Index: trunk/extensions/UploadWizard/styles/uploadWizard.css |
— | — | @@ -469,13 +469,18 @@ |
470 | 470 | visibility: hidden !important; |
471 | 471 | } |
472 | 472 | |
| 473 | +.mwe-upwiz-thirdparty-fields { |
| 474 | + margin-bottom: 5px; |
| 475 | +} |
| 476 | + |
473 | 477 | .mwe-upwiz-thirdparty-fields label { |
474 | 478 | width: 100px; |
475 | 479 | display: inline-block; |
| 480 | + padding-bottom: 5px; |
476 | 481 | } |
477 | 482 | |
478 | 483 | .mwe-upwiz-thirdparty-fields textarea { |
479 | | - margin: 5px 0px -3px 5px; |
| 484 | + margin: 0px |
480 | 485 | } |
481 | 486 | |
482 | 487 | .mwe-upwiz-thirdparty-license { |
— | — | @@ -525,7 +530,11 @@ |
526 | 531 | color: #ff0000; |
527 | 532 | } |
528 | 533 | |
529 | | -input[type='text'].mwe-error { |
| 534 | +.mwe-upwiz-deed-form-internal label.mwe-error { |
| 535 | + margin-left: 100px; |
| 536 | +} |
| 537 | + |
| 538 | +input[type='text'].mwe-error, textarea.mwe-error { |
530 | 539 | color: black; |
531 | 540 | border: 1px solid #ff0000; |
532 | 541 | } |
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php |
— | — | @@ -112,11 +112,14 @@ |
113 | 113 | 'mwe-upwiz-license-incompatible-cc' => 'You can only choose one kind of Creative Commons license.', |
114 | 114 | 'mwe-upwiz-license-show-all' => 'Use a different license', |
115 | 115 | 'mwe-upwiz-license-show-recommended' => 'Use the recommended license', |
116 | | - 'mwe-upwiz-error-author-blank' => 'You must sign the field below with your username or real name.', |
117 | | - 'mwe-upwiz-error-author-too-long' => 'Your signature is too long. Make it shorter than $1 {{PLURAL:$1|character|characters}}.', |
118 | | - 'mwe-upwiz-error-author-too-short' => 'Your signature is too short. Make it longer than $1 {{PLURAL:$1|character|characters}}.', |
119 | | - 'mwe-upwiz-error-author-bad-chars' => 'Your signature contains symbols that aren\'t allowed. Please don\'t use wikitext or HTML here, just your username or real name.', |
120 | | - |
| 116 | + 'mwe-upwiz-error-signature-blank' => 'You must sign the field below with your username or real name.', |
| 117 | + 'mwe-upwiz-error-signature-too-long' => 'Your signature is too long. Make it shorter than $1 {{PLURAL:$1|character|characters}}.', |
| 118 | + 'mwe-upwiz-error-signature-too-short' => 'Your signature is too short. Make it longer than $1 {{PLURAL:$1|character|characters}}.', |
| 119 | + 'mwe-upwiz-error-signature-bad-chars' => 'Your signature contains symbols that aren\'t allowed. Please don\'t use wikitext or HTML here, just your username or real name.', |
| 120 | + 'mwe-upwiz-error-blank' => 'This field is required.', |
| 121 | + 'mwe-upwiz-error-too-long' => 'This field is too long. Make it shorter than $1 {{PLURAL:$1|character|characters}}.', |
| 122 | + 'mwe-upwiz-error-too-short' => 'This field is too short. Make it longer than $1 {{PLURAL:$1|character|characters}}.', |
| 123 | + 'mwe-upwiz-error-bad-chars' => 'This field contains symbols that aren\'t allowed. Please don\'t use wikitext or HTML here, just your username or real name.' |
121 | 124 | ); |
122 | 125 | |
123 | 126 | /** Message documentation (Message documentation) |
Index: trunk/extensions/UploadWizard/js/mw.UploadWizard.js |
— | — | @@ -8,7 +8,8 @@ |
9 | 9 | * General configuration for the validator |
10 | 10 | */ |
11 | 11 | $j.validator.setDefaults( { |
12 | | - debug: true |
| 12 | + debug: true, |
| 13 | + errorClass: 'mwe-error' |
13 | 14 | } ); |
14 | 15 | |
15 | 16 | |
— | — | @@ -2485,10 +2486,7 @@ |
2486 | 2487 | * @return boolean true if valid, false if not |
2487 | 2488 | */ |
2488 | 2489 | valid: function() { |
2489 | | - // we don't need to validate source because it's set by default |
2490 | | - var authorValid = _this.$form.valid(); |
2491 | | - var licenseValid = _this.licenseInput.valid(); |
2492 | | - return authorValid & licenseValid; |
| 2490 | + return _this.$form.valid() && _this.licenseInput.valid(); |
2493 | 2491 | }, |
2494 | 2492 | |
2495 | 2493 | getSourceWikiText: function() { |
— | — | @@ -2590,8 +2588,6 @@ |
2591 | 2589 | |
2592 | 2590 | // and finally, make it validatable |
2593 | 2591 | _this.formValidator = _this.$form.validate( { |
2594 | | - debug: true, |
2595 | | - errorClass: 'mwe-error', // add to general config? |
2596 | 2592 | rules: { |
2597 | 2593 | author2: { |
2598 | 2594 | required: function( element ) { |
— | — | @@ -2610,14 +2606,14 @@ |
2611 | 2607 | }, |
2612 | 2608 | messages: { |
2613 | 2609 | author2: { |
2614 | | - required: gM( 'mwe-upwiz-error-author-blank' ), |
2615 | | - minlength: gM( 'mwe-upwiz-error-author-too-long', mw.getConfig( 'minAuthorLength' ) ), |
2616 | | - maxlength: gM( 'mwe-upwiz-error-author-too-long', mw.getConfig( 'maxAuthorLength' ) ) |
| 2610 | + required: gM( 'mwe-upwiz-error-signature-blank' ), |
| 2611 | + minlength: gM( 'mwe-upwiz-error-signature-too-short', mw.getConfig( 'minAuthorLength' ) ), |
| 2612 | + maxlength: gM( 'mwe-upwiz-error-signature-too-long', mw.getConfig( 'maxAuthorLength' ) ) |
2617 | 2613 | }, |
2618 | 2614 | author: { |
2619 | | - required: gM( 'mwe-upwiz-error-author-blank' ), |
2620 | | - minlength: gM( 'mwe-upwiz-error-author-too-long', mw.getConfig( 'minAuthorLength' ) ), |
2621 | | - maxlength: gM( 'mwe-upwiz-error-author-too-long', mw.getConfig( 'maxAuthorLength' ) ) |
| 2615 | + required: gM( 'mwe-upwiz-error-signature-blank' ), |
| 2616 | + minlength: gM( 'mwe-upwiz-error-signature-too-short', mw.getConfig( 'minAuthorLength' ) ), |
| 2617 | + maxlength: gM( 'mwe-upwiz-error-signature-too-long', mw.getConfig( 'maxAuthorLength' ) ) |
2622 | 2618 | } |
2623 | 2619 | } |
2624 | 2620 | } ); |
— | — | @@ -2650,6 +2646,9 @@ |
2651 | 2647 | name: 'thirdparty', |
2652 | 2648 | |
2653 | 2649 | setFormFields: function( $selector ) { |
| 2650 | + var _this = this; |
| 2651 | + _this.$form = $j( '<form/>' ); |
| 2652 | + |
2654 | 2653 | var $formFields = $j( '<div class="mwe-upwiz-deed-form-internal"/>' ); |
2655 | 2654 | |
2656 | 2655 | if ( uploadCount > 1 ) { |
— | — | @@ -2658,9 +2657,11 @@ |
2659 | 2658 | |
2660 | 2659 | $formFields.append ( |
2661 | 2660 | $j( '<div class="mwe-upwiz-source-thirdparty-custom-multiple-intro" />' ), |
| 2661 | + $j( '<label for="source" generated="true" class="mwe-error" style="display:block;"/>' ), |
2662 | 2662 | $j( '<div class="mwe-upwiz-thirdparty-fields" />' ) |
2663 | 2663 | .append( $j( '<label for="source"/>' ).text( gM( 'mwe-upwiz-source' ) ), |
2664 | 2664 | _this.sourceInput ), |
| 2665 | + $j( '<label for="author" generated="true" class="mwe-error" style="display:block;"/>' ), |
2665 | 2666 | $j( '<div class="mwe-upwiz-thirdparty-fields" />' ) |
2666 | 2667 | .append( $j( '<label for="author"/>' ).text( gM( 'mwe-upwiz-author' ) ), |
2667 | 2668 | _this.authorInput ), |
— | — | @@ -2669,13 +2670,36 @@ |
2670 | 2671 | licenseInputDiv |
2671 | 2672 | ); |
2672 | 2673 | |
2673 | | - $selector.append( $formFields ); |
| 2674 | + _this.$form.validate( { |
| 2675 | + rules: { |
| 2676 | + source: { required: true, |
| 2677 | + minlength: mw.getConfig( 'minSourceLength' ), |
| 2678 | + maxlength: mw.getConfig( 'maxSourceLength' ) }, |
| 2679 | + author: { required: true, |
| 2680 | + minlength: mw.getConfig( 'minAuthorLength' ), |
| 2681 | + maxlength: mw.getConfig( 'maxAuthorLength' ) }, |
| 2682 | + }, |
| 2683 | + messages: { |
| 2684 | + source: { |
| 2685 | + required: gM( 'mwe-upwiz-error-blank' ), |
| 2686 | + minlength: gM( 'mwe-upwiz-error-too-short', mw.getConfig( 'minSourceLength' ) ), |
| 2687 | + maxlength: gM( 'mwe-upwiz-error-too-long', mw.getConfig( 'maxSourceLength' ) ) |
| 2688 | + }, |
| 2689 | + author: { |
| 2690 | + required: gM( 'mwe-upwiz-error-blank' ), |
| 2691 | + minlength: gM( 'mwe-upwiz-error-too-short', mw.getConfig( 'minAuthorLength' ) ), |
| 2692 | + maxlength: gM( 'mwe-upwiz-error-too-long', mw.getConfig( 'maxAuthorLength' ) ) |
| 2693 | + } |
| 2694 | + } |
| 2695 | + } ); |
| 2696 | + |
| 2697 | + _this.$form.append( $formFields ); |
| 2698 | + |
| 2699 | + $selector.append( _this.$form ); |
2674 | 2700 | }, |
2675 | 2701 | |
2676 | 2702 | valid: function() { |
2677 | | - return (! mw.isEmpty( $j( this.sourceInput ).val() ) ) |
2678 | | - && (! mw.isEmpty( $j( this.authorInput ).val() ) ) |
2679 | | - && this.licenseInput.isSet() |
| 2703 | + return this.$form.valid() & this.licenseInput.valid(); |
2680 | 2704 | } |
2681 | 2705 | } ); |
2682 | 2706 | } |
Index: trunk/extensions/UploadWizard/UploadWizardPage.js |
— | — | @@ -24,6 +24,8 @@ |
25 | 25 | smallThumbnailWidth: 60, |
26 | 26 | maxAuthorLength: 50, |
27 | 27 | minAuthorLength: 2, |
| 28 | + maxSourceLength: 200, |
| 29 | + minSourceLength: 5, |
28 | 30 | |
29 | 31 | // not for use with all wikis. |
30 | 32 | // The ISO 639 code for the language tagalog is "tl". |