1 dump('entering cat/util.js\n');
3 if (typeof cat == 'undefined') var cat = {};
9 cat.util.EXPORT_TAGS = { ':all' : cat.util.EXPORT_OK };
11 cat.util.spawn_copy_editor = function(list) {
13 JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
14 JSAN.use('util.network'); obj.network = new util.network();
15 JSAN.use('util.error'); obj.error = new util.error();
17 var copies = util.functional.map_list(
20 return obj.network.simple_request('FM_ACP_RETRIEVE',[acp_id]);
26 edit = obj.network.request(
27 api.PERM_MULTI_ORG_CHECK.app,
28 api.PERM_MULTI_ORG_CHECK.method,
31 obj.data.list.au[0].id(),
32 util.functional.map_list(
35 return obj.network.simple_request('FM_ACN_RETRIEVE',[o.call_number()]).owning_lib();
38 [ 'UPDATE_COPY', 'UPDATE_BATCH_COPY' ]
40 ).length == 0 ? 1 : 0;
42 obj.error.sdump('D_ERROR','batch permission check: ' + E);
45 var title = list.length == 1 ? 'Copy' : 'Copies';
47 JSAN.use('util.window'); var win = new util.window();
49 obj.data.stash('temp');
51 window.xulG.url_prefix(urls.XUL_COPY_EDITOR)
52 +'?copy_ids='+window.escape(js2JSON(list))
55 'chrome,modal,resizable'
57 /* FIXME -- need to unique the temp space, and not rely on modalness of window */
58 obj.data.stash_retrieve();
59 copies = JSON2js( obj.data.temp );
60 obj.error.sdump('D_CAT','in cat/copy_status, copy editor, copies =\n<<' + copies + '>>');
61 if (edit=='1' && copies!='' && typeof copies != 'undefined') {
63 var r = obj.network.request(
64 api.FM_ACP_FLESHED_BATCH_UPDATE.app,
65 api.FM_ACP_FLESHED_BATCH_UPDATE.method,
68 /* FIXME -- revisit the return value here */
70 obj.error.standard_unexpected_error_alert('copy update error',E);
75 dump('exiting cat/util.js\n');