Branch 'dev/kolab3' - 4 commits - plugins/calendar plugins/kolab_addressbook plugins/libkolab

Thomas Brüderli bruederli at kolabsys.com
Thu May 10 21:26:05 CEST 2012


 plugins/calendar/drivers/kolab/kolab_calendar.php      |   12 +++
 plugins/calendar/drivers/kolab/kolab_driver.php        |    4 -
 plugins/kolab_addressbook/lib/kolab_addressbook_ui.php |    4 -
 plugins/libkolab/lib/kolab_format_event.php            |    4 -
 plugins/libkolab/lib/kolab_storage.php                 |   61 ++++++++++++++++-
 5 files changed, 75 insertions(+), 10 deletions(-)

New commits:
commit 7de0aa468c32e570087f6f02bf6ad41bf1b5928b
Author: Thomas Bruederli <thomas at roundcube.net>
Date:   Thu May 10 21:25:57 2012 +0200

    Increment sequence property when updating an event

diff --git a/plugins/libkolab/lib/kolab_format_event.php b/plugins/libkolab/lib/kolab_format_event.php
index 0552025..42c323c 100644
--- a/plugins/libkolab/lib/kolab_format_event.php
+++ b/plugins/libkolab/lib/kolab_format_event.php
@@ -144,8 +144,8 @@ class kolab_format_event extends kolab_format
         if (!empty($object['uid']))
             $this->obj->setUid($object['uid']);
 
-        // TODO: increase sequence
-        // $this->obj->setSequence($this->obj->sequence()+1);
+        // increment sequence
+        $this->obj->setSequence($this->obj->sequence()+1);
 
         // do the hard work of setting object values
         $this->obj->setStart(self::get_datetime($object['start'], null, $object['allday']));


commit 6973bbcaee2d9591aa3a7864aae61948ee8876f2
Author: Thomas Bruederli <thomas at roundcube.net>
Date:   Thu May 10 21:24:48 2012 +0200

    Implement undelete with new storage backend; remove cruft

diff --git a/plugins/calendar/drivers/kolab/kolab_calendar.php b/plugins/calendar/drivers/kolab/kolab_calendar.php
index 53a8d83..6104972 100644
--- a/plugins/calendar/drivers/kolab/kolab_calendar.php
+++ b/plugins/calendar/drivers/kolab/kolab_calendar.php
@@ -352,7 +352,17 @@ class kolab_calendar
    */
   public function restore_event($event)
   {
-    // TODO: re-implement this with new kolab_storege backend
+    if ($this->storage->undelete($event['id'])) {
+        return true;
+    }
+    else {
+        raise_error(array(
+          'code' => 600, 'type' => 'php',
+          'file' => __FILE__, 'line' => __LINE__,
+          'message' => "Error undeleting a contact object $uid from the Kolab server"),
+        true, false);
+    }
+
     return false;
   }
 
diff --git a/plugins/calendar/drivers/kolab/kolab_driver.php b/plugins/calendar/drivers/kolab/kolab_driver.php
index aea6783..6ce7a84 100644
--- a/plugins/calendar/drivers/kolab/kolab_driver.php
+++ b/plugins/calendar/drivers/kolab/kolab_driver.php
@@ -401,7 +401,6 @@ class kolab_driver extends calendar_driver
         }
       }
 
-      $GLOBALS['conf']['kolab']['no_triggering'] = true;
       $success = $storage->insert_event($event);
       
       if ($success)
@@ -472,7 +471,6 @@ class kolab_driver extends calendar_driver
       $master = $event;
 
       $this->rc->session->remove('calendar_restore_event_data');
-      $GLOBALS['conf']['kolab']['no_triggering'] = true;
 
       // read master if deleting a recurring event
       if ($event['recurrence'] || $event['recurrence_id']) {
@@ -614,8 +612,6 @@ class kolab_driver extends calendar_driver
     if ($old['recurrence']['EXDATE'])
       $event['recurrence']['EXDATE'] = $old['recurrence']['EXDATE'];
 
-    $GLOBALS['conf']['kolab']['no_triggering'] = true;
-
     switch ($savemode) {
       case 'new':
         // save submitted data as new (non-recurring) event


commit ff90fa64f92ab0ca9e311eac94853d5a2357fb3f
Author: Thomas Bruederli <thomas at roundcube.net>
Date:   Thu May 10 20:45:30 2012 +0200

    Implement missing lib function

diff --git a/plugins/libkolab/lib/kolab_storage.php b/plugins/libkolab/lib/kolab_storage.php
index 689b438..983a268 100644
--- a/plugins/libkolab/lib/kolab_storage.php
+++ b/plugins/libkolab/lib/kolab_storage.php
@@ -306,13 +306,72 @@ class kolab_storage
      */
     public static function folder_selector($type, $attrs, $current = '')
     {
-        // TODO: implement this
+        // get all folders of specified type
+        $folders = self::get_folders($type);
 
+        $delim = self::$imap->get_hierarchy_delimiter();
+        $names = array();
+        $len   = strlen($current);
+
+        if ($len && ($rpos = strrpos($current, $delim))) {
+            $parent = substr($current, 0, $rpos);
+            $p_len  = strlen($parent);
+        }
+
+        // Filter folders list
+        foreach ($folders as $c_folder) {
+            $name = $c_folder->name;
+            // skip current folder and it's subfolders
+            if ($len && ($name == $current || strpos($name, $current.$delim) === 0)) {
+                continue;
+            }
+
+            // always show the parent of current folder
+            if ($p_len && $name == $parent) { }
+            // skip folders where user have no rights to create subfolders
+            else if ($c_folder->get_owner() != $_SESSION['username']) {
+                $rights = $c_folder->get_myrights();
+                if (!preg_match('/[ck]/', $rights)) {
+                    continue;
+                }
+            }
+
+            $names[$name] = rcube_charset::convert($name, 'UTF7-IMAP');
+        }
+
+        // Make sure parent folder is listed (might be skipped e.g. if it's namespace root)
+        if ($p_len && !isset($names[$parent])) {
+            $names[$parent] = rcube_charset::convert($parent, 'UTF7-IMAP');
+        }
+
+        // Sort folders list
+        asort($names, SORT_LOCALE_STRING);
+
+        $folders = array_keys($names);
+        $names   = array();
 
         // Build SELECT field of parent folder
         $select = new html_select($attrs);
         $select->add('---', '');
 
+        foreach ($folders as $name) {
+            $imap_name = $name;
+            $name      = $origname = self::object_name($name);
+
+            // find folder prefix to truncate
+            for ($i = count($names)-1; $i >= 0; $i--) {
+                if (strpos($name, $names[$i].' » ') === 0) {
+                    $length = strlen($names[$i].' » ');
+                    $prefix = substr($name, 0, $length);
+                    $count  = count(explode(' » ', $prefix));
+                    $name   = str_repeat('  ', $count-1) . '» ' . substr($name, $length);
+                    break;
+                }
+            }
+
+            $names[] = $origname;
+            $select->add($name, $imap_name);
+        }
 
         return $select;
     }


commit 418e6540f5c614a593d11e7ecbd0f6c275187065
Author: Thomas Bruederli <thomas at roundcube.net>
Date:   Thu May 10 20:45:06 2012 +0200

    Update roundcube core API calls

diff --git a/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php b/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php
index 2dabd6c..980df05 100644
--- a/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php
+++ b/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php
@@ -144,8 +144,8 @@ class kolab_addressbook_ui
         if (strlen($folder)) {
             $hidden_fields[] = array('name' => '_oldname', 'value' => $folder);
 
-            $this->rc->imap_connect();
-            $options = $this->rc->imap->mailbox_info($folder);
+            $this->rc->storage_connect();
+            $options = $this->rc->get_storage()->mailbox_info($folder);
         }
 
         $form   = array();





More information about the commits mailing list