From: phasefx Date: Mon, 26 Apr 2010 03:54:14 +0000 (+0000) Subject: chicanery to let us pass the queue from one sound object to another (where for exampl... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9076cb8440d01c2c2dec529bcdca414299e4796f;p=contrib%2FConifer.git chicanery to let us pass the queue from one sound object to another (where for example, the timer for the first object may be blocked by the modalness of the window for the second object. This ensures that sounds queued up prior to a fancy prompt popup will play during the popup and not after git-svn-id: svn://svn.open-ils.org/ILS/trunk@16297 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/chrome/content/util/fancy_prompt.xul b/Open-ILS/xul/staff_client/chrome/content/util/fancy_prompt.xul index 50981b087a..9bf0e6ea29 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/fancy_prompt.xul +++ b/Open-ILS/xul/staff_client/chrome/content/util/fancy_prompt.xul @@ -99,8 +99,16 @@ } var snd = xul_param('sound',{'modal_xulG':true}); + var snd_obj = xul_param('sound_object',{'modal_xulG':true}); if (snd) { - try { JSAN.use('util.sound'); var sound = new util.sound(); sound[ snd ](); } catch(E) { alert(E); } + try { + var params = { 'interval' : 500, 'sig' : 'fancy_prompt_my_init' }; + if (snd_obj) { params.reuse_queue_from_this_snd_obj = snd_obj; } + JSAN.use('util.sound'); var sound = new util.sound(params); + if (snd) { sound[ snd ](); } + } catch(E) { + alert(E); + } } JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); diff --git a/Open-ILS/xul/staff_client/chrome/content/util/network.js b/Open-ILS/xul/staff_client/chrome/content/util/network.js index b84644a96c..4ed7cb5de9 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/network.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/network.js @@ -473,7 +473,7 @@ util.network.prototype = { //+ '?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, 'sound' : 'bad' } + { 'xml' : xml, 'title' : override_params.title, 'sound' : 'bad', 'sound_object' : obj.sound } ); if (fancy_prompt_data.fancy_status == 'complete') { req = obj._request(app,name + '.override',params); diff --git a/Open-ILS/xul/staff_client/chrome/content/util/sound.js b/Open-ILS/xul/staff_client/chrome/content/util/sound.js index a190d3d278..8d4665382e 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/sound.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/sound.js @@ -12,7 +12,7 @@ util.sound = function (params) { /* We're going to turn this guy into a singleton, at least for a given window, and look for it in xulG */ if (! window.xulG) { window.xulG = {}; } - if (window.xulG._sound) { + if (window.xulG._sound && !params.reuse_queue_from_this_snd_obj) { dump('SOUND('+this.sig+'): reusing sound from ' + window.xulG._sound.origin + '('+xulG._sound.sig+') for ' + location.pathname + '\n'); return window.xulG._sound; } else { @@ -21,10 +21,14 @@ util.sound = function (params) { /* So we can queue up sounds and put a pause between them instead of having them trample over each other */ /* Limitation: interval only gets set once for a singleton */ - if (params.interval) { + if (params.interval || params.reuse_queue_from_this_snd_obj) { this._queue = true; - this._funcs = params.queue || []; - JSAN.use('util.exec'); this._exec = new util.exec(); var intervalId = this._exec.timer( this._funcs, params.interval ); + if (params.reuse_queue_from_this_snd_obj) { + this._funcs = params.reuse_queue_from_this_snd_obj._funcs || []; + } else { + this._funcs = []; + } + JSAN.use('util.exec'); this._exec = new util.exec(); var intervalId = this._exec.timer( this._funcs, params.interval || 500 ); dump('SOUND('+this.sig+'): starting timer with intervalId = ' + intervalId + '\n'); }