Tillägg:InputBox
InputBox Utgivningsstatus: stabil |
|
---|---|
Genomförande | Tagg , Sidhandling , Sök |
Beskrivning | Låter användare lägga till fördefinierade HTML-formulär på wikisidor. |
Författare |
|
Senaste versionen | Continuous updates |
MediaWiki | 1.30+ |
Förändringar i databasen | Nej |
Licenser | MIT-licens |
Ladda ner | |
|
|
Kvartalsnedladdningar | 262 (Ranked 22nd) |
Offentliga wikier som använder | 10,897 (Ranked 10th) |
Översätt tillägget InputBox om det finns tillgängligt på translatewiki.net | |
Ärenden | Öppna ärenden · Rapportera en bugg |
The InputBox extension adds already created HTML forms to wiki pages. Users can "complete" a form (entering text, selecting menu items, etc.) by entering text into the box.
InputBox was originally created by Erik Möller for the purpose of adding a Skapa en artikel box to Wikinews.
Installation
- Ladda ner och placera filen/filerna i en katalog som heter
InputBox
i dinextensions/
-mapp.
Utvecklare och personer som bidrar med kod borde istället installera tillägget från Git, med:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/InputBox - Lägg till följande kod längst ner i din LocalSettings.php -fil:
wfLoadExtension( 'InputBox' );
- Klart – Ta dig till Special:Version på din wiki för att bekräfta att tillägget har installerats ordentligt.
Exempel
Ruta för att starta en ny artikel.
Wikikod
<inputbox> type=create break=no </inputbox>
Resultat
Allmän syntax
Inmatningsrutor är uppbyggda så här:
<inputbox>
type=
bgcolor=
width=
page=
default=
preload=
editintro=
buttonlabel=
hidden=
searchbuttonlabel=
fulltextbutton=
labeltext=
break=
namespaces=
prefix=
placeholder=
minor=
nosummary=
summary=
id=
inline=
dir=
preloadparams[]=
searchfilter=
useve=
arialabel=
</inputbox>
|
Parametern type är obligatorisk. Alla andra parametrar är valfria. preloadparams[] kan användas fler än en gång.
Typer rutor
The default location of the “Skicka” button(s) is below the input box.
The “Skicka” button can be moved to the right by using the line break parameter to eliminate the line break between the box and the button: break=no
.
Having the “Skicka” button to the right is useful for search boxes when search suggestions would otherwise cover up a search button below the search box.
Typ | Exempel | Beskrivning |
---|---|---|
type=search | Skapar en sökruta som har en standardbredd på 50 tecken. Information som läggs till i textrutan söks efter. | |
type=create | Skapar en ny sida. Information som läggs till i textrutan är namnet på sidan som redigeras. | |
type=comment | Lägger till ett nytt avsnitt längst ner på sidan som anges i textrutan. | |
type=commenttitle | Lägger till ett nytt avsnitt med avsnittsrubriken som skrivits in i textrutan. Titeln kan anges med parametern default= . Sidan har angivits med parametern page= . (introducerad i rev:47203)
| |
type=fulltext | Sök endast med sökknappen fulltext, utan knappen "Gå till". (introducerad i rev:45269) | |
type=move | Flytta en sida till ett annat namn. (introducerad i gerrit:97559) |
For type=search2
, the default location for the search button is to the right.
Currently, it does not seem to be possible to add other parameters to this type of input box.
This search box searches the entire wiki that it is placed on.
Typ | Exempel |
---|---|
type=search2 |
Parametrar
Parameter | Beskrivning | Omfattning | Kompatibilitet | Exempel | Resultat | |
---|---|---|---|---|---|---|
arialabel= | Supply the aria-label attribute to the inputbox to allow generated markup be accessible to screen readers | Alla typer |
|
<inputbox> type=search arialabel=Search the Wiki </inputbox> |
||
bgcolor= | Anges tabellens bakgrundsfärg (HTML-färgvärden). Använd inte citat. | Alla typer | ? | <inputbox> type=search bgcolor=#eeeeff </inputbox> |
||
width= | Anges bredd för InputBox i tecken. | Alla typer | ? | <inputbox> type=create width=24 </inputbox> |
||
default= | Standardtext att skriva i InputBox. | Alla typer | ? | <inputbox> type=comment default=User talk:Eloquence </inputbox> |
||
preload= | The page under this title will be preloaded (see Manual:Creating pages with preloaded text ) into the blank editbox when a new page is created. | create, comment, commenttitle | ? | <inputbox> type=create preload=Log </inputbox> |
||
Enter the title of a non-existent page in the example InputBox above or below, and click "Skapa sida" or "Nytt avsnitt" respectively to test this effect. | ||||||
editintro= | The page which is given under this parameter will be shown, as instructions, above the editing window. | create, comment | ? | <inputbox> type=comment editintro=MediaWiki:Missingcommenttext </inputbox> |
||
buttonlabel= | This label will be used for the main button of the form. | Alla typer | ? | <inputbox> type=comment buttonlabel=Add new rumor </inputbox> |
||
hidden= | This specifies that there is no InputBox. It is used with parameter "default", now not being a default, but the fixed value of the name of the page. |
create, comment | ? | <inputbox> type=comment editintro=Extension:InputBox/editintro comment preload=Extension:InputBox/preload hidden=yes default=Extension talk:InputBox buttonlabel=Post a comment on the talk page </inputbox> |
||
searchbuttonlabel= | This label will be used for the "Search full text" button of the search form. | search, fulltext | ? | <inputbox> type=search searchbuttonlabel=Gräv djupare </inputbox> |
||
fulltextbutton= | Show the full text search button on search2 form | search2 | ? | <inputbox> type=search2 searchbuttonlabel=Gräv djupare fulltextbutton=true </inputbox> |
||
labeltext= | Text to print beside the button | search2 | ? | <inputbox> type=search2 searchbuttonlabel=Gräv djupare labeltext=Leta efter: </inputbox> |
||
break= | Whether or not to insert a line break between the input box and the button(s). Defaults to yes (use a line break). | All types | ? | <inputbox> type=create width=24 break=no </inputbox> |
||
namespaces= | Support for namespace checkboxes in fulltext search. With " |
search, fulltext | ? | <inputbox> type=search namespaces=Main**,Help </inputbox> |
||
prefix= |
Remark: underscores aren't recognized as spaces. |
search, fulltext, create | ? | <inputbox> type=search prefix={{FULLPAGENAME}}/Archive </inputbox> |
The button below prefixes the name with | |
placeholder= | Define placeholder text that will display in the input box when it is empty. | All types |
|
<inputbox> type=search placeholder=Search this Wiki </inputbox> |
||
page= | Page to posts comment to, or page to move. | comment, move | <inputbox> type=comment page=Project:Sandbox </inputbox> |
|||
minor= | Minor edit. | comment, create | <inputbox> type=comment page=Project:Sandbox minor=true </inputbox> |
|||
nosummary= | Edit summary (headline) not required for new comment. | comment | <inputbox> type=comment page=Project:Sandbox nosummary=true </inputbox> |
|||
summary= | Edit summary or move reason. | create, move | <inputbox> type=create default=Special:Mypage/inputbox test summary=Foo </inputbox> |
|||
id= | id attribute for <form>. | All types |
|
<inputbox> type=comment page=Project:Sandbox summary=Foo id=bar </inputbox> |
||
inline= | Make the InputBox be an inline element (no line break at beginning). | search2 | Text here: <inputbox> type=search2 inline=true width=10 </inputbox> |
Text here: | ||
dir= | Right to left (rtl) or left to right (ltr). Defaults to directionality of the page's language. | Alla typer | <inputbox> dir=rtl type=comment page=Project:Sandbox summary=Foo </inputbox> |
|||
preloadparams[]= | Specify parameters to the preload text. See Creating pages with preloaded text. | create, comment, commenttitle |
|
<inputbox> type=create preload=Log preloadparams[]=param1 preloadparams[]=param2 </inputbox> |
||
searchfilter= | Specify parameters to append to the search | search |
|
<inputbox> type=search searchfilter=insource:foo </inputbox> |
||
useve= | When creating a page the input box will use the new visual editor, if the extension is installed, and this parameter is set to true. | create, comment | <inputbox> type=create break=no useve=true </inputbox> |
Applying create to an existing page simply gives the edit page.
In that case preload
is ignored.
Applying comment for a new page works.
The texts taken from the MediaWiki:
namespace are of course only examples, any existing page can be used for editintro
or preload
.
Unfortunately preload
does not yet work for the Upload summary.
Alignment
If you want to create an inputbox on the right side of the page, do something like:
<div style="float:{{dir|{{pagelang}}|left|right}}; width:42em">
<inputbox>
type=create
</inputbox>
</div>
Parser function
Using InputBox in a template
In order to create many similar input boxes, InputBox can be used in a template.
However, passing template parameters to InputBox parameters only works if the <inputbox>...</inputbox>
tag is written as {{#tag:inputbox | ...}}
inside the template.
The following example is a template to create a new wiki page from a named template:
{{#tag:inputbox |
type=create
buttonlabel=Create new {{{1|article}}}
preload={{{2|Template:Article}}} }}
When instantiating the template, the first parameter gives the item that is created (default: article
) as spelled out in the button, the second parameter gives the name of the template used to create the item (default: Template:Article
).
E.g., the code for an input box to create a new project from a project template might look like this:
{{Template:CreateNew|project|Template:Project}}
Se även
Det här tillägget används på ett eller fler av Wikimedias projekt. Det betyder förmodligen att tillägget är stabilt och fungerar tillräckligt bra för att användas på högtrafikerade hemsidor. Leta efter tilläggets namn i Wikimedias CommonSettings.php och InitialiseSettings.php-konfigureringsfiler för att se var det har installerats. En fullständig lista över tillägg som installerats på en wiki finns på wikins Special:Version-sida. |