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 // add some basic labels to client
$this->output->add_label('loading', 'servererror', 'connerror', 'requesttimedout', $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; return $this->output;
} }

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

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

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

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

@ -78,6 +78,7 @@ $messages['errormoving'] = 'Could not move the message(s).';
$messages['errorcopying'] = 'Could not copy the message(s).'; $messages['errorcopying'] = 'Could not copy the message(s).';
$messages['errordeleting'] = 'Could not delete the message(s).'; $messages['errordeleting'] = 'Could not delete the message(s).';
$messages['errormarking'] = 'Could not mark 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['deletecontactconfirm'] = 'Do you really want to delete selected contact(s)?';
$messages['deletegroupconfirm'] = 'Do you really want to delete selected group?'; $messages['deletegroupconfirm'] = 'Do you really want to delete selected group?';
$messages['deletemessagesconfirm'] = 'Do you really want to delete selected message(s)?'; $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', 'selectimportfile', 'messageissent', 'loadingdata', 'nopubkeyfor', 'nopubkeyforsender',
'encryptnoattachments','encryptedsendialog','searchpubkeyservers', 'importpubkeys', 'encryptnoattachments','encryptedsendialog','searchpubkeyservers', 'importpubkeys',
'encryptpubkeysfound', 'search', 'close', 'import', 'keyid', 'keylength', 'keyexpired', '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')); $OUTPUT->set_pagetitle($RCMAIL->gettext('compose'));

Loading…
Cancel
Save