* @return UploadForm
*/
protected function getUploadForm( $message = '', $sessionKey = '' ) {
+ global $wgOut;
+
# Initialize form
$form = new UploadForm( $this->watchCheck(), $this->mForReUpload, $sessionKey );
$form->setTitle( $this->getTitle() );
$form->addPreText( '<div id="uploadtext">' . wfMsgExt( 'uploadtext', 'parse' ) . '</div>');
# Add upload error message
$form->addPreText( $message );
+
+ # Add footer to form
+ $uploadFooter = wfMsgNoTrans( 'uploadfooter' );
+ if ( $uploadFooter != '-' && !wfEmptyMsg( 'uploadfooter', $uploadFooter ) ) {
+ $form->addPostText( '<div id="mw-upload-footer-message">'
+ . $wgOut->parse( $uploadFooter ) . "</div>\n" );
+ }
+
+ return $form;
- return $form;
}
/**
- * TODO: DOCUMENT
+ * Shows the "view X deleted revivions link""
*/
protected function showViewDeletedLinks() {
global $wgOut, $wgUser;
}
/**
- *
+ * Get the descriptor of the fieldset that contains the file source
+ * selection. The section is 'source'
+ *
+ * @return array Descriptor array
*/
protected function getSourceSection() {
global $wgLang, $wgUser, $wgRequest;
return $descriptor;
}
+
/**
- *
+ * Get the messages indicating which extensions are preferred and prohibitted.
+ *
+ * @return string HTML string containing the message
*/
protected function getExtensionsMessage() {
# Print a list of allowed file extensions, if so configured. We ignore
}
/**
- *
+ * Get the descriptor of the fieldset that contains the file description
+ * input. The section is 'description'
+ *
+ * @return array Descriptor array
*/
protected function getDescriptionSection() {
global $wgUser, $wgOut;
'cols' => $cols,
'rows' => 8,
),
+ 'EditTools' => array(
+ 'type' => 'edittools',
+ 'section' => 'description',
+ ),
'License' => array(
'type' => 'select',
'class' => 'Licenses',
if ( $this->mForReUpload )
$descriptor['DestFile']['readonly'] = true;
- global $wgUseAjax, $wgAjaxLicensePreview;
- if ( $wgUseAjax && $wgAjaxLicensePreview )
- $descriptor['AjaxLicensePreview'] = array(
- 'class' => 'UploadAjaxLicensePreview',
- 'section' => 'description'
- );
-
global $wgUseCopyrightUpload;
if ( $wgUseCopyrightUpload ) {
$descriptor['UploadCopyStatus'] = array(
}
/**
- *
+ * Get the descriptor of the fieldset that contains the upload options,
+ * such as "watch this file". The section is 'options'
+ *
+ * @return array Descriptor array
*/
protected function getOptionsSection() {
global $wgOut;
'label-message' => 'ignorewarnings',
'section' => 'options',
),
- 'EditTools' => array(
- 'type' => 'edittools',
- 'section' => 'options',
- ),
);
- $uploadFooter = wfMsgNoTrans( 'uploadfooter' );
- if ( $uploadFooter != '-' && !wfEmptyMsg( 'uploadfooter', $uploadFooter ) )
- $descriptor['UploadFooter'] = array(
- 'type' => 'info',
- 'id' => 'mw-upload-footer-message',
- 'default' => $wgOut->parse( $uploadFooter ),
- );
-
return $descriptor;
}
/**
- *
+ * Add the upload JS and show the form.
*/
public function show() {
$this->addUploadJS();
}
/**
- *
+ * Add upload JS to $wgOut
+ *
+ * @param bool $autofill Whether or not to autofill the destination
+ * filename text box
*/
protected function addUploadJS( $autofill = true ) {
global $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview;
}
}
+ /**
+ * Empty function; submission is handled elsewhere.
+ *
+ * @return bool false
+ */
function trySubmit() {
return false;
}
}
/**
- * TODO: DOCUMENT
+ * A form field that contains a radio box in the label
*/
class UploadSourceField extends HTMLTextField {
function getLabelHtml() {
}
}
-/**
- * TODO: Document
- * TODO: This can be migrated to JS only
- */
-class UploadAjaxLicensePreview extends HTMLFormField {
- public function getTableRow( $value ) {
- return "<tr><td></td><td id=\"mw-license-preview\"></td></tr>\n";
- }
- public function getInputHTML( $value ) {
- return '';
- }
-}
\ No newline at end of file
optionsTable.appendChild( row );
}
- // License selector check
- document.getElementById( 'wpLicense' ).onchange = licenseSelectorCheck;
+ if ( wgAjaxLicensePreview ) {
+ // License selector check
+ document.getElementById( 'wpLicense' ).onchange = licenseSelectorCheck;
+
+ // License selector table row
+ var wpLicense = document.getElementById( 'wpLicense' );
+ var wpLicenseRow = wpLicense.parentNode.parentNode;
+ var wpLicenseTbody = wpLicenseRow.parentNode;
+
+ var row = document.createElement( 'tr' );
+ var td = document.createElement( 'td' );
+ row.appendChild( td );
+ td = document.createElement( 'td' );
+ td.id = 'mw-license-preview';
+ row.appendChild( td );
+
+ wpLicenseTbody.insertBefore( row, wpLicenseRow.nextSibling );
+ }
+
// fillDestFile setup
for ( var i = 0; i < wgUploadSourceIds.length; i++ )