summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2014-03-20 22:07:02 +0100
committerThomas Bruederli <thomas@roundcube.net>2014-03-20 22:08:39 +0100
commitb7f95b7efe557093f9172780812ea421992b82f5 (patch)
treef88c7d75ed6fd10f452c6f0c7d3d86fed2abab1f
parent920322a60981fd22d21f64c34cfb55720620cf59 (diff)
Don't hide upload dialog if no file was selected. Display an alert message for all empty file uploads (#1489685)
-rw-r--r--program/js/app.js15
-rw-r--r--program/steps/mail/compose.inc3
2 files changed, 12 insertions, 6 deletions
diff --git a/program/js/app.js b/program/js/app.js
index fe7cf8141..605df57fa 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -564,7 +564,7 @@ function rcube_webmail()
// execute a specific command on the web client
this.command = function(command, props, obj, event)
{
- var ret, uid, cid, url, flag;
+ var ret, uid, cid, url, flag, aborted = false;
if (obj && obj.blur)
obj.blur();
@@ -1054,7 +1054,10 @@ function rcube_webmail()
// Reset the auto-save timer
clearTimeout(this.save_timer);
- this.upload_file(props || this.gui_objects.uploadform, 'upload');
+ if (!this.upload_file(props || this.gui_objects.uploadform, 'upload')) {
+ alert(this.get_label('selectimportfile'));
+ aborted = true;
+ }
break;
case 'insert-sig':
@@ -1182,6 +1185,7 @@ function rcube_webmail()
if (!this.upload_file(form, 'import')) {
this.set_busy(false, null, importlock);
alert(this.get_label('selectimportfile'));
+ aborted = true;
}
break;
@@ -1190,6 +1194,7 @@ function rcube_webmail()
var file = document.getElementById('rcmimportfile');
if (file && !file.value) {
alert(this.get_label('selectimportfile'));
+ aborted = true;
break;
}
this.gui_objects.importform.submit();
@@ -1241,9 +1246,9 @@ function rcube_webmail()
break;
}
- if (this.triggerEvent('after'+command, props) === false)
+ if (!aborted && this.triggerEvent('after'+command, props) === false)
ret = false;
- this.triggerEvent('actionafter', {props:props, action:command});
+ this.triggerEvent('actionafter', { props:props, action:command, aborted:aborted });
return ret === false ? false : obj ? false : true;
};
@@ -3985,7 +3990,7 @@ function rcube_webmail()
if (numfiles) {
if (this.env.max_filesize && this.env.filesizeerror && size > this.env.max_filesize) {
this.display_message(this.env.filesizeerror, 'error');
- return;
+ return false;
}
var frame_name = this.async_upload_form(form, action || 'upload', function(e) {
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index c76da14ce..46280292e 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -81,7 +81,8 @@ $OUTPUT->add_label('nosubject', 'nosenderwarning', 'norecipientwarning', 'nosubj
'nobodywarning', 'notsentwarning', 'notuploadedwarning', 'savingmessage', 'sendingmessage',
'messagesaved', 'converting', 'editorwarning', 'searching', 'uploading', 'uploadingmany',
'fileuploaderror', 'sendmessage', 'savenewresponse', 'responsename', 'responsetext', 'save',
- 'savingresponse', 'restoresavedcomposedata', 'restoremessage', 'delete', 'restore', 'ignore');
+ 'savingresponse', 'restoresavedcomposedata', 'restoremessage', 'delete', 'restore', 'ignore',
+ 'selectimportfile');
$OUTPUT->set_pagetitle($RCMAIL->gettext('compose'));