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