lib/Auth.php public_html/js

Aleksander Machniak machniak at kolabsys.com
Wed Apr 4 13:00:15 CEST 2012


 lib/Auth.php                  |    6 ++++--
 public_html/js/kolab_admin.js |   22 +++++++++++++---------
 2 files changed, 17 insertions(+), 11 deletions(-)

New commits:
commit 400d39f143397d7d035d345e48a46df5dc28467c
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Wed Apr 4 12:26:58 2012 +0200

    Fix so autocomplete list widget is displayed properly when the field is empty and disabled/readonly

diff --git a/lib/Auth.php b/lib/Auth.php
index 18294f8..92901e3 100644
--- a/lib/Auth.php
+++ b/lib/Auth.php
@@ -153,9 +153,11 @@ class Auth {
             $domain = $this->conf->get('primary_domain');
         }
 
-        $auth_method = strtoupper($this->conf->get($domain, 'auth_mechanism'));
+        if ($domain) {
+            $auth_method = strtoupper($this->conf->get($domain, 'auth_mechanism'));
+        }
 
-        if (!$auth_method) {
+        if (empty($auth_method)) {
             // Use the default authentication technology
             $auth_method = strtoupper($this->conf->get('kolab', 'auth_mechanism'));
         }
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index e9c7c2f..76c2fa3 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -733,7 +733,7 @@ function kolab_admin()
   // Replaces form element with smart element
   this.form_element_wrapper = function(form_element)
   {
-    var i, j = 0, len, elem, e = $(form_element),
+    var i, j = 0, len = 0, elem, e = $(form_element),
       list = this.env.assoc_fields[form_element.name],
       disabled = e.attr('disabled'),
       readonly = e.attr('readonly'),
@@ -743,11 +743,22 @@ function kolab_admin()
 
     e.hide();
 
+    if (!list) {
+      if (form_element.value) {
+        list = form_element.value.split("\n");
+        len = list.length;
+        list = $.extend({}, list);
+      }
+      else if (!autocomplete)
+        list = {0: ''};
+    }
+
     // add autocompletion input
-    if (!disabled && !readonly && autocomplete) {
+    if (autocomplete && ((!disabled && !readonly) || (!len && (disabled || readonly)))) {
       elem = this.form_list_element(form_element.form, {
         maxlength: maxlength,
         autocomplete: autocomplete,
+        disabled: !len && (disabled || readonly),
         element: e
       }, -1);
 
@@ -755,13 +766,6 @@ function kolab_admin()
       this.ac_init(elem, {attribute: form_element.name, oninsert: this.form_element_oninsert});
     }
 
-    if (!list) {
-      if (form_element.value)
-        list = $.extend({}, form_element.value.split("\n"));
-      else if (!autocomplete)
-        list = {0: ''};
-    }
-
     // add input rows
     for (i in list) {
       elem = this.form_list_element(form_element.form, {





More information about the commits mailing list