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