TPac: more template scrubbing and cleaning
[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 <div style="height: 10px;"></div>
13
14 [% PROCESS "opac/parts/result/paginate.tt2" %] 
15 [% ctx.results_count_header = PROCESS results_count_header;
16     ctx.results_count_header %]
17
18 <div id="result_table_div">
19     <table cellpadding="0" cellspacing="0" border="0" width="100%">
20         <tr>
21             <td valign="top" width="1" style="padding-right:20px;">
22                 <div style="width:174px;" class="hide_me">
23                     SIDEBAR TODO
24                 </div>
25             </td>
26             <td class='opac-auto-015' width="1"></td>
27             <td valign="top">
28                 <table cellpadding="0" cellspacing="0"
29                     border="0" width="100%" style="margin-top:10px;">
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                         <tr>
35                             <td class='result_table_row' align='left' width='100%'>
36                                 <table cellpadding="0" cellspacing="0" class='result_table_subtable'>
37                                     <tbody class='result_table_subtbody'>
38                                         <tr name='counts_row'>
39                                             <td width="58" valign="top"
40                                                 style="font-weight:bold;padding-left:10px;"
41                                                 name="results_row_count">[%
42                                                     result_count; result_count = result_count + 1
43                                                 %].</td>
44                                             <td class='result_table_pic_header' align='center'
45                                                 width="78" nowrap="nowrap" valign="top">
46                                                 [% ident = attrs.isbn_clean || attrs.upc; IF ident; %]
47                                                 <a href="[% mkurl(ctx.opac_root _ '/record/' _ rec.id) %]"><img alt="[% l('Image of item') %]"
48                                                         name='item_jacket' class='result_table_pic' width="55"
49                                                         src='[% ctx.media_prefix %]/opac/extras/ac/jacket/small/[% ident | uri %]' /></a><br />
50                                                 [% END %]
51                                             </td>
52                                             <td class='result_table_title_cell'
53                                                 name='result_table_title_cell'
54                                                 valign="top">
55                                                 <div class="bold">
56                                                     <a title="[% attrs.title | uri %]" name='item_title'
57                                                         href="[% mkurl(ctx.opac_root _ '/record/' _ rec.id) %]"
58                                                         class='search_link'>[% attrs.title | html %]</a>
59                                                 </div>
60                                                 <div style="font-size:11px;">
61                                                     <div>
62                                                         <em><a title="[% l("Perform an Author Search") %]"
63                                                                 name='item_author'
64                                                                 href="[%- 
65                                                                     authorquery = attrs.author | replace('[,\.:;]', '');
66                                                                     mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, ['page'])
67                                                                     -%]">[% attrs.author | html %]</a></em>
68                                                         &nbsp;&nbsp;
69                                                         [% attrs.pubdate | html %]
70                                                     </div>
71                                                     <table cellpadding="0" cellspacing="0" border="0"
72                                                         class="results_info_table">
73                                                         [% IF args.holdings.size > 0 %]
74                                                         <tr name='bib_cn_list' class='result_table_title_cell'>
75                                                             <td valign='top'>
76                                                                 <strong>[% l('Call number:') %]</strong>
77                                                             </td>
78                                                             <td>[% args.holdings.0.label | html %]</td>
79                                                         </tr>
80                                                         [% END %]
81
82                                                         [% IF CGI.param('detail_record_view') %]
83                                                         <!-- These fields are visible when viewing the results page in 'detailed' mode -->
84
85                                                         [% IF attrs.publisher %]
86                                                             <tr name="results_pub_tr">
87                                                                 <td valign="top">
88                                                                     <strong>[% l('Publisher:') %]</strong>
89                                                                 </td>
90                                                                 <td>[% attrs.publisher | html %]</td>
91                                                             </tr>
92                                                         [% END %]
93                                                         [% IF attrs.isbns.size > 0 %]
94                                                             <tr name="results_isbn_tr">
95                                                                 <td valign="top">
96                                                                     <strong>[% l('ISBN:') %]</strong>
97                                                                 </td>
98                                                                 <td>[% attrs.isbns.0 | html %]</td>
99                                                             </tr>
100                                                         [% END %]
101                                                         [%- IF openurl.enabled == 'true';
102                                                             FOR issn IN args.issns;
103                                                                 sfx = ResolverResolver.resolve_issn(issn, openurl.baseurl);
104                                                                 FOR res IN sfx;
105                                                         %]
106                                                         <tr name="results_issn_tr">
107                                                             <td valign="top">
108                                                                 <strong><a href="[% res.target_url %]">
109                                                                 [% res.public_name | html %]</a></strong>
110                                                             </td>
111                                                             <td>[% res.target_coverage | html %]</td>
112                                                         </tr>
113                                                                 [% END %]
114                                                             [% END %]
115                                                         [% END %]
116
117                                                         [% IF attrs.edition %]
118                                                             <tr name="results_edition_tr">
119                                                                 <td valign="top">
120                                                                     <strong>[% l('Edition:') %]</strong>
121                                                                 </td>
122                                                                 <td>[% attrs.edition | html %]</td>
123                                                             </tr>
124                                                         [% END %]
125                                                         [% IF attrs.phys_desc %]
126                                                             <tr name="results_phys_desc_tr">
127                                                                 <td nowrap="nowrap" valign="top">
128                                                                     <strong>[% l('Phys. Desc.:') %]</strong>
129                                                                 </td>
130                                                                 <td>
131                                                                     [% args.phys_desc | html %]
132                                                                 </td>
133                                                             </tr>
134                                                         [% END %]
135                                                         [% FOR uri IN args.uris %]
136                                                             <tr name='bib_uri_list' class='result_table_title_cell'>
137                                                                 <td valign='top'>
138                                                                     <strong>[% l('Electronic resource') %]</strong>
139                                                                 </td>
140                                                                 <td><a href="[% uri.href %]">[% uri.link | html %]</a>[% ' - ' _ uri.note | html IF uri.note %]</td>
141                                                             </tr>
142                                                             [% END %]
143                                                             [% IF args.holdings.size > 0 %]
144                                                             <tr name='bib_cn_list' class='result_table_title_cell'>
145                                                                 <td colspan='2'>
146                                                                     <table class='result_holdings_table'>
147                                                                         <thead><tr>
148                                                                             <th>[% l('Library') %]</th>
149                                                                             <th>[% l('Shelving location') %]</th>
150                                                                             <th>[% l('Call number') %]</th>
151                                                                             <th>[% l('Status') %]</th>
152                                                                         </tr></thead>
153                                                                         <tbody>
154                                                                 [% FOR copy IN args.holdings %]
155                                                                         <tr>
156                                                                             <td>[% copy.library | html %]</td>
157                                                                             <td>[% copy.location | html %]</td>
158                                                                             <td>[% copy.label | html %]</td>
159                                                                             <td>[% copy.status | html %]</td>
160                                                                         </tr>
161                                                                 [% END %]
162                                                                         </tbody>
163                                                                     </table>
164                                                                 </td>
165                                                             </tr>
166                                                         [% END %]
167                                                         [% END %] <!-- END detail_record_view -->
168                                                     </table>
169                                                     <div>
170                                                         [% l('[_1] of [quant,_2,copy,copies] available',
171                                                             attrs.copy_counts.available, attrs.copy_counts.count) # XXX s/count/nshadow/ ?
172                                                             #rec.copy_counts.available, rec.copy_counts.visible) 
173                                                         %]
174                                                     </div>
175                                                 </div>
176                                                 <div class="hide_me">
177                                                     <span name='result_table_extra_span' class='hide_me'>
178                                                         <span name='result_table_pub_box'
179                                                             style='padding-left: 10px;'>
180                                                             <span name='result_table_edition_span'
181                                                                 style='padding-left: 10px;'></span> |
182                                                             <span name='result_table_pub_span'> </span> |
183                                                             <span name='result_table_phys_span'> </span>
184                                                         </span>
185                                                     </span>
186                                                 </div>
187                                             </td>
188
189                                             <td name='result_table_format_cell' class='result_table_format_cell' width="1">
190
191                                                 [% IF attrs.format_icon %]
192                                                 <img title="[% attrs.format_label | html %]" alt="[% attrs.format_label | html %]" src="[% attrs.format_icon %]" />
193                                                 [% END %]
194
195                                                 <!-- unAPI link -->
196                                                 <abbr class="unapi-id" title='tag:[% ctx.hostname %],[% date.format(date.now, '%Y') %]:biblio-record_entry/[% rec.id %]'></abbr>
197
198                                                 <!-- Empty span used for creating Google Book Search-->
199                                                 <span name="googleBooksLink" class="hide_me">
200                                                     <a style='padding-left: 8px;'
201                                                         class='classic_link hide_me'
202                                                         name="googleBooks-link">[% l("Browse in Google Books Search") %]</a>
203                                                 </span>
204
205                                             </td>
206                                             <td nowrap='nowrap' width="1" align="right">
207                                                 <div style="width:250px;text-align:left;">
208                                                     <div style="float:right;">
209                                                         <div class="results_aux_utils opac-auto-010"><a
210                                                                 href="[% mkurl(ctx.opac_root _ '/place_hold', {hold_target => rec.id, hold_type => 'T'}) %]" 
211                                                                     name="place_hold_link" class="no-dec"><img
212                                                                 src="[% ctx.media_prefix %]/images/green_check.png"
213                                                                 alt=""/><span style="position:relative;top:-3px;left:3px;">[% l('Place Hold') %]</span></a>
214                                                         </div>
215                                                         <div class="results_aux_utils opac-auto-011">
216                                                             [%  
217                                                                 operation = ctx.mylist.grep(rec.id).size ? "delete" : "add";
218                                                                 label = (operation == "add") ? l("Add to my list") : l("Remove from my list");
219                                                             %]      
220                                                             <a href="[% mkurl(ctx.opac_root _ '/mylist/' _ operation, {record => rec.id}, 1) %]" class="no-dec">
221                                                                 <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
222                                                                 [% label %]
223                                                             </a>
224                                                         </div>
225                                                     </div>
226                                                 </div>
227                                             </td>
228                                         </tr>
229                                         <tr>
230                                             <td/>
231                                             <td align='center'> <!-- Chilifresh reviews link --> 
232                                                 <div class="chili_review" id="isbn_[% attrs.isbn_clean | html %]"> </div>
233                                             </td>
234                                         </tr>
235                                         <tr>
236                                             <td/>
237                                             <td colspan='5'> <!-- Chilifresh reviews panel -->
238                                                 <div id="chili_review_[% attrs.isbn_clean | html %]" style="display: none;" align="center" width="100%"></div>
239                                             </td>
240                                         </tr>
241                                         <tr><td colspan="5"><div style="height:0px;border-top:1px solid #b7b7b7;border-bottom:1px solid #d4d4d4;margin:15px 0px;"></div></td></tr>
242                                     </tbody>
243                                 </table>
244                             </td>
245                         </tr>
246                     [% END %]
247                     </tbody>
248                 </table>
249             </td>
250         </tr>
251     </table>
252 </div>
253 <div>
254     [% ctx.results_count_header %]
255 </div>