Extension talk:InputBox

Jump to: navigation, search

About this board

Edit description

For the page history, see also here. / previous talk on this page


By clicking "Add topic", you agree to our Terms of Use and agree to irrevocably release your text under the CC BY-SA 3.0 License and GFDL
Loman87 (talkcontribs)

Hi everybody, I want to use the parameter 'prefix=' in my InputBox 'type=fulltext' to limit search within a specific category. I use CirrusSearch as search engine, so it supports queries like 'incategory:[CategoryName]'. So in my Inputbox I would use something like 'prefix=incategory:[CategoryName]'. I tried but in the query results I see it has been searched something like '[wordQueried] prefix:incategory:[CategoryName]'.

I have read in InputBox documentation that this feature was supported just by Lucene; is there any chance to see it working also with other search engines? I think it could be an intersting upgrade for InputBox users. Thanks for your help! Lorenzo

Quiddity (WMF) (talkcontribs)

Hi. The "prefix" parameter is just for finding "pages that start with a specific string their name", so won't work for your purpose here.

I think the "default" parameter might be the closest to what you want. Your users will need to (1) Leave the 'default' as it appears, and (2) add a space after the default. But it will work, as long as you use underscores for multi-word category names. E.g. see this revision. Hope that helps.

Loman87 (talkcontribs)

Hi, thanks for your answer. Yes, the other option is to use the parameter 'default' but I don't like it very much. Is it possible to add this feature for future updates? Thanks, Lorenzo

Quiddity (WMF) (talkcontribs)

I've added a comment at the existing feature-request, Phab:T147951. I'm not sure if any developers are actively working on this extension currently, so patches welcome if you know how to code! Otherwise, it may take a long time.

Loman87 (talkcontribs)

Thanks very much! Unfortunately I am not an actual developer, however I am going to study the source to understand what could be done. Bye!

Quiddity (WMF) (talkcontribs)

This is now possible! documentation update, or example:

Loman87 (talkcontribs)

Thanks for the update! This works just for the Mediawiki 1.28 release?

Quiddity (WMF) (talkcontribs)

Sadly not. This is for the 1.30+ update only, per the documentation diff link.

Reply to "Paramater prefix doesn't work"
Waschl87 (talkcontribs)

In my wiki people create category pages with the input box and some preloaded content. Clicking on the "Create Page" requires my users to save the previewed page. As they do not have to change anything in the new page's content, this is annoying and many of my users don't really get what is going on. Is there any way to skip the preview step and automatically generate the page with the given name and preloaded content?

Quiddity (WMF) (talkcontribs)

There is not a way to do that, using this extension. However you could use the "editintro=" parameter to add a high-visibility message at the top (for example, using "template:welcome" as the editintro value).

Waschl87 (talkcontribs)

Thanks for your reply. Yes I already use the editintro=, but still some of my users get confused. Are you aware of any other extension or workaround which may help?

Quiddity (WMF) (talkcontribs)

Nothing that I know of, I'm afraid.

Waschl87 (talkcontribs)

OK, thanks anyway @Quiddity (WMF)

Reply to "Directly create page without preview"
Acagastya (talkcontribs)

Is there a way to enable spell check?

Ciencia Al Poder (talkcontribs)

On Firefox, right-click inside the textbox enable spell check (or similar, my language is not english)

Acagastya (talkcontribs)

That is not what I am asking. I don't want a hack for that. Just like how the summary textbox provides spellcheck by default, there should be at least an option to enable spell check that works on various browsers.

Ciencia Al Poder (talkcontribs)

Spell check is specific for each browser. Browsers enable it for default on textarea, and disable it for default on normal textbox (being inputbox of this type). My edit summaries don't have spellcheck, maybe it works for you if you have Visual Editor enabled and it uses a textarea instead of a normal texbox for this. Anyway, I don't know of another way to enable it for inputbox and this extension doesn't provide configuration/parameters to enable it.

Acagastya (talkcontribs)

Visual Editor is disabled in my preferences. But spell check is set to true to the summary textbox.

Ciencia Al Poder (talkcontribs)

Maybe you manually enabled it in the past and the browser remembers that?

Acagastya (talkcontribs)

No, I did not enable it manually. But there might be a way, as a design improvement, to add spell check.

Quiddity (WMF) (talkcontribs)

Suggestion filed as phab:T167195, with a note about how FF doesn't enable it for single-line <input type="text"> by default.

In the meantime, you can do what I did, and enable it at all sites, via instructions in https://superuser.com/a/599303

Reply to "Spell check?"
Ibutakov.smartec (talkcontribs)

is there any way to add button or smth to add namespace for new page from list? Ibutakov.smartec (talk) 16:09, 22 April 2016 (UTC)

217.108.170.8 (talkcontribs)

okay, if someone needs solution i will provide it here:

InputBox.classes.php:
	/**
	 * Generate create page form
	 */
	public function getCreateForm() {
		global $wgScript;

		if ( $this->mType == "comment" ) {
			if ( !$this->mButtonLabel ) {
				$this->mButtonLabel = wfMessage( 'inputbox-postcomment' )->text();
			}
		} else {
			if ( !$this->mButtonLabel ) {
				$this->mButtonLabel = wfMessage( 'inputbox-createarticle' )->text();
			}
		}

		$htmlOut = Xml::openElement( 'div',
			array(
				'class' => 'mw-inputbox-centered',
				'style' => $this->bgColorStyle(),
			)
		);
		$createBoxParams = array(
			'name' => 'createbox',
			'class' => 'createbox',
			'action' => $wgScript,
			'method' => 'get'
		);
		if ( $this->mID !== '' ) {
			$createBoxParams['id'] = Sanitizer::escapeId( $this->mID );
		}
		$htmlOut .= Xml::openElement( 'form', $createBoxParams );
		$editArgs = $this->getEditActionArgs();
		$htmlOut .= Html::hidden( $editArgs['name'], $editArgs['value'] );
		$htmlOut .= Html::hidden( 'preload', $this->mPreload );
		foreach ( $this->mPreloadparams as $preloadparams ) {
			$htmlOut .= Html::hidden( 'preloadparams[]', $preloadparams );
		}
		$htmlOut .= Html::hidden( 'editintro', $this->mEditIntro );
		$htmlOut .= Html::hidden( 'summary', $this->mSummary );
		$htmlOut .= Html::hidden( 'nosummary', $this->mNosummary );
		$htmlOut .= Html::hidden( 'prefix', $this->mPrefix );
		$htmlOut .= Html::hidden( 'minor', $this->mMinor );
		if ( $this->mType == 'comment' ) {
			$htmlOut .= Html::hidden( 'section', 'new' );
		}

		global $InputBoxNSList;

		$htmlOut .= Xml::openElement( 'select',
			array(
				'name' => 'ns',
				'class' => 'mw-ui-input mw-ui-input-inline createboxInput',
			)
		);
		foreach ($InputBoxNSList as $NS) {
			$htmlOut .= Xml::openElement( 'option',
				array('value' => $NS,
				)
			);
			$htmlOut .= $NS;
			$htmlOut .= Xml::closeElement( 'option' );
		}	
		$htmlOut .= Xml::closeElement( 'select' );

		$htmlOut .= Xml::openElement( 'input',
			array(
				'type' => $this->mHidden ? 'hidden' : 'text',
				'name' => 'title',
				'class' => $this->getLinebreakClasses() .
					'mw-ui-input mw-ui-input-inline createboxInput',
				'value' => $this->mDefaultText,
				'placeholder' => $this->mPlaceholderText,
				'size' => $this->mWidth,
				'dir' => $this->mDir,
			)
		);
		$htmlOut .= $this->mBR;
		$htmlOut .= Xml::openElement( 'input',
			array(
				'type' => 'submit',
				'name' => 'create',
				'class' => 'mw-ui-button mw-ui-progressive createboxButton',
				'value' => $this->mButtonLabel
			)
		);
		$htmlOut .= Xml::closeElement( 'form' );
		$htmlOut .= Xml::closeElement( 'div' );

		// Return HTML
		return $htmlOut;
	}
InputBox.hooks.php:
	public static function onMediaWikiPerformAction(
		$output,
		$article,
		$title,
		$user,
		$request,
		$wiki
	) {
		if( $wiki->getAction( $request ) !== 'edit' ){
			# not our problem
			return true;
		}
		if( $request->getText( 'prefix', '' ) === '' && $request->getText( 'ns', '' ) === ''){
			# Fine
			return true;
		}

		$params = $request->getValues();

		$title = $params['prefix'];
		if ($request->getText( 'ns', '' ) != ''){
			if ( $params['ns'] !='(main)') { $title .= $params['ns'] . ':'; }
		}
		if ( isset( $params['title'] ) ) {
			$title .= $params['title'];
		}
		unset( $params['ns'] );
		unset( $params['prefix'] );
		$params['title'] = $title;

		global $wgScript;
		$output->redirect( wfAppendQuery( $wgScript, $params ), '301' );
		return false;
	}
Reply to "Namespaces for create form"

How can I allow a user to search by pageid?

1
Stevenpcox (talkcontribs)

I would like users to be able to look up an article based on pageid.

Using ?curid=PAGEID I can add the pageid to a url and go directly to the page. I would like to have a search function where the user input the pageid into a field, mediawiki appends the URL and the desired page opens up.

This should be easy. The only thing I cannot figure out is how to have the user type the pageid into a field and hit enter. From there I can turn it into a variable and inject it into the URL.

Reply to "How can I allow a user to search by pageid?"
Cpiral (talkcontribs)

The namespaces parameter doesn't take the space character. So there's no searching talk namespaces. Quoting or underscoring fails to help. This is an 8 yr old problem?

Please accept the namespace numbers directly that are output the URL. Please accept namespace aliases. Please ignore capitalization. Please ignore whitespace between the field separator. Thanks a lot.

Reply to "Namespaces parameter still broken"

Open created page in new tab. Not in current.

3
Aka sektor (talkcontribs)

How do I get by clicking on the button creation page, go to the new tab and does not remain in the current? What is correct in extension code, if in no other way?

Russian:

Как сделать, чтобы по нажатию на кнопку создания страницы, переходило в новую вкладку, а не оставалась в текущей? Что поправить в коде расширения, если по-другому нельзя?

Ciencia Al Poder (talkcontribs)

Add this JavaScript code to your wiki:

// Create page form: open on new window
$(function(){
  $('form.createbox').attr('target', '_blank');
});
Aka sektor (talkcontribs)

Thank you very much. Work fine.

Dturtill (talkcontribs)

Is there any way that this can be used to create a subpage of the page the button is on, please.

Eg if the button was on a page called January the create button would create a subpage called January/whatever the title was entered

Ciencia Al Poder (talkcontribs)

Yes. Add:

prefix={{FULLPAGENAME}}/
Mattho69 (talkcontribs)

Hi !

Is it possible to use InputBox with VisualEditor ?

Bozomal (talkcontribs)

I guess you are asking about the create article "problem"?

I'm a newbie, so probably what I'm suggesing might be very bad, but worked for me

here is suppoed to be a solution, but not working for me

so I search in the source files and found that if you change the file /extensions/Inputbox/Inputbox.classes.php and change action to veaction (see below) the magic happens. This doesn't work When you are using the parameter prefix, it won't create an article with prefix in the name.

$htmlOut .= Xml::openElement( 'input',
  array(
        'type' => 'hidden',
	'name' => 'veaction',
	'value' => 'edit',
	)
Mpconnick (talkcontribs)

An easier way (now) to do this is add the parameter 'useve' for InputBox. I'm not sure when this was added, but I'm running MediaWiki 1.26.2.

<inputbox>

type=create

break=no

useve=yes

</inputbox>

Mattho69 (talkcontribs)

Thanks for that ;-)

Do you know if using a preload is possible with VisualEditor?

Swennet (talkcontribs)

@Mattho69 Did you manage to get preload working with VisualEditor?

Mpconnick (talkcontribs)

I'm not sure what you mean by preload. I'm pretty new to administering an instance of MediaWiki. Still figuring a lot out. Sorry I can't be of more help.

Mattho69 (talkcontribs)

@Swennet Not yet but I hope this will be available soon

@Mpconnick look at Manual:Creating pages with preloaded text

Thanks :-)

OgreMHDW (talkcontribs)

This is currently a bug in VisualEditor. See bug tracking at https://phabricator.wikimedia.org/T51622

Reply to "VisualEditor"
67.78.106.74 (talkcontribs)

Is there a way to add the ajax search suggestion to an inputbox? Thanks

Stefahn (talkcontribs)

I would like to know this too.
In my eyes the search is no fun if there's no autocompletion / suggestions...

Emijrp (talkcontribs)

I have found a hack to add ajax suggestions to any inputbox. You must add the following code to your MediaWiki:Common.js, and refresh browser cache.

document.getElementById('searchform').action = '/w/index.php';
document.getElementsByName('search')[0].id = 'searchInput';
Reply to "Add SearchSuggest to inputbox?"