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'];
15 <h2 class="sr-only">[% l('Catalog Browse') %]</h2>
16 <div id="search-wrapper">
17 [%# XXX TODO Give searchbar.tt2 more smarts so we can just do:
18 # INCLUDE "opac/parts/searchbar.tt2" %]
20 <span class="search_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/home', {}, depart_list) %]">[% l('Basic Search') %]</a></span>
21 <span class="adv_search_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/advanced', {}, depart_list) %]"
22 id="home_adv_search_link">[%l('Advanced Search')%]</a></span>
24 <span class="browse_the_catalog_lbl mobile_hide">[% l('Browse the Catalog') %]</span>
27 <div id="content-wrapper">
28 <div id="main-content">
29 <div id="browse-the-catalog">
30 <div id="browse-controls" class='searchbar'>
31 <form method="get" onsubmit="$('browse-submit-spinner').className = ''; return true">
32 <input type="hidden" name="blimit"
33 value="[% blimit %]" />
35 [% control_qtype = INCLUDE "opac/parts/qtype_selector.tt2"
36 id="browse-search-class" browse_only=1 plural=1 %]
38 [% control_bterm = BLOCK %]<input type="text" name="bterm" id="browse-term"
39 value="[% CGI.param('bterm') | html %]" />[% END %]
40 [% control_locg = INCLUDE build_org_selector id='browse-context'
42 arialabel=l('Select holding library') %]
43 [% l('Browse for [_1] starting with [_2] in [_3]', control_qtype, control_bterm, control_locg) %]
45 <input id='search-submit-go' type="submit" value="[% l('Browse') %]" alt="[% l('Browse') %]" class="opac-button"/>
46 <img id="browse-submit-spinner"
47 src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif"
48 class="hidden" style="width: 16px; height: 16px;"
49 alt="[% l('Search in progress icon') %]" />
53 [% BLOCK browse_pager %]
54 <div class="browse-pager">
55 [% IF ctx.back_pivot %]
56 <a class="opac-button" href="[% mkurl('', {bpivot => ctx.back_pivot}) %]" onclick="$('browse-pager-spinner-[% id %]').className = '';">← [%l ('Back') %]</a>
58 [% IF ctx.pager_shortcuts;
59 current_qtype = CGI.param('qtype') || 'title' %]
60 <span class="browse-shortcuts">
61 [% FOR shortcut IN ctx.pager_shortcuts %]
62 <a href="[% mkurl('', {qtype => current_qtype, bterm => shortcut.0}, ['bpivot','query']) %]">[% shortcut.1 %]</a>
67 [% IF ctx.forward_pivot %]
68 <a class="opac-button" href="[% mkurl('', {bpivot => ctx.forward_pivot}) %]" onclick="$('browse-pager-spinner-[% id %]').className = '';">[%l ('Next') %] →</a>
71 <img id="browse-pager-spinner-[% id %]"
72 src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif"
73 class="hidden" style="width: 16px; height: 16px;"
74 alt="[% l('Search in progress icon') %]" />
78 [% PROCESS browse_pager id=0 %]
80 <div id="browse-results">
81 [% IF ctx.browse_error %]
82 <span class="browse-error">
83 [% l("An error occurred browsing records. " _
84 "Please try again in a moment or report the issue " _
85 "to library staff.") %]
88 [% IF ctx.browse_leading_article_warning %]
89 <div class="browse-leading-article-warning">
90 [% l("Your browse term seems to begin with an article (a, an, the). You might get better results by omitting the article.") %]
91 [% IF ctx.browse_leading_article_alternative %]
93 [% alternative_link = BLOCK %]
94 <a href="[% mkurl('', {bterm => ctx.browse_leading_article_alternative}, ['bpivot']) %]">[% ctx.browse_leading_article_alternative | html %]</a>
95 [%- END; # alternative_link BLOCK
96 l("Did you mean [_1]?", alternative_link);
102 <ul class="browse-result-list">
103 [% FOR result IN ctx.browse_results %]
104 <li class="browse-result">
105 <span class="browse-result-value[% result.row_number == 0 && !CGI.param('bpivot') ? ' browse-result-best-match' : '' %]">
106 [% IF result.sources > 0 %] <!-- bib-linked browse value -->
108 ctx.opac_root _ '/results', {
109 'fi:has_browse_entry' => (result.browse_entry _ ',' _ result.fields)
110 }) %]">[% result.value | html %]</a>
111 <span class="browse-result-sources">([%
112 IF result.accurate == 'f';
115 result.sources %])</span>
116 [% ELSE %] <!-- only authority links -->
117 [% result.value | html %]
121 [% auth_headings_ul_added = 0 %];
122 [% seenit = {}; # for headings we've rendered
123 FOR a IN result.sees;
124 PROCESS authority_notes authority=a;
126 # Other than displaying public general
127 # notes, we can go no further sans
129 NEXT UNLESS a.control_set;
131 # get_authority_fields is fast and cache-y.
132 acs = ctx.get_authority_fields(a.control_set);
133 FOR field_group IN a.headings;
134 field_id = field_group.keys.0;
135 field = acs.$field_id;
136 headings = field_group.values.0;
138 # We could display headings without
139 # links here when h.target is
140 # undef, if we wanted to, but note
141 # that h.target_count is only
142 # defined when h.target is.
144 IF h.target AND h.target_count AND result.list_authorities.grep('^' _ h.target _ '$').size == 0;
145 id = h.target; NEXT IF seenit.$id; seenit.$id = 1;
146 IF !auth_headings_ul_added;
147 # only add a <ul> if we have at least one <li> (WCAG 2.0)
148 auth_headings_ul_added = 1; %]
149 <ul class="browse-result-authority-headings">
152 <li><span class="browse-result-authority-field-name">[% field.name %]</span>
153 <a href="[% mkurl(ctx.opac_root _ '/browse', {bterm => h.heading}, ['bpivot']) %]">[% h.heading | html %]</a>
154 <span class="browse-result-authority-bib-links">([% h.target_count %])</span>
160 [% FOR a IN result.authorities; # I don't think we'll ever get here...
161 PROCESS authority_notes authority=a IF !sees.grep(a.id);
163 # Other than displaying public general
164 # notes, we can go no further sans
166 NEXT UNLESS a.control_set;
168 # get_authority_fields is fast and cache-y.
169 acs = ctx.get_authority_fields(a.control_set);
170 FOR field_group IN a.headings;
171 field_id = field_group.keys.0;
172 field = acs.$field_id;
173 headings = field_group.values.0;
175 # We could display headings without
176 # links here when h.target is
177 # undef, if we wanted to, but note
178 # that h.target_count is only
179 # defined when h.target is.
181 IF h.target AND h.target_count AND result.list_sees.grep('^' _ h.target _ '$').size == 0 AND !h.main_entry;
182 id = h.target; NEXT IF seenit.$id; seenit.$id = 1;
183 IF !auth_headings_ul_added;
184 # only add a <ul> if we have at least one <li> (WCAG 2.0)
185 auth_headings_ul_added = 1; %]
186 <ul class="browse-result-authority-headings">
188 <li><span class="browse-result-authority-field-name">[% field.name %]</span>
189 <a href="[% mkurl(ctx.opac_root _ '/results', {query => 'identifier|authority_id[' _ h.target _ ']'}) %]">[% h.heading | html %]</a>
190 <span class="browse-result-authority-bib-links">([% h.target_count %])</span>
196 [% IF auth_headings_ul_added %]</ul>[% END %]
203 [% PROCESS browse_pager id=1 %]
206 <div class="common-full-pad"></div>
210 [% BLOCK authority_notes;
211 # Displays public general notes (sometimes called "scope notes" ?)
212 FOR note IN authority.notes %]
213 <div class="browse-public-general-note">
214 <span class="browse-public-general-note-label">
217 <span class="browse-public-general-note-body">
218 [% FOR piece IN note; piece | html; END %]
222 END; # end of BLOCK authority_notes %]