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