kohabug 2507 Fixing labels search to indicate keyword rather than title search
[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.pack.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 <h1>Tags</h1>
150
151 <form method="post" action="/cgi-bin/koha/tags/review.pl">
152 <fieldset>
153   <legend>Filters</legend>
154         <table>
155     <tr>
156                 <th>Term</th>
157                 <th>Status</th>
158                 <th>Reviewer</th>
159                 <th>Date</th>
160         </tr>
161         <tr>
162             <td><input type="text" name="tag" value="<!-- TMPL_VAR NAME="filter_tag" -->" />
163             </td>
164             <td><select name="approved">
165                         <option <!-- TMPL_IF NAME="filter_approved_all"     -->selected="selected" <!-- /TMPL_IF -->value="all">all</option>
166                         <option <!-- TMPL_IF NAME="filter_approved_ok"      -->selected="selected" <!-- /TMPL_IF -->value="1">approved</option>
167                         <option <!-- TMPL_IF NAME="filter_approved_pending" -->selected="selected" <!-- /TMPL_IF -->value="0">pending</option>
168                         <option <!-- TMPL_IF NAME="filter_approved_rej"     -->selected="selected" <!-- /TMPL_IF -->value="-1">rejected</option>
169                         </select>
170             </td>
171             <td><input type="text" name="approver" value="<!-- TMPL_VAR NAME="filter_approver" -->" />
172             </td>
173             <td>
174                         <label for="from" class="setlabel">from </label>
175                         <input type="text" size="10" id="from" name="from" value="<!-- TMPL_VAR NAME="filter_date_approved_from" -->" />
176                         <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" border="0" alt="Show Calendar" style="cursor: pointer;" id="openCalendarFrom" />
177                         <br />
178                         <label for="to" class="setlabel">&nbsp;&nbsp;to </label>
179                         <input type="text" size="10" id="to"   name="to"   value="<!-- TMPL_VAR NAME="filter_date_approved_to" -->" />
180                         <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" border="0" alt="Show Calendar" style="cursor: pointer;" id="openCalendarTo" />
181             </td>
182         </tr>
183   </table>
184  <fieldset class="action"><input type="submit" value="Apply Filter(s)" /></fieldset>
185 </fieldset>
186 </form>
187 <script type="text/javascript">
188 //<![CDATA[
189 // function submit_check (from_id,to_id) {
190 //      var dateFrom = Date_from_syspref(document.getElementById(from_id).value);
191 //      var dateTo   = Date_from_syspref(document.getElementById(  to_id).value);
192 //      var today = new Date();
193 //      if (dateFrom < dateTo) { 
194 //              alert("The starting date cannot be after the ending date.");
195 //              document.getElementById(to_id).select();
196 //              return false;
197 //      }
198 //      if (dateFrom > today) { 
199 //              alert("The starting date cannot be in the future.");
200 //              document.getElementById(from_id).select();
201 //              return false;
202 //      }
203 // }
204
205 // return true if the date is blocked.
206 function disable_from(date) {var limit = get_Calendar_limit(date,'to'  ); return (limit && limit < date);}
207 function disable_to  (date) {var limit = get_Calendar_limit(date,'from'); return (limit && limit > date);}
208
209 Calendar.setup({
210         inputField : "from",
211           ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
212                 button : "openCalendarFrom",
213            disableFunc : disable_from,
214         dateStatusFunc : disable_from
215 });
216 Calendar.setup({
217         inputField : "to",
218           ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
219                 button : "openCalendarTo",
220            disableFunc : disable_to,
221         dateStatusFunc : disable_to
222 });
223 //]]>
224 </script>
225 <form method="post" action="/cgi-bin/koha/tags/review.pl" class="checkboxed">
226   <h4>Displaying 
227         <!-- TMPL_IF NAME="filter_approved_all"     -->ALL<!-- /TMPL_IF -->
228         <!-- TMPL_IF NAME="filter_approved_ok"      -->Approved<!-- /TMPL_IF -->
229         <!-- TMPL_IF NAME="filter_approved_pending" -->Pending<!-- /TMPL_IF -->
230         <!-- TMPL_IF NAME="filter_approved_rej"     -->Rejected<!-- /TMPL_IF -->
231         Terms
232   </h4>
233
234   <!-- TMPL_IF NAME="op_count" -->
235   <div class="message" id="main_status">
236                 <!-- TMPL_IF EXPR="op eq 'approve'" -->         Approved
237                 <!-- TMPL_ELSIF EXPR="op eq 'reject'" -->       Rejected
238                 <!-- TMPL_ELSIF EXPR="op eq 'test'" -->         Tested
239                 <!-- TMPL_ELSE -->                                                      Unkown Operation (<!-- TMPL_VAR NAME="op" -->) on
240                 <!-- /TMPL_IF -->
241         <!-- TMPL_VAR NAME="op_count" --> Term(s).
242   </div>
243   <!-- /TMPL_IF -->
244   <!-- TMPL_IF NAME="message_loop" -->
245   <div class="error" id="main_error">
246         <!-- TMPL_LOOP NAME="message_loop" -->
247                 <!-- TMPL_IF    NAME="date_from"  -->ERROR: Date from is not a legal value (<!-- TMPL_VAR NAME="date_from" -->).
248                 <!-- TMPL_ELSIF NAME="date_to"    -->ERROR: Date to is not a legal value (<!-- TMPL_VAR NAME="date_to" -->).
249                 <!-- TMPL_ELSIF NAME="failed_ok"  -->ERROR: Failed to approve term (<!-- TMPL_VAR NAME="failed_ok" -->).
250                 <!-- TMPL_ELSIF NAME="failed_rej" -->ERROR: Failed to reject term (<!-- TMPL_VAR NAME="failed_rej" -->).
251                 <!-- TMPL_ELSIF NAME="approver"   -->ERROR: No match for user (<!-- TMPL_VAR NAME="approver" -->). FILTER REQUIRES BORROWERNUMBER (not name).
252                 <!-- TMPL_ELSIF NAME="approved_by"-->ERROR: No match for borrowernumber (<!-- TMPL_VAR NAME="approved_by" -->).
253                 <!-- TMPL_ELSIF NAME="op_zero"    -->ERROR: The root koha user in your KOHA_CONF file
254                                 (default: kohaadmin) is not a valid tag moderator.  These actions are logged 
255                                 by borrowernumber, so the moderator must exist in your borrowers table.
256                                 Please login as a different authorized staff user to moderate tags.  
257                 <!-- TMPL_ELSE -->                                      Unrecognized error! 
258                 <!-- /TMPL_IF -->
259                 <br />
260         <!-- /TMPL_LOOP -->
261   </div>
262   <!-- /TMPL_IF -->
263   <!-- TMPL_IF NAME="pagination_bar" -->
264   <div class="pagination" id="pagination_top">
265         <!-- TMPL_VAR NAME="pagination_bar" -->
266   </div>
267   <!-- /TMPL_IF -->
268   <!-- TMPL_IF NAME="tagloop" -->
269   <p class="check"></p>
270   <table>
271     <tr>
272         <th>&nbsp;</th>
273         <th>&nbsp;</th>
274                 <th>Status</th>
275                 <th>Term</th>
276                 <th>Weight</th>
277                 <th>Actions</th>
278                 <th>Reviewer</th>
279                 <th>Date</th>
280         </tr>
281         <!-- TMPL_LOOP NAME="tagloop" -->
282         <tr>
283             <td class="count"><!-- TMPL_VAR EXPR="offset + __counter__" -->
284             </td>
285             <td><span><input type="checkbox" value="<!-- TMPL_VAR NAME="term"-->" name="tags" <!-- TMPL_IF EXPR="approved == 0" --> class="pending"<!-- /TMPL_IF --> /></span>
286             </td>
287             <!-- TMPL_IF EXPR="approved == -1" --><td class="red">rejected
288                 <!-- TMPL_ELSIF EXPR="approved == 1" --><td class="green"><img alt="OK" src="/intranet-tmpl/prog/img/approve.gif" />
289                 <!-- TMPL_ELSE --><td class="pending">
290                 <!-- /TMPL_IF -->
291             </td>
292             <td><!-- TMPL_VAR NAME="term" -->
293             </td>
294                 <td><!-- TMPL_VAR NAME="weight_total" -->
295             </td>
296                 <!-- TMPL_IF NAME="approved" -->
297             <td><span class="ajax_buttons" style="visibility:hidden">
298                         <!-- TMPL_IF EXPR="approved == -1" -->
299                         <input class="ok"  type="submit" title="<!-- TMPL_VAR NAME="term"-->" value="Approve" name="approve" />
300                         <input class="rej" disabled="disabled" type="submit" title="<!-- TMPL_VAR NAME="term"-->" value="Rejected" name="reject" />
301                         <!-- TMPL_ELSE -->
302                         <input class="ok"  disabled="disabled" type="submit" title="<!-- TMPL_VAR NAME="term"-->" value="Approved" name="approve" />
303                         <input class="rej" type="submit" title="<!-- TMPL_VAR NAME="term"-->" value="Reject" name="reject" />
304                         <!-- /TMPL_IF -->
305                         </span>
306             </td>
307             <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 -->
308             </td>
309                 <!-- TMPL_ELSE -->
310                 <td><span class="ajax_buttons" style="visibility:hidden">
311                 <input class="ok"  type="submit" title="<!-- TMPL_VAR NAME="term"-->" value="Approve" name="approve" />
312                         <input class="rej" type="submit" title="<!-- TMPL_VAR NAME="term"-->" value="Reject" name="reject" />
313                         </span>
314             </td>
315                 <td>&nbsp;</td>
316                 <!-- /TMPL_IF -->
317             <td><!-- TMPL_VAR NAME="date_approved"-->
318             </td>
319         </tr>
320         <!-- /TMPL_LOOP -->
321   </table>
322   <!-- /TMPL_IF -->
323     <!-- TMPL_IF NAME="tagloop" --><fieldset class="action">
324    <input type="submit" value="Approve" id="approve_button" name="op" />
325    <input type="submit" value="Reject"  id="reject_button"  name="op" />
326   </fieldset><!-- /TMPL_IF -->
327   </form>
328   </div>
329  </div>
330  <div class="yui-b">
331
332   <fieldset class="brief">
333   <h4>Terms Summary</h4>
334   <ul>
335         <li><a href="/cgi-bin/koha/tags/review.pl?approved=1">Approved</a>:
336                 <span id="terms_summary_approved_count"><!-- TMPL_VAR NAME="approved_count" --></span>
337         </li>
338         <li><a href="/cgi-bin/koha/tags/review.pl?approved=-1">Rejected</a>:
339                 <span id="terms_summary_rejected_count"><!-- TMPL_VAR NAME="rejected_count" --></span>
340         </li>
341         <li><a href="/cgi-bin/koha/tags/review.pl?approved=0">Pending</a>:
342                 <span id="terms_summary_unapproved_count"><!-- TMPL_VAR NAME="unapproved_count" --></span>
343         </li>
344         <li><a href="/cgi-bin/koha/tags/review.pl?approved=all">Total</a>:
345                 <span id="terms_summary_approved_total"><!-- TMPL_VAR NAME="approved_total" --></span>
346         </li>
347   </ul>
348   <span id="terms_summary_status">&nbsp;</span>
349   </fieldset>
350   <fieldset class="brief">
351    <h4>Test Blacklist</h4>
352    <div class="description">Enter a word or phrase here to test against your whitelist/blacklist: </div>
353    <form method="post" action="/cgi-bin/koha/tags/review.pl">
354    <input type="text" size="14" name="test" id="test" />
355    <fieldset class="action"><input type="submit" value="Test" id="test_button" name="op" /></fieldset>
356    <div id="verdict">
357         <!-- TMPL_IF NAME="test_term" -->
358         <!-- TMPL_IF NAME="verdict_ok" -->
359                 &quot;<!-- TMPL_VAR NAME="test_term" -->&quot; is permitted.
360         <!-- TMPL_ELSIF NAME="verdict_rej" -->
361                 &quot;<!-- TMPL_VAR NAME="test_term" -->&quot; is prohibited.
362         <!-- TMPL_ELSIF NAME="verdict_indeterminate" -->
363                 &quot;<!-- TMPL_VAR NAME="test_term" -->&quot; is neither permitted nor prohibited.
364         <!-- /TMPL_IF -->
365         <!-- /TMPL_IF -->
366    </div>
367    </form>
368   </fieldset>
369  </div>
370 </div>
371 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
372