]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates/opac-new/browse.tt2
LP#1778972: OPAC Redesign
[Evergreen.git] / Open-ILS / src / templates / opac-new / 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 id="main-content" class="container mx-auto w-75">
36             <div id="browse-the-catalog">
37                 <div id="browse-controls" class='row text-center'>
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                         <input id='search-submit-go' type="submit" value="[% l('Browse') %]" alt="[% l('Browse') %]" class="btn btn-confirm my-2"/>
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 text-center 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-outline-primary btn-sm" href="[% mkurl('', {bpivot => ctx.back_pivot}) %]" onclick="$('browse-pager-spinner-[% id %]').className = '';">&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                     <img id="browse-pager-spinner-[% id %]" 
76                         src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif[% ctx.cache_key %]"
77                         class="hidden" style="width: 16px; height: 16px;" 
78                         alt="[% l('Search in progress icon') %]" />
79                     [% IF ctx.forward_pivot %]
80                     <a class="btn btn-outline-primary btn-sm" href="[% mkurl('', {bpivot => ctx.forward_pivot}) %]" onclick="$('browse-pager-spinner-[% id %]').className = '';">[%l ('Next') %] &rarr;</a>
81                     [% END %]
82
83                    
84                         </div>
85                 </div>
86                 [% END %]
87
88                 [% PROCESS browse_pager id=0 %]
89
90                 <div id="browse-results" class="col-12">
91                 [% IF ctx.browse_error %]
92                     <span class="browse-error">
93                         [% l("An error occurred browsing records. " _
94                         "Please try again in a moment or report the issue " _
95                         "to library staff.") %]
96                     </span>
97                 [% ELSE %]
98                     [% IF ctx.browse_leading_article_warning %]
99                     <div class="browse-leading-article-warning">
100                             [% l("Your browse term seems to begin with an article (a, an, the). You might get better results by omitting the article.") %]
101                             [% IF ctx.browse_leading_article_alternative %]
102                             <p>
103                             [% alternative_link = BLOCK %]
104                             <a href="[% mkurl('', {bterm => ctx.browse_leading_article_alternative}, ['bpivot']) %]">[% ctx.browse_leading_article_alternative | html %]</a>
105                             [%-  END; # alternative_link BLOCK
106                                 l("Did you mean [_1]?", alternative_link);
107                             END # IF %]
108                             </p>
109                     </div>
110                     [% END %]
111                     <ul class="browse-result-list">
112                     [% FOR result IN ctx.browse_results %]
113                         <li class="browse-result">
114                             <span class="browse-result-value[% result.row_number == 0 && !CGI.param('bpivot') ? ' browse-result-best-match' : '' %]">
115                                 [% IF result.sources > 0 %] <!-- bib-linked browse value -->
116                                     <a href="[% mkurl(
117                                         ctx.opac_root _ '/results', {
118                                             'fi:has_browse_entry' => (result.browse_entry _ ',' _ result.fields)
119                                         }) %]">[% result.value | html %]</a>
120                                     <span class="browse-result-sources">([%
121                                         IF result.accurate == 'f';
122                                             l("At least"); " ";
123                                         END;
124                                     result.sources %])</span>
125                                 [% ELSE %] <!-- only authority links -->
126                                     [% result.value | html %]
127                                 [% END %]
128                             </span>
129
130                             [% FOR a IN result.authorities;
131                                     PROCESS authority_notes authority=a IF !sees.grep(a.id);
132                                END %]
133                             [% auth_headings_ul_added = 0; %]
134                                 [% seenit = {}; # for headings we've rendered
135                                    FOR a IN result.sees;
136                                     # We can go no further sans control_set.
137                                     NEXT UNLESS a.control_set;
138
139                                     # get_authority_fields is fast and cache-y.
140                                     acs = ctx.get_authority_fields(a.control_set);
141                                     FOR field_group IN a.headings;
142                                         field_id = field_group.keys.0;
143                                         field = acs.$field_id;
144                                         headings = field_group.values.0;
145                                         FOR h IN headings;
146                                             # We could display headings without
147                                             # links here when h.target is
148                                             # undef, if we wanted to, but note
149                                             # that h.target_count is only
150                                             # defined when h.target is.
151
152                                             IF h.target AND h.target_count AND result.list_authorities.grep('^' _ h.target _ '$').size == 0 AND h.main_entry;
153                                                 id = h.target; NEXT IF seenit.$id; seenit.$id = 1; 
154                                                 IF !auth_headings_ul_added;
155                                                     # only add a <ul> if we have at least one <li> (WCAG 2.0)
156                                                     auth_headings_ul_added = 1; %]
157                                                 <ul class="browse-result-authority-headings"> 
158                                                 [% END %]
159
160                                                 <li><span class="browse-result-authority-field-name">[% heading_use_label(use=h.type) %]</span>
161                                                 <a href="[% mkurl(ctx.opac_root _ '/browse', {bterm => h.heading}, ['bpivot']) %]">[% h.heading | html %]</a>
162                                                 <span class="browse-result-authority-bib-links">([% h.target_count %])</span>
163                                                 </li>
164                                             [% END %]
165                                         [% END %]
166                                     [% END %]
167                                 [% END %]
168                                 [% FOR a IN result.authorities;
169                                     # We can go no further sans control_set.
170                                     NEXT UNLESS a.control_set;
171
172                                     # get_authority_fields is fast and cache-y.
173                                     acs = ctx.get_authority_fields(a.control_set);
174                                     FOR field_group IN a.headings;
175                                         field_id = field_group.keys.0;
176                                         field = acs.$field_id;
177                                         headings = field_group.values.0;
178                                         FOR h IN headings;
179                                             # We could display headings without
180                                             # links here when h.target is
181                                             # undef, if we wanted to, but note
182                                             # that h.target_count is only
183                                             # defined when h.target is.
184
185                                             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';
186                                                 id = h.target; NEXT IF seenit.$id; seenit.$id = 1; 
187                                                 IF !auth_headings_ul_added;
188                                                     # only add a <ul> if we have at least one <li> (WCAG 2.0)
189                                                     auth_headings_ul_added = 1; %]
190                                                 <ul class="browse-result-authority-headings"> 
191                                                 [% END %]
192                                                 <li><span class="browse-result-authority-field-name">[% heading_use_label(use=h.type) %]</span>
193                                                 <a href="[% mkurl(ctx.opac_root _ '/results', {query => 'identifier|authority_id[' _ h.target _ ']'}) %]">[% h.heading | html %]</a>
194                                                 <span class="browse-result-authority-bib-links">([% h.target_count %])</span>
195                                                 </li>
196                                             [% END %]
197                                         [% END %]
198                                     [% END %]
199                                 [% END %]
200                             [% IF auth_headings_ul_added %]</ul>[% END %]
201                         </li>
202                     [% END %]
203                     </ul>
204                 [% END %]
205                 </div>
206
207                 [% PROCESS browse_pager id=1 %]
208             </div>
209 </div>
210             <div class="common-full-pad"></div> 
211         </div>
212     </div>
213
214     [% BLOCK authority_notes;
215         # Displays public general notes (sometimes called "scope notes" ?)
216         FOR note IN authority.notes %]
217             <div class="browse-public-general-note">
218                 <span class="browse-public-general-note-label">
219                     [% l("Note:") %]
220                 </span>
221                 <span class="browse-public-general-note-body">
222                 [% FOR piece IN note; piece | html; END %]
223                 </span>
224             </div>
225         [% END;
226     END;    # end of BLOCK authority_notes %]
227
228 [% END %]