summaryrefslogtreecommitdiff
path: root/public_html/js
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-10-25 11:32:28 (GMT)
committerAleksander Machniak <alec@alec.pl>2013-10-25 11:32:28 (GMT)
commita019fc528c0da0049bfc1f5237c9ae2b763859f6 (patch)
treefb8262620a931da9c2fddfd0ac313be484025563 /public_html/js
parent0c0d89f1fc3dbdb6630e648eeaca69d5f2b9e4a9 (diff)
downloadkolab-wap-a019fc528c0da0049bfc1f5237c9ae2b763859f6.tar.gz
Add possibility to set 'validate' flag for form_fields in object type definition
Conflicts: lib/client/kolab_client_task_settings.php public_html/js/kolab_admin.js
Diffstat (limited to 'public_html/js')
-rw-r--r--public_html/js/kolab_admin.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 9a1e776..fac2aa6 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -1810,6 +1810,8 @@ function kolab_admin()
data.optional = true;
if (attr.maxcount)
data.maxcount = attr.maxcount;
+ if (attr.validate != 'default')
+ data.validate = attr.validate;
if (attr['default'] && attr.valtype == 'normal' && attr.type.match(/^(text|select)/))
data['default'] = attr['default'];
@@ -1931,7 +1933,7 @@ function kolab_admin()
// Saves attribute form, create/update attribute row
this.type_attr_save = function()
{
- var attr, row, value = '', data = {},
+ var attr, row, data = {},
form_data = this.serialize_form('#'+this.env.form_id),
name_select = $('select[name="attr_name"]');
@@ -1939,6 +1941,7 @@ function kolab_admin()
data.type = form_data.attr_type;
data.valtype = form_data.attr_value;
data.optional = form_data.attr_optional;
+ data.validate = form_data.attr_validate;
data.data = data.valtype != 'normal' ? form_data.attr_data : null;
data.maxcount = data.type == 'list' || data.type == 'list-autocomplete' ? form_data.attr_maxcount : 0;
data.values = data.type == 'select' || data.type == 'multiselect' ? form_data.attr_options : [];
@@ -1947,7 +1950,7 @@ function kolab_admin()
// new attribute
attr = name_select.val();
row = $('<tr><td class="name"></td><td class="type"></td><td class="readonly"></td>'
- +'<td class="optional"></td><td class="value"></td><td class="actions">'
+ +'<td class="optional"></td><td class="validate"></td><td class="actions">'
+'<a class="button delete" title="delete" onclick="kadm.type_attr_delete(\''+attr+'\')" href="#delete"></a>'
+'<a class="button edit" title="edit" onclick="kadm.type_attr_edit(\''+attr+'\')" href="#edit"></a></td></tr>')
.attr('id', 'attr_table_row_' + attr).appendTo('#type_attr_table > tbody');
@@ -1959,7 +1962,7 @@ function kolab_admin()
}
if (data.valtype != 'normal') {
- value = this.t('attribute.value.' + (data.valtype == 'static' ? 'static' : 'auto')) + ': ' + data.data;
+ 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)/)) {
@@ -1971,7 +1974,7 @@ function kolab_admin()
$('td.type', row).text(data.type);
$('td.readonly', row).text(data.valtype == 'auto-readonly' ? this.env.yes_label : this.env.no_label);
$('td.optional', row).text(data.optional ? this.env.yes_label : this.env.no_label);
- $('td.value', row).text(value);
+ $('td.validate', row).text(this.t('attribute.validate.' + data.validate));
// Update env data
this.env.attr_table[attr] = data;
@@ -1993,6 +1996,7 @@ function kolab_admin()
$('select[name="attr_type"]').val(type);
$('select[name="attr_value"]').val(attr ? data.valtype : 'normal');
+ $('select[name="attr_validate"]').val(attr ? data.validate : '');
$('input[name="attr_default"]').val(data['default'] || '');
$('input[name="attr_optional"]').attr('checked', attr ? data.optional : false);
$('input[name="attr_data"]').val(data.data || '');