[open-ils-commits] r16297 - 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:17 EDT 2010


Author: phasefx
Date: 2010-04-25 23:54:14 -0400 (Sun, 25 Apr 2010)
New Revision: 16297

Modified:
   trunk/Open-ILS/xul/staff_client/chrome/content/util/fancy_prompt.xul
   trunk/Open-ILS/xul/staff_client/chrome/content/util/network.js
   trunk/Open-ILS/xul/staff_client/chrome/content/util/sound.js
Log:
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

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:11 UTC (rev 16296)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/fancy_prompt.xul	2010-04-26 03:54:14 UTC (rev 16297)
@@ -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'});

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:11 UTC (rev 16296)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/network.js	2010-04-26 03:54:14 UTC (rev 16297)
@@ -473,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, '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);

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/sound.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/sound.js	2010-04-26 03:54:11 UTC (rev 16296)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/sound.js	2010-04-26 03:54:14 UTC (rev 16297)
@@ -12,7 +12,7 @@
 
         /* 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 @@
 
         /* 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');
         }
 



More information about the open-ils-commits mailing list