1 dump('entering cat.copy_browser.js\n');
3 if (typeof cat == 'undefined') cat = {};
4 cat.copy_browser = function (params) {
6 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
7 JSAN.use('util.error'); this.error = new util.error();
9 dump('cat.copy_browser: ' + E + '\n');
13 cat.copy_browser.prototype = {
15 'init' : function( params ) {
18 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
21 JSAN.use('util.controller'); obj.controller = new util.controller();
27 function() { alert('Not Yet Implemented'); }
31 function() { obj.test(); }
37 obj.list_init(params);
40 this.error.sdump('D_ERROR','cat.copy_browser.init: ' + E + '\n');
47 JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
48 JSAN.use('util.functional'); JSAN.use('util.exec'); var exec = new util.exec();
56 var start_at_this_aou;
57 start_at_this_aou = obj.data.tree.aou;
59 start_at_this_aou = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
60 if (start_at_this_aou.parent_ou()) start_at_this_aou = obj.data.hash.aou[ start_at_this_aou.parent_ou() ];
63 util.functional.walk_tree_preorder(
65 function (org) { dump('finding children for ' + org.shortname() + '\n'); return org.children(); },
66 function (org,parent_org) {
67 dump('queueing ' + org.shortname() + '\n');
77 'render_cols' : [ 0, 1, 2 ]
79 if ( obj.data.hash.aout[ org.ou_type() ].can_have_vols() ) {
80 data.row.my.volume_count = '??';
81 data.row.my.copy_count = '??';
83 data.row.my.volume_count = '';
84 data.row.my.copy_count = '';
87 data.node = obj.map_tree[ 'aou_' + parent_org.id() ];
89 obj.map_tree[ 'aou_' + org.id() ] = obj.list.append(data);
91 if ( obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ].parent_ou() == parent_org.id() ) data.node.setAttribute('open','true');
93 obj.map_tree[ 'aou_' + org.id() ].setAttribute('open','true');
111 'list_init' : function( params ) {
114 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
117 JSAN.use('circ.util');
120 'id' : 'tree_location', 'label' : 'Location/Barcode', 'flex' : 1,
121 'primary' : true, 'hidden' : false,
122 'render' : 'my.acp ? my.acp.barcode() : my.acn ? my.acn.label() : my.aou ? my.aou.name() : "???"'
125 'id' : 'volume_count', 'label' : 'Volumes', 'flex' : 0,
126 'primary' : false, 'hidden' : false,
127 'render' : 'my.volume_count'
130 'id' : 'copy_count', 'label' : 'Copies', 'flex' : 0,
131 'primary' : false, 'hidden' : false,
132 'render' : 'my.copy_count'
137 'location' : { 'hidden' : false },
138 'circ_lib' : { 'hidden' : false },
139 'owning_lib' : { 'hidden' : false },
140 'call_number' : { 'hidden' : false },
145 JSAN.use('util.list'); obj.list = new util.list('copy_tree');
149 'map_row_to_column' : circ.util.std_map_row_to_column(' '),
150 'retrieve_row' : function(params) {
152 var row = params.row;
156 if (!row.my.mvr) funcs.push(
159 row.my.mvr = obj.network.request(
160 api.MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.app,
161 api.MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.method,
162 [ row.my.circ.target_copy() ]
171 row.my.acp = obj.network.request(
172 api.FM_ACP_RETRIEVE.app,
173 api.FM_ACP_RETRIEVE.method,
174 [ row.my.circ.target_copy() ]
177 params.row_node.setAttribute( 'retrieve_id',row.my.acp.barcode() );
182 params.row_node.setAttribute( 'retrieve_id',row.my.acp.barcode() );
188 if (typeof params.on_retrieve == 'function') {
189 params.on_retrieve(row);
195 JSAN.use('util.exec'); var exec = new util.exec();
196 exec.on_error = function(E) {
197 //var err = 'items chain: ' + js2JSON(E);
198 //obj.error.sdump('D_ERROR',err);
199 return true; /* keep going */
205 'on_select' : function(ev) {
206 JSAN.use('util.functional');
207 var sel = obj.list.retrieve_selection();
208 var list = util.functional.map_list(
210 function(o) { return o.getAttribute('retrieve_id'); }
212 if (typeof obj.on_select == 'function') {
215 if (typeof window.xulG == 'object' && typeof window.xulG.on_select == 'function') {
216 window.xulG.on_select(list);
224 this.error.sdump('D_ERROR','cat.copy_browser.list_init: ' + E + '\n');
229 dump('exiting cat.copy_browser.js\n');