Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php |
— | — | @@ -105,6 +105,9 @@ |
106 | 106 | 'mwe-upwiz-tooltip-description' => 'Briefly describe everything notable about the work. For a photo, mention the main things that are depicted, the occasion or the place.', |
107 | 107 | 'mwe-upwiz-tooltip-other' => 'Any other information you want to include about this work. You may use wikitext code.', |
108 | 108 | 'mwe-upwiz-tooltip-more-info' => 'Learn more.', |
| 109 | + 'mwe-upwiz-file-need-file' => 'Please add an upload first.', |
| 110 | + 'mwe-upwiz-file-need-start' => 'Please press this button to start your uploads.', |
| 111 | + 'mwe-upwiz-file-need-complete' => 'Please wait until all files have finished uploading.', |
109 | 112 | ); |
110 | 113 | |
111 | 114 | /** Message documentation (Message documentation) |
Index: trunk/extensions/UploadWizard/js/mw.UploadWizard.js |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | |
8 | 8 | |
9 | 9 | /** |
10 | | - * |
| 10 | + * Sort of an abstract class for deeds |
11 | 11 | */ |
12 | 12 | mw.UploadWizardDeed = function() { |
13 | 13 | var _this = this; |
— | — | @@ -367,7 +367,6 @@ |
368 | 368 | _this.transportProgress = 1; |
369 | 369 | $j( _this ).trigger( 'transportedEvent' ); |
370 | 370 | |
371 | | - debugger; |
372 | 371 | if ( result.upload && result.upload.imageinfo && result.upload.imageinfo.descriptionurl ) { |
373 | 372 | // success |
374 | 373 | _this.extractUploadInfo( result ); |
— | — | @@ -1868,7 +1867,28 @@ |
1869 | 1868 | } ); |
1870 | 1869 | |
1871 | 1870 | $j( '#mwe-upwiz-stepdiv-file .mwe-upwiz-button-next').click( function() { |
1872 | | - _this.moveToStep( 'deeds' ); |
| 1871 | + if ( _this.uploads.length === 0 ) { |
| 1872 | + alert( gM( 'mwe-upwiz-file-need-file' ) ); |
| 1873 | + return; |
| 1874 | + } |
| 1875 | + var overallState = 'new'; |
| 1876 | + $j.each( _this.uploads, function( i, upload ) { |
| 1877 | + if ( upload.state == 'transporting' ) { |
| 1878 | + overallState = 'transporting'; |
| 1879 | + } else if ( upload.state == 'transported' && overallState != 'transporting' ) { |
| 1880 | + overallState = 'transported'; |
| 1881 | + } |
| 1882 | + } ); |
| 1883 | + if ( overallState == 'new' ) { |
| 1884 | + alert( gM( 'mwe-upwiz-file-need-start' ) ); |
| 1885 | + } else if ( overallState == 'transporting' ) { |
| 1886 | + alert( gM( 'mwe-upwiz-file-need-complete' ) ); |
| 1887 | + } else if ( overallState == 'transported' ) { |
| 1888 | + _this.moveToStep( 'deeds' ); |
| 1889 | + } else { |
| 1890 | + alert( "error: could not recognize state of uploads: " + overallState ); |
| 1891 | + } |
| 1892 | + |
1873 | 1893 | } ); |
1874 | 1894 | |
1875 | 1895 | // DEEDS div |
— | — | @@ -2349,7 +2369,7 @@ |
2350 | 2370 | $j( '<textarea class="mwe-long-textarea" rows="1"/>' ) |
2351 | 2371 | .growTextArea() |
2352 | 2372 | .append( thumbWikiText ) |
2353 | | - .resizeIfNeeded() |
| 2373 | + .trigger('change') |
2354 | 2374 | ), |
2355 | 2375 | $j('<p/>').append( |
2356 | 2376 | gM( 'mwe-upwiz-thanks-url' ), |
— | — | @@ -2357,7 +2377,7 @@ |
2358 | 2378 | $j( '<textarea class="mwe-long-textarea" rows="1"/>' ) |
2359 | 2379 | .growTextArea() |
2360 | 2380 | .append( upload.imageinfo.descriptionurl ) |
2361 | | - .resizeIfNeeded() |
| 2381 | + .trigger('change') |
2362 | 2382 | ) |
2363 | 2383 | ) |
2364 | 2384 | ); |
— | — | @@ -2962,7 +2982,7 @@ |
2963 | 2983 | } ); |
2964 | 2984 | } |
2965 | 2985 | |
2966 | | - this.resizeIfNeeded = function() { |
| 2986 | + var resizeIfNeeded = function() { |
2967 | 2987 | // this is the dom element |
2968 | 2988 | while (this.scrollHeight > this.offsetHeight) { |
2969 | 2989 | this.rows++; |
— | — | @@ -2972,8 +2992,8 @@ |
2973 | 2993 | |
2974 | 2994 | this.addClass( 'mwe-grow-textarea' ); |
2975 | 2995 | |
2976 | | - this.change(this.resizeIfNeeded); |
2977 | | - this.keyup(this.resizeIfNeeded); |
| 2996 | + this.keyup( resizeIfNeeded ); |
| 2997 | + this.change( resizeIfNeeded ); |
2978 | 2998 | |
2979 | 2999 | |
2980 | 3000 | return this; |