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