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