]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/cat/record_buckets.js
change wording for user speedbump
[Evergreen.git] / Open-ILS / xul / staff_client / server / cat / record_buckets.js
1 dump('entering cat.record_buckets.js\n');
2
3 if (typeof cat == 'undefined') cat = {};
4 cat.record_buckets = function (params) {
5
6         JSAN.use('util.error'); this.error = new util.error();
7         JSAN.use('util.network'); this.network = new util.network();
8         JSAN.use('util.date');
9         JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
10         this.first_pause = true;
11 }
12
13 cat.record_buckets.prototype = {
14         'selection_list1' : [],
15         'selection_list2' : [],
16         'bucket_id_name_map' : {},
17
18         'render_pending_records' : function() {
19                 if (this.first_pause) {
20                         this.first_pause = false;
21                 } else {
22                         alert("Action completed.");
23                 }
24                 var obj = this;
25                 obj.list1.clear();
26                 for (var i = 0; i < obj.record_ids.length; i++) {
27                         var item = obj.flesh_item_for_list( obj.record_ids[i] );
28                         if (item) obj.list1.append( item );
29                 }
30         },
31
32         'init' : function( params ) {
33
34                 var obj = this;
35
36                 obj.record_ids = params['record_ids'] || [];
37
38                 JSAN.use('circ.util');
39                 var columns = circ.util.columns( 
40                         { 
41                                 'title' : { 'hidden' : false },
42                                 'author' : { 'hidden' : false },
43                                 'edition' : { 'hidden' : false },
44                                 'publisher' : { 'hidden' : false },
45                                 'pubdate' : { 'hidden' : false },
46                                 'isbn' : { 'hidden' : false },
47                                 'tcn' : { 'hidden' : false },
48                         } 
49                 );
50
51                 JSAN.use('util.list'); 
52
53                 obj.list1 = new util.list('pending_records_list');
54                 obj.list1.init(
55                         {
56                                 'columns' : columns,
57                                 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
58                                 'on_select' : function(ev) {
59                                         try {
60                                                 JSAN.use('util.functional');
61                                                 var sel = obj.list1.retrieve_selection();
62                                                 document.getElementById('clip_button1').disabled = sel.length < 1;
63                                                 obj.selection_list1 = util.functional.map_list(
64                                                         sel,
65                                                         function(o) { return JSON2js(o.getAttribute('retrieve_id')); }
66                                                 );
67                                                 obj.error.sdump('D_TRACE','circ/record_buckets: selection list 1 = ' + js2JSON(obj.selection_list1) );
68                                                 if (obj.selection_list1.length == 0) {
69                                                         obj.controller.view.record_buckets_sel_add.disabled = true;
70                                                 } else {
71                                                         obj.controller.view.record_buckets_sel_add.disabled = false;
72                                                 }
73                                         } catch(E) {
74                                                 alert('FIXME: ' + E);
75                                         }
76                                 },
77
78                         }
79                 );
80
81                 obj.render_pending_records();
82         
83                 obj.list2 = new util.list('records_in_bucket_list');
84                 obj.list2.init(
85                         {
86                                 'columns' : columns,
87                                 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
88                                 'on_select' : function(ev) {
89                                         try {
90                                                 JSAN.use('util.functional');
91                                                 var sel = obj.list2.retrieve_selection();
92                                                 document.getElementById('clip_button2').disabled = sel.length < 1;
93                                                 obj.selection_list2 = util.functional.map_list(
94                                                         sel,
95                                                         function(o) { return JSON2js(o.getAttribute('retrieve_id')); }
96                                                 );
97                                                 obj.error.sdump('D_TRACE','circ/record_buckets: selection list 2 = ' + js2JSON(obj.selection_list2) );
98                                                 if (obj.selection_list2.length == 0) {
99                                                         obj.controller.view.record_buckets_delete_item.disabled = true;
100                                                         obj.controller.view.record_buckets_delete_item.setAttribute('disabled','true');
101                                                         obj.controller.view.record_buckets_export.disabled = true;
102                                                         obj.controller.view.record_buckets_export.setAttribute('disabled','true');
103                                                 } else {
104                                                         obj.controller.view.record_buckets_delete_item.disabled = false;
105                                                         obj.controller.view.record_buckets_delete_item.setAttribute('disabled','false');
106                                                         obj.controller.view.record_buckets_export.disabled = false;
107                                                         obj.controller.view.record_buckets_export.setAttribute('disabled','false');
108                                                 }
109                                         } catch(E) {
110                                                 alert('FIXME: ' + E);
111                                         }
112                                 },
113                         }
114                 );
115                 
116                 JSAN.use('util.controller'); obj.controller = new util.controller();
117                 obj.controller.init(
118                         {
119                                 'control_map' : {
120                                         'save_columns2' : [
121                                                 ['command'],
122                                                 function() { obj.list2.save_columns(); }
123                                         ],
124                                         'save_columns1' : [
125                                                 ['command'],
126                                                 function() { obj.list1.save_columns(); }
127                                         ],
128                                         'sel_clip2' : [
129                                                 ['command'],
130                                                 function() { obj.list2.clipboard(); }
131                                         ],
132                                         'sel_clip1' : [
133                                                 ['command'],
134                                                 function() { obj.list1.clipboard(); }
135                                         ],
136                                         'record_buckets_menulist_placeholder' : [
137                                                 ['render'],
138                                                 function(e) {
139                                                         return function() {
140                                                                 JSAN.use('util.widgets'); JSAN.use('util.functional');
141                                                                 var buckets = obj.network.simple_request(
142                                                                         'BUCKET_RETRIEVE_VIA_USER',
143                                                                         [ ses(), obj.data.list.au[0].id() ]
144                                                                 );
145                                                                 if (typeof buckets.ilsevent != 'undefined') {
146                                                                         obj.error.standard_unexpected_error_alert('Could not retrieve your buckets.',buckets);
147                                                                         return;
148                                                                 }
149                                                                 var items = [ ['Choose a bucket...',''], ['Retrieve shared bucket...',-1] ].concat(
150                                                                         util.functional.map_list(
151                                                                                 util.functional.filter_list(
152                                                                                         buckets.biblio,
153                                                                                         function(o) {
154                                                                                                 return o.btype() == 'staff_client';
155                                                                                         }
156                                                                                 ),
157                                                                                 function(o) {
158                                                                                         obj.bucket_id_name_map[ o.id() ] = o.name();
159                                                                                         return [ o.name(), o.id() ];
160                                                                                 }
161                                                                         )
162                                                                 );
163                                                                 obj.error.sdump('D_TRACE','items = ' + js2JSON(items));
164                                                                 util.widgets.remove_children( e );
165                                                                 var ml = util.widgets.make_menulist(
166                                                                         items
167                                                                 );
168                                                                 e.appendChild( ml );
169                                                                 ml.setAttribute('id','bucket_menulist');
170                                                                 ml.setAttribute('accesskey','');
171
172                                                                 function change_bucket(ev) {
173                                                                         var bucket_id = ev.target.value;
174                                                                         if (bucket_id < 0 ) {
175                                                                                 bucket_id = window.prompt('Enter bucket number:');
176                                                                                 ev.target.value = bucket_id;
177                                                                                 ev.target.setAttribute('value',bucket_id);
178                                                                         }
179                                                                         if (!bucket_id) return;
180                                                                         var bucket = obj.network.simple_request(
181                                                                                 'BUCKET_FLESH',
182                                                                                 [ ses(), 'biblio', bucket_id ]
183                                                                         );
184                                                                         if (typeof bucket.ilsevent != 'undefined') {
185                                                                                 if (bucket.ilsevent == 1506 /* CONTAINER_NOT_FOUND */) {
186                                                                                         alert('Could not find a bucket with ID = ' + bucket_id);
187                                                                                 } else {
188                                                                                         obj.error.standard_unexpected_error_alert('Error retrieving bucket.  Did you use a valid bucket id?',bucket);
189                                                                                 }
190                                                                                 return;
191                                                                         }
192                                                                         try {
193                                                                                 var x = document.getElementById('info_box');
194                                                                                 x.setAttribute('hidden','false');
195                                                                                 x = document.getElementById('bucket_number');
196                                                                                 x.setAttribute('value',bucket.id());
197                                                                                 x = document.getElementById('bucket_name');
198                                                                                 x.setAttribute('value',bucket.name());
199                                                                                 x = document.getElementById('bucket_owner');
200                                                                                 var s = bucket.owner(); JSAN.use('patron.util');
201                                                                                 if (s && typeof s != "object") s = patron.util.retrieve_fleshed_au_via_id(ses(),s); 
202                                                                                 x.setAttribute('value',s.card().barcode() + " @ " + obj.data.hash.aou[ s.home_ou() ].shortname());
203                                                                         } catch(E) {
204                                                                                 alert(E);
205                                                                         }
206                                                                         var items = bucket.items() || [];
207                                                                         obj.list2.clear();
208                                                                         for (var i = 0; i < items.length; i++) {
209                                                                                 var item = obj.flesh_item_for_list( 
210                                                                                         items[i].target_biblio_record_entry(),
211                                                                                         items[i].id()
212                                                                                 );
213                                                                                 if (item) obj.list2.append( item );
214                                                                         }
215                                                                 }
216
217                                                                 ml.addEventListener( 'change_bucket', change_bucket , false);
218                                                                 ml.addEventListener( 'command', function() {
219                                                                         JSAN.use('util.widgets'); util.widgets.dispatch('change_bucket',ml);
220                                                                 }, false);
221                                                                 obj.controller.view.bucket_menulist = ml;
222                                                                 JSAN.use('util.widgets'); util.widgets.dispatch('change_bucket',ml);
223                                                                 document.getElementById('refresh').addEventListener( 'command', function() {
224                                                                         JSAN.use('util.widgets'); util.widgets.dispatch('change_bucket',ml);
225                                                                 }, false);
226                                                         };
227                                                 },
228                                         ],
229
230                                         'record_buckets_add' : [
231                                                 ['command'],
232                                                 function() {
233                                                         var bucket_id = obj.controller.view.bucket_menulist.value;
234                                                         if (!bucket_id) return;
235                                                         for (var i = 0; i < obj.record_ids.length; i++) {
236                                                                 var bucket_item = new cbrebi();
237                                                                 bucket_item.isnew('1');
238                                                                 bucket_item.bucket(bucket_id);
239                                                                 bucket_item.target_biblio_record_entry( obj.record_ids[i] );
240                                                                 try {
241                                                                         var robj = obj.network.simple_request('BUCKET_ITEM_CREATE',
242                                                                                 [ ses(), 'biblio', bucket_item ]);
243
244                                                                         if (typeof robj == 'object') throw robj;
245
246                                                                         var item = obj.flesh_item_for_list( obj.record_ids[i], robj );
247                                                                         if (!item) continue;
248
249                                                                         obj.list2.append( item );
250                                                                 } catch(E) {
251                                                                         alert( js2JSON(E) );
252                                                                 }
253                                                         }
254                                                 }
255                                         ],
256                                         'record_buckets_sel_add' : [
257                                                 ['command'],
258                                                 function() {                                                        
259                                                         var bucket_id = obj.controller.view.bucket_menulist.value;
260                                                         if (!bucket_id) return;
261                                                         for (var i = 0; i < obj.selection_list1.length; i++) {
262                                                                 var docid = obj.selection_list1[i].docid;
263                                                                 var bucket_item = new cbrebi();
264                                                                 bucket_item.isnew('1');
265                                                                 bucket_item.bucket(bucket_id);
266                                                                 bucket_item.target_biblio_record_entry( docid );
267                                                                 try {
268                                                                         var robj = obj.network.simple_request('BUCKET_ITEM_CREATE',
269                                                                                 [ ses(), 'biblio', bucket_item ]);
270
271                                                                         if (typeof robj == 'object') throw robj;
272
273                                                                         var item = obj.flesh_item_for_list( docid, robj );
274                                                                         if (!item) continue;
275
276                                                                         obj.list2.append( item );
277                                                                 } catch(E) {
278                                                                         alert( js2JSON(E) );
279                                                                 }
280                                                         }
281
282                                                 }
283                                         ],
284                                         'record_buckets_export' : [
285                                                 ['command'],
286                                                 function() {                                                        
287                                                         for (var i = 0; i < obj.selection_list2.length; i++) {
288                                                                 var docid = obj.selection_list2[i].docid;
289                                                                 var item = obj.flesh_item_for_list( docid );
290                                                                 if (item) {
291                                                                         obj.list1.append( item );
292                                                                         obj.record_ids.push( docid );
293                                                                 }
294                                                         }
295                                                 }
296                                         ],
297
298                                         'record_buckets_delete_item' : [
299                                                 ['command'],
300                                                 function() {
301                                                         for (var i = 0; i < obj.selection_list2.length; i++) {
302                                                                 try {
303                                                                         var bucket_item_id = obj.selection_list2[i].bucket_item_id;
304                                                                         var robj = obj.network.simple_request('BUCKET_ITEM_DELETE',
305                                                                                 [ ses(), 'biblio', bucket_item_id ]);
306                                                                         if (typeof robj == 'object') throw robj;
307                                                                 } catch(E) {
308                                                                         alert(js2JSON(E));
309                                                                 }
310                                                         }
311                                                         alert("Action completed.");
312                                                         setTimeout(
313                                                                 function() {
314                                                                         JSAN.use('util.widgets'); 
315                                                                         util.widgets.dispatch('change_bucket',obj.controller.view.bucket_menulist);
316                                                                 }, 0
317                                                         );
318                                                 }
319                                         ],
320                                         'record_buckets_delete_bucket' : [
321                                                 ['command'],
322                                                 function() {
323                                                         try {
324                                                                 var bucket = obj.controller.view.bucket_menulist.value;
325                                                                 var name = obj.bucket_id_name_map[ bucket ];
326                                                                 var conf = window.confirm('Delete the bucket named ' + name + '?');
327                                                                 if (!conf) return;
328                                                                 obj.list2.clear();
329                                                                 var robj = obj.network.simple_request('BUCKET_DELETE',[ses(),'biblio',bucket]);
330                                                                 if (typeof robj == 'object') throw robj;
331                                                                 alert("Action completed.");
332                                                                 obj.controller.render('record_buckets_menulist_placeholder');
333                                                                 setTimeout(
334                                                                         function() {
335                                                                                 JSAN.use('util.widgets'); 
336                                                                                 util.widgets.dispatch('change_bucket',obj.controller.view.bucket_menulist);
337                                                                         }, 0
338                                                                 );
339
340                                                         } catch(E) {
341                                                                 alert('FIXME -- ' + E);
342                                                         }
343                                                 }
344                                         ],
345                                         'record_buckets_new_bucket' : [
346                                                 ['command'],
347                                                 function() {
348                                                         try {
349                                                                 var name = prompt('What would you like to name the bucket?','','Bucket Creation');
350
351                                                                 if (name) {
352                                                                         var bucket = new cbreb();
353                                                                         bucket.btype('staff_client');
354                                                                         bucket.owner( obj.data.list.au[0].id() );
355                                                                         bucket.name( name );
356
357                                                                         var robj = obj.network.simple_request('BUCKET_CREATE',[ses(),'biblio',bucket]);
358
359                                                                         if (typeof robj == 'object') throw robj;
360
361                                                                         alert('Bucket "' + name + '" created.');
362
363                                                                         obj.controller.render('record_buckets_menulist_placeholder');
364                                                                         obj.controller.view.bucket_menulist.value = robj;
365                                                                         setTimeout(
366                                                                                 function() {
367                                                                                         JSAN.use('util.widgets'); 
368                                                                                         util.widgets.dispatch('change_bucket',obj.controller.view.bucket_menulist);
369                                                                                 }, 0
370                                                                         );
371                                                                 }
372                                                         } catch(E) {
373                                                                 alert( js2JSON(E) );
374                                                         }
375                                                 }
376                                         ],
377                                         
378                                         'cmd_record_buckets_export' : [
379                                                 ['command'],
380                                                 function() {
381                                                         obj.list2.on_all_fleshed = function() {
382                                                                 try {
383                                                                         dump(obj.list2.dump_csv() + '\n');
384                                                                         copy_to_clipboard(obj.list2.dump_csv());
385                                                                         setTimeout(function(){obj.list2.on_all_fleshed = null;},0);
386                                                                 } catch(E) {
387                                                                         alert(E); 
388                                                                 }
389                                                         }
390                                                         obj.list2.full_retrieve();
391                                                 }
392                                         ],
393
394                                         'cmd_export1' : [
395                                                 ['command'],
396                                                 function() {
397                                                         obj.list1.on_all_fleshed = function() {
398                                                                 try {
399                                                                         dump(obj.list1.dump_csv() + '\n');
400                                                                         copy_to_clipboard(obj.list1.dump_csv());
401                                                                         setTimeout(function(){obj.list1.on_all_fleshed = null;},0);
402                                                                 } catch(E) {
403                                                                         alert(E); 
404                                                                 }
405                                                         }
406                                                         obj.list1.full_retrieve();
407                                                 }
408                                         ],
409
410                     'cmd_print_export1' : [
411                         ['command'],
412                         function() {
413                             try {
414                                 obj.list1.on_all_fleshed =
415                                     function() {
416                                         try {
417                                             dump( obj.list1.dump_csv() + '\n' );
418                                             //copy_to_clipboard(obj.list.dump_csv());
419                                             JSAN.use('util.print'); var print = new util.print();
420                                             print.simple(obj.list1.dump_csv(),{'content_type':'text/plain'});
421                                             setTimeout(function(){ obj.list1.on_all_fleshed = null; },0);
422                                         } catch(E) {
423                                             obj.error.standard_unexpected_error_alert('print export',E);
424                                         }
425                                     }
426                                 obj.list1.full_retrieve();
427                             } catch(E) {
428                                 obj.error.standard_unexpected_error_alert('print export',E);
429                             }
430                         }
431                     ],
432
433
434                     'cmd_print_export2' : [
435                         ['command'],
436                         function() {
437                             try {
438                                 obj.list2.on_all_fleshed =
439                                     function() {
440                                         try {
441                                             dump( obj.list2.dump_csv() + '\n' );
442                                             //copy_to_clipboard(obj.list.dump_csv());
443                                             JSAN.use('util.print'); var print = new util.print();
444                                             print.simple(obj.list2.dump_csv(),{'content_type':'text/plain'});
445                                             setTimeout(function(){ obj.list2.on_all_fleshed = null; },0);
446                                         } catch(E) {
447                                             obj.error.standard_unexpected_error_alert('print export',E);
448                                         }
449                                     }
450                                 obj.list2.full_retrieve();
451                             } catch(E) {
452                                 obj.error.standard_unexpected_error_alert('print export',E);
453                             }
454                         }
455                     ],
456
457                                         'cmd_merge_records' : [
458                                                 ['command'],
459                                                 function() {
460                                                         try {
461                                                                 obj.list2.select_all();
462                                                                 obj.data.stash_retrieve();
463                                                                 JSAN.use('util.functional');
464
465                                                                 var record_ids = util.functional.map_list(
466                                                                         obj.list2.dump_retrieve_ids(),
467                                                                         function (o) {
468                                                                                 return JSON2js(o).docid; // docid
469                                                                         }
470                                                                 );
471
472                                                                 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
473                                                                 var top_xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" >';
474                                                                 top_xml += '<description>Merge these records? (Select the "lead" record first)</description>';
475                                                                 top_xml += '<hbox><button id="lead" disabled="true" label="Merge" name="fancy_submit"/><button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox></vbox>';
476
477                                                                 var xml = '<form xmlns="http://www.w3.org/1999/xhtml">';
478                                                                 xml += '<table><tr valign="top">';
479                                                                 for (var i = 0; i < record_ids.length; i++) {
480                                                                         xml += '<td><input value="Lead" id="record_' + record_ids[i] + '" type="radio" name="lead"';
481                                                                         xml += ' onclick="' + "try { var x = document.getElementById('lead'); x.setAttribute('value',";
482                                                                         xml += record_ids[i] + '); x.disabled = false; } catch(E) { alert(E); }">';
483                                                                         xml += '</input>Lead Record? #' + record_ids[i] + '</td>';
484                                                                 }
485                                                                 xml += '</tr><tr valign="top">';
486                                                                 for (var i = 0; i < record_ids.length; i++) {
487                                                                         xml += '<td nowrap="nowrap"><iframe src="' + urls.XUL_BIB_BRIEF; 
488                                                                         xml += '?docid=' + record_ids[i] + '"/></td>';
489                                                                 }
490                                                                 xml += '</tr><tr valign="top">';
491                                                                 for (var i = 0; i < record_ids.length; i++) {
492                                                                         html = obj.network.simple_request('MARC_HTML_RETRIEVE',[ record_ids[i] ]);
493                                                                         xml += '<td nowrap="nowrap"><iframe style="min-height: 1000px; min-width: 300px;" flex="1" src="data:text/html,' + window.escape(html) + '"/></td>';
494                                                                 }
495                                                                 xml += '</tr></table></form>';
496                                                                 obj.data.temp_merge_top = top_xml; obj.data.stash('temp_merge_top');
497                                                                 obj.data.temp_merge_mid = xml; obj.data.stash('temp_merge_mid');
498                                                                 window.open(
499                                                                         urls.XUL_FANCY_PROMPT
500                                                                         + '?xml_in_stash=temp_merge_mid'
501                                                                         + '&top_xml_in_stash=temp_merge_top'
502                                                                         + '&title=' + window.escape('Record Merging'),
503                                                                         'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
504                                                                 );
505                                                                 obj.data.stash_retrieve();
506                                                                 if (obj.data.fancy_prompt_data == '') { alert('Merge Aborted'); return; }
507                                                                 var robj = obj.network.simple_request('MERGE_RECORDS', 
508                                                                         [ 
509                                                                                 ses(), 
510                                                                                 obj.data.fancy_prompt_data.lead, 
511                                                                                 util.functional.filter_list( record_ids,
512                                                                                         function(o) {
513                                                                                                 return o != obj.data.fancy_prompt_data.lead;
514                                                                                         }
515                                                                                 )
516                                                                         ]
517                                                                 );
518                                                                 if (typeof robj.ilsevent != 'undefined') {
519                                                                         throw(robj);
520                                                                 } else {
521                                                                         alert('Records were successfully merged.');
522                                                                 }
523
524                                                                 obj.render_pending_records(); // FIXME -- need a generic refresh for lists
525                                                                 setTimeout(
526                                                                         function() {
527                                                                                 JSAN.use('util.widgets'); 
528                                                                                 util.widgets.dispatch('change_bucket',obj.controller.view.bucket_menulist);
529                                                                         }, 0
530                                                                 );
531                                                         } catch(E) {
532                                                                 obj.error.standard_unexpected_error_alert('Records were not likely merged.',E);
533                                                         }
534
535                                                 }
536                                         ],
537                                         'cmd_broken' : [
538                                                 ['command'],
539                                                 function() { alert('Not Yet Implemented'); }
540                                         ],
541                                         'cmd_record_buckets_done' : [
542                                                 ['command'],
543                                                 function() {
544                                                         window.close();
545                                                 }
546                                         ],
547                                         'cmd_sel_opac' : [
548                                                 ['command'],
549                                                 function() {
550                                                         try {
551                                                                 obj.list2.select_all();
552                                                                 JSAN.use('util.functional');
553                                                                 var docids = util.functional.map_list(
554                                                                         obj.list2.dump_retrieve_ids(),
555                                                                         function (o) {
556                                                                                 return JSON2js(o).docid; // docid
557                                                                         }
558                                                                 );
559                                                                 for (var i = 0; i < docids.length; i++) {
560                                                                         var doc_id = docids[i];
561                                                                         var opac_url = xulG.url_prefix( urls.opac_rdetail ) + '?r=' + doc_id;
562                                                                         var content_params = { 
563                                                                                 'session' : ses(),
564                                                                                 'authtime' : ses('authtime'),
565                                                                                 'opac_url' : opac_url,
566                                                                         };
567                                                                         xulG.new_tab(
568                                                                                 xulG.url_prefix(urls.XUL_OPAC_WRAPPER), 
569                                                                                 {'tab_name':'Retrieving title...'}, 
570                                                                                 content_params
571                                                                         );
572                                                                 }
573                                                         } catch(E) {
574                                                                 obj.error.standard_unexpected_error_alert('Showing in OPAC',E);
575                                                         }
576                                                 }
577                                         ],
578
579                                 }
580                         }
581                 );
582                 this.controller.render();
583
584                 if (typeof xulG == 'undefined') {
585                         obj.controller.view.cmd_sel_opac.disabled = true;
586                         obj.controller.view.cmd_sel_opac.setAttribute('disabled',true);
587                 } else {
588                         obj.controller.view.cmd_record_buckets_done.disabled = true;
589                         obj.controller.view.cmd_record_buckets_done.setAttribute('disabled',true);
590                 }
591         },
592
593         'flesh_item_for_list' : function(docid,bucket_item_id) {
594                 var obj = this;
595                 try {
596                         var record = obj.network.simple_request( 'MODS_SLIM_RECORD_RETRIEVE', [ docid ]);
597                         if (record == null || typeof(record.ilsevent) != 'undefined') {
598                                 throw(record);
599                         } else {
600                                 var item = {
601                                         'retrieve_id' : js2JSON( { 'docid' : docid, 'bucket_item_id' : bucket_item_id } ),
602                                         'row' : {
603                                                 'my' : {
604                                                         'mvr' : record,
605                                                 }
606                                         }
607                                 };
608                                 return item;
609                         }
610                 } catch(E) {
611                         obj.error.standard_unexpected_error_alert('Could not retrieve this record: ' + docid,E);
612                         return null;
613                 }
614
615         },
616         
617 }
618
619 dump('exiting cat.record_buckets.js\n');