Extension:UploadWizard/Campaigns

From MediaWiki.org
Jump to: navigation, search

Concept[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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.

Campaign options[edit | edit source]

enabled[edit | edit source]

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[edit | edit source]

This field lets you control what banners to display in UploadWizard

It has the following properties:

  • headerLabel - Specifies wikitext to be parsed and displayed above the UploadWizard interface.
  • thanksLabel - Specifies wikitext to be parsed and displayed when the user has finished uploading.

tutorial[edit | edit source]

This field lets you control the tutorial that is shown before the first step of Uploading.

It has the following properties:

  • skip - Boolean specifying if the tutorial should be skipped or not. Defaults to 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. Defaults to 720.

defaults[edit | edit source]

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:

  • categories - List of categories
  • description - Default description
  • lat - Default latitude
  • lon - Default longitude

autoAdd[edit | edit source]

Specifies wikitext and categories to be added automatically, without user intervention. The user cannot remove or modify these.

It has the following properties:

  • categories - List of categories to be added by default
  • wikitext - Wikitext to be added by default

fields[edit | edit source]

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
  • 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.
  • required - Boolean value indicating wether the user can go ahead without filling in this field. Defaults to false.

licensing[edit | edit source]

Specifies licensing selection options, both for own work and third party licenses.

It has the following properties:

  • ownWorkDefault - Specifies if the user should have a choice of selecting between ownwork and third party licenses, or not. The following values are recognized:
    • own - Show only own work licenses
    • notown - Show only third party licenses
    • choice - Let the user choose between own work and third party licenses
  • 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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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