r65918 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65917‎ | r65918 | r65919 >
Date:20:07, 4 May 2010
Author:neilk
Status:deferred
Tags:
Comment:
remove readiness constraint for now, four-step wizard
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.UploadWizard.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.UploadWizard.js
@@ -1058,6 +1058,15 @@
10591059 .append( $j( '<div class="mwe-upwiz-details-input"></div>' ).append( _this.titleInput ) )
10601060 .append( _this.titleErrorDiv );
10611061
 1062+ _this.deedDiv = $j( '<div class="mwe-upwiz-custom-deed" />' );
 1063+
 1064+ _this.copyrightInfoFieldset = $j('<fieldset class="mwe-fieldset mwe-upwiz-copyright-info"></fieldset>')
 1065+ .hide()
 1066+ .append(
 1067+ $j( '<legend class="mwe-legend">' ).append( gM( 'mwe-upwiz-copyright-info' ) ),
 1068+ _this.deedDiv
 1069+ );
 1070+
10621071 _this.moreDetailsDiv = $j('<div class="mwe-more-details"></div>').maskSafeHide();
10631072
10641073 _this.moreDetailsCtrlDiv = $j( '<div class="mwe-upwiz-details-more-options"></div>' );
@@ -1088,26 +1097,7 @@
10891098 )
10901099 );
10911100
1092 - var copyrightInfoFieldset = $j('<fieldset class="mwe-fieldset"></fieldset>')
1093 - .append(
1094 - $j( '<legend class="mwe-legend">' ).append( gM( 'mwe-upwiz-copyright-info' ) ),
1095 - $j( '<div class="mwe-upwiz-copyright-info" />' ).append(
1096 - $j( '<label />' ).append (
1097 - $j( '<input type="radio" name="custom-deed" value="macro" />' ),
1098 - gM( 'mwe-copyright-macro' ) ),
1099 - $j( '<label />' ).append (
1100 - $j( '<input type="radio" name="custom-deed" value="custom" />' ),
1101 - gM( 'mwe-copyright-custom' ) ) ),
1102 - $j( '<div class="mwe-upwiz-custom-deed" />' )
1103 - );
1104 -
1105 - $j( copyrightInfoFieldset ).find( 'input[name="custom-deed"]' ).change( function() {
1106 - var value = $j( copyrightInfoFieldset ).find( 'input[name="custom-deed"]:checked' ).val();
1107 - _this.toggleCustomDeed( value === 'custom' );
1108 - } );
11091101
1110 - $j( copyrightInfoFieldset ).find( 'input[value="macro"]' ).attr( 'checked', true );
1111 -
11121102
11131103 var aboutFileFieldset = $j('<fieldset class="mwe-fieldset"></fieldset>')
11141104 .append( $j( '<legend class="mwe-legend">' ).append( gM( 'mwe-upwiz-about-format' ) ) )
@@ -1129,16 +1119,16 @@
11301120 .append( $j( _this.dataDiv )
11311121 .append( _this.descriptionsContainerDiv )
11321122 .append( _this.titleContainerDiv )
 1123+ .append( _this.copyrightInfoFieldset )
11331124 .append( _this.moreDetailsCtrlDiv )
11341125 .append( $j( _this.moreDetailsDiv )
11351126 .append( aboutThisWorkFieldset )
1136 - .append( copyrightInfoFieldset )
1137 - .append( aboutFileFieldset )
 1127+ //.append( aboutFileFieldset )
11381128 .append( otherInformationDiv )
11391129 )
11401130 );
11411131
1142 - mw.UploadWizardUtil.makeMoreToggler( _this.moreDetailsCtrlDiv, _this.moreDetailsDiv);
 1132+ mw.UploadWizardUtil.makeMoreToggler( _this.moreDetailsCtrlDiv, _this.moreDetailsDiv );
11431133
11441134 _this.addDescription();
11451135 $j( containerDiv ).append( _this.div );
@@ -1151,19 +1141,20 @@
11521142 /**
11531143 * toggles whether we use the 'macro' deed or our own
11541144 */
1155 - toggleCustomDeed: function( isUsingCustomDeed ) {
 1145+ useCustomDeedChooser: function() {
11561146 var _this = this;
1157 - var deedDiv = $j( _this.div ).find( '.mwe-upwiz-custom-deed' );
1158 - if ( isUsingCustomDeed ) {
1159 - _this.upload.wizardDeedChooser = _this.upload.deedChooser;
1160 - _this.upload.deedChooser = new mw.UploadWizardDeedChooser( deedDiv );
1161 - } else {
1162 - _this.upload.deedChooser = _this.upload.wizardDeedChooser;
1163 - deedDiv.empty();
1164 - }
 1147+ _this.copyrightInfoFieldset.show();
 1148+ _this.upload.wizardDeedChooser = _this.upload.deedChooser;
 1149+ _this.upload.deedChooser = new mw.UploadWizardDeedChooser( _this.deedDiv );
11651150 },
11661151
 1152+ useDeedChooser: function( deedChooser ) {
 1153+ var _this = this;
 1154+ _this.upload.deedChooser = deedChooser;
 1155+ _this.deedDiv.empty();
 1156+ },
11671157
 1158+
11681159 /**
11691160 * Sets the filename from the title plus this upload's extension.
11701161 */
@@ -1860,7 +1851,7 @@
18611852 + '<div id="mwe-upwiz-progress" class="ui-helper-clearfix"></div>'
18621853 + '</div>'
18631854 + '<div class="mwe-upwiz-buttons"/>'
1864 - + '<button class="mwe-upwiz-button-next" disabled="true" />'
 1855+ + '<button class="mwe-upwiz-button-next" />'
18651856 + '</div>'
18661857 + '</div>'
18671858
@@ -1870,7 +1861,7 @@
18711862 + '<div id="mwe-upwiz-deeds" class="ui-helper-clearfix"></div>'
18721863 + '<div id="mwe-upwiz-deeds-custom" class="ui-helper-clearfix"></div>'
18731864 + '<div class="mwe-upwiz-buttons"/>'
1874 - + '<button class="mwe-upwiz-button-next" disabled="true" />'
 1865+ + '<button class="mwe-upwiz-button-next" />'
18751866 + '</div>'
18761867 + '</div>'
18771868
@@ -1883,7 +1874,7 @@
18841875 + '<div id="mwe-upwiz-macro-files"></div>'
18851876 + '</div>'
18861877 + '<div class="mwe-upwiz-buttons"/>'
1887 - + '<button class="mwe-upwiz-button-next" disabled="true" />'
 1878+ + '<button class="mwe-upwiz-button-next" />'
18881879 + '</div>'
18891880 + '</div>'
18901881
@@ -1925,7 +1916,8 @@
19261917 } );
19271918
19281919 $j( '#mwe-upwiz-deeds-custom' ).append(
1929 - $j( '<div id="mwe-upwiz-deeds-later" style="hidden"/>' )
 1920+ $j( '<div id="mwe-upwiz-deeds-later" />' )
 1921+ .hide()
19301922 .append( $j( '<label>' )
19311923 .append(
19321924 $j( '<input />')
@@ -1935,6 +1927,7 @@
19361928 if ( $j( this ).is( ':checked' ) ) {
19371929 _this.deedChooser.showDeedChoice();
19381930 _this.deedChooser.choose( customDeed );
 1931+ _this.deedChooser.trigger( 'isReady' );
19391932 } else {
19401933 _this.deedChooser.choose( mw.UploadWizardNullDeed );
19411934 }
@@ -1944,8 +1937,9 @@
19451938 )
19461939 );
19471940
1948 - $j( _this.deedChooser ).bind( 'setQuantity', function() {
1949 - if ( _this.count > 1 ) {
 1941+ $j( _this.deedChooser ).bind( 'setQuantityEvent', function() {
 1942+ mw.log( "checking this deedchooser count " + _this.deedChooser.count );
 1943+ if ( _this.deedChooser.count > 1 ) {
19501944 $j( '#mwe-upwiz-deeds-later' ).show();
19511945 } else {
19521946 $j( '#mwe-upwiz-deeds-later' ).hide();
@@ -1958,24 +1952,40 @@
19591953 _this.moveToStep('details');
19601954 } );
19611955
 1956+ // XXX perhaps we should defer this until we click next
19621957 $j( _this.deedChooser ).bind( 'chooseDeed', function() {
1963 - $j( '#mwe-upwiz-stepdiv-deeds' ).enableNextButton();
19641958 var isCustom = ( _this.deedChooser.deed === customDeed );
19651959 $j.each( _this.uploads, function( i, upload ) {
1966 - upload.details.toggleCustomDeed( isCustom );
 1960+ if (isCustom) {
 1961+ upload.details.useCustomDeedChooser();
 1962+ } else {
 1963+ upload.details.useDeedChooser( _this.deedChooser );
 1964+ }
19671965 } );
19681966 } );
19691967
 1968+ // XXX perhaps we should defer this until we click next
19701969 $j( _this.deedChooser ).bind( 'chooseNullDeed', function() {
1971 - $j( '#mwe-upwiz-stepdiv-deeds' ).disableNextButton();
19721970 $j.each( _this.uploads, function( i, upload ) {
1973 - upload.details.toggleCustomDeed( false );
 1971+ upload.details.deedChooser = _this.deedChooser;
19741972 } );
 1973+ // $j( '#mwe-upwiz-stepdiv-deeds' ).disableNextButton();
19751974 } );
19761975
 1976+ /*
 1977+ // XXX figure out some way to make them ready / unready
 1978+ // timeout after input, check for readiness, then trigger event?
 1979+ $j( _this.deedChooser ).bind( 'isReady', function() {
 1980+ $j( '#mwe-upwiz-stepdiv-deeds' ).enableNextButton();
 1981+ } );
19771982
 1983+ $j( _this.deedChooser ).bind( 'isNotReady', function() {
 1984+ $j( '#mwe-upwiz-stepdiv-deeds' ).disableNextButton();
 1985+ } );
 1986+*/
 1987+
19781988 // DETAILS div
1979 - $j( '#mwe-upwiz-stepdiv-details' ).click( function() {
 1989+ $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-button-next' ).click( function() {
19801990 _this.detailsSubmit( function() {
19811991 _this.prefillThanksPage();
19821992 _this.moveToStep('thanks');
@@ -2461,7 +2471,7 @@
24622472 'thirdparty' : _this.setupDeedThirdParty()
24632473 };
24642474
2465 - _this.setQuantity(1);
 2475+ _this.setQuantity();
24662476 };
24672477
24682478
@@ -2501,6 +2511,7 @@
25022512 }
25032513
25042514 } );
 2515+ $j( _this ).trigger( 'setQuantityEvent' );
25052516
25062517 },
25072518
@@ -2509,6 +2520,7 @@
25102521 _this.deed = deed;
25112522 if ( deed === mw.UploadWizardNullDeed ) {
25122523 $j( _this ).trigger( 'chooseNullDeed' );
 2524+ //_this.trigger( 'isNotReady' );
25132525 $j( _this.selector )
25142526 .find( 'input.mwe-accept-deed' )
25152527 .attr( 'checked', false )
@@ -3086,7 +3098,8 @@
30873099 $j.fn.notify = function ( message ) {
30883100 // could do something here with Chrome's in-browser growl-like notifications.
30893101 // play a sound?
3090 - alert( message );
 3102+ // if the current tab does not have focus, use an alert?
 3103+ // alert( message );
30913104 };
30923105
30933106 $j.fn.enableNextButton = function() {

Status & tagging log