]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/result/table.tt2
Restore facet-first loading, add breakpoint for results
[working/Evergreen.git] / Open-ILS / src / templates / opac / parts / result / table.tt2
1 [%  PROCESS "opac/parts/misc_util.tt2";
2
3     USE ResolverResolver;
4
5     ctx.result_start = 1 + ctx.page_size * page;
6     ctx.result_stop = ctx.page_size * (page + 1);
7     IF ctx.result_stop > ctx.hit_count; ctx.result_stop = ctx.hit_count; END;
8
9     result_count = ctx.result_start;
10
11 %]
12
13 [% PROCESS "opac/parts/result/paginate.tt2" %] 
14 [% ctx.results_count_header = PROCESS results_count_header;
15     ctx.results_count_header %]
16 [% IF ctx.bookbag %]
17 <div id="result-bookbag-heading">
18     <div class="result-bookbag-name">[% ctx.bookbag.name | html %]</div>
19     <div class="result-bookbag-description">[% ctx.bookbag.description | html %]</div>
20 </div>
21 [% END %]
22 <div id="result_table_div">
23     <div class="facet_sidebar_hidden" id="facet_sidebar">
24         <div id="return_to_hits"><a onclick="getResulty();">[% l('Back to results') %]</a></div>
25     [% INCLUDE "opac/parts/staff_saved_searches.tt2" %]
26     [% INCLUDE 'opac/parts/result/facets.tt2' %]
27     </div>
28             <div id="result_block" class="result_block_visible">
29                 <div id="refine_hits"><a onclick="getFacety();">[% l('Refine these results') %]</a></div>
30                 <table cellpadding="0" cellspacing="0"
31                     border="0" style="margin-top:10px;">
32                     <tbody id="result_table">
33                     [%  FOR rec IN ctx.records;
34                             attrs = {marc_xml => rec.marc_xml};
35                             PROCESS get_marc_attrs args=attrs;
36                             IF CGI.param('detail_record_view');
37                                 attrs.title = attrs.title_extended;
38                             END;
39                     -%]
40                         <tr class="result_table_row">
41                                             <td class="results_row_count" name="results_row_count">[%
42                                                     result_count; result_count = result_count + 1
43                                                 %].</td>
44                                             <td class='result_table_pic_header'>
45                                                 [% ident = attrs.isbn_clean || attrs.upc; IF ident; %]
46                                                 <a href="[% mkurl(ctx.opac_root _ '/record/' _ rec.id) %]"><img alt="[% l('Image of item') %]"
47                                                         name='item_jacket' class='result_table_pic' width="55"
48                                                         src='[% ctx.media_prefix %]/opac/extras/ac/jacket/small/[% ident | uri %]' /></a><br />
49                                                 [% END %]
50                                             </td>
51                                             <td class='result_table_title_cell' name='result_table_title_cell'>
52                                                <div class="result_metadata">
53                                                     <abbr class="unapi-id" title='tag:[% ctx.hostname %],[% date.format(date.now, '%Y') %]:biblio-record_entry/[% rec.id %]'></abbr>
54                                                     <a class='record_title' name='record_[% rec.id %]' name='item_title'
55                                                         href="[% mkurl(ctx.opac_root _ '/record/' _ rec.id) %]"
56                                                         [% HTML.attributes(title => l('Display record details for "[_1]"', attrs.title)) %]
57                                                         class='search_link'>[% attrs.title | html %]</a>
58 [%-
59 FOR entry IN attrs.graphic_titles;
60     FOR alt IN entry.graphic;
61         diratt = "";
62         IF alt.dir;
63             diratt = ' dir="' _ alt.dir _ '"';
64         END;
65 -%]
66 <div class="graphic880"[% diratt %]>
67     [% alt.value | html %]
68 </div>
69 [%-
70     END;
71 END;
72 -%]
73  
74                                                     <div>
75                                                         <a title="[% l("Perform an Author Search") %]"
76                                                                 class="record_author" name='item_author'
77                                                                 href="[%- 
78                                                                     authorquery = attrs.author | replace('[#"^$\+\-,\.:;&|\[\]()]', ' ');
79                                                                     mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, ['page'])
80                                                                     -%]">[% attrs.author | html %]</a>
81 [%-
82 FOR entry IN attrs.graphic_authors;
83     FOR alt IN entry.graphic;
84         diratt = "";
85         IF alt.dir;
86             diratt = ' dir="' _ alt.dir _ '"';
87         END;
88 -%]
89 <div class="graphic880"[% diratt %]>
90     [% alt.value | html %]
91 </div>
92 [%-
93     END;
94 END;
95 -%]
96
97                                                     </div>
98                                                     <div id='bib_format' class='result_table_title_cell'>
99                                                     [%- IF attrs.format_label; %]
100                                                         [% attrs.format_label; %]
101                                                     [%- END %]
102                                                     [%- UNLESS CGI.param('detail_record_view')
103                                                             OR (show_more_details.default == 'true'
104                                                             OR show_more_details.default == 'hide');
105                                                             IF attrs.pubdate;
106                                                                 pubdate_clean = attrs.pubdate | html;
107                                                                 l(" ([_1])", pubdate_clean);
108                                                             END;
109                                                         END
110                                                     -%]
111                                                     </div>
112                                                     <span name="googleBooksLink" class="hide_me">
113                                                         <a style='padding-left: 8px;'
114                                                             class='classic_link hide_me'
115                                                             name="googleBooks-link">[% l("Browse in Google Books Search") %]</a>
116                                                     </span>
117                                                     <table cellpadding="0" cellspacing="0" border="0"
118                                                         class="results_info_table">
119                                                         [% IF args.holdings.size > 0 %]
120                                                         <tr name='bib_cn_list' class='result_table_title_cell'>
121                                                             <td valign='top'>
122                                                                 <strong>[% l('Call number:') %]</strong>
123                                                             </td>
124                                                             <td>[% args.holdings.0.label | html %]</td>
125                                                         </tr>
126                                                         [% END %]
127
128                                                         [% IF CGI.param('detail_record_view') %]
129                                                         <!-- These fields are visible when viewing the results page in 'detailed' mode -->
130
131                                                         [% IF attrs.pubinfo %]
132                                                             <tr name="results_pub_tr">
133                                                                 <td valign="top">
134                                                                     <strong>[% l('Publisher:') %]</strong>
135                                                                 </td>
136                                                                 <td>[% attrs.pubinfo | html %]
137 [%-
138 FOR entry IN attrs.graphic_pubinfos;
139     FOR alt IN entry.graphic;
140         diratt = "";
141         IF alt.dir;
142             diratt = ' dir="' _ alt.dir _ '"';
143         END;
144 -%]
145 <div class="graphic880"[% diratt %]>
146     [% alt.value | html %]
147 </div>
148 [%-
149     END;
150 END;
151 -%]
152 </td>
153                                                             </tr>
154                                                         [% END %]
155                                                         [% IF attrs.isbns.size > 0 %]
156                                                             <tr name="results_isbn_tr">
157                                                                 <td valign="top">
158                                                                     <strong>[% l('ISBN:') %]</strong>
159                                                                 </td>
160                                                                 <td>[% attrs.isbns.0 | html %]</td>
161                                                             </tr>
162                                                         [% END %]
163                                                         [%- IF attrs.issns.size > 0 %]
164                                                             <tr name="results_issn_tr">
165                                                                 <td valign="top">
166                                                                     <strong>[% l('ISSN:') %]</strong>
167                                                                 </td>
168                                                                 <td>[% attrs.issns.0 | html %]</td>
169                                                             </tr>
170                                                         [%- END %]
171                                                         [%- IF openurl.enabled == 'true';
172                                                             FOREACH issn IN args.issns;
173                                                                 NEXT IF issn == '';
174                                                                 res_urls = ResolverResolver.resolve_issn(issn, openurl.baseurl);
175                                                                 FOREACH res IN res_urls;
176                                                         %]
177                                                         <tr name="results_issn_tr">
178                                                             <td valign="top">
179                                                                 <strong><a href="[% res.target_url %]">
180                                                                 [% res.public_name | html %]</a></strong>
181                                                             </td>
182                                                             <td>[% res.target_coverage | html %]</td>
183                                                         </tr>
184                                                                 [% END %]
185                                                             [% END %]
186                                                         [% END %]
187
188                                                         [% IF attrs.edition %]
189                                                             <tr name="results_edition_tr">
190                                                                 <td valign="top">
191                                                                     <strong>[% l('Edition:') %]</strong>
192                                                                 </td>
193                                                                 <td>[% attrs.edition | html %]
194 [%-
195 FOR entry IN attrs.graphic_editions;
196     FOR alt IN entry.graphic;
197         diratt = "";
198         IF alt.dir;
199             diratt = ' dir="' _ alt.dir _ '"';
200         END;
201 -%]
202 <div class="graphic880"[% diratt %]>
203     [% alt.value | html %]
204 </div>
205 [%-
206     END;
207 END;
208 -%]
209 </td>
210                                                             </tr>
211                                                         [% END %]
212                                                         [% IF attrs.phys_desc %]
213                                                             <tr name="results_phys_desc_tr">
214                                                                 <td nowrap="nowrap" valign="top">
215                                                                     <strong>[% l('Phys. Desc.:') %]</strong>
216                                                                 </td>
217                                                                 <td>
218                                                                     [% args.phys_desc | html %]
219                                                                 </td>
220                                                             </tr>
221                                                         [% END %]
222                                                         [% FOR uri IN args.uris %]
223                                                             <tr name='bib_uri_list' class='result_table_title_cell'>
224                                                                 <td valign='top'>
225                                                                     <strong>[% l('Electronic resource') %]</strong>
226                                                                 </td>
227                                                                 <td><a href="[% uri.href %]">[% uri.link | html %]</a>[% ' - ' _ uri.note | html IF uri.note %]</td>
228                                                             </tr>
229                                                             [% END %]
230                                                             [%- IF args.holdings.size > 0;
231                                                                 FOREACH copy IN args.holdings;
232                                                                     IF copy.part_label != '';
233                                                                         has_parts = 'true';
234                                                                         LAST;
235                                                                     END;
236                                                                 END;
237                                                             %]
238                                                             <tr name='bib_cn_list' class='result_table_title_cell'>
239                                                                 <td colspan='2'>
240                                                                     <table class='result_holdings_table'>
241                                                                         <thead><tr>
242                                                                             <th>[% l('Library') %]</th>
243                                                                             <th>[% l('Shelving location') %]</th>
244                                                                             <th>[% l('Call number') %]</th>
245                                                                             [%- IF has_parts == 'true'; %]
246                                                                             <th>[% l('Part') %]</th>
247                                                                             [%- END %]
248                                                                             <th>[% l('Status') %]</th>
249                                                                         </tr></thead>
250                                                                         <tbody>
251                                                                 [% FOR copy IN args.holdings %]
252                                                                         <tr>
253                                                                             <td>
254 [%-
255     lib_url = ctx.get_org_setting(copy.circ_lib, 'lib.info_url');
256     IF lib_url; '<a href="'; lib_url | url; '">'; END;
257     copy.library | html;
258     IF lib_url; '</a>'; END;
259 -%]
260                                                                             </td>
261                                                                             <td>[% copy.location | html %]</td>
262                                                                             <td>[% copy.label | html %]</td>
263                                                                             [%- IF has_parts == 'true'; %]
264                                                                             <td>[% copy.part_label %]</td>
265                                                                             [%- END %]
266                                                                             <td>[% copy.status | html %]</td>
267                                                                         </tr>
268                                                                 [% END %]
269                                                                         </tbody>
270                                                                     </table>
271                                                                 </td>
272                                                             </tr>
273                                                             [%- has_parts = 'false';
274                                                                 END;
275                                                              %]
276                                                         [% END %] <!-- END detail_record_view -->
277                                                     </table>
278                                                     [% PROCESS "opac/parts/result/copy_counts.tt2" %]
279                                                     [% IF rec.user_circulated %]
280                                                     <div class="result_item_circulated">
281                                                         <img src="[% ctx.media_prefix %]/images/green_check.png" alt="[% l('Checked Out Before') %]"/>
282                                                         <span>[% l('I have checked this item out before') %]</span>
283                                                     </div>
284                                                     [% END %]
285                                                     [% IF ctx.bookbag;
286                                                         rec_id = rec.id;
287                                                         FOR note IN ctx.bookbag_items_by_bre_id.$rec_id.notes %]
288                                                     <div class="result-bookbag-item-note">
289                                                         [% note.note | html %]
290                                                     </div>
291                                                         [% END %]
292                                                     [% END %]
293                                                 </div>
294                                                 <div class="result_table_utils_cont">
295                                                     <div class="result_table_utils">
296 [%- search_ou = ctx.search_ou;
297     num_holdable_copies = attrs.marc_xml.findnodes('//*[local-name()="holdings" and @has_holdable="true"]').size || 0;
298     IF ctx.place_unfillable ||
299         ( num_holdable_copies > 0
300             && (ctx.holds_block.enabled != 'true' || attrs.org_copy_counts.$search_ou.available == 0)
301         )
302 %]
303                                                         <div class="results_aux_utils place_hold"><a
304                                                                 href="[% mkurl(ctx.opac_root _ '/place_hold', 
305                                                                     {hold_target => rec.id, hold_type => 'T', hold_source_page => mkurl()}) %]" 
306                                                                     name="place_hold_link" class="no-dec"><img
307                                                                 src="[% ctx.media_prefix %]/images/green_check.png"
308                                                                 alt=""/><span class="result_place_hold">[% l('Place Hold') %]</span></a>
309                                                         </div>
310 [%- END -%]
311                                                         <div class="results_aux_utils result_util">
312                                                             [%  IF ctx.user;
313                                                                 INCLUDE "opac/parts/bookbag_actions.tt2";
314                                                             %]
315                                                             [%  ELSE;
316                                                                 operation = ctx.mylist.grep(rec.id).size ? "delete" : "add";
317                                                                 label = (operation == "add") ? l("Add to my list") : l("Remove from my list");
318                                                                 href = mkurl(ctx.opac_root _ '/mylist/' _ operation, 
319                                                                         {record => rec.id, anchor => 'record_' _ rec.id}, 1);
320                                                             %]      
321                                                             <a href="[% href %]" class="no-dec">
322                                                                 <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
323                                                                 [% label %]
324                                                             </a>
325                                                             [% END %]
326                                                         </div>
327                                                         [% IF ENV.OILS_CONTENT_CAFE_USER %]
328                                                         <div class="results_aux_utils result_util">
329                                                             <a title="[% l('Reviews and More') %]" target='_blank' 
330                                                                 href="[% ctx.ext_proto %]://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=[%- 
331                                                                     ENV.OILS_CONTENT_CAFE_USER %]&amp;Password=[%-
332                                                                     ENV.OILS_CONTENT_CAFE_PASS %]&amp;ItemKey=[% ident | uri %]&amp;Options=Y">
333                                                                 <img src='[% ctx.media_prefix %]/images/starz.png'/> 
334                                                                 <span class="results_reviews">[% l('Reviews &amp; More') %]</span>
335                                                             </a>
336                                                         </div>
337                                                         [% END %]
338                                                     </div>
339                                                 </div>
340
341                                             </td>
342
343                                         </tr>
344                                         [%- IF ENV.OILS_CHILIFRESH_ACCOUNT %]
345                                         <tr>
346                                             <td/>
347                                             <td align='center'> <!-- Chilifresh reviews link --> 
348                                                 <span class="chili_review" id="isbn_[% attrs.isbn_clean | html %]"> </span>
349                                             </td>
350                                         </tr>
351                                         <tr>
352                                             <td/>
353                                             <td colspan='5'> <!-- Chilifresh reviews panel -->
354                                                 <div id="chili_review_[% attrs.isbn_clean | html %]" style="display: none;" align="center"></div>
355                                             </td>
356                                         </tr>
357                                         [%- END %]
358                     [% END %]
359                     </tbody>
360                 </table>
361             </div>
362 </div>
363 <div class="result_footer_nav1">
364     [% ctx.results_count_header %]
365 </div>
366 <script>
367 resultBlock = document.querySelector('#result_block');
368 facetSidebar = document.querySelector('#facet_sidebar');
369 function getFacety() {
370     resultBlock.setAttribute('class', 'result_block_hidden');
371     facetSidebar.setAttribute('class', 'facet_sidebar_visible');
372     window.location.hash = 'facet_sidebar';
373 }
374 function getResulty() {
375     resultBlock.setAttribute('class', 'result_block_visible');
376     facetSidebar.setAttribute('class', 'facet_sidebar_hidden');
377     window.location.hash = 'result_block';
378 }
379 </script>