Use proper XML functions for upload warning, prettify a bit.
authorRaimond Spekking <raymond@users.mediawiki.org>
Thu, 27 Mar 2008 10:42:58 +0000 (10:42 +0000)
committerRaimond Spekking <raymond@users.mediawiki.org>
Thu, 27 Mar 2008 10:42:58 +0000 (10:42 +0000)
includes/SpecialUpload.php
languages/messages/MessagesDe.php
languages/messages/MessagesEn.php

index 6beb1cb..b2017bc 100644 (file)
@@ -832,8 +832,8 @@ class UploadForm {
         */
        function uploadError( $error ) {
                global $wgOut;
-               $wgOut->addHTML( "<h2>" . wfMsgHtml( 'uploadwarning' ) . "</h2>\n" );
-               $wgOut->addHTML( "<span class='error'>{$error}</span>\n" );
+               $wgOut->addHTML( Xml::element( 'h2', null, wfMsg( 'uploadwarning' ) . "\n" ) );
+               $wgOut->addHTML( Xml::tags( 'span', array( 'class' => 'error' ), $error ) );
        }
 
        /**
@@ -845,7 +845,7 @@ class UploadForm {
         * @access private
         */
        function uploadWarning( $warning ) {
-               global $wgOut, $wgContLang;
+               global $wgOut;
                global $wgUseCopyrightUpload;
 
                $this->mSessionKey = $this->stashSession();
@@ -854,53 +854,32 @@ class UploadForm {
                        return;
                }
 
-               $wgOut->addHTML( "<h2>" . wfMsgHtml( 'uploadwarning' ) . "</h2>\n" );
-               $wgOut->addHTML( "<ul class='warning'>{$warning}</ul><br />\n" );
+               $wgOut->addHTML( Xml::element( 'h2', null, wfMsg( 'uploadwarning' ) ) . "\n" );
+               $wgOut->addHTML( Xml::tags( 'ul', array( 'class' => 'warning' ), $warning ) . "\n" );
 
-               $save = wfMsgHtml( 'savefile' );
-               $reupload = wfMsgHtml( 'reupload' );
-               $iw = wfMsgWikiHtml( 'ignorewarning' );
-               $reup = wfMsgWikiHtml( 'reuploaddesc' );
                $titleObj = SpecialPage::getTitleFor( 'Upload' );
-               $action = $titleObj->escapeLocalURL( 'action=submit' );
-               $align1 = $wgContLang->isRTL() ? 'left' : 'right';
-               $align2 = $wgContLang->isRTL() ? 'right' : 'left';
 
-               if ( $wgUseCopyrightUpload )
-               {
-                       $copyright =  "
-       <input type='hidden' name='wpUploadCopyStatus' value=\"" . htmlspecialchars( $this->mCopyrightStatus ) . "\" />
-       <input type='hidden' name='wpUploadSource' value=\"" . htmlspecialchars( $this->mCopyrightSource ) . "\" />
-       ";
+               if ( $wgUseCopyrightUpload ) {
+                       $copyright = Xml::hidden( 'wpUploadCopyStatus', $this->mCopyrightStatus ) . "\n" .
+                                       Xml::hidden( 'wpUploadSource', $this->mCopyrightSource ) . "\n";
                } else {
-                       $copyright = "";
+                       $copyright = '';
                }
 
-               $wgOut->addHTML( "
-       <form id='uploadwarning' method='post' enctype='multipart/form-data' action='$action'>
-               <input type='hidden' name='wpIgnoreWarning' value='1' />
-               <input type='hidden' name='wpSessionKey' value=\"" . htmlspecialchars( $this->mSessionKey ) . "\" />
-               <input type='hidden' name='wpUploadDescription' value=\"" . htmlspecialchars( $this->mComment ) . "\" />
-               <input type='hidden' name='wpLicense' value=\"" . htmlspecialchars( $this->mLicense ) . "\" />
-               <input type='hidden' name='wpDestFile' value=\"" . htmlspecialchars( $this->mDesiredDestName ) . "\" />
-               <input type='hidden' name='wpWatchthis' value=\"" . htmlspecialchars( intval( $this->mWatchthis ) ) . "\" />
-       {$copyright}
-       <table border='0'>
-               <tr>
-                       <tr>
-                               <td align='$align1'>
-                                       <input tabindex='2' type='submit' name='wpUpload' value=\"$save\" />
-                               </td>
-                               <td align='$align2'>$iw</td>
-                       </tr>
-                       <tr>
-                               <td align='$align1'>
-                                       <input tabindex='2' type='submit' name='wpReUpload' value=\"{$reupload}\" />
-                               </td>
-                               <td align='$align2'>$reup</td>
-                       </tr>
-               </tr>
-       </table></form>\n" );
+               $wgOut->addHTML(
+                       Xml::openElement( 'form', array( 'method' => 'post', 'action' => $titleObj->getLocalURL( 'action=submit' ), 
+                                'enctype' => 'multipart/form-data', 'id' => 'uploadwarning' ) ) . "\n" .
+                       Xml::hidden( 'wpIgnoreWarning', '1' ) . "\n" .
+                       Xml::hidden( 'wpSessionKey', $this->mSessionKey ) . "\n" .
+                       Xml::hidden( 'wpUploadDescription', $this->mComment ) . "\n" .
+                       Xml::hidden( 'wpLicense', $this->mLicense ) . "\n" .
+                       Xml::hidden( 'wpDestFile', $this->mDesiredDestName ) . "\n" .
+                       Xml::hidden( 'wpWatchthis', $this->mWatchthis ) . "\n" .
+                       "{$copyright}<br />" .
+                       Xml::submitButton( wfMsg( 'ignorewarning' ), array ( 'name' => 'wpUpload', 'id' => 'wpUpload', 'checked' => 'checked' ) ) . ' ' .
+                       Xml::submitButton( wfMsg( 'reuploaddesc' ), array ( 'name' => 'wpReUpload', 'id' => 'wpReUpload' ) ) .
+                       Xml::closeElement( 'form' ) . "\n"
+               );
        }
 
        /**
index 56dcf1f..50815f3 100644 (file)
@@ -1091,7 +1091,7 @@ Wenn du dich mit dem Thema auskennst, kannst du selbst die Seite „[[$1]]“ ve
 'upload'                      => 'Hochladen',
 'uploadbtn'                   => 'Datei hochladen',
 'reupload'                    => 'Abbrechen',
-'reuploaddesc'                => 'Zurück zur Hochladen-Seite.',
+'reuploaddesc'                => 'Abbrechen und zurück zur Hochladen-Seite',
 'uploadnologin'               => 'Nicht angemeldet',
 'uploadnologintext'           => 'Du musst [[Special:Userlogin|angemeldet sein]], um Dateien hochladen zu können.',
 'upload_directory_read_only'  => 'Der Webserver hat keine Schreibrechte für das Upload-Verzeichnis ($1).',
@@ -1124,7 +1124,7 @@ Bitte beachte, dass, genau wie bei normalen Seiteninhalten, andere Benutzer dein
 'filestatus'                  => 'Copyright-Status:',
 'filesource'                  => 'Quelle:',
 'uploadedfiles'               => 'Hochgeladene Dateien',
-'ignorewarning'               => 'Warnung ignorieren und Datei speichern.',
+'ignorewarning'               => 'Warnung ignorieren und Datei speichern',
 'ignorewarnings'              => 'Warnungen ignorieren',
 'minlength1'                  => 'Dateinamen müssen mindestens einen Buchstaben lang sein.',
 'illegalfilename'             => 'Der Dateiname „$1“ enthält mindestens ein nicht erlaubtes Zeichen. Bitte benenne die Datei um und versuche sie erneut hochzuladen.',
index aca42c7..7ced83d 100644 (file)
@@ -1433,7 +1433,7 @@ Pages on your watchlist are '''bold'''.",
 'upload'                      => 'Upload file',
 'uploadbtn'                   => 'Upload file',
 'reupload'                    => 'Re-upload',
-'reuploaddesc'                => 'Return to the upload form.',
+'reuploaddesc'                => 'Cancel upload and return to the upload form',
 'uploadnologin'               => 'Not logged in',
 'uploadnologintext'           => 'You must be [[Special:Userlogin|logged in]] to upload files.',
 'upload_directory_read_only'  => 'The upload directory ($1) is not writable by the webserver.',
@@ -1459,7 +1459,7 @@ To include a file in a page, use a link in the form
 'filestatus'                  => 'Copyright status:',
 'filesource'                  => 'Source:',
 'uploadedfiles'               => 'Uploaded files',
-'ignorewarning'               => 'Ignore warning and save file anyway.',
+'ignorewarning'               => 'Ignore warning and save file anyway',
 'ignorewarnings'              => 'Ignore any warnings',
 'minlength1'                  => 'File names must be at least one letter.',
 'illegalfilename'             => 'The filename "$1" contains characters that are not allowed in page titles. Please rename the file and try uploading it again.',