From c854435a27e0595c17661e80d38d5fa0016f8c96 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Thu, 4 Nov 2010 21:42:37 -0500 Subject: HBAC Access Time IPA commands now can be defined in these classes: - ipa_command: a single IPA command - ipa_batch_command: a batch command for executing multiple commands on the server side using the new batch plugin The dialog boxes for adding and removing entries have been refactored: - ipa_dialog: base class for dialog boxes - ipa_adder_dialog: generic adder dialog box - ipa_deleter_dialog: generic deleter dialog box - ipa_association_adder_dialog: adding entity association - ipa_association_deleter_dialog: removing entity association Dialog boxes for adding/deleting HBAC users, hosts, services, and sourcehosts are implemented using the association dialog boxes. The dialog box for adding access time is implemented using ipa_dialog and currently contains only a text field. This will be replaced with a custom dialog box in a separate patch. The dialog box for removing access time is implemented using the generic deleter class because it's not an association. Removing multiple access times is implemented using batch operations. New test data files for access times have been added. --- install/static/widget.js | 308 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 296 insertions(+), 12 deletions(-) (limited to 'install/static/widget.js') diff --git a/install/static/widget.js b/install/static/widget.js index 73969432..af17b930 100755 --- a/install/static/widget.js +++ b/install/static/widget.js @@ -72,16 +72,9 @@ function ipa_text_widget(spec) { spec = spec || {}; - spec.setup = spec.setup || setup; - spec.load = spec.load || load; - spec.save = spec.save || save; - var that = ipa_widget(spec); - function setup(container) { - } - - function load(container, result) { + that.load = function(container, result) { that.value = result[that.name] || ''; var input = $('input[name="'+that.name+'"]', container); @@ -92,9 +85,9 @@ function ipa_text_widget(spec) { } else { input.val(that.value); } - } + }; - function save(container) { + that.save = function(container) { var values = []; if (that.value) { @@ -106,7 +99,7 @@ function ipa_text_widget(spec) { } return values; - } + }; return that; } @@ -469,5 +462,296 @@ function ipa_table_widget(spec) { that.create_column(spec.columns[i]); } } + + return that; +} + +/** + * This is a base class for dialog boxes. + */ +function ipa_dialog(spec) { + + spec = spec || {}; + + var that = {}; + + that.title = spec.title; + that.parent = spec.parent; + that._entity_name = spec.entity_name; + + that.container = $('
').appendTo(that.parent); + that.width = spec.width || 400; + + that.buttons = {}; + + that.fields = []; + that.fields_by_name = {}; + + that.super = function(name) { + var method = that[name]; + return function () { + return method.apply(that, arguments); + }; + }; + + that.__defineGetter__("entity_name", function(){ + return that._entity_name; + }); + + that.__defineSetter__("entity_name", function(entity_name){ + that._entity_name = entity_name; + + for (var i=0; i').appendTo(that.container); + + that.filter_field = $('', { + type: 'text' + }).appendTo(search_panel); + + that.find_button = $('', { + type: 'button', + value: 'Find' + }).appendTo(search_panel); + + var results_panel = $('
').appendTo(that.container); + results_panel.css('border', '2px solid rgb(0, 0, 0)'); + results_panel.css('position', 'relative'); + results_panel.css('height', '200px'); + + var available_panel = $('
').appendTo(results_panel); + available_panel.css('float', 'left'); + + $('
', { + text: 'Available' + }).appendTo(available_panel); + + that.available_list = $('', { + type: 'button', + value: '<<' + }).appendTo(p); + + p = $('

').appendTo(buttons_panel); + that.add_button = $('', { + type: 'button', + value: '>>' + }).appendTo(p); + + var selected_panel = $('

').appendTo(results_panel); + selected_panel.css('float', 'left'); + + $('
', { + text: 'Prospective' + }).appendTo(selected_panel); + + that.selected_list = $('