From 65c8764b19d16ebdcd270f5c9bf0162e686c56bd Mon Sep 17 00:00:00 2001 From: thomascube <thomas@roundcube.net> Date: Thu, 01 Apr 2010 02:52:48 -0400 Subject: [PATCH] Add client-side events when adding/removing groups --- program/steps/addressbook/groups.inc | 3 +-- program/js/app.js | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/program/js/app.js b/program/js/app.js index ae55cc4..2bc8808 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3659,10 +3659,14 @@ { var li, key = 'G'+id; if ((li = this.get_folder_li(key))) { + this.triggerEvent('removegroup', { id:id, li:li }); + li.parentNode.removeChild(li); delete this.env.contactfolders[key]; delete this.env.contactgroups[key]; } + + this.list_contacts(null, 0); }; // handler for keyboard events on the input field @@ -3716,6 +3720,8 @@ var link = $('<a>').attr('href', '#').attr('onclick', "return rcmail.command('listgroup','"+prop.id+"',this)").html(prop.name); var li = $('<li>').attr('id', 'rcmli'+key).addClass('contactgroup').append(link); $(this.gui_objects.folderlist).append(li); + + this.triggerEvent('insertgroup', { id:prop.id, name:prop.name, li:li[0] }); }; // callback for renaming a contact group diff --git a/program/steps/addressbook/groups.inc b/program/steps/addressbook/groups.inc index c853ced..df44703 100644 --- a/program/steps/addressbook/groups.inc +++ b/program/steps/addressbook/groups.inc @@ -41,9 +41,8 @@ else if ($RCMAIL->action == 'group-delmembers') { if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = get_input_value('_cid', RCUBE_INPUT_POST))) { $plugin = $RCMAIL->plugins->exec_hook('group_delmembers', array('group_id' => $gid, 'ids' => $ids, 'source' => $source)); - $ids = $plugin['ids']; - if (!$plugin['abort'] && $CONTACTS->remove_from_group($gid, $ids)) + if (!$plugin['abort'] && $CONTACTS->remove_from_group($gid, $plugin['ids'])) $OUTPUT->show_message('contactremovedfromgroup'); else if ($plugin['message']) $OUTPUT->show_message($plugin['message'], 'warning'); -- Gitblit v1.9.1