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
This commit is contained in:
Endi S. Dewata
2011-09-19 21:04:57 -05:00
parent 4487a9564b
commit 188cc5c496
8 changed files with 35 additions and 38 deletions

View File

@@ -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){
$('<a/>', {
href: '#'+key,
html: key,
text: key,
click: function() {
var state = IPA.nav.get_path_state(that.entity_name);
state[that.entity_name + '-facet'] = 'default';

View File

@@ -232,25 +232,25 @@ IPA.cert.view_dialog = function(spec) {
tr = $('<tr/>').appendTo(table);
$('<td>'+IPA.messages.objects.cert.common_name+':</td>').appendTo(tr);
$('<td/>', {
'html': that.subject.cn
text: that.subject.cn
}).appendTo(tr);
tr = $('<tr/>').appendTo(table);
$('<td>'+IPA.messages.objects.cert.organization+':</td>').appendTo(tr);
$('<td/>', {
'html': that.subject.o
text: that.subject.o
}).appendTo(tr);
tr = $('<tr/>').appendTo(table);
$('<td>'+IPA.messages.objects.cert.organizational_unit+':</td>').appendTo(tr);
$('<td/>', {
'html': that.subject.ou
text: that.subject.ou
}).appendTo(tr);
tr = $('<tr/>').appendTo(table);
$('<td>'+IPA.messages.objects.cert.serial_number+':</td>').appendTo(tr);
$('<td/>', {
'html': that.serial_number
text: that.serial_number
}).appendTo(tr);
tr = $('<tr/>').appendTo(table);
@@ -262,19 +262,19 @@ IPA.cert.view_dialog = function(spec) {
tr = $('<tr/>').appendTo(table);
$('<td>'+IPA.messages.objects.cert.common_name+':</td>').appendTo(tr);
$('<td/>', {
'html': that.issuer.cn
text: that.issuer.cn
}).appendTo(tr);
tr = $('<tr/>').appendTo(table);
$('<td>'+IPA.messages.objects.cert.organization+':</td>').appendTo(tr);
$('<td/>', {
'html': that.issuer.o
text: that.issuer.o
}).appendTo(tr);
tr = $('<tr/>').appendTo(table);
$('<td>'+IPA.messages.objects.cert.organizational_unit+':</td>').appendTo(tr);
$('<td/>', {
'html': that.issuer.ou
text: that.issuer.ou
}).appendTo(tr);
tr = $('<tr/>').appendTo(table);
@@ -286,13 +286,13 @@ IPA.cert.view_dialog = function(spec) {
tr = $('<tr/>').appendTo(table);
$('<td>'+IPA.messages.objects.cert.issued_on+':</td>').appendTo(tr);
$('<td/>', {
'html': that.issued_on
text: that.issued_on
}).appendTo(tr);
tr = $('<tr/>').appendTo(table);
$('<td>'+IPA.messages.objects.cert.expires_on+':</td>').appendTo(tr);
$('<td/>', {
'html': that.expires_on
text: that.expires_on
}).appendTo(tr);
tr = $('<tr/>').appendTo(table);
@@ -304,13 +304,13 @@ IPA.cert.view_dialog = function(spec) {
tr = $('<tr/>').appendTo(table);
$('<td>'+IPA.messages.objects.cert.sha1_fingerprint+':</td>').appendTo(tr);
$('<td/>', {
'html': that.sha1_fingerprint
text: that.sha1_fingerprint
}).appendTo(tr);
tr = $('<tr/>').appendTo(table);
$('<td>'+IPA.messages.objects.cert.md5_fingerprint+':</td>').appendTo(tr);
$('<td/>', {
'html': that.md5_fingerprint
text: that.md5_fingerprint
}).appendTo(tr);
};

View File

@@ -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;
};

View File

@@ -509,9 +509,9 @@ IPA.entitle.certificate_column = function(spec) {
var certificate = record[that.name];
$('<a/>', {
'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,

View File

@@ -196,6 +196,7 @@ IPA.facet_header = function(spec) {
while (entity) {
breadcrumb.unshift($('<a/>', {
'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(' &raquo; ');
that.path.append(value);
$('<span>', {
'class': 'breadcrumb-element',
text: value
}).appendTo(that.path);
}
that.title_container.empty();

View File

@@ -101,10 +101,5 @@ test('Testing IPA.entity_set_search_definition().', function() {
'column.label'
);
ok(
column.setup,
'column.setup not null'
);
});

View File

@@ -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'}
]}
]
});

View File

@@ -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 = $('<label/>', {
'name': that.name,
'html': value
name: that.name,
text: value
});
input.replaceWith(label);
@@ -1137,7 +1137,7 @@ IPA.column = function (spec) {
throw except;
}
function setup(container, record) {
that.setup = function(container, record) {
container.empty();
@@ -1150,18 +1150,16 @@ IPA.column = function (spec) {
if (that.link) {
$('<a/>', {
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{