From b94ead03c663d8a174c24afb0c9da90ab2c6ff5c Mon Sep 17 00:00:00 2001 From: Rolux Date: Fri, 8 Jan 2016 15:05:35 +0530 Subject: [PATCH] more encoding fun --- static/js/editDialog.js | 15 ++++++++------- static/js/infoView.js | 3 ++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/static/js/editDialog.js b/static/js/editDialog.js index fb089b8..5846901 100644 --- a/static/js/editDialog.js +++ b/static/js/editDialog.js @@ -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, diff --git a/static/js/infoView.js b/static/js/infoView.js index 30cf042..03491b7 100644 --- a/static/js/infoView.js +++ b/static/js/infoView.js @@ -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() : '',