From d389e054f6173194daabc08ad3abd366005048bd Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Wed, 2 Feb 2011 10:35:23 -0600 Subject: Added undo for permission target. https://fedorahosted.org/freeipa/ticket/885 --- install/ui/aci.js | 314 ++++++++++++++++++++++++++---------------------------- 1 file changed, 151 insertions(+), 163 deletions(-) (limited to 'install/ui/aci.js') diff --git a/install/ui/aci.js b/install/ui/aci.js index 67c2d5f8..03673123 100644 --- a/install/ui/aci.js +++ b/install/ui/aci.js @@ -24,7 +24,7 @@ /* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */ -IPA.attribute_table_widget = function(spec) { +IPA.attributes_widget = function(spec) { spec = spec || {}; @@ -35,38 +35,43 @@ IPA.attribute_table_widget = function(spec) { var id = spec.name; var dd_class = "other"; - that.create = function(container){ + that.create = function(container) { var dd = $('
', { 'class': dd_class }).appendTo(container); - var span = $('', { - name: 'attrs' - }).appendTo(dd); - that.table = $('', { id:id, - 'class':'search-table aci-attribute-table'}). + 'class':'search-table aci-attribute-table' + }). append(''). - append($('')). - appendTo(span); + append(''). + appendTo(dd); var tr = $('').appendTo($('thead', that.table)); - tr.append($(''); + + if (that.undo) { + that.create_undo(dd); + } + if (that.object_type){ that.populate (that.object_type); } - }; that.load = function(record) { @@ -85,11 +90,11 @@ IPA.attribute_table_widget = function(spec) { that.update = function() { that.populate(that.object_type); - that.checkboxes_update(); that.append(); + that.checkboxes_update(); }; - that.populate = function(object_type){ + that.populate = function(object_type) { $('tbody tr', that.table).remove(); @@ -100,22 +105,21 @@ IPA.attribute_table_widget = function(spec) { var aciattrs = metadata.aciattrs; - var attr_per_col = 400; - var col_span = aciattrs.length / attr_per_col + 1; - var tbody = $('tbody', that.table); - var td; - for (var a = 0; a < aciattrs.length ; a += 1){ - var value = aciattrs[a].toLowerCase(); - var aci_tr = $('').appendTo(tbody); - td = $('
',{ + tr.append($('', { style:"height:2em; vertical-align:bottom;", html:$('',{ type: "checkbox", click: function(){ $('.aci-attribute'). attr('checked', $(this).attr('checked')); - }}) + }, + change: function() { + that.show_undo(); + } + }) })). append('Attribute
').appendTo(aci_tr); + for (var i=0; i').appendTo(tbody); + + var td = $('').appendTo(aci_tr); td.append($('',{ type: 'checkbox', - id: 'aciattr-'+value, - name: 'attrs', + name: that.name, value: value, - 'class': 'aci-attribute' + 'class': 'aci-attribute', + change: function() { + that.show_undo(); + } })); td = $('').appendTo(aci_tr); td.append($('').appendTo(tr); @@ -165,47 +169,24 @@ IPA.attribute_table_widget = function(spec) { return that; }; - - -IPA.type_widget = function(spec) { - - spec = spec || {}; - - var that = IPA.select_widget(spec); - - that.filter = spec.filter || ''; - - that.create = function(container) { - that.select = $('', { type: 'checkbox', - id: rights[i], name: that.name, - value: rights[i], + value: that.rights[i], 'class': that.entity_name +'_'+ that.name })). append($('