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