Index: trunk/extensions/UploadWizard/UploadWizardHooks.php |
— | — | @@ -147,6 +147,8 @@ |
148 | 148 | 'mwe-upwiz-transported', |
149 | 149 | 'mwe-upwiz-stashed-upload', |
150 | 150 | 'mwe-upwiz-getting-metadata', |
| 151 | + 'mwe-upwiz-submitting-details', |
| 152 | + 'mwe-upwiz-published', |
151 | 153 | 'mwe-upwiz-failed', |
152 | 154 | 'mwe-upwiz-click-here', |
153 | 155 | 'mwe-upwiz-editing', |
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php |
— | — | @@ -78,6 +78,8 @@ |
79 | 79 | 'mwe-upwiz-transported' => 'Finished uploading...', |
80 | 80 | 'mwe-upwiz-stashed-upload' => 'OK', |
81 | 81 | 'mwe-upwiz-getting-metadata' => 'Getting file information and previews...', |
| 82 | + 'mwe-upwiz-submitting-details' => 'Submitting details and publishing...', |
| 83 | + 'mwe-upwiz-published' => 'Published!', |
82 | 84 | 'mwe-upwiz-failed' => 'Failed.', |
83 | 85 | 'mwe-upwiz-click-here' => 'Click here to select a file', |
84 | 86 | 'mwe-upwiz-editing' => 'editing...', |
Index: trunk/extensions/UploadWizard/resources/jquery/jquery.morphCrossfade.js |
— | — | @@ -62,7 +62,10 @@ |
63 | 63 | |
64 | 64 | // should achieve the same result as crossfade( this.children().first() ) but without |
65 | 65 | // animation etc. |
66 | | - this.morphCrossfade( this.children().first(), 0 ); |
| 66 | + $j.each( this, function( i, container ) { |
| 67 | + var $container = $j( container ); |
| 68 | + $container.morphCrossfade( $container.children().first(), 0 ); |
| 69 | + } ); |
67 | 70 | |
68 | 71 | return this; |
69 | 72 | }; |
— | — | @@ -73,38 +76,45 @@ |
74 | 77 | * @param speed (optional) how fast to crossfade, in milliseconds |
75 | 78 | */ |
76 | 79 | $.fn.morphCrossfade = function( newPanelSelector, speed ) { |
77 | | - var container = this; |
| 80 | + var $containers = this; |
78 | 81 | if ( typeof speed === 'undefined' ) { |
79 | 82 | speed = 400; |
80 | 83 | } |
81 | 84 | |
82 | | - container.css( { 'overflow' : 'hidden' } ); |
| 85 | + $containers.css( { 'overflow' : 'hidden' } ); |
83 | 86 | |
84 | | - $oldPanel = $( container.data( 'crossfadeDisplay' ) ); |
85 | | - if ( $oldPanel ) { |
86 | | - // remove auto setting of height from container, and |
87 | | - // make doubly sure that the container height is equal to oldPanel |
88 | | - container.css( { height: $oldPanel.outerHeight() } ); |
89 | | - // take it out of the flow |
90 | | - $oldPanel.css( { position: 'absolute' } ); |
91 | | - // fade WITHOUT hiding when opacity = 0 |
92 | | - $oldPanel.animate( { opacity: 0 }, speed, 'linear', function() { |
93 | | - $oldPanel.css( { visibility: 'hidden'} ); |
94 | | - } ); |
95 | | - } |
96 | | - container.data( 'crossfadeDisplay', newPanelSelector ); |
| 87 | + |
| 88 | + $j.each( $containers, function( i, container ) { |
| 89 | + var $container = $j( container ); |
| 90 | + var $oldPanel = $( $container.data( 'crossfadeDisplay' ) ); |
| 91 | + var $newPanel = ( typeof newPanelSelector === 'string' ) ? $container.find( newPanelSelector ) : $j( newPanelSelector ); |
97 | 92 | |
98 | | - var $newPanel = $( newPanelSelector ); |
99 | | - $newPanel.css( { visibility: 'visible' } ); |
100 | | - container.animate( { height: $newPanel.outerHeight() }, speed, 'linear', function() { |
101 | | - // we place it back into the flow, in case its size changes. |
102 | | - $newPanel.css( { position: 'relative' } ); |
103 | | - // and allow the container to grow with it. |
104 | | - container.css( { height : 'auto' } ); |
| 93 | + if ( $oldPanel.get(0) !== $newPanel.get(0) ) { |
| 94 | + if ( $oldPanel ) { |
| 95 | + // remove auto setting of height from container, and |
| 96 | + // make doubly sure that the container height is equal to oldPanel |
| 97 | + $container.css( { height: $oldPanel.outerHeight() } ); |
| 98 | + // take it out of the flow |
| 99 | + $oldPanel.css( { position: 'absolute' } ); |
| 100 | + // fade WITHOUT hiding when opacity = 0 |
| 101 | + $oldPanel.animate( { opacity: 0 }, speed, 'linear', function() { |
| 102 | + $oldPanel.css( { visibility: 'hidden'} ); |
| 103 | + } ); |
| 104 | + } |
| 105 | + $container.data( 'crossfadeDisplay', $newPanel ); |
| 106 | + |
| 107 | + $newPanel.css( { visibility: 'visible' } ); |
| 108 | + $container.animate( { height: $newPanel.outerHeight() }, speed, 'linear', function() { |
| 109 | + // we place it back into the flow, in case its size changes. |
| 110 | + $newPanel.css( { position: 'relative' } ); |
| 111 | + // and allow the container to grow with it. |
| 112 | + $container.css( { height : 'auto' } ); |
| 113 | + } ); |
| 114 | + $newPanel.animate( { opacity: 1 }, speed ); |
| 115 | + } |
105 | 116 | } ); |
106 | | - $newPanel.animate( { opacity: 1 }, speed ); |
107 | 117 | |
108 | | - return container; |
| 118 | + return this; |
109 | 119 | }; |
110 | 120 | |
111 | 121 | } )( jQuery ); |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDeed.js |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | .msg( 'mwe-upwiz-license-show-all' ) |
118 | 118 | .click( function() { |
119 | 119 | _this.formValidator.resetForm(); |
120 | | - if ( $crossfader.data( 'crossfadeDisplay' ) === $customDiv ) { |
| 120 | + if ( $crossfader.data( 'crossfadeDisplay' ).get(0) === $customDiv.get(0) ) { |
121 | 121 | _this.licenseInput.setDefaultValues(); |
122 | 122 | $crossfader.morphCrossfade( $standardDiv ); |
123 | 123 | $j( this ).msg( 'mwe-upwiz-license-show-all' ); |
Index: trunk/extensions/UploadWizard/resources/uploadWizard.css |
— | — | @@ -704,3 +704,7 @@ |
705 | 705 | .ui-dialog .mwe-upwiz-lightbox { |
706 | 706 | padding: 0; |
707 | 707 | } |
| 708 | + |
| 709 | +.mwe-upwiz-details-texts { |
| 710 | + padding: 0.5em; |
| 711 | +} |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js |
— | — | @@ -633,8 +633,9 @@ |
634 | 634 | } ); |
635 | 635 | |
636 | 636 | $j( '#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons .mwe-upwiz-button-next' ).click( function() { |
637 | | - _this.removeErrorUploads(); |
638 | | - _this.prepareAndMoveToDeeds(); |
| 637 | + _this.removeErrorUploads( function() { |
| 638 | + _this.prepareAndMoveToDeeds(); |
| 639 | + } ); |
639 | 640 | } ); |
640 | 641 | $j ( '#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons .mwe-upwiz-button-retry' ).click( function() { |
641 | 642 | _this.hideFileEndButtons(); |
— | — | @@ -671,23 +672,39 @@ |
672 | 673 | |
673 | 674 | |
674 | 675 | // DETAILS div |
| 676 | + var finalizeDetails = function() { |
| 677 | + if ( mw.isDefined( _this.allowCloseWindow ) ) { |
| 678 | + _this.allowCloseWindow(); |
| 679 | + } |
| 680 | + _this.prefillThanksPage(); |
| 681 | + _this.moveToStep( 'thanks' ); |
| 682 | + }; |
675 | 683 | |
676 | | - $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-button-next' ) |
| 684 | + var startDetails = function() { |
| 685 | + $j( '.mwe-upwiz-hint' ).each( function(i) { $j( this ).tipsy( 'hide' ); } ); // close tipsy help balloons |
| 686 | + if ( _this.detailsValid() ) { |
| 687 | + _this.hideDetailsEndButtons(); |
| 688 | + _this.detailsSubmit( function() { |
| 689 | + _this.showNext( 'details', 'complete', finalizeDetails ); |
| 690 | + } ); |
| 691 | + } |
| 692 | + }; |
| 693 | + |
| 694 | + $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-file-next-some-failed' ).hide(); |
| 695 | + $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-file-next-all-failed' ).hide(); |
| 696 | + |
| 697 | + $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-start-next .mwe-upwiz-button-next' ) |
| 698 | + .click( startDetails ); |
| 699 | + |
| 700 | + $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-buttons .mwe-upwiz-button-next-despite-failures' ) |
677 | 701 | .click( function() { |
678 | | - $j( '.mwe-upwiz-hint' ).each( function(i) { $j( this ).tipsy( 'hide' ); } ); // close tipsy help balloons |
679 | | - if ( _this.detailsValid() ) { |
680 | | - _this.detailsSubmit( function() { |
681 | | - if ( mw.isDefined( _this.allowCloseWindow ) ) { |
682 | | - _this.allowCloseWindow(); |
683 | | - } |
684 | | - _this.prefillThanksPage(); |
685 | | - _this.moveToStep( 'thanks' ); |
686 | | - } ); |
687 | | - } |
| 702 | + _this.removeErrorUploads( finalizeDetails ); |
688 | 703 | } ); |
| 704 | + |
| 705 | + $j ( '#mwe-upwiz-stepdiv-details .mwe-upwiz-buttons .mwe-upwiz-button-retry' ) |
| 706 | + .click( startDetails ); |
689 | 707 | |
690 | 708 | |
691 | | - |
692 | 709 | // WIZARD |
693 | 710 | |
694 | 711 | // check to see if the the skip tutorial cookie is set |
— | — | @@ -878,10 +895,13 @@ |
879 | 896 | * Hide the button choices at the end of the file step. |
880 | 897 | */ |
881 | 898 | hideFileEndButtons: function() { |
882 | | - $j( '#mwe-upwiz-stepdiv .mwe-upwiz-buttons' ).hide(); |
883 | 899 | $j( '#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons .mwe-upwiz-file-endchoice' ).hide(); |
884 | 900 | }, |
885 | 901 | |
| 902 | + hideDetailsEndButtons: function() { |
| 903 | + $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-buttons .mwe-upwiz-file-endchoice' ).hide(); |
| 904 | + }, |
| 905 | + |
886 | 906 | /** |
887 | 907 | * This is useful to clean out unused upload file inputs if the user hits GO. |
888 | 908 | * We are using a second array to iterate, because we will be splicing the main one, _this.uploads |
— | — | @@ -894,11 +914,13 @@ |
895 | 915 | |
896 | 916 | /** |
897 | 917 | * Clear out uploads that are in error mode, perhaps before proceeding to the next step |
| 918 | + * @param {Function} to be called when done |
898 | 919 | */ |
899 | | - removeErrorUploads: function() { |
| 920 | + removeErrorUploads: function( endCallback ) { |
900 | 921 | this.removeMatchingUploads( function( upload ) { |
901 | 922 | return upload.state === 'error'; |
902 | 923 | } ); |
| 924 | + endCallback(); |
903 | 925 | }, |
904 | 926 | |
905 | 927 | |
— | — | @@ -1016,7 +1038,7 @@ |
1017 | 1039 | }, |
1018 | 1040 | function() { |
1019 | 1041 | $j().notify( gM( 'mwe-upwiz-files-complete' ) ); |
1020 | | - _this.showFileNext(); |
| 1042 | + _this.showNext( 'file', 'stashed' ); |
1021 | 1043 | } |
1022 | 1044 | ); |
1023 | 1045 | }, |
— | — | @@ -1030,29 +1052,26 @@ |
1031 | 1053 | * 4) All failed -- have to retry, no other option |
1032 | 1054 | * In principle there could be other configurations, like having the uploads not all in error or stashed state, but |
1033 | 1055 | * we trust that this hasn't happened. |
| 1056 | + * |
| 1057 | + * @param {String} step that we are on |
| 1058 | + * @param {String} desired state to proceed (other state is assumed to be 'error') |
1034 | 1059 | */ |
1035 | | - showFileNext: function() { |
1036 | | - if ( this.uploads.length === 0 ) { |
1037 | | - this.updateFileCounts(); |
1038 | | - $j( '#mwe-upwiz-progress' ).hide(); |
1039 | | - $j( '#mwe-upwiz-upload-ctrls' ).show(); |
1040 | | - $j( '#mwe-upwiz-add-file' ).show(); |
1041 | | - this.moveToStep( 'file' ); |
1042 | | - return; |
1043 | | - } |
| 1060 | + showNext: function( step, desiredState, allOkCallback ) { |
1044 | 1061 | var errorCount = 0; |
1045 | | - var stashedCount = 0; |
| 1062 | + var okCount = 0; |
1046 | 1063 | $j.each( this.uploads, function( i, upload ) { |
1047 | 1064 | if ( upload.state === 'error' ) { |
1048 | 1065 | errorCount++; |
1049 | | - } else if ( upload.state === 'stashed' ) { |
1050 | | - stashedCount++; |
| 1066 | + } else if ( upload.state === desiredState ) { |
| 1067 | + okCount++; |
1051 | 1068 | } else { |
1052 | 1069 | mw.log( "mw.UploadWizardUpload::showFileNext> upload " + i + " not in appropriate state for filenext: " + upload.state ); |
1053 | 1070 | } |
1054 | 1071 | } ); |
1055 | 1072 | var selector = null; |
1056 | | - if ( stashedCount === this.uploads.length ) { |
| 1073 | + var allOk = false; |
| 1074 | + if ( okCount === this.uploads.length ) { |
| 1075 | + allOk = true; |
1057 | 1076 | selector = '.mwe-upwiz-file-next-all-ok'; |
1058 | 1077 | } else if ( errorCount === this.uploads.length ) { |
1059 | 1078 | selector = '.mwe-upwiz-file-next-all-failed'; |
— | — | @@ -1060,9 +1079,11 @@ |
1061 | 1080 | selector = '.mwe-upwiz-file-next-some-failed'; |
1062 | 1081 | } |
1063 | 1082 | |
1064 | | - // perhaps the button should slide down? |
1065 | | - $j( '#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons' ).show().find( selector ).show(); |
1066 | | - |
| 1083 | + if ( allOk && mw.isDefined( allOkCallback ) ) { |
| 1084 | + allOkCallback(); |
| 1085 | + } else { |
| 1086 | + $j( '#mwe-upwiz-stepdiv-' + step + ' .mwe-upwiz-buttons' ).show().find( selector ).show(); |
| 1087 | + } |
1067 | 1088 | }, |
1068 | 1089 | |
1069 | 1090 | /** |
— | — | @@ -1169,35 +1190,31 @@ |
1170 | 1191 | */ |
1171 | 1192 | detailsSubmit: function( endCallback ) { |
1172 | 1193 | var _this = this; |
1173 | | - // some details blocks cannot be submitted (for instance, identical file hash) |
1174 | | - _this.removeBlockedDetails(); |
1175 | 1194 | |
1176 | | - // remove ability to edit details |
1177 | | - $j.each( _this.uploads, function( i, upload ) { |
1178 | | - upload.details.div.mask(); |
| 1195 | + $j.each( _this.uploads, function( i, upload ) { |
| 1196 | + $j( upload.details.submittingDiv ) |
| 1197 | + .find( '.mwe-upwiz-visible-file-filename-text' ) |
| 1198 | + .html( upload.title.getMain() ); |
1179 | 1199 | } ); |
1180 | 1200 | |
| 1201 | + // remove ability to edit details |
| 1202 | + $j( '#mwe-upwiz-stepdiv-details' ) |
| 1203 | + .find( '.mwe-upwiz-data' ) |
| 1204 | + .morphCrossfade( '.mwe-upwiz-submitting' ); |
| 1205 | + |
1181 | 1206 | // add the upload progress bar, with ETA |
1182 | 1207 | // add in the upload count |
1183 | 1208 | _this.makeTransitioner( |
1184 | 1209 | 'details', |
1185 | 1210 | [ 'submitting-details' ], |
1186 | | - [ 'complete' ], |
| 1211 | + [ 'error', 'complete' ], |
1187 | 1212 | function( upload ) { |
1188 | 1213 | upload.details.submit(); |
1189 | 1214 | }, |
1190 | | - endCallback /* called when all uploads are "complete" */ |
| 1215 | + endCallback /* called when all uploads are in a valid end state */ |
1191 | 1216 | ); |
1192 | 1217 | }, |
1193 | 1218 | |
1194 | | - /** |
1195 | | - * Removes(?) details that we can't edit for whatever reason -- might just advance them to a different state? |
1196 | | - */ |
1197 | | - removeBlockedDetails: function() { |
1198 | | - // TODO |
1199 | | - }, |
1200 | | - |
1201 | | - |
1202 | 1219 | prefillThanksPage: function() { |
1203 | 1220 | var _this = this; |
1204 | 1221 | |
— | — | @@ -1311,7 +1328,7 @@ |
1312 | 1329 | { |
1313 | 1330 | text: gM( 'mwe-upwiz-cancel', uploads.length ), |
1314 | 1331 | click: function() { |
1315 | | - $j( this ).dialog( 'close' ) |
| 1332 | + $j( this ).dialog( 'close' ); |
1316 | 1333 | } |
1317 | 1334 | } |
1318 | 1335 | ]; |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js |
— | — | @@ -174,9 +174,19 @@ |
175 | 175 | moreDetailsDiv |
176 | 176 | ); |
177 | 177 | |
| 178 | + _this.submittingDiv = $j( '<div></div>' ).addClass( 'mwe-upwiz-submitting' ) |
| 179 | + .append( |
| 180 | + $j( '<div></div>' ).addClass( 'mwe-upwiz-file-indicator' ), |
| 181 | + $j( '<div></div>' ).addClass( 'mwe-upwiz-details-texts' ).append( |
| 182 | + $j( '<div></div>' ).addClass( 'mwe-upwiz-visible-file-filename-text' ), |
| 183 | + $j( '<div></div>' ).addClass( 'mwe-upwiz-file-status-line' ) |
| 184 | + ) |
| 185 | + ); |
| 186 | + |
178 | 187 | $j( _this.dataDiv ).append( |
179 | | - _this.$form |
180 | | - ); |
| 188 | + _this.$form, |
| 189 | + _this.submittingDiv |
| 190 | + ).morphCrossfader(); |
181 | 191 | |
182 | 192 | $j( _this.div ).append( |
183 | 193 | _this.thumbnailDiv, |
— | — | @@ -657,6 +667,7 @@ |
658 | 668 | var _this = this; |
659 | 669 | |
660 | 670 | _this.upload.state = 'submitting-details'; |
| 671 | + _this.setStatus( gM( 'mwe-upwiz-submitting-details' ) ); |
661 | 672 | _this.showIndicator( 'progress' ); |
662 | 673 | |
663 | 674 | // XXX check state of details for okayness ( license selected, at least one desc, sane filename ) |
— | — | @@ -672,6 +683,7 @@ |
673 | 684 | }; |
674 | 685 | |
675 | 686 | var err = function( code, info ) { |
| 687 | + _this.upload.state = 'error'; |
676 | 688 | _this.showError( code, info ); |
677 | 689 | }; |
678 | 690 | |
— | — | @@ -682,7 +694,7 @@ |
683 | 695 | _this.upload.state = 'complete'; |
684 | 696 | _this.showIndicator( 'uploaded' ); |
685 | 697 | } else { |
686 | | - _this.showError( 'details-info-missing', result ); |
| 698 | + err( 'details-info-missing', result ); |
687 | 699 | } |
688 | 700 | }; |
689 | 701 | |
— | — | @@ -701,11 +713,11 @@ |
702 | 714 | }, |
703 | 715 | |
704 | 716 | setStatus: function( s ) { |
705 | | - this.div.data( 'statusLine' ).html( s ).show(); |
| 717 | + this.div.find( '.mwe-upwiz-file-status-line' ).html( s ).show(); |
706 | 718 | }, |
707 | 719 | |
708 | 720 | showIndicator: function( statusStr ) { |
709 | | - this.div.data( 'indicator' ) |
| 721 | + this.div.find( '.mwe-upwiz-file-indicator' ) |
710 | 722 | .show() |
711 | 723 | .removeClass( 'mwe-upwiz-status-progress mwe-upwiz-status-error mwe-upwiz-status-uploaded' ) |
712 | 724 | .addClass( 'mwe-upwiz-status-' + statusStr ); |
Index: trunk/extensions/UploadWizard/SpecialUploadWizard.php |
— | — | @@ -265,7 +265,18 @@ |
266 | 266 | . '<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-details" style="display:none;">' |
267 | 267 | . '<div id="mwe-upwiz-macro-files" class="mwe-upwiz-filled-filelist ui-corner-all"></div>' |
268 | 268 | . '<div class="mwe-upwiz-buttons">' |
269 | | - . '<button class="mwe-upwiz-button-next">' . wfMsg( "mwe-upwiz-next-details" ) . '</button>' |
| 269 | + . '<div class="mwe-upwiz-start-next mwe-upwiz-file-endchoice">' |
| 270 | + . '<button class="mwe-upwiz-button-next">' . wfMsg( "mwe-upwiz-next-details" ) . '</button>' |
| 271 | + . '</div>' |
| 272 | + . '<div class="mwe-upwiz-file-next-some-failed mwe-upwiz-file-endchoice">' |
| 273 | + . wfMsg( "mwe-upwiz-file-some-failed" ) |
| 274 | + . '<button class="mwe-upwiz-button-retry">' . wfMsg( "mwe-upwiz-file-retry" ) . '</button>' |
| 275 | + . '<button class="mwe-upwiz-button-next-despite-failures">' . wfMsg( "mwe-upwiz-next-file-despite-failures" ) . '</button>' |
| 276 | + . '</div>' |
| 277 | + . '<div class="mwe-upwiz-file-next-all-failed mwe-upwiz-file-endchoice">' |
| 278 | + . wfMsg( "mwe-upwiz-file-all-failed" ) |
| 279 | + . '<button class="mwe-upwiz-button-retry"> ' . wfMsg( "mwe-upwiz-file-retry" ) . '</button>' |
| 280 | + . '</div>' |
270 | 281 | . '</div>' |
271 | 282 | . '</div>' |
272 | 283 | |