]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/cat/copy_browser.js
COPY_REMOTE_CIRC_LIB override for volume transfer
[Evergreen.git] / Open-ILS / xul / staff_client / server / cat / copy_browser.js
1 dump('entering cat.copy_browser.js\n');
2
3 if (typeof cat == 'undefined') cat = {};
4 cat.copy_browser = function (params) {
5         try {
6                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
7                 JSAN.use('util.error'); this.error = new util.error();
8         } catch(E) {
9                 dump('cat.copy_browser: ' + E + '\n');
10         }
11 }
12
13 cat.copy_browser.prototype = {
14
15         'map_tree' : {},
16         'map_acn' : {},
17         'map_acp' : {},
18         'sel_list' : [],
19
20         'init' : function( params ) {
21
22                 try {
23                         netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
24                         var obj = this;
25
26                         obj.docid = params.docid;
27
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'});
30                         JSAN.use('util.controller'); obj.controller = new util.controller();
31                         obj.controller.init(
32                                 {
33                                         control_map : {
34                                                 'cmd_broken' : [
35                                                         ['command'],
36                                                         function() { alert('Not Yet Implemented'); }
37                                                 ],
38                                                 'cmd_show_my_libs' : [
39                                                         ['command'],
40                                                         function() { 
41                                                                 obj.show_my_libs(); 
42                                                         }
43                                                 ],
44                                                 'cmd_show_all_libs' : [
45                                                         ['command'],
46                                                         function() {
47                                                                 obj.show_all_libs();
48                                                         }
49                                                 ],
50                                                 'cmd_show_libs_with_copies' : [
51                                                         ['command'],
52                                                         function() {
53                                                                 obj.show_libs_with_copies();
54                                                         }
55                                                 ],
56                                                 'cmd_clear' : [
57                                                         ['command'],
58                                                         function() {
59                                                                 obj.map_tree = {};
60                                                                 obj.list.clear();
61                                                         }
62                                                 ],
63                                                 'cmd_add_items' : [
64                                                         ['command'],
65                                                         function() {
66                                                                 try {
67                                                                         JSAN.use('util.functional');
68                                                                         var list = util.functional.map_list(
69                                                                                 util.functional.filter_list(
70                                                                                         obj.sel_list,
71                                                                                         function (o) {
72                                                                                                 return o.split(/_/)[0] == 'acn';
73                                                                                         }
74                                                                                 ),
75                                                                                 function (o) {
76                                                                                         return o.split(/_/)[1];
77                                                                                 }
78                                                                         );
79                                                                         if (list.length == 0) return;
80
81                                                                         var copy_shortcut = {};
82                                                                         list = util.functional.map_list(
83                                                                                 list,
84                                                                                 function (o) {
85                                                                                         var ou_id = obj.map_acn['acn_' + o].owning_lib();
86                                                                                         var volume_id = o;
87                                                                                         var label = obj.map_acn['acn_' + o].label();
88                                                                                         if (!copy_shortcut[ou_id]) copy_shortcut[ou_id] = {};
89                                                                                         copy_shortcut[ou_id][ label ] = volume_id;
90
91                                                                                         return ou_id;
92                                                                                 }
93                                                                         );
94                                                                         /* quick fix */  /* what was this fixing? */
95                                                                         list = []; for (var i in copy_shortcut) { list.push( i ); }
96
97                                                                         var edit = 0;
98                                                                         try {
99                                                                                 edit = obj.network.request(
100                                                                                         api.PERM_MULTI_ORG_CHECK.app,
101                                                                                         api.PERM_MULTI_ORG_CHECK.method,
102                                                                                         [ 
103                                                                                                 ses(), 
104                                                                                                 obj.data.list.au[0].id(), 
105                                                                                                 list,
106                                                                                                 [ 'CREATE_COPY' ]
107                                                                                         ]
108                                                                                 ).length == 0 ? 1 : 0;
109                                                                         } catch(E) {
110                                                                                 obj.error.sdump('D_ERROR','batch permission check: ' + E);
111                                                                         }
112
113                                                                         if (edit==0) return; // no read-only view for this interface
114
115                                                                         var title = 'Add Item';
116
117                                                                         JSAN.use('util.window'); var win = new util.window();
118                                                                         var w = win.open(
119                                                                                 window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR)
120                                                                                         +'?doc_id=' + window.escape(obj.docid)
121                                                                                         +'&ou_ids=' + window.escape( js2JSON(list) )
122                                                                                         +'&copy_shortcut=' + window.escape( js2JSON(copy_shortcut) ),
123                                                                                 title,
124                                                                                 'chrome,modal,resizable'
125                                                                         );
126                                                                         obj.refresh_list();
127                                                                 } catch(E) {
128                                                                         obj.error.standard_unexpected_error_alert('copy browser -> add copies',E);
129                                                                 }
130                                                         }
131                                                 ],
132                                                 'cmd_add_items_to_buckets' : [
133                                                         ['command'],
134                                                         function() {
135                                                                 try {
136                                                                         JSAN.use('util.functional');
137
138                                                                         var list = util.functional.filter_list(
139                                                                                 obj.sel_list,
140                                                                                 function (o) {
141                                                                                         return o.split(/_/)[0] == 'acp';
142                                                                                 }
143                                                                         );
144
145                                                                         list = util.functional.map_list(
146                                                                                 list,
147                                                                                 function (o) {
148                                                                                         return o.split(/_/)[1];
149                                                                                 }
150                                                                         );
151                                                                 
152                                                                         JSAN.use('cat.util');
153                                                                         cat.util.add_copies_to_bucket( list );
154
155                                                                 } catch(E) {
156                                                                         obj.error.standard_unexpected_error_alert('copy browser -> add copies to bucket',E);
157                                                                 }
158                                                         }
159                                                 ],
160                                                 'cmd_edit_items' : [
161                                                         ['command'],
162                                                         function() {
163                                                                 try {
164                                                                         JSAN.use('util.functional');
165
166                                                                         var list = util.functional.filter_list(
167                                                                                 obj.sel_list,
168                                                                                 function (o) {
169                                                                                         return o.split(/_/)[0] == 'acp';
170                                                                                 }
171                                                                         );
172
173                                                                         list = util.functional.map_list(
174                                                                                 list,
175                                                                                 function (o) {
176                                                                                         return o.split(/_/)[1];
177                                                                                 }
178                                                                         );
179
180                                                                         var edit = 0;
181                                                                         try {
182                                                                                 edit = obj.network.request(
183                                                                                         api.PERM_MULTI_ORG_CHECK.app,
184                                                                                         api.PERM_MULTI_ORG_CHECK.method,
185                                                                                         [ 
186                                                                                                 ses(), 
187                                                                                                 obj.data.list.au[0].id(), 
188                                                                                                 util.functional.map_list(
189                                                                                                         list,
190                                                                                                         function (o) {
191                                                                                                                 return obj.map_acn[ 'acn_' + obj.map_acp[ 'acp_' + o ].call_number() ].owning_lib();
192                                                                                                         }
193                                                                                                 ),
194                                                                                                 [ 'UPDATE_COPY', 'UPDATE_BATCH_COPY' ]
195                                                                                         ]
196                                                                                 ).length == 0 ? 1 : 0;
197                                                                         } catch(E) {
198                                                                                 obj.error.sdump('D_ERROR','batch permission check: ' + E);
199                                                                         }
200
201                                                                         JSAN.use('cat.util'); cat.util.spawn_copy_editor(list,edit);
202
203                                                                 } catch(E) {
204                                                                         obj.error.standard_unexpected_error_alert('Copy Browser -> Edit Items',E);
205                                                                 }
206                                                         }
207                                                 ],
208                                                 'cmd_delete_items' : [
209                                                         ['command'],
210                                                         function() {
211                                                                 try {
212                                                                         JSAN.use('util.functional');
213
214                                                                         var list = util.functional.filter_list(
215                                                                                 obj.sel_list,
216                                                                                 function (o) {
217                                                                                         return o.split(/_/)[0] == 'acp';
218                                                                                 }
219                                                                         );
220
221                                                                         list = util.functional.map_list(
222                                                                                 list,
223                                                                                 function (o) {
224                                                                                         return JSON2js( js2JSON( obj.map_acp[ 'acp_' + o.split(/_/)[1] ] ) );
225                                                                                 }
226                                                                         );
227
228                                                                         var r = obj.error.yns_alert('Are you sure you would like to delete ' + (list.length != 1 ? 'these ' + list.length + ' items' : 'this one item') + '?', 'Delete Items?', 'Delete', 'Cancel', null, 'Check here to confirm this action');
229
230                                                                         if (r == 0) {
231                                                                                 var acn_hash = {}; var acn_list = [];
232                                                                                 for (var i = 0; i < list.length; i++) {
233                                                                                         list[i].isdeleted('1');
234                                                                                         var acn_id = list[i].call_number();
235                                                                                         if ( ! acn_hash[ acn_id ] ) {
236                                                                                                 acn_hash[ acn_id ] = obj.map_acn[ 'acn_' + acn_id ];
237                                                                                                 acn_hash[ acn_id ].copies( [] );
238                                                                                         }
239                                                                                         var temp = acn_hash[ acn_id ].copies();
240                                                                                         temp.push( list[i] );
241                                                                                         acn_hash[ acn_id ].copies( temp );
242                                                                                 }
243                                                                                 for (var i in acn_hash) acn_list.push( acn_hash[i] );
244                                                                                 var robj = obj.network.simple_request(
245                                                                                         'FM_ACN_TREE_UPDATE', 
246                                                                                         [ ses(), acn_list, true ],
247                                                                                         null,
248                                                                                         {
249                                                                                                 'title' : 'Override Delete Failure?',
250                                                                                                 'overridable_events' : [
251                                                                                                         1208 /* TITLE_LAST_COPY */
252                                                                                                 ]
253                                                                                         }
254                                                                                 );
255                                                                                 if (robj == null) throw(robj);
256                                                                                 if (typeof robj.ilsevent != 'undefined') {
257                                                                                         if ( (robj.ilsevent != 0) && (robj.ilsevent != 1208 /* TITLE_LAST_COPY */) ) throw(robj);
258                                                                                 }
259                                                                                 obj.refresh_list();
260                                                                         }
261
262                                                                         
263                                                                 } catch(E) {
264                                                                         obj.error.standard_unexpected_error_alert('copy browser -> delete items',E);
265                                                                         obj.refresh_list();
266                                                                 }
267                                                         }
268                                                 ],
269                                                 'cmd_print_spine_labels' : [
270                                                         ['command'],
271                                                         function() {
272                                                                 try {
273                                                                         JSAN.use('util.functional');
274                                                                         
275                                                                         var list = util.functional.filter_list(
276                                                                                 obj.sel_list,
277                                                                                 function (o) {
278                                                                                         return o.split(/_/)[0] == 'acp';
279                                                                                 }
280                                                                         );
281
282                                                                         list = util.functional.map_list(
283                                                                                 list,
284                                                                                 function (o) {
285                                                                                         return obj.map_acp[ o ];
286                                                                                 }
287                                                                         );
288
289                                                                         xulG.new_tab(
290                                                                                 xulG.url_prefix( urls.XUL_SPINE_LABEL ) + '?barcodes=' 
291                                                                                 + js2JSON( 
292                                                                                         util.functional.map_list(
293                                                                                                 list,
294                                                                                                 function(o){return o.barcode();}
295                                                                                         ) 
296                                                                                 ),
297                                                                                 { 'tab_name' : 'Spine Labels' },
298                                                                                 {}
299                                                                         );
300                                                                 } catch(E) {
301                                                                         obj.error.standard_unexpected_error_alert('copy browser -> Spine Labels',E);
302                                                                 }
303                                                         }
304                                                 ],
305                                                 'cmd_add_volumes' : [
306                                                         ['command'],
307                                                         function() {
308                                                                 try {
309                                                                         JSAN.use('util.functional');
310                                                                         var list = util.functional.filter_list(
311                                                                                 obj.sel_list,
312                                                                                 function (o) {
313                                                                                         return o.split(/_/)[0] == 'aou';
314                                                                                 }
315                                                                         );
316                                                                         list = util.functional.map_list(
317                                                                                 list,
318                                                                                 function (o) {
319                                                                                         return o.split(/_/)[1];
320                                                                                 }
321                                                                         );              
322                                                                         var edit = 0;
323                                                                         try {
324                                                                                 edit = obj.network.request(
325                                                                                         api.PERM_MULTI_ORG_CHECK.app,
326                                                                                         api.PERM_MULTI_ORG_CHECK.method,
327                                                                                         [ 
328                                                                                                 ses(), 
329                                                                                                 obj.data.list.au[0].id(), 
330                                                                                                 list,
331                                                                                                 [ 'CREATE_VOLUME', 'CREATE_COPY' ]
332                                                                                         ]
333                                                                                 ).length == 0 ? 1 : 0;
334                                                                         } catch(E) {
335                                                                                 obj.error.sdump('D_ERROR','batch permission check: ' + E);
336                                                                         }
337
338                                                                         if (edit==0) {
339                                                                                 alert("You don't have permission to add volumes to that library.");
340                                                                                 return; // no read-only view for this interface
341                                                                         }
342
343                                                                         var title = 'Add Volume/Item';
344
345                                                                         JSAN.use('util.window'); var win = new util.window();
346                                                                         var w = win.open(
347                                                                                 window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR)
348                                                                                         +'?doc_id=' + window.escape(obj.docid)
349                                                                                         +'&ou_ids=' + window.escape( js2JSON(list) ),
350                                                                                 title,
351                                                                                 'chrome,modal,resizable'
352                                                                         );
353
354                                                                         obj.refresh_list();
355                                                                 } catch(E) {
356                                                                         obj.error.standard_unexpected_error_alert('copy browser -> add volumes',E);
357                                                                 }
358                                                         }
359                                                 ],
360                                                 'cmd_edit_volumes' : [
361                                                         ['command'],
362                                                         function() {
363                                                                 try {
364                                                                         JSAN.use('util.functional');
365                                                                         var list = util.functional.map_list(
366                                                                                 util.functional.filter_list(
367                                                                                         obj.sel_list,
368                                                                                         function (o) {
369                                                                                                 return o.split(/_/)[0] == 'acn';
370                                                                                         }
371                                                                                 ),
372                                                                                 function (o) {
373                                                                                         return o.split(/_/)[1];
374                                                                                 }
375                                                                         );
376                                                                         if (list.length == 0) return;
377
378                                                                         var edit = 0;
379                                                                         try {
380                                                                                 edit = obj.network.request(
381                                                                                         api.PERM_MULTI_ORG_CHECK.app,
382                                                                                         api.PERM_MULTI_ORG_CHECK.method,
383                                                                                         [ 
384                                                                                                 ses(), 
385                                                                                                 obj.data.list.au[0].id(), 
386                                                                                                 util.functional.map_list(
387                                                                                                         list,
388                                                                                                         function (o) {
389                                                                                                                 return obj.map_acn[ 'acn_' + o ].owning_lib();
390                                                                                                         }
391                                                                                                 ),
392                                                                                                 [ 'UPDATE_VOLUME' ]
393                                                                                         ]
394                                                                                 ).length == 0 ? 1 : 0;
395                                                                         } catch(E) {
396                                                                                 obj.error.sdump('D_ERROR','batch permission check: ' + E);
397                                                                         }
398
399                                                                         if (edit==0) {
400                                                                                 alert("You don't have permission to edit this volume.");
401                                                                                 return; // no read-only view for this interface
402                                                                         }
403
404                                                                         list = util.functional.map_list(
405                                                                                 list,
406                                                                                 function (o) {
407                                                                                         var my_acn = obj.map_acn['acn_' + o];
408                                                                                         return function(r){return r;}(my_acn);
409                                                                                 }
410                                                                         );
411
412                                                                         var title = list.length == 1 ? 'Volume' : 'Volumes';
413
414                                                                         JSAN.use('util.window'); var win = new util.window();
415                                                                         obj.data.volumes_temp = js2JSON( list );
416                                                                         obj.data.stash('volumes_temp');
417                                                                         var w = win.open(
418                                                                                 window.xulG.url_prefix(urls.XUL_VOLUME_EDITOR),
419                                                                                 title,
420                                                                                 'chrome,modal,resizable'
421                                                                         );
422
423                                                                         /* FIXME -- need to unique the temp space, and not rely on modalness of window */
424                                                                         obj.data.stash_retrieve();
425                                                                         var volumes = JSON2js( obj.data.volumes_temp );
426                                                                         obj.error.sdump('D_CAT','in browse, obj.data.temp =\n' + obj.data.temp);
427                                                                         if (volumes=='') return;
428                                                                 
429                                                                         volumes = util.functional.filter_list(
430                                                                                 volumes,
431                                                                                 function (o) {
432                                                                                         return o.ischanged() == '1';
433                                                                                 }
434                                                                         );
435
436                                                                         volumes = util.functional.map_list(
437                                                                                 volumes,
438                                                                                 function (o) {
439                                                                                         o.record( obj.docid ); // staff client 2 did not do this.  Does it matter?
440                                                                                         return o;
441                                                                                 }
442                                                                         );
443
444                                                                         if (volumes.length == 0) return;
445
446                                                                         try {
447                                                                                 var r = obj.network.request(
448                                                                                         api.FM_ACN_TREE_UPDATE.app,
449                                                                                         api.FM_ACN_TREE_UPDATE.method,
450                                                                                         [ ses(), volumes, true ]
451                                                                                 );
452                                                                                 if (typeof r.ilsevent != 'undefined') throw(r);
453                                                                         } catch(E) {
454                                                                                 obj.error.standard_unexpected_error_alert('volume update error: ',E);
455                                                                         }
456                                                                         obj.refresh_list();
457
458                                                                 } catch(E) {
459                                                                         obj.error.standard_unexpected_error_alert('Copy Browser -> Volume Edit',E);
460                                                                 }
461                                                         }
462                                                 ],
463                                                 'cmd_delete_volumes' : [
464                                                         ['command'],
465                                                         function() {
466                                                                 try {
467                                                                         JSAN.use('util.functional');
468
469                                                                         var list = util.functional.filter_list(
470                                                                                 obj.sel_list,
471                                                                                 function (o) {
472                                                                                         return o.split(/_/)[0] == 'acn';
473                                                                                 }
474                                                                         );
475
476                                                                         list = util.functional.map_list(
477                                                                                 list,
478                                                                                 function (o) {
479                                                                                         return JSON2js( js2JSON( obj.map_acn[ 'acn_' + o.split(/_/)[1] ] ) );
480                                                                                 }
481                                                                         );
482
483                                                                         var r = obj.error.yns_alert('Are you sure you would like to delete ' + (list.length != 1 ? 'these ' + list.length + ' volumes' : 'this one volume') + '?', 'Delete Volumes?', 'Delete', 'Cancel', null, 'Check here to confirm this action');
484
485                                                                         if (r == 0) {
486                                                                                 for (var i = 0; i < list.length; i++) {
487                                                                                         list[i].isdeleted('1');
488                                                                                 }
489                                                                                 var robj = obj.network.simple_request(
490                                                                                         'FM_ACN_TREE_UPDATE', 
491                                                                                         [ ses(), list, true ],
492                                                                                         null,
493                                                                                         {
494                                                                                                 'title' : 'Override Delete Failure?',
495                                                                                                 'overridable_events' : [
496                                                                                                 ]
497                                                                                         }
498                                                                                 );
499                                                                                 if (robj == null) throw(robj);
500                                                                                 if (typeof robj.ilsevent != 'undefined') {
501                                                                                         if (robj.ilsevent == 1206 /* VOLUME_NOT_EMPTY */) {
502                                                                                                 alert('You must delete all the copies on the volume before you may delete the volume itself.');
503                                                                                                 return;
504                                                                                         }
505                                                                                         if (robj.ilsevent != 0) throw(robj);
506                                                                                 }
507                                                                                 obj.refresh_list();
508                                                                         }
509                                                                 } catch(E) {
510                                                                         obj.error.standard_unexpected_error_alert('copy browser -> delete volumes',E);
511                                                                         obj.refresh_list();
512                                                                 }
513
514                                                         }
515                                                 ],
516                                                 'cmd_mark_library' : [
517                                                         ['command'],
518                                                         function() {
519                                                                 try {
520                                                                         var list = util.functional.filter_list(
521                                                                                 obj.sel_list,
522                                                                                 function (o) {
523                                                                                         return o.split(/_/)[0] == 'aou';
524                                                                                 }
525                                                                         );
526
527                                                                         list = util.functional.map_list(
528                                                                                 list,
529                                                                                 function (o) {
530                                                                                         return o.split(/_/)[1];
531                                                                                 }
532                                                                         );
533
534                                                                         if (list.length == 1) {
535                                                                                 obj.data.marked_library = { 'lib' : list[0], 'docid' : obj.docid };
536                                                                                 obj.data.stash('marked_library');
537                                                                                 alert('Library + Record marked as Volume Transfer Destination');
538                                                                         } else {
539                                                                                 obj.error.yns_alert('Choose just one Library to mark as Volume Transfer Destination','Limit Selection','OK',null,null,'Check here to confirm this dialog');
540                                                                         }
541                                                                 } catch(E) {
542                                                                         obj.error.standard_unexpected_error_alert('copy browser -> mark library',E);
543                                                                 }
544                                                         }
545                                                 ],
546
547                                                 'cmd_mark_volume' : [
548                                                         ['command'],
549                                                         function() {
550                                                                 try {
551                                                                         var list = util.functional.filter_list(
552                                                                                 obj.sel_list,
553                                                                                 function (o) {
554                                                                                         return o.split(/_/)[0] == 'acn';
555                                                                                 }
556                                                                         );
557
558                                                                         list = util.functional.map_list(
559                                                                                 list,
560                                                                                 function (o) {
561                                                                                         return o.split(/_/)[1];
562                                                                                 }
563                                                                         );
564
565                                                                         if (list.length == 1) {
566                                                                                 obj.data.marked_volume = list[0];
567                                                                                 obj.data.stash('marked_volume');
568                                                                                 alert('Volume marked as Item Transfer Destination');
569                                                                         } else {
570                                                                                 obj.error.yns_alert('Choose just one Volume to mark as Item Transfer Destination','Limit Selection','OK',null,null,'Check here to confirm this dialog');
571                                                                         }
572                                                                 } catch(E) {
573                                                                         obj.error.standard_unexpected_error_alert('copy browser -> mark volume',E);
574                                                                 }
575                                                         }
576                                                 ],
577                                                 'cmd_refresh_list' : [
578                                                         ['command'],
579                                                         function() {
580                                                                 obj.refresh_list();
581                                                         }
582                                                 ],
583                                                 'cmd_transfer_volume' : [
584                                                         ['command'],
585                                                         function() {
586                                                                 try {
587                                                                         obj.data.stash_retrieve();
588                                                                         if (!obj.data.marked_library) {
589                                                                                 alert('Please mark a library as the destination from within holdings maintenance and then try this again.');
590                                                                                 return;
591                                                                         }
592                                                                         
593                                                                         JSAN.use('util.functional');
594
595                                                                         var list = util.functional.filter_list(
596                                                                                 obj.sel_list,
597                                                                                 function (o) {
598                                                                                         return o.split(/_/)[0] == 'acn';
599                                                                                 }
600                                                                         );
601
602                                                                         list = util.functional.map_list(
603                                                                                 list,
604                                                                                 function (o) {
605                                                                                         return o.split(/_/)[1];
606                                                                                 }
607                                                                         );
608
609                                                                         netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
610                                                                         var xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: auto">';
611                                                                         xml += '<description>Transfer volumes ';
612
613                                                                         xml += util.functional.map_list(
614                                                                                 list,
615                                                                                 function (o) {
616                                                                                         return obj.map_acn[ 'acn_' + o ].label();
617                                                                                 }
618                                                                         ).join(", ");
619
620                                                                         xml += ' to library ' + obj.data.hash.aou[ obj.data.marked_library.lib ].shortname();
621                                                                         xml += ' on the following record?</description>';
622                                                                         xml += '<hbox><button label="Transfer" name="fancy_submit"/>';
623                                                                         xml += '<button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
624                                                                         xml += '<iframe style="overflow: scroll" flex="1" src="' + urls.XUL_BIB_BRIEF + '?docid=' + obj.data.marked_library.docid + '"/>';
625                                                                         xml += '</vbox>';
626                                                                         obj.data.temp_transfer = xml; obj.data.stash('temp_transfer');
627                                                                         window.open(
628                                                                                 urls.XUL_FANCY_PROMPT
629                                                                                 + '?xml_in_stash=temp_transfer'
630                                                                                 + '&title=' + window.escape('Volume Transfer'),
631                                                                                 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300'
632                                                                         );
633                                                                         JSAN.use('OpenILS.data');
634                                                                         var data = new OpenILS.data(); data.init({'via':'stash'});
635                                                                         if (data.fancy_prompt_data == '') { alert('Transfer Aborted'); return; }
636
637                                                                         var robj = obj.network.simple_request(
638                                                                                 'FM_ACN_TRANSFER', 
639                                                                                 [ ses(), { 'docid' : obj.data.marked_library.docid, 'lib' : obj.data.marked_library.lib, 'volumes' : list } ],
640                                                                                 null,
641                                                                                 {
642                                                                                         'title' : 'Override Volume Transfer Failure?',
643                                                                                         'overridable_events' : [
644                                                                                                 1219 /* COPY_REMOTE_CIRC_LIB */,
645                                                                                         ],
646                                                                                 }
647                                                                         );
648
649                                                                         if (typeof robj.ilsevent != 'undefined') {
650                                                                                 throw(robj);
651                                                                         } else {
652                                                                                 alert('Volumes transferred.');
653                                                                         }
654
655                                                                 } catch(E) {
656                                                                         obj.error.standard_unexpected_error_alert('All volumes not likely transferred.',E);
657                                                                 }
658                                                                 obj.refresh_list();
659                                                         }
660                                                 ],
661
662                                                 'cmd_transfer_items' : [
663                                                         ['command'],
664                                                         function() {
665                                                                 try {
666                                                                         obj.data.stash_retrieve();
667                                                                         if (!obj.data.marked_volume) {
668                                                                                 alert('Please mark a volume as the destination from within holdings maintenance and then try this again.');
669                                                                                 return;
670                                                                         }
671                                                                         
672                                                                         JSAN.use('util.functional');
673
674                                                                         var list = util.functional.filter_list(
675                                                                                 obj.sel_list,
676                                                                                 function (o) {
677                                                                                         return o.split(/_/)[0] == 'acp';
678                                                                                 }
679                                                                         );
680
681                                                                         list = util.functional.map_list(
682                                                                                 list,
683                                                                                 function (o) {
684                                                                                         return o.split(/_/)[1];
685                                                                                 }
686                                                                         );
687
688                                                                         var volume = obj.network.simple_request('FM_ACN_RETRIEVE',[ obj.data.marked_volume ]);
689
690                                                                         JSAN.use('cat.util'); cat.util.transfer_copies( { 
691                                                                                 'copy_ids' : list, 
692                                                                                 'docid' : volume.record(),
693                                                                                 'volume_label' : volume.label(),
694                                                                                 'owning_lib' : volume.owning_lib(),
695                                                                         } );
696
697                                                                 } catch(E) {
698                                                                         obj.error.standard_unexpected_error_alert('All copies not likely transferred.',E);
699                                                                 }
700                                                                 obj.refresh_list();
701                                                         }
702                                                 ],
703                                         }
704                                 }
705                         );
706
707                         obj.list_init(params);
708
709                         obj.org_ids = obj.network.simple_request('FM_AOU_IDS_RETRIEVE_VIA_RECORD_ID',[ obj.docid ]);
710
711                         var org = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
712                         obj.show_libs( org );
713
714                         obj.show_my_libs();
715
716                 } catch(E) {
717                         this.error.sdump('D_ERROR','cat.copy_browser.init: ' + E + '\n');
718                 }
719         },
720
721         'show_my_libs' : function() {
722                 var obj = this;
723                 try {
724                         var org = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
725                         obj.show_libs( org, true );
726                 
727                         var p_org = obj.data.hash.aou[ org.parent_ou() ];
728                         if (p_org) {
729                                 JSAN.use('util.exec'); var exec = new util.exec();
730                                 var funcs = [];
731                                 for (var i = 0; i < p_org.children().length; i++) {
732                                         funcs.push(
733                                                 function(o) {
734                                                         return function() {
735                                                                 obj.show_libs( o, true );
736                                                         }
737                                                 }( p_org.children()[i] )
738                                         );
739                                 }
740                                 exec.chain( funcs );
741                         }
742                 } catch(E) {
743                         alert(E);
744                 }
745         },
746
747         'show_all_libs' : function() {
748                 var obj = this;
749                 try {
750                         obj.show_my_libs();
751
752                         obj.show_libs( obj.data.tree.aou );
753
754                         JSAN.use('util.exec'); var exec = new util.exec();
755                         var funcs = [];
756                         for (var i = 0; i < obj.data.tree.aou.children().length; i++) {
757                                 funcs.push(
758                                         function(o) {
759                                                 return function() {
760                                                         obj.show_libs( o );
761                                                 }
762                                         }( obj.data.tree.aou.children()[i] )
763                                 );
764                         }
765                         exec.chain( funcs );
766                 } catch(E) {
767                         alert(E);
768                 }
769         },
770
771         'show_libs_with_copies' : function() {
772                 var obj = this;
773                 try {
774                         JSAN.use('util.exec'); var exec = new util.exec();
775                         JSAN.use('util.functional');
776
777                         var orgs = util.functional.map_list(
778                                 obj.org_ids,
779                                 function(id) { return obj.data.hash.aou[id]; }
780                         ).sort(
781                                 function( a, b ) {
782                                         if (a.shortname() < b.shortname()) return -1;
783                                         if (a.shortname() > b.shortname()) return 1;
784                                         return 0;
785                                 }
786                         );
787                         var funcs = [];
788                         for (var i = 0; i < orgs.length; i++) {
789                                 funcs.push(
790                                         function(o) {
791                                                 return function() {
792                                                         obj.show_libs(o,true);
793                                                 }
794                                         }( orgs[i] )
795                                 );
796                         }
797                         exec.chain( funcs );
798                 } catch(E) {
799                         alert(E);
800                 }
801         },
802
803         'show_libs' : function(start_aou,show_open) {
804                 var obj = this;
805                 try {
806                         if (!start_aou) throw('show_libs: Need a start_aou');
807                         JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
808                         JSAN.use('util.functional'); JSAN.use('util.exec'); var exec = new util.exec();
809
810                         var funcs = [];
811
812                         var parents = [];
813                         var temp_aou = start_aou;
814                         while ( temp_aou.parent_ou() ) {
815                                 temp_aou = obj.data.hash.aou[ temp_aou.parent_ou() ];
816                                 parents.push( temp_aou );
817                         }
818                         parents.reverse();
819
820                         for (var i = 0; i < parents.length; i++) {
821                                 funcs.push(
822                                         function(o,p) {
823                                                 return function() { 
824                                                         if (show_open) {
825                                                                 obj.append_org(o,p,{'container':'true','open':'true'}); 
826                                                         } else {
827                                                                 obj.append_org(o,p,{'container':'true'}); 
828                                                         }
829                                                 };
830                                         }(parents[i], obj.data.hash.aou[ parents[i].parent_ou() ])
831                                 );
832                         }
833
834                         funcs.push(
835                                 function(o,p) {
836                                         return function() { obj.append_org(o,p); };
837                                 }(start_aou,obj.data.hash.aou[ start_aou.parent_ou() ])
838                         );
839
840                         funcs.push(
841                                 function() {
842                                         if (start_aou.children()) {
843                                                 var x = obj.map_tree[ 'aou_' + start_aou.id() ];
844                                                 x.setAttribute('container','true');
845                                                 if (show_open) x.setAttribute('open','true');
846                                                 for (var i = 0; i < start_aou.children().length; i++) {
847                                                         funcs.push(
848                                                                 function(o,p) {
849                                                                         return function() { obj.append_org(o,p); };
850                                                                 }( start_aou.children()[i], start_aou )
851                                                         );
852                                                 }
853                                         }
854                                 }
855                         );
856
857                         exec.chain( funcs );
858
859                 } catch(E) {
860                         alert(E);
861                 }
862         },
863
864         'on_select' : function(list,twisty) {
865                 var obj = this;
866                 for (var i = 0; i < list.length; i++) {
867                         var node = obj.map_tree[ list[i] ];
868                         //if (node.lastChild.nodeName == 'treechildren') { continue; } else { alert(node.lastChild.nodeName); }
869                         var row_type = list[i].split('_')[0];
870                         var id = list[i].split('_')[1];
871                         switch(row_type) {
872                                 case 'aou' : obj.on_select_org(id,twisty); break;
873                                 case 'acn' : obj.on_select_acn(id,twisty); break;
874                                 default: break;
875                         }
876                 }
877         },
878
879         'on_select_acn' : function(acn_id,twisty) {
880                 var obj = this;
881                 try {
882                         var acn_tree = obj.map_acp[ 'acn_' + acn_id ];
883                         var funcs = [];
884                         if (acn_tree.copies()) {
885                                 for (var i = 0; i < acn_tree.copies().length; i++) {
886                                         funcs.push(
887                                                 function(c,a) {
888                                                         return function() {
889                                                                 obj.append_acp(c,a);
890                                                         }
891                                                 }( acn_tree.copies()[i], acn_tree )
892                                         )
893                                 }
894                         }
895                         JSAN.use('util.exec'); var exec = new util.exec();
896                         exec.chain( funcs );
897                 } catch(E) {
898                         alert(E);
899                 }
900         },
901
902         'on_select_org' : function(org_id,twisty) {
903                 var obj = this;
904                 var org = obj.data.hash.aou[ org_id ];
905                 var funcs = [];
906                 if (org.children()) {
907                         for (var i = 0; i < org.children().length; i++) {
908                                 funcs.push(
909                                         function(o,p) {
910                                                 return function() {
911                                                         obj.append_org(o,p)
912                                                 }
913                                         }(org.children()[i],org)
914                                 );
915                         }
916                 } 
917                 if (obj.map_acn[ 'aou_' + org_id ]) {
918                         for (var i = 0; i < obj.map_acn[ 'aou_' + org_id ].length; i++) {
919                                 funcs.push(
920                                         function(o,a) {
921                                                 return function() {
922                                                         obj.append_acn(o,a);
923                                                 }
924                                         }( org, obj.map_acn[ 'aou_' + org_id ][i] )
925                                 );
926                         }
927                 }
928                 JSAN.use('util.exec'); var exec = new util.exec();
929                 exec.chain( funcs );
930         },
931
932         'append_org' : function (org,parent_org,params) {
933                 var obj = this;
934                 try {
935                         if (obj.map_tree[ 'aou_' + org.id() ]) {
936                                 var x = obj.map_tree[ 'aou_' + org.id() ];
937                                 if (params) {
938                                         for (var i in params) {
939                                                 x.setAttribute(i,params[i]);
940                                         }
941                                 }
942                                 return x;
943                         }
944
945                         var data = {
946                                 'row' : {
947                                         'my' : {
948                                                 'aou' : org,
949                                         }
950                                 },
951                                 'skip_all_columns_except' : [0,1,2],
952                                 'retrieve_id' : 'aou_' + org.id(),
953                         };
954                 
955                         var acn_tree_list;
956                         if ( obj.org_ids.indexOf( org.id() ) == -1 ) {
957                                 if ( obj.data.hash.aout[ org.ou_type() ].can_have_vols() ) {
958                                         data.row.my.volume_count = '0';
959                                         data.row.my.copy_count = '<0>';
960                                 } else {
961                                         data.row.my.volume_count = '';
962                                         data.row.my.copy_count = '';
963                                 }
964                         } else {
965                                 var v_count = 0; var c_count = 0;
966                                 acn_tree_list = obj.network.simple_request(
967                                         'FM_ACN_TREE_LIST_RETRIEVE_VIA_RECORD_ID_AND_ORG_IDS',
968                                         [ ses(), obj.docid, [ org.id() ] ]
969                                 );
970                                 for (var i = 0; i < acn_tree_list.length; i++) {
971                                         v_count++;
972                                         obj.map_acn[ 'acn_' + acn_tree_list[i].id() ] = function(r){return r;}(acn_tree_list[i]);
973                                         var copies = acn_tree_list[i].copies(); if (copies) c_count += copies.length;
974                                         for (var j = 0; j < copies.length; j++) {
975                                                 obj.map_acp[ 'acp_' + copies[j].id() ] = function(r){return r;}(copies[j]);
976                                         }
977                                 }
978                                 data.row.my.volume_count = v_count;
979                                 data.row.my.copy_count = '<' + c_count + '>';
980                         }
981                         if (parent_org) {
982                                 data.node = obj.map_tree[ 'aou_' + parent_org.id() ];
983                         }
984
985                         var node = obj.list.append(data);
986                         if (params) {
987                                 for (var i in params) {
988                                         node.setAttribute(i,params[i]);
989                                 }
990                         }
991                         obj.map_tree[ 'aou_' + org.id() ] = node;
992
993                         if (org.children()) {
994                                 node.setAttribute('container','true');
995                         }
996
997                         if (parent_org) {
998                                 if ( obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ].parent_ou() == parent_org.id() ) {
999                                         data.node.setAttribute('open','true');
1000                                 }
1001                         } else {
1002                                 obj.map_tree[ 'aou_' + org.id() ].setAttribute('open','true');
1003                         }
1004
1005                         if (acn_tree_list) {
1006                                 obj.map_acn[ 'aou_' + org.id() ] = acn_tree_list;
1007                                 node.setAttribute('container','true');
1008                         }
1009
1010                 } catch(E) {
1011                         dump(E+'\n');
1012                         alert(E);
1013                 }
1014         },
1015
1016         'append_acn' : function( org, acn_tree, params ) {
1017                 var obj = this;
1018                 try {
1019                         if (obj.map_tree[ 'acn_' + acn_tree.id() ]) {
1020                                 var x = obj.map_tree[ 'acn_' + acn_tree.id() ];
1021                                 if (params) {
1022                                         for (var i in params) {
1023                                                 x.setAttribute(i,params[i]);
1024                                         }
1025                                 }
1026                                 return x;
1027                         }
1028
1029                         var parent_node = obj.map_tree[ 'aou_' + org.id() ];
1030                         var data = {
1031                                 'row' : {
1032                                         'my' : {
1033                                                 'aou' : org,
1034                                                 'acn' : acn_tree,
1035                                                 'volume_count' : '',
1036                                                 'copy_count' : acn_tree.copies() ? acn_tree.copies().length : '0',
1037                                         }
1038                                 },
1039                                 'skip_all_columns_except' : [0,1,2],
1040                                 'retrieve_id' : 'acn_' + acn_tree.id(),
1041                                 'node' : parent_node,
1042                         };
1043                         var node = obj.list.append(data);
1044                         obj.map_tree[ 'acn_' + acn_tree.id() ] =  node;
1045                         if (params) {
1046                                 for (var i in params) {
1047                                         node.setAttribute(i,params[i]);
1048                                 }
1049                         }
1050                         if (acn_tree.copies()) {
1051                                 obj.map_acp[ 'acn_' + acn_tree.id() ] = acn_tree;
1052                                 node.setAttribute('container','true');
1053                         }
1054
1055                 } catch(E) {
1056                         dump(E+'\n');
1057                         alert(E);
1058                 }
1059         },
1060
1061         'append_acp' : function( acp_item, acn_tree, params ) {
1062                 var obj = this;
1063                 try {
1064                         if (obj.map_tree[ 'acp_' + acp_item.id() ]) {
1065                                 var x = obj.map_tree[ 'acp_' + acp_item.id() ];
1066                                 if (params) {
1067                                         for (var i in params) {
1068                                                 x.setAttribute(i,params[i]);
1069                                         }
1070                                 }
1071                                 return x;
1072                         }
1073
1074                         var parent_node = obj.map_tree[ 'acn_' + acn_tree.id() ];
1075                         var data = {
1076                                 'row' : {
1077                                         'my' : {
1078                                                 'aou' : obj.data.hash.aou[ acn_tree.owning_lib() ],
1079                                                 'acn' : acn_tree,
1080                                                 'acp' : acp_item,
1081                                                 'volume_count' : '',
1082                                                 'copy_count' : '',
1083                                         }
1084                                 },
1085                                 'retrieve_id' : 'acp_' + acp_item.id(),
1086                                 'node' : parent_node,
1087                         };
1088                         var node = obj.list.append(data);
1089                         obj.map_tree[ 'acp_' + acp_item.id() ] =  node;
1090                         if (params) {
1091                                 for (var i in params) {
1092                                         node.setAttribute(i,params[i]);
1093                                 }
1094                         }
1095
1096                 } catch(E) {
1097                         dump(E+'\n');
1098                         alert(E);
1099                 }
1100         },
1101
1102         'list_init' : function( params ) {
1103
1104                 try {
1105                         netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
1106                         var obj = this;
1107                         
1108                         JSAN.use('circ.util');
1109                         var columns = [
1110                                 {
1111                                         'id' : 'tree_location', 'label' : 'Location/Barcode', 'flex' : 1,
1112                                         'primary' : true, 'hidden' : false, 
1113                                         'render' : 'my.acp ? my.acp.barcode() : my.acn ? my.acn.label() : my.aou ? my.aou.shortname() + " : " + my.aou.name() : "???"'
1114                                 },
1115                                 {
1116                                         'id' : 'volume_count', 'label' : 'Volumes', 'flex' : 0,
1117                                         'primary' : false, 'hidden' : false, 
1118                                         'render' : 'my.volume_count'
1119                                 },
1120                                 {
1121                                         'id' : 'copy_count', 'label' : 'Copies', 'flex' : 0,
1122                                         'primary' : false, 'hidden' : false, 
1123                                         'render' : 'my.copy_count'
1124                                 },
1125                         ].concat(
1126                                 circ.util.columns( 
1127                                         { 
1128                                                 'location' : { 'hidden' : false },
1129                                                 'circ_lib' : { 'hidden' : false },
1130                                                 'owning_lib' : { 'hidden' : false },
1131                                                 'call_number' : { 'hidden' : false },
1132                                                 'status' : { 'hidden' : false },
1133                                         },
1134                                         {
1135                                                 'just_these' : [
1136                                                         'owning_lib',
1137                                                         'circ_lib',
1138                                                         'call_number',
1139                                                         'copy_number',
1140                                                         'location',
1141                                                         'barcode',
1142                                                         'loan_duration',
1143                                                         'fine_level',
1144                                                         'circulate',
1145                                                         'holdable',
1146                                                         'opac_visible',
1147                                                         'ref',
1148                                                         'deposit',
1149                                                         'deposit_amount',
1150                                                         'price',
1151                                                         'circ_as_type',
1152                                                         'circ_modifier',
1153                                                         'status',
1154                                                         'alert_message',
1155                                                         'acp_id',
1156                                                 ]
1157                                         }
1158                                 )
1159                         );
1160                         JSAN.use('util.list'); obj.list = new util.list('copy_tree');
1161                         obj.list.init(
1162                                 {
1163                                         'columns' : columns,
1164                                         'map_row_to_column' : circ.util.std_map_row_to_column(' '),
1165                                         'retrieve_row' : function(params) {
1166
1167                                                 var row = params.row;
1168
1169                                                 var funcs = [];
1170                                         /*      
1171                                                 if (!row.my.mvr) funcs.push(
1172                                                         function() {
1173
1174                                                                 row.my.mvr = obj.network.request(
1175                                                                         api.MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.app,
1176                                                                         api.MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.method,
1177                                                                         [ row.my.circ.target_copy() ]
1178                                                                 );
1179
1180                                                         }
1181                                                 );
1182                                                 if (!row.my.acp) {
1183                                                         funcs.push(     
1184                                                                 function() {
1185
1186                                                                         row.my.acp = obj.network.request(
1187                                                                                 api.FM_ACP_RETRIEVE.app,
1188                                                                                 api.FM_ACP_RETRIEVE.method,
1189                                                                                 [ row.my.circ.target_copy() ]
1190                                                                         );
1191
1192                                                                         params.row_node.setAttribute( 'retrieve_id',row.my.acp.barcode() );
1193
1194                                                                 }
1195                                                         );
1196                                                 } else {
1197                                                         params.row_node.setAttribute( 'retrieve_id',row.my.acp.barcode() );
1198                                                 }
1199                                         */
1200                                                 funcs.push(
1201                                                         function() {
1202
1203                                                                 if (typeof params.on_retrieve == 'function') {
1204                                                                         params.on_retrieve(row);
1205                                                                 }
1206
1207                                                         }
1208                                                 );
1209
1210                                                 JSAN.use('util.exec'); var exec = new util.exec();
1211                                                 exec.on_error = function(E) {
1212                                                         var err = 'items chain: ' + js2JSON(E);
1213                                                         obj.error.sdump('D_ERROR',err);
1214                                                         return true; /* keep going */
1215                                                 }
1216                                                 exec.chain( funcs );
1217
1218                                                 return row;
1219                                         },
1220                                         'on_click' : function(ev) {
1221                                                 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserRead');
1222                                                 var row = {}; var col = {}; var nobj = {};
1223                                                 obj.list.node.treeBoxObject.getCellAt(ev.clientX,ev.clientY,row,col,nobj);
1224                                                 if ((row.value == -1)||(nobj.value != 'twisty')) { return; }
1225                                                 var node = obj.list.node.contentView.getItemAtIndex(row.value);
1226                                                 var list = [ node.getAttribute('retrieve_id') ];
1227                                                 if (typeof obj.on_select == 'function') {
1228                                                         obj.on_select(list,true);
1229                                                 }
1230                                                 if (typeof window.xulG == 'object' && typeof window.xulG.on_select == 'function') {
1231                                                         window.xulG.on_select(list);
1232                                                 }
1233                                         },
1234                                         'on_select' : function(ev) {
1235                                                 JSAN.use('util.functional');
1236                                                 var sel = obj.list.retrieve_selection();
1237                                                 obj.sel_list = util.functional.map_list(
1238                                                         sel,
1239                                                         function(o) { return o.getAttribute('retrieve_id'); }
1240                                                 );
1241                                                 obj.toggle_actions();
1242                                                 if (typeof obj.on_select == 'function') {
1243                                                         obj.on_select(obj.sel_list);
1244                                                 }
1245                                                 if (typeof window.xulG == 'object' && typeof window.xulG.on_select == 'function') {
1246                                                         window.xulG.on_select(obj.sel_list);
1247                                                 }
1248                                         },
1249                                 }
1250                         );
1251
1252                         obj.controller.render();
1253
1254                 } catch(E) {
1255                         this.error.sdump('D_ERROR','cat.copy_browser.list_init: ' + E + '\n');
1256                         alert(E);
1257                 }
1258         },
1259
1260         'toggle_actions' : function() {
1261                 var obj = this;
1262                 try {
1263                         var found_aou = false; var found_acn = false; var found_acp = false;
1264                         for (var i = 0; i < obj.sel_list.length; i++) {
1265                                 var type = obj.sel_list[i].split(/_/)[0];
1266                                 switch(type) {
1267                                         case 'aou' : found_aou = true; break;
1268                                         case 'acn' : found_acn = true; break;
1269                                         case 'acp' : found_acp = true; break;
1270                                 }
1271                         }
1272                         obj.controller.view.cmd_add_items.setAttribute('disabled','true');
1273                         obj.controller.view.cmd_add_items_to_buckets.setAttribute('disabled','true');
1274                         obj.controller.view.cmd_edit_items.setAttribute('disabled','true');
1275                         obj.controller.view.cmd_delete_items.setAttribute('disabled','true');
1276                         obj.controller.view.cmd_print_spine_labels.setAttribute('disabled','true');
1277                         obj.controller.view.cmd_add_volumes.setAttribute('disabled','true');
1278                         obj.controller.view.cmd_mark_library.setAttribute('disabled','true');
1279                         obj.controller.view.cmd_edit_volumes.setAttribute('disabled','true');
1280                         obj.controller.view.cmd_delete_volumes.setAttribute('disabled','true');
1281                         obj.controller.view.cmd_mark_volume.setAttribute('disabled','true');
1282                         obj.controller.view.cmd_transfer_volume.setAttribute('disabled','true');
1283                         obj.controller.view.cmd_transfer_items.setAttribute('disabled','true');
1284                         if (found_aou) {
1285                                 obj.controller.view.cmd_add_volumes.setAttribute('disabled','false');
1286                                 obj.controller.view.cmd_mark_library.setAttribute('disabled','false');
1287                         }
1288                         if (found_acn) {
1289                                 obj.controller.view.cmd_edit_volumes.setAttribute('disabled','false');
1290                                 obj.controller.view.cmd_delete_volumes.setAttribute('disabled','false');
1291                                 obj.controller.view.cmd_mark_volume.setAttribute('disabled','false');
1292                                 obj.controller.view.cmd_add_items.setAttribute('disabled','false');
1293                                 obj.controller.view.cmd_transfer_volume.setAttribute('disabled','false');
1294                         }
1295                         if (found_acp) {
1296                                 obj.controller.view.cmd_add_items_to_buckets.setAttribute('disabled','false');
1297                                 obj.controller.view.cmd_edit_items.setAttribute('disabled','false');
1298                                 obj.controller.view.cmd_delete_items.setAttribute('disabled','false');
1299                                 obj.controller.view.cmd_print_spine_labels.setAttribute('disabled','false');
1300                                 obj.controller.view.cmd_transfer_items.setAttribute('disabled','false');
1301                         }
1302                 } catch(E) {
1303                         obj.error.standard_unexpected_error_alert('Copy Browser Actions',E);
1304                 }
1305         },
1306
1307         'refresh_list' : function() { 
1308                 try {
1309                         var obj = this;
1310                         obj.list.clear();
1311                         obj.map_tree = {};
1312                         obj.map_acn = {};
1313                         obj.map_acp = {};
1314                         obj.org_ids = obj.network.simple_request('FM_AOU_IDS_RETRIEVE_VIA_RECORD_ID',[ obj.docid ]);
1315                         var org = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
1316                         obj.show_libs( org );
1317                         obj.show_my_libs();
1318                 } catch(E) {
1319                         this.error.standard_unexpected_error_alert('Problem refreshing the volume/copy tree.',E);
1320                 }
1321         },
1322 }
1323
1324 dump('exiting cat.copy_browser.js\n');