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