summaryrefslogtreecommitdiffstats
path: root/lib/kolab_client_task.php
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-02-10 12:09:15 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-02-10 12:09:15 +0100
commit32df8a7519ea7736b84b627f9c7cc2574a0d216c (patch)
tree20705618e1e7b72929d9f48737818165b449e05d /lib/kolab_client_task.php
parent2f085a56aab8d6d02d13375adfa02dca2bd1a8ce (diff)
downloadwebadmin-32df8a7519ea7736b84b627f9c7cc2574a0d216c.tar.gz
If the options are being lower-cased, but the actual LDAP attribute value is not, make sure that the default (current) is still selected
Diffstat (limited to 'lib/kolab_client_task.php')
-rw-r--r--lib/kolab_client_task.php30
1 files changed, 10 insertions, 20 deletions
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 8cac7e0..8f4ef5d 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -926,7 +926,7 @@ class kolab_client_task
$resp = $resp->get($field['name']);
unset($data['attributes']);
- $default = $resp['default'];
+ $default = empty($data[$field['name']]) ? $resp['default'] : $data[$field['name']];
$field['values'] = $resp['list'];
}
@@ -946,6 +946,14 @@ class kolab_client_task
}
}
+ if (!empty($default)) {
+ foreach ($options as $key => $value) {
+ if (strtolower($default) == $key) {
+ $default = strtolower($default);
+ }
+ }
+ }
+
return array(
'options' => $options,
'default' => $default,
@@ -990,9 +998,7 @@ class kolab_client_task
// Mark automatically generated fields as read-only, etc.
foreach ($auto_fields as $idx => $field) {
- //console("\$field value for \$auto_fields[\$idx] (idx: $idx)", $auto_fields[$idx]);
if (!is_array($field)) {
- //console("not an array... unsetting");
unset($auto_fields[$idx]);
continue;
}
@@ -1161,7 +1167,6 @@ class kolab_client_task
$data[$fname] = (array) $data[$fname];
}
- //console("The data for field $fname at this point is", $data[$fname]);
// request parameters
$post = array(
'list' => $data[$fname],
@@ -1175,7 +1180,6 @@ class kolab_client_task
$result = $result->get('list');
$data[$fname] = $result;
- //console("Set \$data['$fname'] to", $result);
}
}
@@ -1206,19 +1210,14 @@ class kolab_client_task
*/
protected function form_create($name, $attribs, $sections, $fields, $fields_map, $data, $add_mode)
{
- //console("Creating form for $name with data", $data);
-
- //console("Assign fields to sections", $fields);
// Assign sections to fields
foreach ($fields as $idx => $field) {
if (!$field['section']) {
$fields[$idx]['section'] = isset($fields_map[$idx]) ? $fields_map[$idx] : 'other';
- //console("Assigned field $idx to section " . $fields[$idx]['section']);
+ Log::trace("Assigned field $idx to section " . $fields[$idx]['section']);
}
}
- //console("Using fields_map", $fields_map);
-
// Sort
foreach ($fields_map as $idx => $val) {
if (array_key_exists($idx, $fields)) {
@@ -1233,8 +1232,6 @@ class kolab_client_task
$fields_map = array_merge($fields_map, $fields);
}
- //console("Using attribs", $attribs);
-
$form = new kolab_form($attribs);
$assoc_fields = array();
$req_fields = array();
@@ -1242,10 +1239,6 @@ class kolab_client_task
$auto_fields = $this->output->get_env('auto_fields');
- //console("form_create() \$attribs", $attribs);
- //console("form_create() \$auto_fields", $auto_fields);
- //console("Going to walk through sections", $sections);
-
// Parse elements and add them to the form object
foreach ($sections as $section_idx => $section) {
$form->add_section($section_idx, kolab_html::escape($this->translate($section)));
@@ -1264,7 +1257,6 @@ class kolab_client_task
$field['section'] = $section_idx;
if (empty($field['value']) && !empty($data[$idx])) {
- //console("Using data value", $data[$idx], "for value of field $idx");
$value = $data[$idx];
// Convert data for the list field with autocompletion
@@ -1341,8 +1333,6 @@ class kolab_client_task
}
}
- //console("Adding field to form", $field);
-
$form->add_element($field);
}
}