Extensión:InputBox

This page is a translated version of the page Extension:InputBox and the translation is 29% complete.
Outdated translations are marked like this.
This extension comes with MediaWiki 1.21 and above. Thus you do not have to download it again. However, you still need to follow the other instructions provided.
Manual de extensiones de MediaWiki
InputBox
Estado de lanzamiento: estable
Implementación Etiqueta , Acción de página , Buscar
Descripción Permite a los usuarios añadir formularios HTML predefinidos a las páginas wiki.
Autor(es)
  • Erik Möller
  • Leonardo Pimenta
  • Rob Church
  • Trevor Parscal
  • Daniel Schuba
Última versión Continuous updates
MediaWiki >= 1.42
Cambios de la base de datos No
Licencia MIT Licencia
Descarga
  • <inputbox>
Descargas trimestrales 288 (Ranked 23rd)
Wikis públicos que lo utilizan 10,897 (Ranked 10th)
Traduce la extensión InputBox si está disponible en translatewiki.net
Asuntos Tareas abiertas · Reportar un bug

La extensión InputBox añade formularios web ya creados a páginas web. Los usuarios pueden "llenar" un formulario (introducir texto, seleccionar elementos del menú, etc.) introduciendo texto en el cuadro.

InputBox fue originalmente creada por Erik Möller para añadir un cuadro Crear un artículo a Wikinews.

Instalación

  • Descarga y extrae los archivos en un directorio denominado «InputBox» dentro de la carpeta extensions/.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/InputBox
  • Añade el siguiente código en la parte final de tu archivo LocalSettings.php :
    wfLoadExtension( 'InputBox' );
    
  •   Hecho – Navega a Special:Version en el wiki para verificar que la extensión se haya instalado correctamente.

Ejemplo

Cuadro para empezar un nuevo artículo.

Código wiki

<inputbox>
type=create
width=30
break=no
</inputbox>

Resultado

Sintaxis general

Los cuadros de entrada se construyen así:

<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=
usedt=
arialabel=
</inputbox>

El parámetro type es obligatorio. Todos los demás parámetros son opcionales. preloadparams[] pueden apaeecer más de una vez.

Tipos de cuadros

La ubicación predeterminada del botón/botones "Enviar" es debajo del cuadro de entrada.

El botón "Enviar" se puede mover a la derecha usando el parámetro de salto de línea para eliminar el salto de la línea entre la caja y el botón: break=no.

Tener el botón "$sender" a la derecha es útil para los cuadro de búsqueda cuando las sugerencias de búsqueda ocultarían un botón de búsquedo debajo del cuadro.

tipo Ejemplo Descripción
search
Crea un cuadro de búsqueda que tiene un ancho predeterminado de 50 caracteres. La información añadida en el cuadro de texto busca el título exacto de la página (primer botón) o en el texto de los artículos (segundo botón).
create

Crea una nueva página. La información añadida en el cuadro de texto es el nombre de la página a crear (o página a editar si ya existe).
comment

Añade una nueva sección en la parte inferior de la página especificada en el cuadro de texto (creará la página si es nueva).
commenttitle

Añade una nueva sección con el encabezado de la sección escrito en el cuadro de texto. El título se puede especificar con el parámetro default=. La página debe especificarse con el parámetro page=. For some reason this does NOT work when using the extension by invoking it with {{#tag}}, only when using ‎<inputbox>. (introducido en rev:47203)
fulltext
Busca solo con el botón de búsqueda de texto completo, sin el botón de coincidencia exacta (botón "Ir"). (introducido en rev:45269)
move

Translada la página a un nombre diferente. This also doesn't work when creating it by invoking a tag. (introducido en gerrit:97559)

For type=search2, the default location for the search button is inline 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.

Tipo Ejemplo
search2
 

Parámetros

Parámetro Descripción Scope Compatibility Ejemplo Result
arialabel= Supply the aria-label attribute to the inputbox to allow generated markup be accessible to screen readers All types
1.35
Gerrit change 572050
<inputbox>
type=search
arialabel=Search the Wiki
</inputbox>
bgcolor= Sets the table background color (HTML color values). Do not use quotes. All types ?
<inputbox>
type=search
bgcolor=#eeeeff
</inputbox>
width= Sets the width of the InputBox in characters. All types ?
<inputbox>
type=create
width=24
</inputbox>

default= Default text to put in the InputBox. All types ?
<inputbox>
type=comment
default=User talk:Eloquence
</inputbox>

preload= The page under this title will be preloaded (see Manual:Creando páginas con texto precargado ) 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 "Crear página" or "Sección nueva" 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. All types ?
<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. Any value means yes/true.

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=Dig deeper
</inputbox>
fulltextbutton= Show the full text search button on search2 form search2 ?
<inputbox>
type=search2
searchbuttonlabel=Dig deeper
fulltextbutton=true
</inputbox>
labeltext= Text to display beside the button search2 ?
<inputbox>
type=search2
searchbuttonlabel=Dig deeper
labeltext=Look for: 
</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 "Main**", main article namespace is checked by default.

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 . 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 ?
<inputbox>
type=search
prefix={{FULLPAGENAME}}/Archive
</inputbox>

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


placeholder= Define placeholder text that will display in the input box when it is empty. All types
1.19
<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=commenttitle
page=Special:Mypage/inputbox test
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
1.23
for some 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). Any value means yes/true. 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. All types
<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
1.25
<inputbox>
type=create
preload=Log
preloadparams[]=param1
preloadparams[]=param2
</inputbox>

searchfilter= Specify parameters to append to the search search
1.30
<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 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.

Alignment

If you want to create an inputbox on the right side of the page, do something like:

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

Gives:


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}}

Ve también