From 0893dfdcd559a12489d9c2f9f9a957fbd12a5eae Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Fri, 28 Jun 2013 08:47:11 +0300 Subject: [PATCH] Replace deprecated javascript escape() with encodeURIComponent() Signed-off-by: Pasi Kallinen Signed-off-by: Dan Scott Conflicts: Open-ILS/xul/staff_client/chrome/content/auth/controller.js Open-ILS/xul/staff_client/chrome/content/util/error.js Open-ILS/xul/staff_client/chrome/content/util/print.js Open-ILS/xul/staff_client/server/admin/offline_manage_xacts.js Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js Signed-off-by: Dan Scott --- Open-ILS/web/js/dojo/openils/BibTemplate.js | 12 +++--- Open-ILS/web/js/dojo/openils/XUL.js | 2 +- .../web/js/ui/default/acq/common/li_table.js | 2 +- .../conify/global/config/z3950_source.js | 2 +- .../global/vandelay/import_bib_trash_group.js | 2 +- Open-ILS/web/opac/common/js/dtree.js | 10 ++--- .../web/opac/skin/default/js/result_common.js | 2 +- .../content/OpenILS/util_overlay_chrome.xul | 2 +- .../content/OpenILS/util_overlay_offline.xul | 2 +- .../staff_client/chrome/content/cat/opac.js | 28 ++++++------- .../staff_client/chrome/content/main/main.js | 4 +- .../staff_client/chrome/content/main/menu.js | 35 ++++++++--------- .../staff_client/chrome/content/util/error.js | 4 +- .../staff_client/chrome/content/util/list.js | 6 +-- .../chrome/content/util/network.js | 10 ----- .../server/OpenILS/util_overlay.xul | 2 +- .../server/admin/offline_manage_xacts.js | 39 +++++++------------ .../server/cat/bucketz39_dialog.js | 2 +- .../staff_client/server/cat/copy_browser.js | 2 - .../staff_client/server/cat/copy_editor.js | 1 - .../staff_client/server/cat/record_buckets.js | 3 -- .../staff_client/server/cat/spine_labels.js | 1 - Open-ILS/xul/staff_client/server/cat/util.js | 4 +- Open-ILS/xul/staff_client/server/cat/z3950.js | 3 -- .../staff_client/server/circ/circ_brief.xul | 2 - .../staff_client/server/circ/copy_status.js | 2 - Open-ILS/xul/staff_client/server/circ/util.js | 2 +- .../server/patron/barcode_entry.xul | 4 +- .../xul/staff_client/server/patron/display.js | 21 ++-------- .../xul/staff_client/server/patron/holds.js | 24 +----------- .../staff_client/server/patron/info_group.js | 10 +---- .../xul/staff_client/server/patron/items.js | 2 - .../server/serial/manage_dists.js | 2 - .../staff_client/server/serial/manage_subs.js | 2 - .../server/serial/sdist_editor.js | 1 - .../server/serial/sitem_editor.js | 1 - 36 files changed, 84 insertions(+), 169 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/BibTemplate.js b/Open-ILS/web/js/dojo/openils/BibTemplate.js index 8c81447c0a..180b228d50 100644 --- a/Open-ILS/web/js/dojo/openils/BibTemplate.js +++ b/Open-ILS/web/js/dojo/openils/BibTemplate.js @@ -109,7 +109,7 @@ if(!dojo._hasResource["openils.BibTemplate"]) { // Do pre-query stuff dojo.forEach(pre_query_callbacks, function (cb) { - try { (new Function( 'BT', 'slotXML', 'slot', unescape(cb.innerHTML) ))(BT,bib,slot) } catch (e) {/*meh*/} + try { (new Function( 'BT', 'slotXML', 'slot', decodeURIComponent(cb.innerHTML) ))(BT,bib,slot) } catch (e) {/*meh*/} }); var query = slot.getAttribute('query'); @@ -130,14 +130,14 @@ if(!dojo._hasResource["openils.BibTemplate"]) { // Do post-query stuff dojo.forEach(post_query_callbacks, function (cb) { - try { (new Function( 'item_list', 'BT', 'slotXML', 'slot', unescape(cb.innerHTML) ))(item_list,BT,bib,slot) } catch (e) {/*meh*/} + try { (new Function( 'item_list', 'BT', 'slotXML', 'slot', decodeURIComponent(cb.innerHTML) ))(item_list,BT,bib,slot) } catch (e) {/*meh*/} }); if (!item_list.length) return; // Do pre-render stuff dojo.forEach(pre_render_callbacks, function (cb) { - try { (new Function( 'item_list', 'BT', 'slotXML', 'slot', unescape(cb.innerHTML) ))(item_list,BT,bib,slot) } catch (e) {/*meh*/} + try { (new Function( 'item_list', 'BT', 'slotXML', 'slot', decodeURIComponent(cb.innerHTML) ))(item_list,BT,bib,slot) } catch (e) {/*meh*/} }); var templated = slot.getAttribute('templated') == 'true'; @@ -152,7 +152,7 @@ if(!dojo._hasResource["openils.BibTemplate"]) { slot ).orphan().forEach(function(x) { var name = x.getAttribute('name'); - var value = (new Function( 'item_list', 'BT', 'slotXML', 'slot', unescape(x.innerHTML) ))(item_list,BT,bib,slot); + var value = (new Function( 'item_list', 'BT', 'slotXML', 'slot', decodeURIComponent(x.innerHTML) ))(item_list,BT,bib,slot); if (name && (value || value == '')) { template_values[name] = value; template_value_count++; @@ -164,7 +164,7 @@ if(!dojo._hasResource["openils.BibTemplate"]) { dojo.attr( slot, "innerHTML", dojo.string.substitute( - unescape(slot.innerHTML), + decodeURIComponent(slot.innerHTML), template_values ) ); @@ -188,7 +188,7 @@ if(!dojo._hasResource["openils.BibTemplate"]) { // Do post-render stuff dojo.forEach(post_render_callbacks, function (cb) { - try { (new Function( 'item_list', 'BT', 'slotXML', 'slot', unescape(cb.innerHTML) ))(item_list,BT,bib,slot) } catch (e) {/*meh*/} + try { (new Function( 'item_list', 'BT', 'slotXML', 'slot', decodeURIComponent(cb.innerHTML) ))(item_list,BT,bib,slot) } catch (e) {/*meh*/} }); } catch (e) { diff --git a/Open-ILS/web/js/dojo/openils/XUL.js b/Open-ILS/web/js/dojo/openils/XUL.js index 656c055a7e..b13b96d184 100644 --- a/Open-ILS/web/js/dojo/openils/XUL.js +++ b/Open-ILS/web/js/dojo/openils/XUL.js @@ -55,7 +55,7 @@ if(!dojo._hasResource["openils.XUL"]) { if (wrap_in_browser) { var urls = xulG.urls || window.urls; - loc = urls.XUL_BROWSER + "?url=" + window.escape(loc); + loc = urls.XUL_BROWSER + "?url=" + window.encodeURIComponent(loc); content_params = dojo.mixin( { "no_xulG": false, "show_print_button": true, diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js index 9344ad91ef..b462eed887 100644 --- a/Open-ILS/web/js/ui/default/acq/common/li_table.js +++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js @@ -3543,7 +3543,7 @@ function AcqLiTable() { ); win = window.open( - oilsBasePath + '/acq/lineitem/findbib?query=' + escape(query), + oilsBasePath + '/acq/lineitem/findbib?query=' + encodeURIComponent(query), '', 'resizable,scrollbars=1,chrome'); win.window.recordFound = function(bibId) { diff --git a/Open-ILS/web/js/ui/default/conify/global/config/z3950_source.js b/Open-ILS/web/js/ui/default/conify/global/config/z3950_source.js index c73bc9ce4f..bb191c3f8f 100644 --- a/Open-ILS/web/js/ui/default/conify/global/config/z3950_source.js +++ b/Open-ILS/web/js/ui/default/conify/global/config/z3950_source.js @@ -55,7 +55,7 @@ function applyCreds(clear) { } function formatSourceName(val) { - return '' + val + ''; + return '' + val + ''; } var cloneSourceSelector; diff --git a/Open-ILS/web/js/ui/default/conify/global/vandelay/import_bib_trash_group.js b/Open-ILS/web/js/ui/default/conify/global/vandelay/import_bib_trash_group.js index 1cd2bec7fa..93d4264a77 100644 --- a/Open-ILS/web/js/ui/default/conify/global/vandelay/import_bib_trash_group.js +++ b/Open-ILS/web/js/ui/default/conify/global/vandelay/import_bib_trash_group.js @@ -26,7 +26,7 @@ function init2(grp) { function format_grp(val) { return '' + val + ''; + '/' + encodeURIComponent(val) + '">' + val + ''; } openils.Util.addOnLoad(init); diff --git a/Open-ILS/web/opac/common/js/dtree.js b/Open-ILS/web/opac/common/js/dtree.js index 8f95cb030f..974f5deb30 100644 --- a/Open-ILS/web/opac/common/js/dtree.js +++ b/Open-ILS/web/opac/common/js/dtree.js @@ -271,7 +271,7 @@ dTree.prototype.clearCookie = function() { dTree.prototype.setCookie = function(cookieName, cookieValue, expires, path, domain, secure) { document.cookie = - escape(cookieName) + '=' + escape(cookieValue) + encodeURIComponent(cookieName) + '=' + encodeURIComponent(cookieValue) + (expires ? '; expires=' + expires.toGMTString() : '') + (path ? '; path=' + path : '') + (domain ? '; domain=' + domain : '') @@ -280,12 +280,12 @@ dTree.prototype.setCookie = function(cookieName, cookieValue, expires, path, dom dTree.prototype.getCookie = function(cookieName) { var cookieValue = ''; - var posName = document.cookie.indexOf(escape(cookieName) + '='); + var posName = document.cookie.indexOf(encodeURIComponent(cookieName) + '='); if (posName != -1) { - var posValue = posName + (escape(cookieName) + '=').length; + var posValue = posName + (encodeURIComponent(cookieName) + '=').length; var endPos = document.cookie.indexOf(';', posValue); - if (endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos)); - else cookieValue = unescape(document.cookie.substring(posValue)); + if (endPos != -1) cookieValue = decodeURIComponent(document.cookie.substring(posValue, endPos)); + else cookieValue = decodeURIComponent(document.cookie.substring(posValue)); } return (cookieValue); }; diff --git a/Open-ILS/web/opac/skin/default/js/result_common.js b/Open-ILS/web/opac/skin/default/js/result_common.js index 061bf6ff51..c3d4764085 100644 --- a/Open-ILS/web/opac/skin/default/js/result_common.js +++ b/Open-ILS/web/opac/skin/default/js/result_common.js @@ -825,7 +825,7 @@ function fetchGoogleBooksLink () { scriptElement.setAttribute("id", "jsonScript"); scriptElement.setAttribute("src", "https://www.googleapis.com/books/v1/volumes?q=" + - escape('isbn:' + isbnList.join(' | isbn:')) + "&callback=unhideGoogleBooksLink"); + encodeURIComponent('isbn:' + isbnList.join(' | isbn:')) + "&callback=unhideGoogleBooksLink"); scriptElement.setAttribute("type", "text/javascript"); // make the request to Google Book Search document.documentElement.firstChild.appendChild(scriptElement); diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/util_overlay_chrome.xul b/Open-ILS/xul/staff_client/chrome/content/OpenILS/util_overlay_chrome.xul index 0860a6ddec..ce1a778811 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/util_overlay_chrome.xul +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/util_overlay_chrome.xul @@ -70,7 +70,7 @@