checked out display now shows the dummy title and author or pre-cataloged items when...
[Evergreen.git] / Open-ILS / web / opac / skin / default / js / myopac.js
1
2 attachEvt("common", "run", myOPACInit );
3 attachEvt("common", "loggedIn", myOPACInit );
4
5 attachEvt('common','locationUpdated', myopacReload );
6
7 var fleshedUser = null;
8 var fleshedContainers = {};
9
10
11 function clearNodes( node, keepArray ) {
12         if(!node) return;
13         for( var n in keepArray ) node.removeChild(keepArray[n]);
14         removeChildren(node);
15         for( var n in keepArray ) node.appendChild(keepArray[n]);
16 }
17
18 function myOPACInit() {
19         if(!(G.user && G.user.session)) initLogin();
20         else myOPACChangePage( "summary" );
21 }
22
23 function myopacReload() {
24         swapCanvas($('myopac_reloading'));
25         //alert($('myopac_reloading').className);
26         var a = {};
27         a[PARAM_LOCATION] = getNewSearchLocation();
28         a[PARAM_DEPTH] = getNewSearchDepth();
29         goTo(buildOPACLink(a, true));
30 }
31
32
33 function myOPACChangePage( page ) {
34         
35         var s = $("myopac_summary_td");
36         var c = $("myopac_checked_td");
37         var f = $("myopac_fines_td");
38         var h = $("myopac_holds_td");
39         var p = $("myopac_prefs_td");
40         var b = $('myopac_bookbag_td');
41
42         var ss = $("myopac_summary_div");
43         var cc = $("myopac_checked_div");
44         var ff = $("myopac_fines_div");
45         var hh = $("myopac_holds_div");
46         var pp = $("myopac_prefs_div");
47         var bb = $('myopac_bookbag_div');
48
49         var cls = "myopac_link";
50         var acls = "myopac_link_active";
51
52         hideMe(ss);
53         hideMe(cc); hideMe(ff);
54         hideMe(hh); hideMe(pp);
55         hideMe(bb);
56
57         removeCSSClass(s, acls );
58         removeCSSClass(c, acls );
59         removeCSSClass(f, acls );
60         removeCSSClass(h, acls );
61         removeCSSClass(p, acls );
62         removeCSSClass(b, acls );
63
64         switch( page ) {
65
66                 case "summary": 
67                         unHideMe(ss);
68                         addCSSClass(s, acls );
69                         myOPACShowSummary();
70                         break;
71
72                 case "checked": 
73                         unHideMe(cc);
74                         addCSSClass(c, acls );
75                         myOPACShowChecked();
76                         break;
77
78                 case "holds": 
79                         unHideMe(hh);
80                         addCSSClass(h, acls );
81                         myOPACShowHolds();
82                         break;
83
84                 case "fines": 
85                         unHideMe(ff);
86                         addCSSClass(f, acls );
87                         myOPACShowFines();
88                         break;
89
90                 case "prefs": 
91                         unHideMe(pp);
92                         addCSSClass(p, acls );
93                         myOPACShowPrefs();
94                         break;
95
96                 case 'bookbag':
97                         unHideMe(bb);
98                         addCSSClass(b, acls);
99                         myOPACShowBookbags();
100                         break;
101         }
102
103         /*
104         alert('Classes:\n' + s.className + '\n' + c.className + 
105                 '\n' + h.className + '\n' + f.className + '\n' + p.className);
106                 */
107 }
108
109 function myOPACShowChecked() {
110         if(checkedDrawn) return;
111         var req = new Request(FETCH_CHECKED_OUT_SLIM, G.user.session);  
112         req.callback(myOPACDrawCheckedOutSlim);
113         req.send();
114 }
115
116
117 var checkedRowTemplate;
118 var circsCache = new Array();
119 var checkedDrawn = false;
120
121 function myOPACDrawCheckedOutSlim(r) {
122
123         var checked                     = r.getResultObject();
124         var tbody                       = $("myopac_checked_tbody");
125         var loading                     = $("myopac_checked_loading");
126         var none                                = $("myopac_checked_none");
127
128         if(checkedDrawn) return;
129         checkedDrawn = true;
130         if(!checkedRowTemplate) 
131                 checkedRowTemplate = tbody.removeChild($("myopac_checked_row"));
132
133         clearNodes( tbody, [ loading, none ] );
134
135         hideMe(loading); /* remove all children and start over */
136         if(!(checked && checked[0])) unHideMe(none);
137
138         for( var idx in checked ) {
139
140                 var circ    = checked[idx]
141                 var row = checkedRowTemplate.cloneNode(true);
142                 row.id = 'myopac_checked_row_ ' + circ.id();
143
144                 var due = circ.due_date();
145       due = due.replace(/[0-9][0-9]:.*$/,"");
146
147                 var dlink = $n( row, "myopac_checked_due" );
148                 var rlink = $n( row, "myopac_checked_renewals" );
149                 var rnlink = $n( row, "myopac_checked_renew_link" );
150
151                 dlink.appendChild(text(due));
152                 rlink.appendChild(text(circ.renewal_remaining()));
153                 unHideMe(row);
154                 rnlink.setAttribute('href', 'javascript:myOPACRenewCirc("'+circ.id()+'");');
155                 circsCache.push(circ);
156
157                 tbody.appendChild(row);
158
159                 var req = new Request(FETCH_MODS_FROM_COPY, circ.target_copy() );
160                 req.request.circ = circ.id();
161                 req.request.copy = circ.target_copy();
162                 req.callback(myOPACDrawCheckedTitle);
163                 req.send();
164         }
165 }
166
167 function myOPACDrawCheckedTitle(r) {
168         var record = r.getResultObject();
169         var circid = r.circ;
170
171         if(!record || checkILSEvent(record)) {
172                 var req = new Request( FETCH_COPY, r.copy );
173                 req.request.circ = circid
174                 req.callback(myOPACDrawNonCatalogedItem);
175                 req.send();
176                 return;
177         }
178
179         var row = $('myopac_checked_row_ ' + circid);
180         var tlink = $n( row, "myopac_checked_title_link" );
181         var alink = $n( row, "myopac_checked_author_link" );
182         buildTitleDetailLink(record, tlink);
183         buildSearchLink(STYPE_AUTHOR, record.author(), alink);
184 }
185
186 function myOPACDrawNonCatalogedItem(r) {
187         var copy = r.getResultObject();
188         var circid = r.circ;
189         var row = $('myopac_checked_row_ ' + circid);
190         var tlink = $n( row, "myopac_checked_title_link" );
191         var alink = $n( row, "myopac_checked_author_link" );
192         //tlink.appendChild(text(copy.dummy_title()));
193         //alink.appendChild(text(copy.dummy_author()));
194
195         tlink.parentNode.appendChild(text(copy.dummy_title()));
196         alink.parentNode.appendChild(text(copy.dummy_author()));
197
198         /*
199         tlink.setAttribute('href', null);
200         alink.setAttribute('href', null);
201         alert(alink.getAttribute('href'));
202         */
203 }
204
205
206 function myOPACRenewCirc(circid) {
207         alert("Functionality currently under construction");
208         return;
209
210         var circ;
211         for( var i = 0; i != circsCache.length; i++ ) 
212                 if(circsCache[i].id() == circid)
213                         circ = circsCache[i];
214
215         var req = new Request(RENEW_CIRC, G.user.session, circ );
216         req.send(true);
217         var res = req.result();
218         if(res.status) {
219                 alert(res.text);
220                 return;
221         }
222         alert($('myopac_renew_success').innerHTML);     
223         checkedDrawn = false;
224         myOPACShowChecked();
225 }
226
227
228
229 function myOPACShowHolds() {
230         var req = new Request(FETCH_HOLDS, G.user.session, G.user.id());        
231         req.callback(myOPACDrawHolds);
232         req.send();
233 }
234
235 var holdsTemplateRowOrig;
236 var holdsTemplateRow;
237 function myOPACDrawHolds(r) {
238
239         var tbody = $("myopac_holds_tbody");
240         if(holdsTemplateRow) return;
241         if(holdsTemplateRowOrig) {
242                 holdsTemplateRow = holdsTemplateRowOrig;
243                 removeChildren(tbody);
244         } else {
245                 holdsTemplateRow = tbody.removeChild($("myopac_holds_row"));
246                 holdsTemplateRowOrig = holdsTemplateRow;
247         }
248
249         hideMe($('myopac_holds_loading'));
250
251         var holds = r.getResultObject();
252
253         if(!holds || holds.length < 1) unHideMe($('myopac_holds_none'));
254         for( var i = 0; i != holds.length; i++ ) {
255
256                 var h = holds[i];
257                 var row = holdsTemplateRow.cloneNode(true);
258                 row.id = "myopac_holds_row_" + h.id() + '_' + h.target();
259
260                 var formats = (h.holdable_formats()) ? h.holdable_formats() : null;
261                 var form = $n(row, "myopac_holds_formats");
262                 form.id = "myopac_holds_form_" + h.id() + '_' + h.target();
263                 if(formats) form.appendChild(text(formats));
264
265                 $n(row, "myopac_holds_location").
266                         appendChild(text(findOrgUnit(h.pickup_lib()).name()));
267                 $n(row, "myopac_holds_email_link").
268                         appendChild(text(h.email_notify()));
269                 $n(row, "myopac_holds_phone_link").
270                         appendChild(text(h.phone_notify()));
271                 tbody.appendChild(row);
272
273                 $n(row,'myopac_holds_cancel_link').setAttribute(
274                         'href','javascript:myOPACCancelHold("'+ h.id()+'");'); 
275                 unHideMe(row);
276
277                 myOPACDrawHoldTitle(h);
278         }
279 }
280
281 function myOPACCancelHold(holdid) {
282         if( confirm($('myopac_holds_cancel_verify').innerHTML) ) {
283                 holdsCancel(holdid);
284                 holdsTemplateRow = null
285                 myOPACShowHolds();
286         }
287 }
288
289
290
291 function myOPACDrawHoldTitle(hold) {
292         var method;
293         if(hold.hold_type() == "M") method = FETCH_MRMODS;
294         if(hold.hold_type() == "T") method = FETCH_RMODS;
295         var req = new Request(method, hold.target());
296         req.callback(myOPACFleshHoldTitle);
297         req.request.hold = hold.id();
298         req.send();
299 }
300
301 function myOPACFleshHoldTitle(r) {
302
303         var record = r.getResultObject();
304         var row = $("myopac_holds_row_" + r.hold + '_' + record.doc_id());
305         var title_link = $n(row, "myopac_holds_title_link");
306         var author_link = $n(row, "myopac_holds_author_link");
307
308         buildTitleDetailLink(record, title_link);
309         buildSearchLink(STYPE_AUTHOR, record.author(), author_link);
310
311         var form = $("myopac_holds_form_" + r.hold + '_' + record.doc_id());
312
313         if(form) {
314                 var img = elem("img");
315                 img.setAttribute("src", 
316                         buildImageLink('tor/' + record.types_of_resource()[0] + ".jpg"));
317                 addCSSClass(img, "myopac_form_pic");
318                 form.appendChild(img);
319         }
320 }
321
322 var finesShown = false;
323 function myOPACShowFines() {
324         if(finesShown) return; finesShown = true;
325         var req = new Request(FETCH_FINES_SUMMARY, G.user.session, G.user.id() );
326         req.callback(_myOPACShowFines);
327         req.send();
328 }
329
330 function _myOPACShowFines(r) {
331         hideMe($('myopac_fines_summary_loading'));
332         unHideMe($('myopac_fines_summary_row'));
333
334         var summary = r.getResultObject();
335         var total       = "0.00"; /* localization? */
336         var paid                = "0.00";
337         var balance = "0.00";
338         if( instanceOf(summary,mous) ) {
339
340                 total           = _finesFormatNumber(summary.total_owed());
341                 paid            = _finesFormatNumber(summary.total_paid());
342                 balance = _finesFormatNumber(summary.balance_owed());
343
344                 var req = new Request(FETCH_TRANSACTIONS, G.user.session, G.user.id() );
345                 req.callback(myOPACShowTransactions);
346                 req.send();
347         }
348
349         $('myopac_fines_summary_total').appendChild(text(total));
350         $('myopac_fines_summary_paid').appendChild(text(paid));
351         $('myopac_fines_summary_balance').appendChild(text(balance));
352 }
353
354 function _finesFormatNumber(num) {
355         if(isNull(num)) num = 0;
356         num = num + "";
357         if(num.length < 2 || !num.match(/\./)) num += ".00";
358         if(num.match(/\./) && num.charAt(num.length-2) == '.') num += "0";
359         return num;
360 }          
361
362 function _trimSeconds(time) { if(!time) return ""; return time.replace(/\..*/,""); }
363
364
365 var transTemplate;
366 function myOPACShowTransactions(r) {
367
368         if(transTemplate) return;
369         var tbody = $('myopac_fines_tbody');
370         unHideMe($('myopac_trans_table'));
371         transTemplate = tbody.removeChild($('myopac_trans_row'));
372
373         var transactions = r.getResultObject();
374
375         //alert(js2JSON(transactions));
376
377         for( var idx in transactions ) {
378
379                 var trans = transactions[idx].transaction;
380                 var record = transactions[idx].record;
381                 var row = transTemplate.cloneNode(transTemplate);
382
383                 $n(row,'myopac_trans_start').
384                         appendChild(text(_trimSeconds(trans.xact_start())));
385                 $n(row,'myopac_trans_last_bill').
386                         appendChild(text(_trimSeconds(trans.last_billing_ts())));
387                 $n(row,'myopac_trans_last_payment').
388                         appendChild(text(_trimSeconds(trans.last_payment_ts())));
389                 $n(row,'myopac_trans_init_amount').
390                         appendChild(text(_finesFormatNumber(trans.total_owed())));
391                 $n(row,'myopac_trans_total_paid').
392                         appendChild(text(_finesFormatNumber(trans.total_paid())));
393                 $n(row,'myopac_trans_balance').
394                         appendChild(text(_finesFormatNumber(trans.balance_owed())));
395
396                 var extra = "";
397                 var type = trans.xact_type();
398                 if(type == 'circulation') {
399                         unHideMe($('accrue_explanation'));
400                         unHideMe($n(row, 'myopac_trans_balance_recur'));
401                 }
402                 $n(row,'myopac_trans_type').appendChild(text(type));
403                 if( type == "circulation" ) extra = record.title();
404                 $n(row, 'myopac_trans_extra').appendChild(text(extra));
405
406                 tbody.appendChild(row);
407         }
408 }
409
410 function myOPACSavePrefs() {
411         G.user.prefs[PREF_HITS_PER] = getSelectorVal($('prefs_hits_per'));
412         if(commitUserPrefs())
413                 alert($('prefs_update_success').innerHTML);
414         else alert($('prefs_update_failure').innerHTML);
415 }
416
417
418 function myOPACShowPrefs() {
419         grabUserPrefs();
420         myOPACShowHitsPer();
421         hideMe($('myopac_prefs_loading'));
422         unHideMe($('myopac_prefs_row'));
423 }
424
425 function myOPACShowHitsPer() {
426         var hits = 10;
427         if(G.user.prefs[PREF_HITS_PER])
428                 hits = G.user.prefs[PREF_HITS_PER];
429         var hitsSel = $('prefs_hits_per');
430         setSelector(hitsSel, hits);
431 }
432
433 var userShown = false;
434 function myOPACShowSummary() {
435         if(userShown) return; userShown = true;
436         var req = new Request(FETCH_FLESHED_USER,G.user.session, G.user.id());
437         req.callback(_myOPACSummaryShowUer);
438         req.send();
439 }
440
441 var addrRowTemplate;
442 function _myOPACSummaryShowUer(r) {
443
444         var user = r.getResultObject();
445         fleshedUser = user;
446
447         appendClear($('myopac_summary_first'),text(user.first_given_name()));
448         appendClear($('myopac_summary_middle'),text(user.second_given_name()));
449         appendClear($('myopac_summary_dayphone'),text(user.day_phone()));
450         appendClear($('myopac_summary_eveningphone'),text(user.evening_phone()));
451         appendClear($('myopac_summary_otherphone'),text(user.other_phone()));
452         appendClear($('myopac_summary_last'),text(user.family_name()));
453         appendClear($('myopac_summary_username'),text(user.usrname()));
454         appendClear($('myopac_summary_email'),text(user.email()));
455         appendClear($('myopac_summary_barcode'),text(user.card().barcode()));
456         appendClear($('myopac_summary_ident1'),text(user.ident_value()));
457         appendClear($('myopac_summary_ident2'),text(user.ident_value2()));
458         appendClear($('myopac_summary_homelib'),text(findOrgUnit(user.home_ou()).name()));
459         appendClear($('myopac_summary_create_date'),text(user.create_date()));
460
461         var tbody = $('myopac_addr_tbody');
462         var template;
463
464         if(addrRowTemplate) { 
465                 template = addrRowTemplate;
466         } else {
467                 template = tbody.removeChild($('myopac_addr_row'));
468                 addrRowTemplate = template;
469         }
470         removeChildren(tbody);
471
472         for( var a in user.addresses() ) {
473                 var row = template.cloneNode(true);
474                 myOPACDrawAddr(row, user.addresses()[a]);
475                 tbody.appendChild(row);
476         }
477 }
478
479 function myOPACDrawAddr(row, addr) {
480
481         appendClear($n(row, 'myopac_addr_type'),text(addr.address_type()));
482         var street = (addr.street2()) ? addr.street1() + ", " + addr.street2() : addr.street1();
483         appendClear($n(row, 'myopac_addr_street'),text(street));
484         appendClear($n(row, 'myopac_addr_city'),text(addr.city()));
485         appendClear($n(row, 'myopac_addr_county'),text(addr.county()));
486         appendClear($n(row, 'myopac_addr_state'),text(addr.state()));
487         appendClear($n(row, 'myopac_addr_zip'),text(addr.post_code()));
488 }
489
490
491 function myOPACUpdateUsername() {
492         var username = $('myopac_new_username').value;
493         if(username == null || username == "") {
494                 alert($('myopac_username_error').innerHTML);
495                 return;
496         }
497         var req = new Request(UPDATE_USERNAME, G.user.session, username );
498         req.send(true);
499         if(req.result()) {
500
501                 var evt;
502                 if(evt = checkILSEvent(req.result())) {
503                         alertILSEvent(evt);
504                         return;
505                 }
506
507                 G.user.usrname(username);
508                 hideMe($('myopac_update_username_row'));
509                 userShown = false;
510                 myOPACShowSummary();
511                 return;
512         }
513
514         alert($('myopac_username_failure').innerHTML);
515 }
516
517 function myOPACUpdateEmail() {
518         var email = $('myopac_new_email').value;
519         if(email == null || email == "") {
520                 alert($('myopac_email_error').innerHTML);
521                 return;
522         }
523
524         var req = new Request(UPDATE_EMAIL, G.user.session, email );
525         req.send(true);
526         if(req.result()) {
527                 G.user.usrname(email);
528                 hideMe($('myopac_update_email_row'));
529                 userShown = false;
530                 myOPACShowSummary();
531                 return;
532         }
533
534         alert($('myopac_email_failure').innerHTML);
535 }
536
537
538 function myOPACUpdatePassword() {
539         var curpassword = $('myopac_current_password').value;
540         var password = $('myopac_new_password').value;
541         var password2 = $('myopac_new_password2').value;
542
543         if(     curpassword == null || curpassword == "" || 
544                         password == null || password == "" || 
545                         password2 == null || password2 == "" || password != password2 ) {
546                 alert($('myopac_password_error').innerHTML);
547                 return;
548         }
549
550         var req = new Request(UPDATE_PASSWORD, G.user.session, password, curpassword );
551         req.send(true);
552         if(req.result()) {
553                 G.user.usrname(password);
554                 hideMe($('myopac_update_password_row'));
555                 userShown = false;
556                 myOPACShowSummary();
557                 return;
558         }
559
560         alert($('myopac_password_failure').innerHTML);
561 }
562
563
564
565
566 var containerTemplate;
567 function myOPACShowBookbags(force) {
568
569         var tbody =$('myopac_bookbag_tbody') ;
570
571         if(!containerTemplate) 
572                 containerTemplate = tbody.removeChild($('myopac_bookbag_tr'));
573         else if(!force) return;
574
575         removeChildren(tbody);
576
577         var containers = containerFetchAll();
578
579         var found = false;
580         for( var i in containers ) {
581                 found = true;
582                 var cont = containers[i];
583                 var row = containerTemplate.cloneNode(true);
584                 row.id = 'myopac_bookbag_row_' + cont.id();
585                 var link = $n(row, 'myopac_expand_bookbag');
586                 var dlink = $n(row, 'myopac_container_delete');
587                 link.appendChild( text(cont.name()) );
588                 link.setAttribute('href', 
589                         'javascript:myOPACExpandBookbag("' + cont.id() + '","' + cont.name() + '");');
590                 myOPACFetchBBItems( cont.id(), row );
591                 dlink.setAttribute('href', 'javascript:myOPACDeleteBookbag("'+cont.id()+'");');
592
593                 if( cont.pub() ) {
594                         unHideMe($n(row, 'myopac_bb_published_yes'));
595                         var link = $n(row, 'myopac_bb_published_view');
596                         link.setAttribute('href', buildExtrasLink( 'bbags.xml?bb='+cont.id(), false));  
597                         link.setAttribute('target', '_blank' );
598                         unHideMe(link);
599
600                 } else { 
601                         unHideMe($n(row, 'myopac_bb_published_no')); 
602                 }
603
604                 tbody.appendChild(row); 
605         }
606
607         if(!found) unHideMe($('myopac_bookbags_none'));
608         else unHideMe($('myopac_bookbag_table'));       
609 }
610
611 function myOPACDeleteBookbag(id) {
612         if( confirm( $('myopac_delete_bookbag_warn').innerHTML ) ) {
613                 var result = containerDelete(id);
614                 var code = checkILSEvent(result);
615                 if(code) { alertILSEvent(code); return; }
616                 hideMe($('myopac_bookbag_items_table'));
617                 hideMe($('myopac_bookbag_items_name'));
618                 hideMe($('myopac_bookbag_no_items'));
619                 myOPACShowBookbags(true);
620         }
621 }
622
623 function myOPACFetchBBItems( id, row, block ) {
624         if(!block) {
625                 containerFlesh( id, _myOPACSetBBItems, { row: row }  );
626         } else {
627                 var cont = containerFlesh(id);
628                 myOPACSetBBItems( cont, row );
629         }
630 }
631
632 function _myOPACSetBBItems(r) { myOPACSetBBItems( r.getResultObject(), r.args.row ); }
633
634 function myOPACSetBBItems( container, row ) {
635         fleshedContainers[container.id()] = container;
636         var node = $n(row, 'myopac_bookbag_item_count');
637         removeChildren(node);
638         node.appendChild( text(container.items().length) );
639 }
640
641 var BBItemsRow;
642 function myOPACExpandBookbag( id, name ) {
643         
644         var tbody = $('myopac_bookbag_items_tbody');
645         if(!BBItemsRow) BBItemsRow = tbody.removeChild($('myopac_bookbag_items_row'));
646         removeChildren(tbody);
647         removeChildren($('myopac_bookbag_items_name'));
648
649         $('myopac_bookbag_items_name').appendChild(text(name));
650
651         if( fleshedContainers[id] ) {
652                 var len = fleshedContainers[id].items().length;
653
654                 if( len == 0 ) {
655                         unHideMe($('myopac_bookbag_no_items'));
656                         hideMe($('myopac_bookbag_items_table'));
657                         return;
658                 }
659
660                 hideMe($('myopac_bookbag_no_items'));
661                 unHideMe($('myopac_bookbag_items_table'));
662
663                 for( var i = 0; i != len; i++ ) {
664                         var row = BBItemsRow.cloneNode(true);
665                         found = true;
666
667                         var item = fleshedContainers[id].items()[i];
668                         var tlink = $n(row,'myopac_bookbag_items_title');
669                         var alink = $n(row,'myopac_bookbag_items_author');
670
671                         var req = new Request( FETCH_RMODS, item.target_biblio_record_entry() );
672                         req.request.tlink = tlink;
673                         req.request.alink = alink;
674                         req.callback(myOPACShowBBItem);
675                         req.send();
676
677                         var clink = $n(row, 'myopac_bookbag_items_remove');
678                         clink.setAttribute('href', 'javascript:myOPACRemoveBBItem("'+item.id()+'","'+id+'","'+name+'");');
679
680                         tbody.appendChild(row);
681                 }
682         }
683 }
684
685 function myOPACRemoveBBItem( id, containerid, container_name ) {
686         containerRemoveItem( id );
687         myOPACFetchBBItems( containerid, $('myopac_bookbag_row_' + containerid), true);
688         myOPACExpandBookbag( containerid, container_name );
689 }
690
691 function myOPACShowBBItem(r) {
692         var record = r.getResultObject();
693         buildTitleDetailLink(record, r.tlink);
694         buildSearchLink(STYPE_AUTHOR, record.author(), r.alink);
695 }
696
697 function myOPACCreateBookbag() {
698         var name = $('myopac_bookbag_new_name').value;  
699         if(!name) return;
700         var result = containerCreate( name, $('bb_public_yes').checked );
701         var code = checkILSEvent(result);
702         if(code) { alertILSEvent(code); return; }
703         myOPACShowBookbags(true);
704 }
705
706