From 6c5c22b877f6a91b4046433e13588cd3c679dc3f Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sat, 26 Jul 2014 03:54:11 -0400
Subject: [PATCH] Create/rename groups in UI dialogs (#1489951)

---
 program/steps/addressbook/func.inc |   51 ++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 34 insertions(+), 17 deletions(-)

diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index e68a694..f56e071 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -112,7 +112,7 @@
 // register UI objects
 $OUTPUT->add_handlers(array(
     'directorylist'       => 'rcmail_directory_list',
-//  'groupslist'          => 'rcmail_contact_groups',
+    'savedsearchlist'     => 'rcmail_savedsearch_list',
     'addresslist'         => 'rcmail_contacts_list',
     'addresslisttitle'    => 'rcmail_contacts_list_title',
     'addressframe'        => 'rcmail_contact_frame',
@@ -251,6 +251,28 @@
         $out .= '</li>';
     }
 
+    $OUTPUT->set_env('contactgroups', $jsdata);
+    $OUTPUT->set_env('collapsed_abooks', (string)$RCMAIL->config->get('collapsed_abooks',''));
+    $OUTPUT->add_gui_object('folderlist', $attrib['id']);
+    $OUTPUT->include_script('treelist.js');
+
+    // add some labels to client
+    $OUTPUT->add_label('deletegroupconfirm', 'groupdeleting', 'addingmember', 'removingmember',
+        'newgroup', 'grouprename', 'searchsave', 'namex'
+    );
+
+    return html::tag('ul', $attrib, $out, html::$common_attrib);
+}
+
+
+function rcmail_savedsearch_list($attrib)
+{
+    global $RCMAIL, $OUTPUT;
+
+    if (!$attrib['id'])
+        $attrib['id'] = 'rcmsavedsearchlist';
+
+    $out = '';
     $line_templ = html::tag('li', array(
         'id' => 'rcmli%s', 'class' => '%s'),
         html::a(array('href' => '#', 'rel' => 'S%s',
@@ -263,26 +285,19 @@
         $js_id = rcube::JQ($id);
 
         // set class name(s)
-        $class_name = 'contactsearch';
-        if ($current === $id)
-            $class_name .= ' selected';
-        if ($source['class_name'])
-            $class_name .= ' ' . $source['class_name'];
+        $classes = array('contactsearch');
+        if (!empty($source['class_name']))
+            $classes[] = $source['class_name'];
 
         $out .= sprintf($line_templ,
             rcube_utils::html_identifier('S'.$id, true),
-            $class_name,
+            join(' ', $classes),
             $id,
-            $js_id, (!empty($source['name']) ? rcube::Q($source['name']) : rcube::Q($id)));
+            $js_id, (!empty($source['name']) ? rcube::Q($source['name']) : rcube::Q($id))
+        );
     }
 
-    $OUTPUT->set_env('contactgroups', $jsdata);
-    $OUTPUT->set_env('collapsed_abooks', (string)$RCMAIL->config->get('collapsed_abooks',''));
-    $OUTPUT->add_gui_object('folderlist', $attrib['id']);
-    $OUTPUT->include_script('treelist.js');
-
-    // add some labels to client
-    $OUTPUT->add_label('deletegroupconfirm', 'groupdeleting', 'addingmember', 'removingmember');
+    $OUTPUT->add_gui_object('savedsearchlist', $attrib['id']);
 
     return html::tag('ul', $attrib, $out, html::$common_attrib);
 }
@@ -649,6 +664,8 @@
                     if ($subtypes[$i])
                         $subtype = $subtypes[$i];
 
+                    $colprop['id'] = 'ff_' . $col . intval($coltypes[$field]['count']);
+
                     // render composite field
                     if ($colprop['type'] == 'composite') {
                         $composite = array(); $j = 0;
@@ -714,7 +731,7 @@
                     // display row with label
                     if ($label) {
                         $rows .= html::div('row',
-                            html::div('contactfieldlabel label', $select_subtype ? $select_subtype->show($subtype) : rcube::Q($label)) .
+                            html::div('contactfieldlabel label', $select_subtype ? $select_subtype->show($subtype) : html::label($colprop['id'], rcube::Q($label))) .
                             html::div('contactfieldcontent '.$colprop['type'], $val));
                     }
                     else   // row without label
@@ -803,7 +820,7 @@
     else
         $ff_value = '-del-'; // will disable delete-photo action
 
-    $img = html::img(array('src' => $photo_img, 'border' => 1, 'alt' => ''));
+    $img = html::img(array('src' => $photo_img, 'border' => 1, 'alt' => $RCMAIL->gettext('contactphoto')));
     $content = html::div($attrib, $img);
 
     if ($CONTACT_COLTYPES['photo'] && ($RCMAIL->action == 'edit' || $RCMAIL->action == 'add')) {

--
Gitblit v1.9.1