]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/result/table.tt2
baebf636b6c838db2482fa2f56bbe0ad5dacf935
[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.defined && 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}, general_search_parms.merge(expert_search_parms, browse_search_parms, facet_search_parms))
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                                                             ELSIF attrs.copyright;
152                                                                 copyright_clean = attrs.copyright | html;
153                                                                 l(" ([_1])", copyright_clean);                                                                
154                                                             END;
155                                                         END
156                                                     -%]
157                                                     </div>
158                                                     <table 
159                                                        role="presentation"
160                                                        title="[% l('Record Holdings Summary') %]"
161                                                        class="table_no_border_space table_no_cell_pad table_no_border results_info_table">
162                                                         [% IF args.holdings.size > 0 %]
163                                                         <tr name='bib_cn_list' class='result_table_title_cell'>
164                                                             <td valign='top'>
165                                                                 <strong>[% l('Call number:') %]</strong>
166                                                             </td>
167                                                             <td>[% args.holdings.0.label | html %]</td>
168                                                         </tr>
169                                                         [% END %]
170
171                                                         [% IF CGI.param('detail_record_view') %]
172                                                         <!-- These fields are visible when viewing the results page in 'detailed' mode -->
173
174                                                         [% IF attrs.publisher %]
175                                                             <tr name="results_pub_tr">
176                                                                 <td valign="top">
177                                                                     <strong>[% l('Publisher:') %]</strong>
178                                                                 </td>
179                                                                 <td>[% attrs.pubplace | html; %] [% attrs.publisher | html; %] [% attrs.pubdate | html; %]
180 [%-
181 FOR entry IN attrs.graphic_pubinfos;
182     FOR alt IN entry.graphic;
183         diratt = "";
184         IF alt.dir;
185             diratt = ' dir="' _ alt.dir _ '"';
186         END;
187 -%]
188 <div class="graphic880"[% diratt %]>
189     [% alt.value | html %]
190 </div>
191 [%-
192     END;
193 END;
194 -%]
195 </td>
196                                                             </tr>
197                                                         [% ELSIF attrs.producer %]
198                                                             <tr name="results_pub_tr">
199                                                                 <td valign="top">
200                                                                     <strong>[% l('Producer:') %]</strong>
201                                                                 </td>
202                                                                 <td>[% attrs.prodplace | html; %] [% attrs.producer | html; %] [% attrs.proddate | html; %]</td>
203                                                             </tr>
204                                                         [% ELSIF attrs.distributor %]
205                                                             <tr name="results_pub_tr">
206                                                                 <td valign="top">
207                                                                     <strong>[% l('Distributor:') %]</strong>
208                                                                 </td>
209                                                                 <td>[% attrs.distplace | html; %] [% attrs.distributor | html; %] [% attrs.distdate | html; %]</td>
210                                                             </tr>
211                                                         [% ELSIF attrs.manufacturer %]
212                                                             <tr name="results_pub_tr">
213                                                                 <td valign="top">
214                                                                     <strong>[% l('Manufacturer:') %]</strong>
215                                                                 </td>
216                                                                 <td>[% attrs.manplace | html; %] [% attrs.manufacturer | html; %] [% attrs.mandate | html; %]</td>
217                                                             </tr>
218                                                         [% END %]
219                                                         [% IF attrs.isbns.size > 0 %]
220                                                             <tr name="results_isbn_tr">
221                                                                 <td valign="top">
222                                                                     <strong>[% l('ISBN:') %]</strong>
223                                                                 </td>
224                                                                 <td>[% attrs.isbns.0 | html %]</td>
225                                                             </tr>
226                                                         [% END %]
227                                                         [%- IF attrs.issns.size > 0 %]
228                                                             <tr name="results_issn_tr">
229                                                                 <td valign="top">
230                                                                     <strong>[% l('ISSN:') %]</strong>
231                                                                 </td>
232                                                                 <td>[% attrs.issns.0 | html %]</td>
233                                                             </tr>
234                                                         [%- END %]
235                                                         [%- IF openurl.enabled == 'true';
236                                                             FOREACH issn IN args.issns;
237                                                                 NEXT IF issn == '';
238                                                                 res_urls = ResolverResolver.resolve_issn(issn, openurl.baseurl);
239                                                                 FOREACH res IN res_urls;
240                                                         %]
241                                                         <tr name="results_issn_tr">
242                                                             <td valign="top">
243                                                                 <strong><a href="[% res.target_url %]">
244                                                                 [% res.public_name | html %]</a></strong>
245                                                             </td>
246                                                             <td>[% res.target_coverage | html %]
247                                                             [%- IF res.target_embargo != '';
248                                                                     ' - ';
249                                                                     res.target_embargo | html;
250                                                                 END;
251                                                             -%]
252                                                             </td>
253                                                         </tr>
254                                                                 [% END %]
255                                                             [% END %]
256                                                         [% END %]
257
258                                                         [% IF attrs.edition %]
259                                                             <tr name="results_edition_tr">
260                                                                 <td valign="top">
261                                                                     <strong>[% l('Edition:') %]</strong>
262                                                                 </td>
263                                                                 <td>[% attrs.edition | html %]
264 [%-
265 FOR entry IN attrs.graphic_editions;
266     FOR alt IN entry.graphic;
267         diratt = "";
268         IF alt.dir;
269             diratt = ' dir="' _ alt.dir _ '"';
270         END;
271 -%]
272 <div class="graphic880"[% diratt %]>
273     [% alt.value | html %]
274 </div>
275 [%-
276     END;
277 END;
278 -%]
279 </td>
280                                                             </tr>
281                                                         [% END %]
282                                                         [% IF attrs.phys_desc %]
283                                                             <tr name="results_phys_desc_tr">
284                                                                 <td nowrap="nowrap" valign="top">
285                                                                     <strong>[% l('Phys. Desc.:') %]</strong>
286                                                                 </td>
287                                                                 <td>
288                                                                     [% args.phys_desc | html %]
289                                                                 </td>
290                                                             </tr>
291                                                         [% END %]
292                                                         [% FOR uri IN args.uris %]
293                                                             <tr name='bib_uri_list' class='result_table_title_cell'>
294                                                                 <td valign='top'>
295                                                                     <strong>[% l('Electronic resource') %]</strong>
296                                                                 </td>
297                                                                 <td><a href="[% uri.href %]">[% uri.link | html %]</a>[% ' - ' _ uri.note | html IF uri.note %]</td>
298                                                             </tr>
299                                                             [% END %]
300                                                             [%- IF args.holdings.size > 0;
301                                                                 FOREACH copy IN args.holdings;
302                                                                     IF copy.part_label != '';
303                                                                         has_parts = 'true';
304                                                                         LAST;
305                                                                     END;
306                                                                 END;
307                                                             %]
308                                                             <tr name='bib_cn_list' class='result_table_title_cell'>
309                                                                 <td colspan='2'>
310                                                                     <table title="[% l('Record Holdings Details') %]"
311                                                                            class='result_holdings_table'>
312                                                                         <thead><tr>
313                                                                             <th>[% l('Library') %]</th>
314                                                                             <th>[% l('Shelving location') %]</th>
315                                                                             <th>[% l('Call number') %]</th>
316                                                                             [%- IF has_parts == 'true'; %]
317                                                                             <th>[% l('Part') %]</th>
318                                                                             [%- END %]
319                                                                             <th>[% l('Status') %]</th>
320                                                                         </tr></thead>
321                                                                         <tbody>
322                                                                 [% FOR copy IN args.holdings %]
323                                                                         <tr>
324                                                                             <td>
325 [%- copy_info = copy;
326     INCLUDE "opac/parts/library_name_link.tt2"; %]
327                                                                             </td>
328                                                                             <td>[% copy.location | html %]</td>
329                                                                             <td>[% copy.label | html %]</td>
330                                                                             [%- IF has_parts == 'true'; %]
331                                                                             <td>[% copy.part_label %]</td>
332                                                                             [%- END %]
333                                                                             <td>[% copy.status | html %]</td>
334                                                                         </tr>
335                                                                 [% END %]
336                                                                         </tbody>
337                                                                     </table>
338                                                                 </td>
339                                                             </tr>
340                                                             [%- has_parts = 'false';
341                                                                 END;
342                                                              %]
343                                                         [% END %] <!-- END detail_record_view -->
344                                                     </table>
345                                                     [% PROCESS "opac/parts/result/copy_counts.tt2" %]
346                                                     [% IF rec.user_circulated %]
347                                                     <div class="result_item_circulated">
348                                                         <img src="[% ctx.media_prefix %]/images/green_check.png" alt="[% l('Checked Out Before') %]"/>
349                                                         <span>[% l('I have checked this item out before') %]</span>
350                                                     </div>
351                                                     [% END %]
352                                                     [% IF ctx.bookbag;
353                                                         rec_id = rec.id;
354                                                         FOR note IN ctx.bookbag_items_by_bre_id.$rec_id.notes %]
355                                                     <div class="result-bookbag-item-note">
356                                                         [% note.note | html %]
357                                                     </div>
358                                                         [% END %]
359                                                     [% END %]
360                                                 </div>
361                                                 <div class="result_table_utils_cont">
362                                                     <div class="result_table_utils">
363 [%- search_ou = ctx.search_ou;
364     num_holdable_copies = attrs.marc_xml.findnodes('//*[local-name()="holdings" and @has_holdable="true"]').size || 0;
365     IF ctx.place_unfillable ||
366         ( num_holdable_copies > 0
367             && (ctx.holds_block.enabled != 'true' || attrs.org_copy_counts.$search_ou.available == 0)
368         )
369 %]
370                                                         <div class="results_aux_utils place_hold"><a
371                                                                 href="[% mkurl(ctx.opac_root _ '/place_hold',
372                                                                     {hold_target => rec.id, hold_type => hold_type, 
373                                                                       hold_source_page => mkurl()}, ['query','tag','subfield','term','_special','sort','page']) %]"
374                                                                 [% html_text_attr('title', l('Place Hold on [_1]', attrs.title)) %]
375                                                                     class="no-dec"><img
376                                                                 src="[% ctx.media_prefix %]/images/green_check.png"
377                                                                 alt=""/><span class="result_place_hold">[% l('Place Hold') %]</span></a>
378                                                         </div>
379 [%- END -%]
380                                                         <div class="results_aux_utils result_util">
381                                                             [%  IF ctx.user;
382                                                                 INCLUDE "opac/parts/bookbag_actions.tt2";
383                                                             %]
384                                                             [%  ELSE;
385                                                                 operation = ctx.mylist.grep(rec.id).size ? "delete" : "add";
386                                                                 label = (operation == "add") ?  l("Add to my list") : l("Remove from my list");
387                                                                 title_label = (operation == "add") ? 
388                                                                   l("Add [_1] to my list", attrs.title) : 
389                                                                   l("Remove [_1] from my list", attrs.title);
390                                                                 href = mkurl(ctx.opac_root _ '/mylist/' _ operation, 
391                                                                         {record => rec.id, anchor => 'record_' _ rec.id}, 1);
392                                                             %]      
393                                                             <a href="[% href %]" class="no-dec" 
394                                                                 [% html_text_attr('title', title_label) %]>
395                                                                 <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
396                                                                 [% label %]
397                                                             </a>
398                                                             [% END %]
399                                                         </div>
400                                                         [% IF ENV.OILS_CONTENT_CAFE_USER %]
401                                                         [% ident = attrs.isbn_clean || attrs.upc %]
402                                                         <div class="results_aux_utils result_util">
403                                                             <a target='_blank' 
404                                                                [% html_text_attr('title', l('Reviews and More for [_1]', attrs.title)) %]
405                                                                 href="[% ctx.ext_proto %]://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=[%- 
406                                                                     ENV.OILS_CONTENT_CAFE_USER %]&amp;Password=[%-
407                                                                     ENV.OILS_CONTENT_CAFE_PASS %]&amp;ItemKey=[% ident | uri %]&amp;Options=Y">
408                                                                 <img src='[% ctx.media_prefix %]/images/starz.png' alt="[% l('Ratings Icon') %]"/> 
409                                                                 <span class="results_reviews">[% l('Reviews &amp; More') %]</span>
410                                                             </a>
411                                                         </div>
412                                                         [% END %]
413                                                     </div>
414                                                 </div>
415
416                                             </td>
417
418                                         </tr>
419                                         [%- IF ENV.OILS_CHILIFRESH_ACCOUNT %]
420                                         <tr>
421                                             <td/>
422                                             <td align='center'> <!-- Chilifresh reviews link --> 
423                                                 <span class="chili_review" id="isbn_[% attrs.isbn_clean | html %]"> </span>
424                                             </td>
425                                         </tr>
426                                         <tr>
427                                             <td/>
428                                             <td colspan='5'> <!-- Chilifresh reviews panel -->
429                                                 <div id="chili_review_[% attrs.isbn_clean | html %]" style="display: none;" align="center"></div>
430                                             </td>
431                                         </tr>
432                                         [%- END %]
433                     [% END %]
434                     </tbody>
435                 </table>
436             </div>
437 </div>
438 <div class="result_footer_nav1">
439     [% ctx.results_count_header %]
440 </div>
441 <script>
442 resultBlock = document.getElementById('result_block');
443 resultButton = document.getElementById('return_to_hits');
444 facetSidebar = document.getElementById('facet_sidebar');
445 facetButton =  document.getElementById('refine_hits');
446 function getFacety() {
447     resultBlock.setAttribute('class', 'result_block_hidden');
448     resultButton.setAttribute('class', 'results_header_btns result_block_visible');
449     facetSidebar.setAttribute('class', 'facet_sidebar_visible');
450     facetButton.setAttribute('class', 'result_block_hidden');
451     window.location.hash = 'return_to_hits';
452 }
453 function getResulty() {
454     resultBlock.setAttribute('class', 'result_block_visible');
455     resultButton.setAttribute('class', 'result_block_hidden');
456     facetSidebar.setAttribute('class', 'facet_sidebar_hidden');
457     facetButton.setAttribute('class', 'results_header_btns result_block_visible');
458     window.location.hash = 'refine_hits';
459 }
460 </script>