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