"upload-http-error": "An HTTP error occurred: $1",
"upload-copy-upload-invalid-domain": "Copy uploads are not available from this domain.",
"upload-foreign-cant-upload": "This wiki is not configured to upload files to the requested foreign file repository.",
+ "upload-foreign-cant-load-config": "Loading file upload configuration for the foreign file repository failed.",
"upload-dialog-title": "Upload file",
"upload-dialog-button-cancel": "Cancel",
"upload-dialog-button-done": "Done",
"upload-http-error": "Parameters:\n* $1 - error message",
"upload-copy-upload-invalid-domain": "Error message shown if a user is trying to upload (i.e. copy) a file from a website that is not in $wgCopyUploadsDomains (if set).\n\nSee also:\n* {{msg-mw|http-invalid-url}}\n* {{msg-mw|tmp-create-error}}\n* {{msg-mw|tmp-write-error}}",
"upload-foreign-cant-upload": "Error message shown when a user is trying to upload a file to foreign repository that is not configured to receive file uploads from current wiki.",
+ "upload-foreign-cant-load-config": "Error message shown when a user is trying to upload a file to foreign repository and the foreign wiki is down or otherwise unable to respond to API requests.",
"upload-dialog-title": "Title of the upload dialog box\n{{Identical|Upload file}}",
"upload-dialog-button-cancel": "Button to cancel the dialog\n{{Identical|Cancel}}",
"upload-dialog-button-done": "Button to close the dialog once upload is complete\n{{Identical|Done}}",
'mediawiki.ForeignUpload',
'mediawiki.ForeignStructuredUpload.config',
],
+ 'messages' => [
+ 'upload-foreign-cant-load-config',
+ ],
],
'mediawiki.Upload.Dialog' => [
'scripts' => [
// Foreign wiki might be running a pre-1.27 MediaWiki, without support for this
if ( resp.query && resp.query.uploaddialog ) {
upload.config = resp.query.uploaddialog;
+ return upload.config;
+ } else {
+ return $.Deferred().reject( 'upload-foreign-cant-load-config' );
}
- return upload.config;
+ }, function () {
+ return $.Deferred().reject( 'upload-foreign-cant-load-config' );
} );
} );
}
return this.upload.getApi().then(
function ( api ) {
return $.when(
- booklet.upload.loadConfig(),
+ booklet.upload.loadConfig().then(
+ null,
+ function ( errorMsg ) {
+ booklet.getPage( 'upload' ).$element.msg( errorMsg );
+ return $.Deferred().resolve();
+ }
+ ),
// If the user can't upload anything, don't give them the option to.
api.getUserInfo().then( function ( userInfo ) {
if ( userInfo.rights.indexOf( 'upload' ) === -1 ) {