summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2012-04-11 11:37:30 +0200
committerAleksander Machniak <machniak@kolabsys.com>2012-04-11 11:37:30 +0200
commitbb72cd7199b6cec13b8fe9a1959323c70bdd1bf2 (patch)
tree1e5086c8d29cbcce66cb8deaeea55de546f46316
parentd6853272627f962ffae248dca683b26a84d05aeb (diff)
downloadwebadmin-bb72cd7199b6cec13b8fe9a1959323c70bdd1bf2.tar.gz
Add object_type and type_id arguments to list_options/select_options calls (#698)
-rw-r--r--lib/kolab_client_task.php10
-rw-r--r--public_html/js/kolab_admin.js17
2 files changed, 17 insertions, 10 deletions
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 53422e4..e51af9e 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -771,6 +771,9 @@ class kolab_client_task
$extra_fields = array_flip($extra_fields);
+ // Object type
+ $data['object_type'] = $name;
+
// Selected account type
if (!empty($data['type_id'])) {
$type = $data['type_id'];
@@ -896,13 +899,10 @@ class kolab_client_task
// (Re-|Pre-)populate auto_form_fields
if ($add_mode) {
if (!empty($auto_attribs)) {
- $data = array_merge((array)$data, array(
- 'attributes' => $auto_attribs,
- 'object_type' => $name,
- ));
-
+ $data['attributes'] = $auto_attribs;
$resp = $this->api->post('form_value.generate', null, $data);
$data = array_merge((array)$data, (array)$resp->get());
+ unset($data['attributes']);
}
}
else {
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 36b749f..b4ed605 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -734,6 +734,7 @@ function kolab_admin()
this.form_element_wrapper = function(form_element)
{
var i = 0, j = 0, list = [], elem, e = $(form_element),
+ form = form_element.form,
disabled = e.attr('disabled'),
readonly = e.attr('readonly'),
autocomplete = e.attr('data-autocomplete'),
@@ -760,7 +761,7 @@ function kolab_admin()
// add simple input rows
$.each(list, function(i, v) {
- elem = $('<input>');
+ var elem = $('<input>');
elem.attr({
value: v,
disabled: disabled,
@@ -775,21 +776,27 @@ function kolab_admin()
else {
// add autocompletion input
if (autocomplete) {
- elem = this.form_list_element(form_element.form, {
+ elem = this.form_list_element(form, {
maxlength: maxlength,
autocomplete: autocomplete,
element: e
}, -1);
- elem.appendTo(area);
- this.ac_init(elem, {attribute: form_element.name, oninsert: this.form_element_oninsert});
+ // Initialize autocompletion
+ var props = {attribute: form_element.name, oninsert: this.form_element_oninsert};
+ if (i = $('input[name="type_id"]', form).val())
+ props.type_id = i;
+ if (i = $('input[name="object_type"]', form).val())
+ props.object_type = i;
+ this.ac_init(elem, props);
+ elem.appendTo(area);
area.addClass('autocomplete');
}
// add input rows
$.each(list, function(i, v) {
- elem = kadm.form_list_element(form_element.form, {
+ var elem = kadm.form_list_element(form, {
value: v,
key: i,
maxlength: maxlength,