Browse catalog shortcut links should clear the search query
[working/Evergreen.git] / Open-ILS / src / templates / opac / browse.tt2
1 [%- # This is the bib and authority combined record browser.
2
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";
8
9     ctx.page_title = l("Browse the Catalog");
10     blimit = CGI.param('blimit') || ctx.opac_hits_per_page || 10;
11
12     depart_list = ['blimit', 'bterm', 'bpivot'];
13 %]
14
15     <div id="search-wrapper">
16         [%# XXX TODO Give searchbar.tt2 more smarts so we can just do:
17           # INCLUDE "opac/parts/searchbar.tt2" %]
18         <div id="search-box">
19             <span class="search_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/home', {}, depart_list) %]">[% l('Search the Catalog') %]</a></span>
20             <span><a href="[% mkurl(ctx.opac_root _ '/advanced', {}, depart_list) %]"
21                     id="home_adv_search_link">[%l('Advanced Search')%]</a></span>
22             <span>[% l('Browse the Catalog') %]</span>
23         </div>
24     </div>
25     <div id="content-wrapper">
26         <div id="main-content">
27             <div id="browse-the-catalog">
28                 <div id="browse-controls">
29                     <form method="get" onsubmit="$('browse-submit-spinner').className = ''; return true">
30                         <input type="hidden" name="blimit"
31                             value="[% blimit %]" />
32
33                         [% control_qtype = INCLUDE "opac/parts/qtype_selector.tt2"
34                             id="browse-search-class" browse_only=1 plural=1 %]
35
36                         [% control_bterm = BLOCK %]<input type="text" name="bterm" id="browse-term"
37                             value="[% CGI.param('bterm') | html %]" />[% END %]
38                         [% control_locg = INCLUDE build_org_selector id='browse-context'
39                             show_loc_groups=1
40                             arialabel=l('Select holding library') %]
41                         [% l('Browse for [_1] starting with [_2] in [_3]', control_qtype, control_bterm, control_locg) %]
42
43                         <input type="submit" value="[% l('Go') %]" />
44                         <img id="browse-submit-spinner" src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif" class="hidden" style="width: 16px; height: 16px;" alt="" />
45                     </form>
46                 </div>
47
48                 [% BLOCK browse_pager %]
49                 <div class="browse-pager">
50                     [% IF ctx.back_pivot %]
51                     <a class="opac-button" href="[% mkurl('', {bpivot => ctx.back_pivot}) %]" onclick="$('browse-pager-spinner-[% id %]').className = '';">&larr; [%l ('Back') %]</a>
52                     [% END %]
53                     [% IF ctx.pager_shortcuts;
54                         current_qtype = CGI.param('qtype') || 'title' %]
55                     <span class="browse-shortcuts">
56                         [% FOR shortcut IN ctx.pager_shortcuts %]
57                             <a href="[% mkurl('', {qtype => current_qtype, bterm => shortcut.0}, ['bpivot','query']) %]">[% shortcut.1 %]</a>
58                         [% END %]
59                     </span>
60                     [% END %]
61
62                     [% IF ctx.forward_pivot %]
63                     <a class="opac-button" href="[% mkurl('', {bpivot => ctx.forward_pivot}) %]" onclick="$('browse-pager-spinner-[% id %]').className = '';">[%l ('Next') %] &rarr;</a>
64                     [% END %]
65
66                     <img id="browse-pager-spinner-[% id %]" src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif" class="hidden" style="width: 16px; height: 16px;" alt="" />
67                 </div>
68                 [% END %]
69
70                 [% PROCESS browse_pager id=0 %]
71
72                 <div id="browse-results">
73                 [% IF ctx.browse_error %]
74                     <span class="browse-error">
75                         [% l("An error occurred browsing records. " _
76                         "Please try again in a moment or report the issue " _
77                         "to library staff.") %]
78                     </span>
79                 [% ELSE %]
80                     [% IF ctx.browse_leading_article_warning %]
81                     <div class="browse-leading-article-warning">
82                             [% l("Your browse term seems to begin with an article (a, an, the). You might get better results by omitting the article.") %]
83                             [% IF ctx.browse_leading_article_alternative %]
84                             <p>
85                             [% alternative_link = BLOCK %]
86                             <a href="[% mkurl('', {bterm => ctx.browse_leading_article_alternative}, ['bpivot']) %]">[% ctx.browse_leading_article_alternative | html %]</a>
87                             [%-  END; # alternative_link BLOCK
88                                 l("Did you mean [_1]?", alternative_link);
89                             END # IF %]
90                             </p>
91                     </div>
92                     [% END %]
93
94                     <ul class="browse-result-list">
95                     [% FOR result IN ctx.browse_results %]
96                         <li class="browse-result">
97                             <span class="browse-result-value[% result.row_number == 0 && !CGI.param('bpivot') ? ' browse-result-best-match' : '' %]">
98                                 <a href="[% mkurl(
99                                     ctx.opac_root _ '/results', {
100                                         'fi:has_browse_entry' => (result.browse_entry _ ',' _ result.fields)
101                                     }) %]">[% result.value | html %]</a>
102                             </span>
103                             <span class="browse-result-sources">([%
104                                 IF result.accurate == 'f';
105                                     l("At least"); " ";
106                                 END;
107                                 result.sources %])</span>
108                             [% IF result.authorities.size %]
109                             <ul class="browse-result-authority-headings">
110                                 [% FOR a IN result.authorities;
111                                     PROCESS authority_notes authority=a;
112
113                                     # Other than displaying public general
114                                     # notes, we can go no further sans
115                                     # control_set.
116                                     NEXT UNLESS a.control_set;
117
118                                     # get_authority_fields is fast and cache-y.
119                                     acs = ctx.get_authority_fields(a.control_set);
120                                     FOR field_group IN a.headings;
121                                         field_id = field_group.keys.0;
122                                         field = acs.$field_id;
123                                         headings = field_group.values.0;
124                                         FOR h IN headings;
125                                             # We could display headings without
126                                             # links here when h.target is
127                                             # undef, if we wanted to, but note
128                                             # that h.target_count is only
129                                             # defined when h.target is.
130
131                                             IF h.target AND h.target_count %]
132                                             <li><span class="browse-result-authority-field-name">[% field.name %]</span>
133                                             <a href="[% mkurl(ctx.opac_root _ '/results', {query => 'identifier|authority_id[' _ h.target _ ']'}) %]">[% h.heading | html %]</a>
134                                             <span class="browse-result-authority-bib-links">([% h.target_count %])</span>
135                                             </li>
136                                             [% END %]
137                                         [% END %]
138                                     [% END %]
139                                 [% END %]
140                             </ul>
141                             [% END %]
142                         </li>
143                     [% END %]
144                     </ul>
145                 [% END %]
146                 </div>
147
148                 [% PROCESS browse_pager id=1 %]
149             </div>
150
151             <div class="common-full-pad"></div> 
152         </div>
153     </div>
154
155     [% BLOCK authority_notes;
156         # Displays public general notes (sometimes called "scope notes" ?)
157         FOR note IN authority.notes %]
158             <div class="browse-public-general-note">
159                 <span class="browse-public-general-note-label">
160                     [% l("Note:") %]
161                 </span>
162                 <span class="browse-public-general-note-body">
163                 [% FOR piece IN note; piece | html; END %]
164                 </span>
165             </div>
166         [% END;
167     END;    # end of BLOCK authority_notes %]
168
169 [% END %]