r57991 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57990‎ | r57991 | r57992 >
Date:21:29, 21 October 2009
Author:btongminh
Status:ok
Tags:
Comment:
* Bump wgStyleVersion for various upload javascript edits in this revision and r57868.
* Show the upload footer message outside of the form
* Document some remaining SpecialUpload functions
* Move upload edittools to just below the textarea
* Add the license preview table row in javascript entirely
* Fill in a forgotten message
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUpload.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/skins/common/upload.js (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/DefaultSettings.php
@@ -1605,7 +1605,7 @@
16061606 * to ensure that client-side caches do not keep obsolete copies of global
16071607 * styles.
16081608 */
1609 -$wgStyleVersion = '244';
 1609+$wgStyleVersion = '245';
16101610
16111611
16121612 # Server-side caching:
Index: trunk/phase3/includes/specials/SpecialUpload.php
@@ -183,6 +183,8 @@
184184 * @return UploadForm
185185 */
186186 protected function getUploadForm( $message = '', $sessionKey = '' ) {
 187+ global $wgOut;
 188+
187189 # Initialize form
188190 $form = new UploadForm( $this->watchCheck(), $this->mForReUpload, $sessionKey );
189191 $form->setTitle( $this->getTitle() );
@@ -196,12 +198,20 @@
197199 $form->addPreText( '<div id="uploadtext">' . wfMsgExt( 'uploadtext', 'parse' ) . '</div>');
198200 # Add upload error message
199201 $form->addPreText( $message );
 202+
 203+ # Add footer to form
 204+ $uploadFooter = wfMsgNoTrans( 'uploadfooter' );
 205+ if ( $uploadFooter != '-' && !wfEmptyMsg( 'uploadfooter', $uploadFooter ) ) {
 206+ $form->addPostText( '<div id="mw-upload-footer-message">'
 207+ . $wgOut->parse( $uploadFooter ) . "</div>\n" );
 208+ }
 209+
 210+ return $form;
200211
201 - return $form;
202212 }
203213
204214 /**
205 - * TODO: DOCUMENT
 215+ * Shows the "view X deleted revivions link""
206216 */
207217 protected function showViewDeletedLinks() {
208218 global $wgOut, $wgUser;
@@ -644,7 +654,10 @@
645655 }
646656
647657 /**
648 - *
 658+ * Get the descriptor of the fieldset that contains the file source
 659+ * selection. The section is 'source'
 660+ *
 661+ * @return array Descriptor array
649662 */
650663 protected function getSourceSection() {
651664 global $wgLang, $wgUser, $wgRequest;
@@ -710,8 +723,11 @@
711724 return $descriptor;
712725 }
713726
 727+
714728 /**
715 - *
 729+ * Get the messages indicating which extensions are preferred and prohibitted.
 730+ *
 731+ * @return string HTML string containing the message
716732 */
717733 protected function getExtensionsMessage() {
718734 # Print a list of allowed file extensions, if so configured. We ignore
@@ -745,7 +761,10 @@
746762 }
747763
748764 /**
749 - *
 765+ * Get the descriptor of the fieldset that contains the file description
 766+ * input. The section is 'description'
 767+ *
 768+ * @return array Descriptor array
750769 */
751770 protected function getDescriptionSection() {
752771 global $wgUser, $wgOut;
@@ -773,6 +792,10 @@
774793 'cols' => $cols,
775794 'rows' => 8,
776795 ),
 796+ 'EditTools' => array(
 797+ 'type' => 'edittools',
 798+ 'section' => 'description',
 799+ ),
777800 'License' => array(
778801 'type' => 'select',
779802 'class' => 'Licenses',
@@ -784,13 +807,6 @@
785808 if ( $this->mForReUpload )
786809 $descriptor['DestFile']['readonly'] = true;
787810
788 - global $wgUseAjax, $wgAjaxLicensePreview;
789 - if ( $wgUseAjax && $wgAjaxLicensePreview )
790 - $descriptor['AjaxLicensePreview'] = array(
791 - 'class' => 'UploadAjaxLicensePreview',
792 - 'section' => 'description'
793 - );
794 -
795811 global $wgUseCopyrightUpload;
796812 if ( $wgUseCopyrightUpload ) {
797813 $descriptor['UploadCopyStatus'] = array(
@@ -811,7 +827,10 @@
812828 }
813829
814830 /**
815 - *
 831+ * Get the descriptor of the fieldset that contains the upload options,
 832+ * such as "watch this file". The section is 'options'
 833+ *
 834+ * @return array Descriptor array
816835 */
817836 protected function getOptionsSection() {
818837 global $wgOut;
@@ -829,26 +848,14 @@
830849 'label-message' => 'ignorewarnings',
831850 'section' => 'options',
832851 ),
833 - 'EditTools' => array(
834 - 'type' => 'edittools',
835 - 'section' => 'options',
836 - ),
837852 );
838853
839 - $uploadFooter = wfMsgNoTrans( 'uploadfooter' );
840 - if ( $uploadFooter != '-' && !wfEmptyMsg( 'uploadfooter', $uploadFooter ) )
841 - $descriptor['UploadFooter'] = array(
842 - 'type' => 'info',
843 - 'id' => 'mw-upload-footer-message',
844 - 'default' => $wgOut->parse( $uploadFooter ),
845 - );
846 -
847854 return $descriptor;
848855
849856 }
850857
851858 /**
852 - *
 859+ * Add the upload JS and show the form.
853860 */
854861 public function show() {
855862 $this->addUploadJS();
@@ -856,7 +863,10 @@
857864 }
858865
859866 /**
860 - *
 867+ * Add upload JS to $wgOut
 868+ *
 869+ * @param bool $autofill Whether or not to autofill the destination
 870+ * filename text box
861871 */
862872 protected function addUploadJS( $autofill = true ) {
863873 global $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview;
@@ -886,6 +896,11 @@
887897 }
888898 }
889899
 900+ /**
 901+ * Empty function; submission is handled elsewhere.
 902+ *
 903+ * @return bool false
 904+ */
890905 function trySubmit() {
891906 return false;
892907 }
@@ -893,7 +908,7 @@
894909 }
895910
896911 /**
897 - * TODO: DOCUMENT
 912+ * A form field that contains a radio box in the label
898913 */
899914 class UploadSourceField extends HTMLTextField {
900915 function getLabelHtml() {
@@ -921,15 +936,3 @@
922937 }
923938 }
924939
925 -/**
926 - * TODO: Document
927 - * TODO: This can be migrated to JS only
928 - */
929 -class UploadAjaxLicensePreview extends HTMLFormField {
930 - public function getTableRow( $value ) {
931 - return "<tr><td></td><td id=\"mw-license-preview\"></td></tr>\n";
932 - }
933 - public function getInputHTML( $value ) {
934 - return '';
935 - }
936 -}
\ No newline at end of file
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2131,7 +2131,7 @@
21322132 'destfilename' => 'Destination filename:',
21332133 'upload-maxfilesize' => 'Maximum file size: $1',
21342134 'upload-description' => 'File description',
2135 -'upload-options' => '', # do not translate or duplicate this message to other languages
 2135+'upload-options' => 'Upload options',
21362136 'watchthisupload' => 'Watch this file',
21372137 'filewasdeleted' => 'A file of this name has been previously uploaded and subsequently deleted.
21382138 You should check the $1 before proceeding to upload it again.',
Index: trunk/phase3/skins/common/upload.js
@@ -55,9 +55,26 @@
5656 optionsTable.appendChild( row );
5757 }
5858
59 - // License selector check
60 - document.getElementById( 'wpLicense' ).onchange = licenseSelectorCheck;
 59+ if ( wgAjaxLicensePreview ) {
 60+ // License selector check
 61+ document.getElementById( 'wpLicense' ).onchange = licenseSelectorCheck;
6162
 63+ // License selector table row
 64+ var wpLicense = document.getElementById( 'wpLicense' );
 65+ var wpLicenseRow = wpLicense.parentNode.parentNode;
 66+ var wpLicenseTbody = wpLicenseRow.parentNode;
 67+
 68+ var row = document.createElement( 'tr' );
 69+ var td = document.createElement( 'td' );
 70+ row.appendChild( td );
 71+ td = document.createElement( 'td' );
 72+ td.id = 'mw-license-preview';
 73+ row.appendChild( td );
 74+
 75+ wpLicenseTbody.insertBefore( row, wpLicenseRow.nextSibling );
 76+ }
 77+
 78+
6279 // fillDestFile setup
6380 for ( var i = 0; i < wgUploadSourceIds.length; i++ )
6481 document.getElementById( wgUploadSourceIds[i] ).onchange = function (e) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r57994Follow-up r57991: Message not longer to ignore for translatewikiraymond06:01, 22 October 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r57868Rewrote Special:Upload to allow easier extension. Mostly backwards compatible...btongminh19:41, 18 October 2009

Status & tagging log