improvements for plugins and frames

pull/6040/head
PhilW 7 years ago
parent e7311e0e5e
commit 8c250a27f8

@ -55,13 +55,13 @@ rcube_webmail.prototype.acl_delete = function()
var users = this.acl_get_usernames();
if (users && users.length) {
this.confirm_dialog(this.get_label('acl.deleteconfirm'), 'delete', function() {
rcmail.http_post('settings/plugin.acl', {
this.confirm_dialog(this.get_label('acl.deleteconfirm'), 'delete', function(e, ref) {
ref.http_post('settings/plugin.acl', {
_act: 'delete',
_user: users.join(','),
_mbox: rcmail.env.mailbox
},
rcmail.set_busy(true, 'acl.deleting'));
ref.set_busy(true, 'acl.deleting'));
return true;
});

@ -191,12 +191,12 @@ rcube_webmail.prototype.enigma_delete = function()
if (!keys.length)
return;
this.confirm_dialog(this.get_label('enigma.keyremoveconfirm'), 'delete', function() {
var lock = rcmail.display_message(rcmail.get_label('enigma.keyremoving'), 'loading'),
this.confirm_dialog(this.get_label('enigma.keyremoveconfirm'), 'delete', function(e, ref) {
var lock = ref.display_message(ref.get_label('enigma.keyremoving'), 'loading'),
post = {_a: 'delete', _keys: keys};
// send request to server
rcmail.http_post('plugin.enigmakeys', post, lock);
ref.http_post('plugin.enigmakeys', post, lock);
});
};

@ -122,10 +122,10 @@ rcube_webmail.prototype.managesieve_del = function()
{
var id = this.filters_list.get_single_selection();
this.confirm_dialog(this.get_label('managesieve.filterdeleteconfirm'), 'delete', function() {
var lock = rcmail.set_busy(true, 'loading');
rcmail.http_post('plugin.managesieve-action',
'_act=delete&_fid='+rcmail.filters_list.rows[id].uid, lock);
this.confirm_dialog(this.get_label('managesieve.filterdeleteconfirm'), 'delete', function(e, ref) {
var lock = ref.set_busy(true, 'loading');
ref.http_post('plugin.managesieve-action',
'_act=delete&_fid='+ref.filters_list.rows[id].uid, lock);
return true;
});
};
@ -223,9 +223,9 @@ rcube_webmail.prototype.managesieve_setdel = function()
var id = this.filtersets_list.get_single_selection(),
script = this.env.filtersets[id];
this.confirm_dialog(this.get_label('managesieve.setdeleteconfirm'), 'delete', function() {
lock = rcmail.set_busy(true, 'loading'),
rcmail.http_post('plugin.managesieve-action', '_act=setdel&_set='+urlencode(script), lock);
this.confirm_dialog(this.get_label('managesieve.setdeleteconfirm'), 'delete', function(e, ref) {
lock = ref.set_busy(true, 'loading'),
ref.http_post('plugin.managesieve-action', '_act=setdel&_set='+urlencode(script), lock);
return true;
});
};
@ -540,10 +540,10 @@ rcube_webmail.prototype.managesieve_ruledel = function(id)
if ($('#ruledel'+id).hasClass('disabled'))
return;
this.confirm_dialog(this.get_label('managesieve.ruledeleteconfirm'), 'delete', function() {
this.confirm_dialog(this.get_label('managesieve.ruledeleteconfirm'), 'delete', function(e, ref) {
var row = document.getElementById('rulerow'+id);
row.parentNode.removeChild(row);
rcmail.managesieve_formbuttons(document.getElementById('rules'));
ref.managesieve_formbuttons(document.getElementById('rules'));
return true;
});
};
@ -576,10 +576,10 @@ rcube_webmail.prototype.managesieve_actiondel = function(id)
if ($('#actiondel'+id).hasClass('disabled'))
return;
this.confirm_dialog(this.get_label('managesieve.actiondeleteconfirm'), 'delete', function() {
this.confirm_dialog(this.get_label('managesieve.actiondeleteconfirm'), 'delete', function(e, ref) {
var row = document.getElementById('actionrow'+id);
row.parentNode.removeChild(row);
rcmail.managesieve_formbuttons(document.getElementById('actions'));
ref.managesieve_formbuttons(document.getElementById('actions'));
return true;
});
};

@ -723,7 +723,7 @@ function rcube_webmail()
&& $.inArray(command, this.env.compose_commands) < 0 && !this.compose_skip_unsavedcheck
) {
if (!this.env.is_sent && this.cmp_hash != this.compose_field_hash()) {
this.confirm_dialog(this.get_label('notsentwarning'), 'discard', function() {
this.confirm_dialog(this.get_label('notsentwarning'), 'discard', function(e, ref) {
// remove copy from local storage if compose screen is left intentionally
ref.remove_compose_data(ref.env.compose_id);
ref.compose_skip_unsavedcheck = true;
@ -3163,7 +3163,7 @@ 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)) {
this.confirm_dialog(this.get_label('deletemessagesconfirm'), 'delete', function() {
this.confirm_dialog(this.get_label('deletemessagesconfirm'), 'delete', function(e, ref) {
ref.permanently_remove_messages();
return true;
});
@ -4048,7 +4048,7 @@ function rcube_webmail()
{
var lock, post_data = {_mbox: mbox};
this.confirm_dialog(this.get_label('purgefolderconfirm'), 'delete', function() {
this.confirm_dialog(this.get_label('purgefolderconfirm'), 'delete', function(e, ref) {
// lock interface if it's the active mailbox
if (mbox == ref.env.mailbox) {
lock = ref.set_busy(true, 'loading');
@ -4781,7 +4781,7 @@ function rcube_webmail()
// submit delete request
if (key) {
this.confirm_dialog(this.get_label('deleteresponseconfirm'), 'delete', function() {
this.confirm_dialog(this.get_label('deleteresponseconfirm'), 'delete', function(e, ref) {
ref.http_post('settings/delete-response', { _key: key }, false);
return true;
});
@ -6226,7 +6226,7 @@ function rcube_webmail()
var undelete = this.env.source && this.env.address_sources[this.env.source].undelete;
if (!undelete) {
this.confirm_dialog(this.get_label('deletecontactconfirm'), 'delete', function() {
this.confirm_dialog(this.get_label('deletecontactconfirm'), 'delete', function(e, ref) {
ref._with_selected_contacts('delete');
return true;
});
@ -6413,7 +6413,7 @@ function rcube_webmail()
this.group_delete = function()
{
if (this.env.group) {
this.confirm_dialog(this.get_label('deletegroupconfirm'), 'delete', function() {
this.confirm_dialog(this.get_label('deletegroupconfirm'), 'delete', function(e, ref) {
var lock = ref.set_busy(true, 'groupdeleting');
ref.http_post('group-delete', {_source: ref.env.source, _gid: ref.env.group}, lock);
return true;
@ -6951,7 +6951,7 @@ function rcube_webmail()
// submit request with appended token
if (id) {
this.confirm_dialog(this.get_label('deleteidentityconfirm'), 'delete', function() {
this.confirm_dialog(this.get_label('deleteidentityconfirm'), 'delete', function(e, ref) {
ref.http_post('settings/delete-identity', { _iid: id }, true);
return true;
});
@ -7119,7 +7119,7 @@ function rcube_webmail()
name = this.env.mailbox;
if (name) {
this.confirm_dialog(this.get_label('deletefolderconfirm'), 'delete', function() {
this.confirm_dialog(this.get_label('deletefolderconfirm'), 'delete', function(e, ref) {
ref.http_post('delete-folder', {_mbox: name}, ref.set_busy(true, 'folderdeleting'));
return true;
});
@ -7898,9 +7898,11 @@ function rcube_webmail()
var title = this.get_label(title),
cancel_label = (options || {}).cancel_button || 'cancel',
save_label = (options || {}).button || 'save',
save_class = (options || {}).button_class || save_label.replace(/^[^\.]+\./i, ''),
close_func = function(e, ui, dialog) { (ref.is_framed() ? parent.$ : $)(dialog || this).dialog('close'); },
obj = this.is_framed() ? parent.rcmail : this,
buttons = [{
text: ref.get_label(cancel_label),
text: this.get_label(cancel_label),
'class': 'cancel',
click: close_func
}];
@ -7910,32 +7912,39 @@ function rcube_webmail()
else
buttons.unshift({
text: this.get_label(save_label),
'class': 'mainaction ' + save_label.replace(/^[^\.]+\./i, ''),
click: function(e, ui) { if (action_func(e, ref)) close_func(e, ui, this); }
'class': 'mainaction ' + save_class,
click: function(e, ui) { if (action_func(e, obj)) close_func(e, ui, this); }
});
return this.show_popup_dialog(content, title, buttons, options);
};
// show_popup_dialog() wrapper for alert() type dialogs
this.alert_dialog = function(content, action_func)
this.alert_dialog = function(content, action_func, options)
{
var close_func = function(e, ui, dialog) { (ref.is_framed() ? parent.$ : $)(dialog || this).dialog('close'); },
var title = (options || {}).title || 'alerttitle',
close_func = function(e, ui, dialog) { (ref.is_framed() ? parent.$ : $)(dialog || this).dialog('close'); },
obj = this.is_framed() ? parent.rcmail : this,
buttons = [{
text: ref.get_label('ok'),
text: this.get_label('ok'),
'class': 'mainaction ok',
click: function(e, ui) { if (!action_func || action_func(e, ref)) close_func(e, ui, this); }
click: function(e, ui) { if (!action_func || action_func(e, obj)) close_func(e, ui, this); }
}],
options = { close: buttons[0].click };
args = { close: buttons[0].click };
return this.show_popup_dialog(content, this.get_label('alerttitle'), buttons, options);
return this.show_popup_dialog(content, this.get_label(title), buttons, args);
};
// simple_dialog() wrapper for confirm() type dialogs
this.confirm_dialog = function(content, button_label, action_func)
this.confirm_dialog = function(content, button_label, action_func, options)
{
var options = { button: button_label || 'continue' };
return this.simple_dialog(content, this.get_label('confirmationtitle'), action_func, options);
var title = (options || {}).title || 'confirmationtitle',
args = {
button: button_label || 'continue',
button_class: (options || {}).button_class || ''
};
return this.simple_dialog(content, this.get_label(title), action_func, args);
};
// enable/disable buttons for page shifting

Loading…
Cancel
Save