lib/client

Torsten Grote grote at kolabsys.com
Tue Oct 9 18:12:10 CEST 2012


 lib/client/kolab_client_task_signup.php |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 66d1bd9735e5eef7d17f52436391c62d3ac01546
Author: Torsten Grote <grote at kolabsys.com>
Date:   Tue Oct 9 18:11:13 2012 +0200

    hide signup dropdown fields if there's one value

diff --git a/lib/client/kolab_client_task_signup.php b/lib/client/kolab_client_task_signup.php
index b0a58c9..8863c2b 100644
--- a/lib/client/kolab_client_task_signup.php
+++ b/lib/client/kolab_client_task_signup.php
@@ -204,13 +204,18 @@ class kolab_client_task_signup extends kolab_client_task
                 $accttypes[$idx] = array('value' => $idx, 'content' => $elem['name']);
             }
         }
-
         $fields['type_id'] = array(
             'section'  => 'personal',
             'type'     => kolab_form::INPUT_SELECT,
             'options'  => $accttypes,
             'onchange' => "kadm.change_user_type()",
         );
+        // Hide user types selector if only one is available
+        if(count($accttypes) <= 1) {
+            $accctype = array_shift(array_values($accttypes));
+            $fields['type_id']['type'] = kolab_form::INPUT_HIDDEN;
+            $fields['type_id']['value'] = $accttype['value'];
+        }
         
         // Add object type field
         $fields['object_type'] = array(
@@ -219,11 +224,17 @@ class kolab_client_task_signup extends kolab_client_task
         );
  
         // Add available domains
+        $domains = $this->get_domains();
         $fields['domain'] = array(
             'type'     => kolab_form::INPUT_SELECT,
-            'options'  => $this->get_domains(),
+            'options'  => $domains,
             'onchange' => 'kadm.check_user_availability()',
         );
+        // Hide domains if only one is available
+        if(count($domains) <= 1) {
+            $fields['domain']['type'] = kolab_form::INPUT_HIDDEN;
+            $fields['domain']['value'] = array_shift(array_values($domains));
+        }
 
         // Check for user availability
         $fields['uid']['onchange'] = 'kadm.check_user_availability()';





More information about the commits mailing list