summaryrefslogtreecommitdiffstats
path: root/public_html
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-02-20 12:13:11 +0100
committerAleksander Machniak <alec@alec.pl>2012-02-20 12:13:11 +0100
commitfe489152f2199f6a6862529cf1c9cde2b50437e6 (patch)
treea85da7242d29d5e191eaa8c6713474f5b39b47b5 /public_html
parent6b0c6b418effe6bb6780ff71e5c5f4ea3c1df2cf (diff)
downloadwebadmin-fe489152f2199f6a6862529cf1c9cde2b50437e6.tar.gz
Support auto_form_fields update
Diffstat (limited to 'public_html')
-rw-r--r--public_html/.htaccess2
-rw-r--r--public_html/js/kolab_admin.js40
2 files changed, 39 insertions, 3 deletions
diff --git a/public_html/.htaccess b/public_html/.htaccess
index 7af6ff3..e646d2d 100644
--- a/public_html/.htaccess
+++ b/public_html/.htaccess
@@ -1,6 +1,6 @@
<IfModule mod_rewrite.c>
RewriteEngine on
- RewriteBase /~machniak/kolab-wap/public_html
+ RewriteBase /rc/admin/public_html
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index a024047..f88c34f 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -279,7 +279,7 @@ function kolab_admin()
this.set_request_time();
return $.ajax({
- type: 'POST', url: url, data: postdata, dataType: 'json',
+ type: 'POST', url: url, data: JSON.stringify(postdata), dataType: 'json',
success: function(data) { kadm[func](data); },
error: function(o, status, err) { kadm.http_error(o, status, err); }
});
@@ -440,9 +440,45 @@ function kolab_admin()
this.user_save_response = function(response)
{
- this.api_response(response);
+ if (!this.api_response(response))
+ return;
+ };
+
+ this.form_value_change = function(form_id, events)
+ {
+ var i, j, data, e, elem, name, elem_name,
+ form = $('#'+form_id);
+
+ this.set_busy(true, 'loading');
+
+ for (i=0; i<events.length; i++) {
+ name = events[i];
+ e = this.env.auto_fields[name];
+
+ if (!e)
+ continue;
+
+ data = {user_type_id: 1}; // @TODO: get user account type from the form
+ for (j=0; j<e.data.length; j++) {
+ elem_name = e.data[j];
+ if (elem = $('[name="'+elem_name+'"]', form))
+ data[elem_name] = elem.val();
+ }
+
+ this.api_post('form_value.generate_'+name, data, 'form_value_response');
+ }
+
+ this.set_busy(false);
};
+ this.form_value_response = function(response)
+ {
+ if (!this.api_response(response))
+ return;
+
+ for (var i in response.result)
+ $('[name="'+i+'"]').val(response.result[i]);
+ };
};
var kadm = new kolab_admin();