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