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