From: Michael M Slusarz Date: Fri, 20 Feb 2009 07:51:37 +0000 (-0700) Subject: Fix clickHandler functions X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=04e6552e9b1845053fc4b90eeda7ebe581e9312e;p=horde.git Fix clickHandler functions --- diff --git a/imp/js/src/acl.js b/imp/js/src/acl.js index 62bcfd16e..1a7a65550 100644 --- a/imp/js/src/acl.js +++ b/imp/js/src/acl.js @@ -32,11 +32,21 @@ var ImpAcl = { clickHandler: function(e) { - switch (e.element().readAttribute('id')) { - case 'changefolder': - case 'resetbut': - this.folderChange(e, true); - break; + if (e.isRightClick()) { + return; + } + + var elt = e.element(); + + while (Object.isElement(elt)) { + switch (elt.readAttribute('id')) { + case 'changefolder': + case 'resetbut': + this.folderChange(e, true); + break; + } + + elt = elt.up(); } } diff --git a/imp/js/src/compose.js b/imp/js/src/compose.js index 38267c90b..419545033 100644 --- a/imp/js/src/compose.js +++ b/imp/js/src/compose.js @@ -274,22 +274,30 @@ var ImpCompose = { clickHandler: function(e) { + if (e.isRightClick()) { + return; + } + var elt = e.element(), name; - if (elt.hasClassName('button')) { - name = elt.readAttribute('name'); - switch (name) { - case 'btn_add_attachment': - case 'btn_redirect': - case 'btn_save_draft': - case 'btn_send_message': - this.uniqSubmit(name.substring(4), e); - break; - - case 'btn_cancel_compose': - this.confirmCancel(e); - break; + while (Object.isElement(elt)) { + if (elt.hasClassName('button')) { + name = elt.readAttribute('name'); + switch (name) { + case 'btn_add_attachment': + case 'btn_redirect': + case 'btn_save_draft': + case 'btn_send_message': + this.uniqSubmit(name.substring(4), e); + break; + + case 'btn_cancel_compose': + this.confirmCancel(e); + break; + } } + + elt = elt.up(); } }, diff --git a/imp/js/src/contacts.js b/imp/js/src/contacts.js index f8d207ceb..6170dfb25 100644 --- a/imp/js/src/contacts.js +++ b/imp/js/src/contacts.js @@ -141,26 +141,36 @@ var ImpContacts = { _clickHandler: function(e) { - var id = e.element().readAttribute('id'); + if (e.isRightClick()) { + return; + } - switch (id) { - case 'btn_add_to': - case 'btn_add_cc': - case 'btn_add_bcc': - this.addAddress(id.substring(8)); - break; + var elt = e.element(), id; - case 'btn_update': - this.updateMessage(); - break; + while (Object.isElement(elt)) { + id = elt.readAttribute('id'); - case 'btn_delete': - this.removeAddress(); - break; + switch (id) { + case 'btn_add_to': + case 'btn_add_cc': + case 'btn_add_bcc': + this.addAddress(id.substring(8)); + break; - case 'btn_cancel': - window.close(); - break; + case 'btn_update': + this.updateMessage(); + break; + + case 'btn_delete': + this.removeAddress(); + break; + + case 'btn_cancel': + window.close(); + break; + } + + elt = elt.up(); } }, diff --git a/imp/js/src/fetchmailprefs.js b/imp/js/src/fetchmailprefs.js index 7bb661525..9fe20e38f 100644 --- a/imp/js/src/fetchmailprefs.js +++ b/imp/js/src/fetchmailprefs.js @@ -49,27 +49,37 @@ var ImpFetchmailprefs = { _clickHandler: function(e) { - switch (e.element().readAttribute('id')) { - case 'btn_delete': - $('actionID').setValue('fetchmail_prefs_delete'); - break; + if (e.isRightClick()) { + return; + } - case 'btn_create': - $('actionID').setValue('fetchmail_create'); - this._accountSubmit(true); - break; + var elt = e.element(); - case 'btn_return': - document.location.href = this.prefsurl; - break; + while (Object.isElement(elt)) { + switch (elt.readAttribute('id')) { + case 'btn_delete': + $('actionID').setValue('fetchmail_prefs_delete'); + break; - case 'btn_save': - $('actionID').setValue('fetchmail_prefs_save'); - break; + case 'btn_create': + $('actionID').setValue('fetchmail_create'); + this._accountSubmit(true); + break; - case 'btn_select': - document.location.href = this.fetchurl; - break; + case 'btn_return': + document.location.href = this.prefsurl; + break; + + case 'btn_save': + $('actionID').setValue('fetchmail_prefs_save'); + break; + + case 'btn_select': + document.location.href = this.fetchurl; + break; + } + + elt = elt.up(); } } diff --git a/imp/js/src/folders.js b/imp/js/src/folders.js index 9dab02ef9..fd9332008 100644 --- a/imp/js/src/folders.js +++ b/imp/js/src/folders.js @@ -174,19 +174,29 @@ var ImpFolders = { clickHandler: function(e) { - switch (e.element().readAttribute('id')) { - case 'btn_import': - this.submitAction('import_mbox'); - break; + if (e.isRightClick()) { + return; + } - case 'btn_return': - document.location.href = this.folders_url; - break; + var elt = e.element(); - case 'checkAll0': - case 'checkAll1': - this.toggleSelection(); - break; + while (Object.isElement(elt)) { + switch (elt.readAttribute('id')) { + case 'btn_import': + this.submitAction('import_mbox'); + break; + + case 'btn_return': + document.location.href = this.folders_url; + break; + + case 'checkAll0': + case 'checkAll1': + this.toggleSelection(); + break; + } + + elt = elt.up(); } } diff --git a/imp/js/src/login.js b/imp/js/src/login.js index 4932cbb62..84e29128c 100644 --- a/imp/js/src/login.js +++ b/imp/js/src/login.js @@ -102,14 +102,24 @@ var ImpLogin = { _clickHandler: function(e) { - switch (e.element().readAttribute('id')) { - case 'btn_login': - this._reload(); - break; + if (e.isRightClick()) { + return; + } - case 'loginButton': - this.submit(); - break; + var elt = e.element(); + + while (Object.isElement(elt)) { + switch (elt.readAttribute('id')) { + case 'btn_login': + this._reload(); + break; + + case 'loginButton': + this.submit(); + break; + } + + elt = elt.up(); } } diff --git a/imp/js/src/mailbox.js b/imp/js/src/mailbox.js index 84eeebd37..1db727bb2 100644 --- a/imp/js/src/mailbox.js +++ b/imp/js/src/mailbox.js @@ -260,62 +260,71 @@ var ImpMessage = { clickHandler: function(e) { - var elt = e.element(), + if (e.isRightClick()) { + return; + } + + var elt = e.element(), id; + + while (Object.isElement(elt)) { id = elt.readAttribute('id'); - if (elt.match('.msgactions A.widget')) { - if (elt.hasClassName('moveAction')) { - this._transfer('move_messages'); - } else if (elt.hasClassName('copyAction')) { - this._transfer('copy_messages'); - } else if (elt.hasClassName('permdeleteAction')) { - if (confirm(IMP.text.mailbox_delete)) { + if (elt.match('.msgactions A.widget')) { + if (elt.hasClassName('moveAction')) { + this._transfer('move_messages'); + } else if (elt.hasClassName('copyAction')) { + this._transfer('copy_messages'); + } else if (elt.hasClassName('permdeleteAction')) { + if (confirm(IMP.text.mailbox_delete)) { + this.submit('delete_messages'); + } + } else if (elt.hasClassName('deleteAction')) { this.submit('delete_messages'); + } else if (elt.hasClassName('undeleteAction')) { + this.submit('undelete_messages'); + } else if (elt.hasClassName('blacklistAction')) { + this.submit('blacklist'); + } else if (elt.hasClassName('whitelistAction')) { + this.submit('whitelist'); + } else if (elt.hasClassName('forwardAction')) { + this.submit('fwd_digest'); + } else if (elt.hasClassName('spamAction')) { + this.submit('spam_report'); + } else if (elt.hasClassName('notspamAction')) { + this.submit('notspam_report'); + } else if (elt.hasClassName('viewAction')) { + this.submit('view_messages'); + } else if (elt.hasClassName('hideAction') || elt.hasClassName('purgeAction')) { + return; } - } else if (elt.hasClassName('deleteAction')) { - this.submit('delete_messages'); - } else if (elt.hasClassName('undeleteAction')) { - this.submit('undelete_messages'); - } else if (elt.hasClassName('blacklistAction')) { - this.submit('blacklist'); - } else if (elt.hasClassName('whitelistAction')) { - this.submit('whitelist'); - } else if (elt.hasClassName('forwardAction')) { - this.submit('fwd_digest'); - } else if (elt.hasClassName('spamAction')) { - this.submit('spam_report'); - } else if (elt.hasClassName('notspamAction')) { - this.submit('notspam_report'); - } else if (elt.hasClassName('viewAction')) { - this.submit('view_messages'); - } else if (elt.hasClassName('hideAction') || elt.hasClassName('purgeAction')) { - return; + + e.stop(); + return; } - e.stop(); - return; - } + if (!id) { + return; + } - if (!id) { - return; - } + switch (id) { + case 'checkheader': + case 'checkAll': + if (id == 'checkheader') { + $('checkAll').checked = !$('checkAll').checked; + } + this.makeSelection(-1); + return; + } - switch (id) { - case 'checkheader': - case 'checkAll': - if (id == 'checkheader') { - $('checkAll').checked = !$('checkAll').checked; + if (id.startsWith('check') && elt.hasClassName('checkbox')) { + this.selectRange(e); + } else if (!this.sortlimit && + elt.match('TH') && + elt.up('TABLE.messageList')) { + document.location.href = elt.down('A').href; } - this.makeSelection(-1); - return; - } - if (id.startsWith('check') && elt.hasClassName('checkbox')) { - this.selectRange(e); - } else if (!this.sortlimit && - elt.match('TH') && - elt.up('TABLE.messageList')) { - document.location.href = elt.down('A').href; + elt = elt.up(); } }, diff --git a/imp/js/src/search.js b/imp/js/src/search.js index bcbe57ea8..0ec910397 100644 --- a/imp/js/src/search.js +++ b/imp/js/src/search.js @@ -94,35 +94,43 @@ var ImpSearch = { clickHandler: function(e) { + if (e.isRightClick()) { + return; + } + var elt = e.element(); - if (elt.hasClassName('searchSubmit')) { - this._formCheck(); - } else if (elt.hasClassName('searchReset')) { - this._reset(); - } else if (elt.hasClassName('searchDelete')) { - this._deleteField(elt.readAttribute('fid')); - } else { - switch (elt.readAttribute('id')) { - case 'link_sel_all': - this._toggleAll(true); - break; - - case 'link_sel_none': - this._toggleAll(false); - break; - - case 'link_sub': - this._showSubscribed(this.inverse_sub); - break; - - case 'search_match_and': - case 'search_match_or': - if ($('field_1')) { - $('search').submit(); + while (Object.isElement(elt)) { + if (elt.hasClassName('searchSubmit')) { + this._formCheck(); + } else if (elt.hasClassName('searchReset')) { + this._reset(); + } else if (elt.hasClassName('searchDelete')) { + this._deleteField(elt.readAttribute('fid')); + } else { + switch (elt.readAttribute('id')) { + case 'link_sel_all': + this._toggleAll(true); + break; + + case 'link_sel_none': + this._toggleAll(false); + break; + + case 'link_sub': + this._showSubscribed(this.inverse_sub); + break; + + case 'search_match_and': + case 'search_match_or': + if ($('field_1')) { + $('search').submit(); + } + break; } - break; } + + elt = elt.up(); } }