Help:Inputbox: Difference between revisions

Content deleted Content added
Omniplex (talk | contribs)
m 2nd attempt
Addbot (talk | contribs)
m Bot: Migrating 1 interwiki links, now provided by Wikidata on d:q8615333
 
(30 intermediate revisions by 16 users not shown)
Line 1:
{{softredirect|mw:Extension:InputBox}}
{{H:h|editor toc}}
The '''inputbox''' extension is a [[m:MediaWiki|MediaWiki]] extension by Erik Möller to add predefined HTML forms to wiki pages. It was originally created for the purpose of adding a ''Create an article'' box to [[m:Wikinews|Wikinews]]. It requires MediaWiki 1.5 and an extensions script (see ''Installation'' below).
 
== General syntax ==
 
Inputboxes are constructed like this:
 
<pre>
<inputbox>
type=box type
parameter1=value
parameter2=value
</inputbox>
</pre>
 
The ''type'' parameter is mandatory. All other parameters are optional.
 
== Box types ==
 
{| border="1" cellspacing="5" cellpadding="5" frames="border" rules="all" bgcolor="#ffffff" width="80%"
!Type
!Description
!Example
|---
|'''<font id="type_search" />type=search'''
|width="30%"|
Generates a search box with a width of 50 characters<sup>1</sup>. The button labels can be specified, see below; the defaults are [[MediaWiki:Tryexact]] and [[MediaWiki:Searchfulltext]]. The text field specifies the search criteria.
|
<inputbox>
type=search
</inputbox>
|---
|'''<font id="type_create" />type=create'''
|width="30%"|
Allows creating a new page. Note especially the preload= and editintro= options below. The button label can be specified, see below; the default is [[MediaWiki:Createarticle]]. The text field specifies which page is to be edited.
|
<inputbox>
type=create
</inputbox>
|---
|'''<font id="type_comment" />type=comment'''
|width="30%"|
Add one or more sections to an existing page, or create a page, with an edit summary that is automatically the same as the (first) new section header. The button label can be specified, see below; the default is [[MediaWiki:Postcomment]]; note that this message is also used in the sidebar of the old "Standard" skin. The text field specifies which page is to be edited.
|
<inputbox>
type=comment
editintro=Template:Instructions
</inputbox>
|}
 
'''Note <sup>1</sup> :''' The default width doesn't work on old browsers resulting in an input box for one character. Specify a width explicitly (see below), <tt>width=</tt>''n'' works best with ''n'' &lt;= 50 characters for narrow browser windows.
 
== Parameters ==
 
{| border="1" cellspacing="5" cellpadding="5" frames="border" rules="all" bgcolor="#ffffff"
!Parameter<br/>''Scope''
!Description
!Example
|---
|
'''<font id="par_bgcolor" />bgcolor='''<br/>
''All types''
|width="30%"|Sets the table background color (HTML color values). Do not use quotes.
|
<pre>
<inputbox>
type=search
bgcolor=#eeeeff
</inputbox>
</pre>
 
''produces:''
 
<inputbox>
type=search
bgcolor=#eeeeff
</inputbox>
|---
|
'''<font id="par_width" />width='''<br/>
''All types''
|width="30%"|Sets the width of the inputbox in characters, '''required''' for old browsers (see above).
|
<pre>
<inputbox>
type=create
width=6
</inputbox>
</pre>
 
''produces:''
 
<inputbox>
type=create
width=6
</inputbox>
|---
|
'''<font id="par_default" />default='''<br/>
''All types''
|width="30%"|Default text to put in the inputbox.
|
<pre>
<inputbox>
type=comment
default=User talk:Eloquence
</inputbox>
</pre>
 
''produces:''
 
<inputbox>
type=comment
default=User talk:Eloquence
</inputbox>
|---
|'''<font id="par_preload" />preload='''<br/>
''comment'', ''create''
 
|width="30%"|The text of the page under this title will be loaded into the blank editbox when a new page is created. Enter the title of a non-existent page in the example inputbox, and click "Create" to test this effect.
|
<pre>
<inputbox>
type=create
width=20
preload=MediaWiki:Editthispage
</inputbox>
</pre>
 
''produces:''
 
<inputbox>
type=create
width=20
preload=MediaWiki:Editthispage
</inputbox>
|---
|'''<font id="par_editintro" />editintro='''<br/>''comment'', ''create''
|width="30%"|The text of the page under this title will be added, as instructions, ''before'' the submission form for '''new''' pages. Enter the title of a non-existent page in the example inputbox, and click "Create" to test this effect.
|
<pre>
<inputbox>
type=comment
width=20
editintro=MediaWiki:Missingcommenttext
</inputbox>
</pre>
 
''produces:''
 
<inputbox>
type=comment
width=20
editintro=Mediawiki:Missingcommenttext
</inputbox>
|---
|'''<font id="par_buttonlabel" />buttonlabel='''<br/>''All types''
|width="30%"|This label will be used for the main button of the form.
|
<pre>
<inputbox>
type=comment
buttonlabel=Add new rumor
</inputbox>
</pre>
 
''produces:''
 
<inputbox>
type=comment
buttonlabel=Add new rumor
</inputbox>
|---
|'''<font id="par_searchbuttonlabel" />searchbuttonlabel='''<br/>''search''
|width="30%"|This label will be used for the "Search full text" button of the search form.
|
<pre>
<inputbox>
type=search
searchbuttonlabel=Dig deeper
</inputbox>
</pre>
 
''produces:''
 
<inputbox>
type=search
searchbuttonlabel=Dig deeper
</inputbox>
|---
|'''<font id="par_break" />break='''<br/>''yes''
|width="30%"|Whether or not to insert a line break between the input box and the button(s). Defaults to using the line break unless set to '''no'''.
|
<pre>
<inputbox>
type=create
break=no
</inputbox>
</pre>
 
''produces:''
 
<inputbox>
type=create
break=no
</inputbox>
|}
 
Applying ''create ''&#160;to an existing page simply gives the edit page. In that case <tt>editintro</tt> and <tt>preload</tt> are ignored.
Applying ''comment ''&#160;for a new page works, if the page already exists <tt>editintro</tt> is ignored. The texts taken from the
<tt>MediaWiki:</tt> namespace are of course only examples, any existing page can be used for <tt>editintro</tt> or <tt>preload</tt>.
 
==Caveats==
* Variables, parameters, and templates are not allowed in values of parameters of inputbox; see [[Template talk:Inputbox demo]].
 
==Installation==
#Download and save the file [http://cvs.sourceforge.net/viewcvs.py/*checkout*/wikipedia/extensions/inputbox/inputbox.php?rev=1.19 inputbox.php] to the ''extensions'' folder of your MediaWiki installation. Make sure you use this link to download the extension, as the latest version in CVS does not work with the current MediaWiki release branch.
#Open and edit the [[LocalSettings.php]] file by adding the following line near the bottom:
<pre>require_once(&quot;extensions/inputbox.php&quot;);</pre>
NOTE: Make sure that it is still above the closing php tag so that it looks like this:
<pre>
require_once(&quot;extensions/inputbox.php&quot;);
?>
</pre>
<!-- I make the installation more specific because adding the require_once at the top of the LocalSettings.php file (still under the opening "<?php" tag didn't work for me. Putting the line near the bottom of the file did.-->
 
==Examples==
*[[Template talk:New city in Morocco]].
*[[w:Wikipedia:Village pump (proposals)#User talk inputbox]]
 
{{h:f|langs=|enname=Inputbox}}
[[Category:MediaWiki extensions|Inputbox]]