2 <script type="text/javascript">
4 /* Checks to see if a given type of added content has data to show.
5 * The first arg to callback() is boolean indicating the presence of data */
6 function acIsAvailable(bre_id, type, callback) {
7 var url = '/opac/extras/ac/' + type + '/html/r/' + bre_id;
10 failOk : true, // http://bugs.dojotoolkit.org/ticket/11568
11 error : function(err) { callback(false, bre_id, type); },
12 load : function(result) { callback(true, bre_id, type); }
17 FOR type IN ctx.added_content.keys;
18 IF ctx.added_content.$type.status == '3' # status unknown %]
20 dojo.addOnLoad(function() {
21 var bre_id = '[% ctx.bre_id %]';
22 var type = '[% type %]';
24 acIsAvailable(bre_id, type, function(avail, bre_id, type) {
27 [% IF CGI.param('expand') == 'addedcontent' %]
29 // if the content is available, un-hide the tab
30 dojo.removeClass(dojo.byId('ac:' + type), 'hidden');
33 // if no default type is selected on the main tab link
34 // set one here, since we have available content
36 var link = dojo.query('[name=addedcontent]')[0];
37 var href = link.getAttribute('href');
38 if (!href.match('[\&;]ac=')) {
39 href = href.replace('#addedcontent', ';ac=' + type + '#addedcontent');
40 dojo.attr(link, 'href', href);
41 dojo.attr(dojo.query('[name=addedcontent_lbl]')[0], 'href', href);
48 [% END; # IF status unknown
51 ident = ctx.record_attrs.isbn_clean || ctx.record_attrs.upc;
55 [%- IF ENV.OILS_NOVELIST_URL -%]
56 /* Load novelist content */
57 novSelect.loadContentForQuery(
59 ClientIdentifier : '[% ident %]',
63 '[% ENV.OILS_NOVELIST_PROFILE %]',
64 '[% ENV.OILS_NOVELIST_PASSWORD %]',
66 // note if d.length == 0, there is no content to display
67 // hide the Loading... text
68 dojo.byId('novelist-loading').innerHTML = '';
71 [%- END; # Novelist -%]