From a61bbb24aafec5718ca9bc985e7c596c5821f018 Mon Sep 17 00:00:00 2001 From: thomascube Date: Fri, 26 Mar 2010 16:38:20 +0000 Subject: Added basic contact groups feature --- program/steps/addressbook/groups.inc | 61 ++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 program/steps/addressbook/groups.inc (limited to 'program/steps/addressbook/groups.inc') diff --git a/program/steps/addressbook/groups.inc b/program/steps/addressbook/groups.inc new file mode 100644 index 000000000..8c7aef64b --- /dev/null +++ b/program/steps/addressbook/groups.inc @@ -0,0 +1,61 @@ + | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + + +if ($CONTACTS->readonly || !$CONTACTS->groups) { + $OUTPUT->show_message('sourceisreadonly', 'warning'); + $OUTPUT->send(); +} + +if ($RCMAIL->action == 'create-group') { + if (!empty($_POST['_name'])) { + $name = trim(get_input_value('_name', RCUBE_INPUT_POST)); + $created = $CONTACTS->create_group($name); + } + + if ($created && $OUTPUT->ajax_call) { + $OUTPUT->command('insert_contact_group', $created); + } + else if (!$create) { + $OUTPUT->show_message('errorsaving', 'error'); + } +} + +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 == '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'); +} + +// send response +$OUTPUT->send(); + +?> \ No newline at end of file -- cgit v1.2.3