2 commits - lib/api

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Tue Nov 11 13:48:05 CET 2014


 lib/api/kolab_api_service_form_value.php |   49 +++++++++++++++++++++++++++----
 1 file changed, 43 insertions(+), 6 deletions(-)

New commits:
commit f4fab1d3115c99a063f30befc11aadb91f4e8a45
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue Nov 11 13:47:46 2014 +0100

    Add list_options_ou() for form values

diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index 07ee351..33f0530 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -131,11 +131,12 @@ class kolab_api_service_form_value extends kolab_api_service
         $method_name = 'list_options_' . strtolower($attr_name) . '_' . strtolower($postdata['object_type']);
 
         if (!method_exists($this, $method_name)) {
-            //console("Method $method_name doesn't exist");
+            Log::debug("Method $method_name doesn't exist");
 
             $method_name = 'list_options_' . strtolower($attr_name);
 
             if (!method_exists($this, $method_name)) {
+                Log::debug("Method $method_name doesn't exist");
                 return $result;
             }
         }
@@ -942,6 +943,42 @@ class kolab_api_service_form_value extends kolab_api_service
         return $list;
     }
 
+    private function list_options_ou($postdata, $attribs = array())
+    {
+        // return specified records only, by exact DN attributes
+        if (!empty($postdata['list'])) {
+            $data['page_size'] = count($postdata['list']);
+            $data['search'] = array(
+                'entrydn' => array(
+                    'value' => $postdata['list'],
+                    'type'  => 'exact',
+                ),
+            );
+        }
+        // return records with specified string
+        else {
+            $keyword = array('value' => $postdata['search']);
+            $data['page_size']  = 15;
+            $data['search']     = array(
+                'entrydn'     => $keyword,
+                'description' => $keyword,
+            );
+        }
+
+        $data['attributes'] = array('ou', 'entrydn');
+
+        $service = $this->controller->get_service('ous');
+        $result  = $service->ous_list(null, $data);
+        $list    = $result['list'];
+
+        // convert to key=>value array
+        foreach ($list as $idx => $value) {
+            $list[$idx] = $value['entrydn'];
+        }
+
+        return $list;
+    }
+
     private function list_options_owner($postdata, $attribs = array())
     {
         return $this->_list_options_users($postdata, $attribs);


commit fbf4f78ca4cd8b0e04fac7b57f8f80a540c109d1
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue Nov 11 13:18:47 2014 +0100

    I love alphabetical sorting

diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index e9e3a16..07ee351 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -894,11 +894,6 @@ class kolab_api_service_form_value extends kolab_api_service
         return $this->_list_options_users($postdata, $attribs);
     }
 
-    private function list_options_owner($postdata, $attribs = array())
-    {
-        return $this->_list_options_users($postdata, $attribs);
-    }
-
     private function list_options_member($postdata, $attribs = array())
     {
         return $this->_list_options_members($postdata, $attribs);
@@ -947,6 +942,11 @@ class kolab_api_service_form_value extends kolab_api_service
         return $list;
     }
 
+    private function list_options_owner($postdata, $attribs = array())
+    {
+        return $this->_list_options_users($postdata, $attribs);
+    }
+
     private function list_options_uniquemember($postdata, $attribs = array())
     {
         $result = $this->_list_options_members($postdata, $attribs);




More information about the commits mailing list