r45963 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45962‎ | r45963 | r45964 >
Date:15:46, 21 January 2009
Author:aaron
Status:ok (Comments)
Tags:
Comment:
(bug 15811) Re-upload form tweaks
* Don't show license dropdown
* Use different message for summary box label
* Don't show "file exists" message
* Lock the destination name
Modified paths:
  • /trunk/phase3/includes/ImagePage.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUpload.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ImagePage.php
@@ -557,7 +557,7 @@
558558 public function getUploadUrl() {
559559 $this->loadFile();
560560 $uploadTitle = SpecialPage::getTitleFor( 'Upload' );
561 - return $uploadTitle->getFullUrl( 'wpDestFile=' . urlencode( $this->img->getName() ) );
 561+ return $uploadTitle->getFullUrl( 'wpDestFile=' . urlencode( $this->img->getName() ) . '&wpReUpload=1' );
562562 }
563563
564564 /**
Index: trunk/phase3/includes/specials/SpecialUpload.php
@@ -62,6 +62,7 @@
6363 $this->mDesiredDestName = $request->getText( 'wpDestFile' );
6464 $this->mIgnoreWarning = $request->getCheck( 'wpIgnoreWarning' );
6565 $this->mComment = $request->getText( 'wpUploadDescription' );
 66+ $this->mReUpload = $request->getCheck( 'wpReUpload' );
6667
6768 if( !$request->wasPosted() ) {
6869 # GET requests just give the main form; no data except destination
@@ -868,6 +869,7 @@
869870 */
870871 function unsaveUploadedFile() {
871872 global $wgOut;
 873+ if( !$this->mTempPath ) return true; // nothing to delete
872874 $repo = RepoGroup::singleton()->getLocalRepo();
873875 $success = $repo->freeTemp( $this->mTempPath );
874876 if ( ! $success ) {
@@ -1073,7 +1075,8 @@
10741076 $sourcefilename = wfMsgExt( 'sourcefilename', array( 'parseinline', 'escapenoentities' ) );
10751077 $destfilename = wfMsgExt( 'destfilename', array( 'parseinline', 'escapenoentities' ) );
10761078
1077 - $summary = wfMsgExt( 'fileuploadsummary', 'parseinline' );
 1079+ $msg = $this->mReUpload ? 'filereuploadsummary' : 'fileuploadsummary';
 1080+ $summary = wfMsgExt( $msg, 'parseinline' );
10781081
10791082 $licenses = new Licenses();
10801083 $license = wfMsgExt( 'license', array( 'parseinline' ) );
@@ -1087,10 +1090,9 @@
10881091
10891092 $encDestName = htmlspecialchars( $this->mDesiredDestName );
10901093
1091 - $watchChecked = $this->watchCheck()
1092 - ? 'checked="checked"'
1093 - : '';
1094 - $warningChecked = $this->mIgnoreWarning ? 'checked' : '';
 1094+ $watchChecked = $this->watchCheck() ? 'checked="checked"' : '';
 1095+ # Re-uploads should not need "file exist already" warnings
 1096+ $warningChecked = ($this->mIgnoreWarning || $this->mReUpload) ? 'checked' : '';
10951097
10961098 // Prepare form for upload or upload/copy
10971099 if( $wgAllowCopyUploads && $wgUser->isAllowed( 'upload_by_url' ) ) {
@@ -1125,6 +1127,8 @@
11261128 $warningRow = '';
11271129 $destOnkeyup = '';
11281130 }
 1131+ # Uploading a new version? If so, the name is fixed.
 1132+ $on = $this->mReUpload ? "disabled='disabled'" : "";
11291133
11301134 $encComment = htmlspecialchars( $this->mComment );
11311135
@@ -1156,7 +1160,7 @@
11571161 </td>
11581162 <td class='mw-input'>
11591163 <input tabindex='2' type='text' name='wpDestFile' id='wpDestFile' size='60'
1160 - value=\"{$encDestName}\" onchange='toggleFilenameFiller()' $destOnkeyup />
 1164+ value=\"{$encDestName}\" onchange='toggleFilenameFiller()' $on $destOnkeyup />
11611165 </td>
11621166 </tr>
11631167 <tr>
@@ -1171,8 +1175,8 @@
11721176 </tr>
11731177 <tr>"
11741178 );
1175 -
1176 - if ( $licenseshtml != '' ) {
 1179+ # Re-uploads should not need license info
 1180+ if ( !$this->mReUpload && $licenseshtml != '' ) {
11771181 global $wgStylePath;
11781182 $wgOut->addHTML( "
11791183 <td class='mw-label'>
@@ -1704,7 +1708,7 @@
17051709 * @access private
17061710 */
17071711 function cleanupTempFile() {
1708 - if ( $this->mRemoveTempFile && file_exists( $this->mTempPath ) ) {
 1712+ if ( $this->mRemoveTempFile && $this->mTempPath && file_exists( $this->mTempPath ) ) {
17091713 wfDebug( "SpecialUpload::cleanupTempFile: Removing temporary file {$this->mTempPath}\n" );
17101714 unlink( $this->mTempPath );
17111715 }
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1792,6 +1792,7 @@
17931793 'filename' => 'Filename',
17941794 'filedesc' => 'Summary',
17951795 'fileuploadsummary' => 'Summary:',
 1796+'filereuploadsummary' => 'File changes:',
17961797 'filestatus' => 'Copyright status:',
17971798 'filesource' => 'Source:',
17981799 'uploadedfiles' => 'Uploaded files',

Follow-up revisions

RevisionCommit summaryAuthorDate
r45964Follow up r45963: Add new messageraymond15:49, 21 January 2009
r46465(bug 15811) Also remove license template cruft on re-uploadaaron19:29, 28 January 2009

Comments

#Comment by Raymond (talk | contribs)   15:51, 21 January 2009

New message added to messages.inc with r45964

Status & tagging log