r66660 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66659‎ | r66660 | r66661 >
Date:21:52, 19 May 2010
Author:neilk
Status:deferred
Tags:
Comment:
pluralization, some validation
Modified paths:
  • /trunk/extensions/UploadWizard/UploadWizard.i18n.php (modified) (history)
  • /trunk/extensions/UploadWizard/js/mw.UploadWizard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php
@@ -36,20 +36,15 @@
3737 'mwe-upwiz-remaining' => '$1 {{PLURAL:$1|file|files}} remaining',
3838 'mwe-upwiz-deeds-intro' => "Thank you! Now we need to set a license for these files, so everyone can legally view or modify them. First, we will have to know where you got them.",
3939 'mwe-upwiz-details-intro' => 'Now we need some basic information about the files.',
40 - 'mwe-upwiz-source-ownwork' => 'This file is my own work.',
41 - 'mwe-upwiz-source-ownwork-plural' => 'These files are my own work.',
42 - 'mwe-upwiz-source-ownwork-assert' => 'I, $1, the copyright holder of this work, hereby grant anyone the right to use this work for any purpose, as long as they credit me and share derivative work under the same terms.',
43 - 'mwe-upwiz-source-ownwork-assert-plural' => 'I, $1, the copyright holder of these works, hereby grant anyone the right to use these works for any purpose, as long as they credit me and share derivative work under the same terms.',
44 - 'mwe-upwiz-source-ownwork-assert-custom' => 'I, $1, the copyright holder of this work, hereby publish this work under the following license(s):',
45 - 'mwe-upwiz-source-ownwork-assert-custom-plural' => 'I, $1, the copyright holder of these works, hereby publish these works under the following license(s):',
 40+ 'mwe-upwiz-source-ownwork' => '{{PLURAL:$1|This file is|These files are}} my own work.',
 41+ 'mwe-upwiz-source-ownwork-assert' => 'I, $2, the copyright holder of {{PLURAL:$1|this work|these works}}, hereby grant anyone the right to use {{PLURAL:$1|this work|these works}} for any purpose, as long as they credit me and share derivative work under the same terms.',
 42+ 'mwe-upwiz-source-ownwork-assert-custom' => 'I, $2, the copyright holder of {{PLURAL:$1|this work|these works}}, hereby publish {{PLURAL:$1|this work|these works}} under the following license(s):',
4643 'mwe-upwiz-source-ownwork-assert-note' => 'This means you release your work under a double Creative Commons Attribution ShareAlike and GFDL license.',
4744 'mwe-upwiz-source-permission' => 'Their author gave you explicit permission to upload them',
48 - 'mwe-upwiz-source-thirdparty' => 'This file is not my own work.',
49 - 'mwe-upwiz-source-thirdparty-plural' => 'These files are not my own work.',
 45+ 'mwe-upwiz-source-thirdparty' => '{{PLURAL:$1|This file is|These files are}} not my own work.',
5046 'mwe-upwiz-source-thirdparty-intro' => 'Please enter the address where you found each file.',
51 - 'mwe-upwiz-source-thirdparty-custom-plural-intro' => 'If all files have the same source, author, and copyright status, you may enter them only once for all of them.',
52 - 'mwe-upwiz-source-thirdparty-license' => 'The copyright holder of this work published it under the following license(s):',
53 - 'mwe-upwiz-source-thirdparty-license-plural' => 'The copyright holder of these works published them under the following license(s):',
 47+ 'mwe-upwiz-source-thirdparty-custom-multiple-intro' => 'If all files have the same source, author, and copyright status, you may enter them only once for all of them.',
 48+ 'mwe-upwiz-source-thirdparty-license' => 'The copyright holder of {{PLURAL:$1|this work|these works}} published {{PLURAL:$1|it|them}} under the following license(s):',
5449 'mwe-upwiz-source-thirdparty-accept' => 'OK',
5550 'mwe-upwiz-source-custom' => 'Did you know? You can <a href="$1">customize</a> the default options you see here.',
5651 'mwe-upwiz-more-options' => 'more options...',
@@ -108,6 +103,7 @@
109104 'mwe-upwiz-file-need-file' => 'Please add an upload first.',
110105 'mwe-upwiz-file-need-start' => 'Please press this button to start your uploads.',
111106 'mwe-upwiz-file-need-complete' => 'Please wait until all files have finished uploading.',
 107+ 'mwe-upwiz-deeds-need-deed' => 'Please explain where you got {{PLURAL:$1|this file|these files}} and how this site can use {{PLURAL:$1|it|them}}, by selecting one of the options.',
112108 );
113109
114110 /** Message documentation (Message documentation)
Index: trunk/extensions/UploadWizard/js/mw.UploadWizard.js
@@ -966,7 +966,6 @@
967967 // descriptions
968968 _this.descriptionsDiv = $j( '<div class="mwe-upwiz-details-descriptions mwe-upwiz-details-input"></div>' );
969969
970 - // XXX use plurals
971970 _this.descriptionAdder = $j( '<a class="mwe-upwiz-desc-add"/>' )
972971 .attr( 'href', '#' )
973972 .html( gM( 'mwe-upwiz-desc-add-0' ) )
@@ -1896,17 +1895,16 @@
18971896
18981897 var customDeed = $j.extend( new mw.UploadWizardDeed(), {
18991898 isReady: function() { return true; },
1900 - setQuantity: function( n ) { return; }
 1899+ setQuantity: function() { return; }
19011900 } );
19021901
19031902 $j( '#mwe-upwiz-deeds-custom' ).append(
1904 - $j( '<div id="mwe-upwiz-deeds-later" />' )
 1903+ $j( '<div id="mwe-upwiz-deeds-later-div" />' )
19051904 .hide()
19061905 .append( $j( '<label>' )
19071906 .append(
1908 - $j( '<input />')
1909 - .attr( { type: 'checkbox', value: 'deeds-later' } )
1910 - .addClass( 'mwe-accept-deed' )
 1907+ $j( '<input id="mwe-upwiz-deeds-later" '
 1908+ + 'type="checkbox" value="deeds-later" class="mwe-accept-deed" />')
19111909 .click( function() {
19121910 if ( $j( this ).is( ':checked' ) ) {
19131911 _this.deedChooser.showDeedChoice();
@@ -1924,9 +1922,9 @@
19251923 $j( _this.deedChooser ).bind( 'setQuantityEvent', function() {
19261924 mw.log( "checking this deedchooser count " + _this.deedChooser.count );
19271925 if ( _this.deedChooser.count > 1 ) {
1928 - $j( '#mwe-upwiz-deeds-later' ).show();
 1926+ $j( '#mwe-upwiz-deeds-later-div' ).show();
19291927 } else {
1930 - $j( '#mwe-upwiz-deeds-later' ).hide();
 1928+ $j( '#mwe-upwiz-deeds-later-div' ).hide();
19311929 }
19321930 } );
19331931
@@ -1934,7 +1932,13 @@
19351933 $j( '#mwe-upwiz-deeds-intro' ).html( gM( 'mwe-upwiz-deeds-intro' ) );
19361934
19371935 $j( '#mwe-upwiz-stepdiv-deeds .mwe-upwiz-button-next').click( function() {
1938 - _this.moveToStep('details');
 1936+ if ( $j( '#mwe-upwiz-deeds-later-checkbox' ).is( ':checked' )
 1937+ ||
 1938+ _this.deedChooser.isReady() ) {
 1939+ _this.moveToStep('details');
 1940+ } else {
 1941+ _this.deedChooser.deed.showValidationTips();
 1942+ }
19391943 } );
19401944
19411945 // XXX perhaps we should defer this until we click next
@@ -2419,8 +2423,11 @@
24202424 mw.UploadWizardNullDeed = $j.extend( new mw.UploadWizardDeed(), {
24212425 isReady: function() { return false; },
24222426
2423 - setQuantity: function( n ) { return; }
2424 -
 2427+ setQuantity: function() { return; },
 2428+
 2429+ showValidationTips: function() {
 2430+ alert( gM( 'mwe-upwiz-deeds-need-deed', _this.uploads.length ) );
 2431+ }
24252432 } );
24262433
24272434
@@ -2476,6 +2483,10 @@
24772484
24782485 mw.UploadWizardDeedChooser.prototype = {
24792486
 2487+ isReady: function() {
 2488+ return ( typeof this.deed !== 'undefined' && this.deed.isReady() );
 2489+ },
 2490+
24802491 count: 0,
24812492
24822493 attach: function( upload ) {
@@ -2495,15 +2506,13 @@
24962507 setQuantity: function() {
24972508 var _this = this;
24982509 mw.log( "setting quantity of deed to " + _this.count );
2499 - var isPlural = _this.count > 1;
25002510 $j.each( [ 'ownwork', 'thirdparty' ], function (i, key) {
25012511
25022512 // fix the deed title that opens and closes
2503 - gMkey = isPlural ? key + '-plural' : key;
25042513 $j( _this.selector )
25052514 .find( '.mwe-upwiz-macro-deed-' + key)
25062515 .find( '.mwe-upwiz-deed-name' )
2507 - .html( gM( 'mwe-upwiz-source-' + gMkey ) );
 2516+ .html( gM( 'mwe-upwiz-source-' + key, _this.count ) );
25082517
25092518 // any other internal strings in the deed
25102519 if ( _this.deeds[key] ) {
@@ -2669,25 +2678,26 @@
26702679 }
26712680 } );
26722681
2673 - _this.setQuantity( 1 );
 2682+ _this.count = 1;
 2683+ _this.setQuantity();
26742684
26752685
26762686 },
26772687
26782688
2679 - setQuantity: function( n ) {
 2689+ setQuantity: function() {
26802690 var _this = this;
2681 - var plural = n > 1 ? '-plural' : '';
26822691 $j( _this.deedChooser.selector )
26832692 .find( 'p.mwe-upwiz-source-ownwork-assert' )
2684 - .html( gM( 'mwe-upwiz-source-ownwork-assert' + plural,
2685 - $j( '<input />' )
2686 - .attr( { name: 'author' } )
2687 - .addClass( 'mwe-upwiz-sign' ) ) );
 2693+ .html( gM( 'mwe-upwiz-source-ownwork-assert',
 2694+ _this.count,
 2695+ '<input name="author" class="mwe-upwiz-sign" />' )
 2696+ );
26882697
26892698 $j( _this.deedChooser.selector )
26902699 .find( 'p.mwe-upwiz-source-ownwork-assert-custom' )
2691 - .html( gM( 'mwe-upwiz-source-ownwork-assert-custom' + plural,
 2700+ .html( gM( 'mwe-upwiz-source-ownwork-assert-custom',
 2701+ _this.count,
26922702 '<span class="mwe-custom-author-input"></span>' ) );
26932703
26942704 // have to add the author input this way -- gM() will flatten it to a string and we'll lose it as a dom object
@@ -2762,34 +2772,36 @@
27632773 $j( deedChooser.selector ).find( '.mwe-upwiz-macro-deed-thirdparty .mwe-upwiz-deed-form' ).append(
27642774 $j( '<div class="mwe-upwiz-deed-form-internal"/>' )
27652775 .append(
2766 - $j( '<div class="mwe-upwiz-source-thirdparty-custom-plural-intro" />' ),
2767 - $j( '<div />' )
2768 - .addClass( "mwe-upwiz-thirdparty-fields" )
2769 - .append( $j( '<label />' )
2770 - .attr( { 'for' : 'source' } )
2771 - .text( gM( 'mwe-upwiz-source' ) ) )
2772 - .append( sourceInput ),
2773 - $j( '<div />' )
2774 - .addClass( "mwe-upwiz-thirdparty-fields" )
2775 - .append( $j( '<label />' )
2776 - .attr( { 'for' : 'author' } )
2777 - .text( gM( 'mwe-upwiz-author' ) ) )
2778 - .append( authorInput ),
2779 - $j( '<div />' ).addClass( 'mwe-upwiz-thirdparty-license' )
2780 - .text( gM( 'mwe-upwiz-source-thirdparty-license' ) ),
 2776+ $j( '<div class="mwe-upwiz-source-thirdparty-custom-multiple-intro" />' ),
 2777+ $j( '<div class="mwe-upwiz-thirdparty-fields" />' )
 2778+ .append( $j( '<label for="source"/>' ).text( gM( 'mwe-upwiz-source' ) ),
 2779+ sourceInput ),
 2780+ $j( '<div class="mwe-upwiz-thirdparty-fields" />' )
 2781+ .append( $j( '<label for="author"/>' ).text( gM( 'mwe-upwiz-author' ) ),
 2782+ authorInput ),
 2783+ $j( '<div class="mwe-upwiz-thirdparty-license" />' ),
27812784 licenseInputDiv
27822785 )
27832786 );
27842787
2785 - thirdPartyDeed.setQuantity( 1 );
 2788+ _this.count = 1;
 2789+ _this.setQuantity();
 2790+
27862791 },
27872792
2788 -
2789 - setQuantity: function( n ) {
 2793+ setQuantity: function() {
27902794 var _this = this;
27912795 $j( _this.deedChooser.selector )
2792 - .find( 'div.mwe-upwiz-source-thirdparty-custom-plural-intro' )
2793 - .html( n > 1 ? gM( 'mwe-upwiz-source-thirdparty-custom-plural-intro' ) : '' );
 2796+ .find( 'div.mwe-upwiz-source-thirdparty-custom-multiple-intro' )
 2797+ .html( _this.count > 1 ? gM( 'mwe-upwiz-source-thirdparty-custom-multiple-intro' ) : '' );
 2798+
 2799+ $j( _this.deedChooser.selector )
 2800+ .find( 'div.mwe-upwiz-thirdparty-license' )
 2801+ .text( gM( 'mwe-upwiz-source-thirdparty-license', _this.count ) );
 2802+ },
 2803+
 2804+ showValidationTips: function() {
 2805+ // TBD
27942806 }
27952807
27962808

Status & tagging log