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