Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php |
— | — | @@ -36,15 +36,16 @@ |
37 | 37 | 'mwe-upwiz-tutorial-error-file-missing' => 'Sorry, we could not find any files for the tutorial that is supposed to go here. Please contact the system administrators.', |
38 | 38 | 'mwe-upwiz-tutorial-error-cannot-transform' => 'Sorry, we could not get a scaled image of the tutorial to fit this screen. This may be a temporary problem with Wikimedia Commons; try again later.', |
39 | 39 | 'mwe-upwiz-help-desk' => 'Help Desk', |
40 | | - 'mwe-upwiz-intro' => "Welcome to Wikimedia Commons, a repository of images, sounds and movies that anyone can freely download and use. |
41 | | -Add to humanity's knowledge by uploading files that could be used for an educational purpose.", |
42 | 40 | 'mwe-upwiz-add-file-n' => 'Add another file', |
43 | 41 | 'mwe-upwiz-add-file-0' => 'Click here to upload a file', |
44 | 42 | 'mwe-upwiz-browse' => 'Browse...', |
45 | | - 'mwe-upwiz-transported' => 'OK', |
46 | | - 'mwe-upwiz-failed' => 'Failed', |
| 43 | + 'mwe-upwiz-transport-started' => 'Starting...', |
| 44 | + 'mwe-upwiz-uploading' => 'Uploading...', |
| 45 | + 'mwe-upwiz-transported' => 'Finished uploading...', |
| 46 | + 'mwe-upwiz-stashed-upload' => 'OK', |
| 47 | + 'mwe-upwiz-getting-metadata' => 'Getting file information and previews...', |
| 48 | + 'mwe-upwiz-failed' => 'Failed.', |
47 | 49 | 'mwe-upwiz-click-here' => 'Click here to select a file', |
48 | | - 'mwe-upwiz-uploading' => 'uploading...', |
49 | 50 | 'mwe-upwiz-editing' => 'editing...', |
50 | 51 | 'mwe-upwiz-remove' => 'Remove', |
51 | 52 | 'mwe-upwiz-remove-upload' => 'Remove this file from the list of files to upload', |
Index: trunk/extensions/UploadWizard/resources/spinner-orange.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: trunk/extensions/UploadWizard/resources/checkmark.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: trunk/extensions/UploadWizard/resources/dir.combined.css |
— | — | @@ -19,13 +19,25 @@ |
20 | 20 | } |
21 | 21 | */ |
22 | 22 | |
| 23 | +#mwe-upwiz-steps { |
| 24 | + background-color: white; |
| 25 | + background-image: none; |
| 26 | + border: solid 1px #a7d7f9; |
| 27 | +} |
23 | 28 | |
| 29 | +#mwe-upwiz-steps li { |
| 30 | + color: #666666; |
| 31 | +} |
| 32 | + |
| 33 | +#mwe-upwiz-steps li.head { |
| 34 | + color: #000000; |
| 35 | +} |
| 36 | + |
24 | 37 | .mwe-upwiz-clearing { |
25 | 38 | clear: left; |
26 | 39 | width: 100%; |
27 | 40 | } |
28 | 41 | |
29 | | - |
30 | 42 | #mwe-upwiz-content { |
31 | 43 | padding: 1em; |
32 | 44 | } |
— | — | @@ -95,7 +107,7 @@ |
96 | 108 | .mwe-upwiz-file-indicator, .mwe-upwiz-count { |
97 | 109 | float: right; |
98 | 110 | margin-left: 0.5em; |
99 | | - padding: 0.5em 0.5em 0.5em 20px; /* 20px for the icon */ |
| 111 | + padding: 0.5em; |
100 | 112 | } |
101 | 113 | |
102 | 114 | .mwe-upwiz-visible-file .mwe-upwiz-file-indicator { |
— | — | @@ -215,20 +227,21 @@ |
216 | 228 | text-decoration: none; |
217 | 229 | } |
218 | 230 | |
| 231 | +.mwe-upwiz-file-indicator { |
| 232 | + height: 40px; |
| 233 | + width: 40px; |
| 234 | +} |
| 235 | + |
219 | 236 | .mwe-upwiz-status-progress { |
220 | | - background: url(spinner-orange.gif) no-repeat left center; |
221 | | - font-weight: bold; |
222 | | - color: #ff9900; |
| 237 | + background: url(24px-spinner-0645ad.gif) no-repeat center center; |
223 | 238 | } |
224 | 239 | |
225 | | -.mwe-upwiz-status-completed { |
226 | | - background: url(checkmark.gif) no-repeat left center; |
227 | | - font-weight: bold; |
228 | | - color: #009900; |
| 240 | +.mwe-upwiz-status-stashed { |
| 241 | + background: url(32px-Dialog-apply-009900.svg.png) no-repeat center center; |
229 | 242 | } |
230 | 243 | |
231 | | -.mwe-upwiz-status-failed { |
232 | | - background: url(16px-Gnome-process-stop.svg.png) no-repeat left center; |
| 244 | +.mwe-upwiz-status-error { |
| 245 | + background: url(32px-Nuvola_apps_important_orange.svg.png) no-repeat left center; |
233 | 246 | font-weight: bold; |
234 | 247 | color: #CC0000; |
235 | 248 | } |
Index: trunk/extensions/UploadWizard/resources/32px-Dialog-apply-009900.svg.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/UploadWizard/resources/32px-Dialog-apply-009900.svg.png |
___________________________________________________________________ |
Added: svn:mime-type |
236 | 249 | + image/png |
Index: trunk/extensions/UploadWizard/resources/dir.combined.min.css |
— | — | @@ -1,17 +1,16 @@ |
2 | 2 | form.mwe-upwiz-form{display:inline;}#upload-wizard{margin-top:18px;min-width:750px; |
3 | 3 | max-width:900px; |
4 | | -}.mwe-upwiz-clearing{clear:left;width:100%;}#mwe-upwiz-content{padding:1em;}.mwe-upwiz-add-files-0,#mwe-upwiz-files{margin-top:3em;margin-bottom:3em;}.mwe-upwiz-add-files-0{text-align:center;font-size:large;}#mwe-upwiz-add-file{} |
| 4 | +}#mwe-upwiz-steps{background-color:white;background-image:none;border:solid 1px #a7d7f9;}#mwe-upwiz-steps li{color:#666666;}#mwe-upwiz-steps li.head{color:#000000;}.mwe-upwiz-clearing{clear:left;width:100%;}#mwe-upwiz-content{padding:1em;}.mwe-upwiz-add-files-0,#mwe-upwiz-files{margin-top:3em;margin-bottom:3em;}.mwe-upwiz-add-files-0{text-align:center;font-size:large;}#mwe-upwiz-add-file{} |
5 | 5 | #mwe-upwiz-add-file.hover{text-decoration:underline;} |
6 | 6 | #mwe-upwiz-add-file,.mwe-upwiz-more-options{outline:none;cursor:pointer;} |
7 | 7 | .mwe-upwiz-file-ctrl-container{position:absolute;overflow:hidden;}.mwe-upwiz-file-input,.mwe-upwiz-visible-file{cursor:pointer;} |
8 | | -.mwe-upwiz-file-input,.disabler{font-size:100px;-moz-opacity:0.3;filter:alpha(opacity:0);opacity:0;z-index:2;}.mwe-upwiz-file.filled{position:relative;}.mwe-upwiz-file.odd .mwe-upwiz-visible-file{background:#f5f5f5;}.mwe-upwiz-file-status-line-item{display:inline-block;float:left;margin-right:.5em;}.mwe-upwiz-visible-file .mwe-upwiz-remove-ctrl{visibility:hidden;}.mwe-upwiz-file-indicator,.mwe-upwiz-count{float:right;margin-left:0.5em;padding:0.5em 0.5em 0.5em 20px; |
9 | | -}.mwe-upwiz-visible-file .mwe-upwiz-file-indicator{visibility:hidden;}.mwe-upwiz-visible-file{display:none;}.mwe-upwiz-file.filled .mwe-upwiz-visible-file{display:block;}.mwe-upwiz-visible-file-filename{padding:0.5em;margin-right:40px;overflow:hidden;}.mwe-upwiz-icon{float:left;}.mwe-upwiz-filled-filelist{border:1px solid #d8d8d8;}.mwe-upwiz-file-texts{margin-left:46px;}.mwe-upwiz-file-status{display:none;color:#797979;}.mwe-upwiz-progress-bar-etr-container{ |
| 8 | +.mwe-upwiz-file-input,.disabler{font-size:100px;-moz-opacity:0.3;filter:alpha(opacity:0);opacity:0;z-index:2;}.mwe-upwiz-file.filled{position:relative;}.mwe-upwiz-file.odd .mwe-upwiz-visible-file{background:#f5f5f5;}.mwe-upwiz-file-status-line-item{display:inline-block;float:left;margin-right:.5em;}.mwe-upwiz-visible-file .mwe-upwiz-remove-ctrl{visibility:hidden;}.mwe-upwiz-file-indicator,.mwe-upwiz-count{float:right;margin-left:0.5em;padding:0.5em;}.mwe-upwiz-visible-file .mwe-upwiz-file-indicator{visibility:hidden;}.mwe-upwiz-visible-file{display:none;}.mwe-upwiz-file.filled .mwe-upwiz-visible-file{display:block;}.mwe-upwiz-visible-file-filename{padding:0.5em;margin-right:40px;overflow:hidden;}.mwe-upwiz-icon{float:left;}.mwe-upwiz-filled-filelist{border:1px solid #d8d8d8;}.mwe-upwiz-file-texts{margin-left:46px;}.mwe-upwiz-file-status{display:none;color:#797979;}.mwe-upwiz-progress-bar-etr-container{ |
10 | 9 | } |
11 | 10 | .mwe-upwiz-file-preview{float:left;height:40px;width:40px;margin-right:6px;background:url(32px-Blank-document.svg.png) no-repeat center top;}.mwe-upwiz-add-files-n{float:left;margin-top:5px;margin-left:4px;}#mwe-upwiz-add-file-container.mwe-upwiz-add-files-n,.mwe-upwiz-progress-bar-etr{width:300px;padding-left:5px;}#mwe-upwiz-add-file-container.mwe-upwiz-add-files-n{float:left;}.mwe-upwiz-visible-file{width:100%; |
12 | 11 | white-space:nowrap;overflow:hidden;}.mwe-upwiz-file.hover .mwe-upwiz-visible-file{background:#e0f0ff !important;}.mwe-upwiz-file.hover .mwe-upwiz-remove-ctrl{visibility:visible;} |
13 | 12 | .helper{color:#cccccc; |
14 | 13 | font-variant:italic,oblique;text-align:center;}#mwe-upwiz-files{margin-right:8em;margin-left:8em;}.filled + .filled{border-top:1px solid #d8d8d8;}#mwe-upwiz-upload-ctrls{margin-top:1em;}#mwe-upwiz-add-file-container{ |
15 | | -}.mwe-upwiz-details-descriptions .mwe-upwiz-remove-ctrl{vertical-align:top;display:inline-block;}a[disabled=true]{color:#999999;text-decoration:none;cursor:default;}a[disabled=true]:hover{text-decoration:none;}.mwe-upwiz-status-progress{background:url(spinner-orange.gif) no-repeat left center;font-weight:bold;color:#ff9900;}.mwe-upwiz-status-completed{background:url(checkmark.gif) no-repeat left center;font-weight:bold;color:#009900;}.mwe-upwiz-status-failed{background:url(16px-Gnome-process-stop.svg.png) no-repeat left center;font-weight:bold;color:#CC0000;}.mwe-upwiz-progress{margin-top:15px;}.mwe-upwiz-progress-bar-etr{float:left;}.mwe-upwiz-etr{text-align:center;}.mwe-upwiz-upload-warning{background:#ffffe0;}.mwe-upwiz-details-error{display:none;background:#ffffe0;}.mwe-upwiz-thumbnail,.mwe-upwiz-thumbnail-small{border:1px solid #cccccc;text-align:center;background:#ffffff;}.mwe-upwiz-thumbnail{padding:0.5em;width:120px;}.mwe-upwiz-thumbnail-side{float:left;margin-bottom:1em;margin-right:1em;}.mwe-upwiz-thumbnail-small{padding:0.25em;width:60px;}#mwe-upwiz-deeds-thumbnails{text-align:center;margin:1em 0;background:#f0f0f0;}#mwe-upwiz-deeds-thumbnails .mwe-upwiz-thumbnail-small{display:inline-block;margin:1em;vertical-align:middle;} |
| 14 | +}.mwe-upwiz-details-descriptions .mwe-upwiz-remove-ctrl{vertical-align:top;display:inline-block;}a[disabled=true]{color:#999999;text-decoration:none;cursor:default;}a[disabled=true]:hover{text-decoration:none;}.mwe-upwiz-file-indicator{height:40px;width:40px;}.mwe-upwiz-status-progress{background:url(24px-spinner-0645ad.gif) no-repeat center center;}.mwe-upwiz-status-stashed{background:url(32px-Dialog-apply-009900.svg.png) no-repeat center center;}.mwe-upwiz-status-error{background:url(32px-Nuvola_apps_important_orange.svg.png) no-repeat left center;font-weight:bold;color:#CC0000;}.mwe-upwiz-progress{margin-top:15px;}.mwe-upwiz-progress-bar-etr{float:left;}.mwe-upwiz-etr{text-align:center;}.mwe-upwiz-upload-warning{background:#ffffe0;}.mwe-upwiz-details-error{display:none;background:#ffffe0;}.mwe-upwiz-thumbnail,.mwe-upwiz-thumbnail-small{border:1px solid #cccccc;text-align:center;background:#ffffff;}.mwe-upwiz-thumbnail{padding:0.5em;width:120px;}.mwe-upwiz-thumbnail-side{float:left;margin-bottom:1em;margin-right:1em;}.mwe-upwiz-thumbnail-small{padding:0.25em;width:60px;}#mwe-upwiz-deeds-thumbnails{text-align:center;margin:1em 0;background:#f0f0f0;}#mwe-upwiz-deeds-thumbnails .mwe-upwiz-thumbnail-small{display:inline-block;margin:1em;vertical-align:middle;} |
16 | 15 | .mwe-upwiz-data{float:left;width:46em;} |
17 | 16 | .busy{ |
18 | 17 | }.mwe-upwiz-stepdiv{height:0px;overflow:hidden;}#mwe-upwiz-tutorial{text-align:center;}.shim{float:right;width:1px;}.clearShim{clear:both;height:1px;overflow:hidden;}.mwe-checkbox-hang-indent{float:left;width:24px;margin-top:6px;}.mwe-checkbox-hang-indent-text{margin-left:24px;}.mwe-small-print{font-size:x-small;}.mwe-upwiz-deed{margin-left:24px;}.mwe-upwiz-deed.selected .mwe-upwiz-deed-name{font-weight:bold;}.mwe-more-options,.mwe-upwiz-macro-deeds-return,.mwe-upwiz-deed-header-link{cursor:pointer;}.mwe-more-options{padding-bottom:4px;}.mwe-upwiz-deed-license{margin-left:24px;}#mwe-upwiz-macro-deeds{margin-top:12px;margin-bottom:24px;}#mwe-upwiz-macro-files{margin-top:12px;}.mwe-upwiz-info-file{margin-bottom:1em;}.mwe-upwiz-details-input{width:33em;float:left;}.mwe-upwiz-details-fieldname{width:10em;padding-top:0.5em;float:left;}.mwe-upwiz-details-input-error{padding-left:10em; |
Index: trunk/extensions/UploadWizard/resources/24px-spinner-0645ad.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/UploadWizard/resources/24px-spinner-0645ad.gif |
___________________________________________________________________ |
Added: svn:mime-type |
19 | 18 | + application/octet-stream |
Index: trunk/extensions/UploadWizard/resources/24px-spinner-black.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/UploadWizard/resources/24px-spinner-black.gif |
___________________________________________________________________ |
Added: svn:mime-type |
20 | 19 | + application/octet-stream |
Index: trunk/extensions/UploadWizard/resources/combined.js |
— | — | @@ -5854,7 +5854,7 @@ |
5855 | 5855 | |
5856 | 5856 | $j.ajax( ajaxOptions ); |
5857 | 5857 | |
5858 | | - }, |
| 5858 | + } |
5859 | 5859 | |
5860 | 5860 | } |
5861 | 5861 | |
— | — | @@ -7912,7 +7912,9 @@ |
7913 | 7913 | var _this = this; |
7914 | 7914 | this.transport = new mw.IframeTransport( |
7915 | 7915 | this.$form, |
7916 | | - function( fraction ){ _this.upload.setTransportProgress( fraction ); }, |
| 7916 | + function( fraction ) { |
| 7917 | + _this.upload.setTransportProgress( fraction ); |
| 7918 | + }, |
7917 | 7919 | function( result ) { |
7918 | 7920 | _this.upload.setTransported( result ); |
7919 | 7921 | } |
— | — | @@ -7998,7 +8000,8 @@ |
7999 | 8001 | var ok = function() { |
8000 | 8002 | mw.log( "api: upload start!" ); |
8001 | 8003 | _this.beginTime = ( new Date() ).getTime(); |
8002 | | - _this.upload.ui.busy(); |
| 8004 | + _this.upload.ui.setStatus( 'mwe-upwiz-transport-started' ); |
| 8005 | + _this.upload.ui.showTransportProgress(); |
8003 | 8006 | _this.$form.submit(); |
8004 | 8007 | }; |
8005 | 8008 | var err = function( code, info ) { |
— | — | @@ -8349,7 +8352,7 @@ |
8350 | 8353 | /** |
8351 | 8354 | * this is a progress bar for monitoring multiple objects, giving summary view |
8352 | 8355 | */ |
8353 | | -mw.GroupProgressBar = function( selector, text, uploads, endState, progressProperty, weightProperty ) { |
| 8356 | +mw.GroupProgressBar = function( selector, text, uploads, endStates, progressProperty, weightProperty ) { |
8354 | 8357 | var _this = this; |
8355 | 8358 | |
8356 | 8359 | // XXX need to figure out a way to put text inside bar |
— | — | @@ -8369,7 +8372,7 @@ |
8370 | 8373 | _this.$selector.find( '.mwe-upwiz-progress-bar' ).progressbar( { value : 0 } ); |
8371 | 8374 | |
8372 | 8375 | _this.uploads = uploads; |
8373 | | - _this.endState = endState; |
| 8376 | + _this.endStates = endStates; |
8374 | 8377 | _this.progressProperty = progressProperty; |
8375 | 8378 | _this.weightProperty = weightProperty; |
8376 | 8379 | _this.beginTime = undefined; |
— | — | @@ -8404,7 +8407,7 @@ |
8405 | 8408 | var endStateCount = 0; |
8406 | 8409 | var hasData = false; |
8407 | 8410 | $j.each( _this.uploads, function( i, upload ) { |
8408 | | - if ( upload.state == _this.endState ) { |
| 8411 | + if ( $j.inArray( upload.state, _this.endStates ) !== -1 ) { |
8409 | 8412 | endStateCount++; |
8410 | 8413 | } |
8411 | 8414 | if (upload[_this.progressProperty] !== undefined) { |
— | — | @@ -9115,7 +9118,7 @@ |
9116 | 9119 | * Represents the upload -- in its local and remote state. (Possibly those could be separate objects too...) |
9117 | 9120 | * This is our 'model' object if we are thinking MVC. Needs to be better factored, lots of feature envy with the UploadWizard |
9118 | 9121 | * states: |
9119 | | - * 'new' 'transporting' 'transported' 'details' 'submitting-details' 'complete' 'failed' |
| 9122 | + * 'new' 'transporting' 'transported' 'metadata' 'stashed' 'details' 'submitting-details' 'complete' 'error' |
9120 | 9123 | * should fork this into two -- local and remote, e.g. filename |
9121 | 9124 | */ |
9122 | 9125 | ( function( $j ) { |
— | — | @@ -9194,11 +9197,11 @@ |
9195 | 9198 | /** |
9196 | 9199 | * Stop the upload -- we have failed for some reason |
9197 | 9200 | */ |
9198 | | - setFailed: function( code ) { |
| 9201 | + setError: function( code, info ) { |
9199 | 9202 | /* stop the upload progress */ |
9200 | | - this.state = 'failed'; |
| 9203 | + this.state = 'error'; |
9201 | 9204 | this.transportProgress = 0; |
9202 | | - this.ui.showFailed( code ); |
| 9205 | + this.ui.showError( code, info ); |
9203 | 9206 | }, |
9204 | 9207 | |
9205 | 9208 | /** |
— | — | @@ -9212,10 +9215,24 @@ |
9213 | 9216 | // success |
9214 | 9217 | _this.state = 'transported'; |
9215 | 9218 | _this.transportProgress = 1; |
9216 | | - _this.ui.showTransported(); |
9217 | | - _this.extractUploadInfo( result ); |
9218 | | - _this.deedPreview.setup(); |
9219 | | - _this.details.populate(); |
| 9219 | + _this.ui.setStatus( 'mwe-upwiz-getting-metadata' ); |
| 9220 | + _this.extractUploadInfo( result ); |
| 9221 | + var setupDeedsAndShowComplete = function() { |
| 9222 | + _this.ui.setPreview( $img ); |
| 9223 | + _this.deedPreview.setup(); |
| 9224 | + _this.details.populate(); |
| 9225 | + _this.state = 'stashed'; |
| 9226 | + _this.ui.showStashed(); |
| 9227 | + }; |
| 9228 | + var $img = $j( '<img/>' ).load( setupDeedsAndShowComplete ); |
| 9229 | + // blocking preload for thumbnail |
| 9230 | + _this.getThumbnail( |
| 9231 | + function( thumbnailAttrs ) { |
| 9232 | + $img.attr( thumbnailAttrs ); |
| 9233 | + }, |
| 9234 | + mw.UploadWizard.config[ 'iconThumbnailWidth' ], |
| 9235 | + mw.UploadWizard.config[ 'iconThumbnailMaxHeight' ] |
| 9236 | + ); |
9220 | 9237 | |
9221 | 9238 | } else if ( result.upload && result.upload.sessionkey ) { |
9222 | 9239 | // there was a warning - type error which prevented it from adding the result to the db |
— | — | @@ -9226,14 +9243,14 @@ |
9227 | 9244 | |
9228 | 9245 | // and other errors that result in a stash |
9229 | 9246 | } else { |
9230 | | - // XXX handle errors better |
9231 | | - _this.state = 'error'; |
9232 | | - _this.ui.showFailed(); |
| 9247 | + // XXX handle errors better -- get code and pass to showError |
| 9248 | + var code = 'unknown'; |
| 9249 | + var info = 'unknown'; |
9233 | 9250 | if ( result.error ) { |
9234 | | - alert( "error : " + result.error.code + " : " + result.error.info ); |
| 9251 | + code = result.error.code; |
| 9252 | + info = result.error.info; |
9235 | 9253 | } |
9236 | | - // TODO now we should tag the upload as failed |
9237 | | - // if can recover, should maybe allow re-uploading. |
| 9254 | + _this.setError( code, info ); |
9238 | 9255 | } |
9239 | 9256 | |
9240 | 9257 | }, |
— | — | @@ -9300,15 +9317,19 @@ |
9301 | 9318 | }, |
9302 | 9319 | |
9303 | 9320 | /** |
9304 | | - * Fetch a thumbnail for this upload of the desired width. |
| 9321 | + * Fetch a thumbnail for a stashed upload of the desired width. |
9305 | 9322 | * It is assumed you don't call this until it's been transported. |
9306 | 9323 | * |
| 9324 | + * @param callback - callback to execute once thumbnail has been obtained -- must accept Image object |
9307 | 9325 | * @param width - desired width of thumbnail (height will scale to match) |
9308 | | - * @param callback - callback to execute once thumbnail has been obtained -- must accept Image object |
| 9326 | + * @param height - (optional) maximum height of thumbnail |
9309 | 9327 | */ |
9310 | | - getThumbnail: function( width, callback ) { |
| 9328 | + getThumbnail: function( callback, width, height ) { |
9311 | 9329 | var _this = this; |
9312 | | - var key = "width" + width; |
| 9330 | + if ( mw.isEmpty( height ) ) { |
| 9331 | + height = -1; |
| 9332 | + } |
| 9333 | + var key = "width" + width + ',height' + height; |
9313 | 9334 | if ( mw.isDefined( _this.thumbnails[key] ) ) { |
9314 | 9335 | callback( _this.thumbnails[key] ); |
9315 | 9336 | } else { |
— | — | @@ -9316,6 +9337,7 @@ |
9317 | 9338 | 'prop': 'stashimageinfo', |
9318 | 9339 | 'siisessionkey': _this.sessionKey, |
9319 | 9340 | 'siiurlwidth': width, |
| 9341 | + 'siiurlheight': height, |
9320 | 9342 | 'siiprop': 'url' |
9321 | 9343 | }; |
9322 | 9344 | |
— | — | @@ -9345,13 +9367,18 @@ |
9346 | 9368 | * |
9347 | 9369 | * @param selector |
9348 | 9370 | * @param width |
| 9371 | + * @param height (optional) |
9349 | 9372 | */ |
9350 | | - setThumbnail: function( selector, width ) { |
| 9373 | + setThumbnail: function( selector, width, height ) { |
9351 | 9374 | var _this = this; |
9352 | 9375 | if ( typeof width === 'undefined' || width === null || width <= 0 ) { |
9353 | 9376 | width = mw.UploadWizard.config[ 'thumbnailWidth' ]; |
9354 | 9377 | } |
9355 | 9378 | width = parseInt( width, 10 ); |
| 9379 | + height = null; |
| 9380 | + if ( !mw.isEmpty( height ) ) { |
| 9381 | + height = parseInt( height, 10 ); |
| 9382 | + } |
9356 | 9383 | |
9357 | 9384 | var callback = function( thumbnail ) { |
9358 | 9385 | // side effect: will replace thumbnail's loadingSpinner |
— | — | @@ -9367,7 +9394,7 @@ |
9368 | 9395 | }; |
9369 | 9396 | |
9370 | 9397 | $j( selector ).loadingSpinner(); |
9371 | | - _this.getThumbnail( width, callback ); |
| 9398 | + _this.getThumbnail( callback, width, height ); |
9372 | 9399 | } |
9373 | 9400 | |
9374 | 9401 | }; |
— | — | @@ -9388,9 +9415,8 @@ |
9389 | 9416 | _this.div = $j('<div class="mwe-upwiz-file"></div>').get(0); |
9390 | 9417 | _this.isFilled = false; |
9391 | 9418 | |
9392 | | - _this.fileInputCtrl = $j('<input size="1" class="mwe-upwiz-file-input" name="file" type="file"/>') |
9393 | | - .change( function() { _this.fileChanged(); } ) |
9394 | | - .get(0); |
| 9419 | + _this.$fileInputCtrl = $j('<input size="1" class="mwe-upwiz-file-input" name="file" type="file"/>') |
| 9420 | + .change( function() { _this.fileChanged(); } ); |
9395 | 9421 | |
9396 | 9422 | |
9397 | 9423 | visibleFilenameDiv = $j('<div class="mwe-upwiz-visible-file"></div>') |
— | — | @@ -9405,15 +9431,16 @@ |
9406 | 9432 | + '</div>' |
9407 | 9433 | + '</div>' |
9408 | 9434 | ); |
9409 | | - visibleFilenameDiv.find( '.mwe-upwiz-file-status-line' ).append( |
9410 | | - $j.fn.removeCtrl( |
9411 | | - 'mwe-upwiz-remove', |
9412 | | - 'mwe-upwiz-remove-upload', |
9413 | | - function() { _this.upload.remove(); } |
9414 | | - ).addClass( "mwe-upwiz-file-status-line-item" ) |
9415 | | - ); |
9416 | 9435 | |
| 9436 | + _this.$removeCtrl = $j.fn.removeCtrl( |
| 9437 | + 'mwe-upwiz-remove', |
| 9438 | + 'mwe-upwiz-remove-upload', |
| 9439 | + function() { _this.upload.remove(); } |
| 9440 | + ).addClass( "mwe-upwiz-file-status-line-item" ); |
9417 | 9441 | |
| 9442 | + visibleFilenameDiv.find( '.mwe-upwiz-file-status-line' ) |
| 9443 | + .append( _this.$removeCtrl ); |
| 9444 | + |
9418 | 9445 | //_this.errorDiv = $j('<div class="mwe-upwiz-upload-error mwe-upwiz-file-indicator" style="display: none;"></div>').get(0); |
9419 | 9446 | |
9420 | 9447 | _this.filenameCtrl = $j('<input type="hidden" name="filename" value=""/>').get(0); |
— | — | @@ -9437,7 +9464,7 @@ |
9438 | 9465 | _this.form = $j('<form class="mwe-upwiz-form"></form>') |
9439 | 9466 | .append( visibleFilenameDiv ) |
9440 | 9467 | .append( _this.fileCtrlContainer |
9441 | | - .append( _this.fileInputCtrl ) |
| 9468 | + .append( _this.$fileInputCtrl ) |
9442 | 9469 | ) |
9443 | 9470 | .append( _this.filenameCtrl ) |
9444 | 9471 | .append( _this.thumbnailParam ) |
— | — | @@ -9453,7 +9480,7 @@ |
9454 | 9481 | // _this.progressBar = ( no progress bar for individual uploads yet ) |
9455 | 9482 | // we bind to the ui div since unbind doesn't work for non-DOM objects |
9456 | 9483 | $j( _this.div ).bind( 'transportProgressEvent', function(e) { _this.showTransportProgress(); } ); |
9457 | | - // $j( _this.div ).bind( 'transportedEvent', function(e) { _this.showTransported(); } ); |
| 9484 | + // $j( _this.div ).bind( 'transportedEvent', function(e) { _this.showStashed(); } ); |
9458 | 9485 | |
9459 | 9486 | }; |
9460 | 9487 | |
— | — | @@ -9475,17 +9502,10 @@ |
9476 | 9503 | .remove(); |
9477 | 9504 | }, |
9478 | 9505 | |
9479 | | - busy: function() { |
9480 | | - var _this = this; |
9481 | | - // for now we implement this as looking like "100% progress" |
9482 | | - // e.g. an animated bar that takes up all the space |
9483 | | - // _this.showTransportProgress(); |
9484 | | - }, |
9485 | | - |
9486 | 9506 | /** |
9487 | 9507 | * change the indicator at the far right |
9488 | 9508 | */ |
9489 | | - showIndicatorMessage: function( statusClass, msgKey ) { |
| 9509 | + showIndicator: function( statusClass ) { |
9490 | 9510 | var _this = this; |
9491 | 9511 | var $indicator = $j( _this.div ).find( '.mwe-upwiz-file-indicator' ); |
9492 | 9512 | $j.each( $indicator.attr( 'class' ).split( /\s+/ ), function( i, className ) { |
— | — | @@ -9493,13 +9513,16 @@ |
9494 | 9514 | $indicator.removeClass( className ); |
9495 | 9515 | } |
9496 | 9516 | } ); |
9497 | | - $indicator.addClass( 'mwe-upwiz-status-' + statusClass ) |
9498 | | - .html( gM( msgKey ) ); |
| 9517 | + $indicator.addClass( 'mwe-upwiz-status-' + statusClass ); |
| 9518 | + // is this causing dancing when we switch from spinner to checkmark? |
9499 | 9519 | $j( _this.div ).find( '.mwe-upwiz-visible-file-filename' ) |
9500 | 9520 | .css( 'margin-right', ( $indicator.outerWidth() + 24 ).toString() + 'px' ); |
9501 | 9521 | $indicator.css( 'visibility', 'visible' ); |
| 9522 | + }, |
9502 | 9523 | |
9503 | | - _this.setStatus( msgKey ); |
| 9524 | + setPreview: function( $img ) { |
| 9525 | + // encoding for url here? |
| 9526 | + $j( this.div ).find( '.mwe-upwiz-file-preview' ).css( 'background-image', 'url(' + $img.attr( 'src' ) + ')' ); |
9504 | 9527 | }, |
9505 | 9528 | |
9506 | 9529 | // too abstract? |
— | — | @@ -9523,23 +9546,28 @@ |
9524 | 9547 | * @param fraction The fraction of progress. Float between 0 and 1 |
9525 | 9548 | */ |
9526 | 9549 | showTransportProgress: function( fraction ) { |
9527 | | - this.showIndicatorMessage( 'progress', 'mwe-upwiz-uploading' ); |
9528 | | - // update individual progress bar with fraction? |
| 9550 | + // if fraction available, update individual progress bar / estimates, etc. |
| 9551 | + this.showIndicator( 'progress' ); |
| 9552 | + this.setStatus( 'mwe-upwiz-uploading' ); |
9529 | 9553 | }, |
9530 | 9554 | |
9531 | 9555 | /** |
9532 | 9556 | * Show that upload is transported |
9533 | 9557 | */ |
9534 | | - showTransported: function() { |
9535 | | - this.showIndicatorMessage( 'completed', 'mwe-upwiz-transported' ); |
| 9558 | + showStashed: function() { |
| 9559 | + this.$removeCtrl.detach(); |
| 9560 | + this.$fileInputCtrl.detach(); |
| 9561 | + this.showIndicator( 'stashed' ); |
| 9562 | + this.setStatus( 'mwe-upwiz-stashed-upload' ); // this is just "OK", say something more. |
9536 | 9563 | }, |
9537 | 9564 | |
9538 | 9565 | /** |
9539 | 9566 | * Show that transport has failed |
9540 | 9567 | */ |
9541 | | - showFailed: function( code ) { |
9542 | | - this.showIndicatorMessage( 'failed', 'mwe-upwiz-failed' ); |
9543 | | - //add a "retry" button, too? |
| 9568 | + showError: function( code, info ) { |
| 9569 | + // XXX TODO use code |
| 9570 | + this.showIndicator( 'error' ); |
| 9571 | + // create a status message for the error |
9544 | 9572 | }, |
9545 | 9573 | |
9546 | 9574 | /** |
— | — | @@ -9549,7 +9577,7 @@ |
9550 | 9578 | fileChanged: function() { |
9551 | 9579 | var _this = this; |
9552 | 9580 | _this.clearErrors(); |
9553 | | - _this.upload.extractLocalFileInfo( $j( _this.fileInputCtrl ).val() ); |
| 9581 | + _this.upload.extractLocalFileInfo( _this.$fileInputCtrl.val() ); |
9554 | 9582 | if ( _this.isGoodExtension( _this.upload.title.getExtension() ) ) { |
9555 | 9583 | _this.updateFilename(); |
9556 | 9584 | } else { |
— | — | @@ -9578,9 +9606,9 @@ |
9579 | 9607 | // shift the file input over with negative margins, |
9580 | 9608 | // internal to the overflow-containing div, so the div shows all button |
9581 | 9609 | // and none of the textfield-like input |
9582 | | - $j( this.fileInputCtrl ).css( { |
9583 | | - 'margin-left': '-' + ~~( $j( this.fileInputCtrl ).width() - $covered.outerWidth() - 10 ) + 'px', |
9584 | | - 'margin-top' : '-' + ~~( $j( this.fileInputCtrl ).height() - $covered.outerHeight() - 10 ) + 'px' |
| 9610 | + this.$fileInputCtrl.css( { |
| 9611 | + 'margin-left': '-' + ~~( this.$fileInputCtrl.width() - $covered.outerWidth() - 10 ) + 'px', |
| 9612 | + 'margin-top' : '-' + ~~( this.$fileInputCtrl.height() - $covered.outerHeight() - 10 ) + 'px' |
9585 | 9613 | } ); |
9586 | 9614 | |
9587 | 9615 | |
— | — | @@ -9597,7 +9625,7 @@ |
9598 | 9626 | updateFilename: function() { |
9599 | 9627 | var _this = this; |
9600 | 9628 | // TODO get basename of file; Chrome does this C:\fakepath\something which is highly irritating |
9601 | | - var path = _this.fileInputCtrl.value; |
| 9629 | + var path = _this.$fileInputCtrl.val(); |
9602 | 9630 | |
9603 | 9631 | // visible filenam. |
9604 | 9632 | $j( _this.form ).find( '.mwe-upwiz-visible-file-filename-text' ).html( path ); |
— | — | @@ -10211,7 +10239,7 @@ |
10212 | 10240 | populate: function() { |
10213 | 10241 | var _this = this; |
10214 | 10242 | mw.log( "populating details from upload" ); |
10215 | | - _this.upload.setThumbnail( _this.thumbnailDiv ); |
| 10243 | + _this.upload.setThumbnail( _this.thumbnailDiv, mw.UploadWizard.config['thumbnailWidth'], mw.UploadWizard.config['thumbnailMaxHeight'] ); |
10216 | 10244 | _this.prefillDate(); |
10217 | 10245 | _this.prefillSource(); |
10218 | 10246 | _this.prefillAuthor(); |
— | — | @@ -10642,56 +10670,21 @@ |
10643 | 10671 | $j( '#mwe-upwiz-stepdiv-file .mwe-upwiz-button-next') |
10644 | 10672 | .append( gM( 'mwe-upwiz-next-file' ) ) |
10645 | 10673 | .click( function() { |
10646 | | - // check if there is an upload at all |
10647 | | - if ( _this.uploads.length === 0 ) { |
10648 | | - // XXX use standard error message |
10649 | | - alert( gM( 'mwe-upwiz-file-need-file' ) ); |
10650 | | - return; |
10651 | | - } |
10652 | | - |
10653 | | - _this.removeEmptyUploads(); |
10654 | | - _this.startUploads( function() { |
10655 | | - |
10656 | | - // okay all uploads are done, we're ready to go to the next step |
10657 | | - |
10658 | | - // do some last minute prep before advancing to the DEEDS page |
10659 | | - |
10660 | | - // these deeds are standard |
10661 | | - var deeds = [ |
10662 | | - new mw.UploadWizardDeedOwnWork( _this.uploads.length ), |
10663 | | - new mw.UploadWizardDeedThirdParty( _this.uploads.length ) |
10664 | | - ]; |
10665 | | - |
10666 | | - // if we have multiple uploads, also give them the option to set |
10667 | | - // licenses individually |
10668 | | - if ( _this.uploads.length > 1 ) { |
10669 | | - var customDeed = $j.extend( new mw.UploadWizardDeed(), { |
10670 | | - valid: function() { return true; }, |
10671 | | - name: 'custom' |
10672 | | - } ); |
10673 | | - deeds.push( customDeed ); |
| 10674 | + // check if there is an upload at all (should never happen) |
| 10675 | + if ( _this.uploads.length === 0 ) { |
| 10676 | + // XXX use standard error message |
| 10677 | + alert( gM( 'mwe-upwiz-file-need-file' ) ); |
| 10678 | + return; |
10674 | 10679 | } |
10675 | 10680 | |
10676 | | - _this.deedChooser = new mw.UploadWizardDeedChooser( |
10677 | | - '#mwe-upwiz-deeds', |
10678 | | - deeds, |
10679 | | - _this.uploads.length ); |
10680 | | - |
10681 | | - $j( '<div>' ).html( gM( 'mwe-upwiz-deeds-macro-prompt', _this.uploads.length ) ) |
10682 | | - .insertBefore ( _this.deedChooser.$selector.find( '.mwe-upwiz-deed-ownwork' ) ); |
| 10681 | + _this.removeEmptyUploads(); |
| 10682 | + _this.startUploads( function() { |
| 10683 | + // okay all uploads are done, we may be ready to go to the next step |
| 10684 | + alert( "hey, uploads are done"); |
10683 | 10685 | |
10684 | | - if ( _this.uploads.length > 1 ) { |
10685 | | - $j( '<div style="margin-top: 1em">' ).html( gM( 'mwe-upwiz-deeds-custom-prompt' ) ) |
10686 | | - .insertBefore( _this.deedChooser.$selector.find( '.mwe-upwiz-deed-custom' ) ); |
10687 | | - } |
| 10686 | + } ); |
| 10687 | + } ); |
10688 | 10688 | |
10689 | | - |
10690 | | - _this.moveToStep( 'deeds' ); |
10691 | | - |
10692 | | - } ); |
10693 | | - } ); |
10694 | | - |
10695 | | - |
10696 | 10689 | // DEEDS div |
10697 | 10690 | |
10698 | 10691 | $j( '#mwe-upwiz-deeds-intro' ).html( gM( 'mwe-upwiz-deeds-intro' ) ); |
— | — | @@ -10752,6 +10745,43 @@ |
10753 | 10746 | |
10754 | 10747 | }, |
10755 | 10748 | |
| 10749 | + |
| 10750 | + // do some last minute prep before advancing to the DEEDS page |
| 10751 | + prepareAndMoveToDeeds: function() { |
| 10752 | + |
| 10753 | + // these deeds are standard |
| 10754 | + var deeds = [ |
| 10755 | + new mw.UploadWizardDeedOwnWork( _this.uploads.length ), |
| 10756 | + new mw.UploadWizardDeedThirdParty( _this.uploads.length ) |
| 10757 | + ]; |
| 10758 | + |
| 10759 | + // if we have multiple uploads, also give them the option to set |
| 10760 | + // licenses individually |
| 10761 | + if ( _this.uploads.length > 1 ) { |
| 10762 | + var customDeed = $j.extend( new mw.UploadWizardDeed(), { |
| 10763 | + valid: function() { return true; }, |
| 10764 | + name: 'custom' |
| 10765 | + } ); |
| 10766 | + deeds.push( customDeed ); |
| 10767 | + } |
| 10768 | + |
| 10769 | + _this.deedChooser = new mw.UploadWizardDeedChooser( |
| 10770 | + '#mwe-upwiz-deeds', |
| 10771 | + deeds, |
| 10772 | + _this.uploads.length ); |
| 10773 | + |
| 10774 | + $j( '<div>' ).html( gM( 'mwe-upwiz-deeds-macro-prompt', _this.uploads.length ) ) |
| 10775 | + .insertBefore ( _this.deedChooser.$selector.find( '.mwe-upwiz-deed-ownwork' ) ); |
| 10776 | + |
| 10777 | + if ( _this.uploads.length > 1 ) { |
| 10778 | + $j( '<div style="margin-top: 1em">' ).html( gM( 'mwe-upwiz-deeds-custom-prompt' ) ) |
| 10779 | + .insertBefore( _this.deedChooser.$selector.find( '.mwe-upwiz-deed-custom' ) ); |
| 10780 | + } |
| 10781 | + |
| 10782 | + _this.moveToStep( 'deeds' ); |
| 10783 | + |
| 10784 | + }, |
| 10785 | + |
10756 | 10786 | /** |
10757 | 10787 | * Advance one "step" in the wizard interface. |
10758 | 10788 | * It is assumed that the previous step to the current one was selected. |
— | — | @@ -10896,7 +10926,7 @@ |
10897 | 10927 | var toRemove = []; |
10898 | 10928 | |
10899 | 10929 | for ( var i = 0; i < _this.uploads.length; i++ ) { |
10900 | | - if ( mw.isEmpty( _this.uploads[i].ui.fileInputCtrl.value ) ) { |
| 10930 | + if ( mw.isEmpty( _this.uploads[i].ui.$fileInputCtrl.val() ) ) { |
10901 | 10931 | toRemove.push( _this.uploads[i] ); |
10902 | 10932 | } |
10903 | 10933 | } |
— | — | @@ -10911,11 +10941,11 @@ |
10912 | 10942 | * |
10913 | 10943 | * @param beginState what state the upload should be in before starting. |
10914 | 10944 | * @param progressState the state to set the upload to while it's doing whatever |
10915 | | - * @param endState the state to set the upload to after it's done whatever |
| 10945 | + * @param endState the state (or array of states) that signify we're done with this process |
10916 | 10946 | * @param starter function, taking single argument (upload) which starts the process we're interested in |
10917 | 10947 | * @param endCallback function to call when all uploads are in the end state. |
10918 | 10948 | */ |
10919 | | - makeTransitioner: function( beginState, progressState, endState, starter, endCallback ) { |
| 10949 | + makeTransitioner: function( beginState, progressStates, endStates, starter, endCallback ) { |
10920 | 10950 | |
10921 | 10951 | var _this = this; |
10922 | 10952 | |
— | — | @@ -10923,9 +10953,9 @@ |
10924 | 10954 | var uploadsToStart = _this.maxSimultaneousConnections; |
10925 | 10955 | var endStateCount = 0; |
10926 | 10956 | $j.each( _this.uploads, function(i, upload) { |
10927 | | - if ( upload.state == endState ) { |
| 10957 | + if ( $j.inArray( upload.state, endStates ) !== -1 ) { |
10928 | 10958 | endStateCount++; |
10929 | | - } else if ( upload.state == progressState ) { |
| 10959 | + } else if ( $j.inArray( upload.state, progressStates ) !== -1 ) { |
10930 | 10960 | uploadsToStart--; |
10931 | 10961 | } else if ( ( upload.state == beginState ) && ( uploadsToStart > 0 ) ) { |
10932 | 10962 | starter( upload ); |
— | — | @@ -10965,7 +10995,7 @@ |
10966 | 10996 | var progressBar = new mw.GroupProgressBar( '#mwe-upwiz-progress', |
10967 | 10997 | gM( 'mwe-upwiz-uploading' ), |
10968 | 10998 | _this.uploads, |
10969 | | - 'transported', |
| 10999 | + [ 'stashed' ], |
10970 | 11000 | 'transportProgress', |
10971 | 11001 | 'transportWeight' ); |
10972 | 11002 | progressBar.start(); |
— | — | @@ -10979,8 +11009,8 @@ |
10980 | 11010 | // the progress bar and elapsed time |
10981 | 11011 | _this.makeTransitioner( |
10982 | 11012 | 'new', |
10983 | | - 'transporting', |
10984 | | - 'transported', |
| 11013 | + [ 'transporting', 'transported', 'metadata' ], |
| 11014 | + [ 'error', 'verified' ], |
10985 | 11015 | function( upload ) { |
10986 | 11016 | upload.start(); |
10987 | 11017 | }, |
— | — | @@ -11088,8 +11118,8 @@ |
11089 | 11119 | // add in the upload count |
11090 | 11120 | _this.makeTransitioner( |
11091 | 11121 | 'details', |
11092 | | - 'submitting-details', |
11093 | | - 'complete', |
| 11122 | + [ 'submitting-details' ], |
| 11123 | + [ 'complete' ], |
11094 | 11124 | function( upload ) { |
11095 | 11125 | upload.details.submit( function() { |
11096 | 11126 | upload.details.div.data( 'mask' ).html(); |
— | — | @@ -11186,22 +11216,13 @@ |
11187 | 11217 | // add a preview on the deeds page |
11188 | 11218 | var thumbnailDiv = $j( '<div class="mwe-upwiz-thumbnail-small"></div>' ); |
11189 | 11219 | $j( '#mwe-upwiz-deeds-thumbnails' ).append( thumbnailDiv ); |
11190 | | - _this.upload.setThumbnail( thumbnailDiv, mw.UploadWizard.config[ 'smallThumbnailWidth' ] ); |
| 11220 | + _this.upload.setThumbnail( thumbnailDiv, mw.UploadWizard.config[ 'smallThumbnailWidth' ], mw.UploadWizard.config[ 'smallThumbnailMaxHeight' ] ); |
11191 | 11221 | } |
11192 | 11222 | }; |
11193 | | - /** |
11194 | | - * Create 'remove' control, an X which highlights in some standardized way. |
11195 | | - */ |
11196 | | - $j.fn.removeCtrl = function( msgKey, tooltipMsgKey, callback ) { |
11197 | | - var msg = (msgKey === null) ? '' : gM( msgKey ); |
11198 | | - return $j( '<div class="mwe-upwiz-remove-ctrl ui-corner-all" />' ) |
11199 | | - .attr( 'title', gM( tooltipMsgKey ) ) |
11200 | | - .click( callback ) |
11201 | | - .hover( function() { $j( this ).addClass( 'hover' ); }, |
11202 | | - function() { $j( this ).removeClass( 'hover' ); } ) |
11203 | | - .append( $j( '<div class="ui-icon ui-icon-close" /><div class="mwe-upwiz-remove-ctrl-msg">' + msg + '</div>' ) ); |
11204 | | - }; |
11205 | 11223 | |
| 11224 | +} )( jQuery ); |
| 11225 | + |
| 11226 | +( function ( $j ) { |
11206 | 11227 | /** |
11207 | 11228 | * Prevent the closing of a window with a confirm message (the onbeforeunload event seems to |
11208 | 11229 | * work in most browsers |
— | — | @@ -11420,7 +11441,11 @@ |
11421 | 11442 | apiUrl: apiUrl, |
11422 | 11443 | |
11423 | 11444 | thumbnailWidth: 120, |
| 11445 | + thumbnailMaxHeight: 200, |
11424 | 11446 | smallThumbnailWidth: 60, |
| 11447 | + smallThumbnailMaxHeight: 100, |
| 11448 | + iconThumbnailWidth: 32, |
| 11449 | + iconThumbnailMaxHeight: 32, |
11425 | 11450 | maxAuthorLength: 50, |
11426 | 11451 | minAuthorLength: 2, |
11427 | 11452 | maxSourceLength: 200, |
Index: trunk/extensions/UploadWizard/resources/uploadWizard.css |
— | — | @@ -107,7 +107,7 @@ |
108 | 108 | .mwe-upwiz-file-indicator, .mwe-upwiz-count { |
109 | 109 | float: right; |
110 | 110 | margin-left: 0.5em; |
111 | | - padding: 0.5em 0.5em 0.5em 20px; /* 20px for the icon */ |
| 111 | + padding: 0.5em; |
112 | 112 | } |
113 | 113 | |
114 | 114 | .mwe-upwiz-visible-file .mwe-upwiz-file-indicator { |
— | — | @@ -227,16 +227,17 @@ |
228 | 228 | text-decoration: none; |
229 | 229 | } |
230 | 230 | |
| 231 | +.mwe-upwiz-file-indicator { |
| 232 | + height: 40px; |
| 233 | + width: 40px; |
| 234 | +} |
| 235 | + |
231 | 236 | .mwe-upwiz-status-progress { |
232 | | - background: url(spinner-orange.gif) no-repeat left center; |
233 | | - font-weight: bold; |
234 | | - color: #ff9900; |
| 237 | + background: url(24px-spinner-0645ad.gif) no-repeat center center; |
235 | 238 | } |
236 | 239 | |
237 | | -.mwe-upwiz-status-completed { |
238 | | - background: url(32px-Dialog-apply.svg.png) no-repeat left center; |
239 | | - font-weight: bold; |
240 | | - color: #009900; |
| 240 | +.mwe-upwiz-status-stashed { |
| 241 | + background: url(32px-Dialog-apply-009900.svg.png) no-repeat center center; |
241 | 242 | } |
242 | 243 | |
243 | 244 | .mwe-upwiz-status-error { |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | * Represents the upload -- in its local and remote state. (Possibly those could be separate objects too...) |
4 | 4 | * This is our 'model' object if we are thinking MVC. Needs to be better factored, lots of feature envy with the UploadWizard |
5 | 5 | * states: |
6 | | - * 'new' 'transporting' 'transported' 'metadata' 'thumbnailed' 'details' 'submitting-details' 'complete' 'error' |
| 6 | + * 'new' 'transporting' 'transported' 'metadata' 'stashed' 'details' 'submitting-details' 'complete' 'error' |
7 | 7 | * should fork this into two -- local and remote, e.g. filename |
8 | 8 | */ |
9 | 9 | ( function( $j ) { |
— | — | @@ -99,10 +99,24 @@ |
100 | 100 | // success |
101 | 101 | _this.state = 'transported'; |
102 | 102 | _this.transportProgress = 1; |
103 | | - _this.ui.showTransported(); |
104 | | - _this.extractUploadInfo( result ); |
105 | | - _this.deedPreview.setup(); |
106 | | - _this.details.populate(); |
| 103 | + _this.ui.setStatus( 'mwe-upwiz-getting-metadata' ); |
| 104 | + _this.extractUploadInfo( result ); |
| 105 | + var setupDeedsAndShowComplete = function() { |
| 106 | + _this.ui.setPreview( $img ); |
| 107 | + _this.deedPreview.setup(); |
| 108 | + _this.details.populate(); |
| 109 | + _this.state = 'stashed'; |
| 110 | + _this.ui.showStashed(); |
| 111 | + }; |
| 112 | + var $img = $j( '<img/>' ).load( setupDeedsAndShowComplete ); |
| 113 | + // blocking preload for thumbnail |
| 114 | + _this.getThumbnail( |
| 115 | + function( thumbnailAttrs ) { |
| 116 | + $img.attr( thumbnailAttrs ); |
| 117 | + }, |
| 118 | + mw.UploadWizard.config[ 'iconThumbnailWidth' ], |
| 119 | + mw.UploadWizard.config[ 'iconThumbnailMaxHeight' ] |
| 120 | + ); |
107 | 121 | |
108 | 122 | } else if ( result.upload && result.upload.sessionkey ) { |
109 | 123 | // there was a warning - type error which prevented it from adding the result to the db |
— | — | @@ -187,15 +201,19 @@ |
188 | 202 | }, |
189 | 203 | |
190 | 204 | /** |
191 | | - * Fetch a thumbnail for this upload of the desired width. |
| 205 | + * Fetch a thumbnail for a stashed upload of the desired width. |
192 | 206 | * It is assumed you don't call this until it's been transported. |
193 | 207 | * |
| 208 | + * @param callback - callback to execute once thumbnail has been obtained -- must accept Image object |
194 | 209 | * @param width - desired width of thumbnail (height will scale to match) |
195 | | - * @param callback - callback to execute once thumbnail has been obtained -- must accept Image object |
| 210 | + * @param height - (optional) maximum height of thumbnail |
196 | 211 | */ |
197 | | - getThumbnail: function( width, callback ) { |
| 212 | + getThumbnail: function( callback, width, height ) { |
198 | 213 | var _this = this; |
199 | | - var key = "width" + width; |
| 214 | + if ( mw.isEmpty( height ) ) { |
| 215 | + height = -1; |
| 216 | + } |
| 217 | + var key = "width" + width + ',height' + height; |
200 | 218 | if ( mw.isDefined( _this.thumbnails[key] ) ) { |
201 | 219 | callback( _this.thumbnails[key] ); |
202 | 220 | } else { |
— | — | @@ -203,6 +221,7 @@ |
204 | 222 | 'prop': 'stashimageinfo', |
205 | 223 | 'siisessionkey': _this.sessionKey, |
206 | 224 | 'siiurlwidth': width, |
| 225 | + 'siiurlheight': height, |
207 | 226 | 'siiprop': 'url' |
208 | 227 | }; |
209 | 228 | |
— | — | @@ -232,13 +251,18 @@ |
233 | 252 | * |
234 | 253 | * @param selector |
235 | 254 | * @param width |
| 255 | + * @param height (optional) |
236 | 256 | */ |
237 | | - setThumbnail: function( selector, width ) { |
| 257 | + setThumbnail: function( selector, width, height ) { |
238 | 258 | var _this = this; |
239 | 259 | if ( typeof width === 'undefined' || width === null || width <= 0 ) { |
240 | 260 | width = mw.UploadWizard.config[ 'thumbnailWidth' ]; |
241 | 261 | } |
242 | 262 | width = parseInt( width, 10 ); |
| 263 | + height = null; |
| 264 | + if ( !mw.isEmpty( height ) ) { |
| 265 | + height = parseInt( height, 10 ); |
| 266 | + } |
243 | 267 | |
244 | 268 | var callback = function( thumbnail ) { |
245 | 269 | // side effect: will replace thumbnail's loadingSpinner |
— | — | @@ -254,7 +278,7 @@ |
255 | 279 | }; |
256 | 280 | |
257 | 281 | $j( selector ).loadingSpinner(); |
258 | | - _this.getThumbnail( width, callback ); |
| 282 | + _this.getThumbnail( callback, width, height ); |
259 | 283 | } |
260 | 284 | |
261 | 285 | }; |
— | — | @@ -291,16 +315,16 @@ |
292 | 316 | + '</div>' |
293 | 317 | + '</div>' |
294 | 318 | ); |
| 319 | + |
295 | 320 | _this.$removeCtrl = $j.fn.removeCtrl( |
296 | 321 | 'mwe-upwiz-remove', |
297 | 322 | 'mwe-upwiz-remove-upload', |
298 | 323 | function() { _this.upload.remove(); } |
299 | | - ); |
| 324 | + ).addClass( "mwe-upwiz-file-status-line-item" ); |
| 325 | + |
300 | 326 | visibleFilenameDiv.find( '.mwe-upwiz-file-status-line' ) |
301 | | - .append( _this.$removeCtrl ) |
302 | | - .addClass( "mwe-upwiz-file-status-line-item" ); |
| 327 | + .append( _this.$removeCtrl ); |
303 | 328 | |
304 | | - |
305 | 329 | //_this.errorDiv = $j('<div class="mwe-upwiz-upload-error mwe-upwiz-file-indicator" style="display: none;"></div>').get(0); |
306 | 330 | |
307 | 331 | _this.filenameCtrl = $j('<input type="hidden" name="filename" value=""/>').get(0); |
— | — | @@ -340,7 +364,7 @@ |
341 | 365 | // _this.progressBar = ( no progress bar for individual uploads yet ) |
342 | 366 | // we bind to the ui div since unbind doesn't work for non-DOM objects |
343 | 367 | $j( _this.div ).bind( 'transportProgressEvent', function(e) { _this.showTransportProgress(); } ); |
344 | | - // $j( _this.div ).bind( 'transportedEvent', function(e) { _this.showTransported(); } ); |
| 368 | + // $j( _this.div ).bind( 'transportedEvent', function(e) { _this.showStashed(); } ); |
345 | 369 | |
346 | 370 | }; |
347 | 371 | |
— | — | @@ -365,8 +389,7 @@ |
366 | 390 | /** |
367 | 391 | * change the indicator at the far right |
368 | 392 | */ |
369 | | - showIndicatorMessage: function( statusClass, msgKey ) { |
370 | | - debugger; |
| 393 | + showIndicator: function( statusClass ) { |
371 | 394 | var _this = this; |
372 | 395 | var $indicator = $j( _this.div ).find( '.mwe-upwiz-file-indicator' ); |
373 | 396 | $j.each( $indicator.attr( 'class' ).split( /\s+/ ), function( i, className ) { |
— | — | @@ -374,13 +397,16 @@ |
375 | 398 | $indicator.removeClass( className ); |
376 | 399 | } |
377 | 400 | } ); |
378 | | - $indicator.addClass( 'mwe-upwiz-status-' + statusClass ) |
379 | | - .html( gM( msgKey ) ); |
| 401 | + $indicator.addClass( 'mwe-upwiz-status-' + statusClass ); |
| 402 | + // is this causing dancing when we switch from spinner to checkmark? |
380 | 403 | $j( _this.div ).find( '.mwe-upwiz-visible-file-filename' ) |
381 | 404 | .css( 'margin-right', ( $indicator.outerWidth() + 24 ).toString() + 'px' ); |
382 | 405 | $indicator.css( 'visibility', 'visible' ); |
| 406 | + }, |
383 | 407 | |
384 | | - _this.setStatus( msgKey ); |
| 408 | + setPreview: function( $img ) { |
| 409 | + // encoding for url here? |
| 410 | + $j( this.div ).find( '.mwe-upwiz-file-preview' ).css( 'background-image', 'url(' + $img.attr( 'src' ) + ')' ); |
385 | 411 | }, |
386 | 412 | |
387 | 413 | // too abstract? |
— | — | @@ -405,17 +431,18 @@ |
406 | 432 | */ |
407 | 433 | showTransportProgress: function( fraction ) { |
408 | 434 | // if fraction available, update individual progress bar / estimates, etc. |
409 | | - this.showIndicatorMessage( 'progress' ); |
| 435 | + this.showIndicator( 'progress' ); |
410 | 436 | this.setStatus( 'mwe-upwiz-uploading' ); |
411 | 437 | }, |
412 | 438 | |
413 | 439 | /** |
414 | 440 | * Show that upload is transported |
415 | 441 | */ |
416 | | - showTransported: function() { |
| 442 | + showStashed: function() { |
417 | 443 | this.$removeCtrl.detach(); |
418 | 444 | this.$fileInputCtrl.detach(); |
419 | | - this.showIndicatorMessage( 'completed', 'mwe-upwiz-transported' ); |
| 445 | + this.showIndicator( 'stashed' ); |
| 446 | + this.setStatus( 'mwe-upwiz-stashed-upload' ); // this is just "OK", say something more. |
420 | 447 | }, |
421 | 448 | |
422 | 449 | /** |
— | — | @@ -423,8 +450,8 @@ |
424 | 451 | */ |
425 | 452 | showError: function( code, info ) { |
426 | 453 | // XXX TODO use code |
427 | | - this.showIndicatorMessage( 'error', 'mwe-upwiz-error' ); |
428 | | - //add a "retry" button, too? |
| 454 | + this.showIndicator( 'error' ); |
| 455 | + // create a status message for the error |
429 | 456 | }, |
430 | 457 | |
431 | 458 | /** |
— | — | @@ -1096,7 +1123,7 @@ |
1097 | 1124 | populate: function() { |
1098 | 1125 | var _this = this; |
1099 | 1126 | mw.log( "populating details from upload" ); |
1100 | | - _this.upload.setThumbnail( _this.thumbnailDiv ); |
| 1127 | + _this.upload.setThumbnail( _this.thumbnailDiv, mw.UploadWizard.config['thumbnailWidth'], mw.UploadWizard.config['thumbnailMaxHeight'] ); |
1101 | 1128 | _this.prefillDate(); |
1102 | 1129 | _this.prefillSource(); |
1103 | 1130 | _this.prefillAuthor(); |
— | — | @@ -1852,7 +1879,7 @@ |
1853 | 1880 | var progressBar = new mw.GroupProgressBar( '#mwe-upwiz-progress', |
1854 | 1881 | gM( 'mwe-upwiz-uploading' ), |
1855 | 1882 | _this.uploads, |
1856 | | - [ 'error', 'thumbnailed' ], |
| 1883 | + [ 'stashed' ], |
1857 | 1884 | 'transportProgress', |
1858 | 1885 | 'transportWeight' ); |
1859 | 1886 | progressBar.start(); |
— | — | @@ -1867,7 +1894,7 @@ |
1868 | 1895 | _this.makeTransitioner( |
1869 | 1896 | 'new', |
1870 | 1897 | [ 'transporting', 'transported', 'metadata' ], |
1871 | | - [ 'error', 'thumbnailed' ], |
| 1898 | + [ 'error', 'verified' ], |
1872 | 1899 | function( upload ) { |
1873 | 1900 | upload.start(); |
1874 | 1901 | }, |
— | — | @@ -2073,7 +2100,7 @@ |
2074 | 2101 | // add a preview on the deeds page |
2075 | 2102 | var thumbnailDiv = $j( '<div class="mwe-upwiz-thumbnail-small"></div>' ); |
2076 | 2103 | $j( '#mwe-upwiz-deeds-thumbnails' ).append( thumbnailDiv ); |
2077 | | - _this.upload.setThumbnail( thumbnailDiv, mw.UploadWizard.config[ 'smallThumbnailWidth' ] ); |
| 2104 | + _this.upload.setThumbnail( thumbnailDiv, mw.UploadWizard.config[ 'smallThumbnailWidth' ], mw.UploadWizard.config[ 'smallThumbnailMaxHeight' ] ); |
2078 | 2105 | } |
2079 | 2106 | }; |
2080 | 2107 | |
Index: trunk/extensions/UploadWizard/resources/mw.ApiUploadHandler.js |
— | — | @@ -22,11 +22,9 @@ |
23 | 23 | this.transport = new mw.IframeTransport( |
24 | 24 | this.$form, |
25 | 25 | function( fraction ) { |
26 | | - debugger; |
27 | 26 | _this.upload.setTransportProgress( fraction ); |
28 | 27 | }, |
29 | 28 | function( result ) { |
30 | | - debugger; |
31 | 29 | _this.upload.setTransported( result ); |
32 | 30 | } |
33 | 31 | ); |
Index: trunk/extensions/UploadWizard/resources/mw.UploadApiProcessor.js |
— | — | @@ -75,7 +75,6 @@ |
76 | 76 | var _this = this; |
77 | 77 | mw.log( 'processResult::' ); |
78 | 78 | |
79 | | - // debugger; |
80 | 79 | |
81 | 80 | var parsedResult = _this.parseResult(result); |
82 | 81 | |
Index: trunk/extensions/UploadWizard/resources/mw.IframeTransport.js |
— | — | @@ -56,7 +56,6 @@ |
57 | 57 | // Set up the completion callback |
58 | 58 | var _this = this; |
59 | 59 | $j( '#' + this.iframeId ).load( function() { |
60 | | - debugger; |
61 | 60 | mw.log( "received result in iframe" ); |
62 | 61 | _this.progressCb( 1.0 ); |
63 | 62 | _this.processIframeResult( $j( this ).get( 0 ) ); |
Index: trunk/extensions/UploadWizard/resources/combined.min.js |
— | — | @@ -5854,7 +5854,7 @@ |
5855 | 5855 | |
5856 | 5856 | $j.ajax(ajaxOptions); |
5857 | 5857 | |
5858 | | -}, |
| 5858 | +} |
5859 | 5859 | |
5860 | 5860 | } |
5861 | 5861 | |
— | — | @@ -7912,7 +7912,9 @@ |
7913 | 7913 | var _this=this; |
7914 | 7914 | this.transport=new mw.IframeTransport( |
7915 | 7915 | this.$form, |
7916 | | -function(fraction){_this.upload.setTransportProgress(fraction);}, |
| 7916 | +function(fraction){ |
| 7917 | +_this.upload.setTransportProgress(fraction); |
| 7918 | +}, |
7917 | 7919 | function(result){ |
7918 | 7920 | _this.upload.setTransported(result); |
7919 | 7921 | } |
— | — | @@ -7998,7 +8000,8 @@ |
7999 | 8001 | var ok=function(){ |
8000 | 8002 | mw.log("api: upload start!"); |
8001 | 8003 | _this.beginTime=(new Date()).getTime(); |
8002 | | -_this.upload.ui.busy(); |
| 8004 | +_this.upload.ui.setStatus('mwe-upwiz-transport-started'); |
| 8005 | +_this.upload.ui.showTransportProgress(); |
8003 | 8006 | _this.$form.submit(); |
8004 | 8007 | }; |
8005 | 8008 | var err=function(code,info){ |
— | — | @@ -8349,7 +8352,7 @@ |
8350 | 8353 | |
8351 | 8354 | |
8352 | 8355 | |
8353 | | -mw.GroupProgressBar=function(selector,text,uploads,endState,progressProperty,weightProperty){ |
| 8356 | +mw.GroupProgressBar=function(selector,text,uploads,endStates,progressProperty,weightProperty){ |
8354 | 8357 | var _this=this; |
8355 | 8358 | |
8356 | 8359 | |
— | — | @@ -8369,7 +8372,7 @@ |
8370 | 8373 | _this.$selector.find('.mwe-upwiz-progress-bar').progressbar({value:0}); |
8371 | 8374 | |
8372 | 8375 | _this.uploads=uploads; |
8373 | | -_this.endState=endState; |
| 8376 | +_this.endStates=endStates; |
8374 | 8377 | _this.progressProperty=progressProperty; |
8375 | 8378 | _this.weightProperty=weightProperty; |
8376 | 8379 | _this.beginTime=undefined; |
— | — | @@ -8404,7 +8407,7 @@ |
8405 | 8408 | var endStateCount=0; |
8406 | 8409 | var hasData=false; |
8407 | 8410 | $j.each(_this.uploads,function(i,upload){ |
8408 | | -if(upload.state==_this.endState){ |
| 8411 | +if($j.inArray(upload.state,_this.endStates)!==-1){ |
8409 | 8412 | endStateCount++; |
8410 | 8413 | } |
8411 | 8414 | if(upload[_this.progressProperty]!==undefined){ |
— | — | @@ -9194,11 +9197,11 @@ |
9195 | 9198 | |
9196 | 9199 | |
9197 | 9200 | |
9198 | | -setFailed:function(code){ |
| 9201 | +setError:function(code,info){ |
9199 | 9202 | |
9200 | | -this.state='failed'; |
| 9203 | +this.state='error'; |
9201 | 9204 | this.transportProgress=0; |
9202 | | -this.ui.showFailed(code); |
| 9205 | +this.ui.showError(code,info); |
9203 | 9206 | }, |
9204 | 9207 | |
9205 | 9208 | |
— | — | @@ -9212,11 +9215,25 @@ |
9213 | 9216 | |
9214 | 9217 | _this.state='transported'; |
9215 | 9218 | _this.transportProgress=1; |
9216 | | -_this.ui.showTransported(); |
| 9219 | +_this.ui.setStatus('mwe-upwiz-getting-metadata'); |
9217 | 9220 | _this.extractUploadInfo(result); |
| 9221 | +var setupDeedsAndShowComplete=function(){ |
| 9222 | +_this.ui.setPreview($img); |
9218 | 9223 | _this.deedPreview.setup(); |
9219 | 9224 | _this.details.populate(); |
| 9225 | +_this.state='stashed'; |
| 9226 | +_this.ui.showStashed(); |
| 9227 | +}; |
| 9228 | +var $img=$j('<img/>').load(setupDeedsAndShowComplete); |
9220 | 9229 | |
| 9230 | +_this.getThumbnail( |
| 9231 | +function(thumbnailAttrs){ |
| 9232 | +$img.attr(thumbnailAttrs); |
| 9233 | +}, |
| 9234 | +mw.UploadWizard.config['iconThumbnailWidth'], |
| 9235 | +mw.UploadWizard.config['iconThumbnailMaxHeight'] |
| 9236 | +); |
| 9237 | + |
9221 | 9238 | }else if(result.upload&&result.upload.sessionkey){ |
9222 | 9239 | |
9223 | 9240 | if(result.upload.warnings.duplicate){ |
— | — | @@ -9227,13 +9244,13 @@ |
9228 | 9245 | |
9229 | 9246 | }else{ |
9230 | 9247 | |
9231 | | -_this.state='error'; |
9232 | | -_this.ui.showFailed(); |
| 9248 | +var code='unknown'; |
| 9249 | +var info='unknown'; |
9233 | 9250 | if(result.error){ |
9234 | | -alert("error : "+result.error.code+" : "+result.error.info); |
| 9251 | +code=result.error.code; |
| 9252 | +info=result.error.info; |
9235 | 9253 | } |
9236 | | - |
9237 | | - |
| 9254 | +_this.setError(code,info); |
9238 | 9255 | } |
9239 | 9256 | |
9240 | 9257 | }, |
— | — | @@ -9306,9 +9323,13 @@ |
9307 | 9324 | |
9308 | 9325 | |
9309 | 9326 | |
9310 | | -getThumbnail:function(width,callback){ |
| 9327 | + |
| 9328 | +getThumbnail:function(callback,width,height){ |
9311 | 9329 | var _this=this; |
9312 | | -var key="width"+width; |
| 9330 | +if(mw.isEmpty(height)){ |
| 9331 | +height=-1; |
| 9332 | +} |
| 9333 | +var key="width"+width+',height'+height; |
9313 | 9334 | if(mw.isDefined(_this.thumbnails[key])){ |
9314 | 9335 | callback(_this.thumbnails[key]); |
9315 | 9336 | }else{ |
— | — | @@ -9316,6 +9337,7 @@ |
9317 | 9338 | 'prop':'stashimageinfo', |
9318 | 9339 | 'siisessionkey':_this.sessionKey, |
9319 | 9340 | 'siiurlwidth':width, |
| 9341 | +'siiurlheight':height, |
9320 | 9342 | 'siiprop':'url' |
9321 | 9343 | }; |
9322 | 9344 | |
— | — | @@ -9346,12 +9368,17 @@ |
9347 | 9369 | |
9348 | 9370 | |
9349 | 9371 | |
9350 | | -setThumbnail:function(selector,width){ |
| 9372 | + |
| 9373 | +setThumbnail:function(selector,width,height){ |
9351 | 9374 | var _this=this; |
9352 | 9375 | if(typeof width==='undefined'||width===null||width<=0){ |
9353 | 9376 | width=mw.UploadWizard.config['thumbnailWidth']; |
9354 | 9377 | } |
9355 | 9378 | width=parseInt(width,10); |
| 9379 | +height=null; |
| 9380 | +if(!mw.isEmpty(height)){ |
| 9381 | +height=parseInt(height,10); |
| 9382 | +} |
9356 | 9383 | |
9357 | 9384 | var callback=function(thumbnail){ |
9358 | 9385 | |
— | — | @@ -9367,7 +9394,7 @@ |
9368 | 9395 | }; |
9369 | 9396 | |
9370 | 9397 | $j(selector).loadingSpinner(); |
9371 | | -_this.getThumbnail(width,callback); |
| 9398 | +_this.getThumbnail(callback,width,height); |
9372 | 9399 | } |
9373 | 9400 | |
9374 | 9401 | }; |
— | — | @@ -9388,9 +9415,8 @@ |
9389 | 9416 | _this.div=$j('<div class="mwe-upwiz-file"></div>').get(0); |
9390 | 9417 | _this.isFilled=false; |
9391 | 9418 | |
9392 | | -_this.fileInputCtrl=$j('<input size="1" class="mwe-upwiz-file-input" name="file" type="file"/>') |
9393 | | -.change(function(){_this.fileChanged();}) |
9394 | | -.get(0); |
| 9419 | +_this.$fileInputCtrl=$j('<input size="1" class="mwe-upwiz-file-input" name="file" type="file"/>') |
| 9420 | +.change(function(){_this.fileChanged();}); |
9395 | 9421 | |
9396 | 9422 | |
9397 | 9423 | visibleFilenameDiv=$j('<div class="mwe-upwiz-visible-file"></div>') |
— | — | @@ -9405,14 +9431,15 @@ |
9406 | 9432 | +'</div>' |
9407 | 9433 | +'</div>' |
9408 | 9434 | ); |
9409 | | -visibleFilenameDiv.find('.mwe-upwiz-file-status-line').append( |
9410 | | -$j.fn.removeCtrl( |
| 9435 | + |
| 9436 | +_this.$removeCtrl=$j.fn.removeCtrl( |
9411 | 9437 | 'mwe-upwiz-remove', |
9412 | 9438 | 'mwe-upwiz-remove-upload', |
9413 | 9439 | function(){_this.upload.remove();} |
9414 | | -).addClass("mwe-upwiz-file-status-line-item") |
9415 | | -); |
| 9440 | +).addClass("mwe-upwiz-file-status-line-item"); |
9416 | 9441 | |
| 9442 | +visibleFilenameDiv.find('.mwe-upwiz-file-status-line') |
| 9443 | +.append(_this.$removeCtrl); |
9417 | 9444 | |
9418 | 9445 | |
9419 | 9446 | |
— | — | @@ -9437,7 +9464,7 @@ |
9438 | 9465 | _this.form=$j('<form class="mwe-upwiz-form"></form>') |
9439 | 9466 | .append(visibleFilenameDiv) |
9440 | 9467 | .append(_this.fileCtrlContainer |
9441 | | -.append(_this.fileInputCtrl) |
| 9468 | +.append(_this.$fileInputCtrl) |
9442 | 9469 | ) |
9443 | 9470 | .append(_this.filenameCtrl) |
9444 | 9471 | .append(_this.thumbnailParam) |
— | — | @@ -9475,17 +9502,10 @@ |
9476 | 9503 | .remove(); |
9477 | 9504 | }, |
9478 | 9505 | |
9479 | | -busy:function(){ |
9480 | | -var _this=this; |
9481 | 9506 | |
9482 | 9507 | |
9483 | 9508 | |
9484 | | -}, |
9485 | | - |
9486 | | - |
9487 | | - |
9488 | | - |
9489 | | -showIndicatorMessage:function(statusClass,msgKey){ |
| 9509 | +showIndicator:function(statusClass){ |
9490 | 9510 | var _this=this; |
9491 | 9511 | var $indicator=$j(_this.div).find('.mwe-upwiz-file-indicator'); |
9492 | 9512 | $j.each($indicator.attr('class').split(/\s+/),function(i,className){ |
— | — | @@ -9493,13 +9513,16 @@ |
9494 | 9514 | $indicator.removeClass(className); |
9495 | 9515 | } |
9496 | 9516 | }); |
9497 | | -$indicator.addClass('mwe-upwiz-status-'+statusClass) |
9498 | | -.html(gM(msgKey)); |
| 9517 | +$indicator.addClass('mwe-upwiz-status-'+statusClass); |
| 9518 | + |
9499 | 9519 | $j(_this.div).find('.mwe-upwiz-visible-file-filename') |
9500 | 9520 | .css('margin-right',($indicator.outerWidth()+24).toString()+'px'); |
9501 | 9521 | $indicator.css('visibility','visible'); |
| 9522 | +}, |
9502 | 9523 | |
9503 | | -_this.setStatus(msgKey); |
| 9524 | +setPreview:function($img){ |
| 9525 | + |
| 9526 | +$j(this.div).find('.mwe-upwiz-file-preview').css('background-image','url('+$img.attr('src')+')'); |
9504 | 9527 | }, |
9505 | 9528 | |
9506 | 9529 | |
— | — | @@ -9523,23 +9546,28 @@ |
9524 | 9547 | |
9525 | 9548 | |
9526 | 9549 | showTransportProgress:function(fraction){ |
9527 | | -this.showIndicatorMessage('progress','mwe-upwiz-uploading'); |
9528 | 9550 | |
| 9551 | +this.showIndicator('progress'); |
| 9552 | +this.setStatus('mwe-upwiz-uploading'); |
9529 | 9553 | }, |
9530 | 9554 | |
9531 | 9555 | |
9532 | 9556 | |
9533 | 9557 | |
9534 | | -showTransported:function(){ |
9535 | | -this.showIndicatorMessage('completed','mwe-upwiz-transported'); |
| 9558 | +showStashed:function(){ |
| 9559 | +this.$removeCtrl.detach(); |
| 9560 | +this.$fileInputCtrl.detach(); |
| 9561 | +this.showIndicator('stashed'); |
| 9562 | +this.setStatus('mwe-upwiz-stashed-upload'); |
9536 | 9563 | }, |
9537 | 9564 | |
9538 | 9565 | |
9539 | 9566 | |
9540 | 9567 | |
9541 | | -showFailed:function(code){ |
9542 | | -this.showIndicatorMessage('failed','mwe-upwiz-failed'); |
| 9568 | +showError:function(code,info){ |
9543 | 9569 | |
| 9570 | +this.showIndicator('error'); |
| 9571 | + |
9544 | 9572 | }, |
9545 | 9573 | |
9546 | 9574 | |
— | — | @@ -9549,7 +9577,7 @@ |
9550 | 9578 | fileChanged:function(){ |
9551 | 9579 | var _this=this; |
9552 | 9580 | _this.clearErrors(); |
9553 | | -_this.upload.extractLocalFileInfo($j(_this.fileInputCtrl).val()); |
| 9581 | +_this.upload.extractLocalFileInfo(_this.$fileInputCtrl.val()); |
9554 | 9582 | if(_this.isGoodExtension(_this.upload.title.getExtension())){ |
9555 | 9583 | _this.updateFilename(); |
9556 | 9584 | }else{ |
— | — | @@ -9578,9 +9606,9 @@ |
9579 | 9607 | |
9580 | 9608 | |
9581 | 9609 | |
9582 | | -$j(this.fileInputCtrl).css({ |
9583 | | -'margin-left':'-'+~~($j(this.fileInputCtrl).width()-$covered.outerWidth()-10)+'px', |
9584 | | -'margin-top':'-'+~~($j(this.fileInputCtrl).height()-$covered.outerHeight()-10)+'px' |
| 9610 | +this.$fileInputCtrl.css({ |
| 9611 | +'margin-left':'-'+~~(this.$fileInputCtrl.width()-$covered.outerWidth()-10)+'px', |
| 9612 | +'margin-top':'-'+~~(this.$fileInputCtrl.height()-$covered.outerHeight()-10)+'px' |
9585 | 9613 | }); |
9586 | 9614 | |
9587 | 9615 | |
— | — | @@ -9597,7 +9625,7 @@ |
9598 | 9626 | updateFilename:function(){ |
9599 | 9627 | var _this=this; |
9600 | 9628 | |
9601 | | -var path=_this.fileInputCtrl.value; |
| 9629 | +var path=_this.$fileInputCtrl.val(); |
9602 | 9630 | |
9603 | 9631 | |
9604 | 9632 | $j(_this.form).find('.mwe-upwiz-visible-file-filename-text').html(path); |
— | — | @@ -10211,7 +10239,7 @@ |
10212 | 10240 | populate:function(){ |
10213 | 10241 | var _this=this; |
10214 | 10242 | mw.log("populating details from upload"); |
10215 | | -_this.upload.setThumbnail(_this.thumbnailDiv); |
| 10243 | +_this.upload.setThumbnail(_this.thumbnailDiv,mw.UploadWizard.config['thumbnailWidth'],mw.UploadWizard.config['thumbnailMaxHeight']); |
10216 | 10244 | _this.prefillDate(); |
10217 | 10245 | _this.prefillSource(); |
10218 | 10246 | _this.prefillAuthor(); |
— | — | @@ -10652,48 +10680,13 @@ |
10653 | 10681 | _this.removeEmptyUploads(); |
10654 | 10682 | _this.startUploads(function(){ |
10655 | 10683 | |
| 10684 | +alert("hey, uploads are done"); |
10656 | 10685 | |
10657 | | - |
10658 | | - |
10659 | | - |
10660 | | - |
10661 | | -var deeds=[ |
10662 | | -new mw.UploadWizardDeedOwnWork(_this.uploads.length), |
10663 | | -new mw.UploadWizardDeedThirdParty(_this.uploads.length) |
10664 | | -]; |
10665 | | - |
10666 | | - |
10667 | | - |
10668 | | -if(_this.uploads.length>1){ |
10669 | | -var customDeed=$j.extend(new mw.UploadWizardDeed(),{ |
10670 | | -valid:function(){return true;}, |
10671 | | -name:'custom' |
10672 | 10686 | }); |
10673 | | -deeds.push(customDeed); |
10674 | | -} |
10675 | | - |
10676 | | -_this.deedChooser=new mw.UploadWizardDeedChooser( |
10677 | | -'#mwe-upwiz-deeds', |
10678 | | -deeds, |
10679 | | -_this.uploads.length); |
10680 | | - |
10681 | | -$j('<div>').html(gM('mwe-upwiz-deeds-macro-prompt',_this.uploads.length)) |
10682 | | -.insertBefore(_this.deedChooser.$selector.find('.mwe-upwiz-deed-ownwork')); |
10683 | | - |
10684 | | -if(_this.uploads.length>1){ |
10685 | | -$j('<div style="margin-top: 1em">').html(gM('mwe-upwiz-deeds-custom-prompt')) |
10686 | | -.insertBefore(_this.deedChooser.$selector.find('.mwe-upwiz-deed-custom')); |
10687 | | -} |
10688 | | - |
10689 | | - |
10690 | | -_this.moveToStep('deeds'); |
10691 | | - |
10692 | 10687 | }); |
10693 | | -}); |
10694 | 10688 | |
10695 | 10689 | |
10696 | 10690 | |
10697 | | - |
10698 | 10691 | $j('#mwe-upwiz-deeds-intro').html(gM('mwe-upwiz-deeds-intro')); |
10699 | 10692 | |
10700 | 10693 | $j('#mwe-upwiz-stepdiv-deeds .mwe-upwiz-button-next') |
— | — | @@ -10754,12 +10747,49 @@ |
10755 | 10748 | |
10756 | 10749 | |
10757 | 10750 | |
| 10751 | +prepareAndMoveToDeeds:function(){ |
10758 | 10752 | |
10759 | 10753 | |
| 10754 | +var deeds=[ |
| 10755 | +new mw.UploadWizardDeedOwnWork(_this.uploads.length), |
| 10756 | +new mw.UploadWizardDeedThirdParty(_this.uploads.length) |
| 10757 | +]; |
10760 | 10758 | |
10761 | 10759 | |
10762 | 10760 | |
| 10761 | +if(_this.uploads.length>1){ |
| 10762 | +var customDeed=$j.extend(new mw.UploadWizardDeed(),{ |
| 10763 | +valid:function(){return true;}, |
| 10764 | +name:'custom' |
| 10765 | +}); |
| 10766 | +deeds.push(customDeed); |
| 10767 | +} |
10763 | 10768 | |
| 10769 | +_this.deedChooser=new mw.UploadWizardDeedChooser( |
| 10770 | +'#mwe-upwiz-deeds', |
| 10771 | +deeds, |
| 10772 | +_this.uploads.length); |
| 10773 | + |
| 10774 | +$j('<div>').html(gM('mwe-upwiz-deeds-macro-prompt',_this.uploads.length)) |
| 10775 | +.insertBefore(_this.deedChooser.$selector.find('.mwe-upwiz-deed-ownwork')); |
| 10776 | + |
| 10777 | +if(_this.uploads.length>1){ |
| 10778 | +$j('<div style="margin-top: 1em">').html(gM('mwe-upwiz-deeds-custom-prompt')) |
| 10779 | +.insertBefore(_this.deedChooser.$selector.find('.mwe-upwiz-deed-custom')); |
| 10780 | +} |
| 10781 | + |
| 10782 | +_this.moveToStep('deeds'); |
| 10783 | + |
| 10784 | +}, |
| 10785 | + |
| 10786 | + |
| 10787 | + |
| 10788 | + |
| 10789 | + |
| 10790 | + |
| 10791 | + |
| 10792 | + |
| 10793 | + |
10764 | 10794 | moveToStep:function(selectedStepName,callback){ |
10765 | 10795 | var _this=this; |
10766 | 10796 | |
— | — | @@ -10896,7 +10926,7 @@ |
10897 | 10927 | var toRemove=[]; |
10898 | 10928 | |
10899 | 10929 | for(var i=0;i<_this.uploads.length;i++){ |
10900 | | -if(mw.isEmpty(_this.uploads[i].ui.fileInputCtrl.value)){ |
| 10930 | +if(mw.isEmpty(_this.uploads[i].ui.$fileInputCtrl.val())){ |
10901 | 10931 | toRemove.push(_this.uploads[i]); |
10902 | 10932 | } |
10903 | 10933 | } |
— | — | @@ -10915,7 +10945,7 @@ |
10916 | 10946 | |
10917 | 10947 | |
10918 | 10948 | |
10919 | | -makeTransitioner:function(beginState,progressState,endState,starter,endCallback){ |
| 10949 | +makeTransitioner:function(beginState,progressStates,endStates,starter,endCallback){ |
10920 | 10950 | |
10921 | 10951 | var _this=this; |
10922 | 10952 | |
— | — | @@ -10923,9 +10953,9 @@ |
10924 | 10954 | var uploadsToStart=_this.maxSimultaneousConnections; |
10925 | 10955 | var endStateCount=0; |
10926 | 10956 | $j.each(_this.uploads,function(i,upload){ |
10927 | | -if(upload.state==endState){ |
| 10957 | +if($j.inArray(upload.state,endStates)!==-1){ |
10928 | 10958 | endStateCount++; |
10929 | | -}else if(upload.state==progressState){ |
| 10959 | +}else if($j.inArray(upload.state,progressStates)!==-1){ |
10930 | 10960 | uploadsToStart--; |
10931 | 10961 | }else if((upload.state==beginState)&&(uploadsToStart>0)){ |
10932 | 10962 | starter(upload); |
— | — | @@ -10965,7 +10995,7 @@ |
10966 | 10996 | var progressBar=new mw.GroupProgressBar('#mwe-upwiz-progress', |
10967 | 10997 | gM('mwe-upwiz-uploading'), |
10968 | 10998 | _this.uploads, |
10969 | | -'transported', |
| 10999 | +['stashed'], |
10970 | 11000 | 'transportProgress', |
10971 | 11001 | 'transportWeight'); |
10972 | 11002 | progressBar.start(); |
— | — | @@ -10979,8 +11009,8 @@ |
10980 | 11010 | |
10981 | 11011 | _this.makeTransitioner( |
10982 | 11012 | 'new', |
10983 | | -'transporting', |
10984 | | -'transported', |
| 11013 | +['transporting','transported','metadata'], |
| 11014 | +['error','verified'], |
10985 | 11015 | function(upload){ |
10986 | 11016 | upload.start(); |
10987 | 11017 | }, |
— | — | @@ -11088,8 +11118,8 @@ |
11089 | 11119 | |
11090 | 11120 | _this.makeTransitioner( |
11091 | 11121 | 'details', |
11092 | | -'submitting-details', |
11093 | | -'complete', |
| 11122 | +['submitting-details'], |
| 11123 | +['complete'], |
11094 | 11124 | function(upload){ |
11095 | 11125 | upload.details.submit(function(){ |
11096 | 11126 | upload.details.div.data('mask').html(); |
— | — | @@ -11186,21 +11216,14 @@ |
11187 | 11217 | |
11188 | 11218 | var thumbnailDiv=$j('<div class="mwe-upwiz-thumbnail-small"></div>'); |
11189 | 11219 | $j('#mwe-upwiz-deeds-thumbnails').append(thumbnailDiv); |
11190 | | -_this.upload.setThumbnail(thumbnailDiv,mw.UploadWizard.config['smallThumbnailWidth']); |
| 11220 | +_this.upload.setThumbnail(thumbnailDiv,mw.UploadWizard.config['smallThumbnailWidth'],mw.UploadWizard.config['smallThumbnailMaxHeight']); |
11191 | 11221 | } |
11192 | 11222 | }; |
11193 | 11223 | |
| 11224 | +})(jQuery); |
11194 | 11225 | |
| 11226 | +(function($j){ |
11195 | 11227 | |
11196 | | -$j.fn.removeCtrl=function(msgKey,tooltipMsgKey,callback){ |
11197 | | -var msg=(msgKey===null)?'':gM(msgKey); |
11198 | | -return $j('<div class="mwe-upwiz-remove-ctrl ui-corner-all" />') |
11199 | | -.attr('title',gM(tooltipMsgKey)) |
11200 | | -.click(callback) |
11201 | | -.hover(function(){$j(this).addClass('hover');}, |
11202 | | -function(){$j(this).removeClass('hover');}) |
11203 | | -.append($j('<div class="ui-icon ui-icon-close" /><div class="mwe-upwiz-remove-ctrl-msg">'+msg+'</div>')); |
11204 | | -}; |
11205 | 11228 | |
11206 | 11229 | |
11207 | 11230 | |
— | — | @@ -11211,8 +11234,6 @@ |
11212 | 11235 | |
11213 | 11236 | |
11214 | 11237 | |
11215 | | - |
11216 | | - |
11217 | 11238 | $j.fn.preventCloseWindow=function(options){ |
11218 | 11239 | if(typeof options==='undefined'){ |
11219 | 11240 | options={}; |
— | — | @@ -11420,7 +11441,11 @@ |
11421 | 11442 | apiUrl:apiUrl, |
11422 | 11443 | |
11423 | 11444 | thumbnailWidth:120, |
| 11445 | +thumbnailMaxHeight:200, |
11424 | 11446 | smallThumbnailWidth:60, |
| 11447 | +smallThumbnailMaxHeight:100, |
| 11448 | +iconThumbnailWidth:32, |
| 11449 | +iconThumbnailMaxHeight:32, |
11425 | 11450 | maxAuthorLength:50, |
11426 | 11451 | minAuthorLength:2, |
11427 | 11452 | maxSourceLength:200, |
Index: trunk/extensions/UploadWizard/SpecialUploadWizard.php |
— | — | @@ -199,7 +199,6 @@ |
200 | 200 | . '</div>' |
201 | 201 | |
202 | 202 | . '<div class="mwe-upwiz-stepdiv ui-helper-clearfix" id="mwe-upwiz-stepdiv-file">' |
203 | | - . '<div id="mwe-upwiz-intro">' . wfMsg('mwe-upwiz-intro') . '</div>' |
204 | 203 | . '<div id="mwe-upwiz-files">' |
205 | 204 | . '<div id="mwe-upwiz-filelist" class="ui-corner-all"></div>' |
206 | 205 | . '<div id="mwe-upwiz-upload-ctrls" class="mwe-upwiz-file">' |
Index: trunk/extensions/UploadWizard/UploadWizardPage.js |
— | — | @@ -19,7 +19,11 @@ |
20 | 20 | apiUrl: apiUrl, |
21 | 21 | |
22 | 22 | thumbnailWidth: 120, |
| 23 | + thumbnailMaxHeight: 200, |
23 | 24 | smallThumbnailWidth: 60, |
| 25 | + smallThumbnailMaxHeight: 100, |
| 26 | + iconThumbnailWidth: 32, |
| 27 | + iconThumbnailMaxHeight: 32, |
24 | 28 | maxAuthorLength: 50, |
25 | 29 | minAuthorLength: 2, |
26 | 30 | maxSourceLength: 200, |