1 /* staff client integration functions */
2 function debug(msg){dump(msg+'\n')}
4 function attachEvt(scope, name, action) {
5 if(!eventCache[scope]) eventCache[scope] = {};
6 if(!eventCache[scope][name]) eventCache[scope][name] = [];
7 eventCache[scope][name].push(action);
9 function runEvt(scope, name) {
10 debug('running event '+scope+':'+name);
11 var args = Array.prototype.slice.call(arguments).slice(2);
12 if(eventCache[scope]) {
13 var evt = eventCache[scope][name];
14 for(var i in evt) {evt[i].apply(evt[i], args);}
17 function staff_hold_usr_input_disabler(input) {
18 document.getElementById("hold_usr_input").disabled =
19 Boolean(Number(input.value));
21 window.onload = function() {
22 // record details page events
23 var rec = location.href.match(/\/opac\/record\/(\d+)/);
25 runEvt('rdetail', 'recordRetrieved', rec[1]);
26 runEvt('rdetail', 'MFHDDrawn');
30 function rdetail_next_prev_actions(index, count, prev, next, start, end) {
31 /* we get the relative URL from the template: recid?query_args...
32 replace the recid and args on location.href to get the new URL */
33 function fullurl(url) { return location.href.replace(/\/\d+\??.*/, '/' + url); }
37 window.rdetailPrev = function() { location.href = fullurl(prev); }
39 window.rdetailStart = function() { location.href = fullurl(start); }
42 if (index < count - 1) {
44 window.rdetailNext = function() { location.href = fullurl(next); }
46 window.rdetailEnd = function() { location.href = fullurl(end); }
50 window.onload = function() {
52 runEvt('rdetail', 'nextPrevDrawn', Number(index), Number(count));