3be190f6569530d8b2f462ffcf51da38203c9344
[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     item_page = ctx.bookbags_item_page;
8 %]
9 <div id='myopac_bookbag_div' style="padding:5px;">
10
11     <!-- new list creation -->
12     <form action="[% mkurl(ctx.opac_root _ '/myopac/list/update') %]" method="post" id="create_form">
13         <h1>[% l('Create New List') %]</h1><a name="createnewlist"></a>
14         <table cellpadding="0" border="0" id="list_create_table">
15             <tr>
16                 <td>
17                     <label for="list_create_name">[% l('Enter the name of the new list:') %]</label>
18                 </td>
19                 <td>
20                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
21                     <input id="list_create_name" type="text" name="name" />
22                     <input type="hidden" name="action" value="create" />
23                     [% IF ctx.add_rec %]
24                     <input type="hidden" name="add_rec" value="[% ctx.add_rec %]" />
25                     [% END %]
26                     [% IF ctx.where_from %]
27                     <input type="hidden" name="where_from" value="[% ctx.where_from %]" />
28                     [% END %]
29                 </td>
30                 <td>
31                     <label for="list_create_shared">[% l('Share this list?') %]</label>
32                     <select name="shared" id="list_create_shared">
33                         <option value="0">[% l('No') %]
34                         <option value="1">[% l('Yes') %]
35                     </select>
36                     <a href="javascript:void(0);" onclick="alert(document.getElementById('bb_publish_text').innerHTML);"><img alt="[% l('Sharing Help') %]"
37                         src="[% ctx.media_prefix %]/images/question-mark.png" /></a>
38                 </td>
39                 <td class="list-create-table-buttons">
40                     <input type="submit"
41                         value="[% l('Submit') %]"
42                         alt="[% l('Submit') %]"
43                         class="opac-button"/>
44                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
45                     <input type="reset"
46                         value="[% l('Cancel') %]"
47                         alt="[% l('Cancel') %]"
48                         class="opac-button" />
49                 </td>
50             </tr>
51             <tr>
52                 <td class="text-right-top">
53                     <label for="list_description">[% l("List description (optional):") %]</label>
54                 </td>
55                 <td colspan="3">
56                     <textarea cols="40" rows="3" name="description"
57                         id="list_description"></textarea>
58                 </td>
59         </table>
60     </form>
61
62     <h1>[% l("My Existing Lists") %]</h1>
63     [% INCLUDE "opac/parts/anon_list.tt2" %]
64     [% IF ctx.bookbags.size %]
65     <div class="header_middle">
66         <span class="float-left">[% l('Saved Lists') %]</span>
67         [% IF limit < ctx.bookbag_count; %]
68         <span class='float-left' style='padding-left: 10px;'>
69             [%- IF offset > 0 -%]
70                 <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
71                     limit => limit, offset => (offset - limit)
72                 }) %]'><span class="nav_arrow_fix">&#9668;</span>[% l('Previous') %]</a>
73             [%- END; -%]
74             [%- IF (ctx.bookbag_count - offset) > limit; -%] 
75                 <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
76                     limit => limit, offset => (offset + limit)
77                 }) %]'>[% l('Next') %]<span class="nav_arrow_fix">&#9658;</span></a>
78             </span>
79             [%- END; -%]
80         [% END %]
81     </div>
82     <div class="clear-both"></div>
83
84     <div id='acct_lists_prime'>
85         [% FOR bbag IN ctx.bookbags %]
86         <div class="bookbag-controls-holder">
87             <div class="bookbag-controls most">
88                 [% baseurl = ctx.opac_root _ '/myopac/lists';
89                 IF bbag.id != CGI.param("bbid");
90                     url = mkurl(baseurl,{bbid => bbag.id, item_page => 1},['edit_notes','sort']);
91                     ltitle = l("Show items in list");
92                 ELSE;
93                     url = mkurl(baseurl, {}, ['bbid', 'edit_notes', 'sort']);
94                     ltitle = l("Hide items in list");
95                 END %]
96                 <h2 class="bookbag-name"><a title="[% ltitle %]" href="[% url %]">[% bbag.name | html %]</a></h2>
97                 [% IF bbag.description %]<div class="bookbag-description">[% bbag.description | html %]</div>[% END %]
98             </div>
99             [% IF ctx.add_rec %]
100             <form action="[% mkurl(ctx.opac_root _ '/myopac/list/update', {}, 1) %]" method="post">
101                 <div class="bookbag-controls">
102                     <input type="hidden" name="action" value="add_rec" />
103                     <input type="hidden" name="list" value="[% bbag.id %]" />
104                     <input type="hidden" name="add_rec" value="[% ctx.add_rec %]" />
105                     [% IF ctx.where_from %]
106                     <input type="hidden" name="where_from" value="[% ctx.where_from %]" />
107                     [% END %]
108                     <input class="fixed" type="submit" value="[% l('Add to this list') %]" />
109                 </div>
110             </form>
111             [% END %]
112             <form action="[% mkurl(ctx.opac_root _ '/myopac/list/update') %]" method="post">
113                 <div class="bookbag-share">
114                     <input type="hidden" name="list" value="[% bbag.id %]" />
115                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
116                     [% IF bbag.pub != 't' %]
117                     <input type="hidden" name="action" value="show" />
118                     <input class="fixed" type="submit" value="[% l('Share') %]" />
119                     [% ELSE %]
120                     <input type="hidden" name="action" value="hide" />
121                     <input class="fixed" type="submit" value="[% l('Hide') %]" />
122                     [% END %]
123                 </div>
124             </form>
125             <form action="[% mkurl(ctx.opac_root _ '/myopac/list/update') %]" method="post">
126                 <div class="bookbag-controls">
127                     <input type="hidden" name="list" value="[% bbag.id %]" />
128                     <input type="hidden" name="action" value="delete" />
129                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
130                     <input type="submit" value="[% l('Delete List') %]" />
131                 </div>
132             </form>
133             <form action="[% mkurl(ctx.opac_root _ '/myopac/list/print') %]" method="post">
134                 <div class="bookbag-controls">
135                     <input type="hidden" name="list" value="[% bbag.id %]" />
136                     <input type="hidden" name="sort" value="[% CGI.param('sort') | html %]" />
137                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
138                     <input type="submit" value="[% l('Download CSV') %]" />
139                 </div>
140             </form>
141             [% setting = 'opac.default_list'; %]
142             <form action="[% mkurl(ctx.opac_root _ '/myopac/list/update') %]" method="post">
143                 <div class="bookbag-controls">
144                     <input type="hidden" name="list" value="[% bbag.id %]" />
145                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
146                     [% IF ctx.user_setting_map.$setting == bbag.id %]
147                     <input type="hidden" name="action" value="remove_default" />
148                     <input type="submit" value="[% l('Remove Default List') %]" />
149                     [% ELSE %]
150                     <input type="hidden" name="action" value="make_default" />
151                     <input type="submit" value="[% l('Make Default List') %]" />
152                     [% END %]
153                 </div>
154             </form>
155             [% IF ctx.is_staff %]
156             <div class="bookbag-controls">
157                 <input 
158                     type="submit" 
159                     onclick='
160                        var path = 
161                           "oils://remote/xul/server/cat/bucketz39_dialog.xul";
162                         window.openDialog(
163                             xulG.url_prefix(path),
164                             "bucketz39_dialog",
165                             "width=800,height=500",
166                             "[% ctx.user.id %]",
167                             "[% ctx.authtoken %]",
168                             "[% ctx.user.ws_ou %]",
169                             "[% bbag.id %]",
170                             xulG
171                         )'
172                     value="[% l('Locate Z39.50 Matches') %]" 
173                 />
174             </div>
175             [% END %]
176             <div class="bookbag-controls">
177                 [% IF bbag.pub == 't'; %]
178                 <a target='_blank' href='/opac/extras/feed/bookbag/rss2-full/[% bbag.id %]'><img
179                     alt="[% l('RSS Feed') %]" border="0"
180                     src="[% ctx.media_prefix %]/images/small-rss.png"/></a>
181                 [% END %]
182             </div>
183             <div class="bookbag-controls">
184                 [% IF bbag.pub == 't'; %]
185                 <a href='[%-
186                     mkurl(
187                         ctx.opac_root _ '/results',
188                         {page => '0', bookbag => bbag.id, depth => 0, locg => ctx.search_ou},
189                         1
190                     )
191                 -%]'>[% l('HTML View') %]</a>
192                 [% END %]
193             </div>
194             <div class="clear-both pad-bottom-five"></div>
195         </div>
196         [% IF CGI.param("bbid") == bbag.id %]
197         <div class="bookbag-specific">
198             <div class="sort">
199                 <form method="get">
200                     <label for="opac.result.sort">[% l("Sort list items by: ") %]</label>
201                     [%- INCLUDE "opac/parts/preserve_params.tt2" params=['loc', 'query', 'qtype']; %]
202                     [% INCLUDE "opac/parts/filtersort.tt2"
203                         value=CGI.param('sort') mode='bookbag' %]
204                     <input type="hidden" name="bbid"
205                         value="[% CGI.param('bbid') | html %]" />
206                     <input type="submit" value="[% l('Sort') %]" />
207                 </form>
208             </div>
209             <div class="meta">
210                 <form method="post">
211                     <input type="hidden" name="bbid" value="[% bbag.id %]" />
212                     <input type="hidden" name="action" value="editmeta" />
213                     <input type="hidden" name="limit" value="[% limit %]" />
214                     <input type="hidden" name="offset" value="[% offset %]" />
215                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
216                     <table id="bbag-name-desc-form">
217                         <tr>
218                             <th>
219                                 <label for="bbag-edit-name">[% l('Name:') %]</label>
220                             </th>
221                             <td>
222                                 <input name="name" type="text"
223                                     value="[% bbag.name | html %]"
224                                     id="bbag-edit-name" />
225                             </td>
226                             <td rowspan="2" class="saver">
227                                 [% l("Save changes to name or description?") %]<br />
228                                 <input type="submit" value="[% l('Save') %]" />
229                             </td>
230                         </tr>
231                         <tr>
232                             <th><label for="bbag-edit-description">[% l('Description:') %]</label></th>
233                             <td>
234                                 <textarea name="description"
235                                     id="bbag-edit-description">[% bbag.description | html %]</textarea>
236                             </td>
237                         </tr>
238                     </table>
239                 </form>
240             </div>
241         </div>
242         <br class="clear-both" />
243         <form action="[% mkurl(ctx.opac_root _ '/myopac/list/update') %]" method="post">
244         <input type="hidden" name="list" value="[% bbag.id %]" />
245         <input type="hidden" name="sort" value="[% CGI.param('sort') | uri %]" />
246         <table class="bookbag-specific" cellpadding='0' cellspacing='0' border='0'>
247             <thead id="acct_list_header">
248                 <tr>
249                     <td class="list_checkbox">
250                     <input type="checkbox" onclick="
251                         var inputs=document.getElementsByTagName('input'); 
252                         for (i = 0; i < inputs.length; i++) { 
253                             if (inputs[i].name == 'selected_item' && !inputs[i].disabled && inputs[i].getAttribute('bbag') == [% bbag.id %]) 
254                                 inputs[i].checked = this.checked;}"/>
255
256                     </td>
257                     <td class="list_entry">
258                         <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=> (CGI.param('sort') == 'titlesort' ? 'titlesort.descending' : 'titlesort')}) %]">[% l('Title') %]</a>
259                     </td>
260                     <td class="list_entry">
261                         <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=>(CGI.param('sort') == 'authorsort' ? 'authorsort.descending' : 'authorsort')}) %]">[% l('Author(s)') %]</a>
262                     </td>
263                     <td class='list_entry'>
264                         [% l('Local Call Number') %]
265                     </td>
266                     <td class="list_entry">
267                         <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=>(CGI.param('sort') == 'pubdate' ? 'pubdate.descending' : 'pubdate')}) %]">[% l('Publication Date') %]</a>
268                     </td>
269                     <td class="list_entry">
270                          [% l('Format') %]
271                     </td>
272                     <td class="list_entry">
273                         [% l('Notes') %]
274                         [% IF CGI.param("edit_notes") != bbag.id %]
275                         | <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {edit_notes=> bbag.id}) %]">[% l('Edit') %]</a>
276                         [% END %]
277                     </td>
278                     <td class="list_actions">
279                         <select name="action">
280                             <option disabled="disabled">[% l('-- Actions for these items --') %]</option>
281                             <option value="place_hold">[% l('Place hold') %]</option>
282                             <option value="del_item">[% l('Remove from list') %]</option>
283                         </select>
284                         [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
285                         <input type="submit" value="[% l('Go') %]" />
286                     </td>
287                 </tr>
288             </thead>
289             <tbody>
290                 [% UNLESS bbag.items.size %]
291                 <tr><td colspan="6" class="list_is_empty">
292                     [% l("This list contains no items.") %]
293                 </td></tr>
294                 [% END %]
295                 [% FOR item IN bbag.items;
296                     rec_id = item.target_biblio_record_entry.id;
297                     attrs = {marc_xml => ctx.bookbags_marc_xml.$rec_id};
298                     PROCESS get_marc_attrs args=attrs %]
299                 <tr class="bookbag-item-row">
300                     <td class="list_checkbox">
301                         <input type="checkbox" name="selected_item" value="[% item.id %]" bbag='[% bbag.id %]'/>
302                     </td>
303                     <td class="list_entry">
304                         <a href="[% mkurl(ctx.opac_root _ '/record/' _ rec_id, {}, ['edit_notes', 'bbid']) %]">[% attrs.title | html %]</a>
305                     </td>
306                     <td class="list_entry">
307                         <a href="[%- 
308                             authorquery = attrs.author | replace('[,\.:;]', '');
309                             mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, ['page', 'bbid', 'edit_notes'])
310                             -%]">[% attrs.author | html %]</a>
311                     </td>
312                     <td class="list_entry">
313                         [% 
314                             copy = attrs.holdings.0;
315                             IF copy;
316                                 # only show a relevant call number
317                                 copy_org = ctx.get_aou_by_shortname(copy.owner);
318                                 FOR ctx_org IN [ctx.pref_ou, ctx.search_ou, ctx.home_ou, ctx.physical_loc];
319                                     NEXT UNLESS ctx_org;
320                                     ctx_org = ctx.get_aou(ctx_org);
321                                     IF ctx.org_within_scope(ctx_org, copy_org, ctx_org.ou_type.depth);
322                                         l('[_1] ([_2])', copy.label, copy_org.name) | html;
323                                         LAST;
324                                     END;
325                                 END;
326                             END;
327                         %]
328                     </td>
329                     <td class="list_entry">
330                           [% attrs.pubdate | html %]
331                     </td>
332                     <td class="list_entry">
333                           [% attrs.format_label | html %]
334                     </td>
335                     [% IF CGI.param("edit_notes") == bbag.id %]
336                     <td class="list_entry">
337                         [% FOR note IN item.notes %]
338                         <input type="text" name="note-[% note.id %]" value="[% note.note | html %]" />
339                         [% END %]
340                         <input type="text" name="item-[% item.id %]" />
341                     </td>
342                     [% ELSE %]
343                     <td class="list_entry">
344                         [% FOR note IN item.notes %]
345                         <div>[% note.note | html %]</div>
346                         [% END %]
347                     </td>
348                     [% END %]
349                 </tr>
350                 [% END %]
351                 [% IF CGI.param("edit_notes") == bbag.id %]
352                 <tr>
353                     <td colspan="3"><!-- All space left of notes column --></td>
354                     <td class="save-notes">
355                         [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
356                         <input type="hidden" name="bbid" value="[% CGI.param('bbid') | html %]" />
357                         <input type="submit" name="save_notes" value="[% l('Save Notes') %]" />
358                     </td>
359                 </tr>
360                 [% END %]
361             </tbody>
362         </table>
363
364         [% IF ctx.bb_page_count > 1; %]
365             <div class="header_middle" style="padding-top:7px;">
366                 <span class="float-left" style="padding-left:34px;">[% l('Navigate Selected List ') %]</span>
367                 <span class='float-left' style='padding-left: 10px;'>
368                     [%- IF item_page > 1 -%]
369                         <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
370                             item_page => item_page - 1
371                         }) %]'><span class="nav_arrow_fix">&#9668;</span>[% l('Previous') %]</a>
372                     [%- END; -%]
373
374                     [%- IF (item_page - 3) >= 1 -%]
375                         <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
376                             item_page => item_page - 3
377                         }) %]'>[% item_page - 3 %]</a>
378                     [%- END; -%]
379                     [%- IF (item_page - 2) >= 1 -%]
380                         <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
381                             item_page => item_page - 2
382                         }) %]'>[% item_page - 2 %]</a>
383                     [%- END; -%]
384                     [%- IF (item_page - 1) >= 1 -%]
385                         <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
386                             item_page => item_page - 1
387                         }) %]'>[% item_page - 1%]</a>
388                     [%- END; -%]
389                     <span class="bookbag-paginator-selected" >[% item_page %]</span>
390                     [%- IF (item_page + 1) <= ctx.bb_page_count -%]
391                         <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
392                             item_page => item_page + 1
393                         }) %]'>[% item_page + 1 %]</a>
394                     [%- END; -%]
395                     [%- IF (item_page + 2) <= ctx.bb_page_count -%]
396                         <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
397                             item_page => item_page + 2
398                         }) %]'>[% item_page + 2 %]</a>
399                     [%- END; -%]
400                     [%- IF (item_page + 3) <= ctx.bb_page_count -%]
401                         <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
402                             item_page => item_page + 3
403                         }) %]'>[% item_page + 3 %]</a>
404                     [%- END; -%]
405
406                     [%- IF (item_page + 1) <= ctx.bb_page_count; -%]
407                         <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
408                             item_page => item_page + 1
409                         }) %]'>[% l('Next') %]<span class="nav_arrow_fix">&#9658;</span></a>
410                     [%- END; -%]
411                  </span>
412             </div>
413             <div class="clear-both"></div>
414         [% END %]
415         <br/>
416
417         </form>
418         [% END %]
419         [% END %]
420     </div>
421     [% END %]
422
423     <span id='bb_publish_text' class='hide_me'>
424 [% l("Sharing a Bookbag means that the contents " _
425 "of the Bookbag will be visible to others. " _
426 "To see the public view of a shared Bookbag, " _
427 "click on the Bookbag's name in the Bookbag list.") %]
428     </span>
429 </div>
430 [% END %]