]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/myopac/circ_history.tt2
Docs: end-user documentation for Obalkyknih.cz added content
[working/Evergreen.git] / Open-ILS / src / templates / opac / myopac / circ_history.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     limit = ctx.circ_history_limit;
7     offset = ctx.circ_history_offset;
8 %]
9
10 <h3 class="sr-only">[% l('History of Checked Out Items') %]</h3>
11 <div style="padding:0px;">
12
13     <div id="acct_checked_tabs">
14         <div class="align">
15             <a href='[% mkurl('circs',{},1) %]'>[% l("Current Items Checked Out") %]</a>
16         </div>
17         <div class="align selected">
18             <a href="#">[% l("Check Out History") %]</a>
19         </div>
20     </div>
21
22     [%
23     # In the sorting case, the size is the size of ALL the circ items.  In the non-sorting case,
24     # the size is simply the size of the chunk passed in.  See the TODO below for the still-lingering
25     # bug.
26     sort_field = CGI.param('sort');
27     IF (sort_field);
28         no_next = ctx.circs.size - offset <= limit;
29     ELSE;
30         no_next = ctx.circs.size < limit;
31     END;
32     %]
33
34     <div class="header_middle">
35         <span class="float-left">[% l('Previously Checked Out Items') %]</span>
36         <span class='float-left' style='padding-left: 10px;'>
37             <a href='[% mkurl('circ_history', {limit => limit, offset => (offset - limit)}) %]'
38                 [% IF offset == 0 %] class='invisible' [% END %]><span class="nav_arrow_fix">&#9668;</span>[% l('Previous') %]</a>
39             [%# TODO: get total to prevent paging off then end of the list.. %]
40             <a href='[% mkurl('circ_history', {limit => limit, offset => (offset + limit)}) %]'
41             [% IF no_next %] class='invisible' [% END %] >[% l('Next') %]<span class="nav_arrow_fix">&#9658;</span></a>
42         </span>
43         <div class="float-left">
44             <form action="[% mkurl(ctx.opac_root _ '/myopac/circ_history/export') %]" method="post">
45                 <div>
46                     [%- INCLUDE "opac/parts/preserve_params.tt2" %]
47                     [% IF ctx.circs.size > 0 %]
48                     <input type="hidden" name="filename" value="[% l('circ_history.csv') %]"/>
49                     <button type="submit">[% l('Download CSV') %]</button>
50                     [% END %]
51                 </div>
52             </form>
53         </div>
54     </div>
55     <div class="clear-both"></div>
56
57     [% IF ctx.circs.size < 1 %]
58     <div class="warning_box">[% l('There are no items in your circulation history.') %]</div>
59     [% ELSE %]
60
61         <form method="post" id="circ-form"
62             onsubmit="return confirm('[% l("Are you sure you wish to delete the selected item(s)?") %]');">
63         <table cellpadding='0' cellspacing='0' class="item_list_padding">
64             <tr>
65                 <td>
66                     <select name="action">
67                         <option value="delete">[% l('Delete Selected Titles') %]</option>
68                     </select>
69                 </td>
70                 <td style="padding-left:9px;">
71                     <input type="submit"
72                         value="[% l('Go') %]"
73                         alt="[% l('Go') %]" title="[% l('Go') %]"
74                         class="opac-button" />
75                 </td>
76                 <!--
77                 <td style="padding-left:5px;">
78                     <a href="#"><img alt="[% l('Deleting Help') %]"
79                         src="[% ctx.media_prefix %]/images/question-mark.png" /></a>
80                 </td>
81                 -->
82             </tr>
83         </table>
84     <div id='checked_main'>
85         <table id="acct_checked_hist_header"
86             title="[% l('History of Items Checked Out') %]">
87             <thead>
88                 <tr>
89                     <th class="checkbox_column">
90                         <input type="checkbox" onclick="var inputs=document.getElementsByTagName('input'); for (i = 0; i < inputs.length; i++) { if (inputs[i].name == 'circ_id' && !inputs[i].disabled) inputs[i].checked = this.checked;}"/>
91                     </th>
92                     <th>[% sort_head("sort_title", l("Title")) %]</th>
93                     <th>[% sort_head("author", l("Author")) %]</th>
94                     <th>[% sort_head("checkout", l("Checkout Date")) %]</th>
95                     <th>[% sort_head("due", l("Due Date")) %]</th>
96                     <th>[% sort_head("returned", l("Date Returned")) %]</th>
97                     <th>[% sort_head("barcode", l("Barcode")) %]</th>
98                     <th>[% sort_head("callnum", l("Call Number")) %]</th>
99                 </tr>
100             </thead>
101             <tbody>
102                 [%# Copy the ctx.circs into a local array, then add a SORT field
103                     that contains the value to sort on.  Since we need the item attrs,
104                     invoke it and save the result in ATTRS.
105         %]
106         [%
107                 circ_items = ctx.circs;  # Array assignment
108
109                 FOR circ IN circ_items;
110                     circ.ATTRS = {marc_xml => circ.marc_xml};
111                     PROCESS get_marc_attrs args=circ.ATTRS;
112
113                     SWITCH sort_field;
114
115                     CASE "sort_title";
116                         circ.SORTING = circ.ATTRS.sort_title;
117
118                     CASE "author";
119                         circ.SORTING = circ.ATTRS.author;
120
121                     CASE "checkout";
122                         circ.SORTING = circ.circ.xact_start;
123
124                     CASE "due";
125                         circ.SORTING = circ.circ.due_date;
126
127                     CASE "returned";
128                         circ.SORTING = circ.circ.checkin_time;
129
130                     CASE "barcode";
131                         circ.SORTING = circ.circ.target_copy.barcode;
132
133                     CASE "callnum";
134                         circ.SORTING = circ.circ.target_copy.call_number.label;
135
136                     CASE;
137                         sort_field = "";
138                     END; # SWITCH
139                 END; #FOR circ
140
141                 IF (sort_field != "sort_title");
142                 deemphasize_class = "";
143                 ELSE;
144                 deemphasize_class = " class=\"sort_deemphasize\"";
145                 END;
146
147                 # Apply sorting to circ_items
148                 IF (sort_field);
149                 circ_items = circ_items.sort("SORTING");
150                 IF (CGI.param("sort_type") == "desc");
151                     circ_items = circ_items.reverse;
152                 END;
153
154                 # Shorten the circ_items list per offset/limit/cout
155                 hi = offset + limit - 1;
156                 hi = hi > circ_items.max ? circ_items.max : hi;
157
158                 circ_items = circ_items.slice(offset, hi);
159                 END;
160
161                 # circ_items list is now sorted.  Traverse and dump the information.
162
163                 FOR circ IN circ_items; %]
164                     <tr>
165             <td class="checkbox_column">
166                 <input type="checkbox" name="circ_id" value="[% circ.circ.id %]" />
167             </td>
168                         <td>
169                             <a href="[% mkurl(ctx.opac_root _ '/record/' _
170                                 circ.circ.target_copy.call_number.record.id, {}, 1) %]"
171                                 name="[% l('Catalog record') %]"><span[%- deemphasize_class -%]>
172                                 [%- circ.ATTRS.title.substr(0,circ.ATTRS.nonfiling_characters) | html %]</span>
173                                 [%- circ.ATTRS.title.substr(circ.ATTRS.nonfiling_characters) | html %]</a>
174                         </td>
175                         <td>
176                             <a href="[% mkurl(ctx.opac_root _ '/results',
177                                 {qtype => 'author', query => circ.ATTRS.author.replace('[,\.:;]', '')},
178                                 1
179                             ) %]">[% circ.ATTRS.author | html %]</a>
180                         </td>
181                         <td>
182                             [% date.format(ctx.parse_datetime(circ.circ.xact_start),DATE_FORMAT); %]
183                         </td>
184                         <td>
185                             [% date.format(ctx.parse_datetime(circ.circ.due_date),DATE_FORMAT); %]
186                         </td>
187                         <td>
188                             [% IF circ.circ.checkin_time;
189                                     date.format(ctx.parse_datetime(circ.circ.checkin_time),DATE_FORMAT);
190                                 ELSE; %]
191                                 <span style='color:blue;'>*</span><!-- meh -->
192                             [% END; %]
193                         </td>
194                         <td>[% circ.circ.target_copy.barcode | html %]</td>
195                         <td>[% circ.circ.target_copy.call_number.label | html %]</td>
196                     </tr>
197                 [% END %]
198             </tbody>
199         </table>
200     </div>
201     </form>
202     [% END %]
203 </div>
204 [% END %]