]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/web/templates/default/opac-poc/results.tt2
Merge branch 'master' of git://git.evergreen-ils.org/Evergreen into template-toolkit...
[Evergreen.git] / Open-ILS / web / templates / default / opac-poc / results.tt2
1 [% BLOCK html_head %]
2 <style>
3     #body_table { width: 100%; margin-top: 20px; }
4     #left_block { width: 15%; vertical-align: top; }
5     #right_block { width: auto; vertical-align: top;}
6     #record_table { border-collapse: collapse; width:100%; }
7     #record_table td { padding: 3px; border-bottom: 1px solid #ddd; }
8     #record_table tr:nth-child(odd) { background-color:#ded; }
9     .record-table-odd { background-color:#ded; }
10     #form_div { text-align: center; width: 100%; margin-top: 10px;}
11     #links_div { margin-bottom: 10px; padding: 5px;}
12 </style>
13 [% END %]
14
15 [% 
16     USE CGI;
17     USE POSIX;
18     WRAPPER "default/opac/base.tt2"; 
19     PROCESS "default/opac/common.tt2";
20     ctx.page_title = "Results";
21     page = CGI.param('page') || 0; 
22     query = CGI.param('query');
23     page_count = POSIX.ceil(ctx.hit_count / ctx.page_size);
24     loc = CGI.param('loc');
25 %]
26
27 <div id='form_div'>
28     <form action='./results' method='GET'>
29         <input type='text' name='query' size='50' value='[% query %]'/>
30         [% PROCESS build_org_selector name='loc' value=loc %]
31         <input type='submit'/>
32         <input type='hidden' name='page' value='0'/>
33     </form>
34 </div>
35
36 <table id='body_table'>
37     <tr>
38         <td id='left_block'>
39                 [% IF ctx.user; %]
40                     <div id='links_div'>
41                         <div><a href='home'>Home</a></div>
42                         <div><a href='myopac/main'>Account</a></div>
43                         <div><a href='logout'>Logout</a></div>
44                     </div>
45                     <hr/>
46                     <table>
47                         <tr><td colspan='2' style='border-bottom:1px solid #9A9'>Signed in as [% ctx.user.usrname %]</td></tr>
48                         <tr><td>Total Holds</td><td>[% ctx.user_stats.holds.total %]</td></tr>
49                         <tr><td>Ready Holds</td><td>[% ctx.user_stats.holds.ready %]</td></tr>
50                         <tr><td>Items Out</td><td>[% ctx.user_stats.checkouts.out %]</td></tr>
51                         <tr><td>Fines</td><td>$[% ctx.user_stats.fines.balance_owed %]</td></tr>
52                     </table>
53                 [% ELSE %]
54                     [% 
55                         login = CGI.url("-path" => 1).replace('^http:', 'https:').replace('/results','/login');
56                     %]
57                     <a href='[% login %]'>Login</a>
58                 [% END %]
59             </div>
60             <div>
61                 [% FOR facet_type IN ctx.search_facets.keys %]
62                     [% cmf = ctx.search_facets.$facet_type.cmf %]
63                     <b>[% cmf.label %]</b>
64                     <ul>
65                         [% FOR facet IN ctx.search_facets.$facet_type.data.keys %]
66                             [% facet_count = ctx.search_facets.$facet_type.data.$facet %]
67                             <li><a href='results?query=[% query | url %]&facet=[% cmf.field_class %]|[% cmf.name %][[% facet | url %]]'>[% facet_count %] / [% facet %]</a></li>
68                         [% END %]
69                     </ul>
70                 [% END %]
71             </div>
72         </td>
73         <td id='right_block'>
74             <div>
75                 <span>[% l('Hits: [_1] / Page [_2] of [_3]', ctx.hit_count, page + 1, page_count) %]</span>
76                 [% 
77                     q = query | url;
78                     np_link = '?query=' _ q;
79                     IF loc; np_link = np_link _ "&loc=" _ loc; END;
80                     IF depth or depth == 0; np_link = np_link _ "&depth=" _ depth; END;
81                 %]
82                 <a [% IF page > 0 %] href='[% np_link %]&page=[% page - 1 %]' [% END %]>Prev</a>  
83                 <a [% IF (page + 1) < page_count %] href='[% np_link %]&page=[% page + 1 %]' [% END %]>Next</a>
84             </div>
85             <table id='record_table'>
86                 [%
87                 FOR rec IN ctx.records;
88                     attrs = {marc_xml => rec.marc_xml};
89                     PROCESS get_marc_attrs args=attrs;
90                 %]
91                 <tr [% IF loop.count % 2 == 1 %] class='record-table-odd' [% END %]>
92                     <td style='width:52px;height:72px'>
93                         [% IF attrs.isbn %]
94                         <img width='50' height='70' src='[% ctx.media_prefix %]/opac/extras/ac/jacket/small/[% attrs.isbn_clean || attrs.upc %]'/>
95                         [% END %]
96                     </td>
97                     <td width='auto'>
98                         <div width='99%'>
99                             <div style='float:left'>
100                                 <a href='record/[% rec.bre.id %]'>[% attrs.title %]</a>
101                             </div>
102                             <div style='float:right'>
103                                 <span>[% rec.copy_counts.available %] / [% rec.copy_counts.visible %]</span>
104                                 <span style='padding-left:10px;'><a href='place_hold?hold_target=[% rec.bre.id %]&hold_type=T'>Hold</a></span>
105                             </div>
106                         </div><br/>
107                         <div>[% attrs.author %]</div>
108                         <div>[% attrs.isbn || attrs.issn || attrs.upc %] [% attrs.publisher %] [% attrs.pubdate %]</div>
109                     </td>
110                 </tr>
111                 [% END %]
112             </table>
113         </td>
114     </tr>
115
116 </table>
117 [% END %]