]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates/opac/parts/result/table.tt2
Result actions use width when available
[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                                                <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 id='bib_format' class='result_table_title_cell'>
95                                                     [%- IF attrs.format_label; %]
96                                                         [% 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                                                     %] ([% attrs.pubdate | html %])
102                                                     [%- END -%]
103                                                     </div>
104                                                     <span name="googleBooksLink" class="hide_me">
105                                                         <a style='padding-left: 8px;'
106                                                             class='classic_link hide_me'
107                                                             name="googleBooks-link">[% l("Browse in Google Books Search") %]</a>
108                                                     </span>
109                                                     <table cellpadding="0" cellspacing="0" border="0"
110                                                         class="results_info_table">
111                                                         [% IF args.holdings.size > 0 %]
112                                                         <tr name='bib_cn_list' class='result_table_title_cell'>
113                                                             <td valign='top'>
114                                                                 <strong>[% l('Call number:') %]</strong>
115                                                             </td>
116                                                             <td>[% args.holdings.0.label | html %]</td>
117                                                         </tr>
118                                                         [% END %]
119
120                                                         [% IF CGI.param('detail_record_view') %]
121                                                         <!-- These fields are visible when viewing the results page in 'detailed' mode -->
122
123                                                         [% IF attrs.pubinfo %]
124                                                             <tr name="results_pub_tr">
125                                                                 <td valign="top">
126                                                                     <strong>[% l('Publisher:') %]</strong>
127                                                                 </td>
128                                                                 <td>[% attrs.pubinfo | html %]
129 [%-
130 FOR entry IN attrs.graphic_pubinfos;
131     FOR alt IN entry.graphic;
132         diratt = "";
133         IF alt.dir;
134             diratt = ' dir="' _ alt.dir _ '"';
135         END;
136 -%]
137 <div class="graphic880"[% diratt %]>
138     [% alt.value | html %]
139 </div>
140 [%-
141     END;
142 END;
143 -%]
144 </td>
145                                                             </tr>
146                                                         [% END %]
147                                                         [% IF attrs.isbns.size > 0 %]
148                                                             <tr name="results_isbn_tr">
149                                                                 <td valign="top">
150                                                                     <strong>[% l('ISBN:') %]</strong>
151                                                                 </td>
152                                                                 <td>[% attrs.isbns.0 | html %]</td>
153                                                             </tr>
154                                                         [% END %]
155                                                         [%- IF attrs.issns.size > 0 %]
156                                                             <tr name="results_issn_tr">
157                                                                 <td valign="top">
158                                                                     <strong>[% l('ISSN:') %]</strong>
159                                                                 </td>
160                                                                 <td>[% attrs.issns.0 | html %]</td>
161                                                             </tr>
162                                                         [%- END %]
163                                                         [%- IF openurl.enabled == 'true';
164                                                             FOREACH issn IN args.issns;
165                                                                 NEXT IF issn == '';
166                                                                 res_urls = ResolverResolver.resolve_issn(issn, openurl.baseurl);
167                                                                 FOREACH res IN res_urls;
168                                                         %]
169                                                         <tr name="results_issn_tr">
170                                                             <td valign="top">
171                                                                 <strong><a href="[% res.target_url %]">
172                                                                 [% res.public_name | html %]</a></strong>
173                                                             </td>
174                                                             <td>[% res.target_coverage | html %]</td>
175                                                         </tr>
176                                                                 [% END %]
177                                                             [% END %]
178                                                         [% END %]
179
180                                                         [% IF attrs.edition %]
181                                                             <tr name="results_edition_tr">
182                                                                 <td valign="top">
183                                                                     <strong>[% l('Edition:') %]</strong>
184                                                                 </td>
185                                                                 <td>[% attrs.edition | html %]
186 [%-
187 FOR entry IN attrs.graphic_editions;
188     FOR alt IN entry.graphic;
189         diratt = "";
190         IF alt.dir;
191             diratt = ' dir="' _ alt.dir _ '"';
192         END;
193 -%]
194 <div class="graphic880"[% diratt %]>
195     [% alt.value | html %]
196 </div>
197 [%-
198     END;
199 END;
200 -%]
201 </td>
202                                                             </tr>
203                                                         [% END %]
204                                                         [% IF attrs.phys_desc %]
205                                                             <tr name="results_phys_desc_tr">
206                                                                 <td nowrap="nowrap" valign="top">
207                                                                     <strong>[% l('Phys. Desc.:') %]</strong>
208                                                                 </td>
209                                                                 <td>
210                                                                     [% args.phys_desc | html %]
211                                                                 </td>
212                                                             </tr>
213                                                         [% END %]
214                                                         [% FOR uri IN args.uris %]
215                                                             <tr name='bib_uri_list' class='result_table_title_cell'>
216                                                                 <td valign='top'>
217                                                                     <strong>[% l('Electronic resource') %]</strong>
218                                                                 </td>
219                                                                 <td><a href="[% uri.href %]">[% uri.link | html %]</a>[% ' - ' _ uri.note | html IF uri.note %]</td>
220                                                             </tr>
221                                                             [% END %]
222                                                             [%- IF args.holdings.size > 0;
223                                                                 FOREACH copy IN args.holdings;
224                                                                     IF copy.part_label != '';
225                                                                         has_parts = 'true';
226                                                                         LAST;
227                                                                     END;
228                                                                 END;
229                                                             %]
230                                                             <tr name='bib_cn_list' class='result_table_title_cell'>
231                                                                 <td colspan='2'>
232                                                                     <table class='result_holdings_table'>
233                                                                         <thead><tr>
234                                                                             <th>[% l('Library') %]</th>
235                                                                             <th>[% l('Shelving location') %]</th>
236                                                                             <th>[% l('Call number') %]</th>
237                                                                             [%- IF has_parts == 'true'; %]
238                                                                             <th>[% l('Part') %]</th>
239                                                                             [%- END %]
240                                                                             <th>[% l('Status') %]</th>
241                                                                         </tr></thead>
242                                                                         <tbody>
243                                                                 [% FOR copy IN args.holdings %]
244                                                                         <tr>
245                                                                             <td>
246 [%-
247     lib_url = ctx.get_org_setting(copy.circ_lib, 'lib.info_url');
248     IF lib_url; '<a href="'; lib_url | url; '">'; END;
249     copy.library | html;
250     IF lib_url; '</a>'; END;
251 -%]
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()}) %]" 
298                                                                     name="place_hold_link" class="no-dec"><img
299                                                                 src="[% ctx.media_prefix %]/images/green_check.png"
300                                                                 alt=""/><span class="result_place_hold">[% l('Place Hold') %]</span></a>
301                                                         </div>
302 [%- END -%]
303                                                         <div class="results_aux_utils result_util">
304                                                             [%  IF ctx.user;
305                                                                 INCLUDE "opac/parts/bookbag_actions.tt2";
306                                                             %]
307                                                             [%  ELSE;
308                                                                 operation = ctx.mylist.grep(rec.id).size ? "delete" : "add";
309                                                                 label = (operation == "add") ? l("Add to my list") : l("Remove from my list");
310                                                                 href = mkurl(ctx.opac_root _ '/mylist/' _ operation, 
311                                                                         {record => rec.id, anchor => 'record_' _ rec.id}, 1);
312                                                             %]      
313                                                             <a href="[% href %]" class="no-dec">
314                                                                 <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
315                                                                 [% label %]
316                                                             </a>
317                                                             [% END %]
318                                                         </div>
319                                                         [% IF ENV.OILS_CONTENT_CAFE_USER %]
320                                                         <div class="results_aux_utils result_util">
321                                                             <a title="[% l('Reviews and More') %]" target='_blank' 
322                                                                 href="[% ctx.ext_proto %]://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=[%- 
323                                                                     ENV.OILS_CONTENT_CAFE_USER %]&amp;Password=[%-
324                                                                     ENV.OILS_CONTENT_CAFE_PASS %]&amp;ItemKey=[% ident | uri %]&amp;Options=Y">
325                                                                 <img src='[% ctx.media_prefix %]/images/starz.png'/> 
326                                                                 <span class="results_reviews">[% l('Reviews &amp; More') %]</span>
327                                                             </a>
328                                                         </div>
329                                                         [% END %]
330                                                     </div>
331                                                 </div>
332
333                                             </td>
334
335                                         </tr>
336                                         [%- IF ENV.OILS_CHILIFRESH_ACCOUNT %]
337                                         <tr>
338                                             <td/>
339                                             <td align='center'> <!-- Chilifresh reviews link --> 
340                                                 <span class="chili_review" id="isbn_[% attrs.isbn_clean | html %]"> </span>
341                                             </td>
342                                         </tr>
343                                         <tr>
344                                             <td/>
345                                             <td colspan='5'> <!-- Chilifresh reviews panel -->
346                                                 <div id="chili_review_[% attrs.isbn_clean | html %]" style="display: none;" align="center"></div>
347                                             </td>
348                                         </tr>
349                                         [%- END %]
350                     [% END %]
351                     </tbody>
352                 </table>
353             </div>
354     <div class="facet_sidebar" id="facet_sidebar">
355     [% INCLUDE "opac/parts/staff_saved_searches.tt2" %]
356     [% INCLUDE 'opac/parts/result/facets.tt2' %]
357     </div>
358     <script>
359         function showHideFacets() {
360             var clientWidth = document.documentElement.clientWidth;
361             resultBlock = document.querySelector('.result_block');
362             facetSidebar = document.querySelector('.facet_sidebar');
363             if (clientWidth >= 600) {
364                 if (resultBlock && facetSidebar) {
365                     resultBlock.parentNode.insertBefore(facetSidebar, resultBlock);
366                 }
367             } else if (clientWidth < 600) {
368                 if (resultBlock && facetSidebar) {
369                     resultBlock.parentNode.insertBefore(resultBlock, facetSidebar);
370                 }
371             }
372         }
373         window.onresize = showHideFacets;
374         window.onload = showHideFacets;
375     </script>
376 </div>
377 <div class="result_footer_nav1">
378     [% ctx.results_count_header %]
379 </div>