r67210 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67209‎ | r67210 | r67211 >
Date:04:32, 2 June 2010
Author:neilk
Status:deferred
Tags:
Comment:
remove useless custom validator, renamed fields blarg->author2
Modified paths:
  • /trunk/extensions/UploadWizard/js/mw.UploadWizard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/js/mw.UploadWizard.js
@@ -2487,55 +2487,12 @@
24882488 return authorValid & licenseValid;
24892489 },
24902490
2491 -/*
2492 - validateAuthor: function() {
2493 - debugger;
2494 - debugger;
2495 - var _this = this;
2496 - var signature = _this.authorInput.val().trim();
2497 -
2498 - var authorErrorMsg = null;
2499 - var maxAuthorLength = 50; // config?
2500 - var minAuthorLength = 2; // config?
2501 - if ( signature.length === 0 ) {
2502 - authorErrorMsg = gM( 'mwe-upwiz-error-author-blank' );
2503 - } else if ( signature.length < minAuthorLength ) {
2504 - debugger;
2505 - authorErrorMsg = gM( 'mwe-upwiz-error-author-too-short', minAuthorLength );
2506 - } else if ( signature.length > maxAuthorLength ) {
2507 - authorErrorMsg = gM( 'mwe-upwiz-error-author-too-long', maxAuthorLength );
2508 - } else if ( signature.match(/[{}\[\]\(\)%$]/) ) {
2509 - // XXX SECURITY we need to do a better job here
2510 - authorErrorMsg = gM( 'mwe-upwiz-error-author-bad-chars' );
2511 - }
2512 -
2513 - if (authorErrorMsg) {
2514 - _this.$selector
2515 - .find( '.mwe-upwiz-author-error' )
2516 - .html( authorErrorMsg )
2517 - .show();
2518 - _this.$selector
2519 - .find( '.mwe-upwiz-sign' )
2520 - .addClass( '.mwe-field-error' )
2521 - .bind( 'keyup.revalidate', function() {
2522 - $j( this ).unbind( 'keyup.revalidate' );
2523 - _this.validateAuthor();
2524 - } );
2525 -
2526 - } else {
2527 - _this.authorInput.removeClass( '.mwe-field-error' );
2528 - _this.$selector.find( '.mwe-upwiz-author-error' ).fadeOut().empty();
2529 - }
2530 -
2531 - return (authorErrorMsg !== null)
2532 -
2533 - },
2534 -
2535 -*/
25362491 getSourceWikiText: function() {
25372492 return '{{own}}';
25382493 },
25392494
 2495+ // XXX do we need to escape authorInput, or is wikitext a feature here?
 2496+ // what about scripts?
25402497 getAuthorWikiText: function() {
25412498 return "[[User:" + mw.getConfig('userName') + '|' + $j( authorInput ).val() + ']]';
25422499 },
@@ -2557,7 +2514,7 @@
25582515 var $standardDiv, $customDiv;
25592516
25602517 var $standardDiv = $j( '<div />' ).append(
2561 - $j( '<label for="blarg" generated="true" class="mwe-error" style="display:block;"/>' ),
 2518+ $j( '<label for="author2" generated="true" class="mwe-error" style="display:block;"/>' ),
25622519 $j( '<p>' )
25632520 .html( gM( 'mwe-upwiz-source-ownwork-assert',
25642521 uploadCount,
@@ -2565,7 +2522,7 @@
25662523 ),
25672524 $j( '<p class="mwe-small-print" />' ).append( gM( 'mwe-upwiz-source-ownwork-assert-note' ) )
25682525 );
2569 - $standardDiv.find( '.mwe-standard-author-input' ).append( $j( '<input name="blarg" type="text" class="mwe-upwiz-sign" />' ) );
 2526+ $standardDiv.find( '.mwe-standard-author-input' ).append( $j( '<input name="author2" type="text" class="mwe-upwiz-sign" />' ) );
25702527
25712528 var $customDiv = $j('<div/>').append(
25722529 $j( '<label for="author" generated="true" class="mwe-error" style="display:block;"/>' ),
@@ -2632,7 +2589,7 @@
26332590 debug: true,
26342591 errorClass: 'mwe-error', // add to general config?
26352592 rules: {
2636 - blarg: {
 2593+ author2: {
26372594 required: function( element ) {
26382595 return $crossfader.data( 'crossfadeDisplay' ).get(0) === $standardDiv.get(0);
26392596 },
@@ -2648,7 +2605,7 @@
26492606 }
26502607 },
26512608 messages: {
2652 - blarg: {
 2609+ author2: {
26532610 required: gM( 'mwe-upwiz-error-author-blank' ),
26542611 minlength: gM( 'mwe-upwiz-error-author-too-long', mw.getConfig( 'minAuthorLength' ) ),
26552612 maxlength: gM( 'mwe-upwiz-error-author-too-long', mw.getConfig( 'maxAuthorLength' ) )

Status & tagging log