]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/myopac/lists.tt2
ba78f76f2b00b694199ec9be905522a12f537fd1
[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             [% IF ctx.is_staff %]
155             <div class="bookbag-controls">
156                 <input 
157                     type="submit" 
158                     onclick='
159                        var path = 
160                           "oils://remote/xul/server/cat/bucketz39_dialog.xul";
161                         window.openDialog(
162                             xulG.url_prefix(path),
163                             "bucketz39_dialog",
164                             "width=800,height=500",
165                             "[% ctx.user.id %]",
166                             "[% ctx.authtoken %]",
167                             "[% ctx.user.ws_ou %]",
168                             "[% bbag.id %]",
169                             xulG
170                         )'
171                     value="[% l('Locate Z39.59 Matches') %]" 
172                 />
173             </div>
174             [% END %]
175             <div class="bookbag-controls">
176                 [% IF bbag.pub == 't'; %]
177                 <a target='_blank' href='/opac/extras/feed/bookbag/rss2-full/[% bbag.id %]'><img
178                     alt="[% l('RSS Feed') %]" border="0"
179                     src="[% ctx.media_prefix %]/images/small-rss.png"/></a>
180                 [% END %]
181             </div>
182             <div class="bookbag-controls">
183                 [% IF bbag.pub == 't'; %]
184                 <a href='[%-
185                     mkurl(
186                         ctx.opac_root _ '/results',
187                         {page => '0', bookbag => bbag.id, depth => 0, locg => ctx.search_ou},
188                         1
189                     )
190                 -%]'>[% l('HTML View') %]</a>
191                 [% END %]
192             </div>
193             <div class="clear-both pad-bottom-five"></div>
194         </div>
195         [% IF CGI.param("bbid") == bbag.id %]
196         <div class="bookbag-specific">
197             <div class="sort">
198                 <form method="get">
199                     <label for="opac.result.sort">[% l("Sort list items by: ") %]</label>
200                     [%- INCLUDE "opac/parts/preserve_params.tt2" params=['loc', 'query', 'qtype']; %]
201                     [% INCLUDE "opac/parts/filtersort.tt2"
202                         value=CGI.param('sort') mode='bookbag' %]
203                     <input type="hidden" name="bbid"
204                         value="[% CGI.param('bbid') | html %]" />
205                     <input type="submit" value="[% l('Sort') %]" />
206                 </form>
207             </div>
208             <div class="meta">
209                 <form method="post">
210                     <input type="hidden" name="bbid" value="[% bbag.id %]" />
211                     <input type="hidden" name="action" value="editmeta" />
212                     <input type="hidden" name="limit" value="[% limit %]" />
213                     <input type="hidden" name="offset" value="[% offset %]" />
214                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
215                     <table id="bbag-name-desc-form">
216                         <tr>
217                             <th>
218                                 <label for="bbag-edit-name">[% l('Name:') %]</label>
219                             </th>
220                             <td>
221                                 <input name="name" type="text"
222                                     value="[% bbag.name | html %]"
223                                     id="bbag-edit-name" />
224                             </td>
225                             <td rowspan="2" class="saver">
226                                 [% l("Save changes to name or description?") %]<br />
227                                 <input type="submit" value="[% l('Save') %]" />
228                             </td>
229                         </tr>
230                         <tr>
231                             <th><label for="bbag-edit-description">[% l('Description:') %]</label></th>
232                             <td>
233                                 <textarea name="description"
234                                     id="bbag-edit-description">[% bbag.description | html %]</textarea>
235                             </td>
236                         </tr>
237                     </table>
238                 </form>
239             </div>
240         </div>
241         <br class="clear-both" />
242         <form action="[% mkurl(ctx.opac_root _ '/myopac/list/update') %]" method="post">
243         <input type="hidden" name="list" value="[% bbag.id %]" />
244         <input type="hidden" name="sort" value="[% CGI.param('sort') | uri %]" />
245         <table class="bookbag-specific" cellpadding='0' cellspacing='0' border='0'>
246             <thead id="acct_list_header">
247                 <tr>
248                     <td class="list_checkbox">
249                     <input type="checkbox" onclick="
250                         var inputs=document.getElementsByTagName('input'); 
251                         for (i = 0; i < inputs.length; i++) { 
252                             if (inputs[i].name == 'selected_item' && !inputs[i].disabled && inputs[i].getAttribute('bbag') == [% bbag.id %]) 
253                                 inputs[i].checked = this.checked;}"/>
254
255                     </td>
256                     <td class="list_entry">
257                         <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=> (CGI.param('sort') == 'titlesort' ? 'titlesort.descending' : 'titlesort')}) %]">[% l('Title') %]</a>
258                     </td>
259                     <td class="list_entry">
260                         <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=>(CGI.param('sort') == 'authorsort' ? 'authorsort.descending' : 'authorsort')}) %]">[% l('Author(s)') %]</a>
261                     </td>
262                     <td class='list_entry'>
263                         [% l('Local Call Number') %]
264                     </td>
265                     <td class="list_entry">
266                         <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=>(CGI.param('sort') == 'pubdate' ? 'pubdate.descending' : 'pubdate')}) %]">[% l('Publication Date') %]</a>
267                     </td>
268                     <td class="list_entry">
269                          [% l('Format') %]
270                     </td>
271                     <td class="list_entry">
272                         [% l('Notes') %]
273                         [% IF CGI.param("edit_notes") != bbag.id %]
274                         | <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {edit_notes=> bbag.id}) %]">[% l('Edit') %]</a>
275                         [% END %]
276                     </td>
277                     <td class="list_actions">
278                         <select name="action">
279                             <option disabled="disabled">[% l('-- Actions for these items --') %]</option>
280                             <option value="place_hold">[% l('Place hold') %]</option>
281                             <option value="del_item">[% l('Remove from list') %]</option>
282                         </select>
283                         [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
284                         <input type="submit" value="[% l('Go') %]" />
285                     </td>
286                 </tr>
287             </thead>
288             <tbody>
289                 [% UNLESS bbag.items.size %]
290                 <tr><td colspan="6" class="list_is_empty">
291                     [% l("This list contains no items.") %]
292                 </td></tr>
293                 [% END %]
294                 [% FOR item IN bbag.items;
295                     rec_id = item.target_biblio_record_entry.id;
296                     attrs = {marc_xml => ctx.bookbags_marc_xml.$rec_id};
297                     PROCESS get_marc_attrs args=attrs %]
298                 <tr class="bookbag-item-row">
299                     <td class="list_checkbox">
300                         <input type="checkbox" name="selected_item" value="[% item.id %]" bbag='[% bbag.id %]'/>
301                     </td>
302                     <td class="list_entry">
303                         <a href="[% mkurl(ctx.opac_root _ '/record/' _ rec_id, {}, ['edit_notes', 'bbid']) %]">[% attrs.title | html %]</a>
304                     </td>
305                     <td class="list_entry">
306                         <a href="[%- 
307                             authorquery = attrs.author | replace('[,\.:;]', '');
308                             mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, ['page', 'bbid', 'edit_notes'])
309                             -%]">[% attrs.author | html %]</a>
310                     </td>
311                     <td class="list_entry">
312                         [% 
313                             copy = attrs.holdings.0;
314                             IF copy;
315                                 # only show a relevant call number
316                                 copy_org = ctx.get_aou_by_shortname(copy.owner);
317                                 FOR ctx_org IN [ctx.pref_ou, ctx.search_ou, ctx.home_ou, ctx.physical_loc];
318                                     NEXT UNLESS ctx_org;
319                                     ctx_org = ctx.get_aou(ctx_org);
320                                     IF ctx.org_within_scope(ctx_org, copy_org, ctx_org.ou_type.depth);
321                                         l('[_1] ([_2])', copy.label, copy_org.name) | html;
322                                         LAST;
323                                     END;
324                                 END;
325                             END;
326                         %]
327                     </td>
328                     <td class="list_entry">
329                           [% attrs.pubdate | html %]
330                     </td>
331                     <td class="list_entry">
332                           [% attrs.format_label | html %]
333                     </td>
334                     [% IF CGI.param("edit_notes") == bbag.id %]
335                     <td class="list_entry">
336                         [% FOR note IN item.notes %]
337                         <input type="text" name="note-[% note.id %]" value="[% note.note | html %]" />
338                         [% END %]
339                         <input type="text" name="item-[% item.id %]" />
340                     </td>
341                     [% ELSE %]
342                     <td class="list_entry">
343                         [% FOR note IN item.notes %]
344                         <div>[% note.note | html %]</div>
345                         [% END %]
346                     </td>
347                     [% END %]
348                 </tr>
349                 [% END %]
350                 [% IF CGI.param("edit_notes") == bbag.id %]
351                 <tr>
352                     <td colspan="3"><!-- All space left of notes column --></td>
353                     <td class="save-notes">
354                         [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
355                         <input type="hidden" name="bbid" value="[% CGI.param('bbid') | html %]" />
356                         <input type="submit" name="save_notes" value="[% l('Save Notes') %]" />
357                     </td>
358                 </tr>
359                 [% END %]
360             </tbody>
361         </table>
362         </form>
363         [% END %]
364         [% END %]
365     </div>
366     [% END %]
367
368     <span id='bb_publish_text' class='hide_me'>
369 [% |l %]Sharing a Bookbag means that the contents 
370 of the Bookbag will be visible to others.  
371 To see the public view of a shared Bookbag, 
372 click on the Bookbag's name in the Bookbag list.[% END %]
373     </span>
374 </div>
375 [% END %]