Extension:UploadWizard/Campaigns

%)

Concept
The UploadWizard can be configured to behave in a number of ways using various settings. Often one wants the UW on a single wiki to behave differently for different tasks, in which case more than one set of configuration is needed. The UW allows defining such sets of configuration, also called campaigns, which can then be put into effect by specifying a single argument in the url via which the UW is accessed.

Using a campaign
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.

Campaign administration
Campaign configuration is stored as JSON in the Campaign namespace. You can create a new campaign by simply creating a new page in that namespace, and placing the appropriate fields in it.

To create a new campaign, just go to a new page in the Campaign namespace like Campaign:MySuperNeatCampaign, then create a JSON configuration for the campaign you want to make.

enabled
This is a boolean variable that specifies if the campaign is enabled or not. This is a required field, and must always be present.

title

This is a string field that contains wikitext to be displayed as the Title. If this is absent, the name of the campaign page itself is displayed as title.

description

This is a string field that contains wikitext to be displayed as the description.

display
This field lets you control what banners to display in UploadWizard

It has the following properties:
 * - Specifies wikitext to be parsed and displayed above the UploadWizard interface.
 * - Specifies wikitext to be parsed and displayed when the user has finished uploading.
 * - 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.
 * - The text the button should display
 * - The target the button should lead users to. The keyword  can be used to lead users back to the page they were coming from. See possible URL arguments for a detailed explanation of the expected format.
 * - This is the button on the summary page of an upload process, which restarts the upload process with the same parameters. It can be configured with a different label and a different target.
 * - The text the button should display
 * - The target the button should lead users to. The keyword  can be used to restart the Upload Wizard but prevent it from adding the same object reference to another image.

The object reference feature adds messages to the user interface which can be overridden with the following campaign parameters:
 * - The label of the checkboxes
 * - The additional notice when an image for a list item already exists
 * - 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:


 * - Boolean specifying if the tutorial should be skipped or not. Defaults to false.
 * - 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 of the tutorial, specified in pixels. Defaults to 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:
 * - List of categories
 * - Default description. Warning: If you are using Flickr as the source of images, description field of the template might be auto generated based on Flickr metadata. This default deletes and replaces it.
 * - Default latitude
 * - 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:
 * - List of categories to be added by default
 * - 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 template during upload. This is an array, and there can be as many fields as necessary.

Each field can have the following properties:
 * (required) - Wikitext to be placed in the uploaded file's description.  is replaced by the value the user typed into the field
 * - Wikitext to be parsed and displayed as the label of the field to the user
 * -  (default) or , see below
 * - Boolean value indicating whether the user can go ahead without filling in this field. Defaults to false.

text
A single-line text field. Additional properties available for this type: For example: Will add a field to the upload form with label parameter#1 pre-filled with. If you do not change it than a template  with filename  instead of ..., will be appended to the description field in the  template. Also interestingly the English description field does not show up by default and one can save images without additional description.
 * - 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.
 * - The initial value to be pre-filled for the field.

If you want a line break before the wikitext, prepend '\n'.

select
A dropdown select field. Additional properties available for this type:
 * - 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:
 * - Specifies if the user should have a choice of selecting between ownwork and third party licenses, or not. The following values are recognized:
 * - Show only own work licenses
 * - Show only third party licenses
 * - Let the user choose between own work and third party licenses
 * - Specifies available licenses for own work uploads. Licenses are specified as a list, with a  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:
 * - 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 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 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:

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.

The Structured Data features for an UploadWizard Campaign can be disabled entirely:

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:

Default, pre-filled caption values can be added:

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= 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:

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:

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.

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):