Index: trunk/extensions/MultiUpload/SpecialMultipleUpload.body.php |
— | — | @@ -116,32 +116,41 @@ |
117 | 117 | function processUpload() { |
118 | 118 | global $wgMaxUploadFiles, $wgOut; |
119 | 119 | |
120 | | - $wgOut->addHTML("<table>"); |
| 120 | + $images = 0; |
| 121 | + $wgOut->addHTML( '<table>' ); |
121 | 122 | $this->mShowUploadForm = false; |
122 | 123 | for( $x = 0; $x < $wgMaxUploadFiles; $x++ ) { |
123 | 124 | $this->mFileIndex = $x; |
124 | 125 | if( !isset( $this->mUploadTempNameArray[$x] ) || $this->mUploadTempNameArray[$x] == null ) continue; |
125 | 126 | |
| 127 | + $images++; |
126 | 128 | $this->mTempPath = $this->mUploadTempNameArray[$x]; |
127 | 129 | $this->mFileSize = $this->mUploadSizeArray[$x]; |
128 | 130 | $this->mSrcName = $this->mOnameArray[$x]; // for mw > 1.9 |
129 | 131 | $this->mRemoveTempFile = true; |
130 | 132 | $this->mIgnoreWarning = true; |
131 | 133 | |
132 | | - $this->mUploadError = $this->mUploadErrorArray [$x]; |
133 | | - $this->mDesiredDestName = $this->mDestFileArray [$x]; |
134 | | - $this->mComment = $this->mUploadDescriptionArray [$x]; |
135 | | - $wgOut->addHTML("<tr><td>"); |
| 134 | + $this->mUploadError = $this->mUploadErrorArray[$x]; |
| 135 | + $this->mDesiredDestName = $this->mDestFileArray[$x]; |
| 136 | + $this->mComment = $this->mUploadDescriptionArray[$x]; |
| 137 | + $wgOut->addHTML( '<tr><td>' ); |
136 | 138 | parent::processUpload(); |
137 | | - $wgOut->addHTML("</td></tr>"); |
| 139 | + $wgOut->addHTML( '</td></tr>' ); |
138 | 140 | } |
139 | 141 | |
140 | | - $wgOut->addHTML("</table>"); |
141 | | - $this->mShowUploadForm = false; |
142 | | - $wgOut->redirect(''); // clear the redirect, we want to show a nice page of images |
143 | | - $this->mShowUploadForm = true; |
144 | | - if( $this->mHasWarning ) { |
145 | | - $this->showWarningOptions(); |
| 142 | + $wgOut->addHTML( '</table>' ); |
| 143 | + // Display a form again with a warning if we gave no files, instead of a blank screen |
| 144 | + if( 0 == $images ) { |
| 145 | + $this->mShowUploadForm = true; |
| 146 | + $this->mUploadSaveName = wfMsg( 'multiupload-blank' ); |
| 147 | + $this->mainUploadForm( wfMsg( 'multiupload-no-files' ) ); |
| 148 | + } else { |
| 149 | + $this->mShowUploadForm = false; |
| 150 | + $wgOut->redirect(''); // clear the redirect, we want to show a nice page of images |
| 151 | + $this->mShowUploadForm = true; |
| 152 | + if( $this->mHasWarning ) { |
| 153 | + $this->showWarningOptions(); |
| 154 | + } |
146 | 155 | } |
147 | 156 | } |
148 | 157 | |
Index: trunk/extensions/MultiUpload/SpecialMultipleUpload.i18n.php |
— | — | @@ -28,6 +28,8 @@ |
29 | 29 | Inappropriate files will be deleted immediately, see the [[{{MediaWiki:Multipleupload-page}}|file deletion policy]].", |
30 | 30 | 'multiupload-fileuploaded' => 'File uploaded.', |
31 | 31 | 'multiupload-toolbox' => 'Upload multiple files', |
| 32 | + 'multiupload-no-files' => 'Please select at least one file to upload', |
| 33 | + 'multiupload-blank' => 'No file selected', |
32 | 34 | ); |
33 | 35 | |
34 | 36 | /** Message documentation (Message documentation) |
Index: trunk/extensions/MultiUpload/SpecialMultipleUpload.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | $wgExtensionCredits['specialpage'][] = array( |
21 | 21 | 'name' => 'MultipleUpload', |
22 | 22 | 'author' => 'Travis Derouin', |
23 | | - 'version' => '1.0', |
| 23 | + 'version' => '1.01', |
24 | 24 | 'description' => 'Allows users to upload several files at once.', |
25 | 25 | 'descriptionmsg' => 'multipleupload-desc', |
26 | 26 | 'url' => 'http://www.mediawiki.org/wiki/Extension:MultiUpload', |