]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/result/table.tt2
LP 1548993: Restore Show More/Show Fewer Details button functionality.
[working/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 = {marc_xml => rec.marc_xml};
45                             PROCESS get_marc_attrs args=attrs;
46                             IF show_detail_view;
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 show_detail_view;
148                                                             IF attrs.pubdate;
149                                                                 pubdate_clean = attrs.pubdate | html;
150                                                                 l(" ([_1])", pubdate_clean);
151                                                             ELSIF attrs.copyright;
152                                                                 copyright_clean = attrs.copyright | html;
153                                                                 l(" ([_1])", copyright_clean);                                                                
154                                                             END;
155                                                         END
156                                                     -%]
157                                                     </div>
158                                                     <table 
159                                                        role="presentation"
160                                                        title="[% l('Record Holdings Summary') %]"
161                                                        class="table_no_border_space table_no_cell_pad table_no_border results_info_table">
162                                                         [% UNLESS rec.mmr_id %]
163                                                            [% IF args.holdings.size > 0 %]
164                                                         <tr name='bib_cn_list' class='result_table_title_cell'>
165                                                             <td valign='top'>
166                                                                 <strong>[% l('Call number:') %]</strong>
167                                                             </td>
168                                                             <td>[% args.holdings.0.label | html %]</td>
169                                                         </tr>
170                                                            [% END %]
171                                                         [% END %]
172
173                                                         [%- IF show_detail_view -%]
174                                                         <!-- These fields are visible when viewing the results page in 'detailed' mode -->
175                                                         [% UNLESS rec.mmr_id %]
176                                                         <!-- Do not show publication-specific information on a metarecord search results page -->
177                                                         [% IF attrs.publisher %]
178                                                             <tr name="results_pub_tr">
179                                                                 <td valign="top">
180                                                                     <strong>[% l('Publisher:') %]</strong>
181                                                                 </td>
182                                                                 <td>[% attrs.pubplace | html; %] [% attrs.publisher | html; %] [% attrs.pubdate | html; %]
183 [%-
184 FOR entry IN attrs.graphic_pubinfos;
185     FOR alt IN entry.graphic;
186         diratt = "";
187         IF alt.dir;
188             diratt = ' dir="' _ alt.dir _ '"';
189         END;
190 -%]
191 <div class="graphic880"[% diratt %]>
192     [% alt.value | html %]
193 </div>
194 [%-
195     END;
196 END;
197 -%]
198 </td>
199                                                             </tr>
200                                                         [% ELSIF attrs.producer %]
201                                                             <tr name="results_pub_tr">
202                                                                 <td valign="top">
203                                                                     <strong>[% l('Producer:') %]</strong>
204                                                                 </td>
205                                                                 <td>[% attrs.prodplace | html; %] [% attrs.producer | html; %] [% attrs.proddate | html; %]</td>
206                                                             </tr>
207                                                         [% ELSIF attrs.distributor %]
208                                                             <tr name="results_pub_tr">
209                                                                 <td valign="top">
210                                                                     <strong>[% l('Distributor:') %]</strong>
211                                                                 </td>
212                                                                 <td>[% attrs.distplace | html; %] [% attrs.distributor | html; %] [% attrs.distdate | html; %]</td>
213                                                             </tr>
214                                                         [% ELSIF attrs.manufacturer %]
215                                                             <tr name="results_pub_tr">
216                                                                 <td valign="top">
217                                                                     <strong>[% l('Manufacturer:') %]</strong>
218                                                                 </td>
219                                                                 <td>[% attrs.manplace | html; %] [% attrs.manufacturer | html; %] [% attrs.mandate | html; %]</td>
220                                                             </tr>
221                                                         [% END %]
222                                                         [% IF attrs.isbns.size > 0 %]
223                                                             <tr name="results_isbn_tr">
224                                                                 <td valign="top">
225                                                                     <strong>[% l('ISBN:') %]</strong>
226                                                                 </td>
227                                                                 <td>[% attrs.isbns.0 | html %]</td>
228                                                             </tr>
229                                                         [% END %]
230                                                         [%- IF attrs.issns.size > 0 %]
231                                                             <tr name="results_issn_tr">
232                                                                 <td valign="top">
233                                                                     <strong>[% l('ISSN:') %]</strong>
234                                                                 </td>
235                                                                 <td>[% attrs.issns.0 | html %]</td>
236                                                             </tr>
237                                                         [%- END %]
238                                                         [%- IF openurl.enabled == 'true';
239                                                             FOREACH issn IN args.issns;
240                                                                 NEXT IF issn == '';
241                                                                 res_urls = ResolverResolver.resolve_issn(issn, openurl.baseurl);
242                                                                 FOREACH res IN res_urls;
243                                                         %]
244                                                         <tr name="results_issn_tr">
245                                                             <td valign="top">
246                                                                 <strong><a href="[% res.target_url %]">
247                                                                 [% res.public_name | html %]</a></strong>
248                                                             </td>
249                                                             <td>[% res.target_coverage | html %]
250                                                             [%- IF res.target_embargo != '';
251                                                                     ' - ';
252                                                                     res.target_embargo | html;
253                                                                 END;
254                                                             -%]
255                                                             </td>
256                                                         </tr>
257                                                                 [% END %]
258                                                             [% END %]
259                                                         [% END %]
260
261                                                         [% IF attrs.edition %]
262                                                             <tr name="results_edition_tr">
263                                                                 <td valign="top">
264                                                                     <strong>[% l('Edition:') %]</strong>
265                                                                 </td>
266                                                                 <td>[% attrs.edition | html %]
267 [%-
268 FOR entry IN attrs.graphic_editions;
269     FOR alt IN entry.graphic;
270         diratt = "";
271         IF alt.dir;
272             diratt = ' dir="' _ alt.dir _ '"';
273         END;
274 -%]
275 <div class="graphic880"[% diratt %]>
276     [% alt.value | html %]
277 </div>
278 [%-
279     END;
280 END;
281 -%]
282 </td>
283                                                             </tr>
284                                                         [% END %]
285                                                         [% IF attrs.phys_desc %]
286                                                             <tr name="results_phys_desc_tr">
287                                                                 <td nowrap="nowrap" valign="top">
288                                                                     <strong>[% l('Phys. Desc.:') %]</strong>
289                                                                 </td>
290                                                                 <td>
291                                                                     [% args.phys_desc | html %]
292                                                                 </td>
293                                                             </tr>
294                                                         [% END %]
295                                                         [% FOR uri IN args.uris %]
296                                                             <tr name='bib_uri_list' class='result_table_title_cell'>
297                                                                 <td valign='top'>
298                                                                     <strong>[% l('Electronic resource') %]</strong>
299                                                                 </td>
300                                                                 <td><a href="[% uri.href %]" class="uri_link">[% uri.link | html %]</a>[% ' - ' _ uri.note | html IF uri.note %]</td>
301                                                             </tr>
302                                                             [% END %]
303                                                          [% END %]
304                                                             [%- IF args.holdings.size > 0;
305                                                                 FOREACH copy IN args.holdings;
306                                                                     IF copy.part_label != '';
307                                                                         has_parts = 'true';
308                                                                         LAST;
309                                                                     END;
310                                                                 END;
311                                                             %]
312                                                             <tr name='bib_cn_list' class='result_table_title_cell'>
313                                                                 <td colspan='2'>
314                                                                     <table title="[% l('Record Holdings Details') %]"
315                                                                            class='result_holdings_table'>
316                                                                         <thead><tr>
317                                                                             <th>[% l('Library') %]</th>
318                                                                             <th>[% l('Shelving location') %]</th>
319                                                                             <th>[% l('Call number') %]</th>
320                                                                             [%- IF has_parts == 'true'; %]
321                                                                             <th>[% l('Part') %]</th>
322                                                                             [%- END %]
323                                                                             <th>[% l('Status') %]</th>
324                                                                         </tr></thead>
325                                                                         <tbody>
326                                                                 [% FOR copy IN args.holdings %]
327                                                                         <tr>
328                                                                             <td>
329 [%- copy_info = copy;
330     INCLUDE "opac/parts/library_name_link.tt2"; %]
331                                                                             </td>
332                                                                             <td>[% copy.location | html %]</td>
333                                                                             <td>[% copy.label | html %]</td>
334                                                                             [%- IF has_parts == 'true'; %]
335                                                                             <td>[% copy.part_label %]</td>
336                                                                             [%- END %]
337                                                                             <td>[% copy.status | html %]</td>
338                                                                         </tr>
339                                                                 [% END %]
340                                                                         </tbody>
341                                                                     </table>
342                                                                 </td>
343                                                             </tr>
344                                                             [%- has_parts = 'false';
345                                                                 END;
346                                                              %]
347                                                         [% END %] <!-- END detail_record_view -->
348                                                     </table>
349                                                     [% PROCESS "opac/parts/result/copy_counts.tt2" %]
350                                                     [% IF rec.user_circulated %]
351                                                     <div class="result_item_circulated">
352                                                         <img src="[% ctx.media_prefix %]/images/green_check.png" alt="[% l('Checked Out Before') %]"/>
353                                                         <span>[% l('I have checked this item out before') %]</span>
354                                                     </div>
355                                                     [% END %]
356                                                     [% IF ctx.bookbag;
357                                                         rec_id = rec.id;
358                                                         FOR note IN ctx.bookbag_items_by_bre_id.$rec_id.notes %]
359                                                     <div class="result-bookbag-item-note">
360                                                         [% note.note | html %]
361                                                     </div>
362                                                         [% END %]
363                                                     [% END %]
364                                                 </div>
365                                                 <div class="result_table_utils_cont">
366                                                     <div class="result_table_utils">
367 [%- search_ou = ctx.search_ou;
368     num_holdable_copies = attrs.marc_xml.findnodes('//*[local-name()="holdings" and @has_holdable="true"]').size || 0;
369     IF ctx.place_unfillable ||
370         ( num_holdable_copies > 0
371             && (ctx.holds_block.enabled != 'true' || attrs.org_copy_counts.$search_ou.available == 0)
372         )
373 %]
374                                                         <div class="results_aux_utils place_hold"><a
375                                                                 href="[% mkurl(ctx.opac_root _ '/place_hold',
376                                                                     {hold_target => rec.id, hold_type => hold_type, 
377                                                                       hold_source_page => mkurl()}, ['query','tag','subfield','term','_special','sort','page']) %]"
378                                                                 [% html_text_attr('title', l('Place Hold on [_1]', attrs.title)) %]
379                                                                     class="no-dec" rel="nofollow" vocab=""><img
380                                                                 src="[% ctx.media_prefix %]/images/green_check.png"
381                                                                 alt=""/><span class="result_place_hold">[% l('Place Hold') %]</span></a>
382                                                         </div>
383 [%- END -%]
384                                                         <div class="results_aux_utils result_util">
385                                                             [%  IF ctx.user;
386                                                                 INCLUDE "opac/parts/bookbag_actions.tt2";
387                                                             %]
388                                                             [%  ELSE;
389                                                                 operation = ctx.mylist.grep(rec.id).size ? "delete" : "add";
390                                                                 label = (operation == "add") ?  l("Add to my list") : l("Remove from my list");
391                                                                 title_label = (operation == "add") ? 
392                                                                   l("Add [_1] to my list", attrs.title) : 
393                                                                   l("Remove [_1] from my list", attrs.title);
394                                                                 href = mkurl(ctx.opac_root _ '/mylist/' _ operation, 
395                                                                         {record => rec.id, anchor => 'record_' _ rec.id}, 1);
396                                                             %]      
397                                                             <a href="[% href %]" class="no-dec" 
398                                                                 [% html_text_attr('title', title_label) %] rel="nofollow" vocab="">
399                                                                 <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
400                                                                 [% label %]
401                                                             </a>
402                                                             [% END %]
403                                                         </div>
404                                                         [% IF ENV.OILS_CONTENT_CAFE_USER %]
405                                                         [% ident = attrs.isbn_clean || attrs.upc %]
406                                                         <div class="results_aux_utils result_util">
407                                                             <a target='_blank' 
408                                                                [% html_text_attr('title', l('Reviews and More for [_1]', attrs.title)) %]
409                                                                 href="[% ctx.ext_proto %]://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=[%- 
410                                                                     ENV.OILS_CONTENT_CAFE_USER %]&amp;Password=[%-
411                                                                     ENV.OILS_CONTENT_CAFE_PASS %]&amp;ItemKey=[% ident | uri %]&amp;Options=Y" rel="nofollow" vocab="">
412                                                                 <img src='[% ctx.media_prefix %]/images/starz.png' alt="[% l('Ratings Icon') %]"/> 
413                                                                 <span class="results_reviews">[% l('Reviews &amp; More') %]</span>
414                                                             </a>
415                                                         </div>
416                                                         [% END %]
417                                                     </div>
418                                                 </div>
419
420                                             </td>
421
422                                         </tr>
423                                         [%- IF ENV.OILS_CHILIFRESH_ACCOUNT %]
424                                         <tr>
425                                             <td/>
426                                             <td align='center'> <!-- Chilifresh reviews link --> 
427                                                 <span class="chili_review" id="isbn_[% attrs.isbn_clean | html %]"> </span>
428                                             </td>
429                                         </tr>
430                                         <tr>
431                                             <td/>
432                                             <td colspan='5'> <!-- Chilifresh reviews panel -->
433                                                 <div id="chili_review_[% attrs.isbn_clean | html %]" style="display: none;" align="center"></div>
434                                             </td>
435                                         </tr>
436                                         [%- END %]
437                     [% END %]
438                     </tbody>
439                 </table>
440             </div>
441 </div>
442 <div class="result_footer_nav1">
443     [% ctx.results_count_header %]
444 </div>
445 <script>
446 resultBlock = document.getElementById('result_block');
447 resultButton = document.getElementById('return_to_hits');
448 facetSidebar = document.getElementById('facet_sidebar');
449 facetButton =  document.getElementById('refine_hits');
450 function getFacety() {
451     resultBlock.setAttribute('class', 'result_block_hidden');
452     resultButton.setAttribute('class', 'results_header_btns result_block_visible');
453     facetSidebar.setAttribute('class', 'facet_sidebar_visible');
454     facetButton.setAttribute('class', 'result_block_hidden');
455     window.location.hash = 'return_to_hits';
456 }
457 function getResulty() {
458     resultBlock.setAttribute('class', 'result_block_visible');
459     resultButton.setAttribute('class', 'result_block_hidden');
460     facetSidebar.setAttribute('class', 'facet_sidebar_hidden');
461     facetButton.setAttribute('class', 'results_header_btns result_block_visible');
462     window.location.hash = 'refine_hits';
463 }
464 </script>