From c572ec87540f6b6f744db41f9575bff4c2bc11ca Mon Sep 17 00:00:00 2001 From: pines Date: Wed, 28 Mar 2007 17:40:34 +0000 Subject: [PATCH] bug fix (global replace) and better function name for Mike's sanity :) git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_0@7118 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/chrome/content/util/text.js | 14 ++++++++------ Open-ILS/xul/staff_client/server/cat/spine_labels.js | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/util/text.js b/Open-ILS/xul/staff_client/chrome/content/util/text.js index ce9f029485..4eceace4ee 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/text.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/text.js @@ -4,7 +4,7 @@ if (typeof util == 'undefined') var util = {}; util.text = {}; util.text.EXPORT_OK = [ - 'wrap_on_space', 'html_escape', + 'wrap_on_space', 'preserve_string_in_html', ]; util.text.EXPORT_TAGS = { ':all' : util.text.EXPORT_OK }; @@ -25,11 +25,13 @@ util.text.wrap_on_space = function( text, length ) { } } -util.text.html_escape = function( text ) { - text = text.replace(/&/,'&'); - text = text.replace(/ /,' '); - text = text.replace(//,'>'); +util.text.preserve_string_in_html = function( text ) { + text = text.replace(/&/g,'&'); + text = text.replace(/"/g,'"'); + text = text.replace(/'/g,'''); + text = text.replace(/ /g,' '); + text = text.replace(//g,'>'); return text; } diff --git a/Open-ILS/xul/staff_client/server/cat/spine_labels.js b/Open-ILS/xul/staff_client/server/cat/spine_labels.js index d158277660..5346e927d2 100644 --- a/Open-ILS/xul/staff_client/server/cat/spine_labels.js +++ b/Open-ILS/xul/staff_client/server/cat/spine_labels.js @@ -245,13 +245,13 @@ var nl2 = gb.getElementsByAttribute('name','spine'); for (var k = 0; k < nl2.length; k++) { for (var m = 0; m < lm; m++) html += ' '; - html += util.text.html_escape(expand_macros( nl2[k].value, copy, volume, volume.record() ).substr(0,lw)); + html += util.text.preserve_string_in_html(expand_macros( nl2[k].value, copy, volume, volume.record() ).substr(0,lw)); if ($('pl').checked) { var sib = nl2[k].nextSibling; if (sib) { for (var m = 0; m < lw - nl2[k].value.length; m++) html += ' '; for (var m = 0; m < mm; m++) html += ' '; - html += util.text.html_escape(expand_macros( sib.value, copy, volume, volume.record() ).substr(0,plw)); + html += util.text.preserve_string_in_html(expand_macros( sib.value, copy, volume, volume.record() ).substr(0,plw)); } } html += '\n'; -- 2.11.0