]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/myopac/lists.tt2
0b2977dc93dac0c5faf7985c52f6cd9252522f56
[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("My 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             [%- IF offset > 0 -%]
69                 <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
70                     limit => limit, offset => (offset - limit)
71                 }) %]'><span class="nav_arrow_fix">&#9668;</span>[% l('Previous') %]</a>
72             [%- END; -%]
73             [%- IF (ctx.bookbag_count - offset) > limit; -%] 
74                 <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
75                     limit => limit, offset => (offset + limit)
76                 }) %]'>[% l('Next') %]<span class="nav_arrow_fix">&#9658;</span></a>
77             </span>
78             [%- END; -%]
79         [% END %]
80     </div>
81     <div class="clear-both"></div>
82
83     <div id='acct_lists_prime'>
84         [% FOR bbag IN ctx.bookbags %]
85         <div class="bookbag-controls-holder">
86             <div class="bookbag-controls most">
87                 [% baseurl = ctx.opac_root _ '/myopac/lists';
88                 IF bbag.id != CGI.param("bbid");
89                     url = mkurl(baseurl,{bbid => bbag.id},['edit_notes','sort']);
90                     ltitle = l("Show items in list");
91                 ELSE;
92                     url = mkurl(baseurl, {}, ['bbid', 'edit_notes', 'sort']);
93                     ltitle = l("Hide items in list");
94                 END %]
95                 <h2 class="bookbag-name"><a title="[% ltitle %]" href="[% url %]">[% bbag.name | html %]</a></h2>
96                 [% IF bbag.description %]<div class="bookbag-description">[% bbag.description | html %]</div>[% END %]
97             </div>
98             [% IF ctx.add_rec %]
99             <form action="[% mkurl(ctx.opac_root _ '/myopac/list/update', {}, 1) %]" method="post">
100                 <div class="bookbag-controls">
101                     <input type="hidden" name="action" value="add_rec" />
102                     <input type="hidden" name="list" value="[% bbag.id %]" />
103                     <input type="hidden" name="add_rec" value="[% ctx.add_rec %]" />
104                     [% IF ctx.where_from %]
105                     <input type="hidden" name="where_from" value="[% ctx.where_from %]" />
106                     [% END %]
107                     <input class="fixed" type="submit" value="[% l('Add to this list') %]" />
108                 </div>
109             </form>
110             [% END %]
111             <form action="[% mkurl(ctx.opac_root _ '/myopac/list/update') %]" method="post">
112                 <div class="bookbag-share">
113                     <input type="hidden" name="list" value="[% bbag.id %]" />
114                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
115                     [% IF bbag.pub != 't' %]
116                     <input type="hidden" name="action" value="show" />
117                     <input class="fixed" type="submit" value="[% l('Share') %]" />
118                     [% ELSE %]
119                     <input type="hidden" name="action" value="hide" />
120                     <input class="fixed" type="submit" value="[% l('Hide') %]" />
121                     [% END %]
122                 </div>
123             </form>
124             <form action="[% mkurl(ctx.opac_root _ '/myopac/list/update') %]" method="post">
125                 <div class="bookbag-controls">
126                     <input type="hidden" name="list" value="[% bbag.id %]" />
127                     <input type="hidden" name="action" value="delete" />
128                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
129                     <input type="submit" value="[% l('Delete List') %]" />
130                 </div>
131             </form>
132             <form action="[% mkurl(ctx.opac_root _ '/myopac/list/print') %]" method="post">
133                 <div class="bookbag-controls">
134                     <input type="hidden" name="list" value="[% bbag.id %]" />
135                     <input type="hidden" name="sort" value="[% CGI.param('sort') | html %]" />
136                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
137                     <input type="submit" value="[% l('Download CSV') %]" />
138                 </div>
139             </form>
140             [% setting = 'opac.default_list'; %]
141             <form action="[% mkurl(ctx.opac_root _ '/myopac/list/update') %]" method="post">
142                 <div class="bookbag-controls">
143                     <input type="hidden" name="list" value="[% bbag.id %]" />
144                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
145                     [% IF ctx.user_setting_map.$setting == bbag.id %]
146                     <input type="hidden" name="action" value="remove_default" />
147                     <input type="submit" value="[% l('Remove Default List') %]" />
148                     [% ELSE %]
149                     <input type="hidden" name="action" value="make_default" />
150                     <input type="submit" value="[% l('Make Default List') %]" />
151                     [% END %]
152                 </div>
153             </form>
154             <div class="bookbag-controls">
155                 [% IF bbag.pub == 't'; %]
156                 <a target='_blank' href='/opac/extras/feed/bookbag/rss2-full/[% bbag.id %]'><img
157                     alt="[% l('RSS Feed') %]" border="0"
158                     src="[% ctx.media_prefix %]/images/small-rss.png"/></a>
159                 [% END %]
160             </div>
161             <div class="bookbag-controls">
162                 [% IF bbag.pub == 't'; %]
163                 <a href='[%-
164                     mkurl(
165                         ctx.opac_root _ '/results',
166                         {page => '0', bookbag => bbag.id, depth => 0, locg => ctx.search_ou},
167                         1
168                     )
169                 -%]'>[% l('HTML View') %]</a>
170                 [% END %]
171             </div>
172             <div class="clear-both pad-bottom-five"></div>
173         </div>
174         [% IF CGI.param("bbid") == bbag.id %]
175         <div class="bookbag-specific">
176             <div class="sort">
177                 <form method="get">
178                     <label for="opac.result.sort">[% l("Sort list items by: ") %]</label>
179                     [%- INCLUDE "opac/parts/preserve_params.tt2" params=['loc', 'query', 'qtype']; %]
180                     [% INCLUDE "opac/parts/filtersort.tt2"
181                         value=CGI.param('sort') mode='bookbag' %]
182                     <input type="hidden" name="bbid"
183                         value="[% CGI.param('bbid') | html %]" />
184                     <input type="submit" value="[% l('Sort') %]" />
185                 </form>
186             </div>
187             <div class="meta">
188                 <form method="post">
189                     <input type="hidden" name="bbid" value="[% bbag.id %]" />
190                     <input type="hidden" name="action" value="editmeta" />
191                     <input type="hidden" name="limit" value="[% limit %]" />
192                     <input type="hidden" name="offset" value="[% offset %]" />
193                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
194                     <table id="bbag-name-desc-form">
195                         <tr>
196                             <th>
197                                 <label for="bbag-edit-name">[% l('Name:') %]</label>
198                             </th>
199                             <td>
200                                 <input name="name" type="text"
201                                     value="[% bbag.name | html %]"
202                                     id="bbag-edit-name" />
203                             </td>
204                             <td rowspan="2" class="saver">
205                                 [% l("Save changes to name or description?") %]<br />
206                                 <input type="submit" value="[% l('Save') %]" />
207                             </td>
208                         </tr>
209                         <tr>
210                             <th><label for="bbag-edit-description">[% l('Description:') %]</label></th>
211                             <td>
212                                 <textarea name="description"
213                                     id="bbag-edit-description">[% bbag.description | html %]</textarea>
214                             </td>
215                         </tr>
216                     </table>
217                 </form>
218             </div>
219         </div>
220         <br class="clear-both" />
221         <form action="[% mkurl(ctx.opac_root _ '/myopac/list/update') %]" method="post">
222         <input type="hidden" name="list" value="[% bbag.id %]" />
223         <input type="hidden" name="sort" value="[% CGI.param('sort') | uri %]" />
224         <table class="bookbag-specific" cellpadding='0' cellspacing='0' border='0'>
225             <thead id="acct_list_header">
226                 <tr>
227                     <td class="list_checkbox">
228                     <input type="checkbox" onclick="
229                         var inputs=document.getElementsByTagName('input'); 
230                         for (i = 0; i < inputs.length; i++) { 
231                             if (inputs[i].name == 'selected_item' && !inputs[i].disabled && inputs[i].getAttribute('bbag') == [% bbag.id %]) 
232                                 inputs[i].checked = this.checked;}"/>
233
234                     </td>
235                     <td class="list_entry">
236                         <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=> (CGI.param('sort') == 'titlesort' ? 'titlesort.descending' : 'titlesort')}) %]">[% l('Title') %]</a>
237                     </td>
238                     <td class="list_entry">
239                         <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=>(CGI.param('sort') == 'authorsort' ? 'authorsort.descending' : 'authorsort')}) %]">[% l('Author(s)') %]</a>
240                     </td>
241                     <td class='list_entry'>
242                         [% l('Local Call Number') %]
243                     </td>
244                     <td class="list_entry">
245                         <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=>(CGI.param('sort') == 'pubdate' ? 'pubdate.descending' : 'pubdate')}) %]">[% l('Publication Date') %]</a>
246                     </td>
247                     <td class="list_entry">
248                          [% l('Format') %]
249                     </td>
250                     <td class="list_entry">
251                         [% l('Notes') %]
252                         [% IF CGI.param("edit_notes") != bbag.id %]
253                         | <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {edit_notes=> bbag.id}) %]">[% l('Edit') %]</a>
254                         [% END %]
255                     </td>
256                     <td class="list_actions">
257                         <select name="action">
258                             <option disabled="disabled">[% l('-- Actions for these items --') %]</option>
259                             <option value="place_hold">[% l('Place hold') %]</option>
260                             <option value="del_item">[% l('Remove from list') %]</option>
261                         </select>
262                         [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
263                         <input type="submit" value="[% l('Go') %]" />
264                     </td>
265                 </tr>
266             </thead>
267             <tbody>
268                 [% UNLESS bbag.items.size %]
269                 <tr><td colspan="6" class="list_is_empty">
270                     [% l("This list contains no items.") %]
271                 </td></tr>
272                 [% END %]
273                 [% FOR item IN bbag.items;
274                     rec_id = item.target_biblio_record_entry.id;
275                     attrs = {marc_xml => ctx.bookbags_marc_xml.$rec_id};
276                     PROCESS get_marc_attrs args=attrs %]
277                 <tr class="bookbag-item-row">
278                     <td class="list_checkbox">
279                         <input type="checkbox" name="selected_item" value="[% item.id %]" bbag='[% bbag.id %]'/>
280                     </td>
281                     <td class="list_entry">
282                         <a href="[% mkurl(ctx.opac_root _ '/record/' _ rec_id, {}, ['edit_notes', 'bbid']) %]">[% attrs.title | html %]</a>
283                     </td>
284                     <td class="list_entry">
285                         <a href="[%- 
286                             authorquery = attrs.author | replace('[,\.:;]', '');
287                             mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, ['page', 'bbid', 'edit_notes'])
288                             -%]">[% attrs.author | html %]</a>
289                     </td>
290                     <td class="list_entry">
291                         [% 
292                             copy = attrs.holdings.0;
293                             IF copy;
294                                 # only show a relevant call number
295                                 copy_org = ctx.get_aou_by_shortname(copy.owner);
296                                 FOR ctx_org IN [ctx.pref_ou, ctx.search_ou, ctx.home_ou, ctx.physical_loc];
297                                     NEXT UNLESS ctx_org;
298                                     ctx_org = ctx.get_aou(ctx_org);
299                                     IF ctx.org_within_scope(ctx_org, copy_org, ctx_org.ou_type.depth);
300                                         l('[_1] ([_2])', copy.label, copy_org.name) | html;
301                                         LAST;
302                                     END;
303                                 END;
304                             END;
305                         %]
306                     </td>
307                     <td class="list_entry">
308                           [% attrs.pubdate | html %]
309                     </td>
310                     <td class="list_entry">
311                           [% attrs.format_label | html %]
312                     </td>
313                     [% IF CGI.param("edit_notes") == bbag.id %]
314                     <td class="list_entry">
315                         [% FOR note IN item.notes %]
316                         <input type="text" name="note-[% note.id %]" value="[% note.note | html %]" />
317                         [% END %]
318                         <input type="text" name="item-[% item.id %]" />
319                     </td>
320                     [% ELSE %]
321                     <td class="list_entry">
322                         [% FOR note IN item.notes %]
323                         <div>[% note.note | html %]</div>
324                         [% END %]
325                     </td>
326                     [% END %]
327                 </tr>
328                 [% END %]
329                 [% IF CGI.param("edit_notes") == bbag.id %]
330                 <tr>
331                     <td colspan="3"><!-- All space left of notes column --></td>
332                     <td class="save-notes">
333                         [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
334                         <input type="hidden" name="bbid" value="[% CGI.param('bbid') | html %]" />
335                         <input type="submit" name="save_notes" value="[% l('Save Notes') %]" />
336                     </td>
337                 </tr>
338                 [% END %]
339             </tbody>
340         </table>
341         </form>
342         [% END %]
343         [% END %]
344     </div>
345     [% END %]
346
347     <span id='bb_publish_text' class='hide_me'>
348 [% |l %]Sharing a Bookbag means that the contents 
349 of the Bookbag will be visible to others.  
350 To see the public view of a shared Bookbag, 
351 click on the Bookbag's name in the Bookbag list.[% END %]
352     </span>
353 </div>
354 [% END %]