From 188cc5c49617ba09d5cbbd6b4e27ec7bcf472d20 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Mon, 19 Sep 2011 21:04:57 -0500 Subject: Fixed problem displaying special characters. Some jQuery objects in various locations have been modified to use text() to show values obtained from the server (except messages). The text() will automatically encode special characters. Ticket #1798 --- install/ui/automount.js | 5 +++-- install/ui/certificate.js | 22 +++++++++++----------- install/ui/details.js | 2 -- install/ui/entitle.js | 6 +++--- install/ui/entity.js | 7 ++++++- install/ui/test/entity_tests.js | 5 ----- install/ui/test/navigation_tests.js | 4 ++-- install/ui/widget.js | 22 ++++++++++------------ 8 files changed, 35 insertions(+), 38 deletions(-) diff --git a/install/ui/automount.js b/install/ui/automount.js index 72ced632..a4fe166e 100644 --- a/install/ui/automount.js +++ b/install/ui/automount.js @@ -183,7 +183,8 @@ IPA.entity_factories.automountkey = function() { build(); }; -IPA.automount_key_column = function(spec){ +IPA.automount_key_column = function(spec) { + var that = IPA.column(spec); that.setup = function(container, record) { @@ -193,7 +194,7 @@ IPA.automount_key_column = function(spec){ $('', { href: '#'+key, - html: key, + text: key, click: function() { var state = IPA.nav.get_path_state(that.entity_name); state[that.entity_name + '-facet'] = 'default'; diff --git a/install/ui/certificate.js b/install/ui/certificate.js index 781b59ec..15789fc1 100755 --- a/install/ui/certificate.js +++ b/install/ui/certificate.js @@ -232,25 +232,25 @@ IPA.cert.view_dialog = function(spec) { tr = $('').appendTo(table); $(''+IPA.messages.objects.cert.common_name+':').appendTo(tr); $('', { - 'html': that.subject.cn + text: that.subject.cn }).appendTo(tr); tr = $('').appendTo(table); $(''+IPA.messages.objects.cert.organization+':').appendTo(tr); $('', { - 'html': that.subject.o + text: that.subject.o }).appendTo(tr); tr = $('').appendTo(table); $(''+IPA.messages.objects.cert.organizational_unit+':').appendTo(tr); $('', { - 'html': that.subject.ou + text: that.subject.ou }).appendTo(tr); tr = $('').appendTo(table); $(''+IPA.messages.objects.cert.serial_number+':').appendTo(tr); $('', { - 'html': that.serial_number + text: that.serial_number }).appendTo(tr); tr = $('').appendTo(table); @@ -262,19 +262,19 @@ IPA.cert.view_dialog = function(spec) { tr = $('').appendTo(table); $(''+IPA.messages.objects.cert.common_name+':').appendTo(tr); $('', { - 'html': that.issuer.cn + text: that.issuer.cn }).appendTo(tr); tr = $('').appendTo(table); $(''+IPA.messages.objects.cert.organization+':').appendTo(tr); $('', { - 'html': that.issuer.o + text: that.issuer.o }).appendTo(tr); tr = $('').appendTo(table); $(''+IPA.messages.objects.cert.organizational_unit+':').appendTo(tr); $('', { - 'html': that.issuer.ou + text: that.issuer.ou }).appendTo(tr); tr = $('').appendTo(table); @@ -286,13 +286,13 @@ IPA.cert.view_dialog = function(spec) { tr = $('').appendTo(table); $(''+IPA.messages.objects.cert.issued_on+':').appendTo(tr); $('', { - 'html': that.issued_on + text: that.issued_on }).appendTo(tr); tr = $('').appendTo(table); $(''+IPA.messages.objects.cert.expires_on+':').appendTo(tr); $('', { - 'html': that.expires_on + text: that.expires_on }).appendTo(tr); tr = $('').appendTo(table); @@ -304,13 +304,13 @@ IPA.cert.view_dialog = function(spec) { tr = $('').appendTo(table); $(''+IPA.messages.objects.cert.sha1_fingerprint+':').appendTo(tr); $('', { - 'html': that.sha1_fingerprint + text: that.sha1_fingerprint }).appendTo(tr); tr = $('').appendTo(table); $(''+IPA.messages.objects.cert.md5_fingerprint+':').appendTo(tr); $('', { - 'html': that.md5_fingerprint + text: that.md5_fingerprint }).appendTo(tr); }; diff --git a/install/ui/details.js b/install/ui/details.js index cecf97a6..e25c4587 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -205,7 +205,6 @@ IPA.details_section = function(spec) { // methods that should be invoked by subclasses that.section_create = that.create; - that.section_setup = that.setup; that.section_load = that.load; that.section_reset = that.reset; @@ -720,7 +719,6 @@ IPA.details_facet = function(spec) { that.details_facet_create_content = that.create_content; that.details_facet_load = that.load; - that.details_facet_setup = that.setup; return that; }; diff --git a/install/ui/entitle.js b/install/ui/entitle.js index 844c7ad4..b8cff6ee 100644 --- a/install/ui/entitle.js +++ b/install/ui/entitle.js @@ -509,9 +509,9 @@ IPA.entitle.certificate_column = function(spec) { var certificate = record[that.name]; $('', { - 'href': '#download', - 'html': IPA.messages.objects.entitle.download, - 'click': function() { + href: '#download', + html: IPA.messages.objects.entitle.download, + click: function() { var dialog = IPA.cert.download_dialog({ title: IPA.messages.objects.entitle.download_certificate, certificate: certificate, diff --git a/install/ui/entity.js b/install/ui/entity.js index 1ae233fe..37423601 100644 --- a/install/ui/entity.js +++ b/install/ui/entity.js @@ -196,6 +196,7 @@ IPA.facet_header = function(spec) { while (entity) { breadcrumb.unshift($('', { + 'class': 'breadcrumb-element', text: IPA.nav.get_state(entity.name+'-pkey'), title: entity.name, click: function(entity) { @@ -217,7 +218,11 @@ IPA.facet_header = function(spec) { } that.path.append(' » '); - that.path.append(value); + + $('', { + 'class': 'breadcrumb-element', + text: value + }).appendTo(that.path); } that.title_container.empty(); diff --git a/install/ui/test/entity_tests.js b/install/ui/test/entity_tests.js index a3561613..12a1fcae 100644 --- a/install/ui/test/entity_tests.js +++ b/install/ui/test/entity_tests.js @@ -101,10 +101,5 @@ test('Testing IPA.entity_set_search_definition().', function() { 'column.label' ); - ok( - column.setup, - 'column.setup not null' - ); - }); diff --git a/install/ui/test/navigation_tests.js b/install/ui/test/navigation_tests.js index ece3b56d..90e708cc 100644 --- a/install/ui/test/navigation_tests.js +++ b/install/ui/test/navigation_tests.js @@ -118,8 +118,8 @@ test("Testing IPA.navigation.update() with valid index.", function() { content: entity_container, tabs: [ { name:'identity', label:'IDENTITY', children: [ - {name:'one', label:'One', setup: function (){}}, - {name:'two', label:'Two', setup: function (){}} + {name:'one', label:'One'}, + {name:'two', label:'Two'} ]} ] }); diff --git a/install/ui/widget.js b/install/ui/widget.js index 0c07d655..f32dfbb1 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -445,7 +445,7 @@ IPA.text_widget = function(spec) { var value = that.values && that.values.length ? that.values[0] : ''; if (that.read_only || !that.writable) { - that.display_control.html(value); + that.display_control.text(value); that.display_control.css('display', 'inline'); that.input.css('display', 'none'); @@ -639,8 +639,8 @@ IPA.multivalued_text_widget = function(spec) { if (that.read_only || !that.writable) { var label = $('', { href: '#'+value, - html: value, + text: value, click: function() { return that.link_handler(value); } }).appendTo(container); } else { - container.append(value); + container.text(value); } - } - - that.setup = spec.setup || setup; + }; that.link_handler = function(value) { return false; @@ -1764,7 +1762,7 @@ IPA.combobox_widget = function(spec) { }; that.set_value = function(value) { - that.text.html(value); + that.text.text(value); that.input.val(value); }; @@ -1890,8 +1888,8 @@ IPA.entity_link_widget = function(spec) { that.load = function (record){ that.widget_load(record); if (that.values || that.values.length > 0){ - that.nonlink.html(that.values[0]); - that.link.html(that.values[0]); + that.nonlink.text(that.values[0]); + that.link.text(that.values[0]); that.link.css('display','none'); that.nonlink.css('display','inline'); }else{ -- cgit