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