From 9a73c88279dbad1e93c2f540b77d3897bd9249fd Mon Sep 17 00:00:00 2001 From: pines Date: Tue, 30 Jan 2007 16:32:57 +0000 Subject: [PATCH] test for chrome before using fancy prompt git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_0@6828 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../xul/staff_client/chrome/content/util/error.js | 33 ++++++++++++++++------ 1 file changed, 24 insertions(+), 9 deletions(-) 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 28c2936d1b..ef45712a71 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/error.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/error.js @@ -306,6 +306,10 @@ util.error.prototype = { 'yns_alert' : function (s,title,b1,b2,b3,c,image) { + try { + + if (location.href.match(/^chrome/)) return this.yns_alert_original(s,title,b1,b2,b3,c); + /* The original purpose of yns_alert was to prevent errors from being scanned through accidentally with a barcode scanner. However, this can be done in a less annoying manner by rolling our own dialog and not having any of the options in focus */ @@ -343,11 +347,9 @@ util.error.prototype = { JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); data.temp_yns_xml = xml; data.stash('temp_yns_xml'); + var url = urls.XUL_FANCY_PROMPT + '?xml_in_stash=temp_yns_xml' + '&title=' + window.escape(title); window.open( - urls.XUL_FANCY_PROMPT - + '?xml_in_stash=temp_yns_xml' - + '&title=' + window.escape(title), - 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500' + url, 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500' ); data.init({'via':'stash'}); if (data.fancy_prompt_data != '') { @@ -360,10 +362,20 @@ util.error.prototype = { //return this.yns_alert(s,title,b1,b2,b3,c,image); return null; } + + } catch(E) { + + alert('yns_alert failed: ' + E + '\ns = ' + s + '\ntitle = ' + title + '\nb1 = ' + b1 + '\nb2 = ' + b2 + '\nb3 = ' + b3 + '\nc = ' + c + '\nimage = ' + image + '\n'); + + } }, 'yns_alert_formatted' : function (s,title,b1,b2,b3,c,image) { + try { + + if (location.href.match(/^chrome/)) return this.yns_alert_original(s,title,b1,b2,b3,c); + /* The original purpose of yns_alert was to prevent errors from being scanned through accidentally with a barcode scanner. However, this can be done in a less annoying manner by rolling our own dialog and not having any of the options in focus */ @@ -401,11 +413,9 @@ util.error.prototype = { JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); data.temp_yns_xml = xml; data.stash('temp_yns_xml'); + var url = urls.XUL_FANCY_PROMPT + '?xml_in_stash=temp_yns_xml' + '&title=' + window.escape(title); window.open( - urls.XUL_FANCY_PROMPT - + '?xml_in_stash=temp_yns_xml' - + '&title=' + window.escape(title), - 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500' + url, 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500' ); data.init({'via':'stash'}); if (data.fancy_prompt_data != '') { @@ -418,9 +428,14 @@ util.error.prototype = { //return this.yns_alert(s,title,b1,b2,b3,c,image); return null; } - }, + } catch(E) { + + alert('yns_alert_formatted failed: ' + E + '\ns = ' + s + '\ntitle = ' + title + '\nb1 = ' + b1 + '\nb2 = ' + b2 + '\nb3 = ' + b3 + '\nc = ' + c + '\nimage = ' + image + '\n'); + + } + }, 'yns_alert_original' : function (s,title,b1,b2,b3,c) { -- 2.11.0