From 86552ffc8f0f76651747a1faaed9bbda6d015f98 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Thu, 07 Feb 2013 09:35:30 -0500
Subject: [PATCH] Finish hierarchical groups browsing in LDAP address books; add according UI elements and styles to the skins; adapt habavior of the compose address book widget

---
 program/steps/addressbook/func.inc |   32 ++++++++++++++++++++++++++------
 1 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index f921c8c..4d4bf22 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -343,6 +343,8 @@
 
     while ($row = $result->next()) {
         $row['CID'] = $row['ID'];
+        $row['email'] = reset(rcube_addressbook::get_col_values('email', $row, true));
+
         $source_id = $OUTPUT->get_env('source');
         $a_row_cols = array();
         $classes = array($row['_type'] ? $row['_type'] : 'person');
@@ -367,7 +369,7 @@
                             'href' => '#list',
                             'rel' => $row['ID'],
                             'title' => rcube_label('listgroup'),
-                            'onclick' => sprintf("return %s.command('pushgroup',{'source':'%s','id':'%s'},this)", JS_OBJECT_NAME, $source_id, $row['CID']),
+                            'onclick' => sprintf("return %s.command('pushgroup',{'source':'%s','id':'%s'},this,event)", JS_OBJECT_NAME, $source_id, $row['CID']),
                         ), '&raquo;');
                     }
                     break;
@@ -383,8 +385,22 @@
         if ($row['readonly'])
             $classes[] = 'readonly';
 
-        $OUTPUT->command($prefix.'add_contact_row', $row['ID'], $a_row_cols, join(' ', $classes), $row);
+        $OUTPUT->command($prefix.'add_contact_row', $row['ID'], $a_row_cols, join(' ', $classes), array_intersect_key($row, array('ID'=>1,'readonly'=>1,'_type'=>1,'email'=>1,'name'=>1)));
     }
+}
+
+
+function rcmail_contacts_list_title($attrib)
+{
+    global $OUTPUT;
+
+    $attrib += array('label' => 'contacts', 'id' => 'rcmabooklisttitle', 'tag' => 'span');
+    unset($attrib['name']);
+
+    $OUTPUT->add_gui_object('addresslist_title', $attrib['id']);
+    $OUTPUT->add_label('contacts');
+
+    return html::tag($attrib['tag'], $attrib, rcube_label($attrib['label']), html::$common_attrib);
 }
 
 
@@ -456,7 +472,7 @@
 
 function rcmail_contact_form($form, $record, $attrib = null)
 {
-    global $RCMAIL, $CONFIG;
+    global $RCMAIL;
 
     // Allow plugins to modify contact form content
     $plugin = $RCMAIL->plugins->exec_hook('contact_form', array(
@@ -465,7 +481,7 @@
     $form = $plugin['form'];
     $record = $plugin['record'];
     $edit_mode = $RCMAIL->action != 'show';
-    $del_button = $attrib['deleteicon'] ? html::img(array('src' => $CONFIG['skin_path'] . $attrib['deleteicon'], 'alt' => rcube_label('delete'))) : rcube_label('delete');
+    $del_button = $attrib['deleteicon'] ? html::img(array('src' => $RCMAIL->output->get_skin_file($attrib['deleteicon']), 'alt' => rcube_label('delete'))) : rcube_label('delete');
     unset($attrib['deleteicon']);
     $out = '';
 
@@ -731,12 +747,15 @@
 
 function rcmail_contact_photo($attrib)
 {
-    global $SOURCE_ID, $CONTACTS, $CONTACT_COLTYPES, $RCMAIL, $CONFIG;
+    global $SOURCE_ID, $CONTACTS, $CONTACT_COLTYPES, $RCMAIL;
 
     if ($result = $CONTACTS->get_result())
         $record = $result->first();
 
-    $photo_img = $attrib['placeholder'] ? $CONFIG['skin_path'] . $attrib['placeholder'] : 'program/resources/blank.gif';
+    $photo_img = $attrib['placeholder'] ? $RCMAIL->output->get_skin_file($attrib['placeholder']) : 'program/resources/blank.gif';
+    if ($record['_type'] == 'group' && $attrib['placeholdergroup'])
+        $photo_img = $RCMAIL->output->get_skin_file($attrib['placeholdergroup']);
+
     $RCMAIL->output->set_env('photo_placeholder', $photo_img);
     unset($attrib['placeholder']);
 
@@ -820,6 +839,7 @@
     'directorylist' => 'rcmail_directory_list',
 //  'groupslist' => 'rcmail_contact_groups',
     'addresslist' => 'rcmail_contacts_list',
+    'addresslisttitle' => 'rcmail_contacts_list_title',
     'addressframe' => 'rcmail_contact_frame',
     'recordscountdisplay' => 'rcmail_rowcount_display',
     'searchform' => array($OUTPUT, 'search_form')

--
Gitblit v1.9.1