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