From 1c5edfe9546ab79685f1024e3b3e924ab75fecda Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Thu, 27 Jun 2013 11:23:11 +0300 Subject: [PATCH] Add missing character set definitions to data URIs. Also use encodeURIComponent() instead of escape() so the UTF-8 characters stay intact. Also, fix the print macro help popup window size. Signed-off-by: Pasi Kallinen Signed-off-by: Jason Etheridge --- Open-ILS/web/opac/common/js/utils.js | 4 ++-- .../xul/staff_client/chrome/content/auth/controller.js | 2 +- Open-ILS/xul/staff_client/chrome/content/util/error.js | 2 +- Open-ILS/xul/staff_client/chrome/content/util/print.js | 10 +++++----- .../staff_client/server/admin/offline_manage_xacts.js | 2 +- Open-ILS/xul/staff_client/server/cat/marc_view.xul | 4 ++-- .../server/circ/print_list_template_editor.js | 8 ++++---- Open-ILS/xul/staff_client/server/patron/display.js | 8 ++++---- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Open-ILS/web/opac/common/js/utils.js b/Open-ILS/web/opac/common/js/utils.js index 3d1366ea28..dae8ef2a16 100644 --- a/Open-ILS/web/opac/common/js/utils.js +++ b/Open-ILS/web/opac/common/js/utils.js @@ -555,11 +555,11 @@ function interval_to_seconds( $interval ) { function openWindow( data ) { if( isXUL() ) { - var data = window.escape( + var data = window.encodeURIComponent( '' + data + ''); xulG.window_open( - 'data:text/html,' + data, + 'data:text/html;charset=UTF-8,' + data, '', 'chrome,resizable,width=700,height=500'); diff --git a/Open-ILS/xul/staff_client/chrome/content/auth/controller.js b/Open-ILS/xul/staff_client/chrome/content/auth/controller.js index 11b9e1a9c7..bbd1979757 100644 --- a/Open-ILS/xul/staff_client/chrome/content/auth/controller.js +++ b/Open-ILS/xul/staff_client/chrome/content/auth/controller.js @@ -395,7 +395,7 @@ auth.controller.prototype = { try { if (x.readyState != 4) return; if (x.status == 200) { - window.open('data:text/html,'+window.escape(x.responseText),'upgrade','chrome,resizable,modal,centered'); + window.open('data:text/html;charset=UTF-8,'+window.encodeURIComponent(x.responseText),'upgrade','chrome,resizable,modal,centered'); } else { if(typeof(G.upgradeCheck) == "function") { diff --git a/Open-ILS/xul/staff_client/chrome/content/util/error.js b/Open-ILS/xul/staff_client/chrome/content/util/error.js index f30605a6ec..a865349021 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/error.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/error.js @@ -317,7 +317,7 @@ util.error.prototype = { if (r == 1) { JSAN.use('util.window'); var win = new util.window(); win.open( - 'data:text/plain,' + window.escape( 'Please open a helpdesk ticket and include the following text: \n\n' + (new Date()) + '\n\n' + msg + '\n\n' + obj.pretty_print(js2JSON(E)) ), + 'data:text/plain;charset=UTF-8,' + window.encodeURIComponent( 'Please open a helpdesk ticket and include the following text: \n\n' + (new Date()) + '\n\n' + msg + '\n\n' + obj.pretty_print(js2JSON(E)) ), 'error_alert', 'chrome,resizable,width=700,height=500' ); diff --git a/Open-ILS/xul/staff_client/chrome/content/util/print.js b/Open-ILS/xul/staff_client/chrome/content/util/print.js index 30e0ba73b2..075b0c1201 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/print.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/print.js @@ -194,7 +194,7 @@ util.print.prototype = { }); break; default: - w = obj.win.open('data:' + content_type + ',' + window.escape(msg),'receipt_temp','chrome,resizable'); + w = obj.win.open('data:' + content_type + ',' + window.encodeURIComponent(msg),'receipt_temp','chrome,resizable'); w.minimize(); setTimeout( function() { @@ -519,9 +519,9 @@ util.print.prototype = { } } else { if (params.content_type == 'text/plain') { - w = window.open('data:text/plain,'+escape(params.msg),'','chrome'); + w = window.open('data:text/plain;charset=UTF-8,'+encodeURIComponent(params.msg),'','chrome'); } else { - w = window.open('data:text/html,'+escape(params.msg),'','chrome'); + w = window.open('data:text/html;charset=UTF-8,'+encodeURIComponent(params.msg),'','chrome'); } setTimeout( function() { @@ -544,9 +544,9 @@ util.print.prototype = { obj._NSPrint_webBrowserPrint(w,silent,params); } else { if (params.content_type == 'text/plain') { - w = window.open('data:text/plain,'+escape(params.msg),'','chrome'); + w = window.open('data:text/plain;charset=UTF-8,'+encodeURIComponent(params.msg),'','chrome'); } else { - w = window.open('data:text/html,'+escape(params.msg),'','chrome'); + w = window.open('data:text/html;charset=UTF-8,'+encodeURIComponent(params.msg),'','chrome'); } setTimeout( function() { diff --git a/Open-ILS/xul/staff_client/server/admin/offline_manage_xacts.js b/Open-ILS/xul/staff_client/server/admin/offline_manage_xacts.js index 55315277e0..d5f36efb96 100644 --- a/Open-ILS/xul/staff_client/server/admin/offline_manage_xacts.js +++ b/Open-ILS/xul/staff_client/server/admin/offline_manage_xacts.js @@ -879,7 +879,7 @@ admin.offline_manage_xacts.prototype = { for (var i = 0; i < obj.sel_errors.length; i++) { var error = obj.errors[ obj.sel_errors[i] ]; win.open( - 'data:text/plain,' + window.escape( + 'data:text/plain;charset=UTF-8,' + window.encodeURIComponent( 'Details:\n' + obj.error.pretty_print(js2JSON(error)) ), 'offline_error_details', diff --git a/Open-ILS/xul/staff_client/server/cat/marc_view.xul b/Open-ILS/xul/staff_client/server/cat/marc_view.xul index 90b42e8e35..e600a49fa9 100644 --- a/Open-ILS/xul/staff_client/server/cat/marc_view.xul +++ b/Open-ILS/xul/staff_client/server/cat/marc_view.xul @@ -57,12 +57,12 @@ vim:noet:sw=4:ts=4: function(req) { var marc_html = req.getResultObject(); if (noprint||typeof xulG == 'undefined') marc_html = marc_html.replace(//, ''); - document.getElementById('marc_frame').setAttribute('src', 'data:text/html,' + encodeURIComponent(marc_html)); + document.getElementById('marc_frame').setAttribute('src', 'data:text/html;charset=UTF-8,' + encodeURIComponent(marc_html)); } ); } else { var marc_html = '

' + document.getElementById('catStrings').getString('bib.no_marc') + '

'; - document.getElementById('marc_frame').setAttribute('src', 'data:text/html,' + marc_html); + document.getElementById('marc_frame').setAttribute('src', 'data:text/html;charset=UTF-8,' + marc_html); } } catch(E) { diff --git a/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js b/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js index dab6e2bee1..c8461720d8 100644 --- a/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js +++ b/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js @@ -254,9 +254,9 @@ circ.print_list_template_editor.prototype = { var macro_string = macros.join(', '); JSAN.use('util.window'); var win = new util.window(); - win.open('data:text/html,' - + window.escape( - '' + win.open('data:text/html;charset=UTF-8,' + + window.encodeURIComponent( + '' + '' + document.getElementById('circStrings').getString('staff.circ.print_list_template.window.title') + '' @@ -281,7 +281,7 @@ circ.print_list_template_editor.prototype = { + document.getElementById('circStrings').getString('staff.circ.print_list_template.window.close') + '' + '' - ), 'title', 'chrome,resizable'); + ), 'title', 'width=600,height=400,chrome,resizable'); } catch(E) { alert(E); } diff --git a/Open-ILS/xul/staff_client/server/patron/display.js b/Open-ILS/xul/staff_client/server/patron/display.js index 4728790146..dab77bfc81 100644 --- a/Open-ILS/xul/staff_client/server/patron/display.js +++ b/Open-ILS/xul/staff_client/server/patron/display.js @@ -413,9 +413,9 @@ patron.display.prototype = { ['command'], function(ev) { if (obj.msg_url) { - obj.right_deck.set_iframe('data:text/html,'+obj.msg_url,{},{}); + obj.right_deck.set_iframe('data:text/html;charset=UTF-8,'+obj.msg_url,{},{}); } else { - obj.right_deck.set_iframe('data:text/html,

' + $("patronStrings").getString('staff.patron.display.no_alerts_or_messages') + '

',{},{}); + obj.right_deck.set_iframe('data:text/html;charset=UTF-8,

' + $("patronStrings").getString('staff.patron.display.no_alerts_or_messages') + '

',{},{}); } } ], @@ -1047,10 +1047,10 @@ patron.display.prototype = { if (msg != obj.old_msg) { //obj.error.yns_alert(msg,'Alert Message','OK',null,null,'Check here to confirm this message.'); document.documentElement.firstChild.focus(); - var data_url = window.escape("" + '

' + var data_url = window.encodeURIComponent("" + '

' + $("patronStrings").getString('staff.patron.display.init.network_request.window_title') + '

' + msg + '

\r\n\r\n
'
                             + $("patronStrings").getString('staff.patron.display.init.network_request.window_message') + '
'); - obj.right_deck.set_iframe('data:text/html,'+data_url,{},{}); + obj.right_deck.set_iframe('data:text/html;charset=UTF-8,'+data_url,{},{}); obj.old_msg = msg; obj.msg_url = data_url; } else { -- 2.43.2