Index: trunk/extensions/UploadWizard/resources/jquery/jquery.validate.wmCommonsBlacklist.js |
— | — | @@ -1,7 +1,10 @@ |
2 | 2 | /** |
3 | | - * Does some local checking of a file. For more specific filenames (such as bad words, other blacklisted stuff) use |
4 | | - * the Blacklist API. |
| 3 | + * Does some local checking of a filename. |
| 4 | + * If you want more specific filename checks (such as bad words, other blacklisted stuff) use the TitleBlacklist API. |
5 | 5 | * |
| 6 | + * These checks are ignored when the TitleBlacklist API is available, since presumably they should be configured there instead, where it's |
| 7 | + * possible to update them easily and higher-quality error messages are available. |
| 8 | + * |
6 | 9 | * This is an incomplete rendering of some of the meta.wikimedia.org and commons.wikimedia.org blacklist as they existed on 2011-05-05, and |
7 | 10 | * ignores cases that are irrelevant to uploading new media images. |
8 | 11 | * - all regexes are case INsensitive by default |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js |
— | — | @@ -269,23 +269,33 @@ |
270 | 270 | _this.addDescription( true, mw.config.get( 'wgUserLanguage' ) ); |
271 | 271 | $j( containerDiv ).append( _this.div ); |
272 | 272 | |
273 | | - // make the title field required, and non-blacklisted |
274 | | - _this.$form.find( '.mwe-title' ) |
275 | | - .rules( "add", { |
276 | | - required: true, |
277 | | - titleBadchars: true, |
278 | | - titleSenselessimagename: true, |
279 | | - titleThumbnail: true, |
280 | | - titleExtension: true, |
281 | | - messages: { |
282 | | - required: gM( 'mwe-upwiz-error-blank' ), |
283 | | - titleBadchars: gM( 'mwe-upwiz-error-title-badchars' ), |
284 | | - titleSenselessimagename: gM( 'mwe-upwiz-error-title-senselessimagename' ), |
285 | | - titleThumbnail: gM( 'mwe-upwiz-error-title-thumbnail' ), |
286 | | - titleExtension: gM( 'mwe-upwiz-error-title-extension' ) |
287 | | - } |
288 | | - } ); |
289 | | - |
| 273 | + if( UploadWizardConfig.useTitleBlacklistApi ) { |
| 274 | + // less strict checking, since TitleBlacklist checks should catch most errors. |
| 275 | + _this.$form.find( '.mwe-title' ) |
| 276 | + .rules( "add", { |
| 277 | + required: true, |
| 278 | + messages: { |
| 279 | + required: gM( 'mwe-upwiz-error-blank' ), |
| 280 | + } |
| 281 | + } ); |
| 282 | + } else { |
| 283 | + // make the title field required, and non-blacklisted |
| 284 | + _this.$form.find( '.mwe-title' ) |
| 285 | + .rules( "add", { |
| 286 | + required: true, |
| 287 | + titleBadchars: true, |
| 288 | + titleSenselessimagename: true, |
| 289 | + titleThumbnail: true, |
| 290 | + titleExtension: true, |
| 291 | + messages: { |
| 292 | + required: gM( 'mwe-upwiz-error-blank' ), |
| 293 | + titleBadchars: gM( 'mwe-upwiz-error-title-badchars' ), |
| 294 | + titleSenselessimagename: gM( 'mwe-upwiz-error-title-senselessimagename' ), |
| 295 | + titleThumbnail: gM( 'mwe-upwiz-error-title-thumbnail' ), |
| 296 | + titleExtension: gM( 'mwe-upwiz-error-title-extension' ) |
| 297 | + } |
| 298 | + } ); |
| 299 | + } |
290 | 300 | // make this a category picker |
291 | 301 | var hiddenCats = mw.isDefined( mw.UploadWizard.config.autoCategories ) ? mw.UploadWizard.config.autoCategories : []; |
292 | 302 | if ( mw.isDefined( mw.UploadWizard.config.autoCategory ) && mw.UploadWizard.config.autoCategory !== '' ) { |