MediaWiki REL1_32
UploadForm Class Reference

Sub class of HTMLForm that provides the form section of SpecialUpload. More...

Inheritance diagram for UploadForm:
Collaboration diagram for UploadForm:

Public Member Functions

 __construct (array $options=[], IContextSource $context=null, LinkRenderer $linkRenderer=null)
 
 show ()
 Add the upload JS and show the form.
 
 trySubmit ()
 Empty function; submission is handled elsewhere.
 
- Public Member Functions inherited from HTMLForm
 __construct ( $descriptor, $context=null, $messagePrefix='')
 Build a new HTMLForm from an array of field attributes.
 
 addButton ( $data)
 Add a button to the form.
 
 addFooterText ( $msg, $section=null)
 Add footer text, inside the form.
 
 addHeaderText ( $msg, $section=null)
 Add HTML to the header, inside the form.
 
 addHiddenField ( $name, $value, array $attribs=[])
 Add a hidden field to the output.
 
 addHiddenFields (array $fields)
 Add an array of hidden fields to the output.
 
 addPostText ( $msg)
 Add text to the end of the display.
 
 addPreText ( $msg)
 Add HTML to introductory message.
 
 displayForm ( $submitResult)
 Display the form (sending to the context's OutputPage object), with an appropriate error message or stack of messages, and any validation errors, etc.
 
 displaySection ( $fields, $sectionName='', $fieldsetIDPrefix='', &$hasUserVisibleFields=false)
 
 filterDataForSubmit ( $data)
 Overload this if you want to apply special filtration routines to the form as a whole, after it's submitted but before it's processed.
 
 formatErrors ( $errors)
 Format a stack of error messages into a single HTML string.
 
 getAction ()
 Get the value for the action attribute of the form.
 
 getBody ()
 Get the whole body of the form.
 
 getButtons ()
 Get the submit and (potentially) reset buttons.
 
 getDisplayFormat ()
 Getter for displayFormat.
 
 getErrors ( $errors)
 Format and display an error message stack.
 
 getErrorsOrWarnings ( $elements, $elementsType)
 Returns a formatted list of errors or warnings from the given elements.
 
 getField ( $fieldname)
 
 getFooterText ( $section=null)
 Get footer text.
 
 getHeaderText ( $section=null)
 Get header text.
 
 getHiddenFields ()
 Get the hidden fields that should go inside the form.
 
 getHTML ( $submitResult)
 Returns the raw HTML generated by the form.
 
 getLegend ( $key)
 Get a string to go in the "<legend>" of a section fieldset.
 
 getMethod ()
 
 getPreText ()
 Get the introductory message HTML.
 
 getSubmitText ()
 Get the text for the submit button, either customised or a default.
 
 getTitle ()
 Get the title.
 
 hasField ( $fieldname)
 
 loadData ()
 Construct the form fields from the Descriptor array.
 
 needsJSForHtml5FormValidation ()
 Whether this form, with its current fields, requires the user agent to have JavaScript enabled for the client-side HTML5 form validation to work correctly.
 
 prepareForm ()
 Prepare form for submission.
 
 setAction ( $action)
 Set the value for the action attribute of the form.
 
 setAutocomplete ( $autocomplete)
 Set the value for the autocomplete attribute of the form.
 
 setCancelTarget ( $target)
 Sets the target where the user is redirected to after clicking cancel.
 
 setDisplayFormat ( $format)
 Set format in which to display the form.
 
 setFooterText ( $msg, $section=null)
 Set footer text, inside the form.
 
 setFormIdentifier ( $ident)
 Set an internal identifier for this form.
 
 setHeaderText ( $msg, $section=null)
 Set header text, inside the form.
 
 setId ( $id)
 
 setIntro ( $msg)
 Set the introductory message, overwriting any existing message.
 
 setMessagePrefix ( $p)
 Set the prefix for various default messages.
 
 setMethod ( $method='post')
 Set the method used to submit the form.
 
 setName ( $name)
 
 setPostText ( $msg)
 Set text at the end of the display.
 
 setPreText ( $msg)
 Set the introductory message HTML, overwriting any existing message.
 
 setSubmitCallback ( $cb)
 Set a callback to a function to do something with the form once it's been successfully validated.
 
 setSubmitDestructive ()
 Identify that the submit button in the form has a destructive action.
 
 setSubmitID ( $t)
 Set the id for the submit button.
 
 setSubmitName ( $name)
 
 setSubmitProgressive ()
 Identify that the submit button in the form has a progressive action.
 
 setSubmitText ( $t)
 Set the text for the submit button.
 
 setSubmitTextMsg ( $msg)
 Set the text for the submit button to a message.
 
 setSubmitTooltip ( $name)
 
 setTableId ( $id)
 Set the id of the \<table\> or outermost \<div\> element.
 
 setTitle ( $t)
 Set the title for form submission.
 
 setTokenSalt ( $salt)
 Set the salt for the edit token.
 
 setValidationErrorMessage ( $msg)
 Set a message to display on a validation error.
 
 setWrapperLegend ( $legend)
 Prompt the whole form to be wrapped in a "<fieldset>", with this text as its "<legend>" element.
 
 setWrapperLegendMsg ( $msg)
 Prompt the whole form to be wrapped in a "<fieldset>", with this message as its "<legend>" element.
 
 showAlways ()
 Same as self::show with the difference, that the form will be added to the output, no matter, if the validation was good or not.
 
 showCancel ( $show=true)
 Show a cancel button (or prevent it).
 
 suppressDefaultSubmit ( $suppressSubmit=true)
 Stop a default submit button being shown for this form.
 
 suppressReset ( $suppressReset=true)
 Stop a reset button being shown for this form.
 
 tryAuthorizedSubmit ()
 Try submitting, with edit token check first.
 
 wasSubmitted ()
 Test whether the form was considered to have been submitted or not, i.e.
 
 wrapForm ( $html)
 Wrap the form innards in an actual "<form>" element.
 
- Public Member Functions inherited from ContextSource
 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage().
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID.
 
 getConfig ()
 
 getContext ()
 Get the base IContextSource object.
 
 getLanguage ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getStats ()
 
 getTiming ()
 
 getUser ()
 
 getWikiPage ()
 Get the WikiPage object.
 
 msg ( $key)
 Get a Message object with context set Parameters are the same as wfMessage()
 
 setContext (IContextSource $context)
 

Protected Member Functions

 addUploadJS ()
 Add upload JS to the OutputPage.
 
 getDescriptionSection ()
 Get the descriptor of the fieldset that contains the file description input.
 
 getExtensionsMessage ()
 Get the messages indicating which extensions are preferred and prohibitted.
 
 getOptionsSection ()
 Get the descriptor of the fieldset that contains the upload options, such as "watch this file".
 
 getSourceSection ()
 Get the descriptor of the fieldset that contains the file source selection.
 
- Protected Member Functions inherited from HTMLForm
 formatSection (array $fieldsHtml, $sectionName, $anyFieldHasLabel)
 Put a form section together from the individual fields' HTML, merging it and wrapping.
 
 getFormAttributes ()
 Get HTML attributes for the <form> tag.
 
 getMessage ( $value)
 Turns a *-message parameter (which could be a MessageSpecifier, or a message name, or a name + parameters array) into a Message.
 
 wrapFieldSetSection ( $legend, $section, $attributes, $isRoot)
 Wraps the given $section into an user-visible fieldset.
 

Protected Attributes

 $mComment
 
 $mDestFile
 
 $mDestWarningAck
 
 $mForReUpload
 
 $mHideIgnoreWarning
 
 $mMaxFileSize = []
 
 $mMaxUploadSize = []
 
 $mSessionKey
 
 $mSourceIds
 
 $mTextAfterSummary
 
 $mTextTop
 
 $mWatch
 
- Protected Attributes inherited from HTMLForm
array $availableDisplayFormats
 Available formats in which to display the form.
 
array $availableSubclassDisplayFormats
 Available formats in which to display the form.
 
string $displayFormat = 'table'
 Format in which to display form.
 
bool string $mAction = false
 Form action URL.
 
string null $mAutocomplete = null
 Form attribute autocomplete.
 
 $mButtons = []
 
 $mCancelTarget
 
 $mFieldTree
 
HTMLFormField[] $mFlatFields
 
 $mFooter = ''
 
 $mFormIdentifier
 
 $mHeader = ''
 
 $mHiddenFields = []
 
 $mId
 
 $mMessagePrefix
 
 $mMethod = 'post'
 
 $mName
 
 $mPost = ''
 
 $mPre = ''
 
 $mSectionFooters = []
 
 $mSectionHeaders = []
 
 $mShowCancel = false
 
 $mShowReset = false
 
 $mShowSubmit = true
 
 $mSubmitCallback
 
 $mSubmitFlags = [ 'primary', 'progressive' ]
 
 $mSubmitID
 
 $mSubmitName
 
 $mSubmitText
 
 $mSubmitTooltip
 
 $mSubSectionBeforeFields = true
 If true, sections that contain both fields and subsections will render their subsections before their fields.
 
 $mTableId = ''
 
 $mTitle
 
string array $mTokenSalt = ''
 Salt for the edit token.
 
 $mUseMultipart = false
 
 $mValidationErrorMessage
 
 $mWasSubmitted = false
 
 $mWrapperLegend = false
 

Additional Inherited Members

- Static Public Member Functions inherited from HTMLForm
static factory ( $displayFormat)
 Construct a HTMLForm object for given display type.
 
static getClassFromDescriptor ( $fieldname, &$descriptor)
 Get the HTMLFormField subclass for this descriptor.
 
static loadInputFromParameters ( $fieldname, $descriptor, HTMLForm $parent=null)
 Initialise a new Object for the field.
 
- Public Attributes inherited from HTMLForm
 $mFieldData
 
- Static Public Attributes inherited from HTMLForm
static $typeMappings
 

Detailed Description

Sub class of HTMLForm that provides the form section of SpecialUpload.

Definition at line 27 of file UploadForm.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ addUploadJS()

UploadForm::addUploadJS ( )
protected

◆ getDescriptionSection()

UploadForm::getDescriptionSection ( )
protected

Get the descriptor of the fieldset that contains the file description input.

The section is 'description'

Returns
array Descriptor array

Definition at line 253 of file UploadForm.php.

References $e, $mComment, $mDestFile, $mTextAfterSummary, HTMLForm\addHeaderText(), ContextSource\getConfig(), ContextSource\getUser(), and RepoGroup\singleton().

Referenced by __construct().

◆ getExtensionsMessage()

UploadForm::getExtensionsMessage ( )
protected

Get the messages indicating which extensions are preferred and prohibitted.

Returns
string HTML string containing the message

Definition at line 206 of file UploadForm.php.

References ContextSource\getConfig(), ContextSource\getLanguage(), and ContextSource\msg().

Referenced by getSourceSection().

◆ getOptionsSection()

UploadForm::getOptionsSection ( )
protected

Get the descriptor of the fieldset that contains the upload options, such as "watch this file".

The section is 'options'

Returns
array Descriptor array

Definition at line 352 of file UploadForm.php.

References $mWatch, $user, and ContextSource\getUser().

Referenced by __construct().

◆ getSourceSection()

UploadForm::getSourceSection ( )
protected

◆ show()

UploadForm::show ( )

Add the upload JS and show the form.

Reimplemented from HTMLForm.

Definition at line 394 of file UploadForm.php.

References addUploadJS().

◆ trySubmit()

UploadForm::trySubmit ( )

Empty function; submission is handled elsewhere.

Returns
bool False

Reimplemented from HTMLForm.

Definition at line 436 of file UploadForm.php.

Member Data Documentation

◆ $mComment

UploadForm::$mComment
protected

Definition at line 35 of file UploadForm.php.

Referenced by getDescriptionSection().

◆ $mDestFile

UploadForm::$mDestFile
protected

Definition at line 33 of file UploadForm.php.

Referenced by getDescriptionSection().

◆ $mDestWarningAck

UploadForm::$mDestWarningAck
protected

Definition at line 32 of file UploadForm.php.

◆ $mForReUpload

UploadForm::$mForReUpload
protected

Definition at line 29 of file UploadForm.php.

◆ $mHideIgnoreWarning

UploadForm::$mHideIgnoreWarning
protected

Definition at line 31 of file UploadForm.php.

◆ $mMaxFileSize

UploadForm::$mMaxFileSize = []
protected

Definition at line 41 of file UploadForm.php.

◆ $mMaxUploadSize

UploadForm::$mMaxUploadSize = []
protected

Definition at line 43 of file UploadForm.php.

Referenced by addUploadJS().

◆ $mSessionKey

UploadForm::$mSessionKey
protected

Definition at line 30 of file UploadForm.php.

Referenced by getSourceSection().

◆ $mSourceIds

UploadForm::$mSourceIds
protected

Definition at line 39 of file UploadForm.php.

Referenced by addUploadJS().

◆ $mTextAfterSummary

UploadForm::$mTextAfterSummary
protected

Definition at line 37 of file UploadForm.php.

Referenced by getDescriptionSection().

◆ $mTextTop

UploadForm::$mTextTop
protected

Definition at line 36 of file UploadForm.php.

Referenced by getSourceSection().

◆ $mWatch

UploadForm::$mWatch
protected

Definition at line 28 of file UploadForm.php.

Referenced by getOptionsSection().


The documentation for this class was generated from the following file: