more encoding fun

This commit is contained in:
Rolux 2016-01-08 15:05:35 +05:30
parent 2f007f19af
commit b94ead03c6
2 changed files with 10 additions and 8 deletions

View file

@ -45,10 +45,11 @@ oml.ui.editDialog = function() {
function editMetadata(key, value) {
var edit = {id: ids};
if (Ox.contains(['author', 'place'], key)) {
edit[key] = value ? value.split(separator) : [];
if (Ox.contains(arrayKeys, key)) {
edit[key] = value
? Ox.decodeHTMLEntities(value).split(separator) : [];
} else {
edit[key] = value;
edit[key] = Ox.decodeHTMLEntities(value);
}
oml.api.edit(edit, function(result) {
Ox.Request.clearCache();
@ -80,7 +81,9 @@ oml.ui.editDialog = function() {
: key == 'description' ? 'Mixed Description'
: 'mixed'
)) : value ? (Ox.isArray(value) ? value : [value]).map(function(value) {
return key == 'date' && value ? value.slice(0, 4) : value;
return Ox.encodeHTMLEntities(
key == 'date' && value ? value.slice(0, 4) : value
);
}).join(separator) : '';
}
@ -263,9 +266,7 @@ oml.ui.editDialog = function() {
Ox.EditableContent({
editable: true,
format: function(value) {
return formatValue(
Ox.encodeHTMLEntities(value), 'description'
);
return formatValue(value, 'description');
},
placeholder: formatLight('No Description'),
tooltip: tooltip,

View file

@ -460,6 +460,7 @@ oml.ui.infoView = function(identifyData) {
Ox.EditableContent({
clickLink: oml.clickLink,
editable: isEditable,
format: Ox.encodeHTMLEntities,
tooltip: isEditable ? oml.getEditTooltip() : '',
value: data.title || 'No Title'
})
@ -564,7 +565,7 @@ oml.ui.infoView = function(identifyData) {
format: function(value) {
return key == 'language'
? formatValue(splitValue(value), key)
: value;
: Ox.encodeHTMLEntities(value);
},
placeholder: formatLight('unknown'),
tooltip: isEditable ? oml.getEditTooltip() : '',