summaryrefslogtreecommitdiff
path: root/program/steps/addressbook
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2010-03-31 14:53:02 +0000
committerthomascube <thomas@roundcube.net>2010-03-31 14:53:02 +0000
commit3baa72a62fc69dda8306674da6d150efbf2cd55b (patch)
tree55b07dc6eebaf0510575f376f1e4664246f8ef69 /program/steps/addressbook
parent4cdc70941d5d25f47f920c6ba62035d2e6978454 (diff)
Implement group renaming/deleting + use more consistent names for commands and actions (#1486587)
Diffstat (limited to 'program/steps/addressbook')
-rw-r--r--program/steps/addressbook/groups.inc46
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