Constructor
new mw.ForeignStructuredUpload(targetopt, apiconfigopt)
#
Used to represent an upload in progress on the frontend.
This subclass will upload to a wiki using a structured metadata system similar to (or identical to) the one on Wikimedia Commons.
See https://commons.wikimedia.org/wiki/Commons:Structured_data for a more detailed description of how that system works.
TODO: This currently only supports uploads under CC-BY-SA 4.0, and should really have support for more licenses.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
target |
string |
<optional> |
|
apiconfig |
Object |
<optional> |
Extends
Classes
- BookletLayout
- Class that encapsulates the process of uploading a file to MediaWiki.
Methods
addCategories(categories)
#
Add categories to the upload.
Parameters:
Name | Type | Description |
---|---|---|
categories |
Array.<string> | Array of categories to which this upload will be added. |
addDescription(language, description)
#
Add a description to the upload.
Parameters:
Name | Type | Description |
---|---|---|
language |
string | The language code for the description's language. Must have a template on the target wiki to work properly. |
description |
string | The description of the file. |
clearCategories()
#
Empty the list of categories for the upload.
clearDescriptions()
#
Empty the list of descriptions for the upload.
finishStashUpload() → {jQuery.Promise}
#
getApi() → {jQuery.Promise.<mw.Api>}
#
Get the mw.Api instance used by this Upload object.
- Inherited From:
- Source:
Returns:
- Type
- jQuery.Promise.<mw.Api>
getBasename(path) → {string}
#
Gets the base filename from a path name.
Parameters:
Name | Type | Description |
---|---|---|
path |
string |
- Inherited From:
- Source:
Returns:
- Type
- string
getComment() → {string}
#
Get the current value of the edit comment for the upload.
- Overrides:
- Source:
Returns:
- Type
- string
getFile() → {HTMLInputElement|File|Blob}
#
getFilename() → {string}
#
Get the filename, to be finalized on upload.
- Inherited From:
- Source:
Returns:
- Type
- string
getImageInfo() → {Object|undefined
}
#
undefined
}
#
Get the imageinfo object for the finished upload. Only available once the upload is finished! Don't try to get it beforehand.
- Inherited From:
- Source:
Returns:
- Type
-
Object
|
undefined
getState() → {mw.Upload.State}
#
getStateDetails() → {string}
#
Gets details of the current state.
- Inherited From:
- Source:
Returns:
- Type
- string
getText() → {string}
#
Get the text of the file page, to be created on upload. Brings together several different pieces of information to create useful text.
- Overrides:
- Source:
Returns:
- Type
- string
getWatchlist() → {boolean}
#
Get the boolean for whether the file will be watchlisted after upload.
- Inherited From:
- Source:
Returns:
- Type
- boolean
loadConfig() → {jQuery.Promise}
#
Get the configuration for the form and filepage from the foreign wiki, if any, and use it for this upload.
Returns:
Promise returning config object
- Type
- jQuery.Promise
Get the configuration for the form and filepage from the foreign wiki, if any, and use it for this upload.
setComment(comment)
#
Set the edit comment for the upload.
Parameters:
Name | Type | Description |
---|---|---|
comment |
string |
- Inherited From:
- Source:
setDate(date)
#
Set the date of creation for the upload.
Parameters:
Name | Type | Description |
---|---|---|
date |
Date |
setFile(file)
#
Set the file to be uploaded.
Parameters:
Name | Type | Description |
---|---|---|
file |
HTMLInputElement | File | Blob |
- Inherited From:
- Source:
setFilekey(filekey)
#
Set the stashed file to finish uploading.
Parameters:
Name | Type | Description |
---|---|---|
filekey |
string |
- Inherited From:
- Source:
setFilename(filename)
#
Set the filename, to be finalized on upload.
Parameters:
Name | Type | Description |
---|---|---|
filename |
string |
- Inherited From:
- Source:
setFilenameFromFile()
#
Sets the filename based on the filename as it was on the upload.
- Inherited From:
- Source:
setState(state, stateDetails)
#
Sets the state and state details (if any) of the upload.
Parameters:
Name | Type | Description |
---|---|---|
state |
mw.Upload.State | |
stateDetails |
Object |
- Inherited From:
- Source:
setText(text)
#
Set the text of the file page, to be created on file upload.
Parameters:
Name | Type | Description |
---|---|---|
text |
string |
- Inherited From:
- Source:
setWatchlist(watchlist)
#
Set whether the file should be watchlisted after upload.
Parameters:
Name | Type | Description |
---|---|---|
watchlist |
boolean |
- Inherited From:
- Source:
upload() → {jQuery.Promise}
#
uploadToStash() → {jQuery.Promise}
#
Upload the file to the stash to be completed later.
- Inherited From:
- Source:
Returns:
- Type
- jQuery.Promise