]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/result/table.tt2
599463349ec9a3fd0ee46b3fe0b1a40a9874a4b6
[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"
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                                                     <table 
112                                                        title="[% l('Record Holdings Summary') %]"
113                                                        class="table_no_border_space table_no_cell_pad table_no_border results_info_table">
114                                                         [% IF args.holdings.size > 0 %]
115                                                         <tr name='bib_cn_list' class='result_table_title_cell'>
116                                                             <td valign='top'>
117                                                                 <strong>[% l('Call number:') %]</strong>
118                                                             </td>
119                                                             <td>[% args.holdings.0.label | html %]</td>
120                                                         </tr>
121                                                         [% END %]
122
123                                                         [% IF CGI.param('detail_record_view') %]
124                                                         <!-- These fields are visible when viewing the results page in 'detailed' mode -->
125
126                                                         [% IF attrs.pubinfo %]
127                                                             <tr name="results_pub_tr">
128                                                                 <td valign="top">
129                                                                     <strong>[% l('Publisher:') %]</strong>
130                                                                 </td>
131                                                                 <td>[% attrs.pubinfo | html %]
132 [%-
133 FOR entry IN attrs.graphic_pubinfos;
134     FOR alt IN entry.graphic;
135         diratt = "";
136         IF alt.dir;
137             diratt = ' dir="' _ alt.dir _ '"';
138         END;
139 -%]
140 <div class="graphic880"[% diratt %]>
141     [% alt.value | html %]
142 </div>
143 [%-
144     END;
145 END;
146 -%]
147 </td>
148                                                             </tr>
149                                                         [% END %]
150                                                         [% IF attrs.isbns.size > 0 %]
151                                                             <tr name="results_isbn_tr">
152                                                                 <td valign="top">
153                                                                     <strong>[% l('ISBN:') %]</strong>
154                                                                 </td>
155                                                                 <td>[% attrs.isbns.0 | html %]</td>
156                                                             </tr>
157                                                         [% END %]
158                                                         [%- IF attrs.issns.size > 0 %]
159                                                             <tr name="results_issn_tr">
160                                                                 <td valign="top">
161                                                                     <strong>[% l('ISSN:') %]</strong>
162                                                                 </td>
163                                                                 <td>[% attrs.issns.0 | html %]</td>
164                                                             </tr>
165                                                         [%- END %]
166                                                         [%- IF openurl.enabled == 'true';
167                                                             FOREACH issn IN args.issns;
168                                                                 NEXT IF issn == '';
169                                                                 res_urls = ResolverResolver.resolve_issn(issn, openurl.baseurl);
170                                                                 FOREACH res IN res_urls;
171                                                         %]
172                                                         <tr name="results_issn_tr">
173                                                             <td valign="top">
174                                                                 <strong><a href="[% res.target_url %]">
175                                                                 [% res.public_name | html %]</a></strong>
176                                                             </td>
177                                                             <td>[% res.target_coverage | html %]</td>
178                                                         </tr>
179                                                                 [% END %]
180                                                             [% END %]
181                                                         [% END %]
182
183                                                         [% IF attrs.edition %]
184                                                             <tr name="results_edition_tr">
185                                                                 <td valign="top">
186                                                                     <strong>[% l('Edition:') %]</strong>
187                                                                 </td>
188                                                                 <td>[% attrs.edition | html %]
189 [%-
190 FOR entry IN attrs.graphic_editions;
191     FOR alt IN entry.graphic;
192         diratt = "";
193         IF alt.dir;
194             diratt = ' dir="' _ alt.dir _ '"';
195         END;
196 -%]
197 <div class="graphic880"[% diratt %]>
198     [% alt.value | html %]
199 </div>
200 [%-
201     END;
202 END;
203 -%]
204 </td>
205                                                             </tr>
206                                                         [% END %]
207                                                         [% IF attrs.phys_desc %]
208                                                             <tr name="results_phys_desc_tr">
209                                                                 <td nowrap="nowrap" valign="top">
210                                                                     <strong>[% l('Phys. Desc.:') %]</strong>
211                                                                 </td>
212                                                                 <td>
213                                                                     [% args.phys_desc | html %]
214                                                                 </td>
215                                                             </tr>
216                                                         [% END %]
217                                                         [% FOR uri IN args.uris %]
218                                                             <tr name='bib_uri_list' class='result_table_title_cell'>
219                                                                 <td valign='top'>
220                                                                     <strong>[% l('Electronic resource') %]</strong>
221                                                                 </td>
222                                                                 <td><a href="[% uri.href %]">[% uri.link | html %]</a>[% ' - ' _ uri.note | html IF uri.note %]</td>
223                                                             </tr>
224                                                             [% END %]
225                                                             [%- IF args.holdings.size > 0;
226                                                                 FOREACH copy IN args.holdings;
227                                                                     IF copy.part_label != '';
228                                                                         has_parts = 'true';
229                                                                         LAST;
230                                                                     END;
231                                                                 END;
232                                                             %]
233                                                             <tr name='bib_cn_list' class='result_table_title_cell'>
234                                                                 <td colspan='2'>
235                                                                     <table title="[% l('Record Holdings Details') %]"
236                                                                            class='result_holdings_table'>
237                                                                         <thead><tr>
238                                                                             <th>[% l('Library') %]</th>
239                                                                             <th>[% l('Shelving location') %]</th>
240                                                                             <th>[% l('Call number') %]</th>
241                                                                             [%- IF has_parts == 'true'; %]
242                                                                             <th>[% l('Part') %]</th>
243                                                                             [%- END %]
244                                                                             <th>[% l('Status') %]</th>
245                                                                         </tr></thead>
246                                                                         <tbody>
247                                                                 [% FOR copy IN args.holdings %]
248                                                                         <tr>
249                                                                             <td>
250 [%- copy_info = copy;
251     INCLUDE "opac/parts/library_name_link.tt2"; %]
252                                                                             </td>
253                                                                             <td>[% copy.location | html %]</td>
254                                                                             <td>[% copy.label | html %]</td>
255                                                                             [%- IF has_parts == 'true'; %]
256                                                                             <td>[% copy.part_label %]</td>
257                                                                             [%- END %]
258                                                                             <td>[% copy.status | html %]</td>
259                                                                         </tr>
260                                                                 [% END %]
261                                                                         </tbody>
262                                                                     </table>
263                                                                 </td>
264                                                             </tr>
265                                                             [%- has_parts = 'false';
266                                                                 END;
267                                                              %]
268                                                         [% END %] <!-- END detail_record_view -->
269                                                     </table>
270                                                     [% PROCESS "opac/parts/result/copy_counts.tt2" %]
271                                                     [% IF rec.user_circulated %]
272                                                     <div class="result_item_circulated">
273                                                         <img src="[% ctx.media_prefix %]/images/green_check.png" alt="[% l('Checked Out Before') %]"/>
274                                                         <span>[% l('I have checked this item out before') %]</span>
275                                                     </div>
276                                                     [% END %]
277                                                     [% IF ctx.bookbag;
278                                                         rec_id = rec.id;
279                                                         FOR note IN ctx.bookbag_items_by_bre_id.$rec_id.notes %]
280                                                     <div class="result-bookbag-item-note">
281                                                         [% note.note | html %]
282                                                     </div>
283                                                         [% END %]
284                                                     [% END %]
285                                                 </div>
286                                                 <div class="result_table_utils_cont">
287                                                     <div class="result_table_utils">
288 [%- search_ou = ctx.search_ou;
289     num_holdable_copies = attrs.marc_xml.findnodes('//*[local-name()="holdings" and @has_holdable="true"]').size || 0;
290     IF ctx.place_unfillable ||
291         ( num_holdable_copies > 0
292             && (ctx.holds_block.enabled != 'true' || attrs.org_copy_counts.$search_ou.available == 0)
293         )
294 %]
295                                                         <div class="results_aux_utils place_hold"><a
296                                                                 href="[% mkurl(ctx.opac_root _ '/place_hold',
297                                                                     {hold_target => rec.id, hold_type => 'T', hold_source_page => mkurl()}, ['query']) %]"
298                                                                 [% html_text_attr('title', l('Place Hold on [_1]', attrs.title)) %]
299                                                                     class="no-dec"><img
300                                                                 src="[% ctx.media_prefix %]/images/green_check.png"
301                                                                 alt=""/><span class="result_place_hold">[% l('Place Hold') %]</span></a>
302                                                         </div>
303 [%- END -%]
304                                                         <div class="results_aux_utils result_util">
305                                                             [%  IF ctx.user;
306                                                                 INCLUDE "opac/parts/bookbag_actions.tt2";
307                                                             %]
308                                                             [%  ELSE;
309                                                                 operation = ctx.mylist.grep(rec.id).size ? "delete" : "add";
310                                                                 label = (operation == "add") ?  l("Add to my list") : l("Remove from my list");
311                                                                 title_label = (operation == "add") ? 
312                                                                   l("Add [_1] to my list", attrs.title) : 
313                                                                   l("Remove [_1] from my list", attrs.title);
314                                                                 href = mkurl(ctx.opac_root _ '/mylist/' _ operation, 
315                                                                         {record => rec.id, anchor => 'record_' _ rec.id}, 1);
316                                                             %]      
317                                                             <a href="[% href %]" class="no-dec" 
318                                                                 [% html_text_attr('title', title_label) %]>
319                                                                 <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
320                                                                 [% label %]
321                                                             </a>
322                                                             [% END %]
323                                                         </div>
324                                                         [% IF ENV.OILS_CONTENT_CAFE_USER %]
325                                                         [% ident = attrs.isbn_clean || attrs.upc %]
326                                                         <div class="results_aux_utils result_util">
327                                                             <a target='_blank' 
328                                                                [% html_text_attr('title', l('Reviews and More for [_1]', attrs.title)) %]
329                                                                 href="[% ctx.ext_proto %]://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=[%- 
330                                                                     ENV.OILS_CONTENT_CAFE_USER %]&amp;Password=[%-
331                                                                     ENV.OILS_CONTENT_CAFE_PASS %]&amp;ItemKey=[% ident | uri %]&amp;Options=Y">
332                                                                 <img src='[% ctx.media_prefix %]/images/starz.png' alt="[% l('Ratings Icon') %]"/> 
333                                                                 <span class="results_reviews">[% l('Reviews &amp; More') %]</span>
334                                                             </a>
335                                                         </div>
336                                                         [% END %]
337                                                     </div>
338                                                 </div>
339
340                                             </td>
341
342                                         </tr>
343                                         [%- IF ENV.OILS_CHILIFRESH_ACCOUNT %]
344                                         <tr>
345                                             <td/>
346                                             <td align='center'> <!-- Chilifresh reviews link --> 
347                                                 <span class="chili_review" id="isbn_[% attrs.isbn_clean | html %]"> </span>
348                                             </td>
349                                         </tr>
350                                         <tr>
351                                             <td/>
352                                             <td colspan='5'> <!-- Chilifresh reviews panel -->
353                                                 <div id="chili_review_[% attrs.isbn_clean | html %]" style="display: none;" align="center"></div>
354                                             </td>
355                                         </tr>
356                                         [%- END %]
357                     [% END %]
358                     </tbody>
359                 </table>
360             </div>
361 </div>
362 <div class="result_footer_nav1">
363     [% ctx.results_count_header %]
364 </div>
365 <script>
366 resultBlock = document.querySelector('#result_block');
367 resultButton = document.querySelector('#return_to_hits');
368 facetSidebar = document.querySelector('#facet_sidebar');
369 facetButton =  document.querySelector('#refine_hits');
370 function getFacety() {
371     resultBlock.setAttribute('class', 'result_block_hidden');
372     resultButton.setAttribute('class', 'results_header_btns result_block_visible');
373     facetSidebar.setAttribute('class', 'facet_sidebar_visible');
374     facetButton.setAttribute('class', 'result_block_hidden');
375     window.location.hash = 'return_to_hits';
376 }
377 function getResulty() {
378     resultBlock.setAttribute('class', 'result_block_visible');
379     resultButton.setAttribute('class', 'result_block_hidden');
380     facetSidebar.setAttribute('class', 'facet_sidebar_hidden');
381     facetButton.setAttribute('class', 'results_header_btns result_block_visible');
382     window.location.hash = 'refine_hits';
383 }
384 </script>