]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/myopac/lists.tt2
TPac: Add paging to My Lists
[working/Evergreen.git] / Open-ILS / src / templates / opac / myopac / lists.tt2
1 [%  PROCESS "opac/parts/header.tt2";
2     PROCESS "opac/parts/misc_util.tt2";
3     WRAPPER "opac/parts/myopac/base.tt2";
4     myopac_page = "lists"  
5     limit = ctx.bookbags_limit;
6     offset = ctx.bookbags_offset;
7 %]
8 <div id='myopac_bookbag_div' style="padding:5px;">
9
10     <!-- new list creation -->
11     <form action="[% mkurl(ctx.opac_root _ '/myopac/list/update') %]" method="POST" id="create_form">
12         <h1>[% l('Create new list') %]</h1><a name="createnewlist"></a>
13         <table cellpadding="0" border="0" id="list_create_table">
14             <tr>
15                 <td>
16                     <label for="list_create_name">[% l('Enter the name of the new list:') %]</label>
17                 </td>
18                 <td>
19                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
20                     <input id="list_create_name" type="text" name="name" />
21                     <input type="hidden" name="action" value="create" />
22                 </td>
23                 <td>
24                     <label for="list_create_shared">[% l('Share this list?') %]</label>
25                     <select name="shared" id="list_create_shared">
26                         <option value="0">[% l('No') %]
27                         <option value="1">[% l('Yes') %]
28                     </select>
29                     <a href="javascript:void(0);" onclick="alert(document.getElementById('bb_publish_text').innerHTML);"><img alt="[% l('Sharing Help') %]"
30                         src="[% ctx.media_prefix %]/images/question-mark.png" /></a>
31                 </td>
32                 <td class="list-create-table-buttons">
33                     <input type="submit"
34                         value="[% l('Submit') %]"
35                         alt="[% l('Submit') %]"
36                         class="opac-button"/>
37                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
38                     <input type="reset"
39                         value="[% l('Cancel') %]"
40                         alt="[% l('Cancel') %]"
41                         class="opac-button" />
42                 </td>
43             </tr>
44             <tr>
45                 <td class="text-right-top">
46                     <label for="list_description">[% l("List description (optional):") %]</label>
47                 </td>
48                 <td colspan="3">
49                     <textarea cols="40" rows="3" name="description"
50                         id="list_description"></textarea>
51                 </td>
52         </table>
53     </form>
54
55     <h1>[% l("Your existing lists") %]</h1>
56     [% INCLUDE "opac/parts/anon_list.tt2" %]
57     [% IF ctx.bookbags.size %]
58     <div class="header_middle">
59         <span class="float-left">[% l('Saved Lists') %]</span>
60         <span class='float-left' style='padding-left: 10px;'>
61             <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {limit => limit, offset => (offset - limit)}) %]'
62                 [% IF offset == 0 %] class='invisible' [% END %]><span class="nav_arrow_fix">&#9668;</span>[% l('Previous') %]</a>
63             [%# TODO: get total to prevent paging off then end of the list.. %]
64             <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {limit => limit, offset => (offset + limit)}) %]'
65                [% IF ctx.bookbags.size < limit %] class='invisible' [% END %] >[% l('Next') %]<span class="nav_arrow_fix">&#9658;</span></a>
66         </span>
67     </div>
68     <div class="clear-both"></div>
69
70     <div id='acct_lists_prime'>
71         [% FOR bbag IN ctx.bookbags %]
72         <div class="bookbag-controls-holder">
73             <div class="bookbag-controls most">
74                 [% baseurl = ctx.opac_root _ '/myopac/lists';
75                 IF bbag.id != CGI.param("bbid");
76                     url = mkurl(baseurl,{bbid => bbag.id},['edit_notes','sort']);
77                     ltitle = l("Show items in list");
78                 ELSE;
79                     url = mkurl(baseurl, {}, ['bbid', 'edit_notes', 'sort']);
80                     ltitle = l("Hide items in list");
81                 END %]
82                 <h2 class="bookbag-name"><a title="[% ltitle %]" href="[% url %]">[% bbag.name | html %]</a></h2>
83                 [% IF bbag.description %]<div class="bookbag-description">[% bbag.description | html %]</div>[% END %]
84             </div>
85             <form action="[% mkurl(ctx.opac_root _ '/myopac/list/update') %]" method="POST">
86                 <div class="bookbag-share">
87                     <input type="hidden" name="list" value="[% bbag.id %]" />
88                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
89                     [% IF bbag.pub != 't' %]
90                     <input type="hidden" name="action" value="show" />
91                     <input class="fixed" type="submit" value="[% l('Share') %]" />
92                     [% ELSE %]
93                     <input type="hidden" name="action" value="hide" />
94                     <input class="fixed" type="submit" value="[% l('Hide') %]" />
95                     [% END %]
96                 </div>
97             </form>
98             <form action="[% mkurl(ctx.opac_root _ '/myopac/list/update') %]" method="POST">
99                 <div class="bookbag-controls">
100                     <input type="hidden" name="list" value="[% bbag.id %]" />
101                     <input type="hidden" name="action" value="delete" />
102                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
103                     <input type="submit" value="[% l('Delete List') %]" />
104                 </div>
105             </form>
106             <form action="[% mkurl(ctx.opac_root _ '/myopac/list/print') %]" method="POST">
107                 <div class="bookbag-controls">
108                     <input type="hidden" name="list" value="[% bbag.id %]" />
109                     <input type="hidden" name="sort" value="[% CGI.param('sort') | html %]" />
110                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
111                     <input type="submit" value="[% l('Download CSV') %]" />
112                 </div>
113             </form>
114             <div class="bookbag-controls">
115                 [% IF bbag.pub == 't'; %]
116                 <a target='_blank' href='/opac/extras/feed/bookbag/rss2-full/[% bbag.id %]'><img
117                     alt="[% l('RSS Feed') %]" border="0"
118                     src="[% ctx.media_prefix %]/images/small-rss.png"/></a>
119                 [% END %]
120             </div>
121             <div class="bookbag-controls">
122                 [% IF bbag.pub == 't'; %]
123                 <a href='[%-
124                     mkurl(
125                         ctx.opac_root _ '/results',
126                         {page => '0', bookbag => bbag.id, depth => 0, locg => ctx.search_ou},
127                         1
128                     )
129                 -%]'>[% l('HTML View') %]</a>
130                 [% END %]
131             </div>
132             <div class="clear-both pad-bottom-five"></div>
133         </div>
134         [% IF CGI.param("bbid") == bbag.id %]
135         <div class="bookbag-specific">
136             <div class="sort">
137                 <form method="GET">
138                     <label for="opac.result.sort">[% l("Sort list items by: ") %]</label>
139                     [%- INCLUDE "opac/parts/preserve_params.tt2" params=['loc', 'query', 'qtype']; %]
140                     [% INCLUDE "opac/parts/filtersort.tt2"
141                         value=CGI.param('sort') mode='bookbag' %]
142                     <input type="hidden" name="bbid"
143                         value="[% CGI.param('bbid') | html %]" />
144                     <input type="submit" value="[% l('Sort') %]" />
145                 </form>
146             </div>
147             <div class="meta">
148                 <form method="POST">
149                     <input type="hidden" name="bbid" value="[% bbag.id %]" />
150                     <input type="hidden" name="action" value="editmeta" />
151                     <input type="hidden" name="limit" value="[% limit %]" />
152                     <input type="hidden" name="offset" value="[% offset %]" />
153                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
154                     <table id="bbag-name-desc-form">
155                         <tr>
156                             <th>
157                                 <label for="bbag-edit-name">[% l('Name:') %]</label>
158                             </th>
159                             <td>
160                                 <input name="name" type="text"
161                                     value="[% bbag.name | html %]"
162                                     id="bbag-edit-name" />
163                             </td>
164                             <td rowspan="2" class="saver">
165                                 [% l("Save changes to name or description?") %]<br />
166                                 <input type="submit" value="[% l('Save') %]" />
167                             </td>
168                         </tr>
169                         <tr>
170                             <th><label for="bbag-edit-description">[% l('Description:') %]</label></th>
171                             <td>
172                                 <textarea name="description"
173                                     id="bbag-edit-description">[% bbag.description | html %]</textarea>
174                             </td>
175                         </tr>
176                     </table>
177                 </form>
178             </div>
179         </div>
180         <br class="clear-both" />
181         <form action="[% mkurl(ctx.opac_root _ '/myopac/list/update') %]" method="POST">
182         <input type="hidden" name="list" value="[% bbag.id %]" />
183         <input type="hidden" name="sort" value="[% CGI.param('sort') | uri %]" />
184         <table class="bookbag-specific" cellpadding='0' cellspacing='0' border='0'>
185             <thead id="acct_list_header">
186                 <tr>
187                     <td class="list_checkbox">
188                     <input type="checkbox" onclick="
189                         var inputs=document.getElementsByTagName('input'); 
190                         for (i = 0; i < inputs.length; i++) { 
191                             if (inputs[i].name == 'selected_item' && !inputs[i].disabled && inputs[i].getAttribute('bbag') == [% bbag.id %]) 
192                                 inputs[i].checked = this.checked;}"/>
193
194                     </td>
195                     <td class="list_entry">
196                         <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=> (CGI.param('sort') == 'titlesort' ? 'titlesort.descending' : 'titlesort')}) %]">[% l('Title') %]</a>
197                     </td>
198                     <td class="list_entry">
199                         <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=>(CGI.param('sort') == 'authorsort' ? 'authorsort.descending' : 'authorsort')}) %]">[% l('Author(s)') %]</a>
200                     </td>
201                     <td class="list_entry">
202                         [% l('Notes') %]
203                         [% IF CGI.param("edit_notes") != bbag.id %]
204                         | <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {edit_notes=> bbag.id}) %]">[% l('Edit') %]</a>
205                         [% END %]
206                     </td>
207                     <td class="list_actions">
208                         <select name="action">
209                             <option disabled="disabled">[% l('-- Actions for these items --') %]</option>
210                             <option value="place_hold">[% l('Place hold') %]</option>
211                             <option value="del_item">[% l('Remove from list') %]</option>
212                         </select>
213                         [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
214                         <input type="submit" value="[% l('Go') %]" />
215                     </td>
216                 </tr>
217             </thead>
218             <tbody>
219                 [% UNLESS bbag.items.size %]
220                 <tr><td colspan="4" class="list_is_empty">
221                     [% l("This list contains no items.") %]
222                 </td></tr>
223                 [% END %]
224                 [% FOR item IN bbag.items;
225                     rec_id = item.target_biblio_record_entry.id;
226                     attrs = {marc_xml => ctx.bookbags_marc_xml.$rec_id};
227                     PROCESS get_marc_attrs args=attrs %]
228                 <tr class="bookbag-item-row">
229                     <td class="list_checkbox">
230                         <input type="checkbox" name="selected_item" value="[% item.id %]" bbag='[% bbag.id %]'/>
231                     </td>
232                     <td class="list_entry">
233                         <a href="[% mkurl(ctx.opac_root _ '/record/' _ rec_id, {}, ['edit_notes', 'bbid']) %]">[% attrs.title | html %]</a>
234                     </td>
235                     <td class="list_entry">
236                         <a href="[%- 
237                             authorquery = attrs.author | replace('[,\.:;]', '');
238                             mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, ['page', 'bbid', 'edit_notes'])
239                             -%]">[% attrs.author | html %]</a>
240                     [% IF CGI.param("edit_notes") == bbag.id %]
241                     <td class="list_entry">
242                         [% FOR note IN item.notes %]
243                         <input type="text" name="note-[% note.id %]" value="[% note.note | html %]" />
244                         [% END %]
245                         <input type="text" name="item-[% item.id %]" />
246                     </td>
247                     [% ELSE %]
248                     <td class="list_entry">
249                         [% FOR note IN item.notes %]
250                         <div>[% note.note | html %]</div>
251                         [% END %]
252                     </td>
253                     [% END %]
254                 </tr>
255                 [% END %]
256                 [% IF CGI.param("edit_notes") == bbag.id %]
257                 <tr>
258                     <td colspan="3"><!-- All space left of notes column --></td>
259                     <td class="save-notes">
260                         [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
261                         <input type="hidden" name="bbid" value="[% CGI.param('bbid') | html %]" />
262                         <input type="submit" name="save_notes" value="[% l('Save Notes') %]" />
263                     </td>
264                 </tr>
265                 [% END %]
266             </tbody>
267         </table>
268         </form>
269         [% END %]
270         [% END %]
271     </div>
272     [% END %]
273
274     <span id='bb_publish_text' class='hide_me'>
275 [% |l %]Sharing a Bookbag means that the contents 
276 of the Bookbag will be visible to others.  
277 To see the public view of a shared Bookbag, 
278 click on the Bookbag's name in the Bookbag list.[% END %]
279     </span>
280 </div>
281 [% END %]