summaryrefslogtreecommitdiff
path: root/public_html
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-04-15 12:24:55 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2014-04-15 12:24:55 (GMT)
commit7fb0da4c53097d9b5c39df3bd8d90eb1abea8793 (patch)
tree661beed80278e09997238c0cc9b8da9fa6ae0281 /public_html
parentde9b0981f42fce13e15d9030d6358a8916a2cf14 (diff)
downloadkolab-wap-7fb0da4c53097d9b5c39df3bd8d90eb1abea8793.tar.gz
Support default value for imap_acl fields, fix handling defaults on object type change
Diffstat (limited to 'public_html')
-rw-r--r--public_html/js/kolab_admin.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 7178c97..d7167c4 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -30,6 +30,7 @@ function kolab_admin()
this.request_timeout = 300;
this.message_time = 3000;
this.events = {};
+ this.attr_default_rx = /^(text|select|imap_acl)/;
// set jQuery ajax options
$.ajaxSetup({
@@ -2633,7 +2634,7 @@ function kolab_admin()
if (attr.validate != 'default')
data.validate = attr.validate;
- if (attr['default'] && attr.valtype == 'normal' && attr.type.match(/^(text|select)/))
+ if (attr['default'] && attr.valtype == 'normal' && attr.type.match(this.attr_default_rx))
data['default'] = attr['default'];
if (attr.valtype == 'normal' || attr.valtype == 'auto')
@@ -2728,6 +2729,12 @@ function kolab_admin()
action = data.id ? 'edit' : 'add';
if (reload) {
+ // remove unchanged defaults
+ $.each(this.env.default_values || [], function(i, v) {
+ if (v == data[i])
+ delete data[i];
+ });
+
data.section = section;
this.http_post(type + '.' + action, {data: data});
return false;
@@ -2826,7 +2833,7 @@ function kolab_admin()
row.attr('title', this.t('attribute.value.' + (data.valtype == 'static' ? 'static' : 'auto')) + ': ' + data.data);
}
- if (form_data.attr_default && data.valtype == 'normal' && data.type.match(/^(text|select)/)) {
+ if (form_data.attr_default && data.valtype == 'normal' && data.type.match(this.attr_default_rx)) {
data['default'] = form_data.attr_default;
}
@@ -2912,7 +2919,7 @@ function kolab_admin()
$('input[name="attr_data"]')[type != 'normal' ? 'show' : 'hide']();
$('#attr_form_row_readonly')[type != 'static' ? 'show' : 'hide']();
- $('#attr_form_row_default')[type == 'normal' && field_type.match(/^(text|select)/) ? 'show' : 'hide']();
+ $('#attr_form_row_default')[type == 'normal' && field_type.match(this.attr_default_rx) ? 'show' : 'hide']();
optional[opt ? 'show' : 'hide']();
if (!opt)
@@ -2927,7 +2934,7 @@ function kolab_admin()
$('#attr_form_row_maxcount')[type == 'list' || type == 'list-autocomplete' ? 'show' : 'hide']();
$('#attr_form_row_options')[type == 'select' || type == 'multiselect' ? 'show' : 'hide']();
- $('#attr_form_row_default')[val_type == 'normal' && type.match(/^(text|select)/) ? 'show' : 'hide']();
+ $('#attr_form_row_default')[val_type == 'normal' && type.match(this.attr_default_rx) ? 'show' : 'hide']();
};
// Update attributes list on object classes change