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