use skined confirmation boxes where possible

pull/6040/head
PhilW 7 years ago
parent 0385eca50e
commit b897fe9349

@ -455,7 +455,7 @@ class rcmail extends rcube
// add some basic labels to client
$this->output->add_label('loading', 'servererror', 'connerror', 'requesttimedout',
'refreshing', 'windowopenerror', 'uploadingmany', 'close', 'save', 'cancel');
'refreshing', 'windowopenerror', 'uploadingmany', 'close', 'save', 'cancel', 'confirmationtitle', 'delete', 'continue');
return $this->output;
}

@ -720,14 +720,18 @@ function rcube_webmail()
// check input before leaving compose step
if (this.task == 'mail' && this.env.action == 'compose' && !this.env.server_error && command != 'save-pref'
&& $.inArray(command, this.env.compose_commands) < 0
&& $.inArray(command, this.env.compose_commands) < 0 && !this.compose_skip_unsavedcheck
) {
if (!this.env.is_sent && this.cmp_hash != this.compose_field_hash() && !confirm(this.get_label('notsentwarning')))
if (!this.env.is_sent && this.cmp_hash != this.compose_field_hash()) {
this.show_confirm(this.get_label('notsentwarning'), 'discard', function() {
// remove copy from local storage if compose screen is left intentionally
ref.remove_compose_data(ref.env.compose_id);
ref.compose_skip_unsavedcheck = true;
ref.command(command, props, obj, event);
return true;
});
return false;
// remove copy from local storage if compose screen is left intentionally
this.remove_compose_data(this.env.compose_id);
this.compose_skip_unsavedcheck = true;
}
}
this.last_command = command;
@ -3155,8 +3159,10 @@ function rcube_webmail()
else {
// if shift was pressed delete it immediately
if ((list && list.modkey == SHIFT_KEY) || (event && rcube_event.get_modifier(event) == SHIFT_KEY)) {
if (confirm(this.get_label('deletemessagesconfirm')))
this.permanently_remove_messages();
this.show_confirm(this.get_label('deletemessagesconfirm'), 'delete', function() {
ref.permanently_remove_messages();
return true;
});
}
else
this.move_messages(trash);
@ -4036,17 +4042,19 @@ function rcube_webmail()
{
var lock, post_data = {_mbox: mbox};
if (!confirm(this.get_label('purgefolderconfirm')))
return false;
this.show_confirm(this.get_label('purgefolderconfirm'), 'delete', function() {
// lock interface if it's the active mailbox
if (mbox == ref.env.mailbox) {
lock = ref.set_busy(true, 'loading');
post_data._reload = 1;
}
// lock interface if it's the active mailbox
if (mbox == this.env.mailbox) {
lock = this.set_busy(true, 'loading');
post_data._reload = 1;
}
// send request to server
ref.http_post('purge', post_data, lock);
return true;
});
// send request to server
this.http_post('purge', post_data, lock);
return false;
};
// test if purge command is allowed
@ -4762,8 +4770,11 @@ function rcube_webmail()
}
// submit delete request
if (key && confirm(this.get_label('deleteresponseconfirm'))) {
this.http_post('settings/delete-response', { _key: key }, false);
if (key) {
this.show_confirm(this.get_label('deleteresponseconfirm'), 'delete', function() {
ref.http_post('settings/delete-response', { _key: key }, false);
return true;
});
}
};
@ -6204,10 +6215,12 @@ function rcube_webmail()
{
var undelete = this.env.source && this.env.address_sources[this.env.source].undelete;
if (!undelete && !confirm(this.get_label('deletecontactconfirm')))
return;
return this._with_selected_contacts('delete');
if (!undelete) {
this.show_confirm(this.get_label('deletecontactconfirm'), 'delete', function() {
ref._with_selected_contacts('delete');
return true;
});
}
};
this._with_selected_contacts = function(action, post_data)
@ -6389,9 +6402,12 @@ function rcube_webmail()
this.group_delete = function()
{
if (this.env.group && confirm(this.get_label('deletegroupconfirm'))) {
var lock = this.set_busy(true, 'groupdeleting');
this.http_post('group-delete', {_source: this.env.source, _gid: this.env.group}, lock);
if (this.env.group) {
this.show_confirm(this.get_label('deletegroupconfirm'), 'delete', function() {
var lock = ref.set_busy(true, 'groupdeleting');
ref.http_post('group-delete', {_source: ref.env.source, _gid: ref.env.group}, lock);
return true;
});
}
};
@ -6924,8 +6940,12 @@ function rcube_webmail()
id = this.env.iid ? this.env.iid : selection[0];
// submit request with appended token
if (id && confirm(this.get_label('deleteidentityconfirm')))
this.http_post('settings/delete-identity', { _iid: id }, true);
if (id) {
this.show_confirm(this.get_label('deleteidentityconfirm'), 'delete', function() {
ref.http_post('settings/delete-identity', { _iid: id }, true);
return true;
});
}
};
this.update_identity_row = function(id, name, add)
@ -7088,8 +7108,11 @@ function rcube_webmail()
if (!name)
name = this.env.mailbox;
if (name && confirm(this.get_label('deletefolderconfirm'))) {
this.http_post('delete-folder', {_mbox: name}, this.set_busy(true, 'folderdeleting'));
if (name) {
this.show_confirm(this.get_label('deletefolderconfirm'), 'delete', function() {
ref.http_post('delete-folder', {_mbox: name}, ref.set_busy(true, 'folderdeleting'));
return true;
});
}
};
@ -7878,12 +7901,19 @@ function rcube_webmail()
buttons.unshift({
text: this.get_label(save_label),
'class': 'mainaction ' + save_label.replace(/^[^\.]+\./i, ''),
click: function(e, ui) { if (action_func(e)) close_func(e, ui, this); }
click: function(e, ui) { if (action_func(e, ref)) close_func(e, ui, this); }
});
return this.show_popup_dialog(content, title, buttons, options);
};
// simple_dialog() wrapper for confirm() type dialogs
this.show_confirm = function(content, button_label, action_func)
{
var options = { button: button_label || 'continue' };
return this.simple_dialog(content, this.get_label('confirmationtitle'), action_func, options);
};
// enable/disable buttons for page shifting
this.set_page_buttons = function()
{

@ -361,6 +361,8 @@ $labels['edit'] = 'Edit';
$labels['cancel'] = 'Cancel';
$labels['save'] = 'Save';
$labels['delete'] = 'Delete';
$labels['discard'] = 'Discard';
$labels['continue'] = 'Continue';
$labels['rename'] = 'Rename';
$labels['addphoto'] = 'Add';
$labels['replacephoto'] = 'Replace';

@ -76,6 +76,7 @@ $messages['errormoving'] = 'Could not move the message(s).';
$messages['errorcopying'] = 'Could not copy the message(s).';
$messages['errordeleting'] = 'Could not delete the message(s).';
$messages['errormarking'] = 'Could not mark the message(s).';
$messages['confirmationtitle'] = 'Are you sure...';
$messages['deletecontactconfirm'] = 'Do you really want to delete the selected contact(s)?';
$messages['deletegroupconfirm'] = 'Do you really want to delete the selected group?';
$messages['deletemessagesconfirm'] = 'Do you really want to delete the selected message(s)?';

@ -418,6 +418,8 @@ $labels['edit'] = 'Edit';
$labels['cancel'] = 'Cancel';
$labels['save'] = 'Save';
$labels['delete'] = 'Delete';
$labels['discard'] = 'Discard';
$labels['continue'] = 'Continue';
$labels['rename'] = 'Rename';
$labels['addphoto'] = 'Add';
$labels['replacephoto'] = 'Replace';

@ -78,6 +78,7 @@ $messages['errormoving'] = 'Could not move the message(s).';
$messages['errorcopying'] = 'Could not copy the message(s).';
$messages['errordeleting'] = 'Could not delete the message(s).';
$messages['errormarking'] = 'Could not mark the message(s).';
$messages['confirmationtitle'] = 'Are you sure...';
$messages['deletecontactconfirm'] = 'Do you really want to delete selected contact(s)?';
$messages['deletegroupconfirm'] = 'Do you really want to delete selected group?';
$messages['deletemessagesconfirm'] = 'Do you really want to delete selected message(s)?';

@ -81,7 +81,7 @@ $OUTPUT->add_label('notuploadedwarning', 'savingmessage',
'selectimportfile', 'messageissent', 'loadingdata', 'nopubkeyfor', 'nopubkeyforsender',
'encryptnoattachments','encryptedsendialog','searchpubkeyservers', 'importpubkeys',
'encryptpubkeysfound', 'search', 'close', 'import', 'keyid', 'keylength', 'keyexpired',
'keyrevoked', 'keyimportsuccess', 'keyservererror', 'attaching', 'namex', 'attachmentrename'
'keyrevoked', 'keyimportsuccess', 'keyservererror', 'attaching', 'namex', 'attachmentrename', 'discard'
);
$OUTPUT->set_pagetitle($RCMAIL->gettext('compose'));

Loading…
Cancel
Save