lib/api lib/kolab_api_service.php

Aleksander Machniak machniak at kolabsys.com
Wed Sep 11 15:08:21 CEST 2013


 lib/api/kolab_api_service_domain_types.php |   54 ++++++++++++++++-------------
 lib/kolab_api_service.php                  |   28 ++-------------
 2 files changed, 34 insertions(+), 48 deletions(-)

New commits:
commit 35e100a781299b7b497d8f5d836a8b03ad0ee918
Author: Aleksander Machniak <alec at alec.pl>
Date:   Wed Sep 11 15:07:17 2013 +0200

    Fix inetdomainstatus - changed field to select with options: '', 'active', 'suspended' (Bug #2202)

diff --git a/lib/api/kolab_api_service_domain_types.php b/lib/api/kolab_api_service_domain_types.php
index 6152ea4..6829047 100644
--- a/lib/api/kolab_api_service_domain_types.php
+++ b/lib/api/kolab_api_service_domain_types.php
@@ -28,6 +28,33 @@
  */
 class kolab_api_service_domain_types extends kolab_api_service
 {
+    public static $DEFAULT_TYPE_ATTRS = array(
+        'auto_form_fields' => array(),
+        'form_fields' => array(
+            'associateddomain' => array(
+                'type' => 'list'
+            ),
+            'inetdomainbasedn' => array(
+                'optional' => true,
+            ),
+            'inetdomainstatus' => array(
+                'optional' => true,
+                'type'     => 'select',
+                'values'   => array(
+                    '', 'active', 'suspended',
+                ),
+            ),
+        ),
+        'fields' => array(
+            'objectclass' => array(
+                'top',
+                'domainrelatedobject',
+                'inetdomain',
+            ),
+        ),
+    );
+
+
     /**
      * Returns service capabilities.
      *
@@ -55,31 +82,10 @@ class kolab_api_service_domain_types extends kolab_api_service
         // @TODO: move to database
         $types = array(
             1 => array(
-                'key' => 'standard',
-                'name' => 'Standard domain',
+                'key'         => 'standard',
+                'name'        => 'Standard domain',
                 'description' => 'A standard domain name space',
-                'attributes' => array(
-                    'auto_form_fields' => array(),
-                    'form_fields' => array(
-                        'associateddomain' => array(
-                            'type' => 'list',
-                        ),
-                        'inetdomainbasedn' => array(
-                            'optional' => true,
-                        ),
-                        'inetdomainstatus' => array(
-                            'type' => 'checkbox',
-                            'optional' => true,
-                        ),
-                    ),
-                    'fields' => array(
-                        'objectclass' => array(
-                            'top',
-                            'domainrelatedobject',
-                            'inetdomain',
-                        ),
-                    ),
-                ),
+                'attributes'  => self::$DEFAULT_TYPE_ATTRS,
             ),
         );
 
diff --git a/lib/kolab_api_service.php b/lib/kolab_api_service.php
index 4d2f9ef..a154f7d 100644
--- a/lib/kolab_api_service.php
+++ b/lib/kolab_api_service.php
@@ -80,30 +80,10 @@ abstract class kolab_api_service
 
         if (empty($object_types[$type_id])) {
             if ($object_name == 'domain') {
-                $result = array(
-                    'auto_form_fields' => array(),
-                    'form_fields' => array(
-                        'aci' => array(
-                            'type' => 'list',
-                            'optional' => true,
-                        ),
-                        'associateddomain' => array(
-                            'type' => 'list'
-                        ),
-                        'inetdomainbasedn' => array(
-                            'optional' => true,
-                        ),
-                        'inetdomainstatus' => array(
-                            'optional' => true,
-                        ),
-                    ),
-                    'fields' => array(
-                        'objectclass' => array(
-                            'top',
-                            'domainrelatedobject',
-                            'inetdomain',
-                        ),
-                    ),
+                $result = kolab_api_service_domain_types::$DEFAULT_TYPE_ATTRS;
+                $result['form_fields']['aci'] = array(
+                    'type' => 'list',
+                    'optional' => true,
                 );
 
                 return $result;




More information about the commits mailing list