diff options
Diffstat (limited to 'program/steps/addressbook')
-rw-r--r-- | program/steps/addressbook/groups.inc | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/program/steps/addressbook/groups.inc b/program/steps/addressbook/groups.inc index 8c7aef64b..014192676 100644 --- a/program/steps/addressbook/groups.inc +++ b/program/steps/addressbook/groups.inc @@ -25,7 +25,23 @@ if ($CONTACTS->readonly || !$CONTACTS->groups) { $OUTPUT->send(); } -if ($RCMAIL->action == 'create-group') { +if ($RCMAIL->action == 'group-addmember') { + if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = get_input_value('_cid', RCUBE_INPUT_POST))) + if ($CONTACTS->add_to_group($gid, $ids)) + $OUTPUT->show_message('contactaddedtogroup'); + //else + // $OUTPUT->show_message('erroraddingcontact', 'warning'); +} + +else if ($RCMAIL->action == 'group-delmember') { + if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = get_input_value('_cid', RCUBE_INPUT_POST))) + if ($CONTACTS->remove_from_group($gid, $ids)) + $OUTPUT->show_message('contactremovedfromgroup'); + //else + // $OUTPUT->show_message('erroraddingcontact', 'warning'); +} + +else if ($RCMAIL->action == 'group-create') { if (!empty($_POST['_name'])) { $name = trim(get_input_value('_name', RCUBE_INPUT_POST)); $created = $CONTACTS->create_group($name); @@ -39,20 +55,24 @@ if ($RCMAIL->action == 'create-group') { } } -else if ($RCMAIL->action == 'add2group') { - if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = get_input_value('_cid', RCUBE_INPUT_POST))) - if ($CONTACTS->add_to_group($gid, $ids)) - $OUTPUT->show_message('contactaddedtogroup'); - //else - // $OUTPUT->show_message('erroraddingcontact', 'warning'); +else if ($RCMAIL->action == 'group-rename') { + if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($name = trim(get_input_value('_name', RCUBE_INPUT_POST)))) + $newname = $CONTACTS->rename_group($gid, $name); + + if ($newname && $OUTPUT->ajax_call) + $OUTPUT->command('update_contact_group', $gid, $newname); + else if (!$newname) + $OUTPUT->show_message('errorsaving', 'error'); } -else if ($RCMAIL->action == 'removefromgroup') { - if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = get_input_value('_cid', RCUBE_INPUT_POST))) - if ($CONTACTS->remove_from_group($gid, $ids)) - $OUTPUT->show_message('contactremovedfromgroup'); - //else - // $OUTPUT->show_message('erroraddingcontact', 'warning'); +else if ($RCMAIL->action == 'group-delete') { + if ($gid = get_input_value('_gid', RCUBE_INPUT_POST)) + $deleted = $CONTACTS->delete_group($gid); + + if ($deleted) + $OUTPUT->command('remove_group_item', $gid); + else + $OUTPUT->show_message('errorsaving', 'error'); } // send response |