Index: trunk/extensions/UploadWizard/resources/mw.DestinationChecker.js |
— | — | @@ -104,10 +104,11 @@ |
105 | 105 | */ |
106 | 106 | checkUnique: function() { |
107 | 107 | var _this = this; |
108 | | - |
109 | 108 | var found = false; |
110 | | - // XXX if input is empty don't bother? but preprocess gives us File:.png... |
111 | 109 | var title = _this.getTitle(); |
| 110 | + |
| 111 | + // if input is empty don't bother. |
| 112 | + if ( title == '' ) return; |
112 | 113 | |
113 | 114 | if ( _this.cachedResult[name] !== undefined ) { |
114 | 115 | _this.processResult( _this.cachedResult[name] ); |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js |
— | — | @@ -54,13 +54,17 @@ |
55 | 55 | api: _this.upload.api, |
56 | 56 | spinner: function(bool) { _this.toggleDestinationBusy(bool); }, |
57 | 57 | preprocess: function( name ) { |
58 | | - // turn the contents of the input into a MediaWiki title ("File:foo_bar.jpg") to look up |
59 | | - return _this.upload.title.setNameText( name ).toString(); |
| 58 | + if ( name != '' ) { |
| 59 | + // turn the contents of the input into a MediaWiki title ("File:foo_bar.jpg") to look up |
| 60 | + return _this.upload.title.setNameText( name ).toString(); |
| 61 | + } else { |
| 62 | + return name; |
| 63 | + } |
60 | 64 | }, |
61 | 65 | processResult: function( result ) { _this.processDestinationCheck( result ); } |
62 | 66 | } ); |
63 | 67 | |
64 | | - _this.titleErrorDiv = $j('<div class="mwe-upwiz-details-input-error"><label class="mwe-error" for="' + _this.titleId + '" generated="true"/></div>'); |
| 68 | + _this.titleErrorDiv = $j('<div class="mwe-upwiz-details-input-error"><label class="mwe-validator-error" for="' + _this.titleId + '" generated="true"/></div>'); |
65 | 69 | |
66 | 70 | var titleHintId = 'mwe-upwiz-title-hint-' + _this.upload.index; |
67 | 71 | var $titleDialog = $('<div>') |
— | — | @@ -221,6 +225,15 @@ |
222 | 226 | _this.addDescription( true, mw.config.get( 'wgUserLanguage' ) ); |
223 | 227 | $j( containerDiv ).append( _this.div ); |
224 | 228 | |
| 229 | + // make the title field required |
| 230 | + _this.$form.find( '.mwe-title' ) |
| 231 | + .rules( "add", { |
| 232 | + required: true, |
| 233 | + messages: { |
| 234 | + required: gM( 'mwe-upwiz-error-blank' ) |
| 235 | + } |
| 236 | + } ); |
| 237 | + |
225 | 238 | // make this a category picker |
226 | 239 | var hiddenCats = []; |
227 | 240 | if ( mw.isDefined( mw.UploadWizard.config.autoCategory ) ) { |
— | — | @@ -305,7 +318,6 @@ |
306 | 319 | */ |
307 | 320 | processDestinationCheck: function( result ) { |
308 | 321 | var _this = this; |
309 | | - |
310 | 322 | if ( result.isUnique ) { |
311 | 323 | $j( _this.titleInput ).data( 'valid', true ); |
312 | 324 | _this.$form.find( 'label[for=' + _this.titleId + ']' ).hide().empty(); |