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