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

View file

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