Bug 7959 - Update OPAC suggestions interface to match lists
[koha.git] / koha-tmpl / opac-tmpl / prog / en / modules / opac-suggestions.tt
1 [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog ›
2 [% IF ( op_add ) %]Enter a new purchase suggestion[% END %]
3 [% IF ( op_else ) %]Purchase Suggestions[% END %]
4 [% INCLUDE 'doc-head-close.inc' %]
5 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
6 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
7 <script type="text/JavaScript" language="JavaScript">
8 //<![CDATA[
9 $.tablesorter.addParser({
10     id: 'articles', 
11     is: function(s) {return false;  }, 
12     format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); }, 
13     type: 'text' 
14 });
15 [% IF ( loggedinusername ) %]function enableCheckboxActions(){
16     // Enable/disable controls if checkboxes are checked
17     var checkedBoxes = $(".checkboxed input:checkbox:checked");
18     if ($(checkedBoxes).size()) {
19       $("#selections").html(_("With selected suggestions: "));
20       $("#selections-toolbar .links a").removeClass("disabled");
21     } else {
22       $("#selections").html(_("Select suggestions to: "));
23       $("#selections-toolbar .links a").addClass("disabled");
24     }
25 }[% END %]
26
27        $(function() {
28                         $("#suggestt").tablesorter({
29                                 widgets : ['zebra'],
30                                 [% IF ( loggedinusername ) %]sortList: [[1,0]],[% ELSE %]sortList: [[0,0]],[% END %]
31                         headers: {
32                                 [% IF ( loggedinusername ) %]
33                                         [% IF ( OPACViewOthersSuggestions ) %]
34                                         0: { sorter: false },2: { sorter: 'articles' },2: {sorter: false },4: {sorter: false},5:{sorter:false}
35                                         [% ELSE %]
36                                         0: { sorter: false },2: { sorter: 'articles' },2: {sorter: false },3: {sorter: false},4:{sorter:false}
37                                         [% END %]
38                                 [% ELSE %]
39                                 [% IF ( OPACViewOthersSuggestions ) %]
40                                         0: { sorter: 'articles' },1: {sorter: false },3: {sorter: false},4:{sorter:false}
41                                         [% ELSE %]
42                                         0: { sorter: 'articles' },1: {sorter: false },2: {sorter: false},3:{sorter:false}
43                                         [% END %]
44                                 [% END %]
45                                 }
46             });
47             [% IF ( loggedinusername ) %]$("span.clearall").html("<a id=\"CheckNone\" href=\"#\">"+_('Clear all')+"<\/a>");
48             $("span.checkall").html("<a id=\"CheckAll\" href=\"#\">"+_('Select all')+"<\/a>");
49             $("#CheckAll").click(function(){
50                 $(".checkboxed").checkCheckboxes();
51                 enableCheckboxActions();
52                 return false;
53             });
54             $("#CheckNone").click(function(){
55                 $(".checkboxed").unCheckCheckboxes();
56                 enableCheckboxActions();
57                 return false;
58             });
59             $(".cb").click(function(){
60               enableCheckboxActions();
61             });
62             $("#removeitems").html("<a href=\"#\" class=\"removeitems tag_hides disabled\">"+_("Delete")+"</a>")
63             .click(function(){
64               $("#myform").submit();
65               return false;
66             });[% END %]
67        });
68
69       function Check(f) {
70                 var _alertString="";
71                 var alertString2;
72
73             if(f.title.value.length ==0){
74                         _alertString += _("- You must enter a Title") + "\n";
75                 }
76
77                 if (_alertString.length==0) {
78                         f.submit();
79                 } else {
80                         alertString2 = _("Form not submitted because of the following problem(s)");
81                         alertString2 += "\n------------------------------------------------------------------------------------\n\n";
82                         alertString2 += _alertString;
83                         alert(alertString2);
84                 }
85         }
86 //]]>
87 </script>
88 </head>
89 [% IF ( loggedinusername ) %]<body id="opac-usersuggestions">[% ELSE %]<body id="opac-suggestions">[% END %]
90
91 <div id="doc3" class="yui-t1">
92    <div id="bd">
93 [% INCLUDE 'masthead.inc' %]
94         <div id="yui-main">
95         <div class="yui-b"><div class="yui-g">
96 <div id="usersuggestions" class="container">
97 [% IF ( op_add ) %]
98     <h1>Enter a new purchase suggestion</h1>
99
100     <p>Please fill out this form to make a purchase suggestion. You will receive an email when the library processes your suggestion</p>
101     <p>Only the title is required, but the more information you enter the easier it will be for the librarians to find title you're requesting. The "Notes" field can be used to provide any additional information.</p>
102     <form action="/cgi-bin/koha/opac-suggestions.pl" method="post">
103    <fieldset class="rows"> <ol>
104     <li><label class="required" for="title">Title:</label><input type="text" id="title" name="title" size="50" maxlength="80" /></li>
105     <li><label for="author">Author:</label><input type="text" id="author" name="author" size="50" maxlength="80" /></li>
106     <li><label for="copyrightdate">Copyright Date:</label><input type="text" id="copyrightdate" name="copyrightdate" size="4" maxlength="4" /></li>
107     <li><label for="isbn">Standard Number (ISBN, ISSN or Other):</label><input type="text" id="isbn" name="isbn" size="50" maxlength="80" /></li>
108     <li><label for="publishercode">Publisher:</label><input type="text" id="publishercode" name="publishercode" size="50" maxlength="80" /></li>
109     <li><label for="collectiontitle">Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" size="50" maxlength="80" /></li>
110     <li><label for="place">Publication place:</label><input type="text" id="place" name="place" size="50" maxlength="80" /></li>
111     <li><label for="itemtype">Item type:</label><select name="itemtype" id="itemtype">
112             <option value="">Default</option>
113         [% FOREACH itemtypeloo IN itemtypeloop %]
114                         [% IF ( itemtypeloo.selected ) %]<option value="[% itemtypeloo.itemtype %]" selected="selected"> [% ELSE %]<option value="[% itemtypeloo.itemtype %]"> [% END %] [% itemtypeloo.description %]</option>
115         [% END %]
116         </select> </li>
117     [% IF ( branch_loop ) %]
118     <li><label for="branch">Library:</label>
119         <select name="branch" id="branch">
120         [% FOREACH branch_loo IN branch_loop %]
121             [% IF ( branch_loo.selected ) %]
122             <option value="[% branch_loo.value %]" selected="selected">[% branch_loo.branchname %]</option>
123             [% ELSE %]
124             <option value="[% branch_loo.value %]">[% branch_loo.branchname %]</option>
125             [% END %]
126         [% END %]
127         </select>
128     </li>
129     [% END %]
130     [% IF ( patron_reason_loop ) %]<li><label for="patronreason">Reason for suggestion: </label><select name="patronreason" id="patronreason"><option value="">-- Choose --</option>[% FOREACH patron_reason_loo IN patron_reason_loop %]
131            <option value="[% patron_reason_loo.authorised_value %]">[% patron_reason_loo.lib %]</option>
132     [% END %]</select></li>[% END %]
133     <li><label for="note">Notes:</label><textarea name="note" id="note" rows="5" cols="40"></textarea></li>
134     </ol></fieldset>
135         <fieldset class="action"><input type="hidden" name="suggestedby" value="[% suggestedbyme %]" /><input type="hidden" name="op" value="add_confirm" /><input type="submit" onclick="Check(this.form); return false;" value="Submit Your Suggestion" /> <a class="action" href="/cgi-bin/koha/opac-suggestions.pl">Cancel</a></fieldset>
136     </form>
137
138 [% END %]
139
140 [% IF ( op_else ) %]
141     <h1>[% IF ( OPACViewOthersSuggestions ) %]Purchase suggestions[% ELSE %][% IF ( loggedinusername ) %]My purchase suggestions[% ELSE %]Purchase suggestions[% END %][% END %]</h1>
142
143     [% IF ( deleted ) %]<div class="dialog message">The selected suggestions have been deleted.</div>[% END %]
144     [% IF ( submitted ) %]<div class="dialog message">Your suggestion has been submitted.</div>[% END %]
145
146     [% IF ( suggestions_loop ) %]
147     [% IF ( OPACViewOthersSuggestions ) %]
148         <form action="/cgi-bin/koha/opac-suggestions.pl" method="get">
149     <table>
150         <tr>
151                 <th>
152                     Search for:
153                 </th>
154                 <td>
155                     <input type="text" name="title" value="[% title %]" />
156                 </td>
157                 <th>
158                 Suggested by:
159                 </th>
160                 <td>
161                     <select name="suggestedby">
162                         <option value="0">Anyone</option>
163                         <option value="1">Me</option>
164                     </select>
165                 </td>
166                 <th>
167                     <input type="submit" value="Search" />
168                 </th>
169         </tr>
170                 </table>
171             </form>[% END %]
172         <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="myform">
173             <input type="hidden" name="op" value="delete_confirm" />
174             <div id="toolbar" class="list-actions">[% IF ( loggedinusername ) %]<a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a>[% ELSE %][% IF ( AnonSuggestions ) %]<a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a>[% END %][% END %]
175 </div>
176           [% IF ( loggedinusername ) %]<div id="selections-toolbar" class="list-actions">
177                   <span class="checkall"></span> <span class="clearall"></span> <span class="sep">|</span>
178                   <span class="links"><span id="selections">Select suggestions to: </span>
179                   <span id="removeitems"></span>
180           </div>[% END %]
181                         <table id="suggestt" class="checkboxed">
182                         <thead><tr>
183             [% IF ( loggedinusername ) %]<th>&nbsp;</th>[% END %]
184             <th>Summary</th>
185             <th>Note</th>
186             [% IF ( OPACViewOthersSuggestions ) %]<th>Suggested for</th>[% END %]
187             <th>Managed by</th>
188             <th>Status</th>
189         </tr></thead>
190         <tbody>[% FOREACH suggestions_loo IN suggestions_loop %]
191             [% IF ( suggestions_loo.even ) %]<tr>[% ELSE %]<tr class="highlight">[% END %]
192 [% IF ( loggedinusername ) %]<td>
193     [% IF ( suggestions_loo.showcheckbox ) %]
194                     <input type="checkbox" class="cb" name="delete_field" value="[% suggestions_loo.suggestionid %]" />
195     [% END %]
196                 </td>[% END %]
197                 <td>
198                     <p><strong>[% suggestions_loo.title |html %]</strong></p>
199                     <p>[% IF ( suggestions_loo.author ) %][% suggestions_loo.author %],[% END %]
200                         [% IF ( suggestions_loo.copyrightdate ) %] - [% suggestions_loo.copyrightdate %],[% END %] 
201                         [% IF ( suggestions_loo.publishercode ) %] - [% suggestions_loo.publishercode %][% END %]
202                         [% IF ( suggestions_loo.place ) %]([% suggestions_loo.place %])[% END %]
203                         [% IF ( suggestions_loo.collectiontitle ) %] , [% suggestions_loo.collectiontitle %][% END %]
204                         [% IF ( suggestions_loo.itemtype ) %] - [% suggestions_loo.itemtype %][% END %]
205                     </p>
206                 </td>
207                 <td>
208                     [% suggestions_loo.note %]
209                 </td>
210                 [% IF ( OPACViewOthersSuggestions ) %]<td>
211                     [% IF ( suggestions_loo.branchcodesuggestedby ) %][% suggestions_loo.branchcodesuggestedby %][% ELSE %]&nbsp;[% END %]
212                 </td>[% END %]
213                 <td>
214                                         [% IF ( suggestions_loo.surnamemanagedby ) %][% suggestions_loo.surnamemanagedby %][% IF ( suggestions_loo.firstnamemanagedby ) %],[% END %] [% suggestions_loo.firstnamemanagedby %][% ELSE %]&nbsp;[% END %]
215                 </td>
216                 <td>
217                     [% IF ( suggestions_loo.ASKED ) %]Requested[% END %]
218                     [% IF ( suggestions_loo.CHECKED ) %]Checked by the library[% END %]
219                     [% IF ( suggestions_loo.ACCEPTED ) %]Accepted by the library[% END %]
220                     [% IF ( suggestions_loo.ORDERED ) %]Ordered by the library[% END %]
221                     [% IF ( suggestions_loo.REJECTED ) %]Suggestion declined [% END %]
222                     [% IF ( suggestions_loo.AVAILABLE ) %]Available in the library[% END %]
223                     [% IF ( suggestions_loo.reason ) %]([% suggestions_loo.reason %])[% END %]
224                 </td>
225             </tr>
226         [% END %]
227        </tbody>
228     </table> [% IF ( loggedinusername ) %]<fieldset class="action">
229                 <input type="submit" value="Delete selected" />
230             </fieldset>
231         [% END %]
232         </form>
233     [% ELSE %]<p>There are no pending purchase suggestions.</p> [% IF ( loggedinusername ) %]<p><a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a></p>[% ELSE %][% IF ( AnonSuggestions ) %]<p><a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a></p>[% END %][% END %][% END %]
234         
235 [% END %]
236 </div>
237 </div>
238 </div>
239 </div>
240 <div class="yui-b">
241 <div id="leftmenus" class="container">
242 [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
243 </div>
244 </div>
245 </div>
246 [% INCLUDE 'opac-bottom.inc' %]