1 [%- # This is the bib and authority combined record browser.
4 PROCESS "opac/parts/header.tt2";
5 PROCESS "opac/parts/misc_util.tt2";
6 PROCESS "opac/parts/org_selector.tt2";
7 WRAPPER "opac/parts/base.tt2";
8 INCLUDE "opac/parts/topnav.tt2";
10 ctx.page_title = l("Browse the Catalog");
12 blimit = CGI.param('blimit') || ctx.opac_hits_per_page || 10;
14 depart_list = ['blimit', 'bterm', 'bpivot'];
15 ctx.metalinks.push('<meta name="robots" content="noindex,follow">');
16 MACRO heading_use_label BLOCK;
32 <h2 class="sr-only">[% l('Catalog Browse') %]</h2>
34 <div id="content-wrapper" class="my-5">
35 <div class="container mx-auto w-75">
36 <div id="browse-the-catalog">
37 <div id="browse-controls" class='row'>
38 <form method="get" onsubmit="$('browse-submit-spinner').className = ''; return true" class="mx-auto">
39 <input type="hidden" name="blimit"
40 value="[% blimit %]" />
42 [% control_qtype = INCLUDE "opac/parts/qtype_selector.tt2"
43 id="browse-search-class" browse_only=1 plural=1 %]
45 [% control_bterm = BLOCK %]<input type="text" name="bterm" id="browse-term"
46 aria-label="[% l('Browse term') %]"
47 value="[% CGI.param('bterm') | html %]" class="form-control" />[% END %]
48 [% control_locg = INCLUDE build_org_selector id='browse-context'
50 arialabel=l('Select holding library') %]
51 [% l('Browse for [_1] starting with [_2] in [_3]', control_qtype, control_bterm, control_locg) %]
53 <button id='search-submit-go' type="submit" class="btn btn-confirm my-2"><i class="fas fa-book-reader" aria-hidden="true"></i> [% l('Browse') %]</button>
54 <img id="browse-submit-spinner"
55 src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif[% ctx.cache_key %]"
56 class="hidden" style="width: 16px; height: 16px;"
57 alt="[% l('Search in progress icon') %]" />
60 <div class="row my-5 border-top border-bottom">
61 [% BLOCK browse_pager %]
62 <div class="browse-pager col-12">
64 [% IF ctx.back_pivot %]
65 <a class="btn btn-action btn-sm" href="[% mkurl('', {bpivot => ctx.back_pivot}) %]" onclick="$('#browse-pager-spinner-[% id %]').removeClass('hidden');">← [%l ('Back') %]</a>
67 [% IF ctx.pager_shortcuts;
68 current_qtype = CGI.param('qtype') || 'title' %]
69 <span class="browse-shortcuts">
70 [% FOR shortcut IN ctx.pager_shortcuts %]
71 <a href="[% mkurl('', {qtype => current_qtype, bterm => shortcut.0}, ['bpivot','query']) %]">[% shortcut.1 %]</a>
75 <span class="browse-pager-spinner">
76 <img id="browse-pager-spinner-[% id %]"
77 src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif[% ctx.cache_key %]"
78 class="hidden" height="16" width="16"
79 alt="[% l('Search in progress icon') %]" />
81 [% IF ctx.forward_pivot %]
82 <a class="btn btn-action btn-sm" href="[% mkurl('', {bpivot => ctx.forward_pivot}) %]" onclick="$('#browse-pager-spinner-[% id %]').removeClass('hidden');">[%l ('Next') %] →</a>
90 [% PROCESS browse_pager id=0 %]
92 <div id="browse-results" class="col-12">
93 [% IF ctx.browse_error %]
94 <span class="browse-error">
95 [% l("An error occurred browsing records. " _
96 "Please try again in a moment or report the issue " _
97 "to library staff.") %]
100 [% IF ctx.browse_leading_article_warning %]
101 <div class="browse-leading-article-warning">
102 [% l("Your browse term seems to begin with an article (a, an, the). You might get better results by omitting the article.") %]
103 [% IF ctx.browse_leading_article_alternative %]
105 [% alternative_link = BLOCK %]
106 <a href="[% mkurl('', {bterm => ctx.browse_leading_article_alternative}, ['bpivot']) %]">[% ctx.browse_leading_article_alternative | html %]</a>
107 [%- END; # alternative_link BLOCK
108 l("Did you mean [_1]?", alternative_link);
113 <ul class="browse-result-list">
114 [% FOR result IN ctx.browse_results %]
115 <li class="browse-result">
116 <span class="browse-result-value[% result.row_number == 0 && !CGI.param('bpivot') ? ' browse-result-best-match' : '' %]">
117 [% IF result.sources > 0 %] <!-- bib-linked browse value -->
119 ctx.opac_root _ '/results', {
120 'fi:has_browse_entry' => (result.browse_entry _ ',' _ result.fields)
121 }) %]">[% result.value | html %]</a>
122 <span class="browse-result-sources">([%
123 IF result.accurate == 'f';
126 result.sources %])</span>
127 [% ELSE %] <!-- only authority links -->
128 [% result.value | html %]
132 [% FOR a IN result.authorities;
133 PROCESS authority_notes authority=a IF !sees.grep(a.id);
135 [% auth_headings_ul_added = 0; %]
136 [% seenit = {}; # for headings we've rendered
137 FOR a IN result.sees;
138 # We can go no further sans control_set.
139 NEXT UNLESS a.control_set;
141 # get_authority_fields is fast and cache-y.
142 acs = ctx.get_authority_fields(a.control_set);
143 FOR field_group IN a.headings;
144 field_id = field_group.keys.0;
145 field = acs.$field_id;
146 headings = field_group.values.0;
148 # We could display headings without
149 # links here when h.target is
150 # undef, if we wanted to, but note
151 # that h.target_count is only
152 # defined when h.target is.
154 IF h.target AND h.target_count AND result.list_authorities.grep('^' _ h.target _ '$').size == 0 AND h.main_entry;
155 id = h.target; NEXT IF seenit.$id; seenit.$id = 1;
156 IF !auth_headings_ul_added;
157 # only add a <ul> if we have at least one <li> (WCAG 2.0)
158 auth_headings_ul_added = 1; %]
159 <ul class="browse-result-authority-headings">
162 <li><span class="browse-result-authority-field-name">[% heading_use_label(use=h.type) %]</span>
163 <a href="[% mkurl(ctx.opac_root _ '/browse', {bterm => h.heading}, ['bpivot']) %]">[% h.heading | html %]</a>
164 <span class="browse-result-authority-bib-links">([% h.target_count %])</span>
170 [% FOR a IN result.authorities;
171 # We can go no further sans control_set.
172 NEXT UNLESS a.control_set;
174 # get_authority_fields is fast and cache-y.
175 acs = ctx.get_authority_fields(a.control_set);
176 FOR field_group IN a.headings;
177 field_id = field_group.keys.0;
178 field = acs.$field_id;
179 headings = field_group.values.0;
181 # We could display headings without
182 # links here when h.target is
183 # undef, if we wanted to, but note
184 # that h.target_count is only
185 # defined when h.target is.
187 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';
188 id = h.target; NEXT IF seenit.$id; seenit.$id = 1;
189 IF !auth_headings_ul_added;
190 # only add a <ul> if we have at least one <li> (WCAG 2.0)
191 auth_headings_ul_added = 1; %]
192 <ul class="browse-result-authority-headings">
194 <li><span class="browse-result-authority-field-name">[% heading_use_label(use=h.type) %]</span>
195 <a href="[% mkurl(ctx.opac_root _ '/results', {query => 'identifier|authority_id[' _ h.target _ ']'}) %]">[% h.heading | html %]</a>
196 <span class="browse-result-authority-bib-links">([% h.target_count %])</span>
202 [% IF auth_headings_ul_added %]</ul>[% END %]
209 [% PROCESS browse_pager id=1 %]
215 [% BLOCK authority_notes;
216 # Displays public general notes (sometimes called "scope notes" ?)
217 FOR note IN authority.notes %]
218 <div class="browse-public-general-note">
219 <span class="browse-public-general-note-label">
222 <span class="browse-public-general-note-body">
223 [% FOR piece IN note; piece | html; END %]
227 END; # end of BLOCK authority_notes %]