summaryrefslogtreecommitdiff
path: root/roundcubemail/program/steps/addressbook/groups.inc
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-03-26 16:38:20 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-03-26 16:38:20 +0000
commitbd5d5af44f31861c40b2a0cde573e974a9d5b6bf (patch)
tree49528eae7022cf601115aee0e169d527a5f23ef0 /roundcubemail/program/steps/addressbook/groups.inc
parent7ae2aa58bc71e0689dea7cb8cd704242f5b9a80b (diff)
Added basic contact groups feature
git-svn-id: https://svn.roundcube.net/trunk@3425 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/steps/addressbook/groups.inc')
-rw-r--r--roundcubemail/program/steps/addressbook/groups.inc61
1 files changed, 61 insertions, 0 deletions
diff --git a/roundcubemail/program/steps/addressbook/groups.inc b/roundcubemail/program/steps/addressbook/groups.inc
new file mode 100644
index 000000000..8c7aef64b
--- /dev/null
+++ b/roundcubemail/program/steps/addressbook/groups.inc
@@ -0,0 +1,61 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | program/steps/addressbook/groups.inc |
+ | |
+ | This file is part of the RoundCube Webmail client |
+ | Copyright (C) 2010, RoundCube Dev. - Switzerland |
+ | Licensed under the GNU GPL |
+ | |
+ | PURPOSE: |
+ | Create/delete/rename contact groups and assign/remove contacts |
+ | |
+ +-----------------------------------------------------------------------+
+ | Author: Thomas Bruederli <roundcube@gmail.com> |
+ +-----------------------------------------------------------------------+
+
+ $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