plugins/libkolab

Thomas Brüderli bruederli at kolabsys.com
Thu Jun 20 11:08:54 CEST 2013


 plugins/libkolab/lib/kolab_storage.php |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 9332ba4abcc415bf293809f515175d7b41fd5c1a
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Thu Jun 20 11:08:44 2013 +0200

    Adapt displayname annotation key to latest KEP suggestions; add getter for default folder

diff --git a/plugins/libkolab/lib/kolab_storage.php b/plugins/libkolab/lib/kolab_storage.php
index 08e11b2..4205cf3 100644
--- a/plugins/libkolab/lib/kolab_storage.php
+++ b/plugins/libkolab/lib/kolab_storage.php
@@ -29,8 +29,8 @@ class kolab_storage
     const CTYPE_KEY_PRIVATE = '/private/vendor/kolab/folder-type';
     const COLOR_KEY_SHARED  = '/shared/vendor/kolab/color';
     const COLOR_KEY_PRIVATE = '/private/vendor/kolab/color';
-    const NAME_KEY_SHARED   = '/shared/vendor/kolab/name';
-    const NAME_KEY_PRIVATE  = '/private/vendor/kolab/name';
+    const NAME_KEY_SHARED   = '/shared/vendor/kolab/displayname';
+    const NAME_KEY_PRIVATE  = '/private/vendor/kolab/displayname';
 
     public static $version = '3.0';
     public static $last_error;
@@ -102,6 +102,23 @@ class kolab_storage
         return $folders;
     }
 
+    /**
+     * Getter for the storage folder for the given type
+     *
+     * @param string Data type to list folders for (contact,distribution-list,event,task,note)
+     * @return object kolab_storage_folder  The folder object
+     */
+    public static function get_default_folder($type)
+    {
+        if (self::setup()) {
+            foreach ((array)self::list_folders('', '*', $type . '.default', false, $folderdata) as $foldername) {
+                return new kolab_storage_folder($foldername, $folderdata[$foldername]);
+            }
+        }
+
+        return null;
+    }
+
 
     /**
      * Getter for a specific storage folder





More information about the commits mailing list