Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js |
— | — | @@ -136,7 +136,7 @@ |
137 | 137 | var existsFileName = result.upload.warnings.exists; |
138 | 138 | try { |
139 | 139 | code = 'exists'; |
140 | | - info = _this.filenameToUrl( existsFileName ).toString(); |
| 140 | + info = new mw.Title( existsFileName, 'file' ).getUrl(); |
141 | 141 | } catch ( e ) { |
142 | 142 | code = 'unknown'; |
143 | 143 | info = 'Warned about existing filename, but filename is unparseable: "' + existsFileName + "'"; |
— | — | @@ -207,7 +207,7 @@ |
208 | 208 | $j.each( duplicates, function( i, filename ) { |
209 | 209 | var $a = $j( '<a/>' ).append( filename ); |
210 | 210 | try { |
211 | | - var href = _this.filenameToUrl( filename ); |
| 211 | + var href = new mw.Title( filename, 'file' ).getUrl(); |
212 | 212 | $a.attr( { 'href': href, 'target': '_blank' } ); |
213 | 213 | } catch ( e ) { |
214 | 214 | $a.click( function() { alert('could not parse filename=' + filename ); } ); |
— | — | @@ -897,21 +897,6 @@ |
898 | 898 | } ); // close thumbnail click function |
899 | 899 | }, |
900 | 900 | |
901 | | - |
902 | | - /** |
903 | | - * Given a filename like "Foo.jpg", get the URL to that filename, assuming the browser is on the same wiki. |
904 | | - * Candidate for a utility function... |
905 | | - * @param {String} filename |
906 | | - */ |
907 | | - filenameToUrl: function( filename ) { |
908 | | - var fileUrl = new mw.Uri( document.URL ); |
909 | | - fileUrl.path = wgScript; |
910 | | - var fileTitle = new mw.Title( filename, 'file' ); |
911 | | - fileUrl.query = { title: fileTitle, action: 'view' }; |
912 | | - return fileUrl; |
913 | | - } |
914 | | - |
915 | | - |
916 | 901 | }; |
917 | 902 | |
918 | 903 | |
— | — | @@ -1094,7 +1079,7 @@ |
1095 | 1080 | _this.prepareAndMoveToDeeds(); |
1096 | 1081 | } ); |
1097 | 1082 | } ); |
1098 | | - $j ( '#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons .mwe-upwiz-button-retry' ).click( function() { |
| 1083 | + $j( '#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons .mwe-upwiz-button-retry' ).click( function() { |
1099 | 1084 | _this.hideFileEndButtons(); |
1100 | 1085 | _this.startUploads(); |
1101 | 1086 | } ); |
— | — | @@ -1161,7 +1146,7 @@ |
1162 | 1147 | _this.removeErrorUploads( finalizeDetails ); |
1163 | 1148 | } ); |
1164 | 1149 | |
1165 | | - $j ( '#mwe-upwiz-stepdiv-details .mwe-upwiz-buttons .mwe-upwiz-button-retry' ) |
| 1150 | + $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-buttons .mwe-upwiz-button-retry' ) |
1166 | 1151 | .click( startDetails ); |
1167 | 1152 | |
1168 | 1153 | |
— | — | @@ -1650,6 +1635,12 @@ |
1651 | 1636 | var _this = this; |
1652 | 1637 | |
1653 | 1638 | $j.each( _this.uploads, function( i, upload ) { |
| 1639 | + // clear out error states, so we don't end up in an infinite loop |
| 1640 | + if ( upload.state === 'error' ) { |
| 1641 | + upload.state = 'details'; |
| 1642 | + } |
| 1643 | + |
| 1644 | + // set the "minimized" view of the details to have the right title |
1654 | 1645 | $j( upload.details.submittingDiv ) |
1655 | 1646 | .find( '.mwe-upwiz-visible-file-filename-text' ) |
1656 | 1647 | .html( upload.title.getMain() ); |