'fieldmapper' : '/opac/common/js/fmall.js',
'xsl_marc2html' : '/opac/extras/xsl/oilsMARC21slim2HTML.xsl',
- 'AUDIO_GOOD_SOUND' : '/xul/server/skin/media/audio/bonus.wav',
- 'AUDIO_BAD_SOUND' : '/xul/server/skin/media/audio/question.wav',
- 'AUDIO_HORRIBLE_SOUND' : '/xul/server/skin/media/audio/redalert.wav',
- 'AUDIO_CIRC_GOOD_SOUND' : '/xul/server/skin/media/audio/toggled.wav',
- 'AUDIO_CIRC_BAD_SOUND' : '/xul/server/skin/media/audio/question.wav',
+ 'AUDIO_good' : '/xul/server/skin/media/audio/bonus.wav',
+ 'AUDIO_bad' : '/xul/server/skin/media/audio/question.wav',
+ 'AUDIO_horrible' : '/xul/server/skin/media/audio/redalert.wav',
+ 'AUDIO_circ_good' : '/xul/server/skin/media/audio/toggled.wav',
+ 'AUDIO_circ_bad' : '/xul/server/skin/media/audio/question.wav',
+ 'AUDIO_event_ASSET_COPY_NOT_FOUND' : '/xul/server/skin/media/audio/redalert.wav',
'XUL_AUTH_SIMPLE' : '/xul/server/main/simple_auth.xul',
'XUL_BIB_BRIEF' : '/xul/server/cat/bib_brief.xul',
+ (json_string.length > 80 ? obj.error.pretty_print(json_string) : json_string)
+ '\n\nOriginal Request:\n\n'
+ 'request '+app+' '+name+' '+ sparams.slice(1,sparams.length-1));
+ obj.play_sounds( request );
req = obj.rerequest_on_session_timeout(app,name,params,req,override_params,_params);
req = obj.rerequest_on_perm_failure(app,name,params,req,override_params,_params);
if (override_params) {
+ obj.link_id + '\n\n' + ( json_string.length > 80 ? obj.error.pretty_print(json_string) : json_string )
+ '\n\nOriginal Request:\n\n'
+ 'request '+app+' '+name+' '+ sparams.slice(1,sparams.length-1));
+ obj.play_sounds( request );
request = obj.rerequest_on_session_timeout(app,name,params,request,override_params,_params);
request = obj.rerequest_on_perm_failure(app,name,params,request,override_params,_params);
if (override_params) {
try {
var obj = this;
var robj = obj.get_result(req);
- if (robj != null && robj.ilsevent && robj.ilsevent == 1001) {
+ if (robj != null && robj.ilsevent && robj.ilsevent == 1001 /* NO_SESSION */) {
if (obj.get_new_session(name,undefined,true)) {
JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
} catch(E) {
alert(E);
}
+ },
+
+ 'play_sounds' : function(req) {
+ var obj = this;
+ try {
+ var result = req.getResultObject();
+ if (result == null) { return; }
+ if (typeof result.textcode != 'undefined') {
+ obj.sound.event( result );
+ } else {
+ if (typeof result.length != 'undefined') {
+ for (var i = 0; i < result.length; i++) {
+ if (typeof result[i].textcode != 'undefined') {
+ obj.sound.event( result[i] );
+ }
+ }
+ }
+ }
+ } catch(E) {
+ dump('Error in network.js, play_sounds() : ' + E + '\n');
+ }
}
}
var SOUNDContractID = "@mozilla.org/sound;1";
var SOUNDIID = Components.interfaces.nsISound;
this.SOUND = Components.classes[SOUNDContractID].createInstance(SOUNDIID);
+ this.SOUND.init(); // not necessary, but helps avoid delays?
} catch(E) {
dump('util.sound constructor: ' + E + '\n');
'play_url' : function(url) {
+ if (!url) { return; /* sound of silence */ }
+
var obj = this;
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
var url2 = obj.xp_url_init( data.server + url );
- dump('url = ' + url2 + '\n');
+ dump('SOUND: file = ' + url + '\n');
if (typeof data.no_sound == 'undefined' || data.no_sound == false || data.no_sound == 'false') obj.SOUND.play( url2 );
} catch(E) {
try { if (data.no_sound == 'undefined' || data.no_sound == false || data.no_sound == 'false') obj.SOUND.beep(); } catch(F) {
}
dump('play_url(): ' + E + '\n');
}
-
},
- 'good' : function(e){
- this.play_url( urls.AUDIO_GOOD_SOUND );
+ 'event' : function event(evt) {
+ var key = 'AUDIO_' + arguments.callee.name + '_' + evt.textcode;
+ dump('SOUND: key = ' + key + '\n');
+ this.play_url( urls[key] );
},
- 'bad' : function(e){
- this.play_url( urls.AUDIO_BAD_SOUND );
+ 'good' : function good(e){
+ var key = 'AUDIO_' + arguments.callee.name;
+ dump('SOUND: key = ' + key + '\n');
+ this.play_url( urls[key] );
},
- 'horrible' : function(e){
- this.play_url( urls.AUDIO_HORRIBLE_SOUND );
+ 'bad' : function bad(e){
+ var key = 'AUDIO_' + arguments.callee.name;
+ dump('SOUND: key = ' + key + '\n');
+ this.play_url( urls[key] );
},
- 'circ_good' : function(e){
- this.play_url( urls.AUDIO_CIRC_GOOD_SOUND );
+ 'horrible' : function horrible(e){
+ var key = 'AUDIO_' + arguments.callee.name;
+ dump('SOUND: key = ' + key + '\n');
+ this.play_url( urls[key] );
},
- 'circ_bad' : function(e){
- this.play_url( urls.AUDIO_CIRC_BAD_SOUND );
+ 'circ_good' : function circ_good(e){
+ var key = 'AUDIO_' + arguments.callee.name;
+ dump('SOUND: key = ' + key + '\n');
+ this.play_url( urls[key] );
},
+
+ 'circ_bad' : function circ_bad(e){
+ var key = 'AUDIO_' + arguments.callee.name;
+ dump('SOUND: key = ' + key + '\n');
+ this.play_url( urls[key] );
+ }
}
dump('exiting util/sound.js\n');