Index: trunk/extensions/UploadWizard/UploadWizardHooks.php |
— | — | @@ -303,7 +303,8 @@ |
304 | 304 | 'mwe-upwiz-feedback-submit', |
305 | 305 | 'mwe-upwiz-feedback-adding', |
306 | 306 | 'mwe-upwiz-feedback-error1', |
307 | | - 'mwe-upwiz-feedback-error2' |
| 307 | + 'mwe-upwiz-feedback-error2', |
| 308 | + 'mwe-upwiz-feedback-error3' |
308 | 309 | ), |
309 | 310 | 'group' => 'ext.uploadWizard' |
310 | 311 | ), |
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php |
— | — | @@ -256,8 +256,9 @@ |
257 | 257 | 'mwe-upwiz-feedback-cancel' => 'Cancel', |
258 | 258 | 'mwe-upwiz-feedback-submit' => 'Submit Feedback', |
259 | 259 | 'mwe-upwiz-feedback-adding' => 'Adding feedback to page...', |
260 | | - 'mwe-upwiz-feedback-error1' => 'Error: Unknown result from API', |
261 | | - 'mwe-upwiz-feedback-error2' => 'Error: Edit failed' |
| 260 | + 'mwe-upwiz-feedback-error1' => 'Error: Unrecognized result from API', |
| 261 | + 'mwe-upwiz-feedback-error2' => 'Error: Edit failed', |
| 262 | + 'mwe-upwiz-feedback-error3' => 'Error: No response from API' |
262 | 263 | |
263 | 264 | ); |
264 | 265 | |
— | — | @@ -308,7 +309,7 @@ |
309 | 310 | 'mwe-upwiz-feedback-subject' => 'Label for a text input', |
310 | 311 | 'mwe-upwiz-feedback-message' => 'Label for a textarea; signature referrs to a Wikitext signature.', |
311 | 312 | 'mwe-upwiz-feedback-cancel' => 'Button label', |
312 | | - 'mwe-upwiz-feedback-cancel' => 'Button label', |
| 313 | + 'mwe-upwiz-feedback-submit' => 'Button label', |
313 | 314 | 'mwe-upwiz-feedback-adding' => 'Progress notice' |
314 | 315 | ); |
315 | 316 | |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js |
— | — | @@ -1228,22 +1228,29 @@ |
1229 | 1229 | dataType: 'json', |
1230 | 1230 | type: 'POST', |
1231 | 1231 | success: function( data ) { |
1232 | | - if ( data.edit.result == "Success" ) { |
1233 | | - $feedbackForm.dialog("close"); |
| 1232 | + if ( typeof data.edit != 'undefined' ) { |
| 1233 | + if ( data.edit.result == "Success" ) { |
| 1234 | + $feedbackForm.dialog("close"); |
| 1235 | + } else { |
| 1236 | + displayError( 'mwe-upwiz-feedback-error1' ); |
| 1237 | + } |
1234 | 1238 | } else { |
1235 | | - $('#mwe-upwiz-feedback-form div').hide(); // remove everything else from the dialog box |
1236 | | - $('#mwe-upwiz-feedback-form').append ( $('<div style="color:#990000;margin-top:0.4em;"></div>').msg( 'mwe-upwiz-feedback-error1' ) ); |
| 1239 | + displayError( 'mwe-upwiz-feedback-error2' ); |
1237 | 1240 | } |
1238 | 1241 | }, |
1239 | 1242 | error: function( xhr ) { |
1240 | | - $('#mwe-upwiz-feedback-form div').hide(); // remove everything else from the dialog box |
1241 | | - $('#mwe-upwiz-feedback-form').append ( $('<div style="color:#990000;margin-top:0.4em;"></div>').msg( 'mwe-upwiz-feedback-error2' ) ); |
| 1243 | + displayError( 'mwe-upwiz-feedback-error3' ); |
1242 | 1244 | } |
1243 | 1245 | }); // close Ajax request |
1244 | 1246 | }; // close useTokenToPost function |
1245 | 1247 | _this.api.getEditToken( useTokenToPost ); |
1246 | 1248 | }; // close submit button function |
1247 | 1249 | |
| 1250 | + var displayError = function( message ) { |
| 1251 | + $('#mwe-upwiz-feedback-form div').hide(); // remove everything else from the dialog box |
| 1252 | + $('#mwe-upwiz-feedback-form').append ( $('<div style="color:#990000;margin-top:0.4em;"></div>').msg( message ) ); |
| 1253 | + } |
| 1254 | + |
1248 | 1255 | // Construct the feedback form |
1249 | 1256 | var feedbackLink = '<a href="'+wgArticlePath.replace( '$1', mw.UploadWizard.config['feedbackPage'].replace( /\s/g, '_' ) )+'" target="_blank">'+mw.UploadWizard.config['feedbackPage']+'</a>'; |
1250 | 1257 | $feedbackForm = $('<div id="mwe-upwiz-feedback-form" style="position:relative;"></div>') |