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