1 dump('entering cat.copy_browser.js\n');
4 if (typeof cat == 'undefined') cat = {};
5 cat.copy_browser = function (params) {
7 JSAN.use('util.error'); this.error = new util.error();
9 dump('cat.copy_browser: ' + E + '\n');
13 cat.copy_browser.prototype = {
21 'init' : function( params ) {
26 obj.docid = params.docid;
28 JSAN.use('util.network'); obj.network = new util.network();
29 JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
31 obj.controller_init(params);
33 obj.list_init(params);
37 obj.controller.render();
39 obj.default_depth = obj.depth_menu_init();
40 obj.default_lib = obj.data.hash.aou[ obj.library_menu_init() ];
42 document.getElementById('show_acns').addEventListener(
45 JSAN.use('util.file');
46 var file = new util.file(
47 'copy_browser_prefs.'+obj.data.server_unadorned);
48 util.widgets.save_attributes(file, {
49 'lib_menu' : [ 'value' ],
50 'depth_menu' : [ 'value' ],
51 'show_acns' : [ 'checked' ],
52 'show_acps' : [ 'checked' ],
53 'hide_aous' : [ 'checked' ] });
58 document.getElementById('show_acps').addEventListener(
61 JSAN.use('util.file');
62 var file = new util.file(
63 'copy_browser_prefs.'+obj.data.server_unadorned);
64 util.widgets.save_attributes(file, {
65 'lib_menu' : [ 'value' ],
66 'depth_menu' : [ 'value' ],
67 'show_acns' : [ 'checked' ],
68 'show_acps' : [ 'checked' ],
69 'hide_aous' : [ 'checked' ] });
74 document.getElementById('hide_aous').addEventListener(
77 JSAN.use('util.file');
78 var file = new util.file(
79 'copy_browser_prefs.'+obj.data.server_unadorned);
80 util.widgets.save_attributes(file, {
81 'lib_menu' : [ 'value' ],
82 'depth_menu' : [ 'value' ],
83 'show_acns' : [ 'checked' ],
84 'show_acps' : [ 'checked' ],
85 'hide_aous' : [ 'checked' ] });
90 obj.show_my_libs( obj.default_lib.id() );
92 JSAN.use('util.exec'); var exec = new util.exec(20); exec.timer(obj.funcs,100);
94 obj.show_consortial_count();
97 this.error.standard_unexpected_error_alert('cat.copy_browser.init: ',E);
101 'controller_init' : function(params) {
104 JSAN.use('util.controller'); obj.controller = new util.controller();
108 'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
111 function() { obj.list.clipboard(); }
116 alert(document.getElementById('commonStrings').getString('common.unimplemented'));
119 'cmd_show_my_libs' : [
125 'cmd_show_all_libs' : [
131 'cmd_show_libs_with_copies' : [
134 obj.show_libs_with_copies();
144 'cmd_request_items' : [
147 JSAN.use('cat.util'); JSAN.use('util.functional');
149 var list = util.functional.filter_list( obj.sel_list, function (o) { return o.split(/_/)[0] == 'acp'; });
151 list = util.functional.map_list( list, function (o) { return o.split(/_/)[1]; });
153 cat.util.request_items( list );
156 'sel_mark_items_damaged' : [
159 JSAN.use('cat.util'); JSAN.use('util.functional');
161 var list = util.functional.filter_list( obj.sel_list, function (o) { return o.split(/_/)[0] == 'acp'; });
163 list = util.functional.map_list( list, function (o) { return o.split(/_/)[1]; });
165 cat.util.mark_item_damaged( list );
170 'sel_mark_items_missing' : [
173 JSAN.use('cat.util'); JSAN.use('util.functional');
175 var list = util.functional.filter_list( obj.sel_list, function (o) { return o.split(/_/)[0] == 'acp'; });
177 list = util.functional.map_list( list, function (o) { return o.split(/_/)[1]; });
179 cat.util.mark_item_missing( list );
187 JSAN.use('util.functional');
189 var list = util.functional.filter_list(
192 return o.split(/_/)[0] == 'acp';
196 list = util.functional.map_list(
199 return { 'copy_id' : o.split(/_/)[1] };
203 JSAN.use('circ.util');
204 circ.util.show_last_few_circs(list);
207 'sel_copy_details' : [
210 JSAN.use('util.functional');
212 var list = util.functional.filter_list(
215 return o.split(/_/)[0] == 'acp';
219 JSAN.use('circ.util');
220 circ.util.item_details_new(
221 util.functional.map_list(
223 return obj.map_acp[o].barcode();
232 JSAN.use("cat.util");
233 JSAN.use("util.functional");
235 /* Filter selected rows that aren"t copies. */
236 var list = util.functional.filter_list(
239 return o.split(/_/)[0] == "acp";
242 var results = cat.util.make_bookable(
243 util.functional.map_list(
245 return obj.map_acp[o].id();
249 if (results && results["brsrc"]) {
250 cat.util.edit_new_brsrc(results["brsrc"]);
254 'cmd_book_item_now' : [
257 JSAN.use("cat.util");
258 JSAN.use("util.functional");
260 /* Filter selected rows that aren"t copies. */
261 var list = util.functional.filter_list(
264 return o.split(/_/)[0] == "acp";
267 var results = cat.util.make_bookable(
268 util.functional.map_list(
270 return obj.map_acp[o].id();
275 cat.util.edit_new_bresv(results);
283 JSAN.use('util.functional');
284 var list = util.functional.map_list(
285 util.functional.filter_list(
288 return o.split(/_/)[0] == 'acn';
292 return o.split(/_/)[1];
295 if (list.length == 0) return;
297 var copy_shortcut = {};
298 list = util.functional.map_list(
301 var call_number = obj.map_acn['acn_'+o];
302 var ou_id = call_number.owning_lib();
304 var label = call_number.label();
305 var acnc_id = typeof call_number.label_class() == 'object'
306 ? call_number.label_class().id()
307 : call_number.label_class();
308 var acnp_id = typeof call_number.prefix() == 'object'
309 ? call_number.prefix().id()
310 : call_number.prefix();
311 var acns_id = typeof call_number.suffix() == 'object'
312 ? call_number.suffix().id()
313 : call_number.suffix();
314 if (!copy_shortcut[ou_id]) copy_shortcut[ou_id] = {};
315 var callnumber_composite_key = acnc_id + ':' + acnp_id + ':' + label + ':' + acns_id;
316 copy_shortcut[ou_id][ callnumber_composite_key ] = volume_id;
321 /* quick fix */ /* what was this fixing? */
322 list = []; for (var i in copy_shortcut) { list.push( i ); }
326 edit = obj.network.request(
327 api.PERM_MULTI_ORG_CHECK.app,
328 api.PERM_MULTI_ORG_CHECK.method,
331 obj.data.list.au[0].id(),
335 ).length == 0 ? 1 : 0;
337 obj.error.sdump('D_ERROR','batch permission check: ' + E);
340 if (edit==0) return; // no read-only view for this interface
342 if (!obj.can_have_copies) {
343 alert(document.getElementById('catStrings').getFormattedString('staff.cat.copy_browser.can_have_copies.false', obj.source));
347 var title = document.getElementById('catStrings').getString('staff.cat.copy_browser.add_item.title');
350 var unified_interface = String( obj.data.hash.aous['ui.unified_volume_copy_editor'] ) == 'true';
351 if (unified_interface) {
352 var horizontal_interface = String( obj.data.hash.aous['ui.cat.volume_copy_editor.horizontal'] ) == 'true';
353 url = xulG.url_prefix( horizontal_interface ? 'XUL_VOLUME_COPY_CREATOR_HORIZONTAL' : 'XUL_VOLUME_COPY_CREATOR' );
355 url = xulG.url_prefix('XUL_VOLUME_COPY_CREATOR_ORIGINAL');
358 var w = xulG.new_tab(
360 { 'tab_name' : title },
362 'doc_id' : obj.docid,
364 'copy_shortcut' : copy_shortcut,
365 'onrefresh' : function() { obj.refresh_list(); }
369 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.add_item.error'),E);
373 'cmd_add_items_to_buckets' : [
377 JSAN.use('util.functional');
379 var list = util.functional.filter_list(
382 return o.split(/_/)[0] == 'acp';
386 list = util.functional.map_list(
389 return o.split(/_/)[1];
393 JSAN.use('cat.util');
394 cat.util.add_copies_to_bucket( list );
397 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.add_items_bucket.error'),E);
405 var unified_interface = String( obj.data.hash.aous['ui.unified_volume_copy_editor'] ) == 'true';
406 if (!unified_interface) {
407 obj.controller.control_map['old_cmd_edit_items'][1]();
411 JSAN.use('util.functional');
413 var list = util.functional.filter_list(
416 return o.split(/_/)[0] == 'acp';
420 list = util.functional.map_list(
423 var cloned_copy_obj = JSON2js( js2JSON( obj.map_acp[ o ] ) );
424 cloned_copy_obj.call_number( obj.map_acn[ 'acn_' + cloned_copy_obj.call_number() ] );
425 return cloned_copy_obj;
429 if (list.length > 0) {
430 xulG.volume_item_creator( {'existing_copies':list, 'onrefresh' : function() { obj.refresh_list(); } } );
434 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.edit_items.error'),E);
439 'cmd_replace_barcode' : [
443 JSAN.use('util.functional');
445 var list = util.functional.filter_list(
448 return o.split(/_/)[0] == 'acp';
452 list = util.functional.map_list(
455 var cloned_copy_obj = JSON2js( js2JSON( obj.map_acp[ o ] ) );
456 cloned_copy_obj.call_number( obj.map_acn[ 'acn_' + cloned_copy_obj.call_number() ] );
457 return cloned_copy_obj;
461 xulG.volume_item_creator( {'existing_copies':list, 'onrefresh' : function() { obj.refresh_list(); } } );
464 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.edit_items.error'),E);
470 'old_cmd_edit_items' : [
474 JSAN.use('util.functional');
476 var list = util.functional.filter_list(
479 return o.split(/_/)[0] == 'acp';
483 list = util.functional.map_list(
486 return o.split(/_/)[1];
490 JSAN.use('cat.util'); cat.util.spawn_copy_editor( { 'copy_ids' : list, 'edit' : 1 } );
494 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.edit_items.error'),E);
498 'cmd_delete_items' : [
502 JSAN.use('util.functional');
504 var list = util.functional.filter_list(
507 return o.split(/_/)[0] == 'acp';
511 list = util.functional.map_list(
514 return JSON2js( js2JSON( obj.map_acp[ 'acp_' + o.split(/_/)[1] ] ) );
519 if (list.length != 1) {
520 delete_msg = document.getElementById('catStrings').getFormattedString('staff.cat.copy_browser.delete_items.confirm.plural', [list.length]);
522 delete_msg = document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_items.confirm');
524 var r = obj.error.yns_alert(
526 document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_items.title'),
527 document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_items.delete'),
528 document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_items.cancel'),
530 document.getElementById('commonStrings').getString('common.confirm')
534 var acn_hash = {}; var acn_list = [];
535 for (var i = 0; i < list.length; i++) {
536 list[i].isdeleted('1');
537 var acn_id = list[i].call_number();
538 if ( ! acn_hash[ acn_id ] ) {
539 acn_hash[ acn_id ] = obj.map_acn[ 'acn_' + acn_id ];
540 acn_hash[ acn_id ].copies( [] );
542 var temp = acn_hash[ acn_id ].copies();
543 temp.push( list[i] );
544 acn_hash[ acn_id ].copies( temp );
546 for (var i in acn_hash) acn_list.push( acn_hash[i] );
547 var robj = obj.network.simple_request(
548 'FM_ACN_TREE_UPDATE',
549 [ ses(), acn_list, true ],
552 'title' : document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_items.override'),
553 'overridable_events' : [
554 1208 /* TITLE_LAST_COPY */,
555 1227 /* COPY_DELETE_WARNING */,
559 if (robj == null) throw(robj);
560 if (typeof robj.ilsevent != 'undefined') {
563 && (robj.ilsevent != 1227 /* COPY_DELETE_WARNING */)
564 && (robj.ilsevent != 1208 /* TITLE_LAST_COPY */)
565 && (robj.ilsevent != 5000 /* PERM_DENIED */)
575 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_items.error'),E);
580 'cmd_print_spine_labels' : [
584 JSAN.use('util.functional');
586 var list = util.functional.filter_list(
589 return o.split(/_/)[0] == 'acp';
593 list = util.functional.map_list(
596 return obj.map_acp[ o ];
601 xulG.url_prefix('XUL_SPINE_LABEL'),
602 { 'tab_name' : document.getElementById('catStrings').getString('staff.cat.copy_browser.print_spine.tab') },
604 'barcodes' : util.functional.map_list( list, function(o){return o.barcode();})
608 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.print_spine.error'),E);
612 'cmd_add_volumes' : [
616 JSAN.use('util.functional');
617 var list = util.functional.filter_list(
620 return o.split(/_/)[0] == 'aou';
623 list = util.functional.map_list(
626 return o.split(/_/)[1];
631 edit = obj.network.request(
632 api.PERM_MULTI_ORG_CHECK.app,
633 api.PERM_MULTI_ORG_CHECK.method,
636 obj.data.list.au[0].id(),
638 [ 'CREATE_VOLUME', 'CREATE_COPY' ]
640 ).length == 0 ? 1 : 0;
642 obj.error.sdump('D_ERROR','batch permission check: ' + E);
646 alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.add_volume.permission_error'));
647 return; // no read-only view for this interface
650 if (!obj.can_have_copies) {
651 alert(document.getElementById('catStrings').getFormattedString('staff.cat.copy_browser.can_have_copies.false', obj.source));
655 var title = document.getElementById('catStrings').getString('staff.cat.copy_browser.add_volume.title');
658 var unified_interface = String( obj.data.hash.aous['ui.unified_volume_copy_editor'] ) == 'true';
659 if (unified_interface) {
660 var horizontal_interface = String( obj.data.hash.aous['ui.cat.volume_copy_editor.horizontal'] ) == 'true';
661 url = xulG.url_prefix( horizontal_interface ? 'XUL_VOLUME_COPY_CREATOR_HORIZONTAL' : 'XUL_VOLUME_COPY_CREATOR' );
663 url = xulG.url_prefix('XUL_VOLUME_COPY_CREATOR_ORIGINAL');
666 var w = xulG.new_tab(
668 { 'tab_name' : title },
669 { 'doc_id' : obj.docid, 'ou_ids' : list, 'onrefresh' : function() { obj.refresh_list(); } }
673 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.add_volume.error'),E);
677 'cmd_edit_volumes' : [
681 JSAN.use('util.functional');
682 var volumes = util.functional.map_list(
683 util.functional.filter_list(
686 return o.split(/_/)[0] == 'acn';
690 return o.split(/_/)[1];
693 volumes = util.functional.map_list(
696 var my_acn = obj.map_acn['acn_' + o];
697 return function(r){return r;}(my_acn);
701 JSAN.use('cat.util');
702 if ( cat.util.batch_edit_volumes( volumes ) ) {
707 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.edit_volume.exception'),E);
711 'cmd_delete_volumes' : [
715 JSAN.use('util.functional');
717 var list = util.functional.filter_list(
720 return o.split(/_/)[0] == 'acn';
724 list = util.functional.map_list(
727 return JSON2js( js2JSON( obj.map_acn[ 'acn_' + o.split(/_/)[1] ] ) );
732 if (list.length == 1) {
733 del_prompt = document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_volume.prompt');
735 del_prompt = document.getElementById('catStrings').getFormattedString('staff.cat.copy_browser.delete_volume.prompt.plural', [list.length]);
738 var r = obj.error.yns_alert(
740 document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_volume.title'),
741 document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_volume.delete'),
742 document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_volume.cancel'),
744 document.getElementById('commonStrings').getString('common.confirm')
747 if (r == 0) { // delete vols
748 for (var i = 0; i < list.length; i++) {
749 list[i].isdeleted('1');
753 var robj = obj.network.simple_request(
754 'FM_ACN_TREE_UPDATE',
755 [ ses(), list, true, params ],
758 'title' : document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_volume.override'),
759 'overridable_events' : [
760 1208 /* TITLE_LAST_COPY */,
761 1227 /* COPY_DELETE_WARNING */
765 if (robj == null) throw(robj);
766 if (typeof robj.ilsevent != 'undefined') {
767 if (robj.ilsevent == 1206 /* VOLUME_NOT_EMPTY */) {
768 var r2 = obj.error.yns_alert(
769 document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_volume.copies_remain'),
770 document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_volume.title'),
771 document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_volume.copies_remain.confirm'),
772 document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_volume.copies_remain.cancel'),
774 document.getElementById('commonStrings').getString('common.confirm')
776 if (r2 == 0) { // delete vols and copies
777 params.force_delete_copies = true;
781 if (typeof robj.ilsevent != 'undefined') {
784 && (robj.ilsevent != 1227 /* COPY_DELETE_WARNING */)
785 && (robj.ilsevent != 1208 /* TITLE_LAST_COPY */)
786 && (robj.ilsevent != 5000 /* PERM_DENIED */)
798 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_volume.exception'),E);
804 'cmd_mark_library' : [
808 var list = util.functional.filter_list(
811 return o.split(/_/)[0] == 'aou';
815 list = util.functional.map_list(
818 return o.split(/_/)[1];
822 if (list.length == 1) {
823 obj.data.marked_library = { 'lib' : list[0], 'docid' : obj.docid };
824 obj.data.stash('marked_library');
825 alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.mark_library.alert'));
828 document.getElementById('catStrings').getString('staff.cat.copy_browser.mark_library.prompt'),
829 document.getElementById('catStrings').getString('staff.cat.copy_browser.mark_library.title'),
830 document.getElementById('commonStrings').getString('common.ok'),
833 document.getElementById('commonStrings').getString('common.confirm')
837 obj.error.standard_unexpected_error_alert('copy browser -> mark library',E);
842 'cmd_mark_volume' : [
846 var list = util.functional.filter_list(
849 return o.split(/_/)[0] == 'acn';
853 list = util.functional.map_list(
856 return o.split(/_/)[1];
860 if (list.length == 1) {
861 obj.data.marked_volume = list[0];
862 obj.data.stash('marked_volume');
863 alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.mark_volume.alert'));
866 document.getElementById('catStrings').getString('staff.cat.copy_browser.mark_volume.prompt'),
867 document.getElementById('catStrings').getString('staff.cat.copy_browser.mark_volume.title'),
868 document.getElementById('commonStrings').getString('common.ok'),
871 document.getElementById('commonStrings').getString('common.confirm')
875 obj.error.standard_unexpected_error_alert('copy browser -> mark volume',E);
879 'cmd_refresh_list' : [
885 'cmd_transfer_volume' : [
889 obj.data.stash_retrieve();
890 if (!obj.data.marked_library) {
891 alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer_volume.alert'));
895 JSAN.use('util.functional');
897 var list = util.functional.filter_list(
900 return o.split(/_/)[0] == 'acn';
904 list = util.functional.map_list(
907 return o.split(/_/)[1];
911 var acn_list = util.functional.map_list(
914 return obj.map_acn[ 'acn_' + o ].label();
916 ).join(document.getElementById('commonStrings').getString('common.grouping_string'));
918 var xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: auto">';
919 xml += '<description>';
920 xml += document.getElementById('catStrings').getFormattedString('staff.cat.copy_browser.transfer.prompt', [acn_list, obj.data.hash.aou[ obj.data.marked_library.lib ].shortname()]);
921 xml += '</description>';
922 xml += '<hbox><button label="' + document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.submit.label') + '" name="fancy_submit"/>';
923 xml += '<button label="'
924 + document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.cancel.label')
926 + document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.cancel.accesskey')
927 + '" name="fancy_cancel"/></hbox>';
928 xml += '<iframe style="overflow: scroll" flex="1" src="' + urls.XUL_BIB_BRIEF + '?docid=' + obj.data.marked_library.docid + '" oils_force_external="true"/>';
930 JSAN.use('OpenILS.data');
931 var data = new OpenILS.data(); data.init({'via':'stash'});
932 //data.temp_transfer = xml; data.stash('temp_transfer');
933 JSAN.use('util.window'); var win = new util.window();
934 var fancy_prompt_data = win.open(
935 urls.XUL_FANCY_PROMPT,
936 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300',
939 'title' : document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.title')
943 if (fancy_prompt_data.fancy_status == 'incomplete') {
944 alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.incomplete'));
948 var robj = obj.network.simple_request(
950 [ ses(), { 'docid' : obj.data.marked_library.docid, 'lib' : obj.data.marked_library.lib, 'volumes' : list } ],
953 'title' : document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.override.failure'),
954 'overridable_events' : [
955 1208 /* TITLE_LAST_COPY */,
956 1219 /* COPY_REMOTE_CIRC_LIB */,
961 if (typeof robj.ilsevent != 'undefined') {
962 if (robj.ilsevent == 1221 /* ORG_CANNOT_HAVE_VOLS */) {
963 alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.ineligible_destination'));
968 alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.success'));
972 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.unexpected_error'),E);
978 'cmd_transfer_items' : [
982 obj.data.stash_retrieve();
983 if (!obj.data.marked_volume) {
984 alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer_items.missing_volume'));
988 JSAN.use('util.functional');
990 var list = util.functional.filter_list(
993 return o.split(/_/)[0] == 'acp';
997 list = util.functional.map_list(
1000 return o.split(/_/)[1];
1004 var volume = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ obj.data.marked_volume ]);
1006 JSAN.use('cat.util'); cat.util.transfer_copies( {
1008 'docid' : volume.record(),
1009 'volume_label' : volume.label(),
1010 'owning_lib' : volume.owning_lib(),
1014 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer_items.unexpected_error'),E);
1020 'cmd_link_as_multi_bib' : [
1024 obj.data.stash_retrieve();
1025 if (!obj.data.marked_multi_home_record) {
1026 alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.link_as_multi_bib.missing_bib'));
1030 JSAN.use('util.functional');
1032 var list = util.functional.filter_list(
1035 return o.split(/_/)[0] == 'acp';
1039 list = util.functional.map_list(
1042 return obj.map_acp[ o ].barcode();
1047 window.xulG.url_prefix('MANAGE_MULTI_HOME_ITEMS'),
1049 { 'docid' : obj.data.marked_multi_home_record, 'barcodes' : list }
1053 alert('Error in copy_browser.js, cmd_link_as_multi_bib: ' + E);
1059 'cmd_print_tree' : [
1064 'template' : 'holdings_maintenance',
1065 'mvr_id' : obj.docid,
1068 bib_brief_overlay(p);
1069 p.data = p.print_data;
1072 alert('Error in copy_browser.js, cmd_print_tree: ' + E);
1081 this.error.standard_unexpected_error_alert('cat.copy_browser.controller_init(): ',E);
1085 'depth_menu_init' : function(params) {
1090 for (var i = 0; i < obj.data.list.aout.length; i++) {
1091 var type = obj.data.list.aout[i];
1092 var depth = type.depth();
1093 if ( depth > max_depth) { max_depth = depth; }
1094 if (typeof list[depth] == 'undefined') {
1102 list[depth][0] += ' / ' + type.opac_label();
1105 ml = util.widgets.make_menulist( list, max_depth );
1106 ml.setAttribute('id','depth_menu'); document.getElementById('x_depth_menu').appendChild(ml);
1107 ml.addEventListener(
1110 obj.default_depth = ev.target.value;
1111 if (document.getElementById('refresh_button')) document.getElementById('refresh_button').focus();
1112 JSAN.use('util.file'); var file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned);
1113 util.widgets.save_attributes(file, {
1114 'lib_menu' : [ 'value' ],
1115 'depth_menu' : [ 'value' ],
1116 'show_acns' : [ 'checked' ],
1117 'show_acps' : [ 'checked' ],
1118 'hide_aous' : [ 'checked' ]
1124 file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned);
1125 util.widgets.load_attributes(file);
1126 ml.value = ml.getAttribute('value');
1128 ml.value = max_depth;
1129 ml.setAttribute('value',ml.value);
1134 alert('Error in copy_browser.js, depth_menu_init(): ' + E);
1138 'library_menu_init' : function(params) {
1142 obj.org_ids = obj.network.simple_request('FM_AOU_IDS_RETRIEVE_VIA_RECORD_ID.authoritative',[ obj.docid ]);
1143 if (typeof obj.org_ids.ilsevent != 'undefined') throw(obj.org_ids);
1144 JSAN.use('util.functional');
1145 obj.org_ids = util.functional.map_list( obj.org_ids, function (o) { return Number(o); });
1147 var org = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
1149 JSAN.use('util.file'); JSAN.use('util.widgets');
1151 var file; var list_data; var ml;
1153 file = new util.file('offline_ou_list');
1154 if (file._file.exists()) {
1155 list_data = file.get_object(); file.close();
1156 for (var i = 0; i < list_data[0].length; i++) { // make sure all entries are enabled
1157 list_data[0][i][2] = false;
1159 ml = util.widgets.make_menulist( list_data[0], list_data[1] );
1160 ml.setAttribute('id','lib_menu'); document.getElementById('x_lib_menu').appendChild(ml);
1161 for (var i = 0; i < obj.org_ids.length; i++) {
1162 ml.getElementsByAttribute('value',obj.org_ids[i])[0].setAttribute('class','has_copies');
1164 ml.firstChild.addEventListener(
1167 document.getElementById('legend').setAttribute('hidden','false');
1171 ml.firstChild.addEventListener(
1174 document.getElementById('legend').setAttribute('hidden','true');
1178 ml.addEventListener(
1181 obj.default_lib = obj.data.hash.aou[ ev.target.value ];
1182 if (document.getElementById('refresh_button')) document.getElementById('refresh_button').focus();
1183 JSAN.use('util.file'); var file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned);
1184 util.widgets.save_attributes(file, {
1185 'lib_menu' : [ 'value' ],
1186 'depth_menu' : [ 'value' ],
1187 'show_acns' : [ 'checked' ],
1188 'show_acps' : [ 'checked' ],
1189 'hide_aous' : [ 'checked' ]
1196 throw(document.getElementById('catStrings').getString('staff.cat.copy_browser.missing_library') + '\n');
1199 file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned);
1200 util.widgets.load_attributes(file);
1201 ml.value = ml.getAttribute('value');
1203 ml.value = org.id();
1204 ml.setAttribute('value',ml.value);
1210 this.error.standard_unexpected_error_alert('cat.copy_browser.library_menu_init(): ',E);
1214 'show_consortial_count' : function() {
1217 obj.network.simple_request('FM_ACP_COUNT.authoritative',[ obj.data.tree.aou.id(), obj.docid ],function(req){
1219 var robj = req.getResultObject();
1220 var x = document.getElementById('consortial_total');
1221 if (x) x.setAttribute('value',robj[0].count);
1222 x = document.getElementById('consortial_available');
1223 if (x) x.setAttribute('value',robj[0].available);
1225 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.consortial_copy_count.error'),E);
1229 this.error.standard_unexpected_error_alert('cat.copy_browser.show_consortial_count: ',E);
1233 'show_my_libs' : function(org) {
1237 org = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
1239 if (typeof org != 'object') org = obj.data.hash.aou[ org ];
1241 obj.show_libs( org, false );
1243 var p_org = obj.data.hash.aou[ org.parent_ou() ];
1245 obj.funcs.push( function() {
1246 document.getElementById('cmd_refresh_list').setAttribute('disabled','true');
1247 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','true');
1248 document.getElementById('lib_menu').setAttribute('disabled','true');
1250 for (var i = 0; i < p_org.children().length; i++) {
1254 obj.show_libs( o, false );
1256 }( p_org.children()[i] )
1259 obj.funcs.push( function() {
1260 document.getElementById('cmd_refresh_list').setAttribute('disabled','false');
1261 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','false');
1262 document.getElementById('lib_menu').setAttribute('disabled','false');
1271 'show_all_libs' : function() {
1276 obj.show_libs( obj.data.tree.aou );
1278 obj.funcs.push( function() {
1279 document.getElementById('cmd_refresh_list').setAttribute('disabled','true');
1280 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','true');
1281 document.getElementById('lib_menu').setAttribute('disabled','true');
1284 for (var i = 0; i < obj.data.tree.aou.children().length; i++) {
1285 var child = obj.data.tree.aou.children()[i];
1286 if (obj.data.hash.aout[child.ou_type()].depth() <= obj.default_depth
1287 && orgIsMine(obj.default_lib,child,obj.default_depth)) {
1297 obj.funcs.push( function() {
1298 document.getElementById('cmd_refresh_list').setAttribute('disabled','false');
1299 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','false');
1300 document.getElementById('lib_menu').setAttribute('disabled','false');
1308 'show_libs_with_copies' : function() {
1311 JSAN.use('util.functional');
1313 var orgs = util.functional.map_list(
1315 function(id) { return obj.data.hash.aou[id]; }
1318 if (a.shortname() < b.shortname()) return -1;
1319 if (a.shortname() > b.shortname()) return 1;
1323 obj.funcs.push( function() {
1324 document.getElementById('cmd_refresh_list').setAttribute('disabled','true');
1325 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','true');
1326 document.getElementById('lib_menu').setAttribute('disabled','true');
1329 for (var i = 0; i < orgs.length; i++) {
1333 obj.show_libs(o,false);
1338 obj.funcs.push( function() {
1339 document.getElementById('cmd_refresh_list').setAttribute('disabled','false');
1340 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','false');
1341 document.getElementById('lib_menu').setAttribute('disabled','false');
1349 'show_libs' : function(start_aou,show_open) {
1352 if (!start_aou) throw('show_libs: Need a start_aou');
1353 JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
1354 JSAN.use('util.functional');
1357 var temp_aou = start_aou;
1358 while ( temp_aou.parent_ou() ) {
1359 temp_aou = obj.data.hash.aou[ temp_aou.parent_ou() ];
1360 parents.push( temp_aou );
1364 for (var i = 0; i < parents.length; i++) {
1368 obj.append_org(o,p,{'container':'true','open':'true'});
1370 }(parents[i], obj.data.hash.aou[ parents[i].parent_ou() ])
1376 return function() { obj.append_org(o,p); };
1377 }(start_aou,obj.data.hash.aou[ start_aou.parent_ou() ])
1382 if (start_aou.children()) {
1383 var x = obj.map_tree[ 'aou_' + start_aou.id() ];
1384 x.setAttribute('container','true');
1385 if (show_open) x.setAttribute('open','true');
1386 for (var i = 0; i < start_aou.children().length; i++) {
1387 var child = start_aou.children()[i];
1388 if (obj.data.hash.aout[child.ou_type()].depth() <= obj.default_depth
1389 && orgIsMine(obj.default_lib,child,obj.default_depth)) {
1392 return function() { obj.append_org(o,p); };
1393 }( child, start_aou )
1406 'on_select' : function(list,twisty) {
1408 for (var i = 0; i < list.length; i++) {
1409 var node = obj.map_tree[ list[i] ];
1410 //if (node.lastChild.nodeName == 'treechildren') { continue; } else { alert(node.lastChild.nodeName); }
1411 var row_type = list[i].split('_')[0];
1412 var id = list[i].split('_')[1];
1414 case 'aou' : obj.on_select_org(id,twisty); break;
1415 case 'acn' : obj.on_select_acn(id,twisty); break;
1421 'on_select_acn' : function(acn_id,twisty) {
1424 var acn_tree = obj.map_acp[ 'acn_' + acn_id ];
1425 obj.funcs.push( function() {
1426 document.getElementById('cmd_refresh_list').setAttribute('disabled','true');
1427 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','true');
1428 document.getElementById('lib_menu').setAttribute('disabled','true');
1430 if (acn_tree.copies()) {
1431 for (var i = 0; i < acn_tree.copies().length; i++) {
1435 obj.append_acp(c,a);
1437 }( acn_tree.copies()[i], acn_tree )
1441 obj.funcs.push( function() {
1442 document.getElementById('cmd_refresh_list').setAttribute('disabled','false');
1443 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','false');
1444 document.getElementById('lib_menu').setAttribute('disabled','false');
1451 'on_select_org' : function(org_id,twisty) {
1454 var org = obj.data.hash.aou[ org_id ];
1455 obj.funcs.push( function() {
1456 document.getElementById('cmd_refresh_list').setAttribute('disabled','true');
1457 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','true');
1458 document.getElementById('lib_menu').setAttribute('disabled','true');
1460 if (org.children()) {
1461 for (var i = 0; i < org.children().length; i++) {
1462 var child = org.children()[i];
1463 if (obj.data.hash.aout[child.ou_type()].depth() <= obj.default_depth
1464 && orgIsMine(obj.default_lib,child,obj.default_depth)) {
1475 if (obj.map_acn[ 'aou_' + org_id ]) {
1476 for (var i = 0; i < obj.map_acn[ 'aou_' + org_id ].length; i++) {
1480 obj.append_acn(o,a);
1482 }( org, obj.map_acn[ 'aou_' + org_id ][i] )
1486 obj.funcs.push( function() {
1487 document.getElementById('cmd_refresh_list').setAttribute('disabled','false');
1488 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','false');
1489 document.getElementById('lib_menu').setAttribute('disabled','false');
1492 alert('Error in copy_browser.js, on_select_org(): ' + E);
1496 'append_org' : function (org,parent_org,params) {
1498 obj.error.consoleService.logStringMessage('append_org: org = ' + org.shortname() + ' parent_org = ' + (parent_org ? parent_org.shortname() : '') + ' params = ' + js2JSON(params) + '\n');
1500 if (obj.map_tree[ 'aou_' + org.id() ]) {
1501 var x = obj.map_tree[ 'aou_' + org.id() ];
1503 for (var i in params) {
1504 x.setAttribute(i,params[i]);
1516 'skip_all_columns_except' : [0,1,2],
1517 'retrieve_id' : 'aou_' + org.id(),
1519 'no_auto_select' : true,
1523 if ( obj.org_ids.indexOf( Number( org.id() ) ) == -1 ) {
1524 if ( get_bool( obj.data.hash.aout[ org.ou_type() ].can_have_vols() ) ) {
1525 data.row.my.volume_count = '0';
1526 data.row.my.copy_count = '<0>';
1528 data.row.my.volume_count = '';
1529 data.row.my.copy_count = '';
1532 var v_count = 0; var c_count = 0;
1533 acn_tree_list = obj.network.simple_request(
1534 'FM_ACN_TREE_LIST_RETRIEVE_VIA_RECORD_ID_AND_ORG_IDS.authoritative',
1535 [ ses(), obj.docid, [ org.id() ] ]
1537 for (var i = 0; i < acn_tree_list.length; i++) {
1539 obj.map_acn[ 'acn_' + acn_tree_list[i].id() ] = function(r){return r;}(acn_tree_list[i]);
1540 var copies = acn_tree_list[i].copies(); if (copies) c_count += copies.length;
1541 for (var j = 0; j < copies.length; j++) {
1542 obj.map_acp[ 'acp_' + copies[j].id() ] = function(r){return r;}(copies[j]);
1545 data.row.my.volume_count = String(v_count);
1546 data.row.my.copy_count = '<' + c_count + '>';
1548 if (document.getElementById('hide_aous').checked) {
1549 if (org.children().length == 0
1550 && data.row.my.volume_count == '0') {
1552 params = { 'hidden' : true };
1554 params['hidden'] = true;
1556 dump('hiding org.id() = ' + org.id() + '\n');
1560 data.node = obj.map_tree[ 'aou_' + parent_org.id() ];
1562 var nparams = obj.list.append(data);
1563 obj.list.refresh_ordinals();
1564 var node = nparams.treeitem_node;
1566 for (var i in params) {
1567 node.setAttribute(i,params[i]);
1570 obj.map_tree[ 'aou_' + org.id() ] = node;
1572 if (org.children()) {
1573 node.setAttribute('container','true');
1577 if ( obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ].parent_ou() == parent_org.id() ) {
1578 data.node.setAttribute('open','true');
1581 obj.map_tree[ 'aou_' + org.id() ].setAttribute('open','true');
1584 if (acn_tree_list) {
1585 obj.map_acn[ 'aou_' + org.id() ] = acn_tree_list;
1586 node.setAttribute('container','true');
1589 if (document.getElementById('show_acns').checked) {
1590 node.setAttribute('open','true');
1591 obj.funcs.push( function() { obj.on_select_org( org.id() ); } );
1600 'append_acn' : function( org, acn_tree, params ) {
1603 if (obj.map_tree[ 'acn_' + acn_tree.id() ]) {
1604 var x = obj.map_tree[ 'acn_' + acn_tree.id() ];
1606 for (var i in params) {
1607 x.setAttribute(i,params[i]);
1613 var parent_node = obj.map_tree[ 'aou_' + org.id() ];
1619 'volume_count' : '',
1620 'copy_count' : acn_tree.copies() ? acn_tree.copies().length : '0',
1623 'skip_all_columns_except' : [0,1,2],
1624 'retrieve_id' : 'acn_' + acn_tree.id(),
1625 'node' : parent_node,
1627 'no_auto_select' : true,
1629 var nparams = obj.list.append(data);
1630 obj.list.refresh_ordinals();
1631 var node = nparams.treeitem_node;
1632 obj.map_tree[ 'acn_' + acn_tree.id() ] = node;
1634 for (var i in params) {
1635 node.setAttribute(i,params[i]);
1638 if (acn_tree.copies()) {
1639 obj.map_acp[ 'acn_' + acn_tree.id() ] = acn_tree;
1640 node.setAttribute('container','true');
1642 if (document.getElementById('show_acps').checked) {
1643 node.setAttribute('open','true');
1644 obj.funcs.push( function() { obj.on_select_acn( acn_tree.id() ); } );
1653 'append_acp' : function( acp_item, acn_tree, params ) {
1656 if (obj.map_tree[ 'acp_' + acp_item.id() ]) {
1657 var x = obj.map_tree[ 'acp_' + acp_item.id() ];
1659 for (var i in params) {
1660 x.setAttribute(i,params[i]);
1666 var parent_node = obj.map_tree[ 'acn_' + acn_tree.id() ];
1670 'doc_id' : obj.docid,
1671 'aou' : obj.data.hash.aou[ acn_tree.owning_lib() ],
1675 acp_item.circulations()
1677 acp_item.circulations().length > 0
1678 ? acp_item.circulations()[0]
1682 'volume_count' : '',
1686 'retrieve_id' : 'acp_' + acp_item.id(),
1687 'node' : parent_node,
1689 'no_auto_select' : true,
1691 var nparams = obj.list.append(data);
1692 obj.list.refresh_ordinals();
1693 var node = nparams.treeitem_node;
1694 obj.map_tree[ 'acp_' + acp_item.id() ] = node;
1696 for (var i in params) {
1697 node.setAttribute(i,params[i]);
1707 'list_init' : function( params ) {
1712 JSAN.use('circ.util');
1715 'id' : 'tree_location',
1716 'label' : document.getElementById('catStrings').getString('staff.cat.copy_browser.list_init.tree_location'),
1717 'flex' : 1, 'primary' : true, 'hidden' : false,
1718 'render' : function(my) { return my.acp ? my.acp.barcode() : my.acn ? my.acn.label() : my.aou ? my.aou.shortname() + " : " + my.aou.name() : "???"; },
1721 'id' : 'volume_count',
1722 'label' : document.getElementById('catStrings').getString('staff.cat.copy_browser.list_init.volume_count'),
1723 'flex' : 0, 'primary' : false, 'hidden' : false,
1724 'render' : function(my) { return my.volume_count; },
1727 'id' : 'copy_count',
1728 'label' : document.getElementById('catStrings').getString('staff.cat.copy_browser.list_init.copy_count'),
1730 'primary' : false, 'hidden' : false,
1731 'render' : function(my) { return my.copy_count; },
1736 'location' : { 'hidden' : false },
1737 'circ_lib' : { 'hidden' : false },
1738 'owning_lib' : { 'hidden' : false },
1739 'call_number' : { 'hidden' : false },
1740 'parts' : { 'hidden' : false },
1741 'due_date' : { 'hidden' : false },
1742 'acp_status' : { 'hidden' : false },
1771 'acp_mint_condition',
1777 JSAN.use('util.list'); obj.list = new util.list('copy_tree');
1780 'no_auto_select' : true,
1781 'columns' : columns,
1782 'retrieve_row' : function(params) {
1784 var row = params.row;
1787 if (!row.my.mvr) obj.funcs.push(
1790 row.my.mvr = obj.network.request(
1791 api.MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.app,
1792 api.MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.method,
1793 [ row.my.circ.target_copy() ]
1802 row.my.acp = obj.network.request(
1803 api.FM_ACP_RETRIEVE.app,
1804 api.FM_ACP_RETRIEVE.method,
1805 [ row.my.circ.target_copy() ]
1808 params.treeitem_node.setAttribute( 'retrieve_id',row.my.acp.barcode() );
1813 params.treeitem_node.setAttribute( 'retrieve_id',row.my.acp.barcode() );
1819 if (typeof params.on_retrieve == 'function') {
1820 params.on_retrieve(row);
1822 obj.list.refresh_ordinals();
1829 'on_click' : function(ev) {
1830 var row = {}; var col = {}; var nobj = {};
1831 obj.list.node.treeBoxObject.getCellAt(ev.clientX,ev.clientY,row,col,nobj);
1832 if ((row.value == -1)||(nobj.value != 'twisty')) { return; }
1833 var node = obj.list.node.contentView.getItemAtIndex(row.value);
1834 var list = [ node.getAttribute('retrieve_id') ];
1835 if (typeof obj.on_select == 'function') {
1836 obj.on_select(list,true);
1838 if (typeof window.xulG == 'object' && typeof window.xulG.on_select == 'function') {
1839 window.xulG.on_select(list);
1841 obj.list.refresh_ordinals();
1843 'on_dblclick' : function(ev) {
1844 JSAN.use('util.functional');
1845 JSAN.use('util.widgets');
1846 var sel = obj.list.retrieve_selection();
1847 obj.controller.view.sel_clip.disabled = sel.length < 1;
1848 obj.sel_list = util.functional.map_list(
1850 function(o) { return o.getAttribute('retrieve_id'); }
1852 obj.toggle_actions();
1853 util.widgets.dispatch('command','cmd_edit_items');
1854 obj.list.refresh_ordinals();
1856 'on_select' : function(ev) {
1857 JSAN.use('util.functional');
1858 var sel = obj.list.retrieve_selection();
1859 obj.controller.view.sel_clip.disabled = sel.length < 1;
1860 obj.sel_list = util.functional.map_list(
1862 function(o) { return o.getAttribute('retrieve_id'); }
1864 obj.toggle_actions();
1865 if (typeof obj.on_select == 'function') {
1866 obj.on_select(obj.sel_list);
1868 if (typeof window.xulG == 'object' && typeof window.xulG.on_select == 'function') {
1869 window.xulG.on_select(obj.sel_list);
1871 obj.list.refresh_ordinals();
1876 $('list_actions').appendChild( obj.list.render_list_actions() );
1877 obj.list.set_list_actions();
1880 this.error.sdump('D_ERROR','cat.copy_browser.list_init: ' + E + '\n');
1885 // Sets can_have_copies and source member variables.
1886 'source_init' : function() {
1889 JSAN.use('cat.util');
1890 var cbsObj = cat.util.get_cbs_for_bre_id(obj.docid);
1892 obj.can_have_copies = (cbsObj.can_have_copies() == get_db_true());
1893 obj.source = cbsObj.source();
1895 obj.can_have_copies = true;
1898 obj.error.sdump('D_ERROR','can have copies check: ' + E);
1903 'toggle_actions' : function() {
1906 var found_aou = false; var found_acn = false; var found_acp = false;
1907 var found_aou_with_can_have_vols = false;
1908 var sel_copy_libs = {};
1909 for (var i = 0; i < obj.sel_list.length; i++) {
1910 var type = obj.sel_list[i].split(/_/)[0];
1914 var org = obj.data.hash.aou[ obj.sel_list[i].split(/_/)[1] ];
1915 if ( get_bool( obj.data.hash.aout[ org.ou_type() ].can_have_vols() ) ) found_aou_with_can_have_vols = true;
1917 case 'acn' : found_acn = true; break;
1923 obj.map_acp[obj.sel_list[i]].call_number()
1929 obj.controller.view.cmd_add_items.setAttribute('disabled','true');
1930 obj.controller.view.cmd_add_items_to_buckets.setAttribute('disabled','true');
1931 obj.controller.view.cmd_edit_items.setAttribute('disabled','true');
1932 obj.controller.view.cmd_replace_barcode.setAttribute('disabled','true');
1933 obj.controller.view.cmd_delete_items.setAttribute('disabled','true');
1934 obj.controller.view.cmd_print_spine_labels.setAttribute('disabled','true');
1935 obj.controller.view.cmd_add_volumes.setAttribute('disabled','true');
1936 obj.controller.view.cmd_mark_library.setAttribute('disabled','true');
1937 obj.controller.view.cmd_edit_volumes.setAttribute('disabled','true');
1938 obj.controller.view.cmd_delete_volumes.setAttribute('disabled','true');
1939 obj.controller.view.cmd_mark_volume.setAttribute('disabled','true');
1940 obj.controller.view.cmd_transfer_volume.setAttribute('disabled','true');
1941 obj.controller.view.cmd_transfer_items.setAttribute('disabled','true');
1942 obj.controller.view.sel_copy_details.setAttribute('disabled','true');
1943 obj.controller.view.cmd_create_brt.setAttribute('disabled','true');
1944 obj.controller.view.cmd_book_item_now.setAttribute('disabled','true');
1945 obj.controller.view.sel_patron.setAttribute('disabled','true');
1946 obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','true');
1947 obj.controller.view.sel_mark_items_missing.setAttribute('disabled','true');
1948 if (found_aou && found_aou_with_can_have_vols) {
1949 obj.controller.view.cmd_add_volumes.setAttribute('disabled','false');
1950 obj.controller.view.cmd_mark_library.setAttribute('disabled','false');
1953 obj.controller.view.cmd_edit_volumes.setAttribute('disabled','false');
1954 obj.controller.view.cmd_delete_volumes.setAttribute('disabled','false');
1955 obj.controller.view.cmd_mark_volume.setAttribute('disabled','false');
1956 obj.controller.view.cmd_add_items.setAttribute('disabled','false');
1957 obj.controller.view.cmd_transfer_volume.setAttribute('disabled','false');
1960 obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','false');
1961 obj.controller.view.sel_mark_items_missing.setAttribute('disabled','false');
1962 obj.controller.view.cmd_add_items_to_buckets.setAttribute('disabled','false');
1963 obj.controller.view.cmd_edit_items.setAttribute('disabled','false');
1964 obj.controller.view.cmd_replace_barcode.setAttribute('disabled','false');
1965 obj.controller.view.cmd_delete_items.setAttribute('disabled','false');
1966 obj.controller.view.cmd_print_spine_labels.setAttribute('disabled','false');
1967 obj.controller.view.cmd_transfer_items.setAttribute('disabled','false');
1968 obj.controller.view.sel_copy_details.setAttribute('disabled','false');
1969 obj.controller.view.cmd_create_brt.setAttribute('disabled','false');
1970 obj.controller.view.sel_patron.setAttribute('disabled','false');
1972 var L = 0; for (var k in sel_copy_libs) L++;
1974 obj.controller.view.cmd_book_item_now.setAttribute('disabled','false');
1978 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.actions.error'),E);
1982 'refresh_list' : function() {
1989 obj.org_ids = obj.network.simple_request('FM_AOU_IDS_RETRIEVE_VIA_RECORD_ID.authoritative',[ obj.docid ]);
1990 if (typeof obj.org_ids.ilsevent != 'undefined') throw(obj.org_ids);
1991 JSAN.use('util.functional');
1992 obj.org_ids = util.functional.map_list( obj.org_ids, function (o) { return Number(o); });
1993 obj.show_my_libs( obj.default_lib.id() );
1994 // FIXME - we get a null from the copy_count call if we call it too quickly here
1997 obj.show_consortial_count();
1998 if (typeof xulG.reload_opac == 'function') {
2004 this.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.refresh_list.error'),E);
2009 dump('exiting cat.copy_browser.js\n');