r32493 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32492‎ | r32493 | r32494 >
Date:10:42, 27 March 2008
Author:raymond
Status:old
Tags:
Comment:
Use proper XML functions for upload warning, prettify a bit.
Modified paths:
  • /trunk/phase3/includes/SpecialUpload.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesDe.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialUpload.php
@@ -832,8 +832,8 @@
833833 */
834834 function uploadError( $error ) {
835835 global $wgOut;
836 - $wgOut->addHTML( "<h2>" . wfMsgHtml( 'uploadwarning' ) . "</h2>\n" );
837 - $wgOut->addHTML( "<span class='error'>{$error}</span>\n" );
 836+ $wgOut->addHTML( Xml::element( 'h2', null, wfMsg( 'uploadwarning' ) . "\n" ) );
 837+ $wgOut->addHTML( Xml::tags( 'span', array( 'class' => 'error' ), $error ) );
838838 }
839839
840840 /**
@@ -845,7 +845,7 @@
846846 * @access private
847847 */
848848 function uploadWarning( $warning ) {
849 - global $wgOut, $wgContLang;
 849+ global $wgOut;
850850 global $wgUseCopyrightUpload;
851851
852852 $this->mSessionKey = $this->stashSession();
@@ -854,53 +854,32 @@
855855 return;
856856 }
857857
858 - $wgOut->addHTML( "<h2>" . wfMsgHtml( 'uploadwarning' ) . "</h2>\n" );
859 - $wgOut->addHTML( "<ul class='warning'>{$warning}</ul><br />\n" );
 858+ $wgOut->addHTML( Xml::element( 'h2', null, wfMsg( 'uploadwarning' ) ) . "\n" );
 859+ $wgOut->addHTML( Xml::tags( 'ul', array( 'class' => 'warning' ), $warning ) . "\n" );
860860
861 - $save = wfMsgHtml( 'savefile' );
862 - $reupload = wfMsgHtml( 'reupload' );
863 - $iw = wfMsgWikiHtml( 'ignorewarning' );
864 - $reup = wfMsgWikiHtml( 'reuploaddesc' );
865861 $titleObj = SpecialPage::getTitleFor( 'Upload' );
866 - $action = $titleObj->escapeLocalURL( 'action=submit' );
867 - $align1 = $wgContLang->isRTL() ? 'left' : 'right';
868 - $align2 = $wgContLang->isRTL() ? 'right' : 'left';
869862
870 - if ( $wgUseCopyrightUpload )
871 - {
872 - $copyright = "
873 - <input type='hidden' name='wpUploadCopyStatus' value=\"" . htmlspecialchars( $this->mCopyrightStatus ) . "\" />
874 - <input type='hidden' name='wpUploadSource' value=\"" . htmlspecialchars( $this->mCopyrightSource ) . "\" />
875 - ";
 863+ if ( $wgUseCopyrightUpload ) {
 864+ $copyright = Xml::hidden( 'wpUploadCopyStatus', $this->mCopyrightStatus ) . "\n" .
 865+ Xml::hidden( 'wpUploadSource', $this->mCopyrightSource ) . "\n";
876866 } else {
877 - $copyright = "";
 867+ $copyright = '';
878868 }
879869
880 - $wgOut->addHTML( "
881 - <form id='uploadwarning' method='post' enctype='multipart/form-data' action='$action'>
882 - <input type='hidden' name='wpIgnoreWarning' value='1' />
883 - <input type='hidden' name='wpSessionKey' value=\"" . htmlspecialchars( $this->mSessionKey ) . "\" />
884 - <input type='hidden' name='wpUploadDescription' value=\"" . htmlspecialchars( $this->mComment ) . "\" />
885 - <input type='hidden' name='wpLicense' value=\"" . htmlspecialchars( $this->mLicense ) . "\" />
886 - <input type='hidden' name='wpDestFile' value=\"" . htmlspecialchars( $this->mDesiredDestName ) . "\" />
887 - <input type='hidden' name='wpWatchthis' value=\"" . htmlspecialchars( intval( $this->mWatchthis ) ) . "\" />
888 - {$copyright}
889 - <table border='0'>
890 - <tr>
891 - <tr>
892 - <td align='$align1'>
893 - <input tabindex='2' type='submit' name='wpUpload' value=\"$save\" />
894 - </td>
895 - <td align='$align2'>$iw</td>
896 - </tr>
897 - <tr>
898 - <td align='$align1'>
899 - <input tabindex='2' type='submit' name='wpReUpload' value=\"{$reupload}\" />
900 - </td>
901 - <td align='$align2'>$reup</td>
902 - </tr>
903 - </tr>
904 - </table></form>\n" );
 870+ $wgOut->addHTML(
 871+ Xml::openElement( 'form', array( 'method' => 'post', 'action' => $titleObj->getLocalURL( 'action=submit' ),
 872+ 'enctype' => 'multipart/form-data', 'id' => 'uploadwarning' ) ) . "\n" .
 873+ Xml::hidden( 'wpIgnoreWarning', '1' ) . "\n" .
 874+ Xml::hidden( 'wpSessionKey', $this->mSessionKey ) . "\n" .
 875+ Xml::hidden( 'wpUploadDescription', $this->mComment ) . "\n" .
 876+ Xml::hidden( 'wpLicense', $this->mLicense ) . "\n" .
 877+ Xml::hidden( 'wpDestFile', $this->mDesiredDestName ) . "\n" .
 878+ Xml::hidden( 'wpWatchthis', $this->mWatchthis ) . "\n" .
 879+ "{$copyright}<br />" .
 880+ Xml::submitButton( wfMsg( 'ignorewarning' ), array ( 'name' => 'wpUpload', 'id' => 'wpUpload', 'checked' => 'checked' ) ) . ' ' .
 881+ Xml::submitButton( wfMsg( 'reuploaddesc' ), array ( 'name' => 'wpReUpload', 'id' => 'wpReUpload' ) ) .
 882+ Xml::closeElement( 'form' ) . "\n"
 883+ );
905884 }
906885
907886 /**
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1433,7 +1433,7 @@
14341434 'upload' => 'Upload file',
14351435 'uploadbtn' => 'Upload file',
14361436 'reupload' => 'Re-upload',
1437 -'reuploaddesc' => 'Return to the upload form.',
 1437+'reuploaddesc' => 'Cancel upload and return to the upload form',
14381438 'uploadnologin' => 'Not logged in',
14391439 'uploadnologintext' => 'You must be [[Special:Userlogin|logged in]] to upload files.',
14401440 'upload_directory_read_only' => 'The upload directory ($1) is not writable by the webserver.',
@@ -1459,7 +1459,7 @@
14601460 'filestatus' => 'Copyright status:',
14611461 'filesource' => 'Source:',
14621462 'uploadedfiles' => 'Uploaded files',
1463 -'ignorewarning' => 'Ignore warning and save file anyway.',
 1463+'ignorewarning' => 'Ignore warning and save file anyway',
14641464 'ignorewarnings' => 'Ignore any warnings',
14651465 'minlength1' => 'File names must be at least one letter.',
14661466 'illegalfilename' => 'The filename "$1" contains characters that are not allowed in page titles. Please rename the file and try uploading it again.',
Index: trunk/phase3/languages/messages/MessagesDe.php
@@ -1091,7 +1091,7 @@
10921092 'upload' => 'Hochladen',
10931093 'uploadbtn' => 'Datei hochladen',
10941094 'reupload' => 'Abbrechen',
1095 -'reuploaddesc' => 'Zurück zur Hochladen-Seite.',
 1095+'reuploaddesc' => 'Abbrechen und zurück zur Hochladen-Seite',
10961096 'uploadnologin' => 'Nicht angemeldet',
10971097 'uploadnologintext' => 'Du musst [[Special:Userlogin|angemeldet sein]], um Dateien hochladen zu können.',
10981098 'upload_directory_read_only' => 'Der Webserver hat keine Schreibrechte für das Upload-Verzeichnis ($1).',
@@ -1124,7 +1124,7 @@
11251125 'filestatus' => 'Copyright-Status:',
11261126 'filesource' => 'Quelle:',
11271127 'uploadedfiles' => 'Hochgeladene Dateien',
1128 -'ignorewarning' => 'Warnung ignorieren und Datei speichern.',
 1128+'ignorewarning' => 'Warnung ignorieren und Datei speichern',
11291129 'ignorewarnings' => 'Warnungen ignorieren',
11301130 'minlength1' => 'Dateinamen müssen mindestens einen Buchstaben lang sein.',
11311131 'illegalfilename' => 'Der Dateiname „$1“ enthält mindestens ein nicht erlaubtes Zeichen. Bitte benenne die Datei um und versuche sie erneut hochzuladen.',

Status & tagging log