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