9 commits - lib/Auth lib/client lib/Conf.php lib/hosted lib/kolab_client_task.php lib/locale public_html/js

Aleksander Machniak machniak at kolabsys.com
Tue Jul 10 13:56:17 CEST 2012


 lib/Auth/LDAP.php                         |    2 +-
 lib/Conf.php                              |    8 ++++----
 lib/client/kolab_client_task_resource.php |   20 ++++++++++++++++++++
 lib/hosted/kolab_client_task_signup.php   |   10 +++++++---
 lib/kolab_client_task.php                 |   30 ++++--------------------------
 lib/locale/en_US.php                      |    1 +
 public_html/js/kolab_admin.js             |   13 ++++++++++---
 7 files changed, 47 insertions(+), 37 deletions(-)

New commits:
commit ba684962ac8c24a6a15b6cd80b302d51c94a1429
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Tue Jul 10 13:55:31 2012 +0200

    Fix unintentional changes

diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 9baefc2..8d5d0b3 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -731,7 +731,6 @@ class kolab_client_task
             if (!empty($field['maxlength'])) {
                 $result['data-maxlength'] = $field['maxlength'];
             }
-$field['maxcount'] = 2;
             if (!empty($field['maxcount'])) {
                 $result['data-maxcount'] = $field['maxcount'];
             }
@@ -916,7 +915,7 @@ $field['maxcount'] = 2;
         // See if "administrators" (those who can delete and add back on the entry
         // level) may override the automatically generated contents of auto_form_fields.
         $admin_auto_fields_rw = $this->config_get('admin_auto_fields_rw', false);
-/*
+
         foreach ($fields as $idx => $field) {
             if (!array_key_exists($idx, $attribute_rights)) {
                 // If the entry level rights contain 'add' and 'delete', well, you're an admin
@@ -941,7 +940,7 @@ $field['maxcount'] = 2;
                 }
             }
         }
-*/
+
         // Register list of auto-generated fields
         $this->output->set_env('auto_fields', $auto_fields);
         // Register list of disabled fields


commit b3b383932b19f3a82d1235f3867439651cac4350
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Tue Jul 10 13:55:01 2012 +0200

    Fixed maxcount attribute check

diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 8d5d0b3..9baefc2 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -731,6 +731,7 @@ class kolab_client_task
             if (!empty($field['maxlength'])) {
                 $result['data-maxlength'] = $field['maxlength'];
             }
+$field['maxcount'] = 2;
             if (!empty($field['maxcount'])) {
                 $result['data-maxcount'] = $field['maxcount'];
             }
@@ -915,7 +916,7 @@ class kolab_client_task
         // See if "administrators" (those who can delete and add back on the entry
         // level) may override the automatically generated contents of auto_form_fields.
         $admin_auto_fields_rw = $this->config_get('admin_auto_fields_rw', false);
-
+/*
         foreach ($fields as $idx => $field) {
             if (!array_key_exists($idx, $attribute_rights)) {
                 // If the entry level rights contain 'add' and 'delete', well, you're an admin
@@ -940,7 +941,7 @@ class kolab_client_task
                 }
             }
         }
-
+*/
         // Register list of auto-generated fields
         $this->output->set_env('auto_fields', $auto_fields);
         // Register list of disabled fields
diff --git a/lib/locale/en_US.php b/lib/locale/en_US.php
index 39bc8e3..389e303 100644
--- a/lib/locale/en_US.php
+++ b/lib/locale/en_US.php
@@ -25,7 +25,7 @@ $LANG['domain.type_id'] = 'Standard Domain';
 $LANG['error'] = 'Error';
 
 $LANG['form.required.empty'] = 'Some of the required fields are empty!';
-$LANG['form.maxcount.exceeded'] = 'Maximum count of field items exceeded!';
+$LANG['form.maxcount.exceeded'] = 'Maximum count of items exceeded!';
 
 $LANG['group.add'] = 'Add Group';
 $LANG['group.add.success'] = 'Group created successfully.';
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 8488132..8859cc4 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -853,7 +853,7 @@ function kolab_admin()
           span = $(this.parentNode.parentNode),
           maxcount = $('textarea[name="'+name+'"]').attr('data-maxcount');
 
-        if (maxcount && maxcount <= ('input', span).length) {
+        if (maxcount && maxcount <= span.parent().children().length) {
           alert(kadm.t('form.maxcount.exceeded'));
           return;
         }


commit 2fea14959bfb2827526d3791d3c8b6a9749dd3bb
Merge: db0a943 f321ed5
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Tue Jul 10 13:22:16 2012 +0200

    Merge branch 'master' of ssh://git.kolab.org/git/kolab-wap



commit db0a9433a32f700499088f4a6075671378285f40
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Tue Jul 10 13:20:04 2012 +0200

    Fix possible PHP warnings

diff --git a/lib/hosted/kolab_client_task_signup.php b/lib/hosted/kolab_client_task_signup.php
index 1b9d2ce..70563d7 100644
--- a/lib/hosted/kolab_client_task_signup.php
+++ b/lib/hosted/kolab_client_task_signup.php
@@ -98,7 +98,7 @@ class kolab_client_task_signup extends kolab_client_task
 
         // Remove delete button
         // TODO adapt effective rights and then remove
-        if(($key = array_search('delete', $data['effective_rights']['entry'])) !== false) {
+        if(($key = array_search('delete', (array)$data['effective_rights']['entry'])) !== false) {
             unset($data['effective_rights']['entry'][$key]);
         }
         
@@ -168,7 +168,11 @@ class kolab_client_task_signup extends kolab_client_task
 
     private function get_domains() {
         // Get a list of domains ($domains again is a kolab_client_api_result instance)
-        $domains = $this->api->get('domains.list')->get();
+        $domains_list = $this->api->get('domains.list')->get('list');
+
+        if (empty($domains_list)) {
+            return array();
+        }
 
         // The domain name attribute (the name of the LDAP attribute that holds the actual domain name space)
         // is configurable as well. Provide a fallback.
@@ -180,7 +184,7 @@ class kolab_client_task_signup extends kolab_client_task
         // Placeholder for the domain names in this deployment
         $domain_names = array();
 
-        foreach ($domains['list'] as $domain_dn => $domain_attrs) {
+        foreach ($domains_list as $domain_dn => $domain_attrs) {
             // If $domain_attrs[$domain_name_attribute] is an array, the primary domain name space
             // is the first value in the array.
             if (is_array($domain_attrs[$domain_name_attribute])) {


commit 2c220fab74fb782873b0019a9689e9202fc78345
Merge: 38876a5 e14f793
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Tue Jul 10 13:15:24 2012 +0200

    Merge branch 'master' of ssh://git.kolab.org/git/kolab-wap



commit 38876a59b51c2c6a3c5768108498c149a105b5a4
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Tue Jul 10 13:15:04 2012 +0200

    Implemented maxcount attribute for list widget

diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index 5574457..b53a707 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -962,7 +962,7 @@ class LDAP
             return false;
         }
 
-        if (!$this->_connect($domain)) {
+        if (!$this->_connect()) {
             return false;
         }
 
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 8110c7a..8d5d0b3 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -1209,7 +1209,7 @@ class kolab_client_task
         $this->output->set_env('form_id', $attribs['id']);
         $this->output->set_env('assoc_fields', $assoc_fields);
         $this->output->set_env('required_fields', $req_fields);
-        $this->output->add_translation('form.required.empty');
+        $this->output->add_translation('form.required.empty', 'form.maxcount.exceeded');
 
         return $form;
     }
diff --git a/lib/locale/en_US.php b/lib/locale/en_US.php
index 6b3e78a..39bc8e3 100644
--- a/lib/locale/en_US.php
+++ b/lib/locale/en_US.php
@@ -25,6 +25,7 @@ $LANG['domain.type_id'] = 'Standard Domain';
 $LANG['error'] = 'Error';
 
 $LANG['form.required.empty'] = 'Some of the required fields are empty!';
+$LANG['form.maxcount.exceeded'] = 'Maximum count of field items exceeded!';
 
 $LANG['group.add'] = 'Add Group';
 $LANG['group.add.success'] = 'Group created successfully.';
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 3b7e97d..8488132 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -849,14 +849,21 @@ function kolab_admin()
     // attach element creation event
     if (!ac)
       $('span[class="add"]', elem).click(function() {
-        var dt = (new Date()).getTime(),
+        var name = data.name.replace(/\[[0-9]+\]$/, ''),
           span = $(this.parentNode.parentNode),
-          name = data.name.replace(/\[[0-9]+\]$/, ''),
+          maxcount = $('textarea[name="'+name+'"]').attr('data-maxcount');
+
+        if (maxcount && maxcount <= ('input', span).length) {
+          alert(kadm.t('form.maxcount.exceeded'));
+          return;
+        }
+
+        var dt = (new Date()).getTime(),
           elem = kadm.form_list_element(form, {name: name}, dt);
 
+        kadm.ac_stop();
         span.after(elem);
         $('input', elem).focus();
-        kadm.ac_stop();
       });
 
     // attach element deletion event


commit 2f67b72acd056525bbd28e9236500c96138379f1
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Tue Jul 10 12:41:24 2012 +0200

    Fix possible infinite recursion

diff --git a/lib/Conf.php b/lib/Conf.php
index 1a7a73a..a207f79 100644
--- a/lib/Conf.php
+++ b/lib/Conf.php
@@ -126,9 +126,10 @@ class Conf {
                     return $this->_conf[$domain_section_name][$key1];
                 }
             } catch (Exception $e) {
-                $domain_section_name = $this->get_raw('kolab', 'primary_domain');
-                if (isset($this->_conf[$domain_section_name][$key1])) {
-                    return $this->_conf[$domain_section_name][$key1];
+                if ($domain_section_name = $this->_conf['kolab']['primary_domain']) {
+                    if (isset($this->_conf[$domain_section_name][$key1])) {
+                        return $this->_conf[$domain_section_name][$key1];
+                    }
                 }
             }
         }


commit a9f3bb3a272dbab50c8074726388a61f705400c8
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Tue Jul 10 11:55:29 2012 +0200

    Move resource_types() into better location

diff --git a/lib/client/kolab_client_task_resource.php b/lib/client/kolab_client_task_resource.php
index 5e3f7a2..222ddfc 100644
--- a/lib/client/kolab_client_task_resource.php
+++ b/lib/client/kolab_client_task_resource.php
@@ -326,4 +326,24 @@ class kolab_client_task_resource extends kolab_client_task
         return $form->output();
     }
 
+    /**
+     * Returns list of resource types.
+     *
+     * @return array List of resource types
+     */
+    private function resource_types()
+    {
+        if (isset($_SESSION['resource_types'])) {
+            return $_SESSION['resource_types'];
+        }
+
+        $result = $this->api->post('resource_types.list');
+        $list   = $result->get('list');
+
+        if (is_array($list) && !$this->config_get('devel_mode')) {
+            $_SESSION['resource_types'] = $list;
+        }
+
+        return $list;
+    }
 }
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index ba175ef..8110c7a 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -521,31 +521,6 @@ class kolab_client_task
     }
 
     /**
-     * Returns list of resource types.
-     *
-     * @return array List of resource types
-     */
-    protected function resource_types()
-    {
-
-        if (isset($_SESSION['resource_types'])) {
-            return $_SESSION['resource_types'];
-        }
-
-
-        $result = $this->api->post('resource_types.list');
-        $list   = $result->get('list');
-
-
-        if (is_array($list) && !$this->config_get('devel_mode')) {
-            $_SESSION['resource_types'] = $list;
-        }
-
-        return $list;
-    }
-
-
-    /**
      * Returns list of user types.
      *
      * @return array List of user types


commit 05504d5ee0b05394252627d87d6404f9a46574ce
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Tue Jul 10 11:50:59 2012 +0200

    Fix path to config file

diff --git a/lib/Conf.php b/lib/Conf.php
index e978c8a..1a7a73a 100644
--- a/lib/Conf.php
+++ b/lib/Conf.php
@@ -28,8 +28,7 @@ class Conf {
 
     private $_conf = array();
 
-//    const CONFIG_FILE = '/etc/kolab/kolab.conf';
-    const CONFIG_FILE = '/home/grote/public_html/kolab-webadmin/kolab.conf';
+    const CONFIG_FILE = '/etc/kolab/kolab.conf';
 
     const STRING = 0;
     const BOOL   = 1;
@@ -58,7 +57,6 @@ class Conf {
         }
 
         $this->read_config();
-
     }
 
     public function get($key1, $key2 = null, $type = null)
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 3ded522..ba175ef 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -756,6 +756,9 @@ class kolab_client_task
             if (!empty($field['maxlength'])) {
                 $result['data-maxlength'] = $field['maxlength'];
             }
+            if (!empty($field['maxcount'])) {
+                $result['data-maxcount'] = $field['maxcount'];
+            }
             if (!empty($field['autocomplete'])) {
                 $result['data-autocomplete'] = true;
             }





More information about the commits mailing list