Jump to content

Erweiterung:InputBox

From mediawiki.org
This page is a translated version of the page Extension:InputBox and the translation is 60% complete.
Outdated translations are marked like this.
MediaWiki-Erweiterungen
InputBox
Freigabestatus: stabil
Einbindung Tag , Seitenaktivität , Suche
Beschreibung Erlaubt Benutzern vorgefertigte HTML-Formulare in Wiki-Seiten einzubauen
Autor(en)
  • Erik Möller
  • Leonardo Pimenta
  • Rob Church
  • Trevor Parscal
  • Daniel Schuba
Letzte Version Continuous updates
MediaWiki >= 1.45
Datenbankänderungen Nein
Lizenz MIT-Lizenz
Herunterladen
  • <inputbox>
Übersetze die InputBox-Erweiterung, wenn sie auf translatewiki.net verfügbar ist
Probleme Offene Aufgaben · Einen Fehler melden

Die Erweiterung InputBox fügt vorprogrammierte HTML-Formularfelder in Wikiseiten ein. Benutzer können mit diesen Formularfeldern interagieren (z.B. durch Schreiben von Text, Auswahl von Menüpunkten, usw.); Dies kann z.B. durch Texteingabe geschehen.

InputBox was originally created by Erik Möller for the purpose of adding a Einen Artikel erstellen box to Wikinews.

Installation

Diese Erweiterung ist in MediaWiki 1.21 und darüber enthalten. The remaining configuration instructions must still be followed.
  • Die Erweiterung herunterladen und die Datei(en) in ein Verzeichnis namens InputBox im Ordner extensions/ ablegen.
    Entwickler und Code-Beitragende sollten stattdessen die Erweiterung von Git installieren, mit:
    cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/InputBox 
  • Folgenden Code am Ende deiner LocalSettings.php -Datei einfügen:
    wfLoadExtension( 'InputBox' ); 
  • Yes Erledigt – Navigiere zu Special:Version in deinem Wiki, um zu überprüfen, ob die Erweiterung erfolgreich installiert wurde.

Beispiel

Box für das Erstellen eines neuen Artikels

Wiki Quelltext

<inputbox> type = create width = 30px <!-- with unit of measurement --> break = no placeholder = Page title </inputbox> 

Ergebnis

Allgemeine Syntax

InputBoxen sind folgendermaßen konstruiert:

<inputbox> type = <!-- <input> type == search search2 create comment commenttitle fulltext move --> bgcolor = <!-- Background color of parent <form>. --> width = <!-- Width of text field (searchbox) in 'characters'. Unit: Characters #Default: 50 --> page = <!-- Wiki pagename (i.e. page title) to post comment to, or move page to. No [[X]]. --> default = <!-- Initial value of the text field. --> preloadtitle = <!-- Content to prepopulate the title field with for a new comment --> preload = <!-- Content to prepopulate the source editor with for a new topic/comment, or new page. --> editintro = <!-- Wiki pagename of page to be transcluded as 'help text' shown above source editor window. --> hidden = <!-- Any value will hide the text field, but not buttons whose links will still work. --> searchbuttonlabel = <!-- Visual label for "Search full text" in type == search == fulltext. --> searchengine = <!-- Either 'MediaSearch' or 'Search'. Defaults to the wiki's value for the search-special-page preference. --> searchtype = <!-- If 'MediaSearch' is selected for searchengine, the result type. One of 'image' (default), 'video', 'audio', 'page', or 'other'. --> fulltextbutton = <!-- Visual label for "Search full text" --> labeltext = <!-- labeltext --> break = <!-- break --> namespaces = <!-- namespaces --> prefix = <!-- prefix --> placeholder = <!-- placeholder --> minor = <!-- minor --> nosummary = <!-- nosummary --> summary = <!-- summary --> id = <!-- id --> inline = <!-- inline --> dir = <!-- dir --> preloadparams[] = <!-- preloadparams[] --> searchfilter = <!-- searchfilter --> useve = <!-- useve --> usedt = <!-- usedt --> arialabel = <!-- arialabel --> buttonlabel = <!-- Visual label for primary search button. --> </inputbox> 

Buttons are not exposed to assistive technology: currently the button elements generated by this template have no accessible label. Screen readers therefore announce only the element role (for example, "Button.") rather than a meaningful label. There is no reliable way to add an accessible label without access to the HTML code.

The type parameter is mandatory. Alle restlichen Parameter sind optional. preloadparams[] können auch mehrmals erscheinen.


Arten der Boxen

Standardmäßig werden die "Absenden"-Knöpfe unterhalb des Eingabefeldes angezeigt.

Der "Absenden"-Knopf kann auch auf die rechte Seite des Eingabefeldes verschoben werden. Dies ist mit dem Zeilenumbruch-Parameter break=no möglich, der den Zeilenumbruch zwischen dem Eingabefeld und dem Knopf entfernt.

Beispielsweise ist es in Suchfeldern sehr nützlich den "Absenden"-Knopf auf der rechten Seite des Eingabefeldes zu positionieren, da sonst das Roll-Down-Menü mit entsprechenden Suchvorschlägen den Knopf unterhalb des Feldes überdeckt.

Typ Beispiel Beschreibung
search
Erzeugt ein Suchfeld mit 50 Zeichen Standardbreite. Der im Suchfeld eingegebene Inhalt wird nach dem genauen Seitentitel (erste Schaltfläche) oder dem Text in den Artikeln (zweite Schaltfläche) durchsucht.
create
Erzeugt eine neue Seite. Eingegebene Informationen werden als Seitentitel der neuen Seite übernommen.

Der im Suchfeld eingegebene Inhalt ist der Name der zu erstellenden Seite (oder der zu bearbeitenden Seite, falls sie bereits existiert).

comment
Fügt einen neuen Abschnitt am unteren Ende der im Eingabefeld angegebenen Seite ein (erstellt die Seite, wenn sie neu ist).
commenttitle
Fügt einen neuen Abschnitt mit der, im Textfeld eingegebenen, Abschnitts-Überschrift ein. Der Titel kann mittels des Parameters default= definiert werden. Die Seite muss mit dem Parameter page= definiert werden. For some reason this does NOT work when using the extension by invoking it with {{#tag}}, only when using ‎<inputbox>. (eingeführt in rev:47203)
fulltext
Ausschließlich Suchfunktion mit Volltextsuche-Knopf, ohne den Ausführen Knopf. (eingeführt in rev:45269)
move
Verschieben einer Seite zu einem anderen Begriff. This also doesn't work when creating it by invoking a tag. (eingeführt in gerrit:97559)

Im Falle von type=search2 befindet sich der Knopf standartmäßig auf der rechten Seite. Zur Zeit ist es leider nicht möglich weitere Parameter in derartige Eingabefelder hinzuzufügen. Dieses Suchfeld durchsucht das gesamte Wiki auf dessen Seiten es platziert wurde.

Typ Beispiel
search2

Parameter

Parameter Beschreibung Bereich Ergebnis Beispiel Kompatibilität
arialabel= Supply the aria-label attribute to the InputBox to ensure generated markup is accessible to screen readers. See ARIA: aria-label attribute. Alle Arten
<inputbox> type=search arialabel=Search the wiki </inputbox> 
1.35
Gerrit change 572050
bgcolor= Definiert die Hintergrundfarbe der Tabelle (HTML Farbwerte). Verwende keine Fußnoten. Alle Arten
<inputbox> type=search bgcolor=gray </inputbox> 
?
width= Definiert die Länge des Eingabefeldes gemessen in Zeichen. Alle Arten
<inputbox> type=create width=24 </inputbox> 
?
default= Standardmäßiger Text, der im Eingabefeld erscheint. Alle Arten
<inputbox> type=comment default=User talk:Eloquence </inputbox> 
?
preloadtitle= Default text to add as the title for a new comment. comment
<inputbox> type=comment preloadtitle=My comment title default=Extension talk:InputBox </inputbox> 
1.45
Gerrit change 1191433
preload= Die Seite unterhalb dieses Titels wird bereits in das leere Eingabefeld vorausberechnet (vergleiche Manual:Erstellen von Seiten mit vorausgefülltem Text ), wenn eine neue Seite erstellt werden soll. create, comment, commenttitle
<inputbox> type=create preload=Log </inputbox> 
?
Füge den Namen einer noch nicht existierenden Seite in dieses als Beispiel dienende Eingabefeld, und klicke auf "Seite erstellen" oder "Neuer Abschnitt" um einen Test durchzuführen.
editintro= Die Seite, welche unterhalb dieses Parameters angegeben ist, wird angezeigt, wenn die Definition oberhalb dieses Bearbeitungsfeldes dies bestimmt. create, comment
<inputbox> type=comment editintro=MediaWiki:Missingcommenttext </inputbox> 
?
buttonlabel= Dieses Label wird vom Zentralen Knopf des Formulars verwendet. Alle Arten
<inputbox> type=comment buttonlabel=Füge einen neuen Abschnitt hinzu </inputbox> 
?
hidden= Dies bewirkt, dass kein Eingabefeld angezeigt wird.

Er wird mit dem Parameter "default" verwendet, der hier nun kein Standard, sondern ein fester Wert des Seitentitels der Seite ist. Any value means yes/true.

create, comment
<inputbox> type=comment editintro=Extension:InputBox/editintro comment preloadtitle=Comment title preload=Extension:InputBox/preload hidden=yes default=Extension talk:InputBox buttonlabel=Füge einen Kommentar auf der Diskussionsseite hinzu </inputbox> 
?
searchbuttonlabel= Dieses Label wird für den Knopf "Gesamten Text durchsuchen" des Suchformulars verwendet. search, fulltext
<inputbox> type=search searchbuttonlabel=Genauere Suche </inputbox> 
?
searchengine= If Extension:MediaSearch is installed, this parameter sets the search special page to either Search or MediaSearch. If this parameter is not used, the user's (or wiki's default) preference will be used. search, search2
<inputbox> type=search searchengine=MediaSearch </inputbox> 
1.45
Gerrit change 1167841
searchtype= If searchengine=MediaSearch, this parameter configures which results' tab to display. One of the following: image, video, audio, page, other search, search2
<inputbox> type=search searchengine=MediaSearch searchtype=audio </inputbox> 
1.46
Gerrit change 1174925
fulltextbutton= Zeige den gesamten Text des Suchknopfes im search2 Formular search2
<inputbox> type=search2 searchbuttonlabel=Genauere Suche fulltextbutton=true </inputbox> 
?
labeltext= Text, der neben dem Knopf gedruckt wird search2
<inputbox> type=search2 searchbuttonlabel=Genauere Suche labeltext=Suche nach: </inputbox> 
?
break= Entweder wird eine Linie zwischen dem Eingabefeld und dem Knopf beziehungsweise den Knöpfen angezeigt, oder nicht. Standardmäßig wird hier yes verwendet (also ein Zeilenumbruch mit Trennlinie). Alle Arten
<inputbox> type=create width=24 break=no </inputbox> 
?
namespaces= Hilfe für Kontrollkästchen für Namensräume in der Volltextsuche.

Mittels "Main**", wird der standardmäßige Artikelnamensraum geprüft.

search, fulltext
<inputbox> type=search namespaces=Main**,Help </inputbox> 
?
prefix=
  • Narrow down search to pages beginning with certain prefix.
Note this only works with certain search back-ends, currently only Extension:CirrusSearch/de . Defaults to empty string (search all pages).
  • Create new page beginning with a certain prefix.
  • In type=move, the prefix is prepended to the default parameter.

Remark: underscores aren't recognized as spaces.

search, fulltext, create

The button below prefixes the name with Special:Mypage/.

<inputbox> type=search prefix={{FULLPAGENAME}}/Archive </inputbox> 
?
placeholder= Define placeholder text that will display in the input box when it is empty. Alle Arten
<inputbox> type=search placeholder=Durchsuche dieses Wiki </inputbox> 
1.19
page= Page to posts comment to, or page to move. comment, move
<inputbox> type=comment page=Project:Sandbox </inputbox> 
minor= Kleine Änderung. comment, create
<inputbox> type=comment page=Project:Sandbox minor=true </inputbox> 
nosummary= Bearbeitungszusammenfassung (Überschrift) ist nicht erforderlich für einen neuen Kommentar. comment
<inputbox> type=commenttitle page=Special:Mypage/inputbox test nosummary=true </inputbox> 
summary= Bearbeitungszusammenfassung oder Verschiebungsgrund. create, move
<inputbox> type=create default=Special:Mypage/inputbox test summary=Foo </inputbox> 
id= ID attribute for ‎<form>. Alle Arten
<inputbox> type=comment page=Project:Sandbox summary=Foo id=bar </inputbox> 
1.23

for some types
inline= Make the InputBox be an inline element (no line break at beginning). Any value means yes/true. search2 Text hier:
Text hier: <inputbox> type=search2 inline=true width=10 </inputbox> 
dir= Von Rechts nach links (rtl) oder von links nach rechts (ltr). Defaults to directionality of the page's language. Alle Arten
<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> 
1.25
searchfilter= Specify parameters to append to the search search, fulltext
<inputbox> type=search searchfilter=insource:foo </inputbox> 
1.30
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 any value. create, comment
<inputbox> type=create break=no useve=true </inputbox> 
usedt= When adding a new section, the input box will open the DiscussionTools new topic tool, if the extension is installed, and this parameter is set to any value. comment, commenttitle
<inputbox> type=commenttitle page=Project:Sandbox usedt=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.


Customizing with CSS

You can customize the inputbox in templates using CSS. First, wrap the inputbox in ‎<div> tags with an unique ID then use CSS selectors to change its appearance. You could also give the inputbox itself an ID and use the ID in the CSS selectors. You could also add a custom search button or icon.


Template:Exampleinputbox
<templatestyles src="Template:Example/styles.css"/><div id = "inputbox-search-wrapper"> {{#tag: inputbox| type = search id = inputbox-search placeholder = Search all pages namespaces = Main**,Help** }}<div class = "inputbox-search-icon"></div> </div> 
Exampleinputbox/styles.css
#inputbox-search-wrapper { box-sizing: border-box;  height: 32px;  display: flex;  border: 1px solid var(--border-color-base, #a2a9b1);  border-radius: 10px; } #inputbox-search-wrapper input { all: unset;  padding-left: 8px;  padding-top: 6px;  padding-bottom: 6px;  width: 180px !important; font-family: 'Helvetica Neue', 'Helvetica', 'Liberation Sans', 'Arial', sans-serif;;  font-size: 14px;  line-height: 20px;  color: var(--color-base--subtle, #72777d); } #inputbox-search-wrapper input::placeholder { font-family: 'Helvetica Neue', 'Helvetica', 'Liberation Sans', 'Arial', sans-serif;;  font-size: 14px;  line-height: 20px;  color: var(--color-base--subtle, #72777d); } #inputbox-search-wrapper input.mw-ui-button, .searchbox .cdx-checkbox--inline, #inputbox-search-wrapper .cdx-button, #inputbox-search-wrapper div.mw-ui-checkbox { display: none; } .inputbox-search-icon {  padding-left: 8px;  width: 25px;  background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/7/7e/Vector_search_icon.svg/18px-Vector_search_icon.svg.png");  background-repeat: no-repeat;  background-position: center;  cursor: pointer; } 

Ausrichtung

Wenn Sie ein rechtsbündiges Eingabefeld erzeugen wollen, dann machen Sie so etwas, wie:

<div style="float:right; width:42em"> <inputbox> type=create </inputbox> </div> 

Gives:


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 used via the #tag parser function with {{#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}} 

Notes

This extension splits the parser cache based on the user interface language (git:e18b7e6), in order to show localized label texts.

Siehe auch