1 <!-- JS imports, etc. -->
2 <script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/opac/simple.js"></script>
5 <script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/opac/staff.js"></script>
6 [% IF ctx.page == 'record' %]
7 [% IF ctx.search_result_index >= 0 %]
9 rdetail_next_prev_actions(
10 "[% ctx.search_result_index %]",
11 "[% ctx.hit_count %]",
12 "[% ctx.prev_rec_url || '' %]",
13 "[% ctx.next_rec_url || '' %]",
14 "[% mkurl(ctx.first_search_record, {page => 0}) %]",
15 "[% mkurl(ctx.opac_root _ '/results', {find_last => 1, page => POSIX.floor(ctx.hit_count / ctx.page_size)}) %]",
16 "[% mkurl(ctx.opac_root _ '/results', {}, ['expand','cnoffset']) %]"
20 [% IF ctx.mfhd_summaries.size %]
22 window.mfhdDetails = [
23 [% FOR summary IN ctx.mfhd_summaries %]
25 'id' : '[% summary.sre_id %]',
26 'label' : '[% summary.location %]',
27 'entryNum' : '[% loop.index %]',
28 'owning_lib' : '[% summary.owning_lib %]'
37 [%- IF ENV.OILS_NOVELIST_URL AND ctx.page == 'record';
38 url = ENV.OILS_NOVELIST_URL;
39 IF CGI.https; url = url.replace('^http:', 'https:'); END; %]
40 <script type='text/javascript' id='EIT' src='[% url %]'></script>
43 <script type="text/javascript">
45 locale: "[% ctx.locale | lower | replace('_', '-') %]",
50 <script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/dojo/dojo.js?[% ctx.eg_cache_hash %]"></script>
51 <script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/dojo/openils_dojo.js?[% ctx.eg_cache_hash %]"></script>
53 [%- # So the following works in Mozilla and Chrome, but not in IE8.
54 # Seems like it /should/ work anywhere, though, and obviate the
55 # next three script tags: %]
56 <!-- <script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/DojoSRF.js?[% ctx.eg_cache_hash %]"></script> -->
58 <script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/opensrf/opensrf.js?[% ctx.eg_cache_hash %]"></script>
59 <script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/opensrf/opensrf_xhr.js?[% ctx.eg_cache_hash %]"></script>
60 <script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/opensrf/JSON_v1.js?[% ctx.eg_cache_hash %]"></script>
62 [% IF use_autosuggest.enabled == "t"; %]
63 <script type="text/javascript">
64 dojo.require("openils.widget.AutoSuggest");
66 /* Set focus, and place the cursor at the end of the input string */
67 dojo.addOnLoad(function() {
68 dijit.byId('search_box').focus();
70 var sb_value = dijit.byId('search_box').value;
71 /* Dojo won't trigger a change if the value doesn't change */
73 dijit.byId('search_box').setValue(sb_value + ' ');
74 dijit.byId('search_box').setValue(sb_value);
78 [% END; # use_autosuggest %]
80 <script type="text/javascript">
81 [% ac_types = ['toc', 'anotes', 'excerpt', 'summary', 'reviews'] %]
83 /* Checks to see if a given type of added content has data to show.
84 * The first arg to callback() is boolean indicating the presence of data.
86 function acIsAvailable(ident, type, callback) {
87 var url = '/opac/extras/ac/' + type + '/html/' + ident;
90 failOk : true, // http://bugs.dojotoolkit.org/ticket/11568
91 error : function(err) { callback(false, ident, type); },
92 load : function(result) { callback(true, ident, type); }
97 IF ctx.page == 'record';
98 # XXX revisit when ident=ctx.bre_id
99 ident = ctx.record_attrs.isbn_clean || ctx.record_attrs.upc;
101 FOR type IN ac_types;
102 IF ctx.added_content.$type.status == '3' # status unknown %]
103 dojo.addOnLoad(function() {
104 var ident = '[% ident %]';
105 var type = '[% type %]';
106 acIsAvailable(ident, type, function(avail, ident, type) {
107 // if the content is available, un-hide the tab
108 if (avail) dojo.removeClass(dojo.byId('ac:' + type), 'hidden');
111 [% END; # IF status unknown
118 [%- END; # want_dojo -%]