Revised suggestions management interface, allows setting of one reason for all sugges...
[koha-ffzg.git] / koha-tmpl / intranet-tmpl / prog / en / modules / suggestion / acceptorreject.tmpl
1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2 <title>Koha &rsaquo; Acquisitions &rsaquo; Suggestions Management</title>
3 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
4 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.pack.js"></script>
5 <script type="text/JavaScript">
6  // <![CDATA[
7         $.tablesorter.addParser({
8             id: 'articles', 
9             is: function(s) {return false;  }, 
10             format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); }, 
11             type: 'text' 
12         });
13         /**
14          *  displayOther.
15          *  This function display the select or an textaera to write a reason.
16          */
17         function displayOther(id,show,hide) {$("#"+hide+id).hide(); $("#"+show+id).show(); }
18         $(document).ready(function() {
19             $('#suggestiontabs > ul').tabs({
20                         select: function(ui) {
21                         $("#loadingtab").show();
22                     },
23                 show: function(ui) {
24                         $("#loadingtab").hide();
25                     }
26                 });
27                 $.tablesorter.defaults.widgets = ['zebra'];
28                 $("#acceptedt").tablesorter({
29                         headers: { 0: { sorter: 'articles' },3:{sorter: false},4:{sorter: false},5:{sorter: false},6:{sorter: false},7:{sorter: false}}
30                 });
31                 $("#acceptedt").bind("sortStart",function() {
32                         $("#sorting").show();
33                 }).bind("sortEnd",function() {
34                         $("#sorting").hide();
35                 });
36                 $("#pendingt").tablesorter({
37             headers: { 0: { sorter: 'articles' },3:{sorter: false},4:{sorter: false},5:{sorter: false},6:{sorter: false},7:{sorter: false}}
38                 });
39                 $("#pendingt").bind("sortStart",function() {
40                         $("#sorting").show();
41                 }).bind("sortEnd",function() {
42                         $("#sorting").hide();
43                 });
44                 $("#rejectedt").tablesorter({
45             headers: { 0: { sorter: 'articles' },3:{sorter: false},4:{sorter: false},5:{sorter: false},6:{sorter: false},7:{sorter: false}}
46                 });
47                 $("#rejectedt").bind("sortStart",function() {
48                         $("#sorting").show();
49                 }).bind("sortEnd",function() {
50                         $("#sorting").hide();
51                 });
52                         
53                 $("div[id*=other-reason]").hide();
54                 $("input[name*=other-reason]").focus(function(){ $(this).val(""); });
55                 $("select[name*=reason]").change(function(){
56                         if($(this).children("[@selected]").val() == "other"){
57                         displayOther($(this).attr("name").replace(/reason/,""),"other-reason","select-reason");
58                         }
59                 });
60                 $("a[href*=back]").click(function(){
61                         var sid = $(this).attr("href").replace(/#back/,"");
62                         displayOther(sid,"select-reason","other-reason");
63                         $("#reason"+sid).find("option[value='']").attr("selected","selected");
64                 });
65                 $("a[href=#markall]").click(function(){
66                         if($(this).attr("id").indexOf("markallop") > -1){
67                                 // select each identical option, clear each input
68                                 var selectedOp = $(this).prev().find("option:selected").val();
69                                 var container = $(this).attr("id").replace(/markallop/,"");
70                                 $("#"+container+" div[id*=other-reason]").hide();
71                                 $("#"+container+" div[id*=select-reason]").show();
72                                 $("#"+container+" select[name*=reason]").not("select[name*=all]").children().each(function(){
73                                         if($(this).val() == selectedOp){ $(this).attr("selected","selected"); }
74                                 });
75                         } else {
76                                 // set each input value, deselect options
77                                 var inputText = $(this).prev().val();
78                                 var container = $(this).attr("id").replace(/markalltext/,"");
79                                 // hide all selects
80                                 $("#"+container+" input[name*=other-reason]").not("input[name*=all]").each(function(){
81                                         // show all text inputs and populate
82                                         $(this).val(inputText).parent("div").show();
83                                         $("div[class=select"+container+"]").hide();
84                                 });
85                                 
86                         }
87                 });
88         }); 
89 // ]]>
90 </script>
91 <style type="text/css">
92 .overlay { top: 180px; left: 50%; position: absolute; margin-left: -100px; width: 200px; text-align: center; display: none; margin-top: -10px; background: #eeffd4; padding : .5em; color: #000; }
93 </style>
94 </head>
95 <body>
96 <!-- TMPL_INCLUDE NAME="header.inc" -->
97 <!-- TMPL_INCLUDE NAME="cat-search.inc" -->
98
99 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <!-- TMPL_IF NAME="op_accepted"--> <a href="/cgi-bin/koha/suggestion/acceptorreject.pl">Suggestions Management</a> &rsaquo; Accepted<!-- /TMPL_IF --><!-- TMPL_IF NAME="op_else"--> Suggestions Management<!-- /TMPL_IF --><!-- TMPL_IF NAME="op_rejected"--> <a href="/cgi-bin/koha/suggestion/acceptorreject.pl">Suggestions Management</a> &rsaquo; Rejected<!-- /TMPL_IF --></div>
100
101 <div id="doc" class="yui-t7">
102    
103    <div id="bd">
104         <div id="yui-main">
105         <div class="yui-b">
106
107     <h1>Suggestions</h1>
108   <div id="sorting" class="overlay">Sorting...</div>
109   <div id="loadingtab" class="overlay">Loading tab...</div>
110   <div id="suggestiontabs" class="toptabs">
111         <ul class="ui-tabs-nav">
112       <li><a href="/cgi-bin/koha/suggestion/acceptorreject.pl#accepted">Accepted</a></li>
113       <li class="ui-tabs-selected"><a href="/cgi-bin/koha/suggestion/acceptorreject.pl#pending">Pending</a></li>
114       <li><a href="/cgi-bin/koha/suggestion/acceptorreject.pl#rejected">Rejected</a></li>
115                 </ul>
116         
117  <!--TMPL_LOOP Name="suggestions"-->
118   <div id="<!--TMPL_VAR Name="suggestiontype"-->">
119 <form name="f<!--TMPL_VAR Name="suggestiontype"-->" method="post" action="/cgi-bin/koha/suggestion/acceptorreject.pl#<!--TMPL_VAR Name="suggestiontype"-->">
120  <input type="hidden" name="op" value="aorr_confirm" />
121  <input type="hidden" name="suggestiontype" value="<!--TMPL_VAR Name="suggestiontype"-->" />
122
123     <!-- TMPL_IF NAME="suggestions_loop" -->
124         <!--TMPL_IF EXPR="suggestiontype eq 'accepted'"-->
125     <table id="acceptedt">
126         <!-- TMPL_ELSIF EXPR="suggestiontype eq 'pending'" -->
127         <table id="pendingt">
128         <!-- TMPL_ELSE -->
129         <table id="rejectedt">
130         <!-- /TMPL_IF -->
131         <thead><tr>
132             <th>Suggestion</th>
133             <th>Suggested by</th>
134             <th>Date</th>
135     <!--TMPL_IF EXPR="suggestiontype ne 'pending'"-->
136             <th>Reason</th>
137             <th>Reason Update</th>
138     <!--TMPL_ELSE-->
139             <th>Reason</th>
140     <!--/TMPL_IF -->         
141             <th>Accept</th>
142             <th>Reject</th>
143             <th>Delete</th>
144     </tr></thead>
145         <tbody><!-- TMPL_LOOP NAME="suggestions_loop" -->
146             <!-- TMPL_IF name="even" --><tr class="highlight"><!-- TMPL_ELSE --><tr><!-- /TMPL_IF -->
147                 <td>
148     <!-- TMPL_VAR NAME="title" --><!-- TMPL_IF NAME="author" -->, by <!-- TMPL_VAR NAME="author" --><!-- /TMPL_IF --><br />
149                     <!-- TMPL_IF name="copyrightdate" -->&copy; <!-- TMPL_VAR name="copyrightdate" --> <!-- /TMPL_IF -->
150                         <!-- TMPL_IF name="volumedesc" -->; Volume:<i><!-- TMPL_VAR name="volumedesc" --></i> <!-- /TMPL_IF -->
151                         <!-- TMPL_IF name="isbn" -->; ISBN :<i><!-- TMPL_VAR name="isbn" --></i> <!-- /TMPL_IF --><!-- TMPL_IF name="publishercode" -->; Published by <!-- TMPL_VAR name="publishercode" --> <!-- /TMPL_IF --><!-- TMPL_IF name="publicationyear" --> in <i><!-- TMPL_VAR name="publicationyear" --></i> <!-- /TMPL_IF --><!-- TMPL_IF name="place" --> in <i><!-- TMPL_VAR name="place" --></i> <!-- /TMPL_IF --><br /><!-- TMPL_IF name="note" --><!-- TMPL VAR NAME="note" --><!-- /TMPL_IF -->
152                 </td>
153                 <td>
154                     <!-- TMPL_VAR name="surnamesuggestedby" -->
155                     <!-- TMPL_IF name="firstnamesuggestedby" -->,<!-- /TMPL_IF -->
156                     <!-- TMPL_VAR name="firstnamesuggestedby" -->
157                 </td>
158                 <td>
159                     <!-- TMPL_VAR name="date" -->
160                 </td>
161   
162     <!--TMPL_IF EXPR="suggestiontype ne 'pending'"-->
163                 <td>
164                 <!--TMPL_VAR Name="reason"-->
165       <input type="hidden" name="initial-reason<!-- TMPL_VAR name="suggestionid" -->" value="<!--TMPL_VAR Name="reason" ESCAPE="HTML"-->"  />
166       
167                 </td>
168     <!--/TMPL_IF -->
169                 <td>
170                             <div id="select-reason<!-- TMPL_VAR NAME="suggestionid" -->" class="select<!-- TMPL_VAR NAME="suggestiontype" -->">
171                         <!-- TMPL_IF NAME="reasonsloop" --><select id="reason<!-- TMPL_VAR NAME="suggestionid" -->" name="reason<!-- TMPL_VAR NAME="suggestionid" -->">
172                                         <option value=""> -- Choose a reason -- </option>
173                             <!-- TMPL_LOOP NAME="reasonsloop" -->
174                                 <option value="<!-- TMPL_VAR NAME="lib" -->"><!-- TMPL_VAR NAME="lib" --></option>
175                             <!-- /TMPL_LOOP -->
176                                         <option value="other">Others...</option>
177                         </select><!-- TMPL_ELSE --><span class="problem">No reasons defined in <a href="/cgi-bin/koha/admin/authorised_values.pl">authorised values</a></span><!-- /TMPL_IF -->
178                     </div>
179                     <div id="other-reason<!-- TMPL_VAR NAME="suggestionid" -->">
180                         <input type="text" size="31" name="other-reason<!-- TMPL_VAR name="suggestionid" -->" value="please note your reason here..." />
181                         <p><a href="#back<!-- TMPL_VAR NAME="suggestionid" -->">back to list</a></p>
182                     </div>
183                         
184                 </td>
185                 <td>
186     <!--TMPL_IF EXPR="suggestiontype eq 'accepted'"-->
187                         <input id="a<!--TMPL_VAR name="suggestionid" -->" name="<!--TMPL_VAR name="suggestionid" -->" type="radio" value="ACCEPTED" readonly="readonly" checked="checked"  />
188     
189     <!--TMPL_ELSE-->  
190                         <input id="a<!--TMPL_VAR name="suggestionid" -->" name="<!--TMPL_VAR name="suggestionid" -->" type="radio" value="ACCEPTED" />
191     <!--/TMPL_IF-->            
192             </td>
193             <td>
194     <!--TMPL_IF EXPR="suggestiontype eq 'rejected'"-->
195                         <input id="r<!--TMPL_VAR name="suggestionid" -->" name="<!--TMPL_VAR name="suggestionid" -->" type="radio" value="REJECTED" readonly="readonly" checked="checked" />
196     
197     <!--TMPL_ELSE-->  
198                         <input id="r<!--TMPL_VAR name="suggestionid" -->"  name="<!--TMPL_VAR name="suggestionid" -->" type="radio" value="REJECTED" />
199     <!--/TMPL_IF-->            
200                 
201             </td>
202             <td>
203                         <input id="d<!--TMPL_VAR name="suggestionid" -->" name="<!--TMPL_VAR name="suggestionid" -->" type="radio" value="delete" />
204             </td>
205          </tr>
206         <!-- /TMPL_LOOP --></tbody>
207         </table>  <fieldset>
208   <div id="select-reason<!-- TMPL_VAR NAME="suggestiontype" -->all">
209      <label for="reason<!-- TMPL_VAR NAME="suggestiontype" -->all">Choose a reason for all marked entries:</label>                 <select id="reason<!-- TMPL_VAR NAME="suggestiontype" -->all" name="reason<!-- TMPL_VAR NAME="suggestiontype" -->all">
210                       <option value=""> -- Choose a reason -- </option>
211                         <!--TMPL_LOOP Name="reasonsloop"-->
212                         <option value="<!--TMPL_VAR Name="lib" -->"><!--TMPL_VAR Name="lib" --></option>
213                         <!--/TMPL_LOOP-->
214                       <option value="other">Others...</option>
215                       </select>  <a href="#markall" id="markallop<!-- TMPL_VAR NAME="suggestiontype" -->">Mark all with this reason</a> 
216       </div>
217         
218         <div id="other-reason<!-- TMPL_VAR NAME="suggestiontype" -->all">
219                 <label for="other-reason<!-- TMPL_VAR NAME="suggestiontype" -->all">Enter a reason for all marked entries:</label>
220                         <input type="text" size="31" id="select-other-reason<!-- TMPL_VAR NAME="suggestiontype" -->all" name="other-reason<!-- TMPL_VAR NAME="suggestiontype" -->all" value="please note your reason here..." /> <a href="#markall" id="markalltext<!-- TMPL_VAR NAME="suggestiontype" -->">Mark all with this reason</a> <a href="#back<!-- TMPL_VAR NAME="suggestiontype" -->all">Cancel</a>
221                 </div>
222   </fieldset>
223         <fieldset class="action"><input type="submit" value="Change Status" /></fieldset>
224 </form>
225 <!-- TMPL_ELSE -->
226     <!--TMPL_IF EXPR="suggestiontype eq 'pending'"-->
227     <b>No pending suggestions.</b>
228     <!--/TMPL_IF-->  
229     <!--TMPL_IF EXPR="suggestiontype eq 'accepted'"-->
230     <b>No accepted suggestions.</b>
231     <!--/TMPL_IF-->  
232     <!--TMPL_IF EXPR="suggestiontype eq 'rejected'"-->
233     <b>No rejected suggestions.</b>
234     <!--/TMPL_IF-->  
235 <!-- /TMPL_IF -->
236
237 </div>
238 <!--/TMPL_LOOP-->
239
240 </div>  
241 </div></div>
242
243 </div>
244 </div>
245 </div>
246 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->