[open-ils-commits] r16295 - trunk/Open-ILS/xul/staff_client/chrome/content/util (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Apr 25 23:54:11 EDT 2010
Author: phasefx
Date: 2010-04-25 23:54:08 -0400 (Sun, 25 Apr 2010)
New Revision: 16295
Modified:
trunk/Open-ILS/xul/staff_client/chrome/content/util/error.js
trunk/Open-ILS/xul/staff_client/chrome/content/util/fancy_prompt.xul
trunk/Open-ILS/xul/staff_client/chrome/content/util/network.js
Log:
don't let util.error create sound objects (trying to reduce proliferation of such objects for easier debugging), and give fancy_prompt the ability to handle its own sounds, to prevent blocking of sounds due to the modal window dialog. Have util.error and util.network make fancy_prompt do this
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/error.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/error.js 2010-04-26 03:54:04 UTC (rev 16294)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/error.js 2010-04-26 03:54:08 UTC (rev 16295)
@@ -18,7 +18,10 @@
this.OpenILS = {};
- JSAN.use('util.sound'); this.sound = new util.sound();
+ // Only use sounds if the context window has already created a sound object
+ if (typeof xulG != 'undefined' && xulG._sound) {
+ this.sound = xulG._sound;
+ }
} catch(E) {
alert('Error in util.error constructor: ' + E);
@@ -340,9 +343,6 @@
dump('yns_alert:\n\ts = ' + s + '\n\ttitle = ' + title + '\n\tb1 = ' + b1 + '\n\tb2 = ' + b2 + '\n\tb3 = ' + b3 + '\n\tc = ' + c + '\n');
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect UniversalBrowserWrite");
- this.sound.bad();
-
-
//FIXME - is that good enough of an escape job?
s = s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
@@ -374,7 +374,7 @@
if (typeof xulG != 'undefined') if (typeof xulG.url_prefix == 'function') url = xulG.url_prefix( url );
JSAN.use('util.window'); var win = new util.window();
var fancy_prompt_data = win.open(
- url, 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500', { 'xml' : xml, 'title' : title }
+ url, 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500', { 'xml' : xml, 'title' : title, 'sound' : 'bad' }
);
if (fancy_prompt_data.fancy_status == 'complete') {
switch(fancy_prompt_data.fancy_submit) {
@@ -417,9 +417,6 @@
dump('yns_alert_formatted:\n\ts = ' + s + '\n\ttitle = ' + title + '\n\tb1 = ' + b1 + '\n\tb2 = ' + b2 + '\n\tb3 = ' + b3 + '\n\tc = ' + c + '\n');
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect UniversalBrowserWrite");
- this.sound.bad();
-
-
//FIXME - is that good enough of an escape job?
s = s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
@@ -451,7 +448,7 @@
if (typeof xulG != 'undefined') if (typeof xulG.url_prefix == 'function') url = xulG.url_prefix( url );
JSAN.use('util.window'); var win = new util.window();
var fancy_prompt_data = win.open(
- url, 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500', { 'xml' : xml, 'title' : title }
+ url, 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500', { 'xml' : xml, 'title' : title, 'sound' : 'bad' }
);
if (fancy_prompt_data.fancy_status == 'complete') {
switch(fancy_prompt_data.fancy_submit) {
@@ -486,7 +483,7 @@
dump('yns_alert_original:\n\ts = ' + s + '\n\ttitle = ' + title + '\n\tb1 = ' + b1 + '\n\tb2 = ' + b2 + '\n\tb3 = ' + b3 + '\n\tc = ' + c + '\n');
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- this.sound.bad();
+ if (this.sound) { this.sound.bad(); }
// get a reference to the prompt service component.
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/fancy_prompt.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/fancy_prompt.xul 2010-04-26 03:54:04 UTC (rev 16294)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/fancy_prompt.xul 2010-04-26 03:54:08 UTC (rev 16295)
@@ -98,6 +98,11 @@
if (focus_element) focus_element.focus();
}
+ var snd = xul_param('sound',{'modal_xulG':true});
+ if (snd) {
+ try { JSAN.use('util.sound'); var sound = new util.sound(); sound[ snd ](); } catch(E) { alert(E); }
+ }
+
JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
xulG.fancy_status = 'incomplete';
var key = location.pathname + location.search + location.hash;
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/network.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/network.js 2010-04-26 03:54:04 UTC (rev 16294)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/network.js 2010-04-26 03:54:08 UTC (rev 16295)
@@ -447,7 +447,6 @@
}
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- obj.sound.bad();
var xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">' +
'<groupbox><caption label="' + offlineStrings.getString('network.override.exceptions') + '"/>' +
'<grid><columns><column/><column/></columns><rows>';
@@ -474,7 +473,7 @@
//+ '?xml_in_stash=temp_override_xml'
//+ '&title=' + window.escape(override_params.title),
'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
- { 'xml' : xml, 'title' : override_params.title }
+ { 'xml' : xml, 'title' : override_params.title, 'sound' : 'bad' }
);
if (fancy_prompt_data.fancy_status == 'complete') {
req = obj._request(app,name + '.override',params);
More information about the open-ils-commits
mailing list