]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/result/table.tt2
LP#1301599 improved TPAC jacket alt text
[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 [% IF ctx.bookbag %]
17 <div id="result-bookbag-heading">
18     <div class="result-bookbag-name">[% ctx.bookbag.name | html %]</div>
19     <div class="result-bookbag-description">[% ctx.bookbag.description | html %]</div>
20 </div>
21 [% END %]
22 <div id="result_table_div">
23     <div class="facet_sidebar_hidden" id="facet_sidebar">
24     <h3 class="sr-only">[% l('Saved Searches') %]</h3>
25     [% INCLUDE "opac/parts/staff_saved_searches.tt2" %]
26     <h3 class="sr-only">[% l('Search Results facets') %]</h3>
27     [% INCLUDE 'opac/parts/result/facets.tt2' %]
28     <h3 class="sr-only">[% l('Search Results List') %]</h3>
29     </div>
30             <div id="result_block" class="result_block_visible">
31                 <table id="result_table_table" title="[% l('Search Results') %]"
32                   class="table_no_border_space table_no_cell_pad">
33                     <thead class="sr-only">
34                       <tr>
35                         <th>[% l('Search result number') %]</th>
36                         <th>[% l('Book jacket cover art') %]</th>
37                         <th>[% l('Item details and Actions') %]</th>
38                       </tr>
39                     </thead>
40                     <tbody id="result_table">
41                     [%  FOR rec IN ctx.records;
42                             attrs = {marc_xml => rec.marc_xml};
43                             PROCESS get_marc_attrs args=attrs;
44                             IF CGI.param('detail_record_view');
45                                 attrs.title = attrs.title_extended;
46                             END;
47                             # note: rec.id refers to the record identifier, regardless
48                             # of the type of record. i.e. rec.id = mmr_id ? mmr_id : bre_id
49                             IF rec.mmr_id;
50                                 IF rec.mr_constituent_count > 1;
51                                     # metarecords link to record list page
52                                     record_url = mkurl(ctx.opac_root _ '/results', 
53                                         {metarecord => rec.mmr_id}, ['page']);
54                                 ELSE;
55                                     # for MR, bre_id refers to the master and in
56                                     # this case, only, record
57                                     record_url = mkurl(ctx.opac_root _ '/record/' _ rec.bre_id);
58                                 END;
59                                 hold_type = 'M';
60                             ELSE;
61                                 record_url = mkurl(ctx.opac_root _ '/record/' _ rec.bre_id);
62                                 hold_type = 'T';
63                             END;
64                     -%]
65                         <tr class="result_table_row">
66                                             <td class="results_row_count" name="results_row_count">[%
67                                                     result_count; result_count = result_count + 1
68                                                 %].</td>
69                                             <td class='result_table_pic_header'>
70                                                 <a href="[% record_url %]"><img alt="[% l('Book cover') %]"
71                                                         name='item_jacket' class='result_table_pic' width="55"
72                                                         src='[% ctx.media_prefix %]/opac/extras/ac/jacket/small/r/[% rec.bre_id | uri %]' /></a><br />
73                                             </td>
74                                             <td class='result_table_title_cell' name='result_table_title_cell'>
75                                                <div class="result_metadata">
76                                                     [% IF rec.mmr_id %]
77                                                     <abbr class="unapi-id" 
78                                                       title='tag:[% ctx.hostname %],[% date.format(date.now, '%Y') %]:metabib-metarecord/[% rec.mmr_id %]'>
79                                                     </abbr>
80                                                     [% ELSE %]
81                                                     <abbr class="unapi-id" 
82                                                       title='tag:[% ctx.hostname %],[% date.format(date.now, '%Y') %]:biblio-record_entry/[% rec.bre_id %]'>
83                                                     </abbr>
84                                                     [% END %]
85                                                     <a class='record_title search_link' name='record_[% rec.id %]'
86                                                         href="[% record_url %]"
87                                                         [% html_text_attr('title', l('Display record details for "[_1]"', attrs.title)) %]>
88                                                         [% attrs.title | html %]
89                                                      </a>
90                                                      [% IF rec.mr_constituent_count > 1 %]
91                                                      <span title="[% l('This group contains [_1] records', rec.mr_constituent_count) %]">
92                                                       ([% rec.mr_constituent_count %])
93                                                      </span>
94                                                      [% END %]
95
96 [%-
97 FOR entry IN attrs.graphic_titles;
98     FOR alt IN entry.graphic;
99         diratt = "";
100         IF alt.dir;
101             diratt = ' dir="' _ alt.dir _ '"';
102         END;
103 -%]
104 <div class="graphic880"[% diratt %]>
105     [% alt.value | html %]
106 </div>
107 [%-
108     END;
109 END;
110 -%]
111  
112                                                     <div>
113                                                         <a title="[% l("Perform an Author Search") %]"
114                                                                 class="record_author"
115                                                                 href="[%- 
116                                                                     authorquery = attrs.author | replace('[#"^$\+\-,\.:;&|\[\]()]', ' ');
117                                                                     mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, ['page'])
118                                                                     -%]">[% attrs.author | html %]</a>
119 [%-
120 FOR entry IN attrs.graphic_authors;
121     FOR alt IN entry.graphic;
122         diratt = "";
123         IF alt.dir;
124             diratt = ' dir="' _ alt.dir _ '"';
125         END;
126 -%]
127 <div class="graphic880"[% diratt %]>
128     [% alt.value | html %]
129 </div>
130 [%-
131     END;
132 END;
133 -%]
134
135                                                     </div>
136                                                     <div class='result_table_title_cell'>
137                                                     [%- IF attrs.format_label; %]
138                                                         [% FOR format IN attrs.all_formats %]
139                                                             <img title="[% format.label | html %]" 
140                                                                 alt="[% format.label | html %]" 
141                                                                 src="[% format.icon %]" /> 
142                                                             [% format.label | html %]
143                                                         [% END %]
144                                                     [%- END %]
145                                                     [%- UNLESS CGI.param('detail_record_view')
146                                                             OR (show_more_details.default == 'true'
147                                                             OR show_more_details.default == 'hide');
148                                                             IF attrs.pubdate;
149                                                                 pubdate_clean = attrs.pubdate | html;
150                                                                 l(" ([_1])", pubdate_clean);
151                                                             END;
152                                                         END
153                                                     -%]
154                                                     </div>
155                                                     <table 
156                                                        role="presentation"
157                                                        title="[% l('Record Holdings Summary') %]"
158                                                        class="table_no_border_space table_no_cell_pad table_no_border results_info_table">
159                                                         [% IF args.holdings.size > 0 %]
160                                                         <tr name='bib_cn_list' class='result_table_title_cell'>
161                                                             <td valign='top'>
162                                                                 <strong>[% l('Call number:') %]</strong>
163                                                             </td>
164                                                             <td>[% args.holdings.0.label | html %]</td>
165                                                         </tr>
166                                                         [% END %]
167
168                                                         [% IF CGI.param('detail_record_view') %]
169                                                         <!-- These fields are visible when viewing the results page in 'detailed' mode -->
170
171                                                         [% IF attrs.pubinfo %]
172                                                             <tr name="results_pub_tr">
173                                                                 <td valign="top">
174                                                                     <strong>[% l('Publisher:') %]</strong>
175                                                                 </td>
176                                                                 <td>[% attrs.pubinfo | html %]
177 [%-
178 FOR entry IN attrs.graphic_pubinfos;
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.isbns.size > 0 %]
196                                                             <tr name="results_isbn_tr">
197                                                                 <td valign="top">
198                                                                     <strong>[% l('ISBN:') %]</strong>
199                                                                 </td>
200                                                                 <td>[% attrs.isbns.0 | html %]</td>
201                                                             </tr>
202                                                         [% END %]
203                                                         [%- IF attrs.issns.size > 0 %]
204                                                             <tr name="results_issn_tr">
205                                                                 <td valign="top">
206                                                                     <strong>[% l('ISSN:') %]</strong>
207                                                                 </td>
208                                                                 <td>[% attrs.issns.0 | html %]</td>
209                                                             </tr>
210                                                         [%- END %]
211                                                         [%- IF openurl.enabled == 'true';
212                                                             FOREACH issn IN args.issns;
213                                                                 NEXT IF issn == '';
214                                                                 res_urls = ResolverResolver.resolve_issn(issn, openurl.baseurl);
215                                                                 FOREACH res IN res_urls;
216                                                         %]
217                                                         <tr name="results_issn_tr">
218                                                             <td valign="top">
219                                                                 <strong><a href="[% res.target_url %]">
220                                                                 [% res.public_name | html %]</a></strong>
221                                                             </td>
222                                                             <td>[% res.target_coverage | html %]</td>
223                                                         </tr>
224                                                                 [% END %]
225                                                             [% END %]
226                                                         [% END %]
227
228                                                         [% IF attrs.edition %]
229                                                             <tr name="results_edition_tr">
230                                                                 <td valign="top">
231                                                                     <strong>[% l('Edition:') %]</strong>
232                                                                 </td>
233                                                                 <td>[% attrs.edition | html %]
234 [%-
235 FOR entry IN attrs.graphic_editions;
236     FOR alt IN entry.graphic;
237         diratt = "";
238         IF alt.dir;
239             diratt = ' dir="' _ alt.dir _ '"';
240         END;
241 -%]
242 <div class="graphic880"[% diratt %]>
243     [% alt.value | html %]
244 </div>
245 [%-
246     END;
247 END;
248 -%]
249 </td>
250                                                             </tr>
251                                                         [% END %]
252                                                         [% IF attrs.phys_desc %]
253                                                             <tr name="results_phys_desc_tr">
254                                                                 <td nowrap="nowrap" valign="top">
255                                                                     <strong>[% l('Phys. Desc.:') %]</strong>
256                                                                 </td>
257                                                                 <td>
258                                                                     [% args.phys_desc | html %]
259                                                                 </td>
260                                                             </tr>
261                                                         [% END %]
262                                                         [% FOR uri IN args.uris %]
263                                                             <tr name='bib_uri_list' class='result_table_title_cell'>
264                                                                 <td valign='top'>
265                                                                     <strong>[% l('Electronic resource') %]</strong>
266                                                                 </td>
267                                                                 <td><a href="[% uri.href %]">[% uri.link | html %]</a>[% ' - ' _ uri.note | html IF uri.note %]</td>
268                                                             </tr>
269                                                             [% END %]
270                                                             [%- IF args.holdings.size > 0;
271                                                                 FOREACH copy IN args.holdings;
272                                                                     IF copy.part_label != '';
273                                                                         has_parts = 'true';
274                                                                         LAST;
275                                                                     END;
276                                                                 END;
277                                                             %]
278                                                             <tr name='bib_cn_list' class='result_table_title_cell'>
279                                                                 <td colspan='2'>
280                                                                     <table title="[% l('Record Holdings Details') %]"
281                                                                            class='result_holdings_table'>
282                                                                         <thead><tr>
283                                                                             <th>[% l('Library') %]</th>
284                                                                             <th>[% l('Shelving location') %]</th>
285                                                                             <th>[% l('Call number') %]</th>
286                                                                             [%- IF has_parts == 'true'; %]
287                                                                             <th>[% l('Part') %]</th>
288                                                                             [%- END %]
289                                                                             <th>[% l('Status') %]</th>
290                                                                         </tr></thead>
291                                                                         <tbody>
292                                                                 [% FOR copy IN args.holdings %]
293                                                                         <tr>
294                                                                             <td>
295 [%- copy_info = copy;
296     INCLUDE "opac/parts/library_name_link.tt2"; %]
297                                                                             </td>
298                                                                             <td>[% copy.location | html %]</td>
299                                                                             <td>[% copy.label | html %]</td>
300                                                                             [%- IF has_parts == 'true'; %]
301                                                                             <td>[% copy.part_label %]</td>
302                                                                             [%- END %]
303                                                                             <td>[% copy.status | html %]</td>
304                                                                         </tr>
305                                                                 [% END %]
306                                                                         </tbody>
307                                                                     </table>
308                                                                 </td>
309                                                             </tr>
310                                                             [%- has_parts = 'false';
311                                                                 END;
312                                                              %]
313                                                         [% END %] <!-- END detail_record_view -->
314                                                     </table>
315                                                     [% PROCESS "opac/parts/result/copy_counts.tt2" %]
316                                                     [% IF rec.user_circulated %]
317                                                     <div class="result_item_circulated">
318                                                         <img src="[% ctx.media_prefix %]/images/green_check.png" alt="[% l('Checked Out Before') %]"/>
319                                                         <span>[% l('I have checked this item out before') %]</span>
320                                                     </div>
321                                                     [% END %]
322                                                     [% IF ctx.bookbag;
323                                                         rec_id = rec.id;
324                                                         FOR note IN ctx.bookbag_items_by_bre_id.$rec_id.notes %]
325                                                     <div class="result-bookbag-item-note">
326                                                         [% note.note | html %]
327                                                     </div>
328                                                         [% END %]
329                                                     [% END %]
330                                                 </div>
331                                                 <div class="result_table_utils_cont">
332                                                     <div class="result_table_utils">
333 [%- search_ou = ctx.search_ou;
334     num_holdable_copies = attrs.marc_xml.findnodes('//*[local-name()="holdings" and @has_holdable="true"]').size || 0;
335     IF ctx.place_unfillable ||
336         ( num_holdable_copies > 0
337             && (ctx.holds_block.enabled != 'true' || attrs.org_copy_counts.$search_ou.available == 0)
338         )
339 %]
340                                                         <div class="results_aux_utils place_hold"><a
341                                                                 href="[% mkurl(ctx.opac_root _ '/place_hold',
342                                                                     {hold_target => rec.id, hold_type => hold_type, 
343                                                                       hold_source_page => mkurl()}, ['query']) %]"
344                                                                 [% html_text_attr('title', l('Place Hold on [_1]', attrs.title)) %]
345                                                                     class="no-dec"><img
346                                                                 src="[% ctx.media_prefix %]/images/green_check.png"
347                                                                 alt=""/><span class="result_place_hold">[% l('Place Hold') %]</span></a>
348                                                         </div>
349 [%- END -%]
350                                                         <div class="results_aux_utils result_util">
351                                                             [%  IF ctx.user;
352                                                                 INCLUDE "opac/parts/bookbag_actions.tt2";
353                                                             %]
354                                                             [%  ELSE;
355                                                                 operation = ctx.mylist.grep(rec.id).size ? "delete" : "add";
356                                                                 label = (operation == "add") ?  l("Add to my list") : l("Remove from my list");
357                                                                 title_label = (operation == "add") ? 
358                                                                   l("Add [_1] to my list", attrs.title) : 
359                                                                   l("Remove [_1] from my list", attrs.title);
360                                                                 href = mkurl(ctx.opac_root _ '/mylist/' _ operation, 
361                                                                         {record => rec.id, anchor => 'record_' _ rec.id}, 1);
362                                                             %]      
363                                                             <a href="[% href %]" class="no-dec" 
364                                                                 [% html_text_attr('title', title_label) %]>
365                                                                 <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
366                                                                 [% label %]
367                                                             </a>
368                                                             [% END %]
369                                                         </div>
370                                                         [% IF ENV.OILS_CONTENT_CAFE_USER %]
371                                                         [% ident = attrs.isbn_clean || attrs.upc %]
372                                                         <div class="results_aux_utils result_util">
373                                                             <a target='_blank' 
374                                                                [% html_text_attr('title', l('Reviews and More for [_1]', attrs.title)) %]
375                                                                 href="[% ctx.ext_proto %]://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=[%- 
376                                                                     ENV.OILS_CONTENT_CAFE_USER %]&amp;Password=[%-
377                                                                     ENV.OILS_CONTENT_CAFE_PASS %]&amp;ItemKey=[% ident | uri %]&amp;Options=Y">
378                                                                 <img src='[% ctx.media_prefix %]/images/starz.png' alt="[% l('Ratings Icon') %]"/> 
379                                                                 <span class="results_reviews">[% l('Reviews &amp; More') %]</span>
380                                                             </a>
381                                                         </div>
382                                                         [% END %]
383                                                     </div>
384                                                 </div>
385
386                                             </td>
387
388                                         </tr>
389                                         [%- IF ENV.OILS_CHILIFRESH_ACCOUNT %]
390                                         <tr>
391                                             <td/>
392                                             <td align='center'> <!-- Chilifresh reviews link --> 
393                                                 <span class="chili_review" id="isbn_[% attrs.isbn_clean | html %]"> </span>
394                                             </td>
395                                         </tr>
396                                         <tr>
397                                             <td/>
398                                             <td colspan='5'> <!-- Chilifresh reviews panel -->
399                                                 <div id="chili_review_[% attrs.isbn_clean | html %]" style="display: none;" align="center"></div>
400                                             </td>
401                                         </tr>
402                                         [%- END %]
403                     [% END %]
404                     </tbody>
405                 </table>
406             </div>
407 </div>
408 <div class="result_footer_nav1">
409     [% ctx.results_count_header %]
410 </div>
411 <script>
412 resultBlock = document.getElementById('result_block');
413 resultButton = document.getElementById('return_to_hits');
414 facetSidebar = document.getElementById('facet_sidebar');
415 facetButton =  document.getElementById('refine_hits');
416 function getFacety() {
417     resultBlock.setAttribute('class', 'result_block_hidden');
418     resultButton.setAttribute('class', 'results_header_btns result_block_visible');
419     facetSidebar.setAttribute('class', 'facet_sidebar_visible');
420     facetButton.setAttribute('class', 'result_block_hidden');
421     window.location.hash = 'return_to_hits';
422 }
423 function getResulty() {
424     resultBlock.setAttribute('class', 'result_block_visible');
425     resultButton.setAttribute('class', 'result_block_hidden');
426     facetSidebar.setAttribute('class', 'facet_sidebar_hidden');
427     facetButton.setAttribute('class', 'results_header_btns result_block_visible');
428     window.location.hash = 'refine_hits';
429 }
430 </script>