Extends
Constructor
new mw.Upload.BookletLayout(config)
#
Create an instance of mw.Upload.BookletLayout
.
Parameters:
Name | Type | Description |
---|---|---|
config |
Object | Configuration options; see also the config parameter for the
Properties: |
Properties
infoForm :OO.ui.FormLayout
#
The form rendered in the second step to get metadata.
Rendered in renderInfoForm
.
Type:
insertForm :OO.ui.FormLayout
#
The form rendered in the third step to show usage.
Rendered in renderInsertForm
.
Type:
uploadForm :OO.ui.FormLayout
#
The form rendered in the first step to get the file object.
Rendered in renderUploadForm
.
Type:
Methods
clear()protected
#
Clear the values of all fields.
createUpload() → {mw.Upload}protected
#
getErrorMessageForStateDetails() → {jQuery.Promise|undefined
}protected
#
undefined
}protected
#
Get an error message (as OO.ui.Error object) that should be displayed to the user for current state and state details.
Returns:
A Promise that will be resolved with an OO.ui.Error.
- Type
-
jQuery.Promise
|
undefined
Get an error message (as OO.ui.Error object) that should be displayed to the user for current state and state details.
getFile() → {File|null
}protected
#
null
}protected
#
Gets the file object from the
upload form
.
getFileWidget() → {OO.ui.SelectFileInputWidget|mw.widgets.StashedFileWidget}
#
Gets the widget for displaying or inputting the file to upload.
Returns:
getFilename() → {string}protected
#
Gets the file name from the
information form
.
getText() → {string}protected
#
Gets the page text from the
information form
.
initialize() → {jQuery.Promise}
#
Initialize for a new upload.
Returns:
Promise resolved when everything is initialized
- Type
- jQuery.Promise
onInfoFormChange()protected
#
Handle change events to the info form.
Fires:
onUploadFormChange()protected
#
Handle change events to the upload form.
Fires:
renderInfoForm() → {OO.ui.FormLayout}protected
#
Renders and returns the information form for collecting
metadata and sets the infoForm
property.
Returns:
- Type
- OO.ui.FormLayout
Renders and returns the information form for collecting
metadata and sets the infoForm
property.
renderInsertForm() → {OO.ui.FormLayout}protected
#
Renders and returns the insert form to show file usage and
sets the insertForm
property.
Returns:
- Type
- OO.ui.FormLayout
Renders and returns the insert form to show file usage and
sets the insertForm
property.
renderUploadForm() → {OO.ui.FormLayout}protected
#
Renders and returns the upload form and sets the
uploadForm
property.
Returns:
- Type
- OO.ui.FormLayout
Renders and returns the upload form and sets the
uploadForm
property.
saveFile() → {jQuery.Promise}protected
#
Saves the stash finalizes upload. Uses
getFilename
, and
getText
to get details from
the form.
Returns:
Rejects the promise with an
error
, or resolves if the upload was successful.
- Type
- jQuery.Promise
Fires:
setFile(file)protected
#
setFilekey(filekey)protected
#
Sets the filekey of a file already stashed on the server as the target of this upload operation.
Parameters:
Name | Type | Description |
---|---|---|
filekey |
string |
Sets the filekey of a file already stashed on the server as the target of this upload operation.
setFilename(filename)protected
#
Prefills the information form
with the given filename.
Parameters:
Name | Type | Description |
---|---|---|
filename |
string |
information form
with the given filename.
updateFilePreview()protected
#
Updates the file preview on the info form when a file is added.
uploadFile() → {jQuery.Promise}protected
#
Uploads the file that was added in the upload form. Uses
getFile
to get the HTML5
file object.
Returns:
- Type
- jQuery.Promise
Fires:
Events
fileSaved(imageInfo)
#
fileUploadProgress(progress, duration)
#
fileUploaded()
#
The file has finished uploading.