1 dump('entering cat/util.js\n');
3 if (typeof cat == 'undefined') var cat = {};
7 'spawn_copy_editor', 'add_copies_to_bucket', 'show_in_opac', 'spawn_spine_editor',
9 cat.util.EXPORT_TAGS = { ':all' : cat.util.EXPORT_OK };
11 cat.util.spawn_spine_editor = function(selection_list) {
12 JSAN.use('util.error'); var error = new util.error();
14 JSAN.use('util.functional');
16 xulG.url_prefix( urls.XUL_SPINE_LABEL ) + '?barcodes='
17 + js2JSON( util.functional.map_list(selection_list,function(o){return o.barcode;}) ),
18 { 'tab_name' : 'Spine Labels' },
22 error.standard_unexpected_error_alert('Spine Labels',E);
26 cat.util.show_in_opac = function(selection_list) {
27 JSAN.use('util.error'); var error = new util.error();
30 for (var i = 0; i < selection_list.length; i++) {
31 doc_id = selection_list[i].doc_id;
33 alert(selection_list[i].barcode + ' is not cataloged');
36 var opac_url = xulG.url_prefix( urls.opac_rdetail ) + '?r=' + doc_id;
37 var content_params = {
39 'authtime' : ses('authtime'),
40 'opac_url' : opac_url,
43 xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
44 {'tab_name':'Retrieving title...'},
49 error.standard_unexpected_error_alert('Error opening catalog for document id = ' + doc_id,E);
53 cat.util.add_copies_to_bucket = function(selection_list) {
54 JSAN.use('util.functional');
55 JSAN.use('util.window'); var win = new util.window();
57 xulG.url_prefix(urls.XUL_COPY_BUCKETS)
58 + '?copy_ids=' + js2JSON(
59 util.functional.map_list(
66 'sel_bucket_win' + win.window_name_increment(),
67 'chrome,resizable,modal,center'
71 cat.util.spawn_copy_editor = function(list,edit) {
74 JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
75 JSAN.use('util.network'); obj.network = new util.network();
76 JSAN.use('util.error'); obj.error = new util.error();
78 var title = list.length == 1 ? '' : 'Batch ';
79 title += edit == 1 ? 'Edit' : 'View';
80 title += ' Copy Attributes';
82 JSAN.use('util.window'); var win = new util.window();
84 obj.data.stash('temp');
86 window.xulG.url_prefix(urls.XUL_COPY_EDITOR)
87 +'?copy_ids='+window.escape(js2JSON(list))
90 'chrome,modal,resizable'
92 /* FIXME -- need to unique the temp space, and not rely on modalness of window */
93 obj.data.stash_retrieve();
94 var copies = JSON2js( obj.data.temp_copies );
95 obj.error.sdump('D_CAT','in cat/copy_status, copy editor, copies =\n<<' + copies + '>>');
96 if (edit=='1' && copies!='' && typeof copies != 'undefined') {
98 var r = obj.network.request(
99 api.FM_ACP_FLESHED_BATCH_UPDATE.app,
100 api.FM_ACP_FLESHED_BATCH_UPDATE.method,
103 /* FIXME -- revisit the return value here */
105 obj.error.standard_unexpected_error_alert('copy update error',E);
108 alert('not updating');
115 dump('exiting cat/util.js\n');