2 * This function should return a URL which points to the book cover image based on ISBN.
6 function buildISBNSrc(isbn, size) {
7 size = (size) ? size : 'small';
8 var protocol = (OILS_OPAC_STATIC_PROTOCOL) ? OILS_OPAC_STATIC_PROTOCOL + ':' : location.protocol;
9 if(OILS_OPAC_IMAGES_HOST)
10 return protocol + '//' + OILS_OPAC_IMAGES_HOST + size + '/' + isbn;
11 return '../../../../extras/ac/jacket/'+size+'/'+isbn;
15 * This function should return a URL which points to the book cover image based on record ID.
18 function buildJacketSrc(rec_id, size) {
19 size = (size) ? size : 'small';
20 var protocol = (OILS_OPAC_STATIC_PROTOCOL) ? OILS_OPAC_STATIC_PROTOCOL + ':' : location.protocol;
21 if(OILS_OPAC_IMAGES_HOST)
22 return protocol + '//' + OILS_OPAC_IMAGES_HOST + size + '/r/' + rec_id;
23 return '../../../../extras/ac/jacket/'+size+'/r/'+rec_id;
26 function acMakeURL(type, key) {
27 return '../../../../extras/ac/' + type + '/html/' + key;
31 function acCollectData( key, callback ) {
32 var context = { key : key, callback: callback, data : {} };
33 acCollectItem(context, 'summary');
34 acCollectItem(context, 'reviews');
35 acCollectItem(context, 'toc');
36 acCollectItem(context, 'excerpt');
37 acCollectItem(context, 'anotes');
40 function acCheckDone(context) {
41 if( context.data.reviews && context.data.reviews.done &&
42 context.data.toc && context.data.toc.done &&
43 context.data.excerpt && context.data.excerpt.done &&
44 context.data.anotes && context.data.anotes.done ) {
46 if(context.callback) context.callback(context.data);
50 function acCollectItem(context, type) {
51 var req = buildXMLRequest();
52 req.open('GET', acMakeURL(type, context.key), true);
53 req.onreadystatechange = function() {
54 if( req.readyState == 4 ) {
55 context.data[type] = { done : true }
59 /* Someone please explain why IE treats status 404 as status 200??
60 On second thought, don't bother.
62 if( ! req.responseText.match(
63 /The requested URL.*was not found on this server/) )
64 context.data[type].html = req.responseText;
67 if( req.status != 404 )
68 context.data[type].html = req.responseText;