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