3 if(findCurrentPage()==RDETAIL){
\r
4 detachAllEvt('common', 'run');
\r
5 attachEvt("common", "run", rdetailDraw);
\r
6 attachEvt("rdetail", "recordDrawn", rdetailBuildStatusColumns);
\r
7 attachEvt("rdetail", "recordDrawn", rdetailBuildInfoRows);
\r
8 attachEvt("rdetail", "recordDrawn", rdetailGetPageIds);
\r
10 /* Per-skin configuration settings */
\r
11 var rdetailLocalOnly = true;
\r
12 var rdetailShowLocal = true;
\r
13 var rdetailShowCopyLocation = true;
\r
14 var rdetailGoogleBookPreview = false;
\r
15 var rdetailDisplaySerialHoldings = true;
\r
16 var rdetailEnableRefWorks = false;
\r
17 var rdetailRefWorksHost = 'http://www.refworks.com';
\r
19 /* vars vars vars */
\r
21 var cp_statuses = null;
\r
22 var recordsCache = [];
\r
24 var copyRowParent = null;
\r
26 var statusRow = null;
\r
27 var numStatuses = null;
\r
29 var callnumberCache = {};
\r
30 var globalCNCache = {};
\r
33 var _statusPositions = {};
\r
36 var nextContainerIndex;
\r
41 var rdetailPrev = null;
\r
42 var rdetailNext = null;
\r
43 var rdetailStart = null;
\r
44 var rdetailEnd = null;
\r
46 /* serials are currently the only use of Dojo strings in the OPAC */
\r
47 if (rdetailDisplaySerialHoldings) {
\r
48 dojo.require("dijit.Menu");
\r
49 dojo.require("dijit.form.Button");
\r
50 dojo.requireLocalization("openils.opac", "opac");
\r
51 opac_strings = dojo.i18n.getLocalization("openils.opac", "opac");
\r
55 function rdetailReload() {
\r
57 args[PARAM_LOCATION] = getNewSearchLocation();
\r
58 args[PARAM_DEPTH] = depthSelGetDepth();
\r
59 goTo(buildOPACLink(args));
\r
62 /* looks to see if we have a next and/or previous record in the
\r
63 record cache, if so, set up the nav links */
\r
64 function rdetailSetPaging(ids) {
\r
67 cachedRecords.ids = ids;
\r
69 for( var i = 0; i < cachedRecords.ids.length; i++ ) {
\r
70 var rec = cachedRecords.ids[i];
\r
71 if( rec == getRid() ) {
\r
72 if( i > 0 ) prevRecord = cachedRecords.ids[i-1];
\r
73 if( i < cachedRecords.ids.length - 1 )
\r
74 nextRecord = cachedRecords.ids[i+1];
\r
79 $('np_offset').appendChild(text(i + 1));
\r
80 $('np_count').appendChild(text(getHitCount()));
\r
83 unHideMe($('np_table'));
\r
84 unHideMe($('np_prev'));
\r
85 unHideMe($('np_start'));
\r
86 rdetailPrev = function() { _rdetailNav(prevRecord); };
\r
87 rdetailStart = function() { _rdetailNav(cachedRecords.ids[0]); };
\r
91 unHideMe($('np_table'));
\r
92 unHideMe($('np_next'));
\r
93 unHideMe($('np_end'));
\r
94 rdetailNext = function() { _rdetailNav(nextRecord); };
\r
95 rdetailEnd = function() { _rdetailNav(cachedRecords.ids[cachedRecords.ids.length-1]); };
\r
98 runEvt('rdetail', 'nextPrevDrawn', i, cachedRecords.ids.length);
\r
102 function _rdetailNav(id, offset) {
\r
104 args[PARAM_RID] = id;
\r
105 goTo(buildOPACLink(args));
\r
108 function rdetailDraw() {
\r
110 detachAllEvt('common','depthChanged');
\r
111 detachAllEvt('common','locationUpdated');
\r
112 attachEvt('common','depthChanged', rdetailReload);
\r
113 attachEvt('common','locationUpdated', rdetailReload);
\r
114 attachEvt('common','holdUpdated', rdetailReload);
\r
115 attachEvt('common','holdUpdateCanceled', rdetailReload);
\r
117 copyRowParent = G.ui.rdetail.cp_info_row.parentNode;
\r
118 copyRow = copyRowParent.removeChild(G.ui.rdetail.cp_info_row);
\r
119 statusRow = G.ui.rdetail.cp_status.parentNode;
\r
120 statusRow.id = '__rdsrow';
\r
122 G.ui.rdetail.cp_info_local.onclick = rdetailShowLocalCopies;
\r
123 G.ui.rdetail.cp_info_all.onclick = rdetailShowAllCopies;
\r
125 if(getLocation() == globalOrgTree.id())
\r
126 hideMe(G.ui.rdetail.cp_info_all);
\r
129 var req = new Request(FETCH_RMODS, getRid());
\r
130 req.callback(_rdetailDraw);
\r
133 } else { // No record ID was specified
\r
135 // If we have an ISBN in the URL, let's try to find that record
\r
136 // This allows direct linking by ISBN.
\r
137 // Note, this uses the first record it finds
\r
138 if(getRtype() == RTYPE_ISBN) {
\r
139 var req = new Request(FETCH_ADV_ISBN_RIDS, getAdvTerm());
\r
142 var blob = r.getResultObject();
\r
143 if(blob && blob.count > 0)
\r
145 var req2 = new Request(FETCH_RMODS, getRid());
\r
146 req2.callback(_rdetailDraw);
\r
155 if (rdetailDisplaySerialHoldings) {
\r
156 var req = new Request(FETCH_MFHD_SUMMARY, getRid());
\r
157 req.callback(_holdingsDraw);
\r
160 var here = findOrgUnit(getLocation());
\r
161 dojo.place("<div id='mfhd_ad_menu' class='hide_me'></div>", "rdetail_details_table", "after");
\r
162 var mfhd_add = new dijit.Menu({style:"float: right;"});
\r
163 new dijit.MenuItem({onClick:function(){
\r
164 var req = new Request(CREATE_MFHD_RECORD, G.user.session, 1, here.id(), getRid());
\r
165 var res = req.send();
\r
166 alert(dojo.string.substitute(opac_strings.CREATED_MFHD_RECORD, [here.name()]));
\r
167 }, label:opac_strings.CREATE_MFHD}).placeAt(mfhd_add);
\r
168 mfhd_add.placeAt('mfhd_ad_menu');
\r
172 detachAllEvt("result", "idsReceived");
\r
173 G.evt.result.hitCountReceived = [];
\r
174 G.evt.result.recordReceived = [];
\r
175 G.evt.result.copyCountsReceived = [];
\r
176 G.evt.result.allRecordsReceived = [];
\r
177 //unHideMe($('rdetail_copy_info_link'));
\r
180 function rdetailGetPageIds() {
\r
181 attachEvt("result", "idsReceived", rdetailSetPaging );
\r
182 resultFetchAllRecords = true;
\r
183 rresultCollectIds(true);
\r
187 function buildunAPISpan (span, type, id) {
\r
188 var cgi = new CGI();
\r
189 var d = new Date();
\r
191 addCSSClass(span,'unapi-id');
\r
194 'title', 'tag:' + cgi.server_name + ',' +
\r
195 d.getFullYear() + ':' + type + '/' + id
\r
199 function rdetailViewMarc(r,id) {
\r
200 hideMe($('rdetail_extras_loading'));
\r
201 $('rdetail_view_marc_box').innerHTML = r.getResultObject();
\r
203 var div = elem('div', { "class" : 'hide_me' });
\r
204 var span = div.appendChild( elem('abbr') );
\r
206 buildunAPISpan( span, 'biblio-record_entry', record.doc_id() );
\r
208 $('rdetail_view_marc_box').insertBefore(span, $('rdetail_view_marc_box').firstChild);
\r
212 function rdetailShowLocalCopies() {
\r
213 rdetailShowLocal = true;
\r
214 rdetailBuildInfoRows();
\r
215 hideMe(G.ui.rdetail.cp_info_local);
\r
216 unHideMe(G.ui.rdetail.cp_info_all);
\r
217 hideMe(G.ui.rdetail.cp_info_none);
\r
220 function rdetailShowAllCopies() {
\r
222 rdetailShowLocal = false;
\r
223 rdetailBuildInfoRows();
\r
224 hideMe(G.ui.rdetail.cp_info_all);
\r
225 unHideMe(G.ui.rdetail.cp_info_local);
\r
226 hideMe(G.ui.rdetail.cp_info_none);
\r
229 function OpenMarcEditWindow(pcrud, rec) {
\r
231 To run in Firefox directly, must set signed.applets.codebase_principal_support
\r
232 to true in about:config
\r
234 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
\r
235 win = window.open('/xul/server/cat/marcedit.xul'); // XXX version?
\r
236 dojo.require('openils.PermaCrud');
\r
239 "record": {"marc": rec.marc()},
\r
241 "label": opac_strings.SAVE_MFHD_LABEL,
\r
242 "func": function(xmlString) {
\r
243 rec.marc(xmlString);
\r
244 rec.ischanged(true);
\r
251 function loadMarcEditor(recId) {
\r
252 var pcrud = new openils.PermaCrud({"authtoken": G.user.session});
\r
253 var rec = pcrud.retrieve("sre", recId);
\r
255 OpenMarcEditWindow(pcrud, rec);
\r
260 * This function could be written much more intelligently
\r
261 * Limited brain power means that I'm brute-forcing it for now
\r
263 function _holdingsDraw(h) {
\r
264 holdings = h.getResultObject();
\r
265 if (!holdings) { return null; }
\r
267 dojo.forEach(holdings, _holdingsDrawMFHD);
\r
271 function _holdingsDrawMFHD(holdings, entryNum) {
\r
273 var here = findOrgUnit(getLocation());
\r
274 if (getDepth() > 0 || getDepth === 0 ) {
\r
275 while (getDepth() < findOrgDepth(here))
\r
276 here = findOrgUnit( here.parent_ou() );
\r
277 if (!orgIsMine(findOrgUnit(here), findOrgUnit(holdings.owning_lib()))) {
\r
282 var hh = holdings.holdings();
\r
283 var hch = holdings.current_holdings();
\r
284 var hs = holdings.supplements();
\r
285 var hcs = holdings.current_supplements();
\r
286 var hi = holdings.indexes();
\r
287 var hci = holdings.current_indexes();
\r
288 var ho = holdings.online();
\r
289 var hm = holdings.missing();
\r
290 var hinc = holdings.incomplete();
\r
291 var hloc = holdings.location() || 'MFHD';
\r
293 if ( hh.length == 0 && hch.length == 0 && hs.length == 0 &&
\r
294 hcs.length == 0 && hi.length == 0 && hci.length == 0 &&
\r
295 ho.length == 0 && hm.length == 0 && hinc.length == 0
\r
300 * If we have a record, but nothing to show for it, then the
\r
301 * record is likely empty or corrupt. This gives cataloguers a
\r
302 * chance to add holdings or correct the record
\r
304 hh = 'PLACEHOLDER';
\r
310 dojo.place("<table style='width: 100%;'><caption id='mfhdHoldingsCaption" + entryNum + "' class='rdetail_header color_1'>" +
\r
311 dojo.string.substitute(opac_strings.HOLDINGS_TABLE_CAPTION, [hloc]) +
\r
312 "</caption><tbody id='rdetail_holdings_tbody_" + entryNum +
\r
313 "'></tbody></table>", "rdetail_details_table", "after"
\r
315 if (hh.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.HOLDINGS, hh); }
\r
316 if (hch.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.CURRENT_HOLDINGS, hch); }
\r
317 if (hs.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.SUPPLEMENTS, hs); }
\r
318 if (hcs.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.CURRENT_SUPPLEMENTS, hcs); }
\r
319 if (hi.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.INDEXES, hi); }
\r
320 if (hci.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.CURRENT_INDEXES, hci); }
\r
321 if (ho.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.ONLINE_VOLUMES, ho); }
\r
322 if (hm.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.MISSING_VOLUMES, hm); }
\r
323 if (hinc.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.INCOMPLETE_VOLUMES, hinc); }
\r
326 dojo.require('openils.Event');
\r
327 dojo.require('openils.PermaCrud');
\r
328 var mfhd_edit = new dijit.Menu({});
\r
329 new dijit.MenuItem({onClick: function(){loadMarcEditor(holdings.id())}, label:opac_strings.EDIT_MFHD_RECORD}).placeAt(mfhd_edit, "first");
\r
330 new dijit.MenuItem({onClick:function(){
\r
331 var pcrud = new openils.PermaCrud({"authtoken": G.user.session});
\r
332 var mfhd_rec = pcrud.retrieve("sre", holdings.id());
\r
334 pcrud.eliminate(mfhd_rec);
\r
335 alert(dojo.string.substitute(opac_strings.DELETED_MFHD_RECORD, [holdings.id()]));
\r
337 }, label:opac_strings.DELETE_MFHD}).placeAt(mfhd_edit, "last");
\r
338 // new dijit.MenuItem({onClick:function(){alert("Edit properties " + holdings.id());}, label:opac_strings.EDIT_PROPERTIES}).placeAt(mfhd_edit, "last");
\r
339 var mfhd_mb = new dijit.form.DropDownButton({dropDown: mfhd_edit, label:opac_strings.EDIT_MFHD_MENU, style:"float:right"});
\r
340 mfhd_mb.placeAt("mfhdHoldingsCaption" + entryNum, "last");
\r
341 mfhd_edit.startup();
\r
345 function _holdingsDrawMFHDEntry(entryNum, entryName, entry) {
\r
346 var flatEntry = entry.toString().replace(/,/g, ', ');
\r
347 dojo.place("<tr><td> </td><td nowrap='nowrap' class='rdetail_desc'>" + entryName + "</td><td class='rdetail_item'>" + flatEntry + "</td></tr>", "rdetail_holdings_tbody_" + entryNum, "last");
\r
350 function _rdetailDraw(r) {
\r
351 record = r.getResultObject();
\r
353 runEvt('rdetail', 'recordRetrieved', record.doc_id());
\r
355 if(isInAnonList(parseInt(record.doc_id()))) {
\r
356 $('add_mylist').innerHTML = '';
\r
357 $('add_mylist').appendChild(elem('img', {src:'/opac/skin/kcls/graphics/add_mylist_sel.gif'}, null));
\r
360 G.ui.rdetail.title.appendChild(text(record.title()));
\r
361 buildSearchLink(STYPE_AUTHOR, record.author(), G.ui.rdetail.author);
\r
362 if(record.isbn()) { unHideMe($('rdetail_isbn_lbl')); G.ui.rdetail.isbn.appendChild(text(cleanISBN(record.isbn()))); }
\r
363 if(record.edition()) { unHideMe($('rdetail_ed_lbl')); G.ui.rdetail.edition.appendChild(text(record.edition())); }
\r
364 if(record.pubdate()) { unHideMe($('rdetail_pubdate_lbl')); G.ui.rdetail.pubdate.appendChild(text(record.pubdate())); }
\r
365 if(record.publisher()) { unHideMe($('rdetail_pub_lbl')); G.ui.rdetail.publisher.appendChild(text(record.publisher())); }
\r
366 if(record.physical_description()) { unHideMe($('rdetail_phys_lbl')); $('rdetail_physical_desc').appendChild(text(record.physical_description())); }
\r
367 $('rd_reviews_and_more').href="http://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=KC72927&Password=CC14647&ItemKey="+cleanISBN(record.isbn())+"&Options=Y";
\r
369 var code = getMarcData(record.doc_id(),"998","d");
\r
371 if(code) { unHideMe($('rdetail_form_lbl')); G.ui.rdetail.tor.innerHTML = get998dValue(code); }
\r
372 if(record.synopsis()) { unHideMe($('rdetail_sum_lbl')); G.ui.rdetail.abstr.appendChild(text(record.synopsis())); }
\r
373 //javascript: alert(getMarcData(22531007,"998","d"));
\r
375 if(record.isbn()) {
\r
376 if(ENABLE_ADDED_CONTENT_ATTRIB_LINKS) {
\r
377 unHideMe($('rdetail.jacket_attrib_div'));
\r
378 var href = $('rdetail.jacket_attrib_link').getAttribute('href') +cleanISBN(record.isbn());
\r
379 $('rdetail.jacket_attrib_link').setAttribute('href', href);
\r
381 rdetailCheckForGBPreview();
\r
384 //hideMe($("rdetail.jacket_attrib_div"));
\r
385 //hideMe($("rdetail_img_link"));
\r
390 // see if the record has any external links
\r
391 var links = record.online_loc();
\r
392 for( var i = 0; links && links.length > 0 && i < links.length; i = i + 3 ) {
\r
393 var href = links[i];
\r
394 // avoid matching "HTTP: The Complete Reference"
\r
395 if( href.match(/https?:\/|ftps?:\/|mailto:/i) ) {
\r
396 unHideMe($('rdetail_online_row'));
\r
397 // MODS can contain a display label (used for the text of the link)
\r
398 // as well as a note about the URL; many legacy systems conflate the
\r
399 // two and generate MARC records that expect the note to be used as
\r
400 // the text of the link, with no display label; here's the canonical
\r
403 // 856 40 $uhttp://localhost$yDisplay label$zPublic note
\r
405 // Note that the MARC21slim2MODS XSL concatenates $3 and $y together
\r
406 // (as $y was defined later in MARC21's life as the display label)
\r
407 var displayLabel = '' + links[i+1];
\r
408 var note = '' + links[i+2];
\r
409 if(!displayLabel || displayLabel.match(/https?:\/|ftps?:\/|mailto:/i)) {
\r
410 if(!note || note.match(/https?:\/|ftps?:\/|mailto:/i)) {
\r
411 displayLabel = href;
\r
413 displayLabel = note;
\r
416 $('rdetail_online').appendChild(elem('a', {href:href,'class':'classic_link'}, displayLabel));
\r
417 if (note && note != displayLabel) {
\r
418 $('rdetail_online').appendChild(elem('span', {'class':'url_note'}, ' - ' + note));
\r
420 $('rdetail_online').appendChild(elem('br'));
\r
424 // Fill in our unAPI ID, if anyone cares
\r
425 var abbrs = document.getElementsByTagName('abbr');
\r
427 for (var i = 0; i < abbrs.length; i = i + 1) {
\r
428 if (abbrs[i].getAttribute('name') == 'unapi') {
\r
433 buildunAPISpan( span, 'biblio-record_entry', record.doc_id() );
\r
435 $('rdetail_place_hold').setAttribute(
\r
436 'href','javascript:holdsDrawEditor({record:"'+record.doc_id()+'",type:"T"});');
\r
438 var RW = $('rdetail_exp_refworks');
\r
439 if (RW && rdetailEnableRefWorks) {
\r
441 var here = (findOrgUnit(getLocation())).name();
\r
442 var org_name = here.replace(" ", "+");
\r
443 var cgi = new CGI();
\r
447 rdetailRefWorksHost + '/express/expressimport.asp?vendor='
\r
449 + '&filter=MARC+Format&database=All+MARC+Formats&encoding=65001&url=http%3A%2F%2F'
\r
450 + cgi.server_name + '/opac/extras/supercat/marctxt/record/'
\r
454 RW.setAttribute('target', 'RefWorksMain');
\r
456 unHideMe($('rdetail_exp_refworks_span'));
\r
459 //$('rdetail_img_link').setAttribute('href', buildISBNSrc(cleanISBN(record.isbn()), 'large'));
\r
460 //G.ui.rdetail.image.setAttribute("src", buildISBNSrc(cleanISBN(record.isbn())));
\r
461 runEvt("rdetail", "recordDrawn");
\r
462 recordsCache.push(record);
\r
464 rdetailSetExtrasSelector();
\r
466 var breq = new Request(FETCH_BRE, [getRid()]);
\r
467 breq.callback( rdetailCheckDeleted );
\r
470 //resultBuildCaches( [ record ] );
\r
471 //resultDrawSubjects();
\r
472 //resultDrawSeries();
\r
474 // grab added content
\r
475 acCollectData(cleanISBN(record.isbn()), rdetailhandleAC);
\r
477 var currentISBN = cleanISBN(record.isbn());
\r
480 if (chilifresh && chilifresh != '(none)' && currentISBN) {
\r
481 $('chilifreshReviewLink').setAttribute('id','isbn_'+currentISBN);
\r
482 $('chilifreshReviewResult').setAttribute('id','chili_review_'+currentISBN);
\r
483 unHideMe($('rdetail_reviews_link'));
\r
484 unHideMe($('rdetail_chilifresh_reviews'));
\r
489 hideMe($('rdetail_reviews_link'));
\r
490 hideMe($('rdetail_chilifresh_reviews'));
\r
494 var it = getCacheValue('showHoldEditor');
\r
496 setCacheValue('showHoldEditor', null);
\r
497 holdsDrawEditor({record:it.record, type:it.type});
\r
500 if (novelist && currentISBN) {
\r
501 unHideMe($('rdetail_novelist_link'));
\r
507 function rdetailCheckDeleted(r) {
\r
508 var br = r.getResultObject()[0];
\r
509 if( isTrue(br.deleted()) ) {
\r
510 hideMe($('rdetail_place_hold'));
\r
511 $('rdetail_more_actions_selector').disabled = true;
\r
512 unHideMe($('rdetail_deleted_exp'));
\r
516 function rdetailSetExtrasSelector() {
\r
517 if(!grabUser()) return;
\r
518 unHideMe($('rdetail_more_actions'));
\r
520 var req = new Request(
\r
521 FETCH_CONTAINERS, G.user.session, G.user.id(), 'biblio', 'bookbag' );
\r
522 req.callback(rdetailAddBookbags);
\r
526 var myListsFetched = false;
\r
527 var selectedItem = null;
\r
528 function addMyList(id) {
\r
529 if(!id) id = record.doc_id();
\r
530 //if(!grabUser()) { alert("Please login first"); goTo(buildOPACLink({page:MYOPAC}, false, true)); return; }
\r
532 var holdsLink = $n($('result_table_template_'+id), 'result_my_list_link');
\r
533 if(!holdsLink) holdsLink = $('add_mylist');
\r
534 var lbl = $('myListLabel');
\r
536 if(_resultFindRec) title = _resultFindRec(id);
\r
537 if(title) title = title.title();
\r
538 if(lbl) lbl.innerHTML = title; else lbl.innerHTML = "";
\r
540 //if(!grabUser()) {
\r
541 isCacheListDrawn = false;
\r
542 for(var i in anonListCache) {
\r
543 if(anonListCache[i] == id) {
\r
544 anonListCache.splice(i, 1);
\r
545 setCacheValue('anonListCache', anonListCache);
\r
546 if(!anonListCache.length) hideMe($('cacheListLink'));
\r
548 holdsLink.innerHTML = '';
\r
549 holdsLink.appendChild(elem('img', {src:'/opac/skin/kcls/graphics/add_mylist.gif'}, null));
\r
550 holdsLink.title = "Add to my list";
\r
556 anonListCache.push(id);
\r
557 setCacheValue('anonListCache', anonListCache);
\r
558 unHideMe($('cacheListLink'));
\r
560 holdsLink.innerHTML = '';
\r
561 holdsLink.appendChild(elem('img', {src:'/opac/skin/kcls/graphics/add_mylist_sel.gif'}, null));
\r
562 holdsLink.title = "Remove from my list";
\r
568 var selector = $('mylist_selector');
\r
570 if(findCurrentPage()==RDETAIL) {
\r
571 unHideMe($('rdetail_more_actions_selector'));
\r
572 } else if(findCurrentPage()==RRESULT) {
\r
573 hideResultsPage(true);
\r
574 unHideMe($('mylist_div'));
\r
576 if(!myListsFetched) {
\r
577 myListsFetched = true;
\r
578 var req = new Request(FETCH_CONTAINERS, G.user.session, G.user.id(), 'biblio', 'bookbag' );
\r
579 req.callback(showMyLists);
\r
584 function saveMyList() {
\r
585 if(!selectedItem) return true;
\r
586 var newList = $('mylist_new');
\r
587 if(!newList) return true;
\r
589 var selector = $('mylist_selector');
\r
590 if(!selector.options.length && !newList.value) { alert('Please choose a name for the new list'); newList.focus(); return false; }
\r
592 if(newList.value) {
\r
594 var name = newList.value
\r
595 if(id = containerCreate(name)) {
\r
596 selector.options.length=0;
\r
597 if(!selector.options.length) {
\r
598 unHideMe($('myListSelect'));
\r
599 var req = new Request(FETCH_CONTAINERS, G.user.session, G.user.id(), 'biblio', 'bookbag' );
\r
600 req.callback(showMyLists);
\r
603 if(containerCreateItem(id, selectedItem)) {
\r
604 alert('Item successfully added to list');
\r
605 newList.value = "";
\r
606 } else { return false; }
\r
607 } else { return false; }
\r
608 } else { //save to selected list
\r
609 var selectedID = selector.options[selector.selectedIndex].value;
\r
610 if(containerCreateItem(selectedID, selectedItem)) {
\r
611 alert('Item successfully added to list');
\r
612 newList.value = "";
\r
613 } else { return false; }
\r
616 if(findCurrentPage()==RDETAIL) {
\r
617 hideMe($('rdetail_more_actions_selector'));
\r
618 } else if(findCurrentPage()==RRESULT) {
\r
619 hideResultsPage(false);
\r
624 function showMyLists(r) {
\r
625 var containers = r.getResultObject();
\r
626 var selector = $('mylist_selector');
\r
628 for( var i = 0; i != containers.length; i++ ) {
\r
629 var container = containers[i];
\r
630 insertSelectorVal( selector, i, container.name(), container.id(), null, 0 );
\r
632 if(!selector.options.length) hideMe($('myListSelect'));
\r
636 function rdetailAddBookbags(r) {
\r
638 var containers = r.getResultObject();
\r
639 var selector = $('rdetail_more_actions_selector');
\r
642 doSelectorActions(selector);
\r
644 for( var i = 0; i != containers.length; i++ ) {
\r
646 var container = containers[i];
\r
647 insertSelectorVal( selector, index++, container.name(),
\r
648 "container_" + container.id(), rdetailAddToBookbag, 1 );
\r
651 nextContainerIndex = index;
\r
655 function rdetailNewBookbag() {
\r
656 var name = prompt($('rdetail_bb_new').innerHTML,"");
\r
660 if( id = containerCreate( name ) ) {
\r
661 alert($('rdetail_bb_success').innerHTML);
\r
662 var selector = $('rdetail_more_actions_selector');
\r
663 insertSelectorVal( selector, nextContainerIndex++, name,
\r
664 "container_" + id, rdetailAddToBookbag, 1 );
\r
665 setSelector( selector, 'start' );
\r
670 function rdetailAddToBookbag() {
\r
671 var selector = $('rdetail_more_actions_selector');
\r
672 var id = selector.options[selector.selectedIndex].value;
\r
673 setSelector( selector, 'start' );
\r
675 if( containerCreateItem( id.substring(10), record.doc_id() )) {
\r
676 alert($('rdetail_bb_item_success').innerHTML);
\r
681 var rdetailMarcFetched = false;
\r
682 function rdetailShowExtra(type, args) {
\r
684 hideMe($('rdetail_copy_info_div'));
\r
685 hideMe($('rdetail_reviews_div'));
\r
686 hideMe($('rdetail_toc_div'));
\r
687 hideMe($('rdetail_anotes_div'));
\r
688 hideMe($('rdetail_excerpt_div'));
\r
689 hideMe($('rdetail_preview_div'));
\r
690 hideMe($('rdetail_marc_div'));
\r
691 hideMe($('cn_browse'));
\r
692 hideMe($('rdetail_cn_browse_div'));
\r
693 hideMe($('rdetail_notes_div'));
\r
694 hideMe($('rdetail_novelist_div'));
\r
696 removeCSSClass($('rdetail_copy_info_link'), 'rdetail_extras_selected');
\r
697 removeCSSClass($('rdetail_viewcn_link'), 'rdetail_extras_selected');
\r
698 removeCSSClass($('rdetail_reviews_link'), 'rdetail_extras_selected');
\r
699 removeCSSClass($('rdetail_toc_link'), 'rdetail_extras_selected');
\r
700 removeCSSClass($('rdetail_excerpt_link'), 'rdetail_extras_selected');
\r
701 removeCSSClass($('rdetail_preview_link'), 'rdetail_extras_selected');
\r
702 removeCSSClass($('rdetail_anotes_link'), 'rdetail_extras_selected');
\r
703 removeCSSClass($('rdetail_annotation_link'), 'rdetail_extras_selected');
\r
704 removeCSSClass($('rdetail_viewmarc_link'), 'rdetail_extras_selected');
\r
705 removeCSSClass($('rdetail_novelist_link'), 'rdetail_extras_selected');
\r
710 unHideMe($('rdetail_copy_info_div'));
\r
711 addCSSClass($('rdetail_copy_info_link'), 'rdetail_extras_selected');
\r
715 addCSSClass($('rdetail_reviews_link'), 'rdetail_extras_selected');
\r
716 unHideMe($('rdetail_reviews_div'));
\r
720 addCSSClass($('rdetail_excerpt_link'), 'rdetail_extras_selected');
\r
721 unHideMe($('rdetail_excerpt_div'));
\r
725 addCSSClass($('rdetail_preview_link'), 'rdetail_extras_selected');
\r
726 unHideMe($('rdetail_preview_div'));
\r
727 rdetailDisplayGBPreview();
\r
731 addCSSClass($('rdetail_anotes_link'), 'rdetail_extras_selected');
\r
732 unHideMe($('rdetail_anotes_div'));
\r
736 addCSSClass($('rdetail_toc_link'), 'rdetail_extras_selected');
\r
737 unHideMe($('rdetail_toc_div'));
\r
741 addCSSClass($('rdetail_viewmarc_link'), 'rdetail_extras_selected');
\r
742 unHideMe($('rdetail_marc_div'));
\r
743 if(rdetailMarcFetched) return;
\r
744 unHideMe($('rdetail_extras_loading'));
\r
745 rdetailMarcFetched = true;
\r
746 var req = new Request( FETCH_MARC_HTML, record.doc_id() );
\r
747 req.callback(rdetailViewMarc);
\r
752 addCSSClass($('rdetail_novelist_link'), 'rdetail_extras_selected');
\r
753 unHideMe($('rdetail_novelist_div'));
\r
757 addCSSClass($('rdetail_viewcn_link'), 'rdetail_extras_selected');
\r
758 unHideMe($('rdetail_cn_browse_div'));
\r
759 rdetailShowCNBrowse(defaultCN, getLocation(), null, true);
\r
765 function rdetailVolumeDetails(args) {
\r
766 var row = $(args.rowid);
\r
767 var tbody = row.parentNode;
\r
768 cpdBuild( tbody, row, record, args.cn, args.org, args.depth, args.copy_location );
\r
772 function rdetailBuildCNList() {
\r
774 var select = $('cn_browse_selector');
\r
777 for( var cn in callnumberCache ) arr.push( cn );
\r
780 if( arr.length == 0 ) {
\r
781 hideMe($('rdetail_cn_browse_select_div'));
\r
785 for( var i in arr ) {
\r
787 var opt = new Option(cn);
\r
788 select.options[index++] = opt;
\r
790 select.onchange = rdetailGatherCN;
\r
793 function rdetailGatherCN() {
\r
794 var cn = getSelectorVal($('cn_browse_selector'));
\r
795 rdetailShowCNBrowse( cn, getLocation(), getDepth(), true );
\r
796 setSelector( $('cn_browse_selector'), cn );
\r
800 function rdetailShowCNBrowse( cn, loc, depth, fromOnclick ) {
\r
803 unHideMe($('cn_browse_none'));
\r
804 hideMe($('rdetail_cn_browse_select_div'));
\r
808 unHideMe($('rdetail_cn_browse_select_div'));
\r
809 rdetailBuildCNList();
\r
810 setSelector( $('cn_browse_selector'), cn );
\r
811 hideMe($('rdetail_copy_info_div'));
\r
812 hideMe($('rdetail_reviews_div'));
\r
813 hideMe($('rdetail_toc_div'));
\r
814 hideMe($('rdetail_marc_div'));
\r
815 unHideMe($('rdetail_cn_browse_div'));
\r
816 unHideMe($('cn_browse'));
\r
817 if( !rdetailLocalOnly && ! fromOnclick ) depth = findOrgDepth(globalOrgTree);
\r
818 cnBrowseGo(cn, loc, depth);
\r
821 function rdetailhandleAC(data) {
\r
823 if( data.reviews.html ) {
\r
824 $('rdetail_review_container').innerHTML = data.reviews.html;
\r
825 unHideMe($('rdetail_reviews_link'));
\r
828 if( data.toc.html ) {
\r
829 $('rdetail_toc_div').innerHTML = data.toc.html;
\r
830 unHideMe($('rdetail_toc_link'));
\r
833 if( data.excerpt.html ) {
\r
834 $('rdetail_excerpt_div').innerHTML = data.excerpt.html;
\r
835 unHideMe($('rdetail_excerpt_link'));
\r
838 if( data.anotes.html ) {
\r
839 $('rdetail_anotes_div').innerHTML = data.anotes.html;
\r
840 unHideMe($('rdetail_anotes_link'));
\r
844 function rdetailShowReviews(r) {
\r
845 hideMe($('rdetail_extras_loading'));
\r
846 var res = r.getResultObject();
\r
847 var par = $('rdetail_reviews_div');
\r
848 var template = par.removeChild($('rdetail_review_template'));
\r
849 if( res && res.length > 0 ) {
\r
850 unHideMe($('rdetail_reviews_link'));
\r
851 for( var i = 0; i != res.length; i++ ) {
\r
853 if( rev.text && rev.info ) {
\r
854 var node = template.cloneNode(true);
\r
855 $n(node, 'review_header').appendChild(text(rev.info));
\r
856 $n(node, 'review_text').appendChild(text(rev.text));
\r
857 par.appendChild(node);
\r
864 function rdetailShowTOC(r) {
\r
865 hideMe($('rdetail_extras_loading'));
\r
866 var resp = r.getResultObject();
\r
868 unHideMe($('rdetail_toc_link'));
\r
869 $('rdetail_toc_div').innerHTML = resp;
\r
873 function rdetailBuildInfoRows() {
\r
875 var method = FETCH_COPY_COUNTS_SUMMARY;
\r
876 if (rdetailShowCopyLocation)
\r
877 method = FETCH_COPY_LOCATION_COUNTS_SUMMARY;
\r
880 if( rdetailShowLocal )
\r
881 req = new Request(method, record.doc_id(), 1, 0)
\r
883 req = new Request(method, record.doc_id());
\r
884 req.callback(_rdetailBuildInfoRows);
\r
888 function _rdetailRows(node) {
\r
890 if( rdetailShowLocal && /*getLocation()*/1 != globalOrgTree.id() ) {
\r
891 var loc = findOrgUnit(1/*getLocation()*/);
\r
893 if( !orgIsMine(node, loc) && !orgIsMine(loc,node) ) return;
\r
895 for( var i = 0; i < globalOrgTree.children().length; i++ ) {
\r
896 var org = findOrgUnit(globalOrgTree.children()[i]);
\r
897 if( orgIsMine(org, loc) ) {
\r
905 if(!node && findOrgType(globalOrgTree.ou_type()).can_have_vols())
\r
906 node = globalOrgTree;
\r
909 /* don't show hidden orgs */
\r
913 //if(!isXUL() && !isTrue(node.opac_visible())) return;
\r
914 if(!isXUL() && !isTrue(node.opac_visible())) {
\r
915 // locally suppressed orgs should appear in the copy summary
\r
916 if(!localSuppressedOrgs[node.id()]) { // indexOf() on user arrays isn't supported on <= IE8
\r
921 // , 1555:true, 1499:true, 1510:true, 1538:true
\r
923 var row = copyRow.cloneNode(true);
\r
924 row.id = "cp_info_" + node.id();
\r
926 var libtd = findNodeByName( row, config.names.rdetail.lib_cell );
\r
927 var cntd = findNodeByName( row, config.names.rdetail.cn_cell );
\r
928 var cpctd = findNodeByName( row, config.names.rdetail.cp_count_cell );
\r
929 var actions = $n(row, 'rdetail_actions_cell');
\r
931 var p = libtd.getElementsByTagName('a')[0];
\r
932 libtd.insertBefore(text(node.name()), p);
\r
933 libtd.setAttribute("style", "padding-left: " + ((findOrgDepth(node) - 1) * 9) + "px;");
\r
935 if(!findOrgType(node.ou_type()).can_have_vols()) {
\r
937 row.removeChild(cntd);
\r
938 row.removeChild(cpctd);
\r
939 row.removeChild(actions);
\r
940 row.setAttribute('novols', '1');
\r
942 libtd.setAttribute("colspan", numStatuses + 3 );
\r
943 libtd.colSpan = numStatuses + 3;
\r
944 addCSSClass(row, 'copy_info_region_row');
\r
947 copyRowParent.appendChild(row);
\r
949 } else { node = globalOrgTree; }
\r
951 for( var c in node.children() )
\r
952 _rdetailRows(node.children()[c]);
\r
955 function rdetailCNPrint(orgid, cn) {
\r
956 var div = cpdBuildPrintWindow( record, orgid);
\r
957 var template = div.removeChild($n(div, 'cnrow'));
\r
958 var rowNode = $("cp_info_" + orgid);
\r
959 cpdStylePopupWindow(div);
\r
960 openWindow(div.innerHTML);
\r
963 var localCNFound = false;
\r
965 function _rdetailBuildInfoRows(r) {
\r
966 var showLibCount = 5;
\r
968 if (rdetailShowCopyLocation)
\r
969 unHideMe( $n( $('rdetail_copy_info_table'), 'rdetail_copylocation_header' ));
\r
971 removeChildren(copyRowParent);
\r
975 var summary = r.getResultObject();
\r
976 if(!summary) return;
\r
978 // sort by name - desc
\r
979 if(getOrigLocation()) summary.sort(function(a,b){
\r
980 if(a[0]==getOrigLocation()) return -1;
\r
981 if(b[0]==getOrigLocation()) return 1;
\r
982 return findOrgUnit(a[0]).name()>=findOrgUnit(b[0]).name()?1:-1;
\r
983 }); else summary.sort(function(a,b){
\r
984 return findOrgUnit(a[0]).name()>=findOrgUnit(b[0]).name()?1:-1;
\r
988 if(summary.length>showLibCount) unHideMe($('lib_info_more'));
\r
989 for( var i = 0; i < summary.length; i++ ) {
\r
991 var arr = summary[i];
\r
992 globalCNCache[arr[1]] = 1;
\r
993 var thisOrg = findOrgUnit(arr[0]);
\r
994 var rowNode = $("cp_info_" + thisOrg.id());
\r
995 if(!rowNode) continue;
\r
997 if(rowNode.getAttribute("used")) {
\r
999 if( rowNode.nextSibling ) {
\r
1000 sib = rowNode.nextSibling;
\r
1001 o ='cp_info_'+thisOrg.id()+'_';
\r
1002 /* push the new row on as the last row for this org unit */
\r
1003 while( sib && sib.id.match(o) ) {
\r
1004 sib = sib.nextSibling;
\r
1007 rowNode = copyRowParent.insertBefore(copyRow.cloneNode(true), sib);
\r
1009 rowNode = copyRowParent.appendChild(copyRow.cloneNode(true));
\r
1011 rowNode = copyRowParent.appendChild(copyRow.cloneNode(true));
\r
1014 var n = findNodeByName( rowNode, config.names.rdetail.lib_cell );
\r
1015 n.appendChild(text(thisOrg.name()));
\r
1016 n.setAttribute("style", "padding-left: " + ((findOrgDepth(thisOrg) - 1) * 9) + "px;");
\r
1017 rowNode.id = "cp_info_" + thisOrg.id() + '_' + (++ctr);
\r
1020 rowNode.setAttribute("used", "1");
\r
1023 var cpc_temp = rowNode.removeChild(
\r
1024 findNodeByName(rowNode, config.names.rdetail.cp_count_cell));
\r
1026 var statuses = arr[2];
\r
1028 if (rdetailShowCopyLocation) {
\r
1030 statuses = arr[3];
\r
1033 var tehTR = $('rdetails_status_head');
\r
1036 var par = i<showLibCount?tehTR.parentNode:$('rdetails_status2');
\r
1037 var newRow = elem('tr');
\r
1038 var lib_td = elem('td',{nowrap:"nowrap"});
\r
1039 var stat = statuses[0]?"Available":"Checked Out";
\r
1040 var url = mapLibUrl(arr[0]);
\r
1041 var libLink = elem('a',{href:url},'View Library Info');
\r
1042 if(!url) hideMe(libLink);
\r
1043 stat = statuses[6]?"Due":stat;
\r
1044 lib_td.appendChild(libLink);
\r
1046 newRow.appendChild(elem('td',{nowrap:"nowrap"},thisOrg.name()));
\r
1047 newRow.appendChild(elem('td',{nowrap:"nowrap"},cl));
\r
1048 newRow.appendChild(lib_td);
\r
1049 newRow.appendChild(elem('td',{nowrap:"nowrap"},stat));
\r
1050 newRow.appendChild(elem('td',{nowrap:"nowrap"},arr[1]));
\r
1051 par.appendChild(newRow);
\r
1054 rdetailApplyStatuses(rowNode, cpc_temp, statuses);
\r
1056 var isLocal = false;
\r
1057 if( orgIsMine( findOrgUnit(getLocation()), thisOrg ) ) {
\r
1060 if(!localCNFound) {
\r
1061 localCNFound = true;
\r
1062 defaultCN = arr[1];
\r
1066 //if(isLocal) unHideMe(rowNode);
\r
1067 unHideMe(rowNode);
\r
1069 rdetailSetPath( thisOrg, isLocal );
\r
1070 rdetailBuildBrowseInfo( rowNode, arr[1], isLocal, thisOrg, cl );
\r
1072 if( i == summary.length - 1 && !defaultCN) defaultCN = arr[1];
\r
1075 if(!found) unHideMe(G.ui.rdetail.cp_info_none);
\r
1078 function rdetailBuildBrowseInfo(row, cn, local, orgNode, cl) {
\r
1080 var cache = callnumberCache[cn];
\r
1081 if( cache ) cache.count++;
\r
1082 else callnumberCache[cn] = { count : 1 };
\r
1085 var depth = getDepth();
\r
1086 if( !local ) depth = findOrgDepth(globalOrgTree);
\r
1088 $n(row, 'rdetail_callnumber_cell').appendChild(text(cn));
\r
1090 if (rdetailShowCopyLocation) {
\r
1091 var cl_cell = $n(row, 'rdetail_copylocation_cell');
\r
1092 cl_cell.appendChild(text(cl));
\r
1093 unHideMe(cl_cell);
\r
1096 _debug('setting action clicks for cn ' + cn);
\r
1098 var dHref = 'javascript:rdetailVolumeDetails('+
\r
1099 '{copy_location : "'+cl+'", rowid : "'+row.id+'", cn :"'+cn+'", depth:"'+depth+'", org:"'+orgNode.id()+'", local: '+local+'});';
\r
1101 var bHref = 'javascript:rdetailShowCNBrowse("' + cn + '", '+orgNode.id()+', "'+depth+'");';
\r
1103 unHideMe( $n(row, 'details') )
\r
1104 $n(row, 'details').setAttribute('href', dHref);
\r
1105 unHideMe( $n(row, 'browse') )
\r
1106 $n(row, 'browse').setAttribute('href', bHref);
\r
1109 unHideMe($n(row, 'hold_div'));
\r
1110 $n(row, 'hold').onclick = function() {
\r
1111 var req = new Request(FETCH_VOLUME_BY_INFO, cn, record.doc_id(), orgNode.id());
\r
1114 var vol = r.getResultObject();
\r
1115 holdsDrawEditor({type: 'V', volumeObject : vol});
\r
1122 // sets the path to org as 'active' and displays the path if it's local
\r
1123 function rdetailSetPath(org, local) {
\r
1124 if( findOrgDepth(org) == 0 ) return;
\r
1125 var row = $("cp_info_" + org.id());
\r
1126 row.setAttribute("hasinfo", "1");
\r
1128 rdetailSetPath(findOrgUnit(org.parent_ou()), local);
\r
1131 //Append all the statuses for a given summary to the
\r
1132 //copy summary table
\r
1133 function rdetailApplyStatuses( row, template, statuses ) {
\r
1134 for( var j in _statusPositions ) {
\r
1135 var stat = _statusPositions[j];
\r
1136 var val = statuses[stat.id()];
\r
1137 var nn = template.cloneNode(true);
\r
1138 if(val) nn.appendChild(text(val));
\r
1139 else nn.appendChild(text(0));
\r
1140 row.appendChild(nn);
\r
1144 //Add one td (creating a new column) to the copy summary
\r
1145 //table for each opac_visible copy status
\r
1146 function rdetailBuildStatusColumns() {
\r
1148 rdetailGrabCopyStatuses();
\r
1149 var parent = statusRow;
\r
1150 var template = parent.removeChild(G.ui.rdetail.cp_status);
\r
1153 for( i = 0; i < cp_statuses.length; i++ ) {
\r
1155 var c = cp_statuses[i];
\r
1156 if( c && isTrue(c.opac_visible()) ) {
\r
1157 var name = c.name();
\r
1158 _statusPositions[i] = c;
\r
1159 var node = template.cloneNode(true);
\r
1160 var data = findNodeByName( node, config.names.rdetail.cp_status);
\r
1162 data.appendChild(text(name));
\r
1163 parent.appendChild(node);
\r
1168 for(x in _statusPositions) numStatuses++;
\r
1171 function rdetailGrabCopyStatuses() {
\r
1172 if(cp_statuses) return cp_statuses;
\r
1173 var req = new Request(FETCH_COPY_STATUSES);
\r
1175 cp_statuses = req.result();
\r
1176 cp_statuses = cp_statuses.sort(_rdetailSortStatuses);
\r
1179 function _rdetailSortStatuses(a, b) {
\r
1180 return parseInt(a.id()) - parseInt(b.id());
\r
1184 * Check for a Google Book preview
\r
1186 function rdetailCheckForGBPreview() {
\r
1187 if (!rdetailGoogleBookPreview) return;
\r
1188 searchForGBPreview( cleanISBN(record.isbn()) );
\r
1193 * @param {DOM object} query The form element containing the
\r
1194 * input parameters "isbns"
\r
1196 function searchForGBPreview( isbn ) {
\r
1198 // Delete any previous Google Booksearch JSON queries.
\r
1199 var GBPJsonScript = document.getElementById("GBPJsonScript");
\r
1200 if (GBPJsonScript) {
\r
1201 GBPJsonScript.parentNode.removeChild(GBPJsonScript);
\r
1204 // Add a script element with the src as the user's Google Booksearch query.
\r
1205 // JSON output is specified by including the alt=json-in-script argument
\r
1206 // and the callback function is also specified as a URI argument.
\r
1207 var GBPScriptElement = document.createElement("script");
\r
1209 GBPScriptElement.setAttribute("id", "GBPJsonScript");
\r
1210 GBPScriptElement.setAttribute("src",
\r
1211 "http://books.google.com/books?bibkeys=" +
\r
1212 isbn + "&jscmd=viewapi&callback=GBPreviewCallback");
\r
1213 GBPScriptElement.setAttribute("type", "text/javascript");
\r
1215 // make the request to Google booksearch
\r
1216 document.documentElement.firstChild.appendChild(GBPScriptElement);
\r
1220 * This function is the call-back function for the JSON scripts which
\r
1221 * executes a Google book search response.
\r
1223 * XXX I18N of text needed
\r
1225 * @param {JSON} booksInfo is the JSON object pulled from the Google books service.
\r
1227 function GBPreviewCallback(GBPBookInfo) {
\r
1228 var GBPreviewDiv = document.getElementById("rdetail_preview_div");
\r
1231 for ( i in GBPBookInfo ) {
\r
1232 GBPBook = GBPBookInfo[i];
\r
1239 if ( GBPBook.preview != "noview" ) {
\r
1240 if ( GBPBook.preview == 'full' ) {
\r
1241 setText( $('rdetail_preview_link'), $('rdetail_preview_full_text').innerHTML );
\r
1242 $('rdetail_preview_link_a').title = $('rdetail_preview_title').innerHTML;
\r
1245 // Add a button below the book cover image to load the preview.
\r
1246 GBPBadge = document.createElement( 'img' );
\r
1247 GBPBadge.src = 'http://books.google.com/intl/en/googlebooks/images/gbs_preview_button1.gif';
\r
1248 GBPBadge.title = $('rdetail_preview_badge').innerHTML;
\r
1249 GBPBadge.style.border = 0;
\r
1250 GBPBadgelink = document.createElement( 'a' );
\r
1251 GBPBadgelink.href = 'javascript:rdetailShowExtra("preview");';
\r
1252 GBPBadgelink.appendChild( GBPBadge );
\r
1253 $('rdetail_image_cell').appendChild( GBPBadgelink );
\r
1254 $('rdetail_preview_div').style.height = 600;
\r
1256 /* Display the "Preview" tab in the Extras section */
\r
1257 unHideMe( $('rdetail_preview_link' ) );
\r
1262 * This is called when the user clicks on the 'Preview' link. We assume
\r
1263 * a preview is available from Google if this link was made visible.
\r
1265 * XXX I18N of Google Book Preview language attribute needed
\r
1267 function rdetailDisplayGBPreview() {
\r
1268 unHideMe($('rdetail_extras_loading'));
\r
1269 GBPreviewPane = $('rdetail_preview_div');
\r
1270 if ( GBPreviewPane.getAttribute('loaded') == null ||
\r
1271 GBPreviewPane.getAttribute('loaded') == "false" ) {
\r
1272 google.load("books", "0", {"callback" : rdetailGBPViewerLoadCallback, "language": "en"} );
\r
1273 GBPreviewPane.setAttribute('loaded', 'true');
\r
1277 function rdetailGBPViewerLoadCallback() {
\r
1278 hideMe($('rdetail_extras_loading'));
\r
1279 var GBPViewer = new google.books.DefaultViewer(document.getElementById('rdetail_preview_div'));
\r
1280 GBPViewer.load('ISBN:' + cleanISBN(record.isbn()) );
\r