]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/result/table.tt2
4167464e234393cd78d6559bbcd88ee2627505cd
[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     <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                     <tbody id="result_table">
34                     [%  FOR rec IN ctx.records;
35                             attrs = {marc_xml => rec.marc_xml};
36                             PROCESS get_marc_attrs args=attrs;
37                             IF CGI.param('detail_record_view');
38                                 attrs.title = attrs.title_extended;
39                             END;
40                     -%]
41                         <tr class="result_table_row">
42                                             <td class="results_row_count" name="results_row_count">[%
43                                                     result_count; result_count = result_count + 1
44                                                 %].</td>
45                                             <td class='result_table_pic_header'>
46                                                 <a href="[% mkurl(ctx.opac_root _ '/record/' _ rec.id) %]"><img alt="[% l('Image of item') %]"
47                                                         name='item_jacket' class='result_table_pic' width="55"
48                                                         src='[% ctx.media_prefix %]/opac/extras/ac/jacket/small/r/[% rec.id | uri %]' /></a><br />
49                                             </td>
50                                             <td class='result_table_title_cell' name='result_table_title_cell'>
51                                                <div class="result_metadata">
52                                                     <abbr class="unapi-id" title='tag:[% ctx.hostname %],[% date.format(date.now, '%Y') %]:biblio-record_entry/[% rec.id %]'></abbr>
53                                                     <a class='record_title search_link' name='record_[% rec.id %]'
54                                                         href="[% mkurl(ctx.opac_root _ '/record/' _ rec.id) %]"
55                                                         [% html_text_attr('title', l('Display record details for "[_1]"', attrs.title)) %]
56                                                         >[% attrs.title | html %]</a>
57 [%-
58 FOR entry IN attrs.graphic_titles;
59     FOR alt IN entry.graphic;
60         diratt = "";
61         IF alt.dir;
62             diratt = ' dir="' _ alt.dir _ '"';
63         END;
64 -%]
65 <div class="graphic880"[% diratt %]>
66     [% alt.value | html %]
67 </div>
68 [%-
69     END;
70 END;
71 -%]
72  
73                                                     <div>
74                                                         <a title="[% l("Perform an Author Search") %]"
75                                                                 class="record_author" name='item_author'
76                                                                 href="[%- 
77                                                                     authorquery = attrs.author | replace('[#"^$\+\-,\.:;&|\[\]()]', ' ');
78                                                                     mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, ['page'])
79                                                                     -%]">[% attrs.author | html %]</a>
80 [%-
81 FOR entry IN attrs.graphic_authors;
82     FOR alt IN entry.graphic;
83         diratt = "";
84         IF alt.dir;
85             diratt = ' dir="' _ alt.dir _ '"';
86         END;
87 -%]
88 <div class="graphic880"[% diratt %]>
89     [% alt.value | html %]
90 </div>
91 [%-
92     END;
93 END;
94 -%]
95
96                                                     </div>
97                                                     <div class='result_table_title_cell'>
98                                                     [%- IF attrs.format_label; %]
99                                                         <img title="[% attrs.format_label | html %]" alt="[% attrs.format_label | html %]" src="[% attrs.format_icon %]" /> [% attrs.format_label; %]
100                                                     [%- END %]
101                                                     [%- UNLESS CGI.param('detail_record_view')
102                                                             OR (show_more_details.default == 'true'
103                                                             OR show_more_details.default == 'hide');
104                                                             IF attrs.pubdate;
105                                                                 pubdate_clean = attrs.pubdate | html;
106                                                                 l(" ([_1])", pubdate_clean);
107                                                             END;
108                                                         END
109                                                     -%]
110                                                     </div>
111                                                     <span name="googleBooksLink" class="hide_me">
112                                                         <a style='padding-left: 8px;'
113                                                             class='classic_link hide_me'
114                                                             name="googleBooks-link">[% l("Browse in Google Books Search") %]</a>
115                                                     </span>
116                                                     <table 
117                                                        title="[% l('Record Holdings Summary') %]"
118                                                        class="table_no_border_space table_no_cell_pad table_no_border results_info_table">
119                                                         [% IF args.holdings.size > 0 %]
120                                                         <tr name='bib_cn_list' class='result_table_title_cell'>
121                                                             <td valign='top'>
122                                                                 <strong>[% l('Call number:') %]</strong>
123                                                             </td>
124                                                             <td>[% args.holdings.0.label | html %]</td>
125                                                         </tr>
126                                                         [% END %]
127
128                                                         [% IF CGI.param('detail_record_view') %]
129                                                         <!-- These fields are visible when viewing the results page in 'detailed' mode -->
130
131                                                         [% IF attrs.pubinfo %]
132                                                             <tr name="results_pub_tr">
133                                                                 <td valign="top">
134                                                                     <strong>[% l('Publisher:') %]</strong>
135                                                                 </td>
136                                                                 <td>[% attrs.pubinfo | html %]
137 [%-
138 FOR entry IN attrs.graphic_pubinfos;
139     FOR alt IN entry.graphic;
140         diratt = "";
141         IF alt.dir;
142             diratt = ' dir="' _ alt.dir _ '"';
143         END;
144 -%]
145 <div class="graphic880"[% diratt %]>
146     [% alt.value | html %]
147 </div>
148 [%-
149     END;
150 END;
151 -%]
152 </td>
153                                                             </tr>
154                                                         [% END %]
155                                                         [% IF attrs.isbns.size > 0 %]
156                                                             <tr name="results_isbn_tr">
157                                                                 <td valign="top">
158                                                                     <strong>[% l('ISBN:') %]</strong>
159                                                                 </td>
160                                                                 <td>[% attrs.isbns.0 | html %]</td>
161                                                             </tr>
162                                                         [% END %]
163                                                         [%- IF attrs.issns.size > 0 %]
164                                                             <tr name="results_issn_tr">
165                                                                 <td valign="top">
166                                                                     <strong>[% l('ISSN:') %]</strong>
167                                                                 </td>
168                                                                 <td>[% attrs.issns.0 | html %]</td>
169                                                             </tr>
170                                                         [%- END %]
171                                                         [%- IF openurl.enabled == 'true';
172                                                             FOREACH issn IN args.issns;
173                                                                 NEXT IF issn == '';
174                                                                 res_urls = ResolverResolver.resolve_issn(issn, openurl.baseurl);
175                                                                 FOREACH res IN res_urls;
176                                                         %]
177                                                         <tr name="results_issn_tr">
178                                                             <td valign="top">
179                                                                 <strong><a href="[% res.target_url %]">
180                                                                 [% res.public_name | html %]</a></strong>
181                                                             </td>
182                                                             <td>[% res.target_coverage | html %]</td>
183                                                         </tr>
184                                                                 [% END %]
185                                                             [% END %]
186                                                         [% END %]
187
188                                                         [% IF attrs.edition %]
189                                                             <tr name="results_edition_tr">
190                                                                 <td valign="top">
191                                                                     <strong>[% l('Edition:') %]</strong>
192                                                                 </td>
193                                                                 <td>[% attrs.edition | html %]
194 [%-
195 FOR entry IN attrs.graphic_editions;
196     FOR alt IN entry.graphic;
197         diratt = "";
198         IF alt.dir;
199             diratt = ' dir="' _ alt.dir _ '"';
200         END;
201 -%]
202 <div class="graphic880"[% diratt %]>
203     [% alt.value | html %]
204 </div>
205 [%-
206     END;
207 END;
208 -%]
209 </td>
210                                                             </tr>
211                                                         [% END %]
212                                                         [% IF attrs.phys_desc %]
213                                                             <tr name="results_phys_desc_tr">
214                                                                 <td nowrap="nowrap" valign="top">
215                                                                     <strong>[% l('Phys. Desc.:') %]</strong>
216                                                                 </td>
217                                                                 <td>
218                                                                     [% args.phys_desc | html %]
219                                                                 </td>
220                                                             </tr>
221                                                         [% END %]
222                                                         [% FOR uri IN args.uris %]
223                                                             <tr name='bib_uri_list' class='result_table_title_cell'>
224                                                                 <td valign='top'>
225                                                                     <strong>[% l('Electronic resource') %]</strong>
226                                                                 </td>
227                                                                 <td><a href="[% uri.href %]">[% uri.link | html %]</a>[% ' - ' _ uri.note | html IF uri.note %]</td>
228                                                             </tr>
229                                                             [% END %]
230                                                             [%- IF args.holdings.size > 0;
231                                                                 FOREACH copy IN args.holdings;
232                                                                     IF copy.part_label != '';
233                                                                         has_parts = 'true';
234                                                                         LAST;
235                                                                     END;
236                                                                 END;
237                                                             %]
238                                                             <tr name='bib_cn_list' class='result_table_title_cell'>
239                                                                 <td colspan='2'>
240                                                                     <table title="[% l('Record Holdings Details') %]"
241                                                                            class='result_holdings_table'>
242                                                                         <thead><tr>
243                                                                             <th>[% l('Library') %]</th>
244                                                                             <th>[% l('Shelving location') %]</th>
245                                                                             <th>[% l('Call number') %]</th>
246                                                                             [%- IF has_parts == 'true'; %]
247                                                                             <th>[% l('Part') %]</th>
248                                                                             [%- END %]
249                                                                             <th>[% l('Status') %]</th>
250                                                                         </tr></thead>
251                                                                         <tbody>
252                                                                 [% FOR copy IN args.holdings %]
253                                                                         <tr>
254                                                                             <td>
255 [%- copy_info = copy;
256     INCLUDE "opac/parts/library_name_link.tt2"; %]
257                                                                             </td>
258                                                                             <td>[% copy.location | html %]</td>
259                                                                             <td>[% copy.label | html %]</td>
260                                                                             [%- IF has_parts == 'true'; %]
261                                                                             <td>[% copy.part_label %]</td>
262                                                                             [%- END %]
263                                                                             <td>[% copy.status | html %]</td>
264                                                                         </tr>
265                                                                 [% END %]
266                                                                         </tbody>
267                                                                     </table>
268                                                                 </td>
269                                                             </tr>
270                                                             [%- has_parts = 'false';
271                                                                 END;
272                                                              %]
273                                                         [% END %] <!-- END detail_record_view -->
274                                                     </table>
275                                                     [% PROCESS "opac/parts/result/copy_counts.tt2" %]
276                                                     [% IF rec.user_circulated %]
277                                                     <div class="result_item_circulated">
278                                                         <img src="[% ctx.media_prefix %]/images/green_check.png" alt="[% l('Checked Out Before') %]"/>
279                                                         <span>[% l('I have checked this item out before') %]</span>
280                                                     </div>
281                                                     [% END %]
282                                                     [% IF ctx.bookbag;
283                                                         rec_id = rec.id;
284                                                         FOR note IN ctx.bookbag_items_by_bre_id.$rec_id.notes %]
285                                                     <div class="result-bookbag-item-note">
286                                                         [% note.note | html %]
287                                                     </div>
288                                                         [% END %]
289                                                     [% END %]
290                                                 </div>
291                                                 <div class="result_table_utils_cont">
292                                                     <div class="result_table_utils">
293 [%- search_ou = ctx.search_ou;
294     num_holdable_copies = attrs.marc_xml.findnodes('//*[local-name()="holdings" and @has_holdable="true"]').size || 0;
295     IF ctx.place_unfillable ||
296         ( num_holdable_copies > 0
297             && (ctx.holds_block.enabled != 'true' || attrs.org_copy_counts.$search_ou.available == 0)
298         )
299 %]
300                                                         <div class="results_aux_utils place_hold"><a
301                                                                 href="[% mkurl(ctx.opac_root _ '/place_hold',
302                                                                     {hold_target => rec.id, hold_type => 'T', hold_source_page => mkurl()}, ['query']) %]"
303                                                                 [% html_text_attr('title', l('Place Hold on [_1]', attrs.title)) %]
304                                                                     name="place_hold_link" class="no-dec"><img
305                                                                 src="[% ctx.media_prefix %]/images/green_check.png"
306                                                                 alt=""/><span class="result_place_hold">[% l('Place Hold') %]</span></a>
307                                                         </div>
308 [%- END -%]
309                                                         <div class="results_aux_utils result_util">
310                                                             [%  IF ctx.user;
311                                                                 INCLUDE "opac/parts/bookbag_actions.tt2";
312                                                             %]
313                                                             [%  ELSE;
314                                                                 operation = ctx.mylist.grep(rec.id).size ? "delete" : "add";
315                                                                 label = (operation == "add") ?  l("Add to my list") : l("Remove from my list");
316                                                                 title_label = (operation == "add") ? 
317                                                                   l("Add [_1] to my list", attrs.title) : 
318                                                                   l("Remove [_1] from my list", attrs.title);
319                                                                 href = mkurl(ctx.opac_root _ '/mylist/' _ operation, 
320                                                                         {record => rec.id, anchor => 'record_' _ rec.id}, 1);
321                                                             %]      
322                                                             <a href="[% href %]" class="no-dec" 
323                                                                 [% html_text_attr('title', title_label) %]>
324                                                                 <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
325                                                                 [% label %]
326                                                             </a>
327                                                             [% END %]
328                                                         </div>
329                                                         [% IF ENV.OILS_CONTENT_CAFE_USER %]
330                                                         [% ident = attrs.isbn_clean || attrs.upc %]
331                                                         <div class="results_aux_utils result_util">
332                                                             <a target='_blank' 
333                                                                [% html_text_attr('title', l('Reviews and More for [_1]', attrs.title)) %]
334                                                                 href="[% ctx.ext_proto %]://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=[%- 
335                                                                     ENV.OILS_CONTENT_CAFE_USER %]&amp;Password=[%-
336                                                                     ENV.OILS_CONTENT_CAFE_PASS %]&amp;ItemKey=[% ident | uri %]&amp;Options=Y">
337                                                                 <img src='[% ctx.media_prefix %]/images/starz.png' alt="[% l('Ratings Icon') %]"/> 
338                                                                 <span class="results_reviews">[% l('Reviews &amp; More') %]</span>
339                                                             </a>
340                                                         </div>
341                                                         [% END %]
342                                                     </div>
343                                                 </div>
344
345                                             </td>
346
347                                         </tr>
348                                         [%- IF ENV.OILS_CHILIFRESH_ACCOUNT %]
349                                         <tr>
350                                             <td/>
351                                             <td align='center'> <!-- Chilifresh reviews link --> 
352                                                 <span class="chili_review" id="isbn_[% attrs.isbn_clean | html %]"> </span>
353                                             </td>
354                                         </tr>
355                                         <tr>
356                                             <td/>
357                                             <td colspan='5'> <!-- Chilifresh reviews panel -->
358                                                 <div id="chili_review_[% attrs.isbn_clean | html %]" style="display: none;" align="center"></div>
359                                             </td>
360                                         </tr>
361                                         [%- END %]
362                     [% END %]
363                     </tbody>
364                 </table>
365             </div>
366 </div>
367 <div class="result_footer_nav1">
368     [% ctx.results_count_header %]
369 </div>
370 <script>
371 resultBlock = document.querySelector('#result_block');
372 resultButton = document.querySelector('#return_to_hits');
373 facetSidebar = document.querySelector('#facet_sidebar');
374 facetButton =  document.querySelector('#refine_hits');
375 function getFacety() {
376     resultBlock.setAttribute('class', 'result_block_hidden');
377     resultButton.setAttribute('class', 'results_header_btns result_block_visible');
378     facetSidebar.setAttribute('class', 'facet_sidebar_visible');
379     facetButton.setAttribute('class', 'result_block_hidden');
380     window.location.hash = 'return_to_hits';
381 }
382 function getResulty() {
383     resultBlock.setAttribute('class', 'result_block_visible');
384     resultButton.setAttribute('class', 'result_block_hidden');
385     facetSidebar.setAttribute('class', 'facet_sidebar_hidden');
386     facetButton.setAttribute('class', 'results_header_btns result_block_visible');
387     window.location.hash = 'refine_hits';
388 }
389 </script>