Расширение:InputBox
![]() Статус релиза: стабильно |
|
---|---|
![]() |
|
Реализация | Тег , Действие страницы , Поиск |
Описание | Позволяет пользователям добавлять предопределенные HTML формы на вики-страницы |
Автор(ы) |
|
Последняя версия | Continuous updates |
MediaWiki | 1.30+ |
Изменения в БД | Нет |
Лицензия | MIT License |
Скачать | |
|
|
Quarterly downloads | 488 (Ranked 17th) |
Public wikis using | 7,250 (Ranked 8th) |
Переведите расширение InputBox, если оно доступно на translatewiki.net | |
Проблемы | Открытые задачи · Сообщить об ошибке |
Расширение InputBox добавляет уже созданные HTML формы к страницам вики. Пользователи могут «заполнить» форму (вводя текст, выбирая пункты меню и т. Д.), вводя текст в поле.
InputBox был первоначально создан пользователем Erik Möller с целью добавления поля Создать статью для Викиновостей.
Установка
- Скачайте и распакуйте файл(ы) в папку с названием
InputBox
в вашей папкеextensions/
. - Добавьте следующий код внизу вашего
LocalSettings.php
:wfLoadExtension( 'InputBox' );
- Готово – Перейдите на страницу Special:Version на своей вики, чтобы удостовериться в том, что расширение успешно установлено.
Примеры
Поле, позволяющее задать новый заголовок
Вики-код
<inputbox>
type=create
break=no
</inputbox>
Результат
Общий синтаксис
Поля ввода конструируются примерно следующим способом:
<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>
|
Параметр type обязателен. Все другие параметры не обязательны. preloadparams[] могут использоваться более одного раза.
Типы полей
Положение "по умолчанию" кнопки(кнопок) “Отправить” ниже поля ввода.
Кнопка “Отправить” может быть сдвинута вправо с помощью параметра разрыва строки чтобы устранить разрыв строки между полем и кнопкой: break=no
.
Положение кнопки “Отправить” справа полезно для полей поиска, когда поисковые запросы могли бы перекрыть кнопку поиска под окном поиска.
Тип | Пример | Описание |
---|---|---|
type=search | Создает окно поиска с шириной по умолчанию 50 символов. Ищет информацию, добавленную в текстовое поле. | |
type=create | Создание новой страницы Информация, добавленная в текстовое поле, - это имя редактируемой страницы. | |
type=comment | Добавляет новый раздел в нижней части страницы, указанной в текстовом поле. | |
type=commenttitle | Добавляет новый раздел с заголовком раздела, введенным в текстовое поле. Заголовок может быть указан параметром default= . Страница должна быть указана с параметром page= . (введено в rev:47203)
| |
type=fulltext | Искать только с помощью кнопки полнотекстового поиска без кнопки “Перейти”. (введено в rev:45269) | |
type=move | Переместите страницу на другое имя. (введено в gerrit:97559) |
Для type=search2
расположение по умолчанию для кнопки поиска находится справа.
В настоящее время не представляется возможным добавлять другие параметры в этот тип поля ввода.
В этом поле поиска выполняется поиск по всей вики, в которую он помещен.
Тип | Пример |
---|---|
type=search2 |
Параметры
Параметр | Описание | Область | Совместимость | Пример | Результат | |
---|---|---|---|---|---|---|
arialabel= | Supply the aria-label attribute to the inputbox to allow generated markup be accessible to screen readers | Все типы |
|
<inputbox>
type=search
arialabel=Search the Wiki
</inputbox>
|
||
bgcolor= | Устанавливает цвет фона таблицы (значения цвета HTML). Не используйте кавычки | Все типы | ? | <inputbox>
type=search
bgcolor=#eeeeff
</inputbox>
|
||
width= | Устанавливает ширину InputBox в символах. | Все типы | ? | <inputbox>
type=create
width=24
</inputbox>
|
||
default= | Текст по умолчанию для ввода в InputBox. | Все типы | ? | <inputbox>
type=comment
default=User talk:Eloquence
</inputbox>
|
||
preload= | The page under this title will be preloaded (see Manual:Создание страниц с предзагрузкой текста ) into the blank editbox when a new page is created. | create, comment, commenttitle | ? | <inputbox>
type=create
preload=Log
</inputbox>
|
||
Введите название несуществующей страницы в примере InputBox выше или ниже и нажмите Создать статью или Новый раздел соответственно, чтобы проверить этот эффект. | ||||||
editintro= | Страница, указанная в этом параметром, будет отображаться в виде инструкций над окном редактирования. | create, comment | ? | <inputbox>
type=comment
editintro=MediaWiki:Missingcommenttext
</inputbox>
|
||
buttonlabel= | Эта надпись будет использоваться как главная кнопка для формы. | Все типы | ? | <inputbox>
type=comment
buttonlabel=Add new rumor
</inputbox>
|
||
hidden= | Это означает, что тут нет 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=Оставить комментарий на странице обсуждения
</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= | Текст для отображения рядом с кнопкой | 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 " |
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=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 |
|
<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. | Все типы | <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.
Выравнивание
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>
Функция парсера
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=Создать новую {{{1|статью}}}
preload={{{2|Template:Article}}} }}
При создании экземпляра шаблона первый параметр дает элемент, который создается (по умолчанию: article
), как указано в кнопке, второй параметр указывает имя шаблона, используемого для создания элемента (по умолчанию: Template:Article
).
Например, код для окна ввода для создания нового проекта из шаблона проекта может выглядеть следующим образом:
{{Template:CreateNew|project|Template:Project}}
Смотрите также
Это расширение используется в одном или нескольких проектах Викимедиа. Вероятно, это означает, что расширение стабильно и работает достаточно хорошо, чтобы использоваться такими сайтами с высоким трафиком. Найдите название этого расширения в файлах конфигурации Викимедиа CommonSettings.php и InitialiseSettings.php, чтобы узнать, где оно установлено. Полный список расширений, установленных на конкретной вики, можно увидеть на странице Special:Version wiki. |
Это расширение включено в следующие пакеты и/или вики-фермы: This is not an authoritative list. Some wiki farms/hosts may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |