more consistent function names

pull/6040/head
PhilW 7 years ago
parent af52df68bf
commit e7311e0e5e

@ -55,7 +55,7 @@ rcube_webmail.prototype.acl_delete = function()
var users = this.acl_get_usernames(); var users = this.acl_get_usernames();
if (users && users.length) { if (users && users.length) {
this.show_confirm(this.get_label('acl.deleteconfirm'), 'delete', function() { this.confirm_dialog(this.get_label('acl.deleteconfirm'), 'delete', function() {
rcmail.http_post('settings/plugin.acl', { rcmail.http_post('settings/plugin.acl', {
_act: 'delete', _act: 'delete',
_user: users.join(','), _user: users.join(','),
@ -84,11 +84,11 @@ rcube_webmail.prototype.acl_save = function()
} }
if (!user) { if (!user) {
this.show_alert(this.get_label('acl.nouser')); this.alert_dialog(this.get_label('acl.nouser'));
return; return;
} }
if (!rights) { if (!rights) {
this.show_alert(this.get_label('acl.norights')); this.alert_dialog(this.get_label('acl.norights'));
return; return;
} }

@ -135,17 +135,17 @@ rcube_webmail.prototype.enigma_key_create_save = function()
// validate the form // validate the form
if (!password || !confirm) { if (!password || !confirm) {
this.show_alert(this.get_label('enigma.formerror')); this.alert_dialog(this.get_label('enigma.formerror'));
return; return;
} }
if (password != confirm) { if (password != confirm) {
this.show_alert(this.get_label('enigma.passwordsdiffer')); this.alert_dialog(this.get_label('enigma.passwordsdiffer'));
return; return;
} }
if (!users.length) { if (!users.length) {
this.show_alert(this.get_label('enigma.noidentselected')); this.alert_dialog(this.get_label('enigma.noidentselected'));
return; return;
} }
@ -191,7 +191,7 @@ rcube_webmail.prototype.enigma_delete = function()
if (!keys.length) if (!keys.length)
return; return;
this.show_confirm(this.get_label('enigma.keyremoveconfirm'), 'delete', function() { this.confirm_dialog(this.get_label('enigma.keyremoveconfirm'), 'delete', function() {
var lock = rcmail.display_message(rcmail.get_label('enigma.keyremoving'), 'loading'), var lock = rcmail.display_message(rcmail.get_label('enigma.keyremoving'), 'loading'),
post = {_a: 'delete', _keys: keys}; post = {_a: 'delete', _keys: keys};
@ -276,7 +276,7 @@ rcube_webmail.prototype.enigma_import = function()
if (form = this.gui_objects.importform) { if (form = this.gui_objects.importform) {
file = document.getElementById('rcmimportfile'); file = document.getElementById('rcmimportfile');
if (file && !file.value) { if (file && !file.value) {
this.show_alert(this.get_label('selectimportfile')); this.alert_dialog(this.get_label('selectimportfile'));
return; return;
} }

@ -122,7 +122,7 @@ rcube_webmail.prototype.managesieve_del = function()
{ {
var id = this.filters_list.get_single_selection(); var id = this.filters_list.get_single_selection();
this.show_confirm(this.get_label('managesieve.filterdeleteconfirm'), 'delete', function() { this.confirm_dialog(this.get_label('managesieve.filterdeleteconfirm'), 'delete', function() {
var lock = rcmail.set_busy(true, 'loading'); var lock = rcmail.set_busy(true, 'loading');
rcmail.http_post('plugin.managesieve-action', rcmail.http_post('plugin.managesieve-action',
'_act=delete&_fid='+rcmail.filters_list.rows[id].uid, lock); '_act=delete&_fid='+rcmail.filters_list.rows[id].uid, lock);
@ -223,7 +223,7 @@ rcube_webmail.prototype.managesieve_setdel = function()
var id = this.filtersets_list.get_single_selection(), var id = this.filtersets_list.get_single_selection(),
script = this.env.filtersets[id]; script = this.env.filtersets[id];
this.show_confirm(this.get_label('managesieve.setdeleteconfirm'), 'delete', function() { this.confirm_dialog(this.get_label('managesieve.setdeleteconfirm'), 'delete', function() {
lock = rcmail.set_busy(true, 'loading'), lock = rcmail.set_busy(true, 'loading'),
rcmail.http_post('plugin.managesieve-action', '_act=setdel&_set='+urlencode(script), lock); rcmail.http_post('plugin.managesieve-action', '_act=setdel&_set='+urlencode(script), lock);
return true; return true;
@ -540,7 +540,7 @@ rcube_webmail.prototype.managesieve_ruledel = function(id)
if ($('#ruledel'+id).hasClass('disabled')) if ($('#ruledel'+id).hasClass('disabled'))
return; return;
this.show_confirm(this.get_label('managesieve.ruledeleteconfirm'), 'delete', function() { this.confirm_dialog(this.get_label('managesieve.ruledeleteconfirm'), 'delete', function() {
var row = document.getElementById('rulerow'+id); var row = document.getElementById('rulerow'+id);
row.parentNode.removeChild(row); row.parentNode.removeChild(row);
rcmail.managesieve_formbuttons(document.getElementById('rules')); rcmail.managesieve_formbuttons(document.getElementById('rules'));
@ -576,7 +576,7 @@ rcube_webmail.prototype.managesieve_actiondel = function(id)
if ($('#actiondel'+id).hasClass('disabled')) if ($('#actiondel'+id).hasClass('disabled'))
return; return;
this.show_confirm(this.get_label('managesieve.actiondeleteconfirm'), 'delete', function() { this.confirm_dialog(this.get_label('managesieve.actiondeleteconfirm'), 'delete', function() {
var row = document.getElementById('actionrow'+id); var row = document.getElementById('actionrow'+id);
row.parentNode.removeChild(row); row.parentNode.removeChild(row);
rcmail.managesieve_formbuttons(document.getElementById('actions')); rcmail.managesieve_formbuttons(document.getElementById('actions'));
@ -1117,7 +1117,7 @@ rcube_webmail.prototype.managesieve_create = function(force)
// check if there's at least one checkbox checked // check if there's at least one checkbox checked
var hdrs = $('input[name="headers[]"]:checked', dialog); var hdrs = $('input[name="headers[]"]:checked', dialog);
if (!hdrs.length) { if (!hdrs.length) {
rcmail.show_alert(rcmail.get_label('managesieve.nodata')); rcmail.alert_dialog(rcmail.get_label('managesieve.nodata'));
return; return;
} }

@ -30,25 +30,25 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
input_confpasswd = rcube_find_object('_confpasswd'); input_confpasswd = rcube_find_object('_confpasswd');
if (input_curpasswd && input_curpasswd.value == '') { if (input_curpasswd && input_curpasswd.value == '') {
rcmail.show_alert(rcmail.get_label('nocurpassword', 'password'), function() { rcmail.alert_dialog(rcmail.get_label('nocurpassword', 'password'), function() {
input_curpasswd.focus(); input_curpasswd.focus();
return true; return true;
}); });
} }
else if (input_newpasswd && input_newpasswd.value == '') { else if (input_newpasswd && input_newpasswd.value == '') {
rcmail.show_alert(rcmail.get_label('nopassword', 'password'), function() { rcmail.alert_dialog(rcmail.get_label('nopassword', 'password'), function() {
input_newpasswd.focus(); input_newpasswd.focus();
return true; return true;
}); });
} }
else if (input_confpasswd && input_confpasswd.value == '') { else if (input_confpasswd && input_confpasswd.value == '') {
rcmail.show_alert(rcmail.get_label('nopassword', 'password'), function() { rcmail.alert_dialog(rcmail.get_label('nopassword', 'password'), function() {
input_confpasswd.focus(); input_confpasswd.focus();
return true; return true;
}); });
} }
else if (input_newpasswd && input_confpasswd && input_newpasswd.value != input_confpasswd.value) { else if (input_newpasswd && input_confpasswd && input_newpasswd.value != input_confpasswd.value) {
rcmail.show_alert(rcmail.get_label('passwordinconsistency', 'password'), function() { rcmail.alert_dialog(rcmail.get_label('passwordinconsistency', 'password'), function() {
input_newpasswd.focus(); input_newpasswd.focus();
return true; return true;
}); });

@ -723,7 +723,7 @@ function rcube_webmail()
&& $.inArray(command, this.env.compose_commands) < 0 && !this.compose_skip_unsavedcheck && $.inArray(command, this.env.compose_commands) < 0 && !this.compose_skip_unsavedcheck
) { ) {
if (!this.env.is_sent && this.cmp_hash != this.compose_field_hash()) { if (!this.env.is_sent && this.cmp_hash != this.compose_field_hash()) {
this.show_confirm(this.get_label('notsentwarning'), 'discard', function() { this.confirm_dialog(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
ref.remove_compose_data(ref.env.compose_id); ref.remove_compose_data(ref.env.compose_id);
ref.compose_skip_unsavedcheck = true; ref.compose_skip_unsavedcheck = true;
@ -948,7 +948,7 @@ function rcube_webmail()
if (form) { if (form) {
// user prefs // user prefs
if ((input = $("[name='_pagesize']", form)) && input.length && isNaN(parseInt(input.val()))) { if ((input = $("[name='_pagesize']", form)) && input.length && isNaN(parseInt(input.val()))) {
this.show_alert(this.get_label('nopagesizewarning'), function() { this.alert_dialog(this.get_label('nopagesizewarning'), function() {
input.focus(); input.focus();
return true; return true;
}); });
@ -963,7 +963,7 @@ function rcube_webmail()
else if (this.task == 'settings' && (this.env.identities_level % 2) == 0 && else if (this.task == 'settings' && (this.env.identities_level % 2) == 0 &&
(input = $("[name='_email']", form)) && input.length && !rcube_check_email(input.val()) (input = $("[name='_email']", form)) && input.length && !rcube_check_email(input.val())
) { ) {
this.show_alert(this.get_label('noemailwarning'), function() { this.alert_dialog(this.get_label('noemailwarning'), function() {
input.focus(); input.focus();
return true; return true;
}); });
@ -1207,7 +1207,7 @@ function rcube_webmail()
if (!(flag = this.upload_file(props || this.gui_objects.uploadform, 'upload'))) { if (!(flag = this.upload_file(props || this.gui_objects.uploadform, 'upload'))) {
if (flag !== false) if (flag !== false)
this.show_alert(this.get_label('selectimportfile')); this.alert_dialog(this.get_label('selectimportfile'));
aborted = true; aborted = true;
} }
break; break;
@ -1359,7 +1359,7 @@ function rcube_webmail()
if (!(flag = this.upload_file(form, 'import', importlock))) { if (!(flag = this.upload_file(form, 'import', importlock))) {
this.set_busy(false, null, importlock); this.set_busy(false, null, importlock);
if (flag !== false) if (flag !== false)
this.show_alert(this.get_label('selectimportfile')); this.alert_dialog(this.get_label('selectimportfile'));
aborted = true; aborted = true;
} }
break; break;
@ -1374,7 +1374,7 @@ function rcube_webmail()
if (form) { if (form) {
var lock, file = win.$('#rcmimportfile')[0]; var lock, file = win.$('#rcmimportfile')[0];
if (file && !file.value) { if (file && !file.value) {
win.rcmail.show_alert(win.rcmail.get_label('selectimportfile')); win.rcmail.alert_dialog(win.rcmail.get_label('selectimportfile'));
return; return;
} }
@ -3163,7 +3163,7 @@ 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)) {
this.show_confirm(this.get_label('deletemessagesconfirm'), 'delete', function() { this.confirm_dialog(this.get_label('deletemessagesconfirm'), 'delete', function() {
ref.permanently_remove_messages(); ref.permanently_remove_messages();
return true; return true;
}); });
@ -3714,7 +3714,7 @@ function rcube_webmail()
// notify user about loosing attachments // notify user about loosing attachments
if (ref.env.attachments && !$.isEmptyObject(ref.env.attachments)) { if (ref.env.attachments && !$.isEmptyObject(ref.env.attachments)) {
ref.show_alert(ref.get_label('encryptnoattachments')); ref.alert_dialog(ref.get_label('encryptnoattachments'));
$.each(ref.env.attachments, function(name, attach) { $.each(ref.env.attachments, function(name, attach) {
ref.remove_from_attachment_list(name); ref.remove_from_attachment_list(name);
@ -3771,7 +3771,7 @@ function rcube_webmail()
if (!isvalid) { if (!isvalid) {
if (!recipients.length) { if (!recipients.length) {
ref.show_alert(ref.get_label('norecipientwarning'), function() { ref.alert_dialog(ref.get_label('norecipientwarning'), function() {
$("[name='_to']").focus(); $("[name='_to']").focus();
return true; return true;
}); });
@ -4008,7 +4008,7 @@ function rcube_webmail()
// import to keyring // import to keyring
ref.mailvelope_keyring.importPublicKey(armored).then(function(status) { ref.mailvelope_keyring.importPublicKey(armored).then(function(status) {
if (status === 'REJECTED') { if (status === 'REJECTED') {
// ref.show_alert(ref.get_label('Key import was rejected')); // ref.alert_dialog(ref.get_label('Key import was rejected'));
} }
else { else {
var $key = keyid.substr(-8).toUpperCase(); var $key = keyid.substr(-8).toUpperCase();
@ -4048,7 +4048,7 @@ function rcube_webmail()
{ {
var lock, post_data = {_mbox: mbox}; var lock, post_data = {_mbox: mbox};
this.show_confirm(this.get_label('purgefolderconfirm'), 'delete', function() { this.confirm_dialog(this.get_label('purgefolderconfirm'), 'delete', function() {
// lock interface if it's the active mailbox // lock interface if it's the active mailbox
if (mbox == ref.env.mailbox) { if (mbox == ref.env.mailbox) {
lock = ref.set_busy(true, 'loading'); lock = ref.set_busy(true, 'loading');
@ -4529,7 +4529,7 @@ function rcube_webmail()
// check if all files has been uploaded // check if all files has been uploaded
for (key in this.env.attachments) { for (key in this.env.attachments) {
if (typeof this.env.attachments[key] === 'object' && !this.env.attachments[key].complete) { if (typeof this.env.attachments[key] === 'object' && !this.env.attachments[key].complete) {
this.show_alert(this.get_label('notuploadedwarning')); this.alert_dialog(this.get_label('notuploadedwarning'));
return false; return false;
} }
} }
@ -4611,7 +4611,7 @@ function rcube_webmail()
// check sender (if have no identities) // check sender (if have no identities)
if (input_from.prop('type') == 'text' && !rcube_check_email(input_from.val(), true)) { if (input_from.prop('type') == 'text' && !rcube_check_email(input_from.val(), true)) {
this.show_alert(this.get_label('nosenderwarning'), function() { this.alert_dialog(this.get_label('nosenderwarning'), function() {
input_from.focus(); input_from.focus();
return true; return true;
}); });
@ -4620,7 +4620,7 @@ function rcube_webmail()
// check for empty recipient // check for empty recipient
if (!rcube_check_email(get_recipients([input_to, input_cc, input_bcc]), true)) { if (!rcube_check_email(get_recipients([input_to, input_cc, input_bcc]), true)) {
this.show_alert(this.get_label('norecipientwarning'), function() { this.alert_dialog(this.get_label('norecipientwarning'), function() {
input_to.focus(); input_to.focus();
return true; return true;
}); });
@ -4781,7 +4781,7 @@ function rcube_webmail()
// submit delete request // submit delete request
if (key) { if (key) {
this.show_confirm(this.get_label('deleteresponseconfirm'), 'delete', function() { this.confirm_dialog(this.get_label('deleteresponseconfirm'), 'delete', function() {
ref.http_post('settings/delete-response', { _key: key }, false); ref.http_post('settings/delete-response', { _key: key }, false);
return true; return true;
}); });
@ -6226,7 +6226,7 @@ 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) { if (!undelete) {
this.show_confirm(this.get_label('deletecontactconfirm'), 'delete', function() { this.confirm_dialog(this.get_label('deletecontactconfirm'), 'delete', function() {
ref._with_selected_contacts('delete'); ref._with_selected_contacts('delete');
return true; return true;
}); });
@ -6413,7 +6413,7 @@ function rcube_webmail()
this.group_delete = function() this.group_delete = function()
{ {
if (this.env.group) { if (this.env.group) {
this.show_confirm(this.get_label('deletegroupconfirm'), 'delete', function() { this.confirm_dialog(this.get_label('deletegroupconfirm'), 'delete', function() {
var lock = ref.set_busy(true, 'groupdeleting'); var lock = ref.set_busy(true, 'groupdeleting');
ref.http_post('group-delete', {_source: ref.env.source, _gid: ref.env.group}, lock); ref.http_post('group-delete', {_source: ref.env.source, _gid: ref.env.group}, lock);
return true; return true;
@ -6951,7 +6951,7 @@ function rcube_webmail()
// submit request with appended token // submit request with appended token
if (id) { if (id) {
this.show_confirm(this.get_label('deleteidentityconfirm'), 'delete', function() { this.confirm_dialog(this.get_label('deleteidentityconfirm'), 'delete', function() {
ref.http_post('settings/delete-identity', { _iid: id }, true); ref.http_post('settings/delete-identity', { _iid: id }, true);
return true; return true;
}); });
@ -7119,7 +7119,7 @@ function rcube_webmail()
name = this.env.mailbox; name = this.env.mailbox;
if (name) { if (name) {
this.show_confirm(this.get_label('deletefolderconfirm'), 'delete', function() { this.confirm_dialog(this.get_label('deletefolderconfirm'), 'delete', function() {
ref.http_post('delete-folder', {_mbox: name}, ref.set_busy(true, 'folderdeleting')); ref.http_post('delete-folder', {_mbox: name}, ref.set_busy(true, 'folderdeleting'));
return true; return true;
}); });
@ -7918,7 +7918,7 @@ function rcube_webmail()
}; };
// show_popup_dialog() wrapper for alert() type dialogs // show_popup_dialog() wrapper for alert() type dialogs
this.show_alert = function(content, action_func) this.alert_dialog = function(content, action_func)
{ {
var close_func = function(e, ui, dialog) { (ref.is_framed() ? parent.$ : $)(dialog || this).dialog('close'); }, var close_func = function(e, ui, dialog) { (ref.is_framed() ? parent.$ : $)(dialog || this).dialog('close'); },
buttons = [{ buttons = [{
@ -7932,7 +7932,7 @@ function rcube_webmail()
}; };
// simple_dialog() wrapper for confirm() type dialogs // simple_dialog() wrapper for confirm() type dialogs
this.show_confirm = function(content, button_label, action_func) this.confirm_dialog = function(content, button_label, action_func)
{ {
var options = { button: button_label || 'continue' }; var options = { button: button_label || 'continue' };
return this.simple_dialog(content, this.get_label('confirmationtitle'), action_func, options); return this.simple_dialog(content, this.get_label('confirmationtitle'), action_func, options);

@ -140,7 +140,7 @@ this.decorateTextarea = function(id)
this.checkSpellingState(); this.checkSpellingState();
} }
else if (this.report_ta_not_found) { else if (this.report_ta_not_found) {
rcmail.show_alert('Text area not found'); rcmail.alert_dialog('Text area not found');
} }
}; };
@ -257,7 +257,7 @@ this.spellCheck = function(ignore)
ref.custom_ajax_error(ref); ref.custom_ajax_error(ref);
} }
else { else {
rcmail.show_alert('An error was encountered on the server. Please try again later.'); rcmail.alert_dialog('An error was encountered on the server. Please try again later.');
} }
if (ref.main_controller) { if (ref.main_controller) {
$(ref.spell_span).remove(); $(ref.spell_span).remove();
@ -291,7 +291,7 @@ this.learnWord = function(word, id)
ref.custom_ajax_error(ref); ref.custom_ajax_error(ref);
} }
else { else {
rcmail.show_alert('An error was encountered on the server. Please try again later.'); rcmail.alert_dialog('An error was encountered on the server. Please try again later.');
} }
}, },
success: function(data) { success: function(data) {

Loading…
Cancel
Save