summaryrefslogtreecommitdiff
path: root/roundcubemail/program/steps
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-10-22 15:24:39 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-10-22 15:24:39 +0000
commita5d1e6f6ff83ac74fdebe355ff223dccd367a738 (patch)
treeaf6cb04940000e60d3aad889c5354b7e6a18d807 /roundcubemail/program/steps
parenta3a8725e7dd22c3dec00138ea22e54e4e4804ed4 (diff)
List groups in address detail view and allow to subscribe/unsubscribe from there (#1486753)
git-svn-id: https://svn.roundcube.net/trunk@4121 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/steps')
-rw-r--r--roundcubemail/program/steps/addressbook/show.inc35
1 files changed, 35 insertions, 0 deletions
diff --git a/roundcubemail/program/steps/addressbook/show.inc b/roundcubemail/program/steps/addressbook/show.inc
index c714ce139..c5784d61d 100644
--- a/roundcubemail/program/steps/addressbook/show.inc
+++ b/roundcubemail/program/steps/addressbook/show.inc
@@ -25,6 +25,10 @@ if (($cid = get_input_value('_cid', RCUBE_INPUT_GPC)) && ($record = $CONTACTS->g
$OUTPUT->set_env('cid', $record['ID']);
}
+$GROUPS = $CONTACTS->list_groups();
+$OUTPUT->set_env('groups', !empty($GROUPS));
+
+
function rcmail_contact_details($attrib)
{
global $CONTACTS, $OUTPUT;
@@ -69,6 +73,37 @@ function rcmail_contact_details($attrib)
}
+function rcmail_contact_record_groups($attrib)
+{
+ global $RCMAIL, $CONTACTS, $GROUPS;
+
+ // check if we have a valid result
+ if (!(($result = $CONTACTS->get_result()) && ($record = $result->first())))
+ return false;
+
+ $table = new html_table(array('cols' => 2, 'cellspacing' => 0, 'border' => 0));
+
+ $members = $CONTACTS->get_record_groups($record['ID']);
+ $checkbox = new html_checkbox(array('name' => '_gid[]', 'class' => 'groupmember', 'disabled' => $CONTACTS->readonly));
+ foreach ($GROUPS as $group) {
+ $gid = $group['ID'];
+ $table->add(null, $checkbox->show($members[$gid] ? $gid : null, array('value' => $gid, 'id' => 'ff_gid' . $gid)));
+ $table->add(null, html::label('ff_gid' . $gid, Q($group['name'])));
+ }
+
+ $hiddenfields = new html_hiddenfield(array('name' => '_source', 'value' => get_input_value('_source', RCUBE_INPUT_GPC)));
+ $hiddenfields->add(array('name' => '_cid', 'value' => $record['ID']));
+
+ $form_start = $RCMAIL->output->request_form(array('name' => "form", 'method' => "post", 'task' => $RCMAIL->task, 'action' => 'save', 'request' => 'save.'.intval($record['ID']), 'noclose' => true) + $attrib, $hiddenfields->show());
+ $form_end = !strlen($attrib['form']) ? '</form>' : '';
+
+ $RCMAIL->output->add_gui_object('editform', !empty($attrib['form']) ? $attrib['form'] : 'form');
+
+ return $form_start . $table->show($attrib) . $form_end;
+}
+
+
//$OUTPUT->framed = $_framed;
$OUTPUT->add_handler('contactdetails', 'rcmail_contact_details');
+$OUTPUT->add_handler('contactgroups', 'rcmail_contact_record_groups');
$OUTPUT->send('showcontact');