From 58c1950566f9fb03b61461f40074e47614113194 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Mon, 23 May 2011 17:48:37 -0500 Subject: Fixed URL parameter parsing. The $.bbq.getState() invocations have been modified not to coerce URL parameter values to avoid parsing error. Ticket #1208 --- install/ui/associate.js | 45 ++++++++++++++++++++++++++++++++++----------- install/ui/details.js | 8 ++++---- install/ui/dns.js | 14 +++++++------- install/ui/entity.js | 15 ++++++--------- install/ui/hbac.js | 8 ++++---- install/ui/navigation.js | 2 +- install/ui/rule.js | 2 +- install/ui/search.js | 16 ++++++++-------- install/ui/sudo.js | 12 ++++++------ install/ui/widget.js | 23 ----------------------- 10 files changed, 71 insertions(+), 74 deletions(-) (limited to 'install/ui') diff --git a/install/ui/associate.js b/install/ui/associate.js index b237d326f..3ba510f10 100644 --- a/install/ui/associate.js +++ b/install/ui/associate.js @@ -527,7 +527,7 @@ IPA.association_table_widget = function (spec) { }; that.create_add_dialog = function() { - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var pkey = $.bbq.getState(that.entity_name+'-pkey'); var label = IPA.metadata.objects[that.other_entity].label; var title = IPA.messages.association.add; @@ -575,7 +575,7 @@ IPA.association_table_widget = function (spec) { that.add = function(values, on_success, on_error) { - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var pkey = $.bbq.getState(that.entity_name+'-pkey'); var command = IPA.command({ entity: that.entity_name, @@ -600,7 +600,7 @@ IPA.association_table_widget = function (spec) { return; } - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var pkey = $.bbq.getState(that.entity_name+'-pkey'); var label = IPA.metadata.objects[that.other_entity].label; var title = IPA.messages.association.remove; @@ -638,7 +638,7 @@ IPA.association_table_widget = function (spec) { that.remove = function(values, on_success, on_error) { - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var pkey = $.bbq.getState(that.entity_name+'-pkey'); var command = IPA.command({ entity: that.entity_name, @@ -653,6 +653,29 @@ IPA.association_table_widget = function (spec) { command.execute(); }; + that.refresh = function() { + + function on_success(data, text_status, xhr) { + that.load(data.result.result); + } + + function on_error(xhr, text_status, error_thrown) { + var summary = $('span[name=summary]', that.tfoot).empty(); + summary.append('

Error: '+error_thrown.name+'

'); + summary.append('

'+error_thrown.message+'

'); + } + + var pkey = $.bbq.getState(that.entity_name+'-pkey'); + IPA.command({ + entity: that.entity_name, + method: 'show', + args: [pkey], + options: {'all': true, 'rights': true}, + on_success: on_success, + on_error: on_error + }).execute(); + }; + // methods that should be invoked by subclasses that.association_table_widget_init = that.init; @@ -787,7 +810,7 @@ IPA.association_facet = function (spec) { }; that.is_dirty = function() { - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var pkey = $.bbq.getState(that.entity_name+'-pkey'); return pkey != that.pkey; }; @@ -795,7 +818,7 @@ IPA.association_facet = function (spec) { that.facet_create_header(container); - that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + that.pkey = $.bbq.getState(that.entity_name+'-pkey'); var other_label = IPA.metadata.objects[that.other_entity].label; var title = that.title; @@ -845,7 +868,7 @@ IPA.association_facet = function (spec) { that.show = function() { that.facet_show(); - that.pkey = $.bbq.getState(that.entity_name+'-pkey', true) || ''; + that.pkey = $.bbq.getState(that.entity_name+'-pkey'); that.entity.header.set_pkey(that.pkey); that.entity.header.back_link.css('visibility', 'visible'); @@ -854,7 +877,7 @@ IPA.association_facet = function (spec) { that.show_add_dialog = function() { - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var pkey = $.bbq.getState(that.entity_name+'-pkey'); var label = IPA.metadata.objects[that.other_entity] ? IPA.metadata.objects[that.other_entity].label : that.other_entity; var title = IPA.messages.association.add; @@ -877,7 +900,7 @@ IPA.association_facet = function (spec) { dialog.execute = function() { - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var pkey = $.bbq.getState(that.entity_name+'-pkey'); var associator = that.associator({ 'entity_name': that.entity_name, @@ -915,7 +938,7 @@ IPA.association_facet = function (spec) { return; } - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var pkey = $.bbq.getState(that.entity_name+'-pkey'); var title = IPA.messages.association.remove; title = title.replace('${entity}', that.entity_name); @@ -966,7 +989,7 @@ IPA.association_facet = function (spec) { 'rights': true }; - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var pkey = $.bbq.getState(that.entity_name+'-pkey'); var args =[]; /* TODO: make a general solution to generate this value */ var relationship_filter = 'in_' + that.entity_name; diff --git a/install/ui/details.js b/install/ui/details.js index a62b97fbd..4af837e8e 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -336,7 +336,7 @@ IPA.details_facet = function(spec) { that.facet_create_header(container); - that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + that.pkey = $.bbq.getState(that.entity_name+'-pkey'); var label = IPA.metadata.objects[that.entity_name].label; var title = that.title; @@ -462,7 +462,7 @@ IPA.details_facet = function(spec) { that.show = function() { that.facet_show(); - that.pkey = $.bbq.getState(that.entity_name+'-pkey', true) || ''; + that.pkey = $.bbq.getState(that.entity_name+'-pkey'); that.entity.header.set_pkey(that.pkey); if (that.entity.facets.length == 1) { @@ -489,7 +489,7 @@ IPA.details_facet = function(spec) { }; function new_key(){ - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var pkey = $.bbq.getState(that.entity_name+'-pkey'); return pkey != that.pkey; } that.new_key = new_key; @@ -608,7 +608,7 @@ IPA.details_facet = function(spec) { that.refresh = function() { - that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + that.pkey = $.bbq.getState(that.entity_name+'-pkey'); var command = IPA.command({ entity: that.entity_name, diff --git a/install/ui/dns.js b/install/ui/dns.js index f295145d5..1c0ff6eef 100644 --- a/install/ui/dns.js +++ b/install/ui/dns.js @@ -211,7 +211,7 @@ IPA.records_facet = function(spec) { dialog.add = function() { - var pkey = $.bbq.getState(that.entity_name+'-pkey', true); + var pkey = $.bbq.getState(that.entity_name+'-pkey'); var resource = dialog.resource.val(); var options = {}; @@ -244,7 +244,7 @@ IPA.records_facet = function(spec) { return; } - var zone = $.bbq.getState('dnszone-pkey', true); + var zone = $.bbq.getState('dnszone-pkey'); var records = []; @@ -330,8 +330,8 @@ IPA.records_facet = function(spec) { }; that.is_dirty = function() { - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; - var record = $.bbq.getState(that.entity_name + '-record', true) || ''; + var pkey = $.bbq.getState(that.entity_name+'-pkey'); + var record = $.bbq.getState(that.entity_name+'-record'); return pkey != that.pkey || record != that.record; }; @@ -415,8 +415,8 @@ IPA.records_facet = function(spec) { that.show = function() { that.facet_show(); - that.record = $.bbq.getState(that.entity_name + '-record', true) || ''; - that.pkey = $.bbq.getState(that.entity_name+'-pkey', true) || ''; + that.record = $.bbq.getState(that.entity_name+'-record'); + that.pkey = $.bbq.getState(that.entity_name+'-pkey'); that.entity.header.set_pkey(that.pkey); that.entity.header.back_link.css('visibility', 'visible'); @@ -497,7 +497,7 @@ IPA.records_facet = function(spec) { options.data = data_filter; } */ - var args = [$.bbq.getState(that.entity_name + '-pkey', true)]; + var args = [$.bbq.getState(that.entity_name+'-pkey')]; if (filter) { args.push(filter); diff --git a/install/ui/entity.js b/install/ui/entity.js index 889b6be38..c855da1b5 100644 --- a/install/ui/entity.js +++ b/install/ui/entity.js @@ -364,8 +364,7 @@ IPA.entity = function (spec) { var current_entity = that; current_entity = current_entity.containing_entity; while(current_entity !== null){ - pkey.unshift( - $.bbq.getState(current_entity.name + '-pkey', true) || ''); + pkey.unshift($.bbq.getState(current_entity.name+'-pkey')); current_entity = current_entity.containing_entity; } return pkey; @@ -375,8 +374,7 @@ IPA.entity = function (spec) { that.get_primary_key = function() { var pkey = that.get_primary_key_prefix(); var current_entity = that; - pkey.unshift( - $.bbq.getState(current_entity.name + '-pkey', true) || ''); + pkey.unshift($.bbq.getState(current_entity.name+'-pkey')); return pkey; }; @@ -387,7 +385,7 @@ IPA.entity = function (spec) { }; IPA.current_facet = function (entity){ - var facet_name = $.bbq.getState(entity.name + '-facet', true); + var facet_name = $.bbq.getState(entity.name+'-facet'); var facets = entity.facets.values; if (!facet_name && facets.length) { facet_name = facets[0].name; @@ -473,7 +471,7 @@ IPA.entity_header = function(spec) { that.select_tab = function() { $(that.facet_tabs).find('a').removeClass('selected'); - var facet_name = $.bbq.getState(that.entity.name + '-facet', true); + var facet_name = $.bbq.getState(that.entity.name+'-facet'); if (!facet_name || facet_name === 'default') { that.facet_tabs.find('a:first').addClass('selected'); @@ -490,8 +488,7 @@ IPA.entity_header = function(spec) { while(current_entity){ breadcrumb.unshift($('',{ - text:$.bbq.getState(current_entity.name + '-pkey', true) || - '', + text:$.bbq.getState(current_entity.name+'-pkey'), title: current_entity.name, click: function() { var entity = IPA.get_entity((this.title)); @@ -538,7 +535,7 @@ IPA.entity_header = function(spec) { return false; } - var pkey = $.bbq.getState(that.entity.name+'-pkey', true); + var pkey = $.bbq.getState(that.entity.name+'-pkey'); IPA.nav.show_page(that.entity.name, other_facet.name, pkey); $('a', that.facet_tabs).removeClass('selected'); diff --git a/install/ui/hbac.js b/install/ui/hbac.js index 93ff7fbd5..aa11879b8 100644 --- a/install/ui/hbac.js +++ b/install/ui/hbac.js @@ -341,7 +341,7 @@ IPA.hbacrule_details_facet = function (spec) { that.update = function() { - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var pkey = $.bbq.getState(that.entity_name+'-pkey'); var modify_operation = { 'execute': false, @@ -837,7 +837,7 @@ IPA.hbacrule_accesstime_widget = function (spec) { that.add = function() { - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var pkey = $.bbq.getState(that.entity_name+'-pkey'); var title = IPA.messages.association.add; title = title.replace('${entity}', IPA.metadata.objects[that.entity_name].label); title = title.replace('${primary_key}', pkey); @@ -946,7 +946,7 @@ IPA.hbacrule_accesstime_widget = function (spec) { return; } - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var pkey = $.bbq.getState(that.entity_name+'-pkey'); title = IPA.messages.association.remove; title = title.replace('${entity}', IPA.metadata.objects[that.entity_name].label); title = title.replace('${primary_key}', pkey); @@ -1002,7 +1002,7 @@ IPA.hbacrule_accesstime_widget = function (spec) { summary.append('

'+error_thrown.message+'

'); } - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var pkey = $.bbq.getState(that.entity_name+'-pkey'); IPA.command({ entity: that.entity_name, method: 'show', diff --git a/install/ui/navigation.js b/install/ui/navigation.js index 837cef180..379573910 100644 --- a/install/ui/navigation.js +++ b/install/ui/navigation.js @@ -88,7 +88,7 @@ IPA.navigation = function(spec) { }; that.get_state = function(key) { - return $.bbq.getState(key, true); + return $.bbq.getState(key); }; that.remove_state = function(key) { diff --git a/install/ui/rule.js b/install/ui/rule.js index 8c69eca8b..08c27e6d1 100644 --- a/install/ui/rule.js +++ b/install/ui/rule.js @@ -134,7 +134,7 @@ IPA.rule_association_table_widget = function (spec) { that.add = function(values, on_success, on_error) { - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var pkey = $.bbq.getState(that.entity_name+'-pkey'); var batch = IPA.batch_command({ 'on_success': on_success, diff --git a/install/ui/search.js b/install/ui/search.js index 450b8a655..5786886ac 100644 --- a/install/ui/search.js +++ b/install/ui/search.js @@ -166,7 +166,7 @@ IPA.search_facet = function(spec) { that.entity.header.facet_tabs.css('visibility', 'hidden'); if (that.filter) { - var filter = $.bbq.getState(that.entity_name + '-filter', true) || ''; + var filter = $.bbq.getState(that.entity_name+'-filter'); that.filter.val(filter); } }; @@ -295,17 +295,17 @@ IPA.search_facet = function(spec) { summary.append('

'+error_thrown.message+'

'); } + var filter = []; var current_entity = entity; - filter.unshift($.bbq.getState(current_entity.name + '-filter', true) || ''); + filter.unshift($.bbq.getState(current_entity.name+'-filter')); current_entity = current_entity.containing_entity; while(current_entity !== null){ filter.unshift( - $.bbq.getState(current_entity.name + '-pkey', true) || ''); + $.bbq.getState(current_entity.name+'-pkey')); current_entity = current_entity.containing_entity; } - var command = IPA.command({ entity: entity.name, method: 'find', @@ -343,17 +343,17 @@ IPA.nested_search_facet = function(spec){ that.entity.header.facet_tabs.css('visibility', 'visible'); that.entity.header.set_pkey( - $.bbq.getState(IPA.current_entity.name + '-pkey', true) || ''); + $.bbq.getState(IPA.current_entity.name+'-pkey')); + if (that.filter) { - var filter = - $.bbq.getState(that.managed_entity_name + '-filter', true) || ''; + var filter = $.bbq.getState(that.managed_entity_name+'-filter'); that.filter.val(filter); } }; that.refresh = function(){ - var pkey = $.bbq.getState(that.entity.name + '-pkey', true) || ''; + var pkey = $.bbq.getState(that.entity.name+'-pkey'); if ((!pkey) && (that.entity.redirect_facet)) { diff --git a/install/ui/sudo.js b/install/ui/sudo.js index 1b37b8488..7bd6f4500 100644 --- a/install/ui/sudo.js +++ b/install/ui/sudo.js @@ -197,7 +197,7 @@ IPA.sudocmd_member_sudocmdgroup_table_widget = function (spec) { 'on_error': on_error }); - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var pkey = $.bbq.getState(that.entity_name+'-pkey'); for (var i=0; iError: '+error_thrown.name+'

'); - summary.append('

'+error_thrown.message+'

'); - } - - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; - IPA.command({ - entity: that.entity_name, - method: 'show', - args: [pkey], - options: {'all': true, 'rights': true}, - on_success: on_success, - on_error: on_error - }).execute(); - }; - if (spec.columns) { for (var i=0; i