Expand all

mw.ForeignStructuredUpload

Upload to another MediaWiki site using structured metadata.

This subclass uses 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.

Classes

BookletLayout

Encapsulates the process of uploading a file to MediaWiki using the mw.ForeignStructuredUpload model.

Extends

Constructor

new mw.ForeignStructuredUpload([target], [apiconfig]) #

Used to represent an upload in progress on the frontend.

Parameters:

Name Type Attributes Description
target string optional
apiconfig Object optional
Source:

Methods

finishStashUpload() → {jQuery.Promise} #

Finish a stash upload.

Returns:

Type
jQuery.Promise
Inherited from:
Source:
Finish a stash upload.

getApi() → {jQuery.Promise.<mw.Api>} #

Get the mw.Api instance used by this Upload object.

Returns:

Type
jQuery.Promise.<mw.Api>
Inherited from:
Source:
Get the mw.Api instance used by this Upload object.

getAutoText() → {boolean} #

Get whether the file page wikitext should be generated server-side.

Returns:

Type
boolean
Inherited from:
Source:
Get whether the file page wikitext should be generated server-side.

getBasename(path) → {string} #

Gets the base filename from a path name.

Parameters:

Name Type Description
path string

Returns:

Type
string
Inherited from:
Source:
Gets the base filename from a path name.

getChunkSize() → {number} #

Get the chunk size used for chunked uploads, in bytes.

Returns:

Type
number
Inherited from:
Source:
Get the chunk size used for chunked uploads, in bytes.

getComment() → {string} #

Get the current value of the edit comment for the upload.

Returns:

Type
string
Inherited from:
Source:
Get the current value of the edit comment for the upload.

getCopyStatus() → {string} #

Get the copyright status for the upload.

Returns:

Type
string
Inherited from:
Source:
Get the copyright status for the upload.

getFile() → {HTMLInputElement|File|Blob} #

Get the file being uploaded.

Returns:

Type
HTMLInputElement | File | Blob
Inherited from:
Source:
Get the file being uploaded.

getFilename() → {string} #

Get the filename, to be finalized on upload.

Returns:

Type
string
Inherited from:
Source:
Get the filename, to be finalized on upload.

getIgnoreWarnings() → {boolean} #

Check if upload warnings will be ignored when publishing.

Returns:

Type
boolean
Inherited from:
Source:
Check if upload warnings will be ignored when publishing.

getImageInfo() → {Object|undefined} #

Get the imageinfo object for the finished upload. Only available once the upload is finished! Don't try to get it beforehand.

Returns:

Type
Object | undefined
Inherited from:
Source:
Get the imageinfo object for the finished upload.

getLicense() → {string} #

Get the license for the upload.

Returns:

Type
string
Inherited from:
Source:
Get the license for the upload.

getSource() → {string} #

Get the source for the upload.

Returns:

Type
string
Inherited from:
Source:
Get the source for the upload.

getState() → {mw.Upload.State} #

Gets the state of the upload.

Returns:

Type
mw.Upload.State
Inherited from:
Source:
Gets the state of the upload.

getStateDetails() → {string} #

Gets details of the current state.

Returns:

Type
string
Inherited from:
Source:
Gets details of the current state.

getText() → {string} #

Get the text of the file page, to be created on file upload.

Returns:

Type
string
Inherited from:
Source:
Get the text of the file page, to be created on file upload.

getWatchlist() → {boolean} #

Get the boolean for whether the file will be watchlisted after upload.

Returns:

Type
boolean
Inherited from:
Source:
Get the boolean for whether the file will be watchlisted after upload.

setAutoText(autotext) #

Set whether the file page wikitext should be generated server-side from the comment, license, copyright status and source, overriding the text.

Parameters:

Name Type Description
autotext boolean
Inherited from:
Source:

Set whether the file page wikitext should be generated server-side from the comment, license, copyright status and source, overriding the text.

setChunkSize(chunkSize) #

Set the chunk size used for chunked uploads, in bytes.

Parameters:

Name Type Description
chunkSize number
Inherited from:
Source:
Set the chunk size used for chunked uploads, in bytes.

setComment(comment) #

Set the edit comment for the upload.

Parameters:

Name Type Description
comment string
Inherited from:
Source:
Set the edit comment for the upload.

setCopyStatus(copyStatus) #

Set the copyright status for the upload.

Parameters:

Name Type Description
copyStatus string
Inherited from:
Source:
Set the copyright status for the upload.

setFile(file) #

Set the file to be uploaded.

Parameters:

Name Type Description
file HTMLInputElement | File | Blob
Inherited from:
Source:
Set the file to be uploaded.

setFilekey(filekey) #

Set the stashed file to finish uploading.

Parameters:

Name Type Description
filekey string
Inherited from:
Source:
Set the stashed file to finish uploading.

setFilename(filename) #

Set the filename, to be finalized on upload.

Parameters:

Name Type Description
filename string
Inherited from:
Source:
Set the filename, to be finalized on upload.

setFilenameFromFile() #

Sets the filename based on the filename as it was on the upload.

Inherited from:
Source:
Sets the filename based on the filename as it was on the upload.

setIgnoreWarnings(ignoreWarnings) #

Set whether to ignore upload warnings when publishing.

Parameters:

Name Type Description
ignoreWarnings boolean
Inherited from:
Source:
Set whether to ignore upload warnings when publishing.

setLicense(license) #

Set the license template for the upload.

Parameters:

Name Type Description
license string
Inherited from:
Source:
Set the license template for the upload.

setSource(source) #

Set the source for the upload.

Parameters:

Name Type Description
source string
Inherited from:
Source:
Set the source for the upload.

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:
Sets the state and state details (if any) of the upload.

setText(text) #

Set the text of the file page, to be created on file upload.

Parameters:

Name Type Description
text string
Inherited from:
Source:
Set the text of the file page, to be created on file upload.

setWatchlist(watchlist) #

Set whether the file should be watchlisted after upload.

Parameters:

Name Type Description
watchlist boolean
Inherited from:
Source:
Set whether the file should be watchlisted after upload.

upload() → {jQuery.Promise} #

Upload the file directly.

Returns:

Type
jQuery.Promise
Inherited from:
Source:
Upload the file directly.

uploadToStash() → {jQuery.Promise} #

Upload the file to the stash to be completed later.

Returns:

Type
jQuery.Promise
Inherited from:
Source:
Upload the file to the stash to be completed later.