Расширение:UploadWizard/Кампании
Концепция
UploadWizard может быть настроен так, чтобы вести себя по-разному при задании разных настроек. Часто хочется, чтобы UW на одной вики вёл себя по-разному для различных задач, и в этом случае требуется более одного набора настроек. UW позволяет создавать такие наборы настроек, также называемые кампаниями, которые затем могут быть активированы с помощью добавления одного аргумента в текст ссылки, через которую происходит доступ к UW.
Использование кампании
При переходе к Special:UploadWizard не используется никакая кампания и вы получите конфигурацию загрузчика по умолчанию.
Чтобы получить настройки для кампании, добавьте ?campaign=name, где "name" — имя кампании.
There are more URL parameters available if you want to pre-fill some fields.
You might want to build the URL using a remote tool (e.g. a mobile app or a monuments map page).
More specifically you can use fields[0], fields[1], etc. to fill custom fields.
This works for both text and select fields.
Remember that the values should be URL-encoded to work properly.
More information about building an advanced URL can be found here: Расширение:UploadWizard
Управление кампанией
Конфигурация кампании хранится в виде в пространстве имён Campaign. Вы можете создать новую кампанию, просто создав новую страницу в этом пространстве имен и помещстив в него соответствующие поля.
Чтобы создать новую кампанию, просто пройдите на новую страницу в пространстве имён Campaign, например Campaign:MySuperNeatCampaign, а потом создайте настройки на JSON для кампании, которую вы хотите сделать.
Варианты на JSON
Ниже представлен список параметров кампании, указываемых в файле JSON; как пример см. источник c:Campaign:WikiDaheim-at-bw.
enabled
Это логическая переменная, которая определяет включена кампания или нет. Это требуемое поле, и оно должно присутствовать всегда.
title
Это поле строки, которое содержит отображаемый Заголовок в виде викитекста. Если этот параметр не указан, в качестве заголовка будет отображено название самой кампании.
description
Это поле строки, которое содержит отображаемое описание в виде викитекста.
display
Это поле позволяет указывать какой баннер отображать в UploadWizard
Оно имеет следующие свойства:
| Имя | Описание |
|---|---|
headerLabel |
Задаёт парсинг и отображение викитекста над интерфейсом UploadWizard. |
thanksLabel |
Задаёт парсинг и отображение викитекста по окончании загрузки пользователем. |
homeButton
|
Это кнопка на странице результатов процесса загрузки, которая ведёт на Заглавную страницу Викисклада. Она может быть настроена для отображения другого текста и другой ссылки.
|
beginButton
|
Это кнопка на странице результатов процесса загрузки, которая перезапускает процесс загрузки с теми же параметрами. Она может быть настроена для отображения другого текста и другой ссылки.
|
Параметр ссылки на объект добавляет сообщения в пользовательский интерфейс, которые могут быть переписаны следующими параметрами кампании:
| Имя | Описание |
|---|---|
labelPickImage |
Ярлык чекбоксов |
noticeExistingImage |
Дополнительное уведомление, если изображение для пункта списка уже существует |
noticeUpdateDelay |
Уведомление о задержке, которое отображается в последнем шаге UploadWizard |
tutorial
Это поле позволяет управлять инструкцией, которая отображается до первого шага загрузки.
Оно имеет следующие свойства:
| Имя | Тип | Описание | По умолчанию |
|---|---|---|---|
skip |
Логическое | Уточните, должна ли инструкция быть пропущена или нет. | false
|
template |
Имя файла инструкции в локальной вики или на Викискладе, который необходимо использовать. $1 в названии заменяется текущим языком. | ||
width |
Ширина инструкции, указываемая в пикселях. | 720 |
defaults
Позволяет контролировать информацию по умолчанию, которую нужно добавить для загруженных медиафайлов. Обратите внимание, что пользователь может изменить их по своему усмотрению перед загрузкой.
Оно имеет следующие свойства:
| Имя | Описание |
|---|---|
categories |
Список категорий |
description
|
Описание по умолчанию. Warning: If you are using Flickr as the source of images, description field of the {{Information}} template might be auto generated based on Flickr metadata. This default deletes and replaces it. |
lat |
Широта по умолчанию |
lon |
Долгота по умолчанию |
autoAdd
Specifies wikitext and categories to be added automatically, without user intervention. The user cannot remove or modify these.
Оно имеет следующие свойства:
| Имя | Описание |
|---|---|
categories |
List of categories to be added by default |
wikitext
|
Wikitext to be added by default. The text is placed between the license and categories. |
fields
Specifies custom fields that can be used to request user input during the upload process, and then substituted into the description field of the {{Information}} template during upload. This is an array, and there can be as many fields as necessary.
Each field can have the following properties:
| Имя | Обязательно? | Тип | Описание | По умолчанию |
|---|---|---|---|---|
wikitext |
Обязательно | Wikitext to be placed in the uploaded file's description. $1 is replaced by the value the user typed into the field |
||
label |
По желанию | Wikitext to be parsed and displayed as the label of the field to the user | ||
type |
По желанию | text or select, see below |
text
| |
required |
По желанию | Логическое | Indicate whether the user can go ahead without filling in this field. | false
|
text
A single-line text field. Additional properties available for this type:
maxLength- Maximum length allowed for this field. Defaults to 25. There is currently no way to specify 'no limits', so just set this to a large value if that is the case.initialValue- The initial value to be pre-filled for the field.
Например:
"fields": [
{
"wikitext": "{{en|1=$1}}",
"label": "parameter#1",
"initialValue": "{{subst:PAGENAME}}"
}
],
Will add a field to the upload form with label parameter#1 pre-filled with {{subst:PAGENAME}}.
If you do not change it than a template {{en|1=...}} with filename instead of ..., will be appended to the description field in the {{Information}} template.
Also interestingly the English description field does not show up by default and one can save images without additional description.
If you want a line break before the wikitext, prepend '\n'.
"wikitext": "\n{{en|1=$1}}",
select
A dropdown select field. Additional properties available for this type:
"options": [{"nn": "Please select"}, {"value1": "label 1"}, {"value2": "label 2"}]
Object mapping field values to labels, creating dropdown options. Labels are displayed to users in the select; you can use simple wikitext in them, e.g.:
"{{LangSwitch|de=Unbekannt|fr=Inconnu|es=Desconocido|default=Unknown}}"
The first option will be selected by default.
Once the user selects an option, its value is passed as $1 to the "wikitext" option, similar to how it works for text fields.
licensing
Specifies licensing selection options, both for own work and third party licenses.
Оно имеет следующие свойства:
| Имя | Описание |
|---|---|
ownWorkDefault
|
Specifies if the user should have a choice of selecting between ownwork and third party licenses, or not. The following values are recognized:
|
ownWork
|
Specifies available licenses for own work uploads. Licenses are specified as a list, with a licenses list sub-property. The first item in the list is considered the default. For example, if you wanted to allow CC BY and CC BY-SA with CC BY-SA as the default, you would use:
"ownWork": {
"licenses": [
"cc-by-sa-4.0",
"cc-by-4.0"
]
}
|
thirdParty |
Specifies available licenses for third party uploads. Specified in the same manner as for ownWork |
start
The start of the "active" period for the campaign. This is used mostly for contests where an active period requires different configuration - see #beforeActive, whileActive, and afterActive for more. This value uses strtotime to convert times, so please use compatible time formats. Please note that the time should be expressed in UTC.
end
The end of the "active" period for the campaign. This is used mostly for contests where an active period requires different configuration - see #beforeActive, whileActive, and afterActive for more. This value uses strtotime to convert times, so please use compatible time formats. Please note that the time should be expressed in UTC.
beforeActive / whileActive / afterActive
Specify automatically modified parts of the campaign configuration between the start and end dates. You may use modified versions of the display and autoAdd arrays. The display elements are used as replacements for the existing values, and the autoAdd elements are added to the existing values. Here's an example of the expected structure:
"beforeActive": {
"display": {
"headerLabel": "Foo campaign hasn't started yet"
}
}
Структорированные данные в Кампаниях
UploadWizard allows users to add Structured Data to files in the "Add Data" step of the upload process. Campaign administrators now have the option to disable the Structured Data features (either partially or entirely), or add suggested properties and values to all uploads that are part of a given campaign.
Отключение структурированных данных
The Structured Data features for an UploadWizard Campaign are enabled by default. They can be disabled entirely though:
"wikibase": {
"enabled": false
}
The above example will disable captions in the Describe step and remove the Add Data step completely.
Базовые настройки структурированных данных
Individual components of Structured Data can be disabled/enabled as well. This example disables captions in the Describe step but keeps the Add Data step enabled:
"wikibase": {
"enabled": true,
"captions": false,
"statements": true
}
Default, pre-filled caption values can be added:
{
"enabled": true,
"wikibase": {
"enabled": true,
"captions": true
},
"defaults": {
"caption": "SOME CAPTION"
}
}
By default, this will fill in a caption for the language matching the user's current interface language. So, if the user's interface is in French, the caption language selector will default to French as well. The desired caption language can be explicitly set via HTML link by adding as part of the querystring linking to UploadWizard. In the future, there will be an ability to set the caption language with the campaign JSON config.
Дополнительные поля для структурированных данных
Suggested statements can be added as part of the defaults option described above, under a statements key:
"defaults": {
"statements": [
{
"propertyId": "P1",
"dataType": "wikibase-entityid"
}
]
}
This example will add a widget which allows the user to add values corresponding to property "P1" in Wikibase. Any number of statements can be provided in this way.
To automatically fill in a specific value for a given property, just add a values array to the block above, and include one value.
For properties that require a Wikidata entity as input, use the appropriate Q ID from Wikidata:
"defaults": {
"statements": [
{
"propertyId": "P1",
"dataType": "wikibase-entityid",
"values": [ "Q1" ]
}
]
}
Другие настройки структурированных данных
A new feature allows campaign organizers to enable a "sync to all files" button that will allow users to copy all structured data statements from one file to all other files in a batch upload.
When clicked, this new button will copy the data from the currently selected file and overwrite/discard any existing data on other files in the batch (there will be an alert window informing users of this when the button is clicked).
The allowCopy value defaults to false, and must be set to true in the campaign config file to enable it.
"wikibase": {
"allowCopy": true
}
Finally, campaign administrators can disable the ability of users to add arbitrary statements (they can still add and modify any default statements which are provided).
To do this, a new option called nonDefaultStatements can be set to false (it defaults to true):
"wikibase": {
"nonDefaultStatements": false
}