From: Jason Etheridge Date: Wed, 20 Jul 2011 20:51:46 +0000 (-0400) Subject: more sound hooks during check-in for transits, holds, etc. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a75c19a8ceabcd2bf43ae937623e79dfbe7244fd;p=evergreen%2Fpines.git more sound hooks during check-in for transits, holds, etc. Adds util.sound.special which can be used like this: util.sound.special('foo'); and looks for a URL constant matching this: urls['AUDIO_special_foo'] Also give util.sound a more programmable delay via custom.js: var _sound_delay_interval = 50000; Here are the new hooks for check-in and how you might use them: urls['AUDIO_special_checkin.cataloging'] = '/xul/server/skin/media/custom/cataloging.wav'; urls['AUDIO_special_checkin.error'] = '/xul/server/skin/media/custom/error.wav'; urls['AUDIO_special_checkin.hold_capture_delayed'] = '/xul/server/skin/media/custom/hold_capture_delayed.wav'; urls['AUDIO_special_checkin.hold_shelf'] = '/xul/server/skin/media/custom/hold_shelf.wav'; urls['AUDIO_special_checkin.no_change'] = '/xul/server/skin/media/custom/no_change.wav'; urls['AUDIO_special_checkin.not_found'] = '/xul/server/skin/media/custom/not_found.wav'; urls['AUDIO_special_checkin.reservation_shelf'] = '/xul/server/skin/media/custom/reservation_shelf.wav'; urls['AUDIO_special_checkin.success'] = '/xul/server/skin/media/custom/success.wav'; urls['AUDIO_special_checkin.transit'] = '/xul/server/skin/media/custom/transit.wav'; urls['AUDIO_special_checkin.transit_for_hold'] = '/xul/server/skin/media/custom/transit_for_hold.wav'; Signed-off-by: Jason Etheridge Signed-off-by: Lebbeous Fogle-Weekley --- 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 9bf0e6ea29..e66ddede36 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 @@ -102,7 +102,7 @@ var snd_obj = xul_param('sound_object',{'modal_xulG':true}); if (snd) { try { - var params = { 'interval' : 500, 'sig' : 'fancy_prompt_my_init' }; + var params = { '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 ](); } 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 8d4665382e..0d57f84f66 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/sound.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/sound.js @@ -28,7 +28,12 @@ util.sound = function (params) { } else { this._funcs = []; } - JSAN.use('util.exec'); this._exec = new util.exec(); var intervalId = this._exec.timer( this._funcs, params.interval || 500 ); + JSAN.use('util.exec'); + this._exec = new util.exec(); + var delay = params.interval; + if (!delay) { delay = _sound_delay_interval; /* define this in server/skin/custom.js */ } + if (!delay) { delay = 2000; } + var intervalId = this._exec.timer( this._funcs, delay ); dump('SOUND('+this.sig+'): starting timer with intervalId = ' + intervalId + '\n'); } @@ -102,6 +107,12 @@ util.sound.prototype = { this.play_url( urls[key] ); }, + 'special' : function special(e) { + var key = 'AUDIO_' + arguments.callee.name + '_' + e; + dump('SOUND('+this.sig+'): key = ' + key + '\n'); + this.play_url( urls[key] ); + }, + 'good' : function good(e){ var key = 'AUDIO_' + arguments.callee.name; dump('SOUND('+this.sig+'): key = ' + key + '\n'); diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js index c94c2ca54c..8a3c355151 100644 --- a/Open-ILS/xul/staff_client/server/circ/util.js +++ b/Open-ILS/xul/staff_client/server/circ/util.js @@ -2802,6 +2802,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che if (check.ilsevent == 3 /* NO_CHANGE */) { //msg = 'This item is already checked in.\n'; check.what_happened = 'no_change'; + sound.special('checkin.no_change'); if (no_change_label) { var m = no_change_label.getAttribute('value'); var text = document.getElementById('circStrings').getFormattedString('staff.circ.utils.item_checked_in', [params.barcode]); @@ -2817,6 +2818,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che } if (check.ilsevent == 1202 /* ITEM_NOT_CATALOGED */ && check.copy.status() != 11) { check.what_happened = 'error'; + sound.special('checkin.error'); var copy_status = (data.hash.ccs[ check.copy.status() ] ? data.hash.ccs[ check.copy.status() ].name() : check.copy.status().name() ); var err_msg = document.getElementById('commonStrings').getString('common.error'); err_msg += '\nFIXME --'; @@ -2829,6 +2831,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che case 0: /* AVAILABLE */ case 7: /* RESHELVING */ check.what_happened = 'success'; + sound.special('checkin.success'); if (msg) { print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]); print_data.route_to = check.route_to; @@ -2838,10 +2841,12 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che break; case 8: /* ON HOLDS SHELF */ check.what_happened = 'hold_shelf'; + sound.special('checkin.hold_shelf'); check.route_to = document.getElementById('circStrings').getString('staff.circ.route_to.hold_shelf'); if (check.payload.hold) { if (check.payload.hold.pickup_lib() != data.list.au[0].ws_ou()) { check.what_happened = 'error'; + sound.special('checkin.error'); var err_msg = document.getElementById('commonStrings').getString('common.error'); err_msg += '\nFIXME: '; err_msg += document.getElementById('circStrings').getString('staff.circ.utils.route_item_error'); @@ -2878,6 +2883,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che } } else { check.what_happened = 'error'; + sound.special('checkin.error'); var err_msg = document.getElementById('commonStrings').getString('common.error'); err_msg += '\nFIXME: '; err_msg += document.getElementById('circStrings').getString('staff.circ.utils.route_item_status_error'); @@ -3062,6 +3068,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che break; case 6: /* IN TRANSIT */ check.what_happened = 'error'; + sound.special('checkin.error'); check.route_to = 'TRANSIT SHELF??'; print_data.route_to; var err_msg = document.getElementById('commonStrings').getString('common.error'); @@ -3071,6 +3078,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che break; case 11: /* CATALOGING */ check.what_happened = 'cataloging'; + sound.special('checkin.cataloging'); check.route_to = 'CATALOGING'; print_data.route_to; var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popups']; @@ -3101,6 +3109,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che case 15: // ON_RESERVATION_SHELF check.route_to = 'RESERVATION SHELF'; check.what_happened = "reservation_shelf"; + sound.special('checkin.reservation_shelf'); if (check.payload.reservation) { if (check.payload.reservation.pickup_lib() != data.list.au[0].ws_ou()) { msg += document.getElementById('commonStrings').getString('common.error'); @@ -3188,6 +3197,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che break; default: check.what_happened = 'error'; + sound.special('checkin.error'); msg += document.getElementById('commonStrings').getString('common.error'); var copy_status = data.hash.ccs[check.copy.status()] ? data.hash.ccs[check.copy.status()].name() : check.copy.status().name(); msg += '\n'; @@ -3212,6 +3222,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che } else /* ROUTE_ITEM */ if (check.ilsevent == 7000) { check.what_happened = 'transit'; + sound.special('checkin.transit'); var lib = data.hash.aou[ check.org ]; check.route_to = lib.shortname(); print_data.route_to = check.route_to; @@ -3269,6 +3280,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che JSAN.use('util.date'); if (check.payload.hold) { check.what_happened = 'transit_for_hold'; + sound.special('checkin.transit_for_hold'); JSAN.use('patron.util'); var au_obj = patron.util.retrieve_fleshed_au_via_id( session, check.payload.hold.usr() ); print_data.user = au_obj; @@ -3454,6 +3466,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che } else /* ASSET_COPY_NOT_FOUND */ if (check.ilsevent == 1502) { check.what_happened = 'not_found'; + sound.special('checkin.not_found'); check.route_to = 'CATALOGING'; var mis_scan_msg = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.status.copy_not_found', [params.barcode]); var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popups']; @@ -3485,6 +3498,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che } else /* HOLD_CAPTURE_DELAYED */ if (check.ilsevent == 7019) { check.what_happened = 'hold_capture_delayed'; + sound.special('checkin.hold_capture_delayed'); var rv = 0; msg += document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.description'); var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popupst']; @@ -3508,6 +3522,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che } else /* NETWORK TIMEOUT */ if (check.ilsevent == -1) { check.what_happened = 'error'; + sound.special('checkin.error'); error.standard_network_error_alert(document.getElementById('circStrings').getString('staff.circ.checkin.suggest_offline')); } else { diff --git a/Open-ILS/xul/staff_client/server/skin/custom.js.example b/Open-ILS/xul/staff_client/server/skin/custom.js.example index d7b36b6aab..5325fd774c 100644 --- a/Open-ILS/xul/staff_client/server/skin/custom.js.example +++ b/Open-ILS/xul/staff_client/server/skin/custom.js.example @@ -1,6 +1,18 @@ /* Settings here override default values from constants.js;for example: urls['AUDIO_good'] = '/xul/server/skin/media/custom/good.wav'; + + urls['AUDIO_special_checkin.cataloging'] = '/xul/server/skin/media/custom/cataloging.wav'; + urls['AUDIO_special_checkin.error'] = '/xul/server/skin/media/custom/error.wav'; + urls['AUDIO_special_checkin.hold_capture_delayed'] = '/xul/server/skin/media/custom/hold_capture_delayed.wav'; + urls['AUDIO_special_checkin.hold_shelf'] = '/xul/server/skin/media/custom/hold_shelf.wav'; + urls['AUDIO_special_checkin.no_change'] = '/xul/server/skin/media/custom/no_change.wav'; + urls['AUDIO_special_checkin.not_found'] = '/xul/server/skin/media/custom/not_found.wav'; + urls['AUDIO_special_checkin.reservation_shelf'] = '/xul/server/skin/media/custom/reservation_shelf.wav'; + urls['AUDIO_special_checkin.success'] = '/xul/server/skin/media/custom/success.wav'; + urls['AUDIO_special_checkin.transit'] = '/xul/server/skin/media/custom/transit.wav'; + urls['AUDIO_special_checkin.transit_for_hold'] = '/xul/server/skin/media/custom/transit_for_hold.wav'; + urls['opac'] = '/opac/' + LOCALE + '/skin/mylib/xml/advanced.xml?nps=1'; urls['opac_rdetail'] = '/opac/' + LOCALE + '/skin/mylib/xml/rdetail.xml'; urls['opac_rresult'] = '/opac/' + LOCALE + '/skin/mylib/xml/rresult.xml';