Open main menu

lensowiki β

Changes

Help:Inputbox

6,882 bytes added, 21:25, 7 July 2006
Box types
{{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" bgcolor="white" width="79%"
!Type
!Example
|-
! type=search
|
<inputbox>
type=search
</inputbox>
|-
| colspan="2" | Generates a search box with a default width of 50 characters. The button labels can be specified, see below; defaults [[MediaWiki:Tryexact]] and [[MediaWiki:Searchfulltext]]. The text field specifies the search criteria.
|-
! type=create
|
<inputbox>
type=create
</inputbox>
|-
| colspan="2" | Allows creating a new page. The button label can be specified, see below; default [[MediaWiki:Createarticle]]. The text field specifies which page is to be edited.
|-
! type=comment
|
<inputbox>
type=comment
</inputbox>
|-
| colspan="2" | 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; default [[MediaWiki:Postcomment]] also used in the sidebar of the "Standard" skin. The text field specifies which page is to be edited.
|}

{{-}}

== Parameters ==

{| border="1" cellspacing="5" cellpadding="5" frames="border" rules="all" bgcolor="#ffffff"
!Parameter<br />''Scope''
!Example
|-
||'''bgcolor='''<br />''All types''<br />&#160;<br />Sets the table background color (HTML color values). Do not use quotes.
|<pre><inputbox>
type=search
bgcolor=#eeeeff
</inputbox></pre>
<inputbox>
type=search
bgcolor=#eeeeff
</inputbox>
|-
||'''width='''<br />''All types''<br />&#160;<br />Sets the width of the inputbox in characters.
|<pre><inputbox>
type=create
width=24
</inputbox></pre>
<inputbox>
type=create
width=24
</inputbox>
|-
||'''default='''<br />''All types''<br />&#160;<br />Default text to put in the inputbox.
|<pre><inputbox>
type=comment
default=User talk:Eloquence
</inputbox></pre>
<inputbox>
type=comment
default=User talk:Eloquence
</inputbox>
|-
||'''preload='''<br />''comment'', ''create''<br />&#160;<br />The page under this title will be preloaded (see below) into the blank editbox when a new page is created.
|<pre><inputbox>
type=create
preload=MediaWiki:Editthispage
</inputbox></pre>
<inputbox>
type=create
preload=MediaWiki:Editthispage
</inputbox>
|-
|colspan="2"|Enter the title of a non-existent page in the example inputbox above or below, and click "Create article" or "Post a comment" respectively to test this effect.
|-
||'''editintro='''<br />''comment'', ''create''<br />&#160;<br />The text of the page under this title will be added, as instructions, ''before'' the submission form for '''new''' pages.
|<pre><inputbox>
type=comment
editintro=MediaWiki:Missingcommenttext
</inputbox></pre>
<inputbox>
type=comment
editintro=Mediawiki:Missingcommenttext
</inputbox>
|-
||'''buttonlabel='''<br />''All types''<br />&#160;<br />This label will be used for the main button of the form.
|<pre><inputbox>
type=comment
buttonlabel=Add new rumor
</inputbox></pre>
<inputbox>
type=comment
buttonlabel=Add new rumor
</inputbox>
|-
||'''searchbuttonlabel='''<br />''search''<br />&#160;<br />This label will be used for the "Search full text" button of the search form.
|<pre><inputbox>
type=search
searchbuttonlabel=Dig deeper
</inputbox></pre>
<inputbox>
type=search
searchbuttonlabel=Dig deeper
</inputbox>
|-
||'''break='''<br />''All types''<br />&#160;<br />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
width=24
break=no
</inputbox></pre>
<inputbox>
type=create
width=24
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>.
Unfortunately <tt>preload</tt> does not yet work for the [[Special:Upload]] summary.

Please note that variables and templates are not supported in inputbox parameters.

==Preload==
Preloading can be done with an inputbox (see above), but also with a URL like
{{fullurl:m:abc|action=edit&preload=Template:Preload_demo}} which links to the edit box of a new page, preloaded with {{tim|Preload demo}}.

The wikitext of the preloaded page, including noinclude parts and tags but excluding includeonly tags, is loaded into the editbox if the target page does not exist yet. If the target of the preload operation already exists then only its wikitext is loaded, the preload command is ignored.

The fact that the includeonly tags are not included can be utilized by putting "subst:" inside them, to define a noinclude part (without using noinclude tags):

<nowiki>{{<includeonly>subst:</includeonly>#ifeq: {{<includeonly>subst:</includeonly>FULLPAGENAME}}| name&#160;of&#160;preloaded&#160;page| noinclude&#160;part| includeonly&#160;part}}</nowiki>

==Installation==
#Download and save the file [http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/inputbox/inputbox.php inputbox.php] to the ''extensions'' folder of your MediaWiki installation. <!-- This CVS version appears to be old and out of date; use the SVN version above instead: [http://wikipedia.cvs.sourceforge.net/*checkout*/wikipedia/extensions/inputbox/inputbox.php?revision=1.20 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>
#May need to add the following [[User:Algorithm/actionCreate]]

<!-- 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.-->

{{h:f|langs=|enname=Inputbox}}
[[Category:MediaWiki extensions|Inputbox]]
Anonymous user