1 dump('entering cat.copy_browser.js\n');
4 if (typeof cat == 'undefined') cat = {};
5 cat.copy_browser = function (params) {
7 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
8 JSAN.use('util.error'); this.error = new util.error();
10 dump('cat.copy_browser: ' + E + '\n');
14 cat.copy_browser.prototype = {
22 'init' : function( params ) {
25 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
28 obj.docid = params.docid;
30 JSAN.use('util.network'); obj.network = new util.network();
31 JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
33 obj.controller_init(params);
35 obj.list_init(params);
39 obj.controller.render();
41 obj.default_depth = obj.depth_menu_init();
42 obj.default_lib = obj.data.hash.aou[ obj.library_menu_init() ];
44 document.getElementById('show_acns').addEventListener(
47 JSAN.use('util.file');
48 var file = new util.file(
49 'copy_browser_prefs.'+obj.data.server_unadorned);
50 util.widgets.save_attributes(file, {
51 'lib_menu' : [ 'value' ],
52 'depth_menu' : [ 'value' ],
53 'show_acns' : [ 'checked' ],
54 'show_acps' : [ 'checked' ],
55 'hide_aous' : [ 'checked' ] });
60 document.getElementById('show_acps').addEventListener(
63 JSAN.use('util.file');
64 var file = new util.file(
65 'copy_browser_prefs.'+obj.data.server_unadorned);
66 util.widgets.save_attributes(file, {
67 'lib_menu' : [ 'value' ],
68 'depth_menu' : [ 'value' ],
69 'show_acns' : [ 'checked' ],
70 'show_acps' : [ 'checked' ],
71 'hide_aous' : [ 'checked' ] });
76 document.getElementById('hide_aous').addEventListener(
79 JSAN.use('util.file');
80 var file = new util.file(
81 'copy_browser_prefs.'+obj.data.server_unadorned);
82 util.widgets.save_attributes(file, {
83 'lib_menu' : [ 'value' ],
84 'depth_menu' : [ 'value' ],
85 'show_acns' : [ 'checked' ],
86 'show_acps' : [ 'checked' ],
87 'hide_aous' : [ 'checked' ] });
92 obj.show_my_libs( obj.default_lib.id() );
94 JSAN.use('util.exec'); var exec = new util.exec(20); exec.timer(obj.funcs,100);
96 obj.show_consortial_count();
99 this.error.standard_unexpected_error_alert('cat.copy_browser.init: ',E);
103 'controller_init' : function(params) {
106 JSAN.use('util.controller'); obj.controller = new util.controller();
110 'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
113 function() { obj.list.clipboard(); }
118 alert(document.getElementById('commonStrings').getString('common.unimplemented'));
121 'cmd_show_my_libs' : [
127 'cmd_show_all_libs' : [
133 'cmd_show_libs_with_copies' : [
136 obj.show_libs_with_copies();
146 'cmd_request_items' : [
149 JSAN.use('cat.util'); JSAN.use('util.functional');
151 var list = util.functional.filter_list( obj.sel_list, function (o) { return o.split(/_/)[0] == 'acp'; });
153 list = util.functional.map_list( list, function (o) { return o.split(/_/)[1]; });
155 cat.util.request_items( list );
158 'sel_mark_items_damaged' : [
161 JSAN.use('cat.util'); JSAN.use('util.functional');
163 var list = util.functional.filter_list( obj.sel_list, function (o) { return o.split(/_/)[0] == 'acp'; });
165 list = util.functional.map_list( list, function (o) { return o.split(/_/)[1]; });
167 cat.util.mark_item_damaged( list );
172 'sel_mark_items_missing' : [
175 JSAN.use('cat.util'); JSAN.use('util.functional');
177 var list = util.functional.filter_list( obj.sel_list, function (o) { return o.split(/_/)[0] == 'acp'; });
179 list = util.functional.map_list( list, function (o) { return o.split(/_/)[1]; });
181 cat.util.mark_item_missing( list );
189 JSAN.use('util.functional');
191 var list = util.functional.filter_list(
194 return o.split(/_/)[0] == 'acp';
198 list = util.functional.map_list(
201 return { 'copy_id' : o.split(/_/)[1] };
205 JSAN.use('circ.util');
206 circ.util.show_last_few_circs(list);
209 'sel_copy_details' : [
212 JSAN.use('util.functional');
214 var list = util.functional.filter_list(
217 return o.split(/_/)[0] == 'acp';
221 JSAN.use('circ.util');
222 circ.util.item_details_new(
223 util.functional.map_list(
225 return obj.map_acp[o].barcode();
234 JSAN.use("cat.util");
235 JSAN.use("util.functional");
237 /* Filter selected rows that aren"t copies. */
238 var list = util.functional.filter_list(
241 return o.split(/_/)[0] == "acp";
244 var results = cat.util.make_bookable(
245 util.functional.map_list(
247 return obj.map_acp[o].id();
251 if (results && results["brsrc"]) {
252 cat.util.edit_new_brsrc(results["brsrc"]);
256 'cmd_book_item_now' : [
259 JSAN.use("cat.util");
260 JSAN.use("util.functional");
262 /* Filter selected rows that aren"t copies. */
263 var list = util.functional.filter_list(
266 return o.split(/_/)[0] == "acp";
269 var results = cat.util.make_bookable(
270 util.functional.map_list(
272 return obj.map_acp[o].id();
277 cat.util.edit_new_bresv(results);
285 JSAN.use('util.functional');
286 var list = util.functional.map_list(
287 util.functional.filter_list(
290 return o.split(/_/)[0] == 'acn';
294 return o.split(/_/)[1];
297 if (list.length == 0) return;
299 var copy_shortcut = {};
300 list = util.functional.map_list(
303 var call_number = obj.map_acn['acn_'+o];
304 var ou_id = call_number.owning_lib();
306 var label = call_number.label();
307 var acnc_id = typeof call_number.label_class() == 'object'
308 ? call_number.label_class().id()
309 : call_number.label_class();
310 var acnp_id = typeof call_number.prefix() == 'object'
311 ? call_number.prefix().id()
312 : call_number.prefix();
313 var acns_id = typeof call_number.suffix() == 'object'
314 ? call_number.suffix().id()
315 : call_number.suffix();
316 if (!copy_shortcut[ou_id]) copy_shortcut[ou_id] = {};
317 var callnumber_composite_key = acnc_id + ':' + acnp_id + ':' + label + ':' + acns_id;
318 copy_shortcut[ou_id][ callnumber_composite_key ] = volume_id;
323 /* quick fix */ /* what was this fixing? */
324 list = []; for (var i in copy_shortcut) { list.push( i ); }
328 edit = obj.network.request(
329 api.PERM_MULTI_ORG_CHECK.app,
330 api.PERM_MULTI_ORG_CHECK.method,
333 obj.data.list.au[0].id(),
337 ).length == 0 ? 1 : 0;
339 obj.error.sdump('D_ERROR','batch permission check: ' + E);
342 if (edit==0) return; // no read-only view for this interface
344 if (!obj.can_have_copies) {
345 alert(document.getElementById('catStrings').getFormattedString('staff.cat.copy_browser.can_have_copies.false', obj.source));
349 var title = document.getElementById('catStrings').getString('staff.cat.copy_browser.add_item.title');
352 var unified_interface = String( obj.data.hash.aous['ui.unified_volume_copy_editor'] ) == 'true';
353 if (unified_interface) {
354 var horizontal_interface = String( obj.data.hash.aous['ui.cat.volume_copy_editor.horizontal'] ) == 'true';
355 url = xulG.url_prefix( horizontal_interface ? urls.XUL_VOLUME_COPY_CREATOR_HORIZONTAL : urls.XUL_VOLUME_COPY_CREATOR );
357 url = xulG.url_prefix( urls.XUL_VOLUME_COPY_CREATOR_ORIGINAL );
360 var w = xulG.new_tab(
362 { 'tab_name' : title },
364 'doc_id' : obj.docid,
366 'copy_shortcut' : copy_shortcut,
367 'onrefresh' : function() { obj.refresh_list(); }
371 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.add_item.error'),E);
375 'cmd_add_items_to_buckets' : [
379 JSAN.use('util.functional');
381 var list = util.functional.filter_list(
384 return o.split(/_/)[0] == 'acp';
388 list = util.functional.map_list(
391 return o.split(/_/)[1];
395 JSAN.use('cat.util');
396 cat.util.add_copies_to_bucket( list );
399 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.add_items_bucket.error'),E);
407 var unified_interface = String( obj.data.hash.aous['ui.unified_volume_copy_editor'] ) == 'true';
408 if (!unified_interface) {
409 obj.controller.control_map['old_cmd_edit_items'][1]();
413 JSAN.use('util.functional');
415 var list = util.functional.filter_list(
418 return o.split(/_/)[0] == 'acp';
422 list = util.functional.map_list(
425 var cloned_copy_obj = JSON2js( js2JSON( obj.map_acp[ o ] ) );
426 cloned_copy_obj.call_number( obj.map_acn[ 'acn_' + cloned_copy_obj.call_number() ] );
427 return cloned_copy_obj;
431 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( urls.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 ? urls.XUL_VOLUME_COPY_CREATOR_HORIZONTAL : urls.XUL_VOLUME_COPY_CREATOR );
663 url = xulG.url_prefix( urls.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 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
913 var acn_list = util.functional.map_list(
916 return obj.map_acn[ 'acn_' + o ].label();
918 ).join(document.getElementById('commonStrings').getString('common.grouping_string'));
920 var xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: auto">';
921 xml += '<description>';
922 xml += document.getElementById('catStrings').getFormattedString('staff.cat.copy_browser.transfer.prompt', [acn_list, obj.data.hash.aou[ obj.data.marked_library.lib ].shortname()]);
923 xml += '</description>';
924 xml += '<hbox><button label="' + document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.submit.label') + '" name="fancy_submit"/>';
925 xml += '<button label="'
926 + document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.cancel.label')
928 + document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.cancel.accesskey')
929 + '" name="fancy_cancel"/></hbox>';
930 xml += '<iframe style="overflow: scroll" flex="1" src="' + urls.XUL_BIB_BRIEF + '?docid=' + obj.data.marked_library.docid + '"/>';
932 JSAN.use('OpenILS.data');
933 var data = new OpenILS.data(); data.init({'via':'stash'});
934 //data.temp_transfer = xml; data.stash('temp_transfer');
935 JSAN.use('util.window'); var win = new util.window();
936 var fancy_prompt_data = win.open(
937 urls.XUL_FANCY_PROMPT,
938 //+ '?xml_in_stash=temp_transfer'
939 //+ '&title=' + window.escape('Volume Transfer'),
940 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300',
943 'title' : document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.title')
947 if (fancy_prompt_data.fancy_status == 'incomplete') {
948 alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.incomplete'));
952 var robj = obj.network.simple_request(
954 [ ses(), { 'docid' : obj.data.marked_library.docid, 'lib' : obj.data.marked_library.lib, 'volumes' : list } ],
957 'title' : document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.override.failure'),
958 'overridable_events' : [
959 1208 /* TITLE_LAST_COPY */,
960 1219 /* COPY_REMOTE_CIRC_LIB */,
965 if (typeof robj.ilsevent != 'undefined') {
966 if (robj.ilsevent == 1221 /* ORG_CANNOT_HAVE_VOLS */) {
967 alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.ineligible_destination'));
972 alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.success'));
976 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.unexpected_error'),E);
982 'cmd_transfer_items' : [
986 obj.data.stash_retrieve();
987 if (!obj.data.marked_volume) {
988 alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer_items.missing_volume'));
992 JSAN.use('util.functional');
994 var list = util.functional.filter_list(
997 return o.split(/_/)[0] == 'acp';
1001 list = util.functional.map_list(
1004 return o.split(/_/)[1];
1008 var volume = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ obj.data.marked_volume ]);
1010 JSAN.use('cat.util'); cat.util.transfer_copies( {
1012 'docid' : volume.record(),
1013 'volume_label' : volume.label(),
1014 'owning_lib' : volume.owning_lib(),
1018 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer_items.unexpected_error'),E);
1024 'cmd_link_as_multi_bib' : [
1028 obj.data.stash_retrieve();
1029 if (!obj.data.marked_multi_home_record) {
1030 alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.link_as_multi_bib.missing_bib'));
1034 JSAN.use('util.functional');
1036 var list = util.functional.filter_list(
1039 return o.split(/_/)[0] == 'acp';
1043 list = util.functional.map_list(
1046 return obj.map_acp[ o ].barcode();
1051 window.xulG.url_prefix(urls.MANAGE_MULTI_HOME_ITEMS),
1053 { 'docid' : obj.data.marked_multi_home_record, 'barcodes' : list }
1057 alert('Error in copy_browser.js, cmd_link_as_multi_bib: ' + E);
1063 'cmd_print_tree' : [
1068 'template' : 'holdings_maintenance',
1069 'mvr_id' : obj.docid,
1072 bib_brief_overlay(p);
1073 p.data = p.print_data;
1076 alert('Error in copy_browser.js, cmd_print_tree: ' + E);
1085 this.error.standard_unexpected_error_alert('cat.copy_browser.controller_init(): ',E);
1089 'depth_menu_init' : function(params) {
1094 for (var i = 0; i < obj.data.list.aout.length; i++) {
1095 var type = obj.data.list.aout[i];
1096 var depth = type.depth();
1097 if ( depth > max_depth) { max_depth = depth; }
1098 if (typeof list[depth] == 'undefined') {
1106 list[depth][0] += ' / ' + type.opac_label();
1109 ml = util.widgets.make_menulist( list, max_depth );
1110 ml.setAttribute('id','depth_menu'); document.getElementById('x_depth_menu').appendChild(ml);
1111 ml.addEventListener(
1114 obj.default_depth = ev.target.value;
1115 if (document.getElementById('refresh_button')) document.getElementById('refresh_button').focus();
1116 JSAN.use('util.file'); var file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned);
1117 util.widgets.save_attributes(file, {
1118 'lib_menu' : [ 'value' ],
1119 'depth_menu' : [ 'value' ],
1120 'show_acns' : [ 'checked' ],
1121 'show_acps' : [ 'checked' ],
1122 'hide_aous' : [ 'checked' ]
1128 file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned);
1129 util.widgets.load_attributes(file);
1130 ml.value = ml.getAttribute('value');
1132 ml.value = max_depth;
1133 ml.setAttribute('value',ml.value);
1138 alert('Error in copy_browser.js, depth_menu_init(): ' + E);
1142 'library_menu_init' : function(params) {
1146 obj.org_ids = obj.network.simple_request('FM_AOU_IDS_RETRIEVE_VIA_RECORD_ID.authoritative',[ obj.docid ]);
1147 if (typeof obj.org_ids.ilsevent != 'undefined') throw(obj.org_ids);
1148 JSAN.use('util.functional');
1149 obj.org_ids = util.functional.map_list( obj.org_ids, function (o) { return Number(o); });
1151 var org = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
1153 JSAN.use('util.file'); JSAN.use('util.widgets');
1155 var file; var list_data; var ml;
1157 file = new util.file('offline_ou_list');
1158 if (file._file.exists()) {
1159 list_data = file.get_object(); file.close();
1160 for (var i = 0; i < list_data[0].length; i++) { // make sure all entries are enabled
1161 list_data[0][i][2] = false;
1163 ml = util.widgets.make_menulist( list_data[0], list_data[1] );
1164 ml.setAttribute('id','lib_menu'); document.getElementById('x_lib_menu').appendChild(ml);
1165 for (var i = 0; i < obj.org_ids.length; i++) {
1166 ml.getElementsByAttribute('value',obj.org_ids[i])[0].setAttribute('class','has_copies');
1168 ml.firstChild.addEventListener(
1171 document.getElementById('legend').setAttribute('hidden','false');
1175 ml.firstChild.addEventListener(
1178 document.getElementById('legend').setAttribute('hidden','true');
1182 ml.addEventListener(
1185 obj.default_lib = obj.data.hash.aou[ ev.target.value ];
1186 if (document.getElementById('refresh_button')) document.getElementById('refresh_button').focus();
1187 JSAN.use('util.file'); var file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned);
1188 util.widgets.save_attributes(file, {
1189 'lib_menu' : [ 'value' ],
1190 'depth_menu' : [ 'value' ],
1191 'show_acns' : [ 'checked' ],
1192 'show_acps' : [ 'checked' ],
1193 'hide_aous' : [ 'checked' ]
1200 throw(document.getElementById('catStrings').getString('staff.cat.copy_browser.missing_library') + '\n');
1203 file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned);
1204 util.widgets.load_attributes(file);
1205 ml.value = ml.getAttribute('value');
1207 ml.value = org.id();
1208 ml.setAttribute('value',ml.value);
1214 this.error.standard_unexpected_error_alert('cat.copy_browser.library_menu_init(): ',E);
1218 'show_consortial_count' : function() {
1221 obj.network.simple_request('FM_ACP_COUNT.authoritative',[ obj.data.tree.aou.id(), obj.docid ],function(req){
1223 var robj = req.getResultObject();
1224 var x = document.getElementById('consortial_total');
1225 if (x) x.setAttribute('value',robj[0].count);
1226 x = document.getElementById('consortial_available');
1227 if (x) x.setAttribute('value',robj[0].available);
1229 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.consortial_copy_count.error'),E);
1233 this.error.standard_unexpected_error_alert('cat.copy_browser.show_consortial_count: ',E);
1237 'show_my_libs' : function(org) {
1241 org = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
1243 if (typeof org != 'object') org = obj.data.hash.aou[ org ];
1245 obj.show_libs( org, false );
1247 var p_org = obj.data.hash.aou[ org.parent_ou() ];
1249 obj.funcs.push( function() {
1250 document.getElementById('cmd_refresh_list').setAttribute('disabled','true');
1251 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','true');
1252 document.getElementById('lib_menu').setAttribute('disabled','true');
1254 for (var i = 0; i < p_org.children().length; i++) {
1258 obj.show_libs( o, false );
1260 }( p_org.children()[i] )
1263 obj.funcs.push( function() {
1264 document.getElementById('cmd_refresh_list').setAttribute('disabled','false');
1265 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','false');
1266 document.getElementById('lib_menu').setAttribute('disabled','false');
1275 'show_all_libs' : function() {
1280 obj.show_libs( obj.data.tree.aou );
1282 obj.funcs.push( function() {
1283 document.getElementById('cmd_refresh_list').setAttribute('disabled','true');
1284 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','true');
1285 document.getElementById('lib_menu').setAttribute('disabled','true');
1288 for (var i = 0; i < obj.data.tree.aou.children().length; i++) {
1289 var child = obj.data.tree.aou.children()[i];
1290 if (obj.data.hash.aout[child.ou_type()].depth() <= obj.default_depth
1291 && orgIsMine(obj.default_lib,child,obj.default_depth)) {
1301 obj.funcs.push( function() {
1302 document.getElementById('cmd_refresh_list').setAttribute('disabled','false');
1303 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','false');
1304 document.getElementById('lib_menu').setAttribute('disabled','false');
1312 'show_libs_with_copies' : function() {
1315 JSAN.use('util.functional');
1317 var orgs = util.functional.map_list(
1319 function(id) { return obj.data.hash.aou[id]; }
1322 if (a.shortname() < b.shortname()) return -1;
1323 if (a.shortname() > b.shortname()) return 1;
1327 obj.funcs.push( function() {
1328 document.getElementById('cmd_refresh_list').setAttribute('disabled','true');
1329 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','true');
1330 document.getElementById('lib_menu').setAttribute('disabled','true');
1333 for (var i = 0; i < orgs.length; i++) {
1337 obj.show_libs(o,false);
1342 obj.funcs.push( function() {
1343 document.getElementById('cmd_refresh_list').setAttribute('disabled','false');
1344 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','false');
1345 document.getElementById('lib_menu').setAttribute('disabled','false');
1353 'show_libs' : function(start_aou,show_open) {
1356 if (!start_aou) throw('show_libs: Need a start_aou');
1357 JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
1358 JSAN.use('util.functional');
1361 var temp_aou = start_aou;
1362 while ( temp_aou.parent_ou() ) {
1363 temp_aou = obj.data.hash.aou[ temp_aou.parent_ou() ];
1364 parents.push( temp_aou );
1368 for (var i = 0; i < parents.length; i++) {
1372 obj.append_org(o,p,{'container':'true','open':'true'});
1374 }(parents[i], obj.data.hash.aou[ parents[i].parent_ou() ])
1380 return function() { obj.append_org(o,p); };
1381 }(start_aou,obj.data.hash.aou[ start_aou.parent_ou() ])
1386 if (start_aou.children()) {
1387 var x = obj.map_tree[ 'aou_' + start_aou.id() ];
1388 x.setAttribute('container','true');
1389 if (show_open) x.setAttribute('open','true');
1390 for (var i = 0; i < start_aou.children().length; i++) {
1391 var child = start_aou.children()[i];
1392 if (obj.data.hash.aout[child.ou_type()].depth() <= obj.default_depth
1393 && orgIsMine(obj.default_lib,child,obj.default_depth)) {
1396 return function() { obj.append_org(o,p); };
1397 }( child, start_aou )
1410 'on_select' : function(list,twisty) {
1412 for (var i = 0; i < list.length; i++) {
1413 var node = obj.map_tree[ list[i] ];
1414 //if (node.lastChild.nodeName == 'treechildren') { continue; } else { alert(node.lastChild.nodeName); }
1415 var row_type = list[i].split('_')[0];
1416 var id = list[i].split('_')[1];
1418 case 'aou' : obj.on_select_org(id,twisty); break;
1419 case 'acn' : obj.on_select_acn(id,twisty); break;
1425 'on_select_acn' : function(acn_id,twisty) {
1428 var acn_tree = obj.map_acp[ 'acn_' + acn_id ];
1429 obj.funcs.push( function() {
1430 document.getElementById('cmd_refresh_list').setAttribute('disabled','true');
1431 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','true');
1432 document.getElementById('lib_menu').setAttribute('disabled','true');
1434 if (acn_tree.copies()) {
1435 for (var i = 0; i < acn_tree.copies().length; i++) {
1439 obj.append_acp(c,a);
1441 }( acn_tree.copies()[i], acn_tree )
1445 obj.funcs.push( function() {
1446 document.getElementById('cmd_refresh_list').setAttribute('disabled','false');
1447 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','false');
1448 document.getElementById('lib_menu').setAttribute('disabled','false');
1455 'on_select_org' : function(org_id,twisty) {
1458 var org = obj.data.hash.aou[ org_id ];
1459 obj.funcs.push( function() {
1460 document.getElementById('cmd_refresh_list').setAttribute('disabled','true');
1461 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','true');
1462 document.getElementById('lib_menu').setAttribute('disabled','true');
1464 if (org.children()) {
1465 for (var i = 0; i < org.children().length; i++) {
1466 var child = org.children()[i];
1467 if (obj.data.hash.aout[child.ou_type()].depth() <= obj.default_depth
1468 && orgIsMine(obj.default_lib,child,obj.default_depth)) {
1479 if (obj.map_acn[ 'aou_' + org_id ]) {
1480 for (var i = 0; i < obj.map_acn[ 'aou_' + org_id ].length; i++) {
1484 obj.append_acn(o,a);
1486 }( org, obj.map_acn[ 'aou_' + org_id ][i] )
1490 obj.funcs.push( function() {
1491 document.getElementById('cmd_refresh_list').setAttribute('disabled','false');
1492 document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','false');
1493 document.getElementById('lib_menu').setAttribute('disabled','false');
1496 alert('Error in copy_browser.js, on_select_org(): ' + E);
1500 'append_org' : function (org,parent_org,params) {
1502 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
1503 obj.error.consoleService.logStringMessage('append_org: org = ' + org.shortname() + ' parent_org = ' + (parent_org ? parent_org.shortname() : '') + ' params = ' + js2JSON(params) + '\n');
1505 if (obj.map_tree[ 'aou_' + org.id() ]) {
1506 var x = obj.map_tree[ 'aou_' + org.id() ];
1508 for (var i in params) {
1509 x.setAttribute(i,params[i]);
1521 'skip_all_columns_except' : [0,1,2],
1522 'retrieve_id' : 'aou_' + org.id(),
1524 'no_auto_select' : true,
1528 if ( obj.org_ids.indexOf( Number( org.id() ) ) == -1 ) {
1529 if ( get_bool( obj.data.hash.aout[ org.ou_type() ].can_have_vols() ) ) {
1530 data.row.my.volume_count = '0';
1531 data.row.my.copy_count = '<0>';
1533 data.row.my.volume_count = '';
1534 data.row.my.copy_count = '';
1537 var v_count = 0; var c_count = 0;
1538 acn_tree_list = obj.network.simple_request(
1539 'FM_ACN_TREE_LIST_RETRIEVE_VIA_RECORD_ID_AND_ORG_IDS.authoritative',
1540 [ ses(), obj.docid, [ org.id() ] ]
1542 for (var i = 0; i < acn_tree_list.length; i++) {
1544 obj.map_acn[ 'acn_' + acn_tree_list[i].id() ] = function(r){return r;}(acn_tree_list[i]);
1545 var copies = acn_tree_list[i].copies(); if (copies) c_count += copies.length;
1546 for (var j = 0; j < copies.length; j++) {
1547 obj.map_acp[ 'acp_' + copies[j].id() ] = function(r){return r;}(copies[j]);
1550 data.row.my.volume_count = String(v_count);
1551 data.row.my.copy_count = '<' + c_count + '>';
1553 if (document.getElementById('hide_aous').checked) {
1554 if (org.children().length == 0
1555 && data.row.my.volume_count == '0') {
1557 params = { 'hidden' : true };
1559 params['hidden'] = true;
1561 dump('hiding org.id() = ' + org.id() + '\n');
1565 data.node = obj.map_tree[ 'aou_' + parent_org.id() ];
1567 var nparams = obj.list.append(data);
1568 var node = nparams.my_node;
1570 for (var i in params) {
1571 node.setAttribute(i,params[i]);
1574 obj.map_tree[ 'aou_' + org.id() ] = node;
1576 if (org.children()) {
1577 node.setAttribute('container','true');
1581 if ( obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ].parent_ou() == parent_org.id() ) {
1582 data.node.setAttribute('open','true');
1585 obj.map_tree[ 'aou_' + org.id() ].setAttribute('open','true');
1588 if (acn_tree_list) {
1589 obj.map_acn[ 'aou_' + org.id() ] = acn_tree_list;
1590 node.setAttribute('container','true');
1593 if (document.getElementById('show_acns').checked) {
1594 node.setAttribute('open','true');
1595 obj.funcs.push( function() { obj.on_select_org( org.id() ); } );
1604 'append_acn' : function( org, acn_tree, params ) {
1607 if (obj.map_tree[ 'acn_' + acn_tree.id() ]) {
1608 var x = obj.map_tree[ 'acn_' + acn_tree.id() ];
1610 for (var i in params) {
1611 x.setAttribute(i,params[i]);
1617 var parent_node = obj.map_tree[ 'aou_' + org.id() ];
1623 'volume_count' : '',
1624 'copy_count' : acn_tree.copies() ? acn_tree.copies().length : '0',
1627 'skip_all_columns_except' : [0,1,2],
1628 'retrieve_id' : 'acn_' + acn_tree.id(),
1629 'node' : parent_node,
1631 'no_auto_select' : true,
1633 var nparams = obj.list.append(data);
1634 var node = nparams.my_node;
1635 obj.map_tree[ 'acn_' + acn_tree.id() ] = node;
1637 for (var i in params) {
1638 node.setAttribute(i,params[i]);
1641 if (acn_tree.copies()) {
1642 obj.map_acp[ 'acn_' + acn_tree.id() ] = acn_tree;
1643 node.setAttribute('container','true');
1645 if (document.getElementById('show_acps').checked) {
1646 node.setAttribute('open','true');
1647 obj.funcs.push( function() { obj.on_select_acn( acn_tree.id() ); } );
1656 'append_acp' : function( acp_item, acn_tree, params ) {
1659 if (obj.map_tree[ 'acp_' + acp_item.id() ]) {
1660 var x = obj.map_tree[ 'acp_' + acp_item.id() ];
1662 for (var i in params) {
1663 x.setAttribute(i,params[i]);
1669 var parent_node = obj.map_tree[ 'acn_' + acn_tree.id() ];
1673 'doc_id' : obj.docid,
1674 'aou' : obj.data.hash.aou[ acn_tree.owning_lib() ],
1678 acp_item.circulations()
1680 acp_item.circulations().length > 0
1681 ? acp_item.circulations()[0]
1685 'volume_count' : '',
1689 'retrieve_id' : 'acp_' + acp_item.id(),
1690 'node' : parent_node,
1692 'no_auto_select' : true,
1694 var nparams = obj.list.append(data);
1695 var node = nparams.my_node;
1696 obj.map_tree[ 'acp_' + acp_item.id() ] = node;
1698 for (var i in params) {
1699 node.setAttribute(i,params[i]);
1709 'list_init' : function( params ) {
1712 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
1715 JSAN.use('circ.util');
1718 'id' : 'tree_location',
1719 'label' : document.getElementById('catStrings').getString('staff.cat.copy_browser.list_init.tree_location'),
1720 'flex' : 1, 'primary' : true, 'hidden' : false,
1721 'render' : function(my) { return my.acp ? my.acp.barcode() : my.acn ? my.acn.label() : my.aou ? my.aou.shortname() + " : " + my.aou.name() : "???"; },
1724 'id' : 'volume_count',
1725 'label' : document.getElementById('catStrings').getString('staff.cat.copy_browser.list_init.volume_count'),
1726 'flex' : 0, 'primary' : false, 'hidden' : false,
1727 'render' : function(my) { return my.volume_count; },
1730 'id' : 'copy_count',
1731 'label' : document.getElementById('catStrings').getString('staff.cat.copy_browser.list_init.copy_count'),
1733 'primary' : false, 'hidden' : false,
1734 'render' : function(my) { return my.copy_count; },
1739 'location' : { 'hidden' : false },
1740 'circ_lib' : { 'hidden' : false },
1741 'owning_lib' : { 'hidden' : false },
1742 'call_number' : { 'hidden' : false },
1743 'parts' : { 'hidden' : false },
1744 'due_date' : { 'hidden' : false },
1745 'acp_status' : { 'hidden' : false },
1773 'acp_mint_condition',
1779 JSAN.use('util.list'); obj.list = new util.list('copy_tree');
1782 'no_auto_select' : true,
1783 'columns' : columns,
1784 'retrieve_row' : function(params) {
1786 var row = params.row;
1789 if (!row.my.mvr) obj.funcs.push(
1792 row.my.mvr = obj.network.request(
1793 api.MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.app,
1794 api.MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.method,
1795 [ row.my.circ.target_copy() ]
1804 row.my.acp = obj.network.request(
1805 api.FM_ACP_RETRIEVE.app,
1806 api.FM_ACP_RETRIEVE.method,
1807 [ row.my.circ.target_copy() ]
1810 params.row_node.setAttribute( 'retrieve_id',row.my.acp.barcode() );
1815 params.row_node.setAttribute( 'retrieve_id',row.my.acp.barcode() );
1821 if (typeof params.on_retrieve == 'function') {
1822 params.on_retrieve(row);
1830 'on_click' : function(ev) {
1831 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserRead');
1832 var row = {}; var col = {}; var nobj = {};
1833 obj.list.node.treeBoxObject.getCellAt(ev.clientX,ev.clientY,row,col,nobj);
1834 if ((row.value == -1)||(nobj.value != 'twisty')) { return; }
1835 var node = obj.list.node.contentView.getItemAtIndex(row.value);
1836 var list = [ node.getAttribute('retrieve_id') ];
1837 if (typeof obj.on_select == 'function') {
1838 obj.on_select(list,true);
1840 if (typeof window.xulG == 'object' && typeof window.xulG.on_select == 'function') {
1841 window.xulG.on_select(list);
1844 'on_select' : function(ev) {
1845 JSAN.use('util.functional');
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 if (typeof obj.on_select == 'function') {
1854 obj.on_select(obj.sel_list);
1856 if (typeof window.xulG == 'object' && typeof window.xulG.on_select == 'function') {
1857 window.xulG.on_select(obj.sel_list);
1863 $('list_actions').appendChild( obj.list.render_list_actions() );
1864 obj.list.set_list_actions();
1867 this.error.sdump('D_ERROR','cat.copy_browser.list_init: ' + E + '\n');
1872 // Sets can_have_copies and source member variables.
1873 'source_init' : function() {
1876 JSAN.use('cat.util');
1877 var cbsObj = cat.util.get_cbs_for_bre_id(obj.docid);
1879 obj.can_have_copies = (cbsObj.can_have_copies() == get_db_true());
1880 obj.source = cbsObj.source();
1882 obj.can_have_copies = true;
1885 obj.error.sdump('D_ERROR','can have copies check: ' + E);
1890 'toggle_actions' : function() {
1893 var found_aou = false; var found_acn = false; var found_acp = false;
1894 var found_aou_with_can_have_vols = false;
1895 var sel_copy_libs = {};
1896 for (var i = 0; i < obj.sel_list.length; i++) {
1897 var type = obj.sel_list[i].split(/_/)[0];
1901 var org = obj.data.hash.aou[ obj.sel_list[i].split(/_/)[1] ];
1902 if ( get_bool( obj.data.hash.aout[ org.ou_type() ].can_have_vols() ) ) found_aou_with_can_have_vols = true;
1904 case 'acn' : found_acn = true; break;
1910 obj.map_acp[obj.sel_list[i]].call_number()
1916 obj.controller.view.cmd_add_items.setAttribute('disabled','true');
1917 obj.controller.view.cmd_add_items_to_buckets.setAttribute('disabled','true');
1918 obj.controller.view.cmd_edit_items.setAttribute('disabled','true');
1919 obj.controller.view.cmd_replace_barcode.setAttribute('disabled','true');
1920 obj.controller.view.cmd_delete_items.setAttribute('disabled','true');
1921 obj.controller.view.cmd_print_spine_labels.setAttribute('disabled','true');
1922 obj.controller.view.cmd_add_volumes.setAttribute('disabled','true');
1923 obj.controller.view.cmd_mark_library.setAttribute('disabled','true');
1924 obj.controller.view.cmd_edit_volumes.setAttribute('disabled','true');
1925 obj.controller.view.cmd_delete_volumes.setAttribute('disabled','true');
1926 obj.controller.view.cmd_mark_volume.setAttribute('disabled','true');
1927 obj.controller.view.cmd_transfer_volume.setAttribute('disabled','true');
1928 obj.controller.view.cmd_transfer_items.setAttribute('disabled','true');
1929 obj.controller.view.sel_copy_details.setAttribute('disabled','true');
1930 obj.controller.view.cmd_create_brt.setAttribute('disabled','true');
1931 obj.controller.view.cmd_book_item_now.setAttribute('disabled','true');
1932 obj.controller.view.sel_patron.setAttribute('disabled','true');
1933 obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','true');
1934 obj.controller.view.sel_mark_items_missing.setAttribute('disabled','true');
1935 if (found_aou && found_aou_with_can_have_vols) {
1936 obj.controller.view.cmd_add_volumes.setAttribute('disabled','false');
1937 obj.controller.view.cmd_mark_library.setAttribute('disabled','false');
1940 obj.controller.view.cmd_edit_volumes.setAttribute('disabled','false');
1941 obj.controller.view.cmd_delete_volumes.setAttribute('disabled','false');
1942 obj.controller.view.cmd_mark_volume.setAttribute('disabled','false');
1943 obj.controller.view.cmd_add_items.setAttribute('disabled','false');
1944 obj.controller.view.cmd_transfer_volume.setAttribute('disabled','false');
1947 obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','false');
1948 obj.controller.view.sel_mark_items_missing.setAttribute('disabled','false');
1949 obj.controller.view.cmd_add_items_to_buckets.setAttribute('disabled','false');
1950 obj.controller.view.cmd_edit_items.setAttribute('disabled','false');
1951 obj.controller.view.cmd_replace_barcode.setAttribute('disabled','false');
1952 obj.controller.view.cmd_delete_items.setAttribute('disabled','false');
1953 obj.controller.view.cmd_print_spine_labels.setAttribute('disabled','false');
1954 obj.controller.view.cmd_transfer_items.setAttribute('disabled','false');
1955 obj.controller.view.sel_copy_details.setAttribute('disabled','false');
1956 obj.controller.view.cmd_create_brt.setAttribute('disabled','false');
1957 obj.controller.view.sel_patron.setAttribute('disabled','false');
1959 var L = 0; for (var k in sel_copy_libs) L++;
1961 obj.controller.view.cmd_book_item_now.setAttribute('disabled','false');
1965 obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.actions.error'),E);
1969 'refresh_list' : function() {
1976 obj.org_ids = obj.network.simple_request('FM_AOU_IDS_RETRIEVE_VIA_RECORD_ID.authoritative',[ obj.docid ]);
1977 if (typeof obj.org_ids.ilsevent != 'undefined') throw(obj.org_ids);
1978 JSAN.use('util.functional');
1979 obj.org_ids = util.functional.map_list( obj.org_ids, function (o) { return Number(o); });
1980 obj.show_my_libs( obj.default_lib.id() );
1981 // FIXME - we get a null from the copy_count call if we call it too quickly here
1982 setTimeout( function() { obj.show_consortial_count(); }, 2000 );
1984 this.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.refresh_list.error'),E);
1989 dump('exiting cat.copy_browser.js\n');