Bug 10730: (follow-up) restore background color for cells
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tags / review.tt
1 [% USE KohaDates %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Home &rsaquo; Tools &rsaquo; Tags &rsaquo; [% IF ( do_it ) %]Review &rsaquo; [% ELSE %]Review tags[% END %]</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/en/css/datatables.css" />
6 [% INCLUDE 'datatables.inc' %]
7 [% INCLUDE 'calendar.inc' %]
8 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
9 <style type="text/css">
10 .setlabel {width: 6em; font-family: courier; background-color:#E8E8E8;}
11 tr > td.red      {color:darkred;   background-color: pink;}
12 tr > td.green    {color:darkgreen; background-color: #D1EFD5; text-align: center;}
13 tr > td.pending  {background-color: lightyellow;}
14 tr > td input,td input[type="submit"] { font-size: 85%; padding: 1px; }
15 </style>
16 <script type="text/javascript">
17 //<![CDATA[
18         // [% script_name %]
19         $.ajaxSetup({
20           url: "/cgi-bin/koha/tags/review.pl",
21           type: "POST",
22           dataType: "script"
23         });
24         var ok_count  = 0;
25         var nok_count = 0;
26         var rej_count = 0;
27         var alerted = 0;
28         function pull_counts () {
29                 ok_count  = parseInt(document.getElementById("terms_summary_approved_count"  ).innerHTML);
30                 nok_count = parseInt(document.getElementById("terms_summary_unapproved_count").innerHTML);
31                 rej_count = parseInt(document.getElementById("terms_summary_rejected_count"  ).innerHTML);
32         }
33         function count_approve () {
34                 pull_counts();
35                 if (nok_count > 0) {
36                         $("#terms_summary_unapproved_count").html(nok_count -1);
37                         $("#terms_summary_approved_count"  ).html( ok_count +1);
38                 }
39         }
40         function count_reject () {
41                 pull_counts();
42                 if (nok_count > 0) {
43                         $("#terms_summary_unapproved_count").html(nok_count -1);
44                         $("#terms_summary_rejected_count"  ).html(rej_count +1);
45                 }
46         }
47         function warn_once (evt) {
48                 if (alerted <= 1 && ($(evt.target).is('.ok') || $(evt.target).is('.rej'))) {
49                         alerted += 1;
50                         window.alert("this is: " + this + "is '.ok': " + $(evt.target).is('.ok') + "  is '.rej': " + $(evt.target).is('.rej'));
51                 }
52         }
53         var success_approve = function(tag){
54                 // window.alert(_("AJAX approved tag: ") + tag);
55         };
56         var failure_approve = function(tag){
57                 window.alert(_("AJAX failed to approve tag: ") + tag);
58         };
59         var success_reject  = function(tag){
60                 // window.alert(_("AJAX rejected tag: ") + tag);
61         };
62         var failure_reject  = function(tag){
63                 window.alert(_("AJAX failed to reject tag: ") + tag);
64         };
65         var success_test    = function(tag){
66                 $('#verdict').html(tag + _(" is permitted!"));
67         };
68         var failure_test    = function(tag){
69                 $('#verdict').html(tag + _(" is prohibited!"));
70         };
71         var indeterminate_test = function(tag){
72                 $('#verdict').html(tag + _(" is neither permitted nor prohibited!"));
73         };
74
75         var success_test_call = function() {
76                 $('#test_button').removeAttr("disabled");
77                 $('#test_button').attr("value","test");
78         };
79         $(document).ready(function() {
80                 $('.ajax_buttons' ).css({visibility:"visible"});
81                 $("p.check").html("<strong>"+_("Select:")+" <\/strong><a id=\"CheckAll\" href=\"/cgi-bin/koha/tags/review.pl\">"+_("All")+"<\/a> <a id=\"CheckPending\" href=\"/cgi-bin/koha/tags/review.pl\">"+_("Pending")+"<\/a> <a id=\"CheckNone\" href=\"/cgi-bin/koha/tags/review.pl\">"+_("None")+"<\/a>");
82             $("#CheckAll").click(function(){
83                 $(".checkboxed").checkCheckboxes();
84                 return false;
85             });
86             $("#CheckNone").click(function(){
87                 $(".checkboxed").unCheckCheckboxes();
88                 return false;
89             });
90             $("#CheckPending").click(function(){
91                 $(".checkboxed").checkCheckboxes(".pending");
92                 return false;
93             });
94                 $('body').click(function(event) {
95                         pull_counts();
96                         // window.alert(_("Click detected on ") + event.target + ": " + $(event.target).html);
97                         if ($(event.target).is('.ok')) {
98                                 $.ajax({
99                     "data": {ok: $(event.target).attr("title")},
100                                         "success": count_approve // success_approve
101                                 });
102                 $(event.target).next(".rej").removeAttr("disabled").attr("value",_("Reject")).css("color","#000");
103                                 $(event.target).attr(   "value",_("Approved")).attr("disabled","disabled").css("color","#666");
104                                 return false;   // cancel submit
105                         }
106                         if ($(event.target).is('.rej')) {
107                                 $.ajax({
108                     "data": {rej: $(event.target).attr("title")},
109                                         "success": count_reject // success_reject
110                                 });
111                 $(event.target).prev(".ok").removeAttr("disabled").attr("value",_("Approve")).css("color","#000");
112                                 $(event.target).attr(   "value",_("Rejected")).attr("disabled","disabled").css("color","#666");
113                                 return false;   // cancel submit
114                         }
115                         if ($(event.target).is('#test_button')) {
116                                 $(event.target).attr(   "value",_("Testing...")).attr("disabled","disabled");
117                                 $.ajax({
118                                         "data": {test: $('#test').attr("value")},
119                                         "success": success_test_call // success_reject
120                                 });
121                                 return false;   // cancel submit
122                         }
123                 });
124                 $("*").ajaxError(function(evt, request, settings){
125                         if ((alerted +=1) <= 1){ window.alert(_("AJAX error")+" (" + alerted + " alert)"); }
126                 });
127         $("#tagst").dataTable($.extend(true, {}, dataTablesDefaults, {
128             "aoColumnDefs": [
129                 [% IF ( filter_approved_pending ) %]
130                     { "aTargets": [ 0,1,-2 ], "bSortable": false, "bSearchable": false }
131                 [% ELSE %]
132                     { "aTargets": [ 0,1,-3 ], "bSortable": false, "bSearchable": false }
133                 [% END %]
134             ],
135             "aoColumns": [
136                 null,null,null,null,null,null,[% UNLESS ( filter_approved_pending ) %]null,[% END %]{ "sType": "title-string" }
137             ],
138             "aaSorting": [[ 4, "desc" ]],
139             "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
140             "iDisplayLength": 20,
141             "sPaginationType": "four_button"
142         }));
143         });
144 //]]>
145 </script>
146 </head>
147 <body id="tags_review" class="tools">
148 [% INCLUDE 'header.inc' %]
149 [% INCLUDE 'cat-search.inc' %]
150
151 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; Tags</div>
152
153 <div id="doc3" class="yui-t2">
154  <div id="bd">
155   <div id="yui-main">
156    <div class="yui-b">
157    
158 <div class="yui-ge">
159 <div class="yui-u first">
160 <h1>Tags</h1>
161 <form method="post" action="/cgi-bin/koha/tags/review.pl" class="checkboxed">
162   <h4>Displaying 
163         [% IF ( filter_approved_all ) %]ALL[% END %]
164         [% IF ( filter_approved_ok ) %]Approved[% END %]
165         [% IF ( filter_approved_pending ) %]Pending[% END %]
166         [% IF ( filter_approved_rej ) %]Rejected[% END %]
167         Terms
168   </h4>
169
170   [% IF ( op_count ) %]
171   <div class="dialog message" id="main_status">
172                 [% IF ( op == 'approve' ) %]            Approved
173                 [% ELSIF ( op == 'reject' ) %]  Rejected
174                 [% ELSIF ( op == 'test' ) %]            Tested
175                 [% ELSE %]Unknown Operation ([% op %]) on
176                 [% END %]
177         [% op_count %] Term(s).
178   </div>
179   [% END %]
180   [% IF ( message_loop ) %]
181   <div class="dialog alert" id="main_error">
182         [% FOREACH message_loo IN message_loop %]
183                 [% IF ( message_loo.date_from ) %]ERROR: <em>Date from</em> is not a legal value ("[% message_loo.date_from %]").
184                 [% ELSIF ( message_loo.date_to ) %]ERROR: <em>Date to</em> is not a legal value ("[% message_loo.date_to %]").
185                 [% ELSIF ( message_loo.failed_ok ) %]ERROR: Failed to approve term ([% message_loo.failed_ok %]).
186                 [% ELSIF ( message_loo.failed_rej ) %]ERROR: Failed to reject term ([% message_loo.failed_rej %]).
187                 [% ELSIF ( message_loo.approver ) %]ERROR: No match for user ([% message_loo.approver %]). FILTER REQUIRES BORROWERNUMBER (not name).
188                 [% ELSIF ( message_loo.approved_by ) %]ERROR: No match for borrowernumber ([% message_loo.approved_by %]).
189                 [% ELSIF ( message_loo.op_zero ) %]ERROR: The root koha user in your KOHA_CONF file
190                                 (default: kohaadmin) is not a valid tag moderator.  These actions are logged 
191                                 by borrowernumber, so the moderator must exist in your borrowers table.
192                                 Please login as a different authorized staff user to moderate tags.  
193                 [% ELSE %]                                      Unrecognized error! 
194                 [% END %]
195                 <br />
196         [% END %]
197   </div>
198   [% END %]
199   [% IF ( pagination_bar ) %]
200   <div class="pages" id="pagination_top">
201         [% pagination_bar %]
202   </div>
203   [% END %]
204   [% IF ( tagloop ) %]
205   <p class="check"></p>
206   <table id="tagst">
207     <thead>
208         <tr>
209                 <th>&nbsp;</th>
210                 <th>&nbsp;</th>
211                 <th>Status</th>
212                 <th>Term</th>
213                 <th>Weight</th>
214                 <th>Actions</th>
215             [% UNLESS ( filter_approved_pending ) %]<th>Reviewer</th>[% END %]
216                 <th>Date</th>
217         </tr>
218     </thead>
219     <tbody>
220     [% FOREACH tagloo IN tagloop %]
221         <tr>
222             <td class="count">[% offset + loop.count %]
223             </td>
224                 [% IF ( tagloo.approved == 0 ) %]<td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" class="pending" /></span>
225                 [% ELSE %]<td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" /></span>[% END %]
226             </td>
227             [% IF ( tagloo.approved == -1 ) %]<td class="red">rejected
228                 [% ELSIF ( tagloo.approved == 1 ) %]<td class="green"><img alt="OK" src="[% interface %]/[% theme %]/img/approve.gif" />
229             [% ELSE %]<td class="pending">
230             [% END %]
231             </td>
232             <td><a href="/cgi-bin/koha/tags/list.pl?tag=[% tagloo.term|uri %]">[% tagloo.term %]</a>
233             </td>
234             <td>[% tagloo.weight_total %]
235             </td>
236             [% IF ( tagloo.approved ) %]
237             <td><span class="ajax_buttons" style="visibility:hidden">
238                     [% IF ( tagloo.approved == -1 ) %]
239                 <input class="ok"  type="submit" title="[% tagloo.term %]" value="Approve" name="approve" />
240                 <input class="rej" disabled="disabled" type="submit" title="[% tagloo.term %]" value="Rejected" name="reject" />
241                 [% ELSE %]
242                 <input class="ok"  disabled="disabled" type="submit" title="[% tagloo.term %]" value="Approved" name="approve" />
243                 <input class="rej" type="submit" title="[% tagloo.term %]" value="Reject" name="reject" />
244                 [% END %]
245                 </span>
246             </td>
247             <td>[% IF ( tagloo.approved_by_name ) %]<a href="/cgi-bin/koha/tags/review.pl?approved_by=[% tagloo.approved_by %]&amp;approved=all">[% tagloo.approved_by_name %]</a>[% ELSE %]&nbsp;[% END %]
248             </td>
249             [% ELSE %]
250             <td><span class="ajax_buttons" style="visibility:hidden">
251             <input class="ok"  type="submit" title="[% tagloo.term %]" value="Approve" name="approve" />
252                 <input class="rej" type="submit" title="[% tagloo.term %]" value="Reject" name="reject" />
253                 </span>
254             </td>
255             [% UNLESS ( filter_approved_pending ) %]<td>&nbsp;</td>[% END %]
256             [% END %]
257             <td>
258                 <span title="[% tagloo.date_approved %]">[% tagloo.date_approved | $KohaDates %]</span>
259             </td>
260         </tr>
261     [% END %]
262     </tbody>
263   </table>
264   [% END %]
265     [% IF ( tagloop ) %]<fieldset class="action">
266    <input type="submit" value="Approve" id="approve_button" name="op-approve" />
267    <input type="submit" value="Reject"  id="reject_button"  name="op-reject" />
268   </fieldset>[% END %]
269   </form>
270 </div>
271 <div class="yui-u">
272  <fieldset class="brief">
273   <h4>Terms summary</h4>
274   <ul>
275         <li><a href="/cgi-bin/koha/tags/review.pl?approved=1">Approved</a>:
276                 <span id="terms_summary_approved_count">[% approved_count %]</span>
277         </li>
278         <li><a href="/cgi-bin/koha/tags/review.pl?approved=-1">Rejected</a>:
279                 <span id="terms_summary_rejected_count">[% rejected_count %]</span>
280         </li>
281         <li><a href="/cgi-bin/koha/tags/review.pl?approved=0">Pending</a>:
282                 <span id="terms_summary_unapproved_count">[% unapproved_count %]</span>
283         </li>
284         <li><a href="/cgi-bin/koha/tags/review.pl?approved=all">Total</a>:
285                 <span id="terms_summary_approved_total">[% approved_total %]</span>
286         </li>
287   </ul>
288   <span id="terms_summary_status">&nbsp;</span>
289   </fieldset>
290   <fieldset class="brief">
291    <h4>Check lists</h4>
292    <div class="description">Enter a word or phrase to check against approved/rejected lists: </div>
293    <form method="post" action="/cgi-bin/koha/tags/review.pl">
294    <input type="text" size="14" name="test" id="test" />
295    <fieldset class="action"><input type="submit" value="Test" id="test_button" name="op-test" /></fieldset>
296    <div id="verdict">
297         [% IF ( test_term ) %]
298         [% IF ( verdict_ok ) %]
299                 &quot;[% test_term %]&quot; is permitted.
300         [% ELSIF ( verdict_rej ) %]
301                 &quot;[% test_term %]&quot; is prohibited.
302         [% ELSIF ( verdict_indeterminate ) %]
303                 &quot;[% test_term %]&quot; is neither permitted nor prohibited.
304         [% END %]
305         [% END %]
306    </div>
307    </form>
308   </fieldset>
309 </div>
310 </div>
311
312
313   </div>
314  </div>
315  <div class="yui-b">
316 <form method="post" action="/cgi-bin/koha/tags/review.pl">
317 <fieldset class="brief">
318   <h4>Filters</h4>
319         <ol>
320             <li><label for="tag">Term</label> <input type="text" name="tag" id="tag" value="[% filter_tag %]" />
321             </li>
322             <li><label for="approved">Status</label> 
323             <select name="approved" id="approved">
324             [% IF ( filter_approved_all ) %]<option selected="selected" value="all">all</option>
325             [% ELSE %]<option value="all">all</option>[% END %]
326             [% IF ( filter_approved_ok ) %]<option selected="selected" value="1">approved</option>
327             [% ELSE %]<option value="1">approved</option>[% END %]
328             [% IF ( filter_approved_pending ) %]<option selected="selected" value="0">pending</option>
329             [% ELSE %]<option value="0">pending</option>[% END %]
330             [% IF ( filter_approved_rej ) %]<option selected="selected" value="-1">rejected</option>
331             [% ELSE %]<option value="-1">rejected</option>[% END %]
332                         </select>
333             </li>
334             <li><label for="approver">Reviewer</label> <input type="text" name="approver" id="approver" value="[% filter_approver %]" />
335             </li>
336             <li>
337                         <label for="from">Date: from </label>
338             <input type="text" size="10" id="from" name="from" value="[% filter_date_approved_from %]" class="datepickerfrom" />
339                         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
340
341                         <label for="to">...to </label>
342             <input type="text" size="10" id="to" name="to" value="[% filter_date_approved_to %]" class="datepickerto" />
343                         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
344             </li>
345   </ol>
346  <fieldset class="action"><input type="submit" value="Apply filter(s)" /></fieldset>
347 </fieldset>
348 </form>
349 </div>
350 </div>
351 [% INCLUDE 'intranet-bottom.inc' %]
352