Extension:アップロードウィザード/キャンペーン
概念
アップロードウィザード は様々な設定を使用して多くの動作方法を設定できます。 通常、単一のウィキで異なるタスクに対して異なる動作をさせたい場合があり、その場合は複数の設定が必要です。 UW では、そのような設定セット、別名キャンペーンを定義することができ、それを実施するためには、UW にアクセスする際の URL に単一の引数を指定することで適用できます。
キャンペーンの使用方法
When navigating to Special:UploadWizard, no campaign will be used, so you will get the default configuration.
To get the configuration for a campaign, add ?campaign=name
to the URL, where "name" is the name of the campaign.
キャンペーンの管理
キャンペーンの設定はキャンペーン名前空間にJSON形式で保存されます 新しいキャンペーンは、その名前空間に新しいページを作成し、適切なフィールドを配置するだけで作成できます。
新規キャンペーンを作成するためには、Campaign:MySuperNeatCampaignのようなキャンペーン名前空間の新規ページへ飛び、あなたの作りたいキャンペーンの設定をJSON形式で書き込むだけです。
キャンペーンの設定内容
enabled
これは、キャンペーンが有効かどうかを指定する真偽値変数です。 これは必須の欄で、常に存在する必要があります。
title
タイトルとして表示されるウィキテキストを入力する欄です。 これがない場合、キャンペーン自体の名前がタイトルとして表示されます。
description
説明文として表示されるウィキテキストを入力する欄です。
display
この欄でアップロードウィザードに表示されるバナーを制御できます。
以下のプロパティを持ちます:
Name | Description |
---|---|
headerLabel |
解析されアップロードウィザードのインターフェースの上に表示されるウィキテキストを指定。 |
thanksLabel |
利用者がアップロードを完了した時に解析され表示されるウィキテキストを指定。 |
homeButton
|
This is the button on the summary page of an upload process, which leads users to the Commons Main Page. It can be configured with a different label and a different target.
|
beginButton
|
アップロード中の要約ページに表示されるボタンで、同じパラメータでアップロードをやり直します。 It can be configured with a different label and a different target.
|
The object reference feature adds messages to the user interface which can be overridden with the following campaign parameters:
Name | Description |
---|---|
labelPickImage |
チェックボックスのラベル |
noticeExistingImage |
The additional notice when an image for a list item already exists |
noticeUpdateDelay |
The delay notice that is being displayed in the last step of the upload wizard |
tutorial
This field lets you control the tutorial that is shown before the first step of Uploading.
It has the following properties:
Name | Type | Description | Default |
---|---|---|---|
skip |
Boolean | Specify if the tutorial should be skipped or not. | false
|
template |
Name of the tutorial file on the local wiki or commons to be used. $1 in the name is replaced with the current language. | ||
width |
Width of the tutorial, specified in pixels. | 720 |
defaults
Lets you control the default information to be added for the media uploaded. Note that the user can modify them at will before uploading.
It has the following properties:
Name | Description |
---|---|
categories |
List of categories |
description |
Default 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 |
Default latitude |
lon |
Default longitude |
autoAdd
Specifies wikitext and categories to be added automatically, without user intervention. The user cannot remove or modify these.
It has the following properties:
Name | Description |
---|---|
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:
Name | Required? | Type | Description | Default |
---|---|---|---|---|
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 |
省略可能 | Boolean | 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.
For example:
"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
- Object mapping field values (that will end up in final wikitext) to labels (which will be displayed to the user). The first value will be selected by default.
licensing
Specifies licensing selection options, both for own work and third party licenses.
It has the following properties:
Name | Description |
---|---|
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-3.0",
"cc-by-3.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, and 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"
}
}
Structured Data in Campaigns
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.
Disable structured data
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.
Basic settings of structured data
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 captionlang=<languagecode> 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.
Extra fields for structured data
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" ]
}
]
}
Other settings of structured data
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
}