]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/myopac/lists.tt2
TPAC: Create a meaningful bookbag class
[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="[% 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                     <input id="list_create_name" type="text" name="name" />
17                     <input type="hidden" name="action" value="create" />
18                 </td>
19                 <td>
20                     <label for="list_create_shared">[% l('Share this list?') %]</label>
21                     <select name="shared" id="list_create_shared">
22                         <option value="0">[% l('No') %]
23                         <option value="1">[% l('Yes') %]
24                     </select>
25                     <a href="javascript:void(0);" onclick="alert(document.getElementById('bb_publish_text').innerHTML);"><img alt="[% l('Sharing Help') %]"
26                         src="[% ctx.media_prefix %]/images/question-mark.png" /></a>
27                 </td>
28                 <td class="list-create-table-buttons">
29                     <input type="submit"
30                         value="[% l('Submit') %]"
31                         alt="[% l('Submit') %]"
32                         class="opac-button"/>
33                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
34                     <input type="reset"
35                         value="[% l('Cancel') %]"
36                         alt="[% l('Cancel') %]"
37                         class="opac-button" />
38                 </td>
39             </tr>
40             <tr>
41                 <td class="text-right-top">
42                     <label for="list_description">[% l("List description (optional):") %]</label>
43                 </td>
44                 <td colspan="3">
45                     <textarea cols="40" rows="3" name="description"
46                         id="list_description"></textarea>
47                 </td>
48         </table>
49     </form>
50
51     <h1>[% l("Your existing lists") %]</h1>
52     [% INCLUDE "opac/parts/anon_list.tt2" %]
53     [% IF ctx.bookbags.size %]
54     <div id='acct_lists_prime'>
55         [% FOR bbag IN ctx.bookbags %]
56         <div class="bookbag-controls-holder">
57             <div class="bookbag-controls most">
58                 [% baseurl = ctx.opac_root _ '/myopac/lists';
59                 IF bbag.id != CGI.param("id");
60                     url = mkurl(baseurl, {id => bbag.id}, ['edit_notes']);
61                     ltitle = l("Show items in list");
62                 ELSE;
63                     url = mkurl(baseurl, {}, ['id', 'edit_notes']);
64                     ltitle = l("Hide items in list");
65                 END %]
66                 <h2 class="bookbag-name"><a title="[% ltitle %]" href="[% url %]">[% bbag.name | html %]</a></h2>
67                 [% IF bbag.description %]<div class="bookbag-description">[% bbag.description | html %]</div>[% END %]
68             </div>
69             <form action="[% ctx.opac_root %]/myopac/list/update" method="POST">
70                 <div class="bookbag-share">
71                     <input type="hidden" name="list" value="[% bbag.id %]" />
72                     [% IF bbag.pub != 't' %]
73                     <input type="hidden" name="action" value="show" />
74                     <input class="fixed" type="submit" value="[% l('Share') %]" />
75                     [% ELSE %]
76                     <input type="hidden" name="action" value="hide" />
77                     <input class="fixed" type="submit" value="[% l('Hide') %]" />
78                     [% END %]
79                 </div>
80             </form>
81             <form action="[% ctx.opac_root %]/myopac/list/update" method="POST">
82                 <div class="bookbag-controls">
83                     <input type="hidden" name="list" value="[% bbag.id %]" />
84                     <input type="hidden" name="action" value="delete" />
85                     <input type="submit" value="[% l('Delete List') %]" />
86                 </div>
87             </form>
88             <form action="[% ctx.opac_root %]/myopac/list/print" method="POST">
89                 <div class="bookbag-controls">
90                     <input type="hidden" name="list" value="[% bbag.id %]" />
91                     <input type="hidden" name="sort" value="[% CGI.param('sort') | html %]" />
92                     <input type="submit" value="[% l('Download CSV') %]" />
93                 </div>
94             </form>
95             <div class="bookbag-controls">
96                 [% IF bbag.pub == 't'; %]
97                 <a target='_blank' href='/opac/extras/feed/bookbag/rss2-full/[% bbag.id %]'><img
98                     alt="[% l('RSS Feed') %]" border="0"
99                     src="[% ctx.media_prefix %]/images/small-rss.png"/></a>
100                 [% END %]
101             </div>
102             <div class="bookbag-controls">
103                 [% IF bbag.pub == 't'; %]
104                 <a href='[%-
105                     mkurl( ctx.opac_root _ '/results', {page => '0', query => 'container(bre,bookbag,' _ bbag.id _ ')'} )
106                 -%]'>[% l('HTML View') %]</a>
107                 [% END %]
108             </div>
109             <div class="clear-both pad-bottom-five"></div>
110         </div>
111         [% IF CGI.param("id") == bbag.id %]
112         <div class="bookbag-specific">
113             <form method="GET">
114                 <label for="opac.result.sort">[% l("Sort list items by: ") %]</label>
115                 [% INCLUDE "opac/parts/filtersort.tt2"
116                     value=CGI.param('sort') mode='bookbag' %]
117                 <input type="hidden" name="id"
118                     value="[% CGI.param('id') | html %]" />
119                 <input type="submit" value="[% l('Sort') %]" />
120             </form>
121         </div>
122         <form action="[% ctx.opac_root %]/myopac/list/update" method="POST">
123         <input type="hidden" name="list" value="[% bbag.id %]" />
124         <input type="hidden" name="sort" value="[% CGI.param('sort') | uri %]" />
125         <table class="bookbag-specific" cellpadding='0' cellspacing='0' border='0'>
126             <thead id="acct_list_header">
127                 <tr>
128                     <td class="list_checkbox">
129                     <input type="checkbox" onclick="
130                         var inputs=document.getElementsByTagName('input'); 
131                         for (i = 0; i < inputs.length; i++) { 
132                             if (inputs[i].name == 'selected_item' && !inputs[i].disabled && inputs[i].getAttribute('bbag') == [% bbag.id %]) 
133                                 inputs[i].checked = this.checked;}"/>
134
135                     </td>
136                     <td class="list_entry">
137                         <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=> (CGI.param('sort') == 'titlesort' ? 'titlesort.descending' : 'titlesort')}) %]">[% l('Title') %]</a>
138                     </td>
139                     <td class="list_entry">
140                         <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=>(CGI.param('sort') == 'authorsort' ? 'authorsort.descending' : 'authorsort')}) %]">[% l('Author(s)') %]</a>
141                     </td>
142                     <td class="list_entry">
143                         [% l('Notes') %]
144                         [% IF CGI.param("edit_notes") != bbag.id %]
145                         | <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {edit_notes=> bbag.id}) %]">[% l('Edit') %]</a>
146                         [% END %]
147                     </td>
148                     <td class="list_actions">
149                         <select name="action">
150                             <option disabled="disabled">[% l('-- Actions for these items --') %]</option>
151                             <option value="place_hold">[% l('Place hold') %]</option>
152                             <option value="del_item">[% l('Remove from list') %]</option>
153                         </select>
154                         <input type="submit" value="[% l('Go') %]" />
155                     </td>
156                 </tr>
157             </thead>
158             <tbody>
159                 [% UNLESS bbag.items.size %]
160                 <tr><td colspan="4" class="list_is_empty">
161                     [% l("This list contains no items.") %]
162                 </td></tr>
163                 [% END %]
164                 [% FOR item IN bbag.items;
165                     rec_id = item.target_biblio_record_entry.id;
166                     attrs = {marc_xml => ctx.bookbags_marc_xml.$rec_id};
167                     PROCESS get_marc_attrs args=attrs %]
168                 <tr class="bookbag-item-row">
169                     <td class="list_checkbox">
170                         <input type="checkbox" name="selected_item" value="[% item.id %]" bbag='[% bbag.id %]'/>
171                     </td>
172                     <td class="list_entry">
173                         <a href="[% mkurl(ctx.opac_root _ '/record/' _ rec_id, {}, ['edit_notes', 'id']) %]">[% attrs.title | html %]</a>
174                     </td>
175                     <td class="list_entry">
176                         <a href="[%- 
177                             authorquery = attrs.author | replace('[,\.:;]', '');
178                             mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, ['page', 'id', 'edit_notes'])
179                             -%]">[% attrs.author | html %]</a>
180                     [% IF CGI.param("edit_notes") == bbag.id %]
181                     <td class="list_entry">
182                         [% FOR note IN item.notes %]
183                         <input type="text" name="note-[% note.id %]" value="[% note.note | html %]" />
184                         [% END %]
185                         <input type="text" name="item-[% item.id %]" />
186                     </td>
187                     [% ELSE %]
188                     <td class="list_entry">
189                         [% FOR note IN item.notes %]
190                         <div>[% note.note | html %]</div>
191                         [% END %]
192                     </td>
193                     [% END %]
194                 </tr>
195                 [% END %]
196                 [% IF CGI.param("edit_notes") == bbag.id %]
197                 <tr>
198                     <td colspan="3"><!-- All space left of notes column --></td>
199                     <td class="save-notes">
200                         <input type="hidden" name="id" value="[% CGI.param('id') | html %]" />
201                         <input type="submit" name="save_notes" value="[% l('Save Notes') %]" />
202                     </td>
203                 </tr>
204                 [% END %]
205             </tbody>
206         </table>
207         </form>
208         [% END %]
209         [% END %]
210     </div>
211     [% END %]
212
213     <span id='bb_publish_text' class='hide_me'>
214 [% |l %]Sharing a Bookbag means that the contents 
215 of the Bookbag will be visible to others.  
216 To see the public view of a shared Bookbag, 
217 click on the Bookbag's name in the Bookbag list.[% END %]
218     </span>
219 </div>
220 [% END %]