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