summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2010-10-13 13:07:43 -0400
committerAdam Young <ayoung@redhat.com>2010-10-15 12:51:30 -0400
commitacf5f9cad7438268148dff6c6b74d8c63048409a (patch)
tree04b5c2bd2529c68f7ec3cb59bb7f2f0cf19417be
parent538646c04ccbbef8249da3705eb455e63d075589 (diff)
downloadfreeipa-acf5f9cad7438268148dff6c6b74d8c63048409a.tar.gz
freeipa-acf5f9cad7438268148dff6c6b74d8c63048409a.tar.xz
freeipa-acf5f9cad7438268148dff6c6b74d8c63048409a.zip
multivalue fixes
metadata for phone numbers test date for users Undo works for multivalue JQuery UI buttons have custom classes inputs/fields are now managed inside of objects removed the use of .call. as it was confusing the issue of mismatched parameter lists. Fixed the parameter lists, too.
-rw-r--r--install/static/details.js342
-rw-r--r--install/static/entity.js12
-rw-r--r--install/static/group.js11
-rw-r--r--install/static/host.js9
-rw-r--r--install/static/hostgroup.js7
-rw-r--r--install/static/ipa.css4
-rw-r--r--install/static/netgroup.js9
-rw-r--r--install/static/policy.js76
-rw-r--r--install/static/search.js12
-rw-r--r--install/static/serverconfig.js51
-rw-r--r--install/static/service.js24
-rw-r--r--install/static/test/data/json_metadata.json668
-rw-r--r--install/static/test/data/user_mod.json32
-rw-r--r--install/static/test/data/user_show.json43
-rw-r--r--install/static/test/details_tests.html2
-rw-r--r--install/static/test/details_tests.js202
-rw-r--r--install/static/user.js78
17 files changed, 1213 insertions, 369 deletions
diff --git a/install/static/details.js b/install/static/details.js
index 2daf0a21b..cb4aab111 100644
--- a/install/static/details.js
+++ b/install/static/details.js
@@ -25,6 +25,144 @@
/* REQUIRES: ipa.js */
var ipa_details_cache = {};
+var ipa_entity_details_list = {};
+
+
+function ipa_stanza(spec){
+ var that = {};
+
+ that.name = spec.name || '';
+ that.label = spec.label || '';
+
+ function input(spec){
+
+ /*Was ipa_details_field_setup*/
+ function setup(container, dl, section) {
+
+ var obj_name = container.attr('title');
+ var title = this.name;
+ var label = '';
+ var param_info = ipa_get_param_info(obj_name, this.name);
+ if (param_info)
+ label = param_info['label'];
+ if (!label)
+ label = this.label;
+ $('<dt></dt>', {
+ id: this.name,
+ title: title,
+ html: label + ':'
+ }).appendTo(dl);
+ }
+
+ /*Was ipa_details_field_load*/
+ function load(container, dt, entry_attrs) {
+
+ var obj_name = container.attr('id');
+ var multivalue = false;
+ var hint_span = null;
+ var dd;
+
+ var param_info = ipa_get_param_info(obj_name, this.name);
+ if (param_info) {
+ if (param_info['multivalue'] || param_info['class'] == 'List')
+ multivalue = true;
+ var hint = param_info['hint'];
+ if (hint){
+ hint_span = $('<span />',{
+ 'class': 'attrhint',
+ 'html': 'Hint: ' + hint});
+ }
+ }
+
+ var value = entry_attrs[this.name];
+ if (value) {
+ dd = ipa_create_first_dd(
+ this.name, ipa_create_input(obj_name, this.name, value[0],hint_span)
+ );
+ dt.after(dd);
+ var last_dd = dd;
+ for (var i = 1; i < value.length; ++i) {
+ dd = ipa_create_other_dd(
+ this.name, ipa_create_input(obj_name, this.name, value[i],hint_span)
+ );
+ last_dd.after(dd);
+ last_dd = dd;
+ }
+ if (multivalue) {
+ dd = ipa_create_other_dd(
+ this.name, _ipa_a_add_template.replace('A', this.name)
+ );
+ last_dd.after(dd);
+ }
+ } else {
+ if (multivalue) {
+ dd = ipa_create_first_dd(
+ this.name, _ipa_a_add_template.replace('A', this.name) /*.append(hint_span)*/
+ );
+ dt.after(dd);
+ } else {
+ dd = ipa_create_first_dd(
+ this.name, ipa_create_input(obj_name, this.name, '') /*.append(hint_span)*/
+ );
+ dt.after(dd);
+ }
+ }
+ }
+ /*Was ipa_details_field_save*/
+ function save(container) {
+ var field = this;
+ var values = [];
+
+ var dd = $('dd[title='+field.name+']', container);
+ dd.each(function () {
+ var input = $('input', $(this));
+ if (!input.length) return;
+
+ if (input.is('strikethrough')) return;
+
+ var value = $.trim(input.val());
+ if (!value) value = '';
+
+ values.push(value);
+ });
+
+ return values;
+ }
+
+ that.fields.push(spec);
+ that.controls[spec.name] = spec;
+
+ if (!spec.setup){
+ spec.setup = setup;
+ }
+ if (!spec.load){
+ spec.load = load;
+ }
+
+ if (!spec.save){
+ spec.save = save;
+ }
+
+ return that;
+ };
+ that.input = input;
+ that.fields = [];
+ that.controls={};
+ return that;
+};
+
+
+
+function ipa_make_button(which,text,details_class){
+
+ var button_class= details_class +
+ " ui-state-default ui-corner-all input_link ";
+ return $('<a ></a>',{
+ "class": button_class
+ }).
+ append('<span class="ui-icon ' + which +'" ></span> ').
+ append(text);
+}
function ipa_details_create(container, sections)
{
@@ -45,8 +183,8 @@ function ipa_details_create(container, sections)
'class': 'details-buttons'
}).appendTo(details);
- buttons.append('<a class="details-reset ui-state-default ui-corner-all input_link " href="jslink"><span class="ui-icon ui-icon-refresh" ></span> Reset</a>');
- buttons.append('<a class="details-update ui-state-default ui-corner-all input_link " href="jslink"><span class="ui-icon ui-icon-check" ></span>Update</a>');
+ buttons.append(ipa_make_button('ui-icon-refresh','Reset','details-reset'));
+ buttons.append(ipa_make_button('ui-icon-check','Update','details-update'));
details.append('<hr />');
@@ -55,9 +193,6 @@ function ipa_details_create(container, sections)
ipa_details_section_setup(container, details, section);
}
- details.append('<div class="details-back"></div>');
- var jobj = details.children().last();
- jobj.append('<a href="#details-viewtype">Back to Top</a>');
}
@@ -83,35 +218,12 @@ function ipa_details_section_setup(container, details, section)
for (var i = 0; i < fields.length; ++i) {
var field = fields[i];
- if (field.setup) {
- field.setup.call(field, container, dl, section);
-
- } else {
- ipa_details_field_setup.call(field, container, dl, section);
- }
+ field.setup(container, dl, section);
}
details.append('<hr/>');
}
-function ipa_details_field_setup(container, dl, section) {
-
- var obj_name = container.attr('title');
-
- var title = this.name;
- var label = '';
- var param_info = ipa_get_param_info(obj_name, this.name);
- if (param_info)
- label = param_info['label'];
- if (!label)
- label = this.label;
-
- $('<dt></dt>', {
- id: this.name,
- title: title,
- html: label + ':'
- }).appendTo(dl);
-}
function ipa_details_load(container, pkey, on_win, on_fail)
{
@@ -182,18 +294,13 @@ function ipa_details_update(container, pkey, on_win, on_fail)
for (var j=0; j<fields.length; j++) {
var field = fields[j];
- if (field.save) {
- values = field.save.call(field, container);
-
- } else {
- values = ipa_details_field_save.call(field, container);
- }
+ values = field.save(container);
var param_info = ipa_get_param_info(obj_name, field.name);
if (param_info) {
if (param_info['primary_key']) continue;
- if (values.length) modlist[field.name] = values[0];
-
+ if (values.length === 1) modlist[field.name] = values[0];
+ if (values.length > 1) modlist[field.name] = values;
} else {
if (values.length) attrs_wo_option[field.name] = values;
}
@@ -210,23 +317,6 @@ function ipa_details_update(container, pkey, on_win, on_fail)
ipa_cmd('mod', [pkey], modlist, update_on_win, update_on_fail, obj_name);
}
-function ipa_details_field_save(container) {
- var field = this;
- var values = [];
-
- var dd = $('dd[title='+field.name+']', container);
- dd.each(function () {
- var input = $('input', dd);
- if (!input.length) return;
-
- var value = $.trim(input.val());
- if (!value) value = '';
-
- values.push(value);
- });
-
- return values;
-}
/* HTML templates for ipa_details_display() */
var _ipa_a_add_template =
@@ -234,6 +324,8 @@ var _ipa_a_add_template =
var _ipa_span_doc_template = '<span class="attrhint">Hint: D</span>';
var _ipa_span_hint_template = '<span class="attrhint">Hint: D</span>';
+
+
/* populate definition lists with the class 'entryattrs' with entry attributes
*
* The list has to be specially crafted for this function to work properly:
@@ -267,73 +359,14 @@ function ipa_details_display(container, entry_attrs)
var field = fields[j];
var dt = $('dt[title='+field.name+']', container);
if (!dt.length) continue;
-
- if (field.load) {
- field.load.call(field, dt, entry_attrs);
-
- } else {
- ipa_details_field_load.call(field, container, dt, entry_attrs);
- }
+ field.load(container, dt, entry_attrs);
}
}
}
-function ipa_details_field_load(container, dt, entry_attrs) {
- var obj_name = container.attr('id');
-
- var multivalue = false;
- var hint_span = null;
- var dd;
- var param_info = ipa_get_param_info(obj_name, this.name);
- if (param_info) {
- if (param_info['multivalue'] || param_info['class'] == 'List')
- multivalue = true;
- var hint = param_info['hint'];
- if (hint){
- hint_span = $('<span />',{
- 'class': 'attrhint',
- 'html': 'Hint: ' + hint});
- }
- }
- var value = entry_attrs[this.name];
- if (value) {
- dd = ipa_create_first_dd(
- this.name, ipa_create_input(obj_name, this.name, value[0],hint_span)
- );
- dt.after(dd);
- var last_dd = dd;
- for (var i = 1; i < value.length; ++i) {
- dd = ipa_create_other_dd(
- this.name, ipa_create_input(obj_name, this.name, value[i],hint_span)
- );
- last_dd.after(dd);
- last_dd = dd;
- }
- if (multivalue) {
- dd = ipa_create_other_dd(
- this.name, _ipa_a_add_template.replace('A', this.name)
- );
- last_dd.after(dd);
- }
- } else {
- if (multivalue) {
- dd = ipa_create_first_dd(
- this.name, _ipa_a_add_template.replace('A', this.name) /*.append(hint_span)*/
- );
- dt.after(dd);
- } else {
- dd = ipa_create_first_dd(
- this.name, ipa_create_input(obj_name, this.name, '') /*.append(hint_span)*/
- );
- dt.after(dd);
- }
- }
-}
-
-function ipa_create_first_dd(field_name, content)
-{
+function ipa_create_first_dd(field_name, content){
return $('<dd/>', {
'class': 'first',
@@ -341,14 +374,24 @@ function ipa_create_first_dd(field_name, content)
}).append(content);
}
-function ipa_create_other_dd(field_name, content)
-{
+function ipa_create_other_dd(field_name, content){
return $('<dd/>', {
'class': 'other',
'title': field_name
}).append(content);
}
+function ipa_insert_first_dd(jobj, content){
+ ipa_insert_dd(jobj, content, "first");
+}
+
+function ipa_insert_dd(jobj, content, dd_class){
+ jobj.after( $('<dd/>',{
+ "class": dd_class
+ }).append(content))
+}
+
+
/* mapping of parameter types to handlers used to create inputs */
var _ipa_param_type_2_handler_map = {
@@ -381,14 +424,12 @@ function ipa_create_input(obj_name, attr, value,hint)
/* call handler by param class */
var handler = _ipa_param_type_2_handler_map[param_info['class']];
if (handler) {
+ input = handler(attr, value, param_info);
if (param_info['multivalue'] || param_info['class'] == 'List') {
- input = handler(attr, value, param_info) +
- _ipa_create_remove_link(attr, param_info);
- }else{
- input = (handler(attr, value, param_info));
- if (hint){
- input.after(hint);
- }
+ input.append( _ipa_create_remove_link(attr, param_info));
+ }
+ if (hint){
+ input.after(hint);
}
}
}
@@ -417,7 +458,23 @@ function _ipa_create_remove_link(attr, param_info)
/* creates a input box for editing a string attribute */
function _ipa_create_text_input(attr, value, param_info)
{
- return $("<input/>",{
+
+ function calculate_dd_index(jobj){
+ var index = 0;
+ var dd = jobj.parents('dd').slice(0, 1)[0];
+ dd = dd.previousElementSibling;
+
+ while(dd.nodeName === 'dd'){
+ dd = dd.previousElementSibling;
+ index += 1;
+ if (index > 100 )
+ break;
+ }
+ return index;
+ }
+
+ var input = $("<Span />");
+ input.append($("<input/>",{
type:"text",
name:attr,
value:value.toString(),
@@ -430,7 +487,8 @@ function _ipa_create_text_input(attr, value, param_info)
error_link.style.display ="block";
}
}
- }).after($("<a/>",{
+ }));
+ input.append($("<a/>",{
html:"undo",
"class":"ui-state-highlight ui-corner-all",
style:"display:none",
@@ -438,16 +496,26 @@ function _ipa_create_text_input(attr, value, param_info)
var key = this.previousElementSibling.name;
var entity_divs = $(this).parents('.details-container');
var entry_attrs = ipa_details_cache[entity_divs[0].id];
+
+ index = calculate_dd_index($(this));
+
var previous_value = entry_attrs[key] || "";
+ if (previous_value.length >= index){
+ previous_value= previous_value[index];
+ }else{
+ previous_value = '';
+ }
+
this.previousElementSibling.value = previous_value;
this.style.display = "none";
}
- })).after($("<span/>",{
+ }));
+ input.append($("<span/>",{
html:"Does not match pattern",
"class":"ui-state-error ui-corner-all",
style:"display:none"
}));
-
+ return input;
}
function ipa_details_reset(container)
@@ -470,10 +538,9 @@ function _ipa_add_on_click(obj)
var obj_name = jobj.closest('.details-container').attr('title');
par.prepend(ipa_create_input(obj_name, attr, ''));
- var dd = ipa_create_other_dd(field.name, _ipa_a_add_template.replace('A', attr));
- par.after(dd);
jobj.next('input').focus();
jobj.remove();
+ par.after( ipa_create_other_dd(attr,_ipa_a_add_template.replace('A', attr)));
return (false);
}
@@ -484,19 +551,8 @@ function _ipa_remove_on_click(obj)
var attr = jobj.attr('title');
var par = jobj.parent();
- var next = par.next('dd[title='+attr+']');
- if (next.length) {
- if (par.hasClass('first')) {
- var hint = par.children('span').detach();
- next.append(hint);
- next.addClass('first');
- next.removeClass('other');
- }
- par.remove();
- } else {
- par.empty();
- par.append(_ipa_a_add_template.replace('A', attr));
- }
+ var input = par.find('input');
+ input.addClass('strikethrough');
return (false);
}
diff --git a/install/static/entity.js b/install/static/entity.js
index c911c0f23..913a751c1 100644
--- a/install/static/entity.js
+++ b/install/static/entity.js
@@ -23,7 +23,9 @@
var ipa_entity_search_list = {};
var ipa_entity_add_list = {};
-var ipa_entity_details_list = {};
+
+//moving this to details
+//var ipa_entity_details_list = {};
var ipa_entity_association_list = {};
/* use this to track individual changes between two hashchange events */
@@ -139,11 +141,9 @@ function _ipa_entity_setup(container, unspecified) {
var filter = $.bbq.getState(obj_name + '-filter', true) || '';
search_create(obj_name, ipa_entity_search_list[obj_name], container);
- $('<input />',{
- type:"submit",
- value: ipa_messages.button.add,
- click:new_on_click
- }).appendTo($( "div#" + obj_name + " > div.search-controls"));
+ ipa_make_button( 'ui-icon-plus',ipa_messages.button.add).
+ click(new_on_click).
+ appendTo($( "div#" + obj_name + " > div.search-controls"))
search_load(container, filter, null, null);
}
diff --git a/install/static/group.js b/install/static/group.js
index 3770e1fb1..1a66c9289 100644
--- a/install/static/group.js
+++ b/install/static/group.js
@@ -36,12 +36,11 @@ ipa_entity_set_add_definition('group', [
]
]);
-ipa_entity_set_details_definition('group', [
- {name:'identity', label:'Group Details', fields:[
- {name:'cn', label:'Group Name'},
- {name:'description', label:'Description'},
- {name:'gidnumber', label:'Group ID'}
- ]}
+ipa_entity_set_details_definition('group',[
+ ipa_stanza({name:'identity', label:'Group Details'}).
+ input({name:'cn', label:'Group Name'}).
+ input({name:'description', label:'Description'}).
+ input({name:'gidnumber', label:'Group ID'})
]);
ipa_entity_set_association_definition('group', {
diff --git a/install/static/host.js b/install/static/host.js
index 907f24dfd..d2cdd7d50 100644
--- a/install/static/host.js
+++ b/install/static/host.js
@@ -35,11 +35,10 @@ ipa_entity_set_add_definition('host', [
]);
ipa_entity_set_details_definition('host', [
- {name:'host', label:'Host Details', fields:[
- {name:'fqdn', label:'Fully Qualified Domain Name'},
- {name:'krbprincipalname', label:'Kerberos Principal'},
- {name:'serverhostname', label:'Server Host Name'}
- ]}
+ ipa_stanza({name:'host', label:'Host Details'}).
+ input({name:'fqdn', label:'Fully Qualified Domain Name'}).
+ input({name:'krbprincipalname', label:'Kerberos Principal'}).
+ input({name:'serverhostname', label:'Server Host Name'})
]);
ipa_entity_set_association_definition('host', {
diff --git a/install/static/hostgroup.js b/install/static/hostgroup.js
index 58a20588a..37af6d6e5 100644
--- a/install/static/hostgroup.js
+++ b/install/static/hostgroup.js
@@ -34,8 +34,7 @@ ipa_entity_set_add_definition('hostgroup', [
]);
ipa_entity_set_details_definition('hostgroup', [
- {name:'identity', label:'Hostgroup Details', fields:[
- {name:'cn', label:'Name'},
- {name:'description', label:'Description'}
- ]}
+ ipa_stanza({name:'identity', label:'Hostgroup Details'}).
+ input({name:'cn', label:'Name'}).
+ input({name: 'description', label:'Description'})
]);
diff --git a/install/static/ipa.css b/install/static/ipa.css
index c562a20b3..eb5396db0 100644
--- a/install/static/ipa.css
+++ b/install/static/ipa.css
@@ -10,7 +10,7 @@ body{ font: 62.5% "Trebuchet MS", sans-serif; margin: 50px;}
.demoHeaders { margin-top: 2em; }
-.input_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative;}
+.input_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative; cursor: pointer; }
.input_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}
@@ -275,3 +275,5 @@ span.main-separator{
display:inline;
cursor: pointer;
}
+
+.strikethrough { text-decoration: line-through; }
diff --git a/install/static/netgroup.js b/install/static/netgroup.js
index 7e8868fed..9a738877d 100644
--- a/install/static/netgroup.js
+++ b/install/static/netgroup.js
@@ -34,10 +34,9 @@ ipa_entity_set_add_definition('netgroup', [
]);
ipa_entity_set_details_definition('netgroup', [
- {name:'identity', label:'Netgroup Details', fields:[
- {name:'cn', label:'Name'},
- {name:'description', label:'Description'},
- {name:'nisdomainname', label:'NIS Domain'}
- ]}
+ ipa_stanza({name:'identity', label:'Netgroup Details'}).
+ input({name:'cn', label:'Name'}).
+ input({name:'description', label:'Description'}).
+ input({name:'nisdomainname', label:'NIS Domain'})
]);
diff --git a/install/static/policy.js b/install/static/policy.js
index 257ede592..9d55e1cf0 100644
--- a/install/static/policy.js
+++ b/install/static/policy.js
@@ -33,16 +33,15 @@ ipa_entity_set_add_definition('hbac', [
]);
ipa_entity_set_details_definition('hbac', [
- {name:'identity', label:'HBAC Details', fields:[
- {name:'cn', label:'HBAC Name'},
- {name:'accessruletype', label:'Rule Type'},
- {name:'description', label:'Description'},
- {name:'hostcategory', label:'Host Category'},
- {name:'ipaenabledflag', label:'Enabled'},
- {name:'servicecategory', label:'Service Category'},
- {name:'sourcehostcategory', label:'Source Host Category'},
- {name:'usercategory', label:'User Category'}
- ]}
+ ipa_stanza({name:'identity', label:'HBAC Details'}).
+ input({name:'cn', label:'HBAC Name'}).
+ input({name:'accessruletype', label:'Rule Type'}).
+ input({name:'description', label:'Description'}).
+ input({name:'hostcategory', label:'Host Category'}).
+ input({name:'ipaenabledflag', label:'Enabled'}).
+ input({name:'servicecategory', label:'Service Category'}).
+ input({name:'sourcehostcategory', label:'Source Host Category'}).
+ input({name:'usercategory', label:'User Category'})
]);
ipa_entity_set_association_definition('hbac', {
@@ -63,21 +62,20 @@ ipa_entity_set_add_definition('dns', [
]);
ipa_entity_set_details_definition('dns', [
- {name:'identity', label:'DNS Zone Details', fields:[
- {name:'idnsname', label:'DNS Name'},
- {name:'idnszoneactive', label:'Zone Active'},
- {name:'idnssoamname', label:'Authoritative name server'},
- {name:'idnssoarname', label:'administrator e-mail address'},
- {name:'idnssoaserial', label:'SOA serial'},
- {name:'idnssoarefresh', label:'SOA refresh'},
- {name:'idnssoaretry', label:'SOA retry'},
- {name:'idnssoaexpire',label:'SOA expire'},
- {name:'idnssoaminimum', label:'SOA minimum'},
- {name:'dnsttl', label:'SOA time to live'},
- {name:'dnsclass', label:'SOA class'},
- {name:'idnsallowdynupdate', label:'allow dynamic update?'},
- {name:'idnsupdatepolicy', label:'BIND update policy'}
- ]}
+ ipa_stanza({name:'identity', label:'DNS Zone Details'}).
+ input({name:'idnsname', label:'DNS Name'}).
+ input({name:'idnszoneactive', label:'Zone Active'}).
+ input({name:'idnssoamname', label:'Authoritative name server'}).
+ input({name:'idnssoarname', label:'administrator e-mail address'}).
+ input({name:'idnssoaserial', label:'SOA serial'}).
+ input({name:'idnssoarefresh', label:'SOA refresh'}).
+ input({name:'idnssoaretry', label:'SOA retry'}).
+ input({name:'idnssoaexpire', label:'SOA expire'}).
+ input({name:'idnssoaminimum', label:'SOA minimum'}).
+ input({name:'dnsttl', label:'SOA time to live'}).
+ input({name:'dnsclass', label:'SOA class'}).
+ input({name:'idnsallowdynupdate', label:'allow dynamic update?'}).
+ input({name:'idnsupdatepolicy', label:'BIND update policy'})
]);
ipa_entity_set_association_definition('dns', {
@@ -99,9 +97,8 @@ ipa_entity_set_add_definition('automountlocation', [
]);
ipa_entity_set_details_definition('automountlocation', [
- {name:'identity', label:'Automount Location Details', fields:[
- {name:'cn', label:'Automount Location'}
- ]}
+ ipa_stanza({name:'identity', label:'Automount Location Details'}).
+ input({name:'cn', label:'Automount Location'})
]);
ipa_entity_set_association_definition('automountlocation', {
@@ -123,13 +120,13 @@ ipa_entity_set_add_definition('pwpolicy', [
]);
ipa_entity_set_details_definition('pwpolicy', [
- {name:'identity', label:'Password Policy', fields:[
- {name:'krbmaxpwdlife', label:'Max Password Life'},
- {name:'krbminpwdlife', label:'Min Password Life'},
- {name:'krbpwdhistorylength', label:'Password History Length'},
- {name:'krbpwdmindiffchars', label:'Min Different Characters'},
- {name:'krbpwdminlength', label:'Password Minimum Length'}
- ]}
+ ipa_stanza({name:'identity', label:'Password Policy'}).
+ input({name:'krbmaxpwdlife',label:'Max Password Life'}).
+ input({name:'krbminpwdlife',label:'Min Password Life'}).
+ input({name:'krbpwdhistorylength',label:'Password History Length'}).
+ input({name:'krbpwdmindiffchars',
+ label:'Min Different Characters'}).
+ input({name:'krbpwdminlength', label:'Password Minimum Length'})
]);
ipa_entity_set_association_definition('pwpolicy', {
@@ -142,11 +139,10 @@ ipa_entity_set_association_definition('pwpolicy', {
*/
ipa_entity_set_details_definition('krbtpolicy', [
- {name:'identity', label:'Krbtpolicy Location Details', fields:[
- {name:'cn', label:'Krbtpolicy Location'},
- {name:'krbmaxrenewableage', label:'Max Renewable Age'},
- {name:'krbmaxticketlife', label:'Max Ticket Life'}
- ]}
+ ipa_stanza({name:'identity', label:'Krbtpolicy Location Details'}).
+ input({name:'cn', label:'Krbtpolicy Location'}).
+ input({name:'krbmaxrenewableage', label:'Max Renewable Age'}).
+ input({name:'krbmaxticketlife', label:'Max Ticket Life'})
]);
ipa_entity_set_association_definition('krbtpolicy', {
diff --git a/install/static/search.js b/install/static/search.js
index f968e91ca..91ee1bd8e 100644
--- a/install/static/search.js
+++ b/install/static/search.js
@@ -34,7 +34,7 @@ function search_create(obj_name, scl, container)
$.bbq.pushState(state);
};
- function delete_on_click() {
+ function delete_on_click_outer() {
var delete_list = [];
var delete_dialog = $('<div></div>', {
title: ipa_messages.button.delete,
@@ -94,10 +94,12 @@ function search_create(obj_name, scl, container)
var jobj = div.children().last();
jobj.append('<input type="text" />');
jobj.children().last().attr('name', 'search-' + obj_name + '-filter')
- jobj.append('<input type="submit" value="'+ipa_messages.button.find+ '" />');
- jobj.children().last().click(find_on_click);
- jobj.append('<input type="submit" value="'+ipa_messages.button.delete+ '" />');
- jobj.children().last().click(delete_on_click);
+ ipa_make_button('ui-icon-search',ipa_messages.button.find).
+ click(find_on_click).appendTo(jobj);
+
+ ipa_make_button('ui-icon-trash',ipa_messages.button.delete).
+ click(delete_on_click_outer).appendTo(jobj);
+
div.append('<span class="search-buttons"></span>');
var search_results = $('<div/>', {
diff --git a/install/static/serverconfig.js b/install/static/serverconfig.js
index 1d25a3b08..a73eb1349 100644
--- a/install/static/serverconfig.js
+++ b/install/static/serverconfig.js
@@ -37,13 +37,13 @@ ipa_entity_set_add_definition('aci', [
]);
ipa_entity_set_details_definition('aci', [
- {name:'ipaserver', label:'Aci Details', fields:[
- {name:'cn', label:'Name'},
- {name:'description', label:'Description'}
- ]}
+ ipa_stanza({name:'ipaserver', label:'Aci Details'}).
+ input({name:'cn', label:'Name'}).
+ input({name:'description', label:'Description'})
]);
+
/* Taskgroup*/
ipa_entity_set_search_definition('taskgroup', [
@@ -59,11 +59,11 @@ ipa_entity_set_add_definition('taskgroup', [
]
]);
+
ipa_entity_set_details_definition('taskgroup', [
- {name:'ipaserver', label:'Taskgroup Details', fields:[
- {name:'cn', label:'Name'},
- {name:'description', label:'Description'}
- ]}
+ ipa_stanza({name:'ipaserver', label:'Taskgroup Details'}).
+ input({name:'cn', label:'Name'}).
+ input({name:'description', label:'Description'})
]);
ipa_entity_set_association_definition('rolegroup', {
@@ -89,10 +89,9 @@ ipa_entity_set_add_definition('rolegroup', [
]);
ipa_entity_set_details_definition('rolegroup', [
- {name:'ipaserver', label:'Rolegroup Details', fields:[
- {name:'cn', label:'Name'},
- {name:'description', label:'Description'}
- ]}
+ ipa_stanza({name:'ipaserver', label:'Rolegroup Details'}).
+ input({name:'cn', label:'Name'}).
+ input({name:'description', label:'Description'})
]);
ipa_entity_set_association_definition('rolegroup', {
@@ -101,18 +100,18 @@ ipa_entity_set_association_definition('rolegroup', {
/* Configuration */
ipa_entity_set_details_definition('config',[
- {name:'ipaserver', label:'Configuration', fields:[
- {name:'cn', label:'Name'},
- {name:'description', label:'Description'},
- {name:'ipacertificatesubjectbase', label:'Certificat Subject Base'},
- {name:'ipadefaultloginshell', label:'Default Login Shell'},
- {name:'ipadefaultprimarygroup', label:'Default Primary Group'},
- {name:'ipagroupsearchfields', label:'Group Search Fields'},
- {name:'ipahomesrootdir', label:'Home Root Dir'},
- {name:'ipamaxusernamelength', label:'Max Username Length'},
- {name:'ipamigrationenabled', label:'Migration enabled?'},
- {name:'ipasearchrecordslimit', label:'Search Record Limit'},
- {name:'ipasearchtimelimit', label:'Search Time Limit'},
- {name:'ipausersearchfields', label:'User Search Fields'}
- ]}
+
+ ipa_stanza({name:'ipaserver', lable:'Configuration'}).
+ input({name:'cn', label:'Name'}).
+ input({name:'description', label:'Description'}).
+ input({name:'ipacertificatesubjectbase', label:'Certificat Subject Base'}).
+ input({name: 'ipadefaultloginshell', label:'Default Login Shell'}).
+ input({name:'ipadefaultprimarygroup', label:'Default Primary Group'}).
+ input({name:'ipagroupsearchfields', label:'Group Search Fields'}).
+ input({name:'ipahomesrootdir', label:'Home Root Dir'}).
+ input({name:'ipamaxusernamelength', label:'Max Username Length'}).
+ input({name:'ipamigrationenabled', label:'Migration enabled?'}).
+ input({name:'ipasearchrecordslimit', label:'Search Record Limit'}).
+ input({name:'ipasearchtimelimit', label:'Search Time Limit'}).
+ input({name:'ipausersearchfields', label:'User Search Fields'})
]);
diff --git a/install/static/service.js b/install/static/service.js
index 0afcb4688..7b81c4d2e 100644
--- a/install/static/service.js
+++ b/install/static/service.js
@@ -34,12 +34,16 @@ ipa_entity_set_add_definition('service', [
]);
ipa_entity_set_details_definition('service', [
- {name:'identity', label:'Service Details', fields:[
- {name:'krbprincipalname', label:'Principal', setup:service_krbprincipalname_setup, load:service_krbprincipalname_load},
- {name:'service', label:'Service', load:service_service_load},
- {name:'host', label:'Host Name', load:service_host_load},
- {name:'usercertificate', label:'Certificate', load:service_usercertificate_load, save:service_usercertificate_save}
- ]}
+ ipa_stanza({name:'identity', label:'Service Details'}).
+ input({name:'krbprincipalname',
+ label:'Principal',
+ setup:service_krbprincipalname_setup,
+ load:service_krbprincipalname_load}).
+ input({name:'service', label:'Service', load:service_service_load}).
+ input({name:'host', label:'Host Name', load:service_host_load}).
+ input({name:'usercertificate', label:'Certificate',
+ load:service_usercertificate_load,
+ save:service_usercertificate_save})
]);
function service_add_krbprincipalname(add_dialog, mode) {
@@ -59,25 +63,25 @@ function service_krbprincipalname_setup(container, dl, section) {
// skip krbprincipalname
}
-function service_krbprincipalname_load(dt, result) {
+function service_krbprincipalname_load(container, dt, result) {
// skip krbprincipalname
}
-function service_service_load(dt, result) {
+function service_service_load(container, dt, result) {
var krbprincipalname = result['krbprincipalname'][0];
var service = krbprincipalname.replace(/\/.*$/, '');
var dd = ipa_create_first_dd(this.name, service);
dt.after(dd);
}
-function service_host_load(dt, result) {
+function service_host_load(container, dt, result) {
var krbprincipalname = result['krbprincipalname'][0];
var host = krbprincipalname.replace(/^.*\//, '');
var dd = ipa_create_first_dd(this.name, host);
dt.after(dd);
}
-function service_usercertificate_load(dt, result) {
+function service_usercertificate_load(container, dt, result) {
var textarea = $("<textarea/>", {
title: 'usercertificate',
style: 'width: 300px; height: 200px;'
diff --git a/install/static/test/data/json_metadata.json b/install/static/test/data/json_metadata.json
index 4a732ac5f..cd617b48e 100644
--- a/install/static/test/data/json_metadata.json
+++ b/install/static/test/data/json_metadata.json
@@ -5,14 +5,12 @@
"messages": {
"button": {
"add": "Add",
+ "delete": "Delete",
"enroll": "Enroll",
"find": "Find",
"reset": "Reset",
"update": "Update"
},
- "search":{
- "quick_links":"Quick Links"
- },
"details": {
"account": "Account Details",
"contact": "Contact Details",
@@ -22,9 +20,14 @@
"misc": "Misc. Information",
"to_top": "Back to Top"
},
-
"login": {
"header": "Logged In As"
+ },
+ "search": {
+ "delete_confirm": "Do you really want to delete the selected entries?",
+ "quick_links": "Quick Links",
+ "select_all": "Select All",
+ "unselect_all": "Unselect All"
}
},
"metadata": {
@@ -149,7 +152,7 @@
"objectclass",
"aci"
],
- "label": "Automount Location",
+ "label": "Automount",
"methods": [
"add",
"del",
@@ -2865,6 +2868,89 @@
"query": false,
"required": true,
"type": "unicode"
+ }
+ ],
+ "uuid_attribute": "ipauniqueid"
+ },
+ "sudocmd": {
+ "attribute_members": {},
+ "container_dn": "cn=sudocmds,cn=accounts",
+ "default_attributes": [
+ "cn",
+ "description"
+ ],
+ "hidden_attributes": [
+ "objectclass",
+ "aci"
+ ],
+ "label": "SudoCmds",
+ "methods": [
+ "add",
+ "del",
+ "find",
+ "mod",
+ "show"
+ ],
+ "name": "sudocmd",
+ "object_class": [
+ "ipaobject",
+ "ipasudocmd"
+ ],
+ "object_class_config": null,
+ "object_name": "sudocmd",
+ "object_name_plural": "sudocmds",
+ "parent_object": "",
+ "primary_key": "cn",
+ "takes_params": [
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "command",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Sudo Command",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Sudo Command",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "cn",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": true,
+ "query": false,
+ "required": true,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "desc",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "A description of this command",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Description",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "description",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
},
{
"attribute": false,
@@ -2894,6 +2980,470 @@
],
"uuid_attribute": "ipauniqueid"
},
+ "sudocmdgroup": {
+ "attribute_members": {
+ "member": [
+ "sudocmd",
+ "sudocmdgroup"
+ ],
+ "memberof": [
+ "sudocmdgroup"
+ ]
+ },
+ "container_dn": "cn=sudocmdgroups,cn=accounts",
+ "default_attributes": [
+ "cn",
+ "description",
+ "member",
+ "memberof"
+ ],
+ "hidden_attributes": [
+ "objectclass",
+ "aci"
+ ],
+ "label": "Sudo Command Groups",
+ "methods": [
+ "add",
+ "add_member",
+ "del",
+ "find",
+ "mod",
+ "remove_member",
+ "show"
+ ],
+ "name": "sudocmdgroup",
+ "object_class": [
+ "ipaobject",
+ "ipasudocmdgrp"
+ ],
+ "object_class_config": null,
+ "object_name": "sudocmdgroup",
+ "object_name_plural": "sudocmdgroups",
+ "parent_object": "",
+ "primary_key": "cn",
+ "takes_params": [
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "name",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Sudo Command Group name",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Sudo Command Group name",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "cn",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": true,
+ "query": false,
+ "required": true,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "desc",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Group description",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Description",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "description",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": true,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "membercmd_sudocmd",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Commands",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Commands",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "membercmd_sudocmd",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "membercmd_sudocmdgroup",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Sudo Command Groups",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Sudo Command Groups",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "membercmd_sudocmdgroup",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ }
+ ],
+ "uuid_attribute": "ipauniqueid"
+ },
+ "sudorule": {
+ "attribute_members": {
+ "memberallowcmd": [
+ "sudocmd",
+ "sudocmdgroup"
+ ],
+ "memberdenycmd": [
+ "sudocmd",
+ "sudocmdgroup"
+ ],
+ "memberhost": [
+ "host",
+ "hostgroup"
+ ],
+ "memberuser": [
+ "user",
+ "group"
+ ]
+ },
+ "container_dn": "cn=sudorules",
+ "default_attributes": [
+ "cn",
+ "description"
+ ],
+ "hidden_attributes": [
+ "objectclass",
+ "aci"
+ ],
+ "label": "SudoRule",
+ "methods": [
+ "add",
+ "add_allow_command",
+ "add_deny_command",
+ "add_host",
+ "add_user",
+ "del",
+ "find",
+ "mod",
+ "remove_allow_command",
+ "remove_deny_command",
+ "remove_host",
+ "remove_user",
+ "show"
+ ],
+ "name": "sudorule",
+ "object_class": [
+ "ipaassociation",
+ "ipasudorule"
+ ],
+ "object_class_config": null,
+ "object_name": "Sudo Rule",
+ "object_name_plural": "Sudo Rules",
+ "parent_object": "",
+ "primary_key": "cn",
+ "takes_params": [
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "name",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Rule name",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Rule name",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "cn",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": true,
+ "query": false,
+ "required": true,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "desc",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Description",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Description",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "description",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "memberuser_user",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Users",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Users",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "memberuser_user",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "memberhost_host",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Hosts",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Hosts",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "memberhost_host",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "memberhost_hostgroup",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Host Groups",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Host Groups",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "memberhost_hostgroup",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "memberallowcmd_sudocmd",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Sudo Allow Commands",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Sudo Allow Commands",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "memberallowcmd_sudocmd",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "memberdenycmd_sudocmd",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Sudo Deny Commands",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Sudo Deny Commands",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "memberdenycmd_sudocmd",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "memberallowcmd_sudocmdgroup",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Sudo Command Groups",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Sudo Command Groups",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "memberallowcmd_sudocmdgroup",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "memberdenycmd_sudocmdgroup",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Sudo Command Groups",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Sudo Command Groups",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "memberdenycmd_sudocmdgroup",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ }
+ ],
+ "uuid_attribute": "ipauniqueid"
+ },
"taskgroup": {
"attribute_members": {
"member": [
@@ -3102,11 +3652,11 @@
"methods": [
"add",
"del",
+ "disable",
+ "enable",
"find",
- "lock",
"mod",
- "show",
- "unlock"
+ "show"
],
"name": "user",
"object_class": [
@@ -3128,7 +3678,7 @@
"doc": "User login",
"exclude": null,
"flags": [],
- "hint": "Numeric user Identifer",
+ "hint": null,
"include": null,
"label": "User login",
"length": null,
@@ -3507,6 +4057,106 @@
"query": false,
"required": false,
"type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "phone",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Telephone Number",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Telephone Number",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": true,
+ "name": "telephonenumber",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "mobile",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Mobile Telephone Number",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Mobile Telephone Number",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": true,
+ "name": "mobile",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "pager",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Pager Number",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Pager Number",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": true,
+ "name": "pager",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "fax",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Fax Number",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Fax Number",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": true,
+ "name": "facsimiletelephonenumber",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
}
],
"uuid_attribute": "ipauniqueid"
diff --git a/install/static/test/data/user_mod.json b/install/static/test/data/user_mod.json
new file mode 100644
index 000000000..87c256273
--- /dev/null
+++ b/install/static/test/data/user_mod.json
@@ -0,0 +1,32 @@
+{
+ "error": null,
+ "id": 6,
+ "result": {
+ "result": {
+ "givenname": [
+ "Kermit"
+ ],
+ "homedirectory": [
+ "/home/kfrog"
+ ],
+ "loginshell": [
+ "/bin/sh"
+ ],
+ "memberof_group": [
+ "ipausers",
+ "muppets"
+ ],
+ "sn": [
+ "Frog"
+ ],
+ "title": [
+ "reporter"
+ ],
+ "uid": [
+ "kfrog"
+ ]
+ },
+ "summary": "Modified user \"kfrog\"",
+ "value": "kfrog"
+ }
+} \ No newline at end of file
diff --git a/install/static/test/data/user_show.json b/install/static/test/data/user_show.json
index 149b24f68..d3e324fde 100644
--- a/install/static/test/data/user_show.json
+++ b/install/static/test/data/user_show.json
@@ -1,17 +1,20 @@
{
"error": null,
- "id": 0,
+ "id": 6,
"result": {
"result": {
"cn": [
"Kermit Frog"
],
- "dn": "uid=kfrog,cn=users,cn=accounts,dc=idm,dc=lab,dc=bos,dc=redhat,dc=com",
+ "dn": "uid=kfrog,cn=users,cn=accounts,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
+ "facsimiletelephonenumber": [
+ "415-111-0990"
+ ],
"gecos": [
"kfrog"
],
"gidnumber": [
- "1079249051"
+ "1155230701"
],
"givenname": [
"Kermit"
@@ -20,27 +23,23 @@
"/home/kfrog"
],
"ipauniqueid": [
- "41bcf085-8baa-11df-8155-00163e26b89e"
+ "ddbc79a1-cd9a-11df-98ae-525400674dcd"
],
"krbprincipalname": [
- "kfrog@IDM.LAB.BOS.REDHAT.COM"
+ "kfrog@AYOUNG.BOSTON.DEVEL.REDHAT.COM"
],
"loginshell": [
"/bin/sh"
],
"mail": [
- "kfrog@redhat.com"
- ],
- "memberof": [
- "cn=ipausers,cn=groups,cn=accounts,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
- "cn=muppets,cn=groups,cn=accounts,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com"
- ],
- "memberof_group": [
- "ipausers",
- "muppets"
- ],
+ "kermit@muppets.com"
+ ],
+ "memberof_group": [
+ "ipausers",
+ "muppets"
+ ],
"mepmanagedentry": [
- "cn=kfrog,cn=groups,cn=accounts,dc=idm,dc=lab,dc=bos,dc=redhat,dc=com"
+ "cn=kfrog,cn=groups,cn=accounts,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com"
],
"objectclass": [
"top",
@@ -55,17 +54,25 @@
"ipaobject",
"mepOriginEntry"
],
+ "pager": [
+ "415-333-1882"
+ ],
"sn": [
"Frog"
],
+ "telephonenumber": [
+ "212-555-4444",
+ "415-333-1882",
+ "415-111-0990"
+ ],
"uid": [
"kfrog"
],
"uidnumber": [
- "1079249051"
+ "1155230701"
]
},
"summary": null,
"value": "kfrog"
}
-}
+} \ No newline at end of file
diff --git a/install/static/test/details_tests.html b/install/static/test/details_tests.html
index e1b35251c..7c323610c 100644
--- a/install/static/test/details_tests.html
+++ b/install/static/test/details_tests.html
@@ -9,6 +9,8 @@
<script type="text/javascript" src="../jquery-ui.js"></script>
<script type="text/javascript" src="../ipa.js"></script>
<script type="text/javascript" src="../details.js"></script>
+ <script type="text/javascript" src="../entity.js"></script>
+
<script type="text/javascript" src="details_tests.js"></script>
</head>
<body>
diff --git a/install/static/test/details_tests.js b/install/static/test/details_tests.js
index 1a7efc10b..78d633634 100644
--- a/install/static/test/details_tests.js
+++ b/install/static/test/details_tests.js
@@ -19,40 +19,149 @@
*/
-
test("Testing ipa_details_create().", function() {
- var fields = [
- {name:'cn', label:'Entity Name'},
- {name:'description', label:'Description'},
- {name:'number', label:'Entity ID'}
- ];
-
- var sections = [
- {name:'identity', label:'Entity Details', fields:fields}
- ];
-
- var identity = sections[0];
- var key = 'entity';
-
- var container = $("<div/>",{id: key});
- ipa_details_create(container, sections);
-
- same(
- container[0].title, key,
- "Checking container name"
- );
-
- var dl = container.find('dl#identity');
- ok(
- dl,
- "Checking section"
- );
-
- same(
- dl[0].children.length, fields.length,
- "Checking fields"
- );
+ var name = 'NAMENAMENAME';
+ var identity = 'IDIDID';
+
+ var section = ipa_stanza({name:identity, label:name}).
+ input({name:'cn', label:'Entity Name'}).
+ input({name:'description', label:'Description'}).
+ input({name:'number', label:'Entity ID'});
+
+
+ var details = section.fields;
+ var parent = $("<div/>");
+ var container = $("<div title='entity'/>");
+ parent.append(container);
+ ipa_details_section_setup(parent,container, section);
+
+ ok(parent.find('hr').length);
+
+ var h2= parent.find('h2');
+ ok(h2.length);
+ ok(h2[0].innerHTML.indexOf(name) > 1,"find name in html");
+
+ var dl = parent.find('dl');
+ ok(dl.length);
+ same(dl[0].children.length,3,"children tag count");
+ same(dl[0].id, identity,"identity");
+ same(details[0].name, dl[0].children[0].title,"name");
+ var d = dl[0].children[0].innerHTML;
+ same(details[0].label+":",d);
+ same(details[2].name,dl[0].children[2].title);
+ d = dl[0].children[2].innerHTML;
+ same(details[2].label+":" ,d);
+
+});
+
+
+
+test("Testing details lifecycle:setup, load, save ().", function(){
+
+ var setup_status_called = false;
+ var save_password_called= false;
+ var load_manager_called = false;
+ var load_success_called = false;
+ var load_failure_called = false;
+ var update_success_called = false;
+ var update_failure_called = false;
+
+ function setup_status(){
+ setup_status_called = true;
+ }
+
+ function save_password(){
+ save_password_called = true;
+ return [];
+ }
+
+ function load_manager(){
+ load_manager_called = true;
+ }
+
+ function setup_st(){
+ }
+ var container = $("<div/>");
+ var obj_name = 'user';
+ ipa_entity_set_details_definition(obj_name, [
+ ipa_stanza({name:'identity', label:'Identity Details'}).
+ input({name:'title', label: 'Title'}).
+ input({name:'givenname', label:'First Name'}).
+ input({name:'sn', label:'Last Name'}).
+ input({name:'cn', label:'Full Name'}).
+ input({name:'displayname', label:'Dispaly Name'}).
+ input({name:'initials', label:'Initials'}),
+ ipa_stanza({name:'account', label:'Account Details'}).
+ input({name:'status', label:'Account Status', setup: setup_status}).
+ input({name:'uid', label:'Login'}).
+ input({name:'userpassword', label:'Password', save: save_password}).
+ input({name:'uidnumber', label:'UID'}).
+ input({name:'gidnumber', label:'GID'}).
+ input({name:'homedirectory', label:'homedirectory'}),
+ ipa_stanza({name:'contact', label:'Contact Details'}).
+ input({name:'mail', label:'E-mail Address'}).
+ input({name:'telephonenumber', label:'Numbers'}),
+ ipa_stanza({name:'address', label:'Mailing Address'}).
+ input({name:'street', label:'Address'}).
+ input({name:'location', label:'City'}).
+ input({name:'state', label:'State', setup: setup_st}).
+ input({name:'postalcode', label:'ZIP'}),
+ ipa_stanza({name:'employee', label:'Employee Information'}).
+ input({name:'ou', label:'Org. Unit'}).
+ input({name:'manager', label:'Manager', load: load_manager}),
+ ipa_stanza({name:'misc', label:'Misc. Information'}).
+ input({name:'carlicense', label:'Car License'})
+ ]);
+
+ ipa_details_create(container, ipa_entity_details_list[obj_name]);
+
+ var contact = container.find('dl#contact.entryattrs');
+ ok(contact);
+ var identity = container.find('dl#identity.entryattrs');
+ ok(identity);
+ var dts= identity.find('dt');
+ ok(dts);
+ same(6, dts.length);
+ same('initials',dts[5].title);
+
+ //TODO extract into Fixture
+ ipa_ajax_options["async"] = false;
+ $.ajaxSetup(ipa_ajax_options);
+ ipa_json_url = './data';
+ ipa_use_static_files = true;
+
+ container.attr('id','user');
+
+ ok (setup_status_called , 'setup status called');
+
+
+ ipa_details_load(container,
+ 'kfrog',
+ function(){load_success_called = true},
+ function(){load_failure_called = true})
+
+ ok (load_success_called,'load success called');
+ ok (!load_failure_called,'load failure not called');
+
+
+ ok (load_manager_called, 'load manager called');
+
+
+ ipa_details_load(container,
+ 'kfrog',
+ function(){load_success_called = true},
+ function(){load_failure_called = true})
+
+
+ ipa_details_update(container,
+ 'kfrog',
+ function(){update_success_called = true},
+ function(){update_failure_called = true})
+
+ ok (update_success_called,'update success called');
+ ok (!update_failure_called,'update failure not called');
+ ok (save_password_called, 'save password called');
});
@@ -64,27 +173,22 @@ test("Testing _ipa_create_text_input().", function(){
var input = _ipa_create_text_input(name, value);
ok(input,"input not null");
- same(input[0].name,name );
- same(input[0].value,value );
- same(input[0].type,"text" );
-});
+ var text = input.find('input');
+ ok(text);
+ same(text[0].name,name );
+ same(text[0].value,value );
+ same(text[0].type,"text" );
+});
test("Testing ipa_details_section_setup()",function(){
- var fields = [
- {name:'cn', label:'Entity Name'},
- {name:'description', label:'Description'},
- {name:'number', label:'Entity ID'}
- ];
-
- var section = {
- name: 'IDIDID',
- label: 'NAMENAMENAME',
- fields: fields
- };
-
+ var section = ipa_stanza({name: 'IDIDID', label: 'NAMENAMENAME'}).
+ input({name:'cn', label:'Entity Name'}).
+ input({name:'description', label:'Description'}).
+ input({name:'number', label:'Entity ID'});
+ var fields = section.fields;
var container = $("<div title='entity'/>");
var details = $("<div/>");
container.append(details);
@@ -106,4 +210,4 @@ test("Testing ipa_details_section_setup()",function(){
same(dl[0].children[2].title, fields[2].name);
same(dl[0].children[2].innerHTML, fields[2].label+":");
-}); \ No newline at end of file
+});
diff --git a/install/static/user.js b/install/static/user.js
index 34ced1ef1..e651d242c 100644
--- a/install/static/user.js
+++ b/install/static/user.js
@@ -38,40 +38,40 @@ ipa_entity_set_add_definition('user', [
]
]);
+
ipa_entity_set_details_definition('user', [
- {name:'identity', label:'Identity Details', fields:[
- {name:'title', label:'Title'},
- {name:'givenname', label:'First Name'},
- {name:'sn', label:'Last Name'},
- {name:'cn', label:'Full Name'},
- {name:'displayname', label:'Dispaly Name'},
- {name:'initials', label:'Initials'}
- ]},
- {name:'account', label:'Account Details', fields:[
- {name:'status', label:'Account Status', load:user_status_load},
- {name:'uid', label:'Login'},
- {name:'userpassword', label:'Password', load:user_password_load},
- {name:'uidnumber', label:'UID'},
- {name:'gidnumber', label:'GID'},
- {name:'homedirectory', label:'homedirectory'}
- ]},
- {name:'contact', label:'Contact Details', fields:[
- {name:'mail', label:'E-mail Address'},
- {name:'telephonenumber', label:'Numbers', load:user_telephonenumber_load}
- ]},
- {name:'address', label:'Mailing Address', fields:[
- {name:'street', label:'Address'},
- {name:'location', label:'City'},
- {name:'state', label:'State', load:user_state_load},
- {name:'postalcode', label:'ZIP'}
- ]},
- {name:'employee', label:'Employee Information', fields:[
- {name:'ou', label:'Org. Unit'},
- {name:'manager', label:'Manager', load:user_manager_load}
- ]},
- {name:'misc', label:'Misc. Information', fields:[
- {name:'carlicense', label:'Car License'}
- ]}
+ ipa_stanza({name:'identity', label:'Identity Details'}).
+ input({name:'title', label: 'Title'}).
+ input({name:'givenname', label:'First Name'}).
+ input({name:'sn', label:'Last Name'}).
+ input({name:'cn', label:'Full Name'}).
+ input({name:'displayname', label:'Dispaly Name'}).
+ input({name:'initials', label:'Initials'}),
+ ipa_stanza({name:'account', label:'Account Details'}).
+ input({name:'status', label:'Account Status', load:user_status_load}).
+ input({name:'uid', label:'Login'}).
+ input({name:'userpassword',
+ label:'Password',
+ load: user_password_load}).
+ input({name:'uidnumber', label:'UID'}).
+ input({name:'gidnumber', label:'GID'}).
+ input({name:'homedirectory', label:'homedirectory'}),
+ ipa_stanza({name:'contact', label:'Contact Details'}).
+ input({name:'mail', label:'E-mail Address'}).
+ input({name:'telephonenumber', label:'Phone Numbers'}).
+ input({name:'pager', label:'Pager Numbers'}).
+ input({name:'mobile', label:'Mobile Phone Numbers'}).
+ input({name:'facsimiletelephonenumber', label:'Fax Numbers'}),
+ ipa_stanza({name:'address', label:'Mailing Address'}).
+ input({name:'street', label:'Address'}).
+ input({name:'location', label:'City'}).
+ input({name:'state', label:'State', load:user_state_load}).
+ input({name:'postalcode', label:'ZIP'}),
+ ipa_stanza({name:'employee', label:'Employee Information'}).
+ input({name:'ou', label:'Org. Unit'}).
+ input({name:'manager', label:'Manager'}),
+ ipa_stanza({name:'misc', label:'Misc. Information'}).
+ input({name:'carlicense', label:'Car License'})
]);
ipa_entity_set_association_definition('user', {
@@ -151,7 +151,7 @@ function on_lock_win(data, textStatus, xhr)
/* ATTRIBUTE CALLBACKS */
var toggle_temp = 'S <a href="jslink" onclick="return (toggle_on_click(this))" title="S">Toggle</a>';
-function user_status_load(dt, result)
+function user_status_load(container, dt, result)
{
var memberof = result['memberof'];
var dd;
@@ -172,7 +172,7 @@ function user_status_load(dt, result)
}
var pwd_temp = '<a href="jslink" onclick="return (resetpwd_on_click(this))" title="A">Reset Password</a>';
-function user_password_load(dt, result)
+function user_password_load(container, dt, result)
{
var dd = ipa_create_first_dd(this.name, pwd_temp.replace('A', 'userpassword'));
dt.after(dd);
@@ -188,7 +188,7 @@ var states = [
'PA', 'PR', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VI', 'VA',
'WA', 'WV', 'WI', 'WY', ''
];
-function user_state_load(dt, result)
+function user_state_load(container, dt, result)
{
var next = dt.next();
next.css('clear', 'none');
@@ -208,10 +208,4 @@ function user_state_load(dt, result)
sel.val('');
}
-function user_telephonenumber_load(dt, result)
-{
-}
-function user_manager_load(dt, result)
-{
-}