http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84473
Revision: 84473
Author: kaldari
Date: 2011-03-21 18:52:41 +0000 (Mon, 21 Mar 2011)
Log Message:
-----------
making title field required
Modified Paths:
--------------
trunk/extensions/UploadWizard/resources/mw.DestinationChecker.js
trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js
Modified: trunk/extensions/UploadWizard/resources/mw.DestinationChecker.js
===================================================================
--- trunk/extensions/UploadWizard/resources/mw.DestinationChecker.js
2011-03-21 18:41:46 UTC (rev 84472)
+++ trunk/extensions/UploadWizard/resources/mw.DestinationChecker.js
2011-03-21 18:52:41 UTC (rev 84473)
@@ -104,10 +104,11 @@
*/
checkUnique: function() {
var _this = this;
-
var found = false;
- // XXX if input is empty don't bother? but preprocess gives us
File:.png...
var title = _this.getTitle();
+
+ // if input is empty don't bother.
+ if ( title == '' ) return;
if ( _this.cachedResult[name] !== undefined ) {
_this.processResult( _this.cachedResult[name] );
Modified: trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js
===================================================================
--- trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js
2011-03-21 18:41:46 UTC (rev 84472)
+++ trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js
2011-03-21 18:52:41 UTC (rev 84473)
@@ -54,13 +54,17 @@
api: _this.upload.api,
spinner: function(bool) {
_this.toggleDestinationBusy(bool); },
preprocess: function( name ) {
- // turn the contents of the input into a
MediaWiki title ("File:foo_bar.jpg") to look up
- return _this.upload.title.setNameText( name
).toString();
+ if ( name != '' ) {
+ // turn the contents of the input into
a MediaWiki title ("File:foo_bar.jpg") to look up
+ return _this.upload.title.setNameText(
name ).toString();
+ } else {
+ return name;
+ }
},
processResult: function( result ) {
_this.processDestinationCheck( result ); }
} );
- _this.titleErrorDiv = $j('<div
class="mwe-upwiz-details-input-error"><label class="mwe-error" for="' +
_this.titleId + '" generated="true"/></div>');
+ _this.titleErrorDiv = $j('<div
class="mwe-upwiz-details-input-error"><label class="mwe-validator-error" for="'
+ _this.titleId + '" generated="true"/></div>');
var titleHintId = 'mwe-upwiz-title-hint-' + _this.upload.index;
var $titleDialog = $('<div>')
@@ -221,6 +225,15 @@
_this.addDescription( true, mw.config.get( 'wgUserLanguage' ) );
$j( containerDiv ).append( _this.div );
+ // make the title field required
+ _this.$form.find( '.mwe-title' )
+ .rules( "add", {
+ required: true,
+ messages: {
+ required: gM( 'mwe-upwiz-error-blank' )
+ }
+ } );
+
// make this a category picker
var hiddenCats = [];
if ( mw.isDefined( mw.UploadWizard.config.autoCategory ) ) {
@@ -305,7 +318,6 @@
*/
processDestinationCheck: function( result ) {
var _this = this;
-
if ( result.isUnique ) {
$j( _this.titleInput ).data( 'valid', true );
_this.$form.find( 'label[for=' + _this.titleId + ']'
).hide().empty();
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs