1 [%- # This is the bib and authority combined record browser.
3 PROCESS "opac/parts/header.tt2";
4 PROCESS "opac/parts/misc_util.tt2";
5 PROCESS "opac/parts/org_selector.tt2";
6 WRAPPER "opac/parts/base.tt2";
7 INCLUDE "opac/parts/topnav.tt2";
9 ctx.page_title = l("Browse the Catalog");
10 blimit = CGI.param('blimit') || ctx.opac_hits_per_page || 10;
12 depart_list = ['blimit', 'bterm', 'bpivot'];
13 ctx.metalinks.push('<meta name="robots" content="noindex,follow">');
16 <h2 class="sr-only">[% l('Catalog Browse') %]</h2>
17 <div id="search-wrapper">
18 [%# XXX TODO Give searchbar.tt2 more smarts so we can just do:
19 # INCLUDE "opac/parts/searchbar.tt2" %]
21 <span class="search_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/home', {}, depart_list) %]">[% l('Basic Search') %]</a></span>
22 <span class="adv_search_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/advanced', {}, depart_list) %]"
23 id="home_adv_search_link">[%l('Advanced Search')%]</a></span>
25 <span class="browse_the_catalog_lbl mobile_hide">[% l('Browse the Catalog') %]</span>
28 <div id="content-wrapper">
29 <div id="main-content">
30 <div id="browse-the-catalog">
31 <div id="browse-controls" class='searchbar'>
32 <form method="get" onsubmit="$('browse-submit-spinner').className = ''; return true">
33 <input type="hidden" name="blimit"
34 value="[% blimit %]" />
36 [% control_qtype = INCLUDE "opac/parts/qtype_selector.tt2"
37 id="browse-search-class" browse_only=1 plural=1 %]
39 [% control_bterm = BLOCK %]<input type="text" name="bterm" id="browse-term"
40 value="[% CGI.param('bterm') | html %]" />[% END %]
41 [% control_locg = INCLUDE build_org_selector id='browse-context'
43 arialabel=l('Select holding library') %]
44 [% l('Browse for [_1] starting with [_2] in [_3]', control_qtype, control_bterm, control_locg) %]
46 <input id='search-submit-go' type="submit" value="[% l('Browse') %]" alt="[% l('Browse') %]" class="opac-button"/>
47 <img id="browse-submit-spinner"
48 src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif"
49 class="hidden" style="width: 16px; height: 16px;"
50 alt="[% l('Search in progress icon') %]" />
54 [% BLOCK browse_pager %]
55 <div class="browse-pager">
56 [% IF ctx.back_pivot %]
57 <a class="opac-button" href="[% mkurl('', {bpivot => ctx.back_pivot}) %]" onclick="$('browse-pager-spinner-[% id %]').className = '';">← [%l ('Back') %]</a>
59 [% IF ctx.pager_shortcuts;
60 current_qtype = CGI.param('qtype') || 'title' %]
61 <span class="browse-shortcuts">
62 [% FOR shortcut IN ctx.pager_shortcuts %]
63 <a href="[% mkurl('', {qtype => current_qtype, bterm => shortcut.0}, ['bpivot','query']) %]">[% shortcut.1 %]</a>
68 [% IF ctx.forward_pivot %]
69 <a class="opac-button" href="[% mkurl('', {bpivot => ctx.forward_pivot}) %]" onclick="$('browse-pager-spinner-[% id %]').className = '';">[%l ('Next') %] →</a>
72 <img id="browse-pager-spinner-[% id %]"
73 src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif"
74 class="hidden" style="width: 16px; height: 16px;"
75 alt="[% l('Search in progress icon') %]" />
79 [% PROCESS browse_pager id=0 %]
81 <div id="browse-results">
82 [% IF ctx.browse_error %]
83 <span class="browse-error">
84 [% l("An error occurred browsing records. " _
85 "Please try again in a moment or report the issue " _
86 "to library staff.") %]
89 [% IF ctx.browse_leading_article_warning %]
90 <div class="browse-leading-article-warning">
91 [% l("Your browse term seems to begin with an article (a, an, the). You might get better results by omitting the article.") %]
92 [% IF ctx.browse_leading_article_alternative %]
94 [% alternative_link = BLOCK %]
95 <a href="[% mkurl('', {bterm => ctx.browse_leading_article_alternative}, ['bpivot']) %]">[% ctx.browse_leading_article_alternative | html %]</a>
96 [%- END; # alternative_link BLOCK
97 l("Did you mean [_1]?", alternative_link);
103 <ul class="browse-result-list">
104 [% FOR result IN ctx.browse_results %]
105 <li class="browse-result">
106 <span class="browse-result-value[% result.row_number == 0 && !CGI.param('bpivot') ? ' browse-result-best-match' : '' %]">
107 [% IF result.sources > 0 %] <!-- bib-linked browse value -->
109 ctx.opac_root _ '/results', {
110 'fi:has_browse_entry' => (result.browse_entry _ ',' _ result.fields)
111 }) %]">[% result.value | html %]</a>
112 <span class="browse-result-sources">([%
113 IF result.accurate == 'f';
116 result.sources %])</span>
117 [% ELSE %] <!-- only authority links -->
118 [% result.value | html %]
122 [% auth_headings_ul_added = 0; %]
123 [% seenit = {}; # for headings we've rendered
124 FOR a IN result.sees;
125 PROCESS authority_notes authority=a;
127 # Other than displaying public general
128 # notes, we can go no further sans
130 NEXT UNLESS a.control_set;
132 # get_authority_fields is fast and cache-y.
133 acs = ctx.get_authority_fields(a.control_set);
134 FOR field_group IN a.headings;
135 field_id = field_group.keys.0;
136 field = acs.$field_id;
137 headings = field_group.values.0;
139 # We could display headings without
140 # links here when h.target is
141 # undef, if we wanted to, but note
142 # that h.target_count is only
143 # defined when h.target is.
145 IF h.target AND h.target_count AND result.list_authorities.grep('^' _ h.target _ '$').size == 0;
146 id = h.target; NEXT IF seenit.$id; seenit.$id = 1;
147 IF !auth_headings_ul_added;
148 # only add a <ul> if we have at least one <li> (WCAG 2.0)
149 auth_headings_ul_added = 1; %]
150 <ul class="browse-result-authority-headings">
153 <li><span class="browse-result-authority-field-name">[% field.name %]</span>
154 <a href="[% mkurl(ctx.opac_root _ '/browse', {bterm => h.heading}, ['bpivot']) %]">[% h.heading | html %]</a>
155 <span class="browse-result-authority-bib-links">([% h.target_count %])</span>
161 [% FOR a IN result.authorities; # I don't think we'll ever get here...
162 PROCESS authority_notes authority=a IF !sees.grep(a.id);
164 # Other than displaying public general
165 # notes, we can go no further sans
167 NEXT UNLESS a.control_set;
169 # get_authority_fields is fast and cache-y.
170 acs = ctx.get_authority_fields(a.control_set);
171 FOR field_group IN a.headings;
172 field_id = field_group.keys.0;
173 field = acs.$field_id;
174 headings = field_group.values.0;
176 # We could display headings without
177 # links here when h.target is
178 # undef, if we wanted to, but note
179 # that h.target_count is only
180 # defined when h.target is.
182 IF h.target AND h.target_count AND result.list_sees.grep('^' _ h.target _ '$').size == 0 AND !h.main_entry;
183 id = h.target; NEXT IF seenit.$id; seenit.$id = 1;
184 IF !auth_headings_ul_added;
185 # only add a <ul> if we have at least one <li> (WCAG 2.0)
186 auth_headings_ul_added = 1; %]
187 <ul class="browse-result-authority-headings">
189 <li><span class="browse-result-authority-field-name">[% field.name %]</span>
190 <a href="[% mkurl(ctx.opac_root _ '/results', {query => 'identifier|authority_id[' _ h.target _ ']'}) %]">[% h.heading | html %]</a>
191 <span class="browse-result-authority-bib-links">([% h.target_count %])</span>
197 [% IF auth_headings_ul_added %]</ul>[% END %]
204 [% PROCESS browse_pager id=1 %]
207 <div class="common-full-pad"></div>
211 [% BLOCK authority_notes;
212 # Displays public general notes (sometimes called "scope notes" ?)
213 FOR note IN authority.notes %]
214 <div class="browse-public-general-note">
215 <span class="browse-public-general-note-label">
218 <span class="browse-public-general-note-body">
219 [% FOR piece IN note; piece | html; END %]
223 END; # end of BLOCK authority_notes %]