diff --git a/install/static/associate.js b/install/static/associate.js index 641409a8f..7dd81caec 100644 --- a/install/static/associate.js +++ b/install/static/associate.js @@ -244,7 +244,6 @@ function ipa_association_widget(spec) { that.other_entity = spec.other_entity; that.superior_create = that.superior('create'); - that.superior_setup = that.superior('setup'); that.create = function(container) { @@ -258,25 +257,42 @@ function ipa_association_widget(spec) { that.superior_create(container); - var div = $('#'+that.id, container); - var buttons = $('').appendTo($('.action-panel')); //TODO replace with ipa_button + var ul = $('.action-panel ul'); + var li = $('
').appendTo(ul); + // creating generic buttons for layout $('', { 'type': 'button', 'name': 'remove', 'value': IPA.messages.button.remove - }).appendTo(buttons); + }).appendTo(li); $('', { 'type': 'button', 'name': 'add', 'value': IPA.messages.button.enroll - }).appendTo(buttons); + }).appendTo(li); }; that.setup = function(container) { - that.superior_setup(container); + that.table_setup(container); + + // replacing generic buttons with ipa_button and setting click handler + var action_panel = $('.action-panel'); + var button = $('input[name=remove]', action_panel); + button.replaceWith(ipa_button({ + 'label': button.val(), + 'icon': 'ui-icon-trash', + 'click': function() { that.remove(that.container); } + })); + + button = $('input[name=add]', action_panel); + button.replaceWith(ipa_button({ + 'label': button.val(), + 'icon': 'ui-icon-plus', + 'click': function() { that.add(that.container) } + })); var entity = IPA.get_entity(that.entity_name); var association = entity.get_association(that.other_entity); @@ -308,18 +324,18 @@ function ipa_association_widget(spec) { 'associator': that.associator, 'method': that.add_method, 'on_success': function() { - that.refresh(container); + that.refresh(that.container); dialog.close(); }, 'on_error': function() { - that.refresh(container); + that.refresh(that.container); dialog.close(); } }); dialog.init(); - dialog.open(container); + dialog.open(that.container); }; that.remove = function(container) { @@ -344,18 +360,18 @@ function ipa_association_widget(spec) { 'associator': that.associator, 'method': that.delete_method, 'on_success': function() { - that.refresh(container); + that.refresh(that.container); dialog.close(); }, 'on_error': function() { - that.refresh(container); + that.refresh(that.container); dialog.close(); } }); dialog.init(); - dialog.open(container); + dialog.open(that.container); }; that.refresh = function(container) { @@ -374,15 +390,15 @@ function ipa_association_widget(spec) { for (var i = 0; i'+error_thrown.title+'
'); - div.append(''+error_thrown.message+'
'); + var summary = $('span[name=summary]', that.tfoot).empty(); + summary.append('Error: '+error_thrown.name+'
'); + summary.append(''+error_thrown.title+'
'); + summary.append(''+error_thrown.message+'
'); } var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; @@ -407,10 +423,21 @@ function ipa_association_facet(spec) { }; that.create = function(container) { + that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; that.other_entity = $.bbq.getState(that.entity_name + '-enroll', true) || ''; + var label = IPA.metadata[that.other_entity] ? IPA.metadata[that.other_entity].label : that.other_entity; + + that.table = ipa_association_widget({ + 'id': that.entity_name+'-'+that.other_entity, + 'name': 'association', + 'label': label, + 'entity_name': that.entity_name, + 'other_entity': that.other_entity + }); + //TODO I18N var header_message = that.other_entity + '(s) enrolled in ' + that.entity_name + ' ' + that.pkey; @@ -427,13 +454,17 @@ function ipa_association_facet(spec) { 'other_entity': that.other_entity }); - that.table.create(container); + var span = $('', { 'name': 'association' }).appendTo(container); + that.table.create(span); }; - that.setup = function(container, unspecified) { - that.table.setup(container); - that.table.refresh(container); + that.setup = function(container) { + + var span = $('span[name=association]', container); + + that.table.setup(span); + that.table.refresh(); }; return that; diff --git a/install/static/details.js b/install/static/details.js index 612716c35..49957a56d 100644 --- a/install/static/details.js +++ b/install/static/details.js @@ -40,29 +40,26 @@ function ipa_details_field(spec) { var that = ipa_widget(spec); that.create = spec.create || create; - that.setup = spec.setup || setup; that.load = spec.load || load; that.save = spec.save || save; function create(container) { - var dl = $('dl', container); - var title = that.name; var label = ''; + var param_info = ipa_get_param_info(that.entity_name, that.name); if (param_info) label = param_info['label']; + if (!label) label = that.label; + $('', { id: that.name, title: title, html: label + ':' - }).appendTo(dl); - } - - function setup(container) { + }).appendTo(container); } function load(container, result) { @@ -129,10 +126,9 @@ function ipa_details_field(spec) { } function save(container) { - var field = this; var values = []; - var dd = $('dd[title='+field.name+']', container); + var dd = $('dd[title='+that.name+']', container); dd.each(function () { var input = $('input', $(this)); if (!input.length) return; @@ -156,15 +152,12 @@ function ipa_details_section(spec){ spec = spec || {}; var that = {}; + that.name = spec.name || ''; that.label = spec.label || ''; that.template = spec.template; that._entity_name = spec.entity_name; - that.setup = spec.setup || ipa_details_section_setup; - that.create = spec.create || ipa_details_section_create; - that.load = spec.load || ipa_details_section_load; - that.fields = []; that.fields_by_name = {}; @@ -234,6 +227,126 @@ function ipa_details_section(spec){ } }; + that.create = function(container) { + + if (that.template) return; + + var fields = that.fields; + for (var i = 0; i < fields.length; ++i) { + var field = fields[i]; + + var span = $('', { 'name': field.name }).appendTo(container); + field.create(span); + } + }; + + that.setup = function(container) { + + this.container = container; + + if (that.template) return; + + var fields = that.fields; + for (var i = 0; i < fields.length; ++i) { + var field = fields[i]; + + var span = $('span[name='+field.name+']', this.container).first(); + field.setup(span); + } + }; + + that.load = function(result) { + + var fields = that.fields; + + if (that.template) { + var template = IPA.get_template(that.template); + this.container.load( + template, + function(data, text_status, xhr) { + for (var i = 0; i < fields.length; ++i) { + var field = fields[i]; + var span = $('span[name='+field.name+']', this.container).first(); + field.setup(span); + field.load(span, result); + } + } + ); + return; + } + + for (var j=0; j'+error_thrown.title+'
'); - div.append(''+error_thrown.message+'
'); + var summary = $('span[name=summary]', that.tfoot).empty(); + summary.append('Error: '+error_thrown.name+'
'); + summary.append(''+error_thrown.title+'
'); + summary.append(''+error_thrown.message+'
'); } var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; ipa_cmd('show', [pkey], {'rights': true}, on_success, on_error, that.entity_name); }; - that.save = function(container) { - return []; - }; - return that; } @@ -742,21 +997,27 @@ function ipa_hbac_accesstime_widget(spec) { spec = spec || {}; - var that = ipa_table_widget(spec); + var that = ipa_widget(spec); + + that.text = spec.text; + that.options = spec.options || []; that.superior_init = that.superior('init'); that.superior_create = that.superior('create'); that.superior_setup = that.superior('setup'); that.init = function() { - // create a column if none defined - if (!that.columns.length) { - that.create_column({ - 'name': that.name, - 'label': that.label, - 'primary_key': true - }); - } + + that.table = ipa_table_widget({ + 'id': 'accesstime-table', + 'name': 'table', 'label': that.label + }); + + that.table.create_column({ + 'name': that.name, + 'label': that.label, + 'primary_key': true + }); that.superior_init(); }; @@ -765,9 +1026,38 @@ function ipa_hbac_accesstime_widget(spec) { that.superior_create(container); - var div = $('#'+that.id); + var span = $('', { 'name': 'text' }).appendTo(container); - var buttons = $('span[name=buttons]', div); + span.append(that.text); + + for (var i=0; i'+error_thrown.title+'
'); - div.append(''+error_thrown.message+'
'); + var summary = $('span[name=summary]', that.table.tfoot).empty(); + summary.append('Error: '+error_thrown.name+'
'); + summary.append(''+error_thrown.title+'
'); + summary.append(''+error_thrown.message+'
'); } var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; ipa_cmd('show', [pkey], {'rights': true}, on_success, on_error, that.entity_name); }; - that.save = function(container) { - return []; - }; - return that; } diff --git a/install/static/hbacsvc.js b/install/static/hbacsvc.js index 1ff5f0a86..a37c5dde2 100755 --- a/install/static/hbacsvc.js +++ b/install/static/hbacsvc.js @@ -69,8 +69,8 @@ function ipa_hbacsvc_add_dialog(spec) { this.superior_init(); - this.add_field(ipa_text_widget({name:'cn', label:'Name'})); - this.add_field(ipa_text_widget({name:'description', label:'Description'})); + this.add_field(ipa_text_widget({name:'cn', label:'Name', undo: false})); + this.add_field(ipa_text_widget({name:'description', label:'Description', undo: false})); }; return that; @@ -91,12 +91,6 @@ function ipa_hbacsvc_search_facet(spec) { that.create_column({name:'cn', label:'Service', primary_key: true}); that.create_column({name:'description', label:'Description'}); - that.create_column({ - name: 'quick_links', - label: 'Quick Links', - setup: ipa_hbacsvc_quick_links - }); - that.superior_init(); }; @@ -107,31 +101,29 @@ function ipa_hbacsvc_search_facet(spec) { // TODO: replace with IPA.metadata[that.entity_name].label $('', { 'html': 'HBAC Services' }).appendTo(container); - var right_buttons = $('', { - 'style': 'float: right;' - }).appendTo($('.action-panel ul')); + var ul = $('.action-panel ul'); - right_buttons.append(ipa_button({ - 'label': 'HBAC Rules', + $('', { + title: 'hbac', + text: 'HBAC Rules', 'click': function() { var state = {}; state['entity'] = 'hbac'; nav_push_state(state); return false; } - })); + }).appendTo(ul); - right_buttons.append(ipa_button({ - 'label': 'HBAC Service Groups', + $('', { + title: 'hbacsvcgroup', + text: 'HBAC Service Groups', 'click': function() { var state = {}; state['entity'] = 'hbacsvcgroup'; nav_push_state(state); return false; } - })); - - container.append('| - - | -- Access Time - - - - - | -
|---|---|
| - - | -- time - | -
| + + | ++ Access Time + + + + + | +
|---|---|
| + + | ++ time + | +