]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates-bootstrap/opac/browse.tt2
LP1863252 Geosort - add dropped END tag
[Evergreen.git] / Open-ILS / src / templates-bootstrap / opac / browse.tt2
1 [%- # This is the bib and authority combined record browser.
2     ctx.page = "browse";
3
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";
9
10     ctx.page_title = l("Browse the Catalog");
11
12     blimit = CGI.param('blimit') || ctx.opac_hits_per_page || 10;
13
14     depart_list = ['blimit', 'bterm', 'bpivot'];
15     ctx.metalinks.push('<meta name="robots" content="noindex,follow">');
16     MACRO heading_use_label BLOCK;
17         SWITCH use;
18             CASE 'variant';
19                l('See');
20             CASE 'broader';
21                l('Broader term');
22             CASE 'narrower';
23                l('Narrower term');
24             CASE 'other';
25                l('Related term');
26             CASE;
27                l('See');
28         END;
29     END;
30 %]
31
32     <h2 class="sr-only">[% l('Catalog Browse') %]</h2>
33
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 %]" />
41
42                         [% control_qtype = INCLUDE "opac/parts/qtype_selector.tt2"
43                             id="browse-search-class" browse_only=1 plural=1 %]
44
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'
49                             show_loc_groups=1
50                             arialabel=l('Select holding library') %]
51                         [% l('Browse for [_1] starting with [_2] in [_3]', control_qtype, control_bterm, control_locg) %]
52
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') %]" />
58                     </form>
59                 </div>
60             <div class="row my-5 border-top border-bottom">
61                 [% BLOCK browse_pager %]
62                 <div class="browse-pager col-12">
63                 <div class="mx-auto">
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');">&larr; [%l ('Back') %]</a>
66                     [% END %]
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>
72                         [% END %]
73                     </span>
74                     [% END %]
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') %]" />
80                     </span>
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') %] &rarr;</a>
83                     [% END %]
84
85
86                         </div>
87                 </div>
88                 [% END %]
89
90                 [% PROCESS browse_pager id=0 %]
91
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.") %]
98                     </span>
99                 [% ELSE %]
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 %]
104                             <p>
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);
109                             END # IF %]
110                             </p>
111                     </div>
112                     [% END %]
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 -->
118                                     <a href="[% mkurl(
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';
124                                             l("At least"); " ";
125                                         END;
126                                     result.sources %])</span>
127                                 [% ELSE %] <!-- only authority links -->
128                                     [% result.value | html %]
129                                 [% END %]
130                             </span>
131
132                             [% FOR a IN result.authorities;
133                                     PROCESS authority_notes authority=a IF !sees.grep(a.id);
134                                END %]
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;
140
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;
147                                         FOR h IN headings;
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.
153
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">
160                                                 [% END %]
161
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>
165                                                 </li>
166                                             [% END %]
167                                         [% END %]
168                                     [% END %]
169                                 [% END %]
170                                 [% FOR a IN result.authorities;
171                                     # We can go no further sans control_set.
172                                     NEXT UNLESS a.control_set;
173
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;
180                                         FOR h IN headings;
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.
186
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">
193                                                 [% END %]
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>
197                                                 </li>
198                                             [% END %]
199                                         [% END %]
200                                     [% END %]
201                                 [% END %]
202                             [% IF auth_headings_ul_added %]</ul>[% END %]
203                         </li>
204                     [% END %]
205                     </ul>
206                 [% END %]
207                 </div>
208
209                 [% PROCESS browse_pager id=1 %]
210             </div>
211 </div>
212         </div>
213     </div>
214
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">
220                     [% l("Note:") %]
221                 </span>
222                 <span class="browse-public-general-note-body">
223                 [% FOR piece IN note; piece | html; END %]
224                 </span>
225             </div>
226         [% END;
227     END;    # end of BLOCK authority_notes %]
228
229 [% END %]