]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/cat/copy_browser.js
clipboard
[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                                                                                                 1219 /* COPY_REMOTE_CIRC_LIB */,
649                                                                                         ],
650                                                                                 }
651                                                                         );
652
653                                                                         if (typeof robj.ilsevent != 'undefined') {
654                                                                                 throw(robj);
655                                                                         } else {
656                                                                                 alert('Volumes transferred.');
657                                                                         }
658
659                                                                 } catch(E) {
660                                                                         obj.error.standard_unexpected_error_alert('All volumes not likely transferred.',E);
661                                                                 }
662                                                                 obj.refresh_list();
663                                                         }
664                                                 ],
665
666                                                 'cmd_transfer_items' : [
667                                                         ['command'],
668                                                         function() {
669                                                                 try {
670                                                                         obj.data.stash_retrieve();
671                                                                         if (!obj.data.marked_volume) {
672                                                                                 alert('Please mark a volume as the destination from within holdings maintenance and then try this again.');
673                                                                                 return;
674                                                                         }
675                                                                         
676                                                                         JSAN.use('util.functional');
677
678                                                                         var list = util.functional.filter_list(
679                                                                                 obj.sel_list,
680                                                                                 function (o) {
681                                                                                         return o.split(/_/)[0] == 'acp';
682                                                                                 }
683                                                                         );
684
685                                                                         list = util.functional.map_list(
686                                                                                 list,
687                                                                                 function (o) {
688                                                                                         return o.split(/_/)[1];
689                                                                                 }
690                                                                         );
691
692                                                                         var volume = obj.network.simple_request('FM_ACN_RETRIEVE',[ obj.data.marked_volume ]);
693
694                                                                         JSAN.use('cat.util'); cat.util.transfer_copies( { 
695                                                                                 'copy_ids' : list, 
696                                                                                 'docid' : volume.record(),
697                                                                                 'volume_label' : volume.label(),
698                                                                                 'owning_lib' : volume.owning_lib(),
699                                                                         } );
700
701                                                                 } catch(E) {
702                                                                         obj.error.standard_unexpected_error_alert('All copies not likely transferred.',E);
703                                                                 }
704                                                                 obj.refresh_list();
705                                                         }
706                                                 ],
707                                         }
708                                 }
709                         );
710
711                         obj.list_init(params);
712
713                         obj.org_ids = obj.network.simple_request('FM_AOU_IDS_RETRIEVE_VIA_RECORD_ID',[ obj.docid ]);
714
715                         var org = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
716                         obj.show_libs( org );
717
718                         obj.show_my_libs();
719
720                 } catch(E) {
721                         this.error.sdump('D_ERROR','cat.copy_browser.init: ' + E + '\n');
722                 }
723         },
724
725         'show_my_libs' : function() {
726                 var obj = this;
727                 try {
728                         var org = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
729                         obj.show_libs( org, true );
730                 
731                         var p_org = obj.data.hash.aou[ org.parent_ou() ];
732                         if (p_org) {
733                                 JSAN.use('util.exec'); var exec = new util.exec();
734                                 var funcs = [];
735                                 for (var i = 0; i < p_org.children().length; i++) {
736                                         funcs.push(
737                                                 function(o) {
738                                                         return function() {
739                                                                 obj.show_libs( o, true );
740                                                         }
741                                                 }( p_org.children()[i] )
742                                         );
743                                 }
744                                 exec.chain( funcs );
745                         }
746                 } catch(E) {
747                         alert(E);
748                 }
749         },
750
751         'show_all_libs' : function() {
752                 var obj = this;
753                 try {
754                         obj.show_my_libs();
755
756                         obj.show_libs( obj.data.tree.aou );
757
758                         JSAN.use('util.exec'); var exec = new util.exec();
759                         var funcs = [];
760                         for (var i = 0; i < obj.data.tree.aou.children().length; i++) {
761                                 funcs.push(
762                                         function(o) {
763                                                 return function() {
764                                                         obj.show_libs( o );
765                                                 }
766                                         }( obj.data.tree.aou.children()[i] )
767                                 );
768                         }
769                         exec.chain( funcs );
770                 } catch(E) {
771                         alert(E);
772                 }
773         },
774
775         'show_libs_with_copies' : function() {
776                 var obj = this;
777                 try {
778                         JSAN.use('util.exec'); var exec = new util.exec();
779                         JSAN.use('util.functional');
780
781                         var orgs = util.functional.map_list(
782                                 obj.org_ids,
783                                 function(id) { return obj.data.hash.aou[id]; }
784                         ).sort(
785                                 function( a, b ) {
786                                         if (a.shortname() < b.shortname()) return -1;
787                                         if (a.shortname() > b.shortname()) return 1;
788                                         return 0;
789                                 }
790                         );
791                         var funcs = [];
792                         for (var i = 0; i < orgs.length; i++) {
793                                 funcs.push(
794                                         function(o) {
795                                                 return function() {
796                                                         obj.show_libs(o,true);
797                                                 }
798                                         }( orgs[i] )
799                                 );
800                         }
801                         exec.chain( funcs );
802                 } catch(E) {
803                         alert(E);
804                 }
805         },
806
807         'show_libs' : function(start_aou,show_open) {
808                 var obj = this;
809                 try {
810                         if (!start_aou) throw('show_libs: Need a start_aou');
811                         JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
812                         JSAN.use('util.functional'); JSAN.use('util.exec'); var exec = new util.exec();
813
814                         var funcs = [];
815
816                         var parents = [];
817                         var temp_aou = start_aou;
818                         while ( temp_aou.parent_ou() ) {
819                                 temp_aou = obj.data.hash.aou[ temp_aou.parent_ou() ];
820                                 parents.push( temp_aou );
821                         }
822                         parents.reverse();
823
824                         for (var i = 0; i < parents.length; i++) {
825                                 funcs.push(
826                                         function(o,p) {
827                                                 return function() { 
828                                                         if (show_open) {
829                                                                 obj.append_org(o,p,{'container':'true','open':'true'}); 
830                                                         } else {
831                                                                 obj.append_org(o,p,{'container':'true'}); 
832                                                         }
833                                                 };
834                                         }(parents[i], obj.data.hash.aou[ parents[i].parent_ou() ])
835                                 );
836                         }
837
838                         funcs.push(
839                                 function(o,p) {
840                                         return function() { obj.append_org(o,p); };
841                                 }(start_aou,obj.data.hash.aou[ start_aou.parent_ou() ])
842                         );
843
844                         funcs.push(
845                                 function() {
846                                         if (start_aou.children()) {
847                                                 var x = obj.map_tree[ 'aou_' + start_aou.id() ];
848                                                 x.setAttribute('container','true');
849                                                 if (show_open) x.setAttribute('open','true');
850                                                 for (var i = 0; i < start_aou.children().length; i++) {
851                                                         funcs.push(
852                                                                 function(o,p) {
853                                                                         return function() { obj.append_org(o,p); };
854                                                                 }( start_aou.children()[i], start_aou )
855                                                         );
856                                                 }
857                                         }
858                                 }
859                         );
860
861                         exec.chain( funcs );
862
863                 } catch(E) {
864                         alert(E);
865                 }
866         },
867
868         'on_select' : function(list,twisty) {
869                 var obj = this;
870                 for (var i = 0; i < list.length; i++) {
871                         var node = obj.map_tree[ list[i] ];
872                         //if (node.lastChild.nodeName == 'treechildren') { continue; } else { alert(node.lastChild.nodeName); }
873                         var row_type = list[i].split('_')[0];
874                         var id = list[i].split('_')[1];
875                         switch(row_type) {
876                                 case 'aou' : obj.on_select_org(id,twisty); break;
877                                 case 'acn' : obj.on_select_acn(id,twisty); break;
878                                 default: break;
879                         }
880                 }
881         },
882
883         'on_select_acn' : function(acn_id,twisty) {
884                 var obj = this;
885                 try {
886                         var acn_tree = obj.map_acp[ 'acn_' + acn_id ];
887                         var funcs = [];
888                         if (acn_tree.copies()) {
889                                 for (var i = 0; i < acn_tree.copies().length; i++) {
890                                         funcs.push(
891                                                 function(c,a) {
892                                                         return function() {
893                                                                 obj.append_acp(c,a);
894                                                         }
895                                                 }( acn_tree.copies()[i], acn_tree )
896                                         )
897                                 }
898                         }
899                         JSAN.use('util.exec'); var exec = new util.exec();
900                         exec.chain( funcs );
901                 } catch(E) {
902                         alert(E);
903                 }
904         },
905
906         'on_select_org' : function(org_id,twisty) {
907                 var obj = this;
908                 var org = obj.data.hash.aou[ org_id ];
909                 var funcs = [];
910                 if (org.children()) {
911                         for (var i = 0; i < org.children().length; i++) {
912                                 funcs.push(
913                                         function(o,p) {
914                                                 return function() {
915                                                         obj.append_org(o,p)
916                                                 }
917                                         }(org.children()[i],org)
918                                 );
919                         }
920                 } 
921                 if (obj.map_acn[ 'aou_' + org_id ]) {
922                         for (var i = 0; i < obj.map_acn[ 'aou_' + org_id ].length; i++) {
923                                 funcs.push(
924                                         function(o,a) {
925                                                 return function() {
926                                                         obj.append_acn(o,a);
927                                                 }
928                                         }( org, obj.map_acn[ 'aou_' + org_id ][i] )
929                                 );
930                         }
931                 }
932                 JSAN.use('util.exec'); var exec = new util.exec();
933                 exec.chain( funcs );
934         },
935
936         'append_org' : function (org,parent_org,params) {
937                 var obj = this;
938                 try {
939                         if (obj.map_tree[ 'aou_' + org.id() ]) {
940                                 var x = obj.map_tree[ 'aou_' + org.id() ];
941                                 if (params) {
942                                         for (var i in params) {
943                                                 x.setAttribute(i,params[i]);
944                                         }
945                                 }
946                                 return x;
947                         }
948
949                         var data = {
950                                 'row' : {
951                                         'my' : {
952                                                 'aou' : org,
953                                         }
954                                 },
955                                 'skip_all_columns_except' : [0,1,2],
956                                 'retrieve_id' : 'aou_' + org.id(),
957                         };
958                 
959                         var acn_tree_list;
960                         if ( obj.org_ids.indexOf( org.id() ) == -1 ) {
961                                 if ( obj.data.hash.aout[ org.ou_type() ].can_have_vols() ) {
962                                         data.row.my.volume_count = '0';
963                                         data.row.my.copy_count = '<0>';
964                                 } else {
965                                         data.row.my.volume_count = '';
966                                         data.row.my.copy_count = '';
967                                 }
968                         } else {
969                                 var v_count = 0; var c_count = 0;
970                                 acn_tree_list = obj.network.simple_request(
971                                         'FM_ACN_TREE_LIST_RETRIEVE_VIA_RECORD_ID_AND_ORG_IDS',
972                                         [ ses(), obj.docid, [ org.id() ] ]
973                                 );
974                                 for (var i = 0; i < acn_tree_list.length; i++) {
975                                         v_count++;
976                                         obj.map_acn[ 'acn_' + acn_tree_list[i].id() ] = function(r){return r;}(acn_tree_list[i]);
977                                         var copies = acn_tree_list[i].copies(); if (copies) c_count += copies.length;
978                                         for (var j = 0; j < copies.length; j++) {
979                                                 obj.map_acp[ 'acp_' + copies[j].id() ] = function(r){return r;}(copies[j]);
980                                         }
981                                 }
982                                 data.row.my.volume_count = v_count;
983                                 data.row.my.copy_count = '<' + c_count + '>';
984                         }
985                         if (parent_org) {
986                                 data.node = obj.map_tree[ 'aou_' + parent_org.id() ];
987                         }
988
989                         var node = obj.list.append(data);
990                         if (params) {
991                                 for (var i in params) {
992                                         node.setAttribute(i,params[i]);
993                                 }
994                         }
995                         obj.map_tree[ 'aou_' + org.id() ] = node;
996
997                         if (org.children()) {
998                                 node.setAttribute('container','true');
999                         }
1000
1001                         if (parent_org) {
1002                                 if ( obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ].parent_ou() == parent_org.id() ) {
1003                                         data.node.setAttribute('open','true');
1004                                 }
1005                         } else {
1006                                 obj.map_tree[ 'aou_' + org.id() ].setAttribute('open','true');
1007                         }
1008
1009                         if (acn_tree_list) {
1010                                 obj.map_acn[ 'aou_' + org.id() ] = acn_tree_list;
1011                                 node.setAttribute('container','true');
1012                         }
1013
1014                 } catch(E) {
1015                         dump(E+'\n');
1016                         alert(E);
1017                 }
1018         },
1019
1020         'append_acn' : function( org, acn_tree, params ) {
1021                 var obj = this;
1022                 try {
1023                         if (obj.map_tree[ 'acn_' + acn_tree.id() ]) {
1024                                 var x = obj.map_tree[ 'acn_' + acn_tree.id() ];
1025                                 if (params) {
1026                                         for (var i in params) {
1027                                                 x.setAttribute(i,params[i]);
1028                                         }
1029                                 }
1030                                 return x;
1031                         }
1032
1033                         var parent_node = obj.map_tree[ 'aou_' + org.id() ];
1034                         var data = {
1035                                 'row' : {
1036                                         'my' : {
1037                                                 'aou' : org,
1038                                                 'acn' : acn_tree,
1039                                                 'volume_count' : '',
1040                                                 'copy_count' : acn_tree.copies() ? acn_tree.copies().length : '0',
1041                                         }
1042                                 },
1043                                 'skip_all_columns_except' : [0,1,2],
1044                                 'retrieve_id' : 'acn_' + acn_tree.id(),
1045                                 'node' : parent_node,
1046                         };
1047                         var node = obj.list.append(data);
1048                         obj.map_tree[ 'acn_' + acn_tree.id() ] =  node;
1049                         if (params) {
1050                                 for (var i in params) {
1051                                         node.setAttribute(i,params[i]);
1052                                 }
1053                         }
1054                         if (acn_tree.copies()) {
1055                                 obj.map_acp[ 'acn_' + acn_tree.id() ] = acn_tree;
1056                                 node.setAttribute('container','true');
1057                         }
1058
1059                 } catch(E) {
1060                         dump(E+'\n');
1061                         alert(E);
1062                 }
1063         },
1064
1065         'append_acp' : function( acp_item, acn_tree, params ) {
1066                 var obj = this;
1067                 try {
1068                         if (obj.map_tree[ 'acp_' + acp_item.id() ]) {
1069                                 var x = obj.map_tree[ 'acp_' + acp_item.id() ];
1070                                 if (params) {
1071                                         for (var i in params) {
1072                                                 x.setAttribute(i,params[i]);
1073                                         }
1074                                 }
1075                                 return x;
1076                         }
1077
1078                         var parent_node = obj.map_tree[ 'acn_' + acn_tree.id() ];
1079                         var data = {
1080                                 'row' : {
1081                                         'my' : {
1082                                                 'aou' : obj.data.hash.aou[ acn_tree.owning_lib() ],
1083                                                 'acn' : acn_tree,
1084                                                 'acp' : acp_item,
1085                                                 'volume_count' : '',
1086                                                 'copy_count' : '',
1087                                         }
1088                                 },
1089                                 'retrieve_id' : 'acp_' + acp_item.id(),
1090                                 'node' : parent_node,
1091                         };
1092                         var node = obj.list.append(data);
1093                         obj.map_tree[ 'acp_' + acp_item.id() ] =  node;
1094                         if (params) {
1095                                 for (var i in params) {
1096                                         node.setAttribute(i,params[i]);
1097                                 }
1098                         }
1099
1100                 } catch(E) {
1101                         dump(E+'\n');
1102                         alert(E);
1103                 }
1104         },
1105
1106         'list_init' : function( params ) {
1107
1108                 try {
1109                         netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
1110                         var obj = this;
1111                         
1112                         JSAN.use('circ.util');
1113                         var columns = [
1114                                 {
1115                                         'id' : 'tree_location', 'label' : 'Location/Barcode', 'flex' : 1,
1116                                         'primary' : true, 'hidden' : false, 
1117                                         'render' : 'my.acp ? my.acp.barcode() : my.acn ? my.acn.label() : my.aou ? my.aou.shortname() + " : " + my.aou.name() : "???"'
1118                                 },
1119                                 {
1120                                         'id' : 'volume_count', 'label' : 'Volumes', 'flex' : 0,
1121                                         'primary' : false, 'hidden' : false, 
1122                                         'render' : 'my.volume_count'
1123                                 },
1124                                 {
1125                                         'id' : 'copy_count', 'label' : 'Copies', 'flex' : 0,
1126                                         'primary' : false, 'hidden' : false, 
1127                                         'render' : 'my.copy_count'
1128                                 },
1129                         ].concat(
1130                                 circ.util.columns( 
1131                                         { 
1132                                                 'location' : { 'hidden' : false },
1133                                                 'circ_lib' : { 'hidden' : false },
1134                                                 'owning_lib' : { 'hidden' : false },
1135                                                 'call_number' : { 'hidden' : false },
1136                                                 'status' : { 'hidden' : false },
1137                                         },
1138                                         {
1139                                                 'just_these' : [
1140                                                         'owning_lib',
1141                                                         'circ_lib',
1142                                                         'call_number',
1143                                                         'copy_number',
1144                                                         'location',
1145                                                         'barcode',
1146                                                         'loan_duration',
1147                                                         'fine_level',
1148                                                         'circulate',
1149                                                         'holdable',
1150                                                         'opac_visible',
1151                                                         'ref',
1152                                                         'deposit',
1153                                                         'deposit_amount',
1154                                                         'price',
1155                                                         'circ_as_type',
1156                                                         'circ_modifier',
1157                                                         'status',
1158                                                         'alert_message',
1159                                                         'acp_id',
1160                                                 ]
1161                                         }
1162                                 )
1163                         );
1164                         JSAN.use('util.list'); obj.list = new util.list('copy_tree');
1165                         obj.list.init(
1166                                 {
1167                                         'columns' : columns,
1168                                         'map_row_to_column' : circ.util.std_map_row_to_column(' '),
1169                                         'retrieve_row' : function(params) {
1170
1171                                                 var row = params.row;
1172
1173                                                 var funcs = [];
1174                                         /*      
1175                                                 if (!row.my.mvr) funcs.push(
1176                                                         function() {
1177
1178                                                                 row.my.mvr = obj.network.request(
1179                                                                         api.MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.app,
1180                                                                         api.MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.method,
1181                                                                         [ row.my.circ.target_copy() ]
1182                                                                 );
1183
1184                                                         }
1185                                                 );
1186                                                 if (!row.my.acp) {
1187                                                         funcs.push(     
1188                                                                 function() {
1189
1190                                                                         row.my.acp = obj.network.request(
1191                                                                                 api.FM_ACP_RETRIEVE.app,
1192                                                                                 api.FM_ACP_RETRIEVE.method,
1193                                                                                 [ row.my.circ.target_copy() ]
1194                                                                         );
1195
1196                                                                         params.row_node.setAttribute( 'retrieve_id',row.my.acp.barcode() );
1197
1198                                                                 }
1199                                                         );
1200                                                 } else {
1201                                                         params.row_node.setAttribute( 'retrieve_id',row.my.acp.barcode() );
1202                                                 }
1203                                         */
1204                                                 funcs.push(
1205                                                         function() {
1206
1207                                                                 if (typeof params.on_retrieve == 'function') {
1208                                                                         params.on_retrieve(row);
1209                                                                 }
1210
1211                                                         }
1212                                                 );
1213
1214                                                 JSAN.use('util.exec'); var exec = new util.exec();
1215                                                 exec.on_error = function(E) {
1216                                                         var err = 'items chain: ' + js2JSON(E);
1217                                                         obj.error.sdump('D_ERROR',err);
1218                                                         return true; /* keep going */
1219                                                 }
1220                                                 exec.chain( funcs );
1221
1222                                                 return row;
1223                                         },
1224                                         'on_click' : function(ev) {
1225                                                 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserRead');
1226                                                 var row = {}; var col = {}; var nobj = {};
1227                                                 obj.list.node.treeBoxObject.getCellAt(ev.clientX,ev.clientY,row,col,nobj);
1228                                                 if ((row.value == -1)||(nobj.value != 'twisty')) { return; }
1229                                                 var node = obj.list.node.contentView.getItemAtIndex(row.value);
1230                                                 var list = [ node.getAttribute('retrieve_id') ];
1231                                                 if (typeof obj.on_select == 'function') {
1232                                                         obj.on_select(list,true);
1233                                                 }
1234                                                 if (typeof window.xulG == 'object' && typeof window.xulG.on_select == 'function') {
1235                                                         window.xulG.on_select(list);
1236                                                 }
1237                                         },
1238                                         'on_select' : function(ev) {
1239                                                 JSAN.use('util.functional');
1240                                                 var sel = obj.list.retrieve_selection();
1241                                                 obj.controller.view.sel_clip.disabled = sel.length < 1;
1242                                                 obj.sel_list = util.functional.map_list(
1243                                                         sel,
1244                                                         function(o) { return o.getAttribute('retrieve_id'); }
1245                                                 );
1246                                                 obj.toggle_actions();
1247                                                 if (typeof obj.on_select == 'function') {
1248                                                         obj.on_select(obj.sel_list);
1249                                                 }
1250                                                 if (typeof window.xulG == 'object' && typeof window.xulG.on_select == 'function') {
1251                                                         window.xulG.on_select(obj.sel_list);
1252                                                 }
1253                                         },
1254                                 }
1255                         );
1256
1257                         obj.controller.render();
1258
1259                 } catch(E) {
1260                         this.error.sdump('D_ERROR','cat.copy_browser.list_init: ' + E + '\n');
1261                         alert(E);
1262                 }
1263         },
1264
1265         'toggle_actions' : function() {
1266                 var obj = this;
1267                 try {
1268                         var found_aou = false; var found_acn = false; var found_acp = false;
1269                         for (var i = 0; i < obj.sel_list.length; i++) {
1270                                 var type = obj.sel_list[i].split(/_/)[0];
1271                                 switch(type) {
1272                                         case 'aou' : found_aou = true; break;
1273                                         case 'acn' : found_acn = true; break;
1274                                         case 'acp' : found_acp = true; break;
1275                                 }
1276                         }
1277                         obj.controller.view.cmd_add_items.setAttribute('disabled','true');
1278                         obj.controller.view.cmd_add_items_to_buckets.setAttribute('disabled','true');
1279                         obj.controller.view.cmd_edit_items.setAttribute('disabled','true');
1280                         obj.controller.view.cmd_delete_items.setAttribute('disabled','true');
1281                         obj.controller.view.cmd_print_spine_labels.setAttribute('disabled','true');
1282                         obj.controller.view.cmd_add_volumes.setAttribute('disabled','true');
1283                         obj.controller.view.cmd_mark_library.setAttribute('disabled','true');
1284                         obj.controller.view.cmd_edit_volumes.setAttribute('disabled','true');
1285                         obj.controller.view.cmd_delete_volumes.setAttribute('disabled','true');
1286                         obj.controller.view.cmd_mark_volume.setAttribute('disabled','true');
1287                         obj.controller.view.cmd_transfer_volume.setAttribute('disabled','true');
1288                         obj.controller.view.cmd_transfer_items.setAttribute('disabled','true');
1289                         if (found_aou) {
1290                                 obj.controller.view.cmd_add_volumes.setAttribute('disabled','false');
1291                                 obj.controller.view.cmd_mark_library.setAttribute('disabled','false');
1292                         }
1293                         if (found_acn) {
1294                                 obj.controller.view.cmd_edit_volumes.setAttribute('disabled','false');
1295                                 obj.controller.view.cmd_delete_volumes.setAttribute('disabled','false');
1296                                 obj.controller.view.cmd_mark_volume.setAttribute('disabled','false');
1297                                 obj.controller.view.cmd_add_items.setAttribute('disabled','false');
1298                                 obj.controller.view.cmd_transfer_volume.setAttribute('disabled','false');
1299                         }
1300                         if (found_acp) {
1301                                 obj.controller.view.cmd_add_items_to_buckets.setAttribute('disabled','false');
1302                                 obj.controller.view.cmd_edit_items.setAttribute('disabled','false');
1303                                 obj.controller.view.cmd_delete_items.setAttribute('disabled','false');
1304                                 obj.controller.view.cmd_print_spine_labels.setAttribute('disabled','false');
1305                                 obj.controller.view.cmd_transfer_items.setAttribute('disabled','false');
1306                         }
1307                 } catch(E) {
1308                         obj.error.standard_unexpected_error_alert('Copy Browser Actions',E);
1309                 }
1310         },
1311
1312         'refresh_list' : function() { 
1313                 try {
1314                         var obj = this;
1315                         obj.list.clear();
1316                         obj.map_tree = {};
1317                         obj.map_acn = {};
1318                         obj.map_acp = {};
1319                         obj.org_ids = obj.network.simple_request('FM_AOU_IDS_RETRIEVE_VIA_RECORD_ID',[ obj.docid ]);
1320                         var org = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
1321                         obj.show_libs( org );
1322                         obj.show_my_libs();
1323                 } catch(E) {
1324                         this.error.standard_unexpected_error_alert('Problem refreshing the volume/copy tree.',E);
1325                 }
1326         },
1327 }
1328
1329 dump('exiting cat.copy_browser.js\n');