]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates/opac/myopac/circs.tt2
4715925ed4938d9ecb02c2e2c3920eb9be589ab2
[Evergreen.git] / Open-ILS / src / templates / opac / myopac / circs.tt2
1 [%  PROCESS "opac/parts/header.tt2";
2     PROCESS "opac/parts/misc_util.tt2";
3     PROCESS "opac/parts/myopac/column_sort_support.tt2";
4     WRAPPER "opac/parts/myopac/base.tt2";
5     myopac_page = "circs"  %]
6 <h3 class="sr-only">[% l('Current Items Checked Out') %]</h3>
7 <div id='myopac_checked_div'>
8
9     <div id="acct_checked_tabs">
10         <div class="align selected">
11             <a href="#">[% l("Current Items Checked Out") %]</a>
12         </div>
13         <div class="align">
14             <a href="[% mkurl('circ_history',{},1) %]">[% l("Check Out History") %]</a>
15         </div>
16     </div>
17
18     <div class="header_middle">
19         <span class="float-left">[% l('Current Items Checked Out') %]</span>
20     </div>
21     <div class="clear-both"></div>
22     [% IF ctx.circs.size < 1 %]
23     <div class="warning_box">[% l('You have no items checked out.') %]</div>
24     [% ELSE %]
25     [% IF ctx.success_renewals %]
26     <div class="renew-summary">
27         [% l("Successfully renewed [_1] item(s)", ctx.success_renewals) %]
28     </div>
29     [% END %]
30     [% IF ctx.failed_renewals %]
31     <div class="renew-summary alert">
32         [% l("Failed to renew [_1] item(s)", ctx.failed_renewals) %]
33     </div>
34     [% END %]
35     <div id='checked_main'>
36         <form method="post" id="circ-form"
37             onsubmit="return confirm('[% l("Are you sure you wish to renew the selected item(s)?") %]');">
38         <div>
39             <span>
40                 <select name="action" title="[% l('Select Action') %]">
41                     <option value="renew">[% l('Renew Selected Titles') %]</option>
42                 </select>
43             </span>
44             <span style="padding-left:9px;">
45                 <input type="submit"
46                     value="[% l('Go') %]"
47                     title="[% l('Go') %]"
48                     class="opac-button" />
49             </span>
50             <span style="padding-left:5px;">
51                 <a href="#"><img 
52                     alt="[% l('Renewing Help') %]"
53                     title="[% l('Actions for checked out items') %]"
54                     src="[% ctx.media_prefix %]/images/question-mark.png" /></a>
55             </span>
56         </div>
57
58         <table id="acct_checked_main_header" 
59             title="[% l('Items Checked Out') %]"
60             class="table_no_border_space table_no_cell_pad item_list_padding">
61             <thead>
62             <tr>
63                 <th class="checkbox_column">
64                     <input type="checkbox" id="check_all_checked"
65                         title="[% l('Select All Items') %]"
66                         onclick="var inputs=document.getElementsByTagName('input'); for (i = 0; i < inputs.length; i++) { if (inputs[i].name == 'circ' &amp;&amp; !inputs[i].disabled) inputs[i].checked = this.checked;}"
67                     />
68                 </th>
69                 <th>[% sort_head("sort_title", l("Title")) %]</th>
70                 <th>[% sort_head("author", l("Author")) %]</th>
71                 <th>[% sort_head("renews", l("Renewals Left")) %]</th>
72                 <th>[% sort_head("due", l("Due Date")) %]</th>
73                 <th>[% sort_head("barcode", l("Barcode")) %]</th>
74                 <th>[% sort_head("callnum", l("Call number")) %]</th>
75             </tr>
76             </thead>
77             <tbody>
78                 [%# Copy the ctx.circs into a local array, then add a SORT field
79                     that contains the value to sort on.  Since we need the item attrs,
80                     invoke it and save the result in ATTRS.
81                 %]
82                 [% 
83                 circ_items = ctx.circs;  # Array assignment
84
85                 sort_field = CGI.param('sort');  # unless changed below...
86
87                 FOR circ IN circ_items;
88                     circ.ATTRS = {marc_xml => circ.marc_xml};
89                     PROCESS get_marc_attrs args=circ.ATTRS;
90                 
91                     SWITCH sort_field;
92
93                        CASE "sort_title";
94                           circ.SORTING = circ.ATTRS.sort_title;
95
96                        CASE "author";
97                           circ.SORTING = circ.ATTRS.author;
98
99                        CASE "renews";
100                           circ.SORTING = circ.circ.renewal_remaining;
101                        
102                        CASE "due";
103                           circ.SORTING = circ.circ.due_date;
104                        
105                        CASE "barcode";
106                           circ.SORTING = circ.circ.target_copy.barcode;
107
108                        CASE "callnum";
109                           circ.SORTING = circ.circ.target_copy.call_number.label;
110                        
111                        CASE;
112                           sort_field = "";
113                     END; # SWITCH
114                 END; #FOR circ
115
116                 IF (sort_field != "sort_title");
117                    deemphasize_class = "";
118                 ELSE;
119                    deemphasize_class = " class=\"sort_deemphasize\"";
120                 END;
121
122                 # Apply sorting to circ_items
123                 IF (sort_field);
124                     circ_items = circ_items.sort("SORTING");
125                     IF (CGI.param("sort_type") == "desc");
126                         circ_items = circ_items.reverse;
127                     END;
128                 END;
129
130                 # circ_items list is now sorted.  Traverse and dump the information.
131
132                 FOR circ IN circ_items; %]
133                     <tr>
134                         <td class="checkbox_column" valign="top">
135                             <input type="checkbox" name="circ"
136                                 title="[% l('Item Selected') %]"
137                                 [% IF circ.circ.renewal_remaining < 1 %] disabled="disabled" [% END %]
138                                 value="[% circ.circ.id %]" />
139                         </td>
140                         <td name="title">
141                             [% IF circ.circ.target_copy.call_number.id == -1 %]
142                                 [% circ.circ.target_copy.dummy_title | html %]
143                             [% ELSIF circ.ATTRS.title %]
144                                 <a href="[% mkurl(ctx.opac_root _ '/record/' _ 
145                                     circ.circ.target_copy.call_number.record.id, {}, 1) %]"
146                                     name="[% l('Catalog record') %]"><span[%- deemphasize_class -%]>
147                                     [%- circ.ATTRS.title.substr(0,circ.ATTRS.nonfiling_characters) | html %]</span>
148                                     [%- circ.ATTRS.title.substr(circ.ATTRS.nonfiling_characters) | html %]</a>
149                             [% END %]
150                         </td>
151                         <td name="author">
152                             [% IF circ.circ.target_copy.call_number.id == -1 %]
153                                 [% circ.circ.target_copy.dummy_author | html %]
154                             [% ELSIF circ.ATTRS.author %]
155                                 <a href="[% mkurl(ctx.opac_root _ '/results',
156                                     {qtype => 'author', query => circ.ATTRS.author.replace('[,\.:;]', '')},
157                                     1
158                                 ) %]">[% circ.ATTRS.author | html %]</a>
159                             [% END %]
160                         </td>
161                         <td name="renewals">
162                             [% circ.circ.renewal_remaining %]
163                         </td>
164                         [%
165                             due_date = ctx.parse_datetime(circ.circ.due_date);
166                             due_class = (date.now > date.format(due_date, '%s')) ? 'error' : '';
167                         %]
168                         <td name="due_date" class='[% due_class %]'>
169                             [% date.format(due_date, DATE_FORMAT) %]
170                         </td>
171                         <td name="barcode">
172                             [% circ.circ.target_copy.barcode | html %]
173                         </td>
174                         <td name="call_number">
175                             [% circ.circ.target_copy.call_number.label | html %]
176                         </td>
177                     </tr>
178                     [%  IF circ.renewal_response AND
179                             circ.renewal_response.textcode != 'SUCCESS' %]
180                     <tr>
181                         <td colspan="6">[%# XXX colspan="0" does not work in IE %]
182                             <span class="failure-text" title="[% circ.renewal_response.textcode | html %] / [% circ.renewal_response.fail_part | html %]">
183                                 [%
184                                     renew_fail_msg = '';
185                                     IF circ.renewal_response.textcode == 'TOTAL_HOLD_COPY_RATIO_EXCEEDED' OR
186                                         circ.renewal_response.textcode == 'AVAIL_HOLD_COPY_RATIO_EXCEEDED';
187                                         # the stock hold ratio message may not be patron friendly
188                                         renew_fail_msg = l('Item is needed for a hold');
189                                     ELSE;
190                                         renew_fail_msg = circ.renewal_response.desc || 
191                                             circ.renewal_response.fail_part || 
192                                             circ.renewal_response.textcode;
193                                     END;
194                                     renew_fail_msg | html;
195                                 %]
196                             </span>
197                         </td>
198                     </tr>
199                     [%  END; # FOR
200
201                     END %]
202                 </tbody>
203             </table>
204         </form>
205     </div>
206     [% END %]
207 </div>
208 [% END %]