1 var docid; var marc_html; var top_pane; var bottom_pane; var opac_frame; var opac_url;
3 var marc_view_reset = true;
4 var marc_edit_reset = true;
5 var copy_browser_reset = true;
6 var hold_browser_reset = true;
7 var serctrl_view_reset = true;
9 function $(id) { return document.getElementById(id); }
13 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
14 if (typeof JSAN == 'undefined') { throw(document.getElementById('offlineStrings').getString('common.jsan.missing')); }
15 JSAN.errorLevel = "die"; // none, warn, or die
16 JSAN.addRepository('..');
17 JSAN.use('util.error'); g.error = new util.error();
18 g.error.sdump('D_TRACE','my_init() for cat/opac.xul');
20 JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
21 XML_HTTP_SERVER = g.data.server_unadorned;
23 // Pull in local customizations
24 var r = new XMLHttpRequest();
25 r.open("GET", xulG.url_prefix('/xul/server/skin/custom.js'), false);
27 if (r.status == 200) {
28 dump('Evaluating /xul/server/skin/custom.js\n');
29 eval( r.responseText );
32 window.help_context_set_locally = true;
34 JSAN.use('util.network'); g.network = new util.network();
37 try { authtime = g.cgi.param('authtime') || xulG.authtime; } catch(E) { g.error.sdump('D_ERROR',E); }
38 try { docid = g.cgi.param('docid') || xulG.docid; } catch(E) { g.error.sdump('D_ERROR',E); }
39 try { opac_url = g.cgi.param('opac_url') || xulG.opac_url; } catch(E) { g.error.sdump('D_ERROR',E); }
40 try { g.view_override = g.cgi.param('default_view') || xulG.default_view; } catch(E) { g.error.sdump('D_ERROR',E); }
42 JSAN.use('util.deck');
43 top_pane = new util.deck('top_pane');
44 bottom_pane = new util.deck('bottom_pane');
49 var err_msg = document.getElementById("offlineStrings").getFormattedString("common.exception", ["cat/opac.xul", E]);
50 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
55 function default_focus() {
56 opac_wrapper_set_help_context();
59 function opac_wrapper_set_help_context() {
61 dump('Entering opac.js, opac_wrapper_set_help_context\n');
62 var cw = bottom_pane.get_contentWindow();
63 if (cw && typeof cw['location'] != 'undefined') {
64 if (typeof cw.help_context_set_locally == 'undefined') {
66 'protocol' : cw.location.protocol,
67 'hostname' : cw.location.hostname,
68 'port' : cw.location.port,
69 'pathname' : cw.location.pathname,
72 xulG.set_help_context(help_params);
74 dump('\tcw.help_context_set_locally = ' + cw.help_context_set_locally + '\n');
75 if (typeof cw.default_focus == 'function') {
80 dump('opac.js: problem in opac_wrapper_set_help_context(): bottom_pane = ' + bottom_pane + ' cw = ' + cw + '\n');
81 dump('\tcw.location = ' + cw.location + '\n');
84 // We can expect some errors here if this called before the DOM is ready. Easiest to just trap and ignore
85 dump('Error in opac.js, opac_wrapper_set_help_context(): ' + E + '\n');
89 function set_brief_view() {
90 var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ) + '?docid=' + window.escape(docid);
91 dump('spawning ' + url + '\n');
96 'set_tab_name' : function(n) {
97 if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
98 try { window.xulG.set_tab_name(document.getElementById('offlineStrings').getFormattedString("cat.bib_record", [n])); } catch(E) { alert(E); }
100 dump('no set_tab_name\n');
107 function set_marc_view() {
108 g.view = 'marc_view';
109 if (marc_view_reset) {
110 bottom_pane.reset_iframe( xulG.url_prefix( urls.XUL_MARC_VIEW ) + '?docid=' + window.escape(docid),{},xulG);
111 marc_view_reset = false;
113 bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_MARC_VIEW ) + '?docid=' + window.escape(docid),{},xulG);
115 opac_wrapper_set_help_context();
116 bottom_pane.get_contentWindow().addEventListener('load',opac_wrapper_set_help_context,false);
119 function set_marc_edit() {
120 g.view = 'marc_edit';
121 var a = xulG.url_prefix( urls.XUL_MARC_EDIT );
124 'record' : { 'url' : '/opac/extras/supercat/retrieve/marcxml/record/' + docid, "id": docid, "rtype": "bre" },
125 'fast_add_item' : function(doc_id,cn_label,cp_barcode) {
127 var cat = { util: {} }; /* FIXME: kludge since we can't load remote JSAN libraries into chrome */
128 cat.util.spawn_copy_editor = function(params) {
130 if (!params.copy_ids && !params.copies) return;
131 if (params.copy_ids && params.copy_ids.length == 0) return;
132 if (params.copies && params.copies.length == 0) return;
133 if (params.copy_ids) params.copy_ids = js2JSON(params.copy_ids); // legacy
134 if (!params.caller_handles_update) params.handle_update = 1; // legacy
137 JSAN.use('util.network'); obj.network = new util.network();
138 JSAN.use('util.error'); obj.error = new util.error();
141 if (params.copy_ids && params.copy_ids.length > 1 && params.edit == 1)
142 title = $("offlineStrings").getString('staff.cat.util.copy_editor.batch_edit');
143 else if(params.copies && params.copies.length > 1 && params.edit == 1)
144 title = $("offlineStrings").getString('staff.cat.util.copy_editor.batch_view');
145 else if(params.copy_ids && params.copy_ids.length == 1)
146 title = $("offlineStrings").getString('staff.cat.util.copy_editor.edit');
148 title = $("offlineStrings").getString('staff.cat.util.copy_editor.view');
150 JSAN.use('util.window'); var win = new util.window();
151 var my_xulG = win.open(
152 (urls.XUL_COPY_EDITOR),
154 'chrome,modal,resizable',
157 if (!my_xulG.copies && params.edit) {
159 return my_xulG.copies;
163 JSAN.use('util.error'); var error = new util.error();
164 error.standard_unexpected_error_alert('Error in chrome/content/cat/opac.js, cat.util.spawn_copy_editor',E);
167 cat.util.fast_item_add = function(doc_id,cn_label,cp_barcode) {
171 JSAN.use('util.error'); error = new util.error();
172 JSAN.use('util.network'); var network = new util.network();
174 var acn_id = network.simple_request(
175 'FM_ACN_FIND_OR_CREATE',
176 [ ses(), cn_label, doc_id, ses('ws_ou') ]
179 if (typeof acn_id.ilsevent != 'undefined') {
180 error.standard_unexpected_error_alert('Error in chrome/content/cat/opac.js, cat.util.fast_item_add', acn_id);
184 var copy_obj = new acp();
187 copy_obj.barcode( cp_barcode );
188 copy_obj.call_number( acn_id );
189 copy_obj.circ_lib( ses('ws_ou') );
190 /* FIXME -- use constants */
193 copy_obj.deposit_amount(0);
194 copy_obj.fine_level(2);
195 copy_obj.loan_duration(2);
196 copy_obj.location(1);
198 copy_obj.circulate(get_db_true());
199 copy_obj.holdable(get_db_true());
200 copy_obj.opac_visible(get_db_true());
201 copy_obj.ref(get_db_false());
203 JSAN.use('util.window'); var win = new util.window();
204 return cat.util.spawn_copy_editor( { 'handle_update' : 1, 'edit' : 1, 'docid' : doc_id, 'copies' : [ copy_obj ] });
207 if (error) error.standard_unexpected_error_alert('Error in chrome/content/cat/opac.js, cat.util.fast_item_add #2',E); else alert('FIXME: ' + E);
210 return cat.util.fast_item_add(doc_id,cn_label,cp_barcode);
212 alert('Error in chrome/content/cat/opac.js, set_marc_edit, fast_item_add: ' + E);
216 'label' : document.getElementById('offlineStrings').getString('cat.save_record'),
217 'func' : function (new_marcxml) {
219 var r = g.network.simple_request('MARC_XML_RECORD_UPDATE', [ ses(), docid, new_marcxml ]);
220 marc_view_reset = true;
221 copy_browser_reset = true;
222 hold_browser_reset = true;
223 if (typeof r.ilsevent != 'undefined') {
228 'oncomplete' : function() {}
232 g.error.standard_unexpected_error_alert(document.getElementById('offlineStrings').getString("cat.save.failure"), E);
237 if (marc_edit_reset) {
238 bottom_pane.reset_iframe( a,b,c );
239 marc_edit_reset = false;
241 bottom_pane.set_iframe( a,b,c );
243 opac_wrapper_set_help_context();
244 bottom_pane.get_contentWindow().addEventListener('load',opac_wrapper_set_help_context,false);
247 function set_copy_browser() {
248 g.view = 'copy_browser';
249 if (copy_browser_reset) {
250 bottom_pane.reset_iframe( xulG.url_prefix( urls.XUL_COPY_VOLUME_BROWSE ) + '?docid=' + window.escape(docid),{},xulG);
251 copy_browser_reset =false;
253 bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_COPY_VOLUME_BROWSE ) + '?docid=' + window.escape(docid),{},xulG);
255 opac_wrapper_set_help_context();
256 bottom_pane.get_contentWindow().addEventListener('load',opac_wrapper_set_help_context,false);
259 function set_hold_browser() {
260 g.view = 'hold_browser';
261 if (hold_browser_reset) {
262 bottom_pane.reset_iframe( xulG.url_prefix( urls.XUL_HOLDS_BROWSER ) + '?docid=' + window.escape(docid),{},xulG);
263 hold_browser_reset = false;
265 bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_HOLDS_BROWSER ) + '?docid=' + window.escape(docid),{},xulG);
267 opac_wrapper_set_help_context();
268 bottom_pane.get_contentWindow().addEventListener('load',opac_wrapper_set_help_context,false);
272 function open_acq_orders() {
274 var content_params = {
276 "authtime": ses("authtime"),
278 "show_nav_buttons": true,
279 "show_print_button": false
282 ["url_prefix", "new_tab", "set_tab", "close_tab", "new_patron_tab",
283 "set_patron_tab", "volume_item_creator", "get_new_session",
284 "holdings_maintenance_tab", "set_tab_name", "open_chrome_window",
285 "url_prefix", "network_meter", "page_meter", "set_statusbar",
287 ].forEach(function(k) { content_params[k] = xulG[k]; });
289 var loc = urls.XUL_BROWSER + "?url=" + window.escape(
290 xulG.url_prefix("/eg/acq/lineitem/related/") +
291 docid + "?target=bib"
295 "tab_name": $("offlineStrings").getString(
296 "staff.cat.opac.related_items"
302 g.error.sdump("D_ERROR", E);
306 function open_alt_serial_mgmt() {
308 var content_params = {
310 "authtime": ses("authtime"),
311 "show_nav_buttons": true,
313 "show_print_button": false
316 ["url_prefix", "new_tab", "set_tab", "close_tab", "new_patron_tab",
317 "set_patron_tab", "volume_item_creator", "get_new_session",
318 "holdings_maintenance_tab", "set_tab_name", "open_chrome_window",
319 "url_prefix", "network_meter", "page_meter", "set_statusbar",
321 ].forEach(function(k) { content_params[k] = xulG[k]; });
323 var loc = urls.XUL_BROWSER + "?url=" + window.escape(
324 xulG.url_prefix("/eg/serial/list_subscription/") + docid
328 "tab_name": $("offlineStrings").getString(
329 "staff.cat.opac.serial_alt_mgmt"
335 g.error.sdump("D_ERROR", E);
339 function set_opac() {
342 var content_params = {
343 'show_nav_buttons' : true,
344 'show_print_button' : true,
345 'passthru_content_params' : {
347 'authtime' : ses('authtime'),
348 'window_open' : function(a,b,c) {
350 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
351 return window.open(a,b,c);
353 g.error.standard_unexpected_error_alert('window_open',E);
357 'on_url_load' : function(f) {
358 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
361 if (typeof f.contentWindow.wrappedJSObject.attachEvt != 'undefined') {
362 win = f.contentWindow.wrappedJSObject;
364 win = f.contentWindow;
367 win = f.contentWindow;
369 win.attachEvt("rdetail", "recordRetrieved",
372 if (docid == id) return;
376 g.error.standard_unexpected_error_alert('rdetail -> recordRetrieved',E);
381 g.f_record_start = null; g.f_record_prev = null; g.f_record_next = null; g.f_record_end = null;
382 $('record_start').disabled = true; $('record_next').disabled = true;
383 $('record_prev').disabled = true; $('record_end').disabled = true;
384 $('record_pos').setAttribute('value','');
386 win.attachEvt("rdetail", "nextPrevDrawn",
387 function(rIndex,rCount){
388 $('record_pos').setAttribute('value', document.getElementById('offlineStrings').getFormattedString('cat.record.counter', [(1+rIndex), rCount ? rCount : 1]));
389 if (win.rdetailNext) {
390 g.f_record_next = function() {
391 g.view_override = g.view;
394 $('record_next').disabled = false;
396 if (win.rdetailPrev) {
397 g.f_record_prev = function() {
398 g.view_override = g.view;
401 $('record_prev').disabled = false;
403 if (win.rdetailStart) {
404 g.f_record_start = function() {
405 g.view_override = g.view;
408 $('record_start').disabled = false;
410 if (win.rdetailEnd) {
411 g.f_record_end = function() {
412 g.view_override = g.view;
415 $('record_end').disabled = false;
420 $('mfhd_add').setAttribute('oncommand','create_mfhd()');
421 var mfhd_edit_menu = $('mfhd_edit');
422 var mfhd_delete_menu = $('mfhd_delete');
424 // clear menus on subsequent loads
425 if (mfhd_edit_menu.firstChild) {
426 mfhd_edit_menu.removeChild(mfhd_edit_menu.firstChild);
427 mfhd_delete_menu.removeChild(mfhd_delete_menu.firstChild);
430 mfhd_edit_menu.disabled = true;
431 mfhd_delete_menu.disabled = true;
433 win.attachEvt("rdetail", "MFHDDrawn",
435 if (win.mfhdDetails && win.mfhdDetails.length > 0) {
437 g.mfhd.details = win.mfhdDetails;
438 mfhd_edit_menu.disabled = false;
439 mfhd_delete_menu.disabled = false;
440 for (var i = 0; i < win.mfhdDetails.length; i++) {
441 var mfhd_details = win.mfhdDetails[i];
442 var num = mfhd_details.entryNum;
444 var label = mfhd_details.label + ' (' + num + ')';
445 var item = mfhd_edit_menu.appendItem(label);
446 item.setAttribute('oncommand','open_mfhd_editor('+mfhd_details.id+')');
447 item = mfhd_delete_menu.appendItem(label);
448 item.setAttribute('oncommand','delete_mfhd('+mfhd_details.id+')');
454 'url_prefix' : xulG.url_prefix,
456 content_params.new_tab = xulG.new_tab;
457 content_params.set_tab = xulG.set_tab;
458 content_params.close_tab = xulG.close_tab;
459 content_params.new_patron_tab = xulG.new_patron_tab;
460 content_params.set_patron_tab = xulG.set_patron_tab;
461 content_params.volume_item_creator = xulG.volume_item_creator;
462 content_params.get_new_session = xulG.get_new_session;
463 content_params.holdings_maintenance_tab = xulG.holdings_maintenance_tab;
464 content_params.set_tab_name = xulG.set_tab_name;
465 content_params.open_chrome_window = xulG.open_chrome_window;
466 content_params.url_prefix = xulG.url_prefix;
467 content_params.network_meter = xulG.network_meter;
468 content_params.page_meter = xulG.page_meter;
469 content_params.set_statusbar = xulG.set_statusbar;
470 content_params.set_help_context = xulG.set_help_context;
472 if (opac_url) { content_params.url = opac_url; } else { content_params.url = xulG.url_prefix( urls.browser ); }
473 browser_frame = bottom_pane.set_iframe( xulG.url_prefix(urls.XUL_BROWSER) + '?name=Catalog', {}, content_params);
474 /* // Remember to use the REMOTE_BROWSER if we ever try to move this to remote xul again
475 browser_frame = bottom_pane.set_iframe( xulG.url_prefix(urls.XUL_REMOTE_BROWSER) + '?name=Catalog', {}, content_params);
478 g.error.sdump('D_ERROR','set_opac: ' + E);
480 opac_wrapper_set_help_context();
481 bottom_pane.get_contentWindow().addEventListener('load',opac_wrapper_set_help_context,false);
484 function set_serctrl_view() {
485 g.view = 'serctrl_view';
486 if (serctrl_view_reset) {
487 bottom_pane.reset_iframe( xulG.url_prefix( urls.XUL_SERIAL_SERCTRL_MAIN ) + '?docid=' + window.escape(docid), {}, xulG);
488 serctrl_view_reset =false;
490 bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_SERIAL_SERCTRL_MAIN ) + '?docid=' + window.escape(docid), {}, xulG);
494 function create_mfhd() {
496 g.data.create_mfhd_aou = '';
497 JSAN.use('util.window'); var win = new util.window();
499 xulG.url_prefix(urls.XUL_SERIAL_SELECT_AOU),
501 'chrome,resizable,modal,centerscreen'
503 if (!g.data.create_mfhd_aou) {
506 var r = g.network.simple_request(
507 'MFHD_XML_RECORD_CREATE',
508 [ ses(), 1, g.data.create_mfhd_aou, docid ]
510 if (typeof r.ilsevent != 'undefined') {
513 alert("MFHD record created."); //TODO: better success message
514 //TODO: refresh opac display
516 g.error.standard_unexpected_error_alert("Create MFHD failed", E); //TODO: better error handling
520 function delete_mfhd(sre_id) {
521 if (g.error.yns_alert(
522 document.getElementById('offlineStrings').getFormattedString('serial.delete_record.confirm', [sre_id]),
523 document.getElementById('offlineStrings').getString('cat.opac.delete_record'),
524 document.getElementById('offlineStrings').getString('cat.opac.delete'),
525 document.getElementById('offlineStrings').getString('cat.opac.cancel'),
527 document.getElementById('offlineStrings').getString('cat.opac.record_deleted.confirm')) == 0) {
528 var robj = g.network.request(
529 'open-ils.permacrud',
530 'open-ils.permacrud.delete.sre',
532 if (typeof robj.ilsevent != 'undefined') {
533 alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_deleted.error', [docid, robj.textcode, robj.desc]) + '\n');
535 alert(document.getElementById('offlineStrings').getString('cat.opac.record_deleted'));
536 //TODO: refresh opac display
541 function open_mfhd_editor(sre_id) {
543 var r = g.network.simple_request(
547 if (typeof r.ilsevent != 'undefined') {
550 open_marc_editor(r, 'MFHD');
552 g.error.standard_unexpected_error_alert("Create MFHD failed", E); //TODO: better error handling
556 function open_marc_editor(rec, label) {
557 win = window.open( xulG.url_prefix('/xul/server/cat/marcedit.xul') );
560 record : {marc : rec.marc()},
562 label: 'Save ' + label,
563 func: function(xmlString) { // TODO: switch to pcrud, or define an sre update method in Serial.pm?
564 var method = 'open-ils.permacrud.update.' + rec.classname;
567 'open-ils.permacrud', method,
575 function bib_in_new_tab() {
577 var url = browser_frame.contentWindow.g.browser.controller.view.browser_browser.contentWindow.wrappedJSObject.location.href;
578 var content_params = { 'session' : ses(), 'authtime' : ses('authtime'), 'opac_url' : url };
579 content_params.url_prefix = xulG.url_prefix;
580 content_params.new_tab = xulG.new_tab;
581 content_params.set_tab = xulG.set_tab;
582 content_params.close_tab = xulG.close_tab;
583 content_params.new_patron_tab = xulG.new_patron_tab;
584 content_params.set_patron_tab = xulG.set_patron_tab;
585 content_params.volume_item_creator = xulG.volume_item_creator;
586 content_params.get_new_session = xulG.get_new_session;
587 content_params.holdings_maintenance_tab = xulG.holdings_maintenance_tab;
588 content_params.set_tab_name = xulG.set_tab_name;
589 content_params.open_chrome_window = xulG.open_chrome_window;
590 content_params.url_prefix = xulG.url_prefix;
591 content_params.network_meter = xulG.network_meter;
592 content_params.page_meter = xulG.page_meter;
593 content_params.set_statusbar = xulG.set_statusbar;
594 content_params.set_help_context = xulG.set_help_context;
596 xulG.new_tab(xulG.url_prefix(urls.XUL_OPAC_WRAPPER), {}, content_params);
598 g.error.sdump('D_ERROR',E);
602 function batch_receive_in_new_tab() {
604 var content_params = {"session": ses(), "authtime": ses("authtime")};
606 ["url_prefix", "new_tab", "set_tab", "close_tab", "new_patron_tab",
607 "set_patron_tab", "volume_item_creator", "get_new_session",
608 "holdings_maintenance_tab", "set_tab_name", "open_chrome_window",
609 "url_prefix", "network_meter", "page_meter", "set_statusbar",
611 ].forEach(function(k) { content_params[k] = xulG[k]; });
614 xulG.url_prefix(urls.XUL_SERIAL_BATCH_RECEIVE) +
615 "?docid=" + window.escape(docid), {
616 "tab_name": $("offlineStrings").getString(
617 "menu.cmd_serial_batch_receive.tab"
622 g.error.sdump("D_ERROR", E);
626 function remove_me() {
627 var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ) + '?docid=' + window.escape(docid);
628 dump('removing ' + url + '\n');
629 try { top_pane.remove_iframe( url ); } catch(E) { dump(E + '\n'); }
630 $('nav').setAttribute('hidden','true');
633 function add_to_bucket() {
634 JSAN.use('util.window'); var win = new util.window();
636 xulG.url_prefix(urls.XUL_RECORD_BUCKETS_QUICK),
638 'chrome,resizable,modal,centerscreen',
640 record_ids: [ docid ]
645 function mark_for_overlay() {
646 g.data.marked_record = docid;
647 g.data.stash('marked_record');
648 var robj = g.network.simple_request('MODS_SLIM_RECORD_RETRIEVE.authoritative',[docid]);
649 if (typeof robj.ilsevent == 'undefined') {
650 g.data.marked_record_mvr = robj;
652 g.data.marked_record_mvr = null;
653 g.error.standard_unexpected_error_alert('in mark_for_overlay',robj);
655 g.data.stash('marked_record_mvr');
656 if (g.data.marked_record_mvr) {
657 alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_marked_for_overlay.tcn.alert',[ g.data.marked_record_mvr.tcn() ]));
658 xulG.set_statusbar(1, $("offlineStrings").getFormattedString('staff.cat.z3950.marked_record_for_overlay_indicator.tcn.label',[g.data.marked_record_mvr.tcn()]) );
660 alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_marked_for_overlay.record_id.alert',[ g.data.marked_record ]));
661 xulG.set_statusbar(1, $("offlineStrings").getFormattedString('staff.cat.z3950.marked_record_for_overlay_indicator.record_id.label',[g.data.marked_record]) );
665 function mark_for_hold_transfer() {
666 g.data.marked_record_for_hold_transfer = docid;
667 g.data.stash('marked_record_for_hold_transfer');
668 var robj = g.network.simple_request('MODS_SLIM_RECORD_RETRIEVE.authoritative',[docid]);
669 if (typeof robj.ilsevent == 'undefined') {
670 g.data.marked_record_for_hold_transfer_mvr = robj;
672 g.data.marked_record_for_hold_transfer_mvr = null;
673 g.error.standard_unexpected_error_alert('in mark_for_hold_transfer',robj);
675 g.data.stash('marked_record_for_hold_transfer_mvr');
676 if (g.data.marked_record_mvr) {
677 var m = $("offlineStrings").getFormattedString('staff.cat.opac.marked_record_for_hold_transfer_indicator.tcn.label',[g.data.marked_record_for_hold_transfer_mvr.tcn()]);
678 alert(m); xulG.set_statusbar(1, m );
680 var m = $("offlineStrings").getFormattedString('staff.cat.opac.marked_record_for_hold_transfer_indicator.record_id.label',[g.data.marked_record_for_hold_transfer]);
681 alert(m); xulG.set_statusbar(1, m );
685 function transfer_title_holds() {
686 g.data.stash_retrieve();
687 var target = g.data.marked_record_for_hold_transfer;
689 var m = $("offlineStrings").getString('staff.cat.opac.title_for_hold_transfer.destination_needed.label');
693 var robj = g.network.simple_request('TRANSFER_TITLE_HOLDS',[ ses(), target, [ docid ] ]);
695 var m = $("offlineStrings").getString('staff.cat.opac.title_for_hold_transfer.success.label');
698 var m = $("offlineStrings").getString('staff.cat.opac.title_for_hold_transfer.failure.label');
701 hold_browser_reset = true;
702 if (g.view == 'hold_browser') { set_hold_browser(); };
705 function delete_record() {
706 if (g.error.yns_alert(
707 document.getElementById('offlineStrings').getFormattedString('cat.opac.delete_record.confirm', [docid]),
708 document.getElementById('offlineStrings').getString('cat.opac.delete_record'),
709 document.getElementById('offlineStrings').getString('cat.opac.delete'),
710 document.getElementById('offlineStrings').getString('cat.opac.cancel'),
712 document.getElementById('offlineStrings').getString('cat.opac.record_deleted.confirm')) == 0) {
713 var robj = g.network.simple_request('FM_BRE_DELETE',[ses(),docid]);
714 if (typeof robj.ilsevent != 'undefined') {
715 alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_deleted.error', [docid, robj.textcode, robj.desc]) + '\n');
717 alert(document.getElementById('offlineStrings').getString('cat.opac.record_deleted'));
718 refresh_display(docid);
723 function undelete_record() {
724 if (g.error.yns_alert(
725 document.getElementById('offlineStrings').getFormattedString('cat.opac.undelete_record.confirm', [docid]),
726 document.getElementById('offlineStrings').getString('cat.opac.undelete_record'),
727 document.getElementById('offlineStrings').getString('cat.opac.undelete'),
728 document.getElementById('offlineStrings').getString('cat.opac.cancel'),
730 document.getElementById('offlineStrings').getString('cat.opac.record_undeleted.confirm')) == 0) {
732 var robj = g.network.simple_request('FM_BRE_UNDELETE',[ses(),docid]);
733 if (typeof robj.ilsevent != 'undefined') {
734 alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_undeleted.error', [docid, robj.textcode, robj.desc]) + '\n');
736 alert(document.getElementById('offlineStrings').getString('cat.opac.record_undeleted'));
737 refresh_display(docid);
742 function refresh_display(id) {
744 marc_view_reset = true;
745 marc_edit_reset = true;
746 copy_browser_reset = true;
747 hold_browser_reset = true;
748 while(top_pane.node.lastChild) top_pane.node.removeChild( top_pane.node.lastChild );
749 var children = bottom_pane.node.childNodes;
750 for (var i = 0; i < children.length; i++) {
751 if (children[i] != browser_frame) bottom_pane.node.removeChild(children[i]);
755 $('nav').setAttribute('hidden','false');
756 var settings = g.network.simple_request(
758 [ ses(), g.data.list.au[0].id() ]
760 var view = settings['staff_client.catalog.record_view.default'];
761 if (g.view_override) {
762 view = g.view_override;
763 g.view_override = null;
766 case 'marc_view' : set_marc_view(); break;
767 case 'marc_edit' : set_marc_edit(); break;
768 case 'copy_browser' : set_copy_browser(); break;
769 case 'hold_browser' : set_hold_browser(); break;
770 case 'serctrl_view' : set_serctrl_view(); break;
772 default: set_opac(); break;
774 opac_wrapper_set_help_context();
776 g.error.standard_unexpected_error_alert('in refresh_display',E);
780 function set_default() {
781 var robj = g.network.simple_request(
783 [ ses(), g.data.list.au[0].id(), { 'staff_client.catalog.record_view.default' : g.view } ]
785 if (typeof robj.ilsevent != 'undefined') {
786 if (robj.ilsevent != 0) g.error.standard_unexpected_error_alert(document.getElementById('offlineStrings').getString('cat.preference.error'), robj);
790 function add_volumes() {
794 edit = g.network.request(
795 api.PERM_MULTI_ORG_CHECK.app,
796 api.PERM_MULTI_ORG_CHECK.method,
801 [ 'CREATE_VOLUME', 'CREATE_COPY' ]
803 ).length == 0 ? 1 : 0;
805 g.error.sdump('D_ERROR','batch permission check: ' + E);
809 alert(document.getElementById('offlineStrings').getString('staff.circ.copy_status.add_volumes.perm_failure'));
810 return; // no read-only view for this interface
813 var title = document.getElementById('offlineStrings').getFormattedString('staff.circ.copy_status.add_volumes.title', [docid]);
815 JSAN.use('util.window'); var win = new util.window();
817 window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR),
820 { 'doc_id' : docid, 'ou_ids' : [ ses('ws_ou') ] }
823 alert('Error in chrome/content/cat/opac.js, add_volumes(): ' + E);