Branch 'dev/new-foldernav' - plugins/calendar plugins/libkolab

Thomas Brüderli bruederli at kolabsys.com
Thu May 15 17:21:11 CEST 2014


 plugins/calendar/drivers/database/database_driver.php  |    2 -
 plugins/calendar/drivers/kolab/kolab_driver.php        |    9 +++++---
 plugins/calendar/drivers/kolab/kolab_user_calendar.php |    3 +-
 plugins/calendar/lib/calendar_ui.php                   |   18 ++++++++---------
 plugins/calendar/localization/en_US.inc                |    3 +-
 plugins/calendar/skins/larry/calendar.css              |    2 -
 plugins/calendar/skins/larry/templates/calendar.html   |    2 -
 plugins/libkolab/js/folderlist.js                      |   10 +++++----
 8 files changed, 28 insertions(+), 21 deletions(-)

New commits:
commit b415c512f00e8b60ddc079cd65fd610f4b612f16
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Thu May 15 17:20:58 2014 +0200

    Use folder namespace for grouping in client-side treelist

diff --git a/plugins/calendar/drivers/database/database_driver.php b/plugins/calendar/drivers/database/database_driver.php
index d0e6b7b..3b833ab 100644
--- a/plugins/calendar/drivers/database/database_driver.php
+++ b/plugins/calendar/drivers/database/database_driver.php
@@ -138,7 +138,7 @@ class database_driver extends calendar_driver
           'color'      => $prefs['color'],
           'showalarms' => (bool)$this->rc->config->get('calendar_birthdays_alarm_type'),
           'active'     => !in_array($id, $hidden),
-          'class_name' => 'birthdays',
+          'group'      => 'birthdays',
           'readonly'   => true,
           'default'    => false,
           'children'   => false,
diff --git a/plugins/calendar/drivers/kolab/kolab_driver.php b/plugins/calendar/drivers/kolab/kolab_driver.php
index ff8372b..8126339 100644
--- a/plugins/calendar/drivers/kolab/kolab_driver.php
+++ b/plugins/calendar/drivers/kolab/kolab_driver.php
@@ -149,7 +149,8 @@ class kolab_driver extends calendar_driver
           'owner'    => $cal->get_owner(),
           'virtual'  => false,
           'readonly' => true,
-          'class_name' => 'user',
+          'group'    => 'other',
+          'class'    => 'user',
         );
       }
       else if ($cal->virtual) {
@@ -160,6 +161,8 @@ class kolab_driver extends calendar_driver
           'editname' => $cal->get_foldername(),
           'virtual' => true,
           'readonly' => true,
+          'group'    => $cal->get_namespace(),
+          'class'    => 'folder',
         );
       }
       else {
@@ -171,7 +174,7 @@ class kolab_driver extends calendar_driver
           'color'    => $cal->get_color(),
           'readonly' => $cal->readonly,
           'showalarms' => $cal->alarms,
-          'class_name' => $cal->get_namespace(),
+          'group'    => $cal->get_namespace(),
           'default'  => $cal->default,
           'active'   => $cal->is_active(),
           'owner'    => $cal->get_owner(),
@@ -198,7 +201,7 @@ class kolab_driver extends calendar_driver
           'color'      => $prefs[$id]['color'],
           'active'     => $prefs[$id]['active'],
           'showalarms' => (bool)$this->rc->config->get('calendar_birthdays_alarm_type'),
-          'class_name' => 'birthdays',
+          'group'      => 'birthdays',
           'readonly'   => true,
           'default'    => false,
           'children'   => false,
diff --git a/plugins/calendar/drivers/kolab/kolab_user_calendar.php b/plugins/calendar/drivers/kolab/kolab_user_calendar.php
index a41e065..4cf3dab 100644
--- a/plugins/calendar/drivers/kolab/kolab_user_calendar.php
+++ b/plugins/calendar/drivers/kolab/kolab_user_calendar.php
@@ -56,6 +56,7 @@ class kolab_user_calendar extends kolab_calendar
       $this->id = kolab_storage::folder_id($this->userdata['kolabtargetfolder'], true);
       $this->imap_folder = $this->userdata['kolabtargetfolder'];
       $this->name = $this->storage->get_name();
+      $this->parent = '';  // user calendars are top level
 
       // user-specific alarms settings win
       $prefs = $this->cal->rc->config->get('kolab_calendars', array());
@@ -94,7 +95,7 @@ class kolab_user_calendar extends kolab_calendar
    */
   public function get_namespace()
   {
-    return 'user';
+    return 'other user';
   }
 
 
diff --git a/plugins/calendar/lib/calendar_ui.php b/plugins/calendar/lib/calendar_ui.php
index 4d41194..74ea5d7 100644
--- a/plugins/calendar/lib/calendar_ui.php
+++ b/plugins/calendar/lib/calendar_ui.php
@@ -229,7 +229,7 @@ class calendar_ui
       if ($attrib['activeonly'] && !$prop['active'])
         continue;
 
-      $html .= html::tag('li', array('id' => 'rcmlical' . $id),
+      $html .= html::tag('li', array('id' => 'rcmlical' . $id, 'class' => $prop['group']),
         $content = $this->calendar_list_item($id, $prop, $jsenv)
       );
     }
@@ -260,7 +260,7 @@ class calendar_ui
       if (strlen($content)) {
         $out .= html::tag('li', array(
             'id' => 'rcmlical' . rcube_utils::html_identifier($id),
-            'class' => $prop['virtual'] ? 'virtual' : '',
+            'class' => $prop['group'] . ($prop['virtual'] ? ' virtual' : ''),
           ),
           $content);
       }
@@ -287,23 +287,23 @@ class calendar_ui
       $jsenv[$id] = $prop;
     }
 
-    $class = 'calendar cal-'  . asciiwords($id, true);
+    $classes = array('calendar', 'cal-'  . asciiwords($id, true));
     $title = $prop['name'] != $prop['listname'] || strlen($prop['name']) > 25 ?
       html_entity_decode($prop['name'], ENT_COMPAT, RCMAIL_CHARSET) : '';
     $is_collapsed = false; // TODO: determine this somehow?
 
     if ($prop['virtual'])
-      $class = 'folder virtual';
+      $classes[] = 'virtual';
     else if ($prop['readonly'])
-      $class .= ' readonly';
+      $classes[] = 'readonly';
     if ($prop['subscribed'])
-      $class .= ' subscribed';
-    if ($prop['class_name'])
-      $class .= ' '.$prop['class_name'];
+      $classes[] = ' subscribed';
+    if ($prop['class'])
+      $classes[] = $prop['class'];
 
     $content = '';
     if (!$attrib['activeonly'] || $prop['active']) {
-      $content = html::div($class,
+      $content = html::div(join(' ', $classes),
         html::span(array('class' => 'calname', 'title' => $title), $prop['editname'] ? Q($prop['editname']) : $prop['listname']) .
         ($prop['virtual'] ? '' :
           html::tag('input', array('type' => 'checkbox', 'name' => '_cal[]', 'value' => $id, 'checked' => $prop['active']), '') .
diff --git a/plugins/calendar/localization/en_US.inc b/plugins/calendar/localization/en_US.inc
index 67675bf..b92f377 100644
--- a/plugins/calendar/localization/en_US.inc
+++ b/plugins/calendar/localization/en_US.inc
@@ -86,8 +86,9 @@ $labels['nmonthsback'] = '$nr months back';
 $labels['showurl'] = 'Show calendar URL';
 $labels['showurldescription'] = 'Use the following address to access (read only) your calendar from other applications. You can copy and paste this into any calendar software that supports the iCal format.';
 $labels['caldavurldescription'] = 'Copy this address to a <a href="http://en.wikipedia.org/wiki/CalDAV" target="_blank">CalDAV</a> client application (e.g. Evolution or Mozilla Thunderbird) to fully synchronize this specific calendar with your computer or mobile device.';
+$labels['findcalendars'] = 'Find calendars...';
 $labels['calsearchresults'] = 'Available Calendars';
-$labels['calendarsubscribe'] = 'Listed permanently';
+$labels['calendarsubscribe'] = 'List permanently';
 
 // agenda view
 $labels['listrange'] = 'Range to display:';
diff --git a/plugins/calendar/skins/larry/calendar.css b/plugins/calendar/skins/larry/calendar.css
index cca70e6..5ef63f7 100644
--- a/plugins/calendar/skins/larry/calendar.css
+++ b/plugins/calendar/skins/larry/calendar.css
@@ -293,7 +293,7 @@ pre {
 	background-position: right -20px;
 }
 
-#calendars .treelist div.user span.calname {
+#calendars .treelist li.user > div > span.calname {
 	background-position: right -38px;
 }
 /*
diff --git a/plugins/calendar/skins/larry/templates/calendar.html b/plugins/calendar/skins/larry/templates/calendar.html
index 0842cf0..7f9f0af 100644
--- a/plugins/calendar/skins/larry/templates/calendar.html
+++ b/plugins/calendar/skins/larry/templates/calendar.html
@@ -25,7 +25,7 @@
 			<h2 class="boxtitle"><roundcube:label name="calendar.calendars" /></h2>
 			<div class="listsearchbox">
 				<div class="searchbox">
-					<input type="text" name="q" id="calendarlistsearch" />
+					<input type="text" name="q" id="calendarlistsearch" placeholder="<roundcube:label name='calendar.findcalendars' />" />
 					<a class="iconbutton searchicon"></a>
 					<roundcube:button command="reset-listsearch" id="calendarlistsearch-reset" class="iconbutton reset" title="resetsearch" content="x" />
 				</div>
diff --git a/plugins/libkolab/js/folderlist.js b/plugins/libkolab/js/folderlist.js
index 587fe56..274d57f 100644
--- a/plugins/libkolab/js/folderlist.js
+++ b/plugins/libkolab/js/folderlist.js
@@ -49,10 +49,12 @@ function kolab_folderlist(node, p)
                   .html(p.search_title ? '<h2 class="boxtitle">' + p.search_title + '</h2>' : '')
                   .insertAfter(me.container);
 
-              search_results_widget = new rcube_treelist_widget('<ul class="treelist listing"></ul>', {
+              search_results_widget = new rcube_treelist_widget('<ul>', {
                   id_prefix: p.id_prefix,
                   selectable: false
               });
+              // copy classes from main list
+              search_results_widget.container.addClass(me.container.attr('class'));
 
               // register click handler on search result's checkboxes to select the given item for listing
               search_results_widget.container
@@ -94,7 +96,7 @@ function kolab_folderlist(node, p)
               search_results[prop.id] = prop;
               search_results_widget.insert({
                   id: prop.id,
-                  classes: prop.class_name ? String(prop.class_name).split(' ') : [],
+                  classes: [ prop.group || '' ],
                   html: item,
                   collapsed: true
               }, prop.parent);
@@ -142,10 +144,10 @@ function kolab_folderlist(node, p)
             // move this result item to the main list widget
             me.insert({
                 id: id,
-                classes: [],
+                classes: [ prop.group || '' ],
                 virtual: prop.virtual,
                 html: dom_node,
-            }, parent_id, parent_id ? true : false);
+            }, parent_id, prop.group);
         }
 
         delete prop.html;




More information about the commits mailing list