Index: trunk/extensions/UploadWizard/js/mw.UploadWizard.js |
— | — | @@ -2487,55 +2487,12 @@ |
2488 | 2488 | return authorValid & licenseValid; |
2489 | 2489 | }, |
2490 | 2490 | |
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 | | -*/ |
2536 | 2491 | getSourceWikiText: function() { |
2537 | 2492 | return '{{own}}'; |
2538 | 2493 | }, |
2539 | 2494 | |
| 2495 | + // XXX do we need to escape authorInput, or is wikitext a feature here? |
| 2496 | + // what about scripts? |
2540 | 2497 | getAuthorWikiText: function() { |
2541 | 2498 | return "[[User:" + mw.getConfig('userName') + '|' + $j( authorInput ).val() + ']]'; |
2542 | 2499 | }, |
— | — | @@ -2557,7 +2514,7 @@ |
2558 | 2515 | var $standardDiv, $customDiv; |
2559 | 2516 | |
2560 | 2517 | 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;"/>' ), |
2562 | 2519 | $j( '<p>' ) |
2563 | 2520 | .html( gM( 'mwe-upwiz-source-ownwork-assert', |
2564 | 2521 | uploadCount, |
— | — | @@ -2565,7 +2522,7 @@ |
2566 | 2523 | ), |
2567 | 2524 | $j( '<p class="mwe-small-print" />' ).append( gM( 'mwe-upwiz-source-ownwork-assert-note' ) ) |
2568 | 2525 | ); |
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" />' ) ); |
2570 | 2527 | |
2571 | 2528 | var $customDiv = $j('<div/>').append( |
2572 | 2529 | $j( '<label for="author" generated="true" class="mwe-error" style="display:block;"/>' ), |
— | — | @@ -2632,7 +2589,7 @@ |
2633 | 2590 | debug: true, |
2634 | 2591 | errorClass: 'mwe-error', // add to general config? |
2635 | 2592 | rules: { |
2636 | | - blarg: { |
| 2593 | + author2: { |
2637 | 2594 | required: function( element ) { |
2638 | 2595 | return $crossfader.data( 'crossfadeDisplay' ).get(0) === $standardDiv.get(0); |
2639 | 2596 | }, |
— | — | @@ -2648,7 +2605,7 @@ |
2649 | 2606 | } |
2650 | 2607 | }, |
2651 | 2608 | messages: { |
2652 | | - blarg: { |
| 2609 | + author2: { |
2653 | 2610 | required: gM( 'mwe-upwiz-error-author-blank' ), |
2654 | 2611 | minlength: gM( 'mwe-upwiz-error-author-too-long', mw.getConfig( 'minAuthorLength' ) ), |
2655 | 2612 | maxlength: gM( 'mwe-upwiz-error-author-too-long', mw.getConfig( 'maxAuthorLength' ) ) |