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">');
14 MACRO heading_use_label BLOCK;
30 <h2 class="sr-only">[% l('Catalog Browse') %]</h2>
31 <div id="search-wrapper">
32 [%# XXX TODO Give searchbar.tt2 more smarts so we can just do:
33 # INCLUDE "opac/parts/searchbar.tt2" %]
35 <span class="search_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/home', {}, depart_list) %]">[% l('Basic Search') %]</a></span>
36 <span class="adv_search_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/advanced', {}, depart_list) %]"
37 id="home_adv_search_link">[%l('Advanced Search')%]</a></span>
39 <span class="browse_the_catalog_lbl mobile_hide">[% l('Browse the Catalog') %]</span>
42 <div id="content-wrapper">
43 <div id="main-content">
44 <div id="browse-the-catalog">
45 <div id="browse-controls" class='searchbar'>
46 <form method="get" onsubmit="$('browse-submit-spinner').className = ''; return true">
47 <input type="hidden" name="blimit"
48 value="[% blimit %]" />
50 [% control_qtype = INCLUDE "opac/parts/qtype_selector.tt2"
51 id="browse-search-class" browse_only=1 plural=1 %]
53 [% control_bterm = BLOCK %]<input type="text" name="bterm" id="browse-term"
54 value="[% CGI.param('bterm') | html %]" />[% END %]
55 [% control_locg = INCLUDE build_org_selector id='browse-context'
57 arialabel=l('Select holding library') %]
58 [% l('Browse for [_1] starting with [_2] in [_3]', control_qtype, control_bterm, control_locg) %]
60 <input id='search-submit-go' type="submit" value="[% l('Browse') %]" alt="[% l('Browse') %]" class="opac-button"/>
61 <img id="browse-submit-spinner"
62 src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif[% ctx.cache_key %]"
63 class="hidden" style="width: 16px; height: 16px;"
64 alt="[% l('Search in progress icon') %]" />
68 [% BLOCK browse_pager %]
69 <div class="browse-pager">
70 [% IF ctx.back_pivot %]
71 <a class="opac-button" href="[% mkurl('', {bpivot => ctx.back_pivot}) %]" onclick="$('browse-pager-spinner-[% id %]').className = '';">← [%l ('Back') %]</a>
73 [% IF ctx.pager_shortcuts;
74 current_qtype = CGI.param('qtype') || 'title' %]
75 <span class="browse-shortcuts">
76 [% FOR shortcut IN ctx.pager_shortcuts %]
77 <a href="[% mkurl('', {qtype => current_qtype, bterm => shortcut.0}, ['bpivot','query']) %]">[% shortcut.1 %]</a>
82 [% IF ctx.forward_pivot %]
83 <a class="opac-button" href="[% mkurl('', {bpivot => ctx.forward_pivot}) %]" onclick="$('browse-pager-spinner-[% id %]').className = '';">[%l ('Next') %] →</a>
86 <img id="browse-pager-spinner-[% id %]"
87 src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif[% ctx.cache_key %]"
88 class="hidden" style="width: 16px; height: 16px;"
89 alt="[% l('Search in progress icon') %]" />
93 [% PROCESS browse_pager id=0 %]
95 <div id="browse-results">
96 [% IF ctx.browse_error %]
97 <span class="browse-error">
98 [% l("An error occurred browsing records. " _
99 "Please try again in a moment or report the issue " _
100 "to library staff.") %]
103 [% IF ctx.browse_leading_article_warning %]
104 <div class="browse-leading-article-warning">
105 [% l("Your browse term seems to begin with an article (a, an, the). You might get better results by omitting the article.") %]
106 [% IF ctx.browse_leading_article_alternative %]
108 [% alternative_link = BLOCK %]
109 <a href="[% mkurl('', {bterm => ctx.browse_leading_article_alternative}, ['bpivot']) %]">[% ctx.browse_leading_article_alternative | html %]</a>
110 [%- END; # alternative_link BLOCK
111 l("Did you mean [_1]?", alternative_link);
116 <ul class="browse-result-list">
117 [% FOR result IN ctx.browse_results %]
118 <li class="browse-result">
119 <span class="browse-result-value[% result.row_number == 0 && !CGI.param('bpivot') ? ' browse-result-best-match' : '' %]">
120 [% IF result.sources > 0 %] <!-- bib-linked browse value -->
122 ctx.opac_root _ '/results', {
123 'fi:has_browse_entry' => (result.browse_entry _ ',' _ result.fields)
124 }) %]">[% result.value | html %]</a>
125 <span class="browse-result-sources">([%
126 IF result.accurate == 'f';
129 result.sources %])</span>
130 [% ELSE %] <!-- only authority links -->
131 [% result.value | html %]
135 [% FOR a IN result.authorities;
136 PROCESS authority_notes authority=a IF !sees.grep(a.id);
138 [% auth_headings_ul_added = 0; %]
139 [% seenit = {}; # for headings we've rendered
140 FOR a IN result.sees;
141 # We can go no further sans control_set.
142 NEXT UNLESS a.control_set;
144 # get_authority_fields is fast and cache-y.
145 acs = ctx.get_authority_fields(a.control_set);
146 FOR field_group IN a.headings;
147 field_id = field_group.keys.0;
148 field = acs.$field_id;
149 headings = field_group.values.0;
151 # We could display headings without
152 # links here when h.target is
153 # undef, if we wanted to, but note
154 # that h.target_count is only
155 # defined when h.target is.
157 IF h.target AND h.target_count AND result.list_authorities.grep('^' _ h.target _ '$').size == 0 AND h.main_entry;
158 id = h.target; NEXT IF seenit.$id; seenit.$id = 1;
159 IF !auth_headings_ul_added;
160 # only add a <ul> if we have at least one <li> (WCAG 2.0)
161 auth_headings_ul_added = 1; %]
162 <ul class="browse-result-authority-headings">
165 <li><span class="browse-result-authority-field-name">[% heading_use_label(use=h.type) %]</span>
166 <a href="[% mkurl(ctx.opac_root _ '/browse', {bterm => h.heading}, ['bpivot']) %]">[% h.heading | html %]</a>
167 <span class="browse-result-authority-bib-links">([% h.target_count %])</span>
173 [% FOR a IN result.authorities;
174 # We can go no further sans control_set.
175 NEXT UNLESS a.control_set;
177 # get_authority_fields is fast and cache-y.
178 acs = ctx.get_authority_fields(a.control_set);
179 FOR field_group IN a.headings;
180 field_id = field_group.keys.0;
181 field = acs.$field_id;
182 headings = field_group.values.0;
184 # We could display headings without
185 # links here when h.target is
186 # undef, if we wanted to, but note
187 # that h.target_count is only
188 # defined when h.target is.
190 IF h.target AND h.target_count AND result.list_sees.grep('^' _ h.target _ '$').size == 0 AND !h.main_entry AND ctx.get_cgf('opac.show_related_headings_in_browse').enabled == 't';
191 id = h.target; NEXT IF seenit.$id; seenit.$id = 1;
192 IF !auth_headings_ul_added;
193 # only add a <ul> if we have at least one <li> (WCAG 2.0)
194 auth_headings_ul_added = 1; %]
195 <ul class="browse-result-authority-headings">
197 <li><span class="browse-result-authority-field-name">[% heading_use_label(use=h.type) %]</span>
198 <a href="[% mkurl(ctx.opac_root _ '/results', {query => 'identifier|authority_id[' _ h.target _ ']'}) %]">[% h.heading | html %]</a>
199 <span class="browse-result-authority-bib-links">([% h.target_count %])</span>
205 [% IF auth_headings_ul_added %]</ul>[% END %]
212 [% PROCESS browse_pager id=1 %]
215 <div class="common-full-pad"></div>
219 [% BLOCK authority_notes;
220 # Displays public general notes (sometimes called "scope notes" ?)
221 FOR note IN authority.notes %]
222 <div class="browse-public-general-note">
223 <span class="browse-public-general-note-label">
226 <span class="browse-public-general-note-body">
227 [% FOR piece IN note; piece | html; END %]
231 END; # end of BLOCK authority_notes %]