]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates/opac/parts/result/table.tt2
LP#1670425: Moving display of advanced search limiters on search results page
[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     # don't display a box for the search_format filter,
12     # as that's got its own widget
13     ignore_filters = ['search_format'];
14
15     trimmed_filters = [];
16     FOR filter IN ctx.query_struct.filters;
17         fname = filter.name;
18         IF ignore_filters.grep('^' _ fname _ '$').size;
19             NEXT;
20         END;
21         trimmed_filters.push(filter);
22     END;
23
24     ctx.query_struct.filters = trimmed_filters;
25
26 %]
27
28 [% PROCESS "opac/parts/result/paginate.tt2" %] 
29 [% ctx.results_count_header = PROCESS results_count_header;
30     ctx.results_count_header %]
31 [% IF ctx.bookbag %]
32 <div id="result-bookbag-heading">
33     <div class="result-bookbag-name">[% ctx.bookbag.name | html %]</div>
34     <div class="result-bookbag-description">[% ctx.bookbag.description | html %]</div>
35 </div>
36 [% END %]
37 <div id="result_table_div">
38     <div class="facet_sidebar_hidden" id="facet_sidebar">
39     [%- IF ctx.is_staff %]
40     <h3 class="sr-only">[% l('Saved Searches') %]</h3>
41     [% INCLUDE "opac/parts/staff_saved_searches.tt2" %]
42     [%-  END %]
43     <h3 class="sr-only">[% l('Search Results facets') %]</h3>
44     [% INCLUDE 'opac/parts/result/facets.tt2' %]
45     <h3 class="sr-only">[% l('Search Results List') %]</h3>
46     </div>
47             <div id="result_block" class="result_block_visible">
48                 <table id="result_table_table" title="[% l('Search Results') %]"
49                   class="table_no_border_space table_no_cell_pad">
50                     <thead class="sr-only">
51                       <tr>
52                         <th>[% l('Search result number') %]</th>
53                         <th>[% l('Book jacket cover art') %]</th>
54                         <th>[% l('Item details and Actions') %]</th>
55                       </tr>
56                     </thead>
57                     <tbody id="result_table">
58                     [%  FOR rec IN ctx.records;
59                             attrs = {};
60                             attrs.marc_xml = rec.marc_xml;
61                             attrs.mr_constituent_ids = [];
62                             FOREACH mr_constituent_id IN rec.mr_constituent_ids;
63                                 attrs.mr_constituent_ids.push(mr_constituent_id);
64                             END;
65                             PROCESS get_marc_attrs args=attrs;
66                             IF show_detail_view;
67                                 attrs.title = attrs.title_extended;
68                             END;
69                             # note: rec.id refers to the record identifier, regardless
70                             # of the type of record. i.e. rec.id = mmr_id ? mmr_id : bre_id
71                             IF rec.mmr_id;
72                                 IF rec.mr_constituent_count > 1;
73                                     # metarecords link to record list page
74                                     record_url = mkurl(ctx.opac_root _ '/results', 
75                                         {metarecord => rec.mmr_id}, ['page']);
76                                 ELSE;
77                                     # for MR, bre_id refers to the master and in
78                                     # this case, only, record
79                                     record_url = mkurl(ctx.opac_root _ '/record/' _ attrs.mr_constituent_ids.0, { badges => rec.badges.join(',') });
80                                 END;
81                                 hold_type = 'M';
82                             ELSE;
83                                 record_url = mkurl(ctx.opac_root _ '/record/' _ rec.bre_id, { badges => rec.badges.join(',') });
84                                 hold_type = 'T';
85                             END;
86                     -%]
87                         <tr class="result_table_row">
88                                             <td class="results_row_count" name="results_row_count">[%
89                                                     result_count; result_count = result_count + 1
90                                                 %].</td>
91                                             <td class='result_table_pic_header'>
92                                                 <a href="[% record_url %]"><img alt="[% l('Book cover') %]"
93                                                         name='item_jacket' class='result_table_pic' width="55"
94                                                         src='[% ctx.media_prefix %]/opac/extras/ac/jacket/small/r/[% rec.bre_id | uri %]' /></a><br />
95                                             </td>
96                                             <td class='result_table_title_cell' name='result_table_title_cell'>
97                                                <div class="result_metadata">
98                                                     [% IF rec.mmr_id %]
99                                                     <abbr class="unapi-id" 
100                                                       title='tag:[% ctx.hostname %],[% date.format(date.now, '%Y') %]:metabib-metarecord/[% rec.mmr_id %]'>
101                                                     </abbr>
102                                                     [% ELSE %]
103                                                     <abbr class="unapi-id" 
104                                                       title='tag:[% ctx.hostname %],[% date.format(date.now, '%Y') %]:biblio-record_entry/[% rec.bre_id %]'>
105                                                     </abbr>
106                                                     [% END %]
107                                                     <a class='record_title search_link' name='record_[% rec.id %]'
108                                                         href="[% record_url %]"
109                                                         [% html_text_attr('title', l('Display record details for "[_1]"', attrs.title)) %]>
110                                                         [% attrs.title | html %]
111                                                      </a>
112                                                      [% IF rec.mr_constituent_count.defined && rec.mr_constituent_count > 1 %]
113                                                      <span title="[% l('This group contains [_1] records', rec.mr_constituent_count) %]">
114                                                       ([% rec.mr_constituent_count %])
115                                                      </span>
116                                                      [% END %]
117
118 [%-
119 FOR entry IN attrs.graphic_titles;
120     FOR alt IN entry.graphic;
121         diratt = "";
122         IF alt.dir;
123             diratt = ' dir="' _ alt.dir _ '"';
124         END;
125 -%]
126 <div class="graphic880"[% diratt %]>
127     [% alt.value | html %]
128 </div>
129 [%-
130     END;
131 END;
132 -%]
133  
134                                                     <div>
135                                                         <a title="[% l("Perform an Author Search") %]"
136                                                                 class="record_author"
137                                                                 href="[%- 
138                                                                     authorquery = attrs.author | replace('[#"^$\+\-,\.:;&|\[\]()]', ' ');
139                                                                     mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, general_search_parms.merge(expert_search_parms, browse_search_parms, facet_search_parms))
140                                                                     -%]" rel="nofollow" vocab="">[% attrs.author | html %]</a>
141 [%-
142 FOR entry IN attrs.graphic_authors;
143     FOR alt IN entry.graphic;
144         diratt = "";
145         IF alt.dir;
146             diratt = ' dir="' _ alt.dir _ '"';
147         END;
148 -%]
149 <div class="graphic880"[% diratt %]>
150     [% alt.value | html %]
151 </div>
152 [%-
153     END;
154 END;
155 -%]
156
157                                                     </div>
158                                                     <div class='result_table_title_cell'>
159                                                     [%- IF attrs.format_label; %]
160                                                         [% FOR format IN attrs.all_formats %]
161                                                             <img title="[% format.label | html %]" 
162                                                                 alt="[% format.label | html %]" 
163                                                                 src="[% format.icon %]" /> 
164                                                             [% format.label | html %]
165                                                         [% END %]
166                                                     [%- END %]
167                                                     [%- UNLESS show_detail_view;
168                                                             IF attrs.pubdate;
169                                                                 pubdate_clean = attrs.pubdate | html;
170                                                                 l(" ([_1])", pubdate_clean);
171                                                             ELSIF attrs.copyright;
172                                                                 copyright_clean = attrs.copyright | html;
173                                                                 l(" ([_1])", copyright_clean);                                                                
174                                                             END;
175                                                         END
176                                                     -%]
177                                                     </div>
178                                                     [% IF rec.popularity > 0.0 %]
179                                                       <div>
180                                                         <span><strong>[% l('Popularity:') %]</strong> [% rec.popularity %] / 5.0</span>
181                                                       </div>
182                                                     [% END %]
183                                                     <table 
184                                                        role="presentation"
185                                                        title="[% l('Record Holdings Summary') %]"
186                                                        class="table_no_border_space table_no_cell_pad table_no_border results_info_table">
187                                                         [% UNLESS rec.mmr_id %]
188                                                            [% IF args.holdings.size > 0 %]
189                                                         <tr name='bib_cn_list' class='result_table_title_cell'>
190                                                             <td valign='top'>
191                                                                 <strong>[% l('Call number:') %]</strong>
192                                                             </td>
193                                                             <td>[% args.holdings.0.label | html %]</td>
194                                                         </tr>
195                                                            [% END %]
196                                                         [% END %]
197
198                                                         [%- IF show_detail_view -%]
199                                                         <!-- These fields are visible when viewing the results page in 'detailed' mode -->
200                                                         [% UNLESS rec.mmr_id %]
201                                                         <!-- Do not show publication-specific information on a metarecord search results page -->
202                                                         [% IF attrs.publisher %]
203                                                             <tr name="results_pub_tr">
204                                                                 <td valign="top">
205                                                                     <strong>[% l('Publisher:') %]</strong>
206                                                                 </td>
207                                                                 <td>[% attrs.pubplace | html; %] [% attrs.publisher | html; %] [% attrs.pubdate | html; %]
208 [%-
209 FOR entry IN attrs.graphic_pubinfos;
210     FOR alt IN entry.graphic;
211         diratt = "";
212         IF alt.dir;
213             diratt = ' dir="' _ alt.dir _ '"';
214         END;
215 -%]
216 <div class="graphic880"[% diratt %]>
217     [% alt.value | html %]
218 </div>
219 [%-
220     END;
221 END;
222 -%]
223 </td>
224                                                             </tr>
225                                                         [% ELSIF attrs.producer %]
226                                                             <tr name="results_pub_tr">
227                                                                 <td valign="top">
228                                                                     <strong>[% l('Producer:') %]</strong>
229                                                                 </td>
230                                                                 <td>[% attrs.prodplace | html; %] [% attrs.producer | html; %] [% attrs.proddate | html; %]</td>
231                                                             </tr>
232                                                         [% ELSIF attrs.distributor %]
233                                                             <tr name="results_pub_tr">
234                                                                 <td valign="top">
235                                                                     <strong>[% l('Distributor:') %]</strong>
236                                                                 </td>
237                                                                 <td>[% attrs.distplace | html; %] [% attrs.distributor | html; %] [% attrs.distdate | html; %]</td>
238                                                             </tr>
239                                                         [% ELSIF attrs.manufacturer %]
240                                                             <tr name="results_pub_tr">
241                                                                 <td valign="top">
242                                                                     <strong>[% l('Manufacturer:') %]</strong>
243                                                                 </td>
244                                                                 <td>[% attrs.manplace | html; %] [% attrs.manufacturer | html; %] [% attrs.mandate | html; %]</td>
245                                                             </tr>
246                                                         [% END %]
247                                                         [% IF attrs.isbns.size > 0 %]
248                                                             <tr name="results_isbn_tr">
249                                                                 <td valign="top">
250                                                                     <strong>[% l('ISBN:') %]</strong>
251                                                                 </td>
252                                                                 <td>[% attrs.isbns.0 | html %]</td>
253                                                             </tr>
254                                                         [% END %]
255                                                         [%- IF attrs.issns.size > 0 %]
256                                                             <tr name="results_issn_tr">
257                                                                 <td valign="top">
258                                                                     <strong>[% l('ISSN:') %]</strong>
259                                                                 </td>
260                                                                 <td>[% attrs.issns.0 | html %]</td>
261                                                             </tr>
262                                                         [%- END %]
263                                                         [%- IF openurl.enabled == 'true';
264                                                             FOREACH issn IN args.issns;
265                                                                 NEXT IF issn == '';
266                                                                 res_urls = ResolverResolver.resolve_issn(issn, openurl.baseurl);
267                                                                 FOREACH res IN res_urls;
268                                                         %]
269                                                         <tr name="results_issn_tr">
270                                                             <td valign="top">
271                                                                 <strong><a href="[% res.target_url %]">
272                                                                 [% res.public_name | html %]</a></strong>
273                                                             </td>
274                                                             <td>[% res.target_coverage | html %]
275                                                             [%- IF res.target_embargo != '';
276                                                                     ' - ';
277                                                                     res.target_embargo | html;
278                                                                 END;
279                                                             -%]
280                                                             </td>
281                                                         </tr>
282                                                                 [% END %]
283                                                             [% END %]
284                                                         [% END %]
285
286                                                         [% IF attrs.edition %]
287                                                             <tr name="results_edition_tr">
288                                                                 <td valign="top">
289                                                                     <strong>[% l('Edition:') %]</strong>
290                                                                 </td>
291                                                                 <td>[% attrs.edition | html %]
292 [%-
293 FOR entry IN attrs.graphic_editions;
294     FOR alt IN entry.graphic;
295         diratt = "";
296         IF alt.dir;
297             diratt = ' dir="' _ alt.dir _ '"';
298         END;
299 -%]
300 <div class="graphic880"[% diratt %]>
301     [% alt.value | html %]
302 </div>
303 [%-
304     END;
305 END;
306 -%]
307 </td>
308                                                             </tr>
309                                                         [% END %]
310                                                         [% IF attrs.phys_desc %]
311                                                             <tr name="results_phys_desc_tr">
312                                                                 <td nowrap="nowrap" valign="top">
313                                                                     <strong>[% l('Phys. Desc.:') %]</strong>
314                                                                 </td>
315                                                                 <td>
316                                                                     [% args.phys_desc | html %]
317                                                                 </td>
318                                                             </tr>
319                                                         [% END %]
320                                                         [% FOR uri IN args.uris %]
321                                                             <tr name='bib_uri_list' class='result_table_title_cell'>
322                                                                 <td valign='top'>
323                                                                     <strong>[% l('Electronic resource') %]</strong>
324                                                                 </td>
325                                                                 <td><a href="[% uri.href %]" class="uri_link">[% uri.link | html %]</a>[% ' - ' _ uri.note | html IF uri.note %]</td>
326                                                             </tr>
327                                                             [% END %]
328                                                          [% END %]
329                                                             [%- IF args.holdings.size > 0;
330                                                                 FOREACH copy IN args.holdings;
331                                                                     IF copy.part_label != '';
332                                                                         has_parts = 'true';
333                                                                         LAST;
334                                                                     END;
335                                                                 END;
336                                                             %]
337                                                             <tr name='bib_cn_list' class='result_table_title_cell'>
338                                                                 <td colspan='2'>
339                                                                     <table title="[% l('Record Holdings Details') %]"
340                                                                            class='result_holdings_table'>
341                                                                         <thead><tr>
342                                                                             <th>[% l('Library') %]</th>
343                                                                             <th>[% l('Shelving location') %]</th>
344                                                                             <th>[% l('Call number') %]</th>
345                                                                             [%- IF has_parts == 'true'; %]
346                                                                             <th>[% l('Part') %]</th>
347                                                                             [%- END %]
348                                                                             <th>[% l('Status') %]</th>
349                                                                         </tr></thead>
350                                                                         <tbody>
351                                                                 [% FOR copy IN args.holdings %]
352                                                                         <tr>
353                                                                             <td>
354 [%- copy_info = copy;
355     INCLUDE "opac/parts/library_name_link.tt2"; %]
356                                                                             </td>
357                                                                             <td>[% copy.location | html %]</td>
358                                                                             <td>[% copy.label | html %]</td>
359                                                                             [%- IF has_parts == 'true'; %]
360                                                                             <td>[% copy.part_label %]</td>
361                                                                             [%- END %]
362                                                                             <td>[% copy.status | html %]</td>
363                                                                         </tr>
364                                                                 [% END %]
365                                                                         </tbody>
366                                                                     </table>
367                                                                 </td>
368                                                             </tr>
369                                                             [%- has_parts = 'false';
370                                                                 END;
371                                                              %]
372                                                         [% END %] <!-- END detail_record_view -->
373                                                     </table>
374                                                     [% 
375                                                         IF ebook_api.enabled == 'true';
376                                                             INCLUDE "opac/parts/ebook_api/avail.tt2";
377                                                         END;
378                                                     %]
379                                                     [% PROCESS "opac/parts/result/copy_counts.tt2" %]
380                                                     [% IF rec.user_circulated %]
381                                                     <div class="result_item_circulated">
382                                                         <img src="[% ctx.media_prefix %]/images/green_check.png" alt="[% l('Checked Out Before') %]"/>
383                                                         <span>[% l('I have checked this item out before') %]</span>
384                                                     </div>
385                                                     [% END %]
386                                                     [% IF ctx.bookbag;
387                                                         rec_id = rec.id;
388                                                         FOR note IN ctx.bookbag_items_by_bre_id.$rec_id.notes %]
389                                                     <div class="result-bookbag-item-note">
390                                                         [% note.note | html %]
391                                                     </div>
392                                                         [% END %]
393                                                     [% END %]
394                                                 </div>
395                                                 <div class="result_table_utils_cont">
396                                                     <div class="result_table_utils">
397 [%- search_ou = ctx.search_ou;
398     num_holdable_copies = attrs.marc_xml.findnodes('//*[local-name()="holdings" and @has_holdable="true"]').size || 0;
399     IF ctx.place_unfillable ||
400         ( num_holdable_copies > 0
401             && (ctx.holds_block.enabled != 'true' || attrs.org_copy_counts.$search_ou.available == 0)
402         )
403 %]
404                                                         <div class="results_aux_utils place_hold"><a
405                                                                 href="[% mkurl(ctx.opac_root _ '/place_hold',
406                                                                     {hold_target => rec.id, hold_type => hold_type, 
407                                                                       hold_source_page => mkurl()}, ['query','tag','subfield','term','_special','sort','page']) %]"
408                                                                 [% html_text_attr('title', l('Place Hold on [_1]', attrs.title)) %]
409                                                                     class="no-dec" rel="nofollow" vocab=""><img
410                                                                 src="[% ctx.media_prefix %]/images/green_check.png"
411                                                                 alt=""/><span class="result_place_hold">[% l('Place Hold') %]</span></a>
412                                                         </div>
413 [%- END -%]
414                                                         <div class="results_aux_utils result_util">
415                                                         [% IF !ctx.is_staff %]
416                                                             [%  IF ctx.user;
417                                                                 INCLUDE "opac/parts/bookbag_actions.tt2";
418                                                             %]
419                                                             [%  ELSE;
420                                                                 operation = ctx.mylist.grep(rec.id).size ? "delete" : "add";
421                                                                 label = (operation == "add") ?  l("Add to my list") : l("Remove from my list");
422                                                                 title_label = (operation == "add") ? 
423                                                                   l("Add [_1] to my list", attrs.title) : 
424                                                                   l("Remove [_1] from my list", attrs.title);
425                                                                 href = mkurl(ctx.opac_root _ '/mylist/' _ operation, 
426                                                                         {record => rec.id, anchor => 'record_' _ rec.id}, 1);
427                                                             %]      
428                                                             <a href="[% href %]" class="no-dec" 
429                                                                 [% html_text_attr('title', title_label) %] rel="nofollow" vocab="">
430                                                                 <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
431                                                                 [% label %]
432                                                             </a>
433                                                             [% END %]
434                                                         [% END %]
435                                                         </div>
436                                                         [% IF ENV.OILS_CONTENT_CAFE_USER %]
437                                                         [% ident = attrs.isbn_clean || attrs.upc %]
438                                                         <div class="results_aux_utils result_util">
439                                                             <a target='_blank' 
440                                                                [% html_text_attr('title', l('Reviews and More for [_1]', attrs.title)) %]
441                                                                 href="[% ctx.ext_proto %]://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=[%- 
442                                                                     ENV.OILS_CONTENT_CAFE_USER %]&amp;Password=[%-
443                                                                     ENV.OILS_CONTENT_CAFE_PASS %]&amp;ItemKey=[% ident | uri %]&amp;Options=Y" rel="nofollow" vocab="">
444                                                                 <img src='[% ctx.media_prefix %]/images/starz.png' alt="[% l('Ratings Icon') %]"/> 
445                                                                 <span class="results_reviews">[% l('Reviews &amp; More') %]</span>
446                                                             </a>
447                                                         </div>
448                                                         [% END %]
449                                                     </div>
450                                                 </div>
451
452                                             </td>
453
454                                         </tr>
455                                         [%- IF ENV.OILS_CHILIFRESH_ACCOUNT %]
456                                         <tr>
457                                             <td/>
458                                             <td align='center'> <!-- Chilifresh reviews link --> 
459                                                 <span class="chili_review" id="isbn_[% attrs.isbn_clean | html %]"> </span>
460                                             </td>
461                                         </tr>
462                                         <tr>
463                                             <td/>
464                                             <td colspan='5'> <!-- Chilifresh reviews panel -->
465                                                 <div id="chili_review_[% attrs.isbn_clean | html %]" style="display: none;" align="center"></div>
466                                             </td>
467                                         </tr>
468                                         [%- END %]
469                     [% END %]
470                     </tbody>
471                 </table>
472             </div>
473 </div>
474 <div class="result_footer_nav1">
475     [% ctx.results_count_header %]
476 </div>
477 <script>
478 resultBlock = document.getElementById('result_block');
479 resultButton = document.getElementById('return_to_hits');
480 facetSidebar = document.getElementById('facet_sidebar');
481 facetButton =  document.getElementById('refine_hits');
482 function getFacety() {
483     resultBlock.setAttribute('class', 'result_block_hidden');
484     resultButton.setAttribute('class', 'results_header_btns result_block_visible');
485     facetSidebar.setAttribute('class', 'facet_sidebar_visible');
486     facetButton.setAttribute('class', 'result_block_hidden');
487     window.location.hash = 'return_to_hits';
488 }
489 function getResulty() {
490     resultBlock.setAttribute('class', 'result_block_visible');
491     resultButton.setAttribute('class', 'result_block_hidden');
492     facetSidebar.setAttribute('class', 'facet_sidebar_hidden');
493     facetButton.setAttribute('class', 'results_header_btns result_block_visible');
494     window.location.hash = 'refine_hits';
495 }
496 </script>