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