Merge branch 'bug_9850' into 3.14-master
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tags / review.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Home &rsaquo; Tools &rsaquo; Tags &rsaquo; [% IF ( do_it ) %]Review &rsaquo; [% ELSE %]Review tags[% END %]</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 [% INCLUDE 'calendar.inc' %]
5 <script type="text/javascript" src="[% 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         // [% 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         $(document).ready(function() {
77                 $('.ajax_buttons' ).css({visibility:"visible"});
78                 $("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>");
79             $("#CheckAll").click(function(){
80                 $(".checkboxed").checkCheckboxes();
81                 return false;
82             });
83             $("#CheckNone").click(function(){
84                 $(".checkboxed").unCheckCheckboxes();
85                 return false;
86             });
87             $("#CheckPending").click(function(){
88                 $(".checkboxed").checkCheckboxes(".pending");
89                 return false;
90             });
91                 $('body').click(function(event) {
92                         pull_counts();
93                         // window.alert(_("Click detected on ") + event.target + ": " + $(event.target).html);
94                         if ($(event.target).is('.ok')) {
95                                 $.ajax({
96                     "data": {ok: $(event.target).attr("title")},
97                                         "success": count_approve // success_approve
98                                 });
99                                 $(event.target).next(".rej").removeAttr("disabled").attr("value","Reject").css("color","#000");
100                                 $(event.target).attr(   "value",_("Approved")).attr("disabled","disabled").css("color","#666");
101                                 return false;   // cancel submit
102                         }
103                         if ($(event.target).is('.rej')) {
104                                 $.ajax({
105                     "data": {rej: $(event.target).attr("title")},
106                                         "success": count_reject // success_reject
107                                 });
108                                 $(event.target).prev(".ok").removeAttr("disabled").attr("value","Approve").css("color","#000");
109                                 $(event.target).attr(   "value",_("Rejected")).attr("disabled","disabled").css("color","#666");
110                                 return false;   // cancel submit
111                         }
112                         if ($(event.target).is('#test_button')) {
113                                 $(event.target).attr(   "value",_("Testing...")).attr("disabled","disabled");
114                                 $.ajax({
115                                         "data": {test: $('#test').attr("value")},
116                                         "success": success_test_call // success_reject
117                                 });
118                                 return false;   // cancel submit
119                         }
120                 });
121                 $("*").ajaxError(function(evt, request, settings){
122                         if ((alerted +=1) <= 1){ window.alert(_("AJAX error")+" (" + alerted + " alert)"); }
123                 });
124         });
125 //]]>
126 </script>
127 </head>
128 <body id="tags_review" class="tools">
129 [% INCLUDE 'header.inc' %]
130 [% INCLUDE 'cat-search.inc' %]
131
132 <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>
133
134 <div id="doc3" class="yui-t2">
135  <div id="bd">
136   <div id="yui-main">
137    <div class="yui-b">
138    
139 <div class="yui-ge">
140 <div class="yui-u first">
141 <h1>Tags</h1>
142 <form method="post" action="/cgi-bin/koha/tags/review.pl" class="checkboxed">
143   <h4>Displaying 
144         [% IF ( filter_approved_all ) %]ALL[% END %]
145         [% IF ( filter_approved_ok ) %]Approved[% END %]
146         [% IF ( filter_approved_pending ) %]Pending[% END %]
147         [% IF ( filter_approved_rej ) %]Rejected[% END %]
148         Terms
149   </h4>
150
151   [% IF ( op_count ) %]
152   <div class="dialog message" id="main_status">
153                 [% IF ( op == 'approve' ) %]            Approved
154                 [% ELSIF ( op == 'reject' ) %]  Rejected
155                 [% ELSIF ( op == 'test' ) %]            Tested
156                 [% ELSE %]Unknown Operation ([% op %]) on
157                 [% END %]
158         [% op_count %] Term(s).
159   </div>
160   [% END %]
161   [% IF ( message_loop ) %]
162   <div class="dialog alert" id="main_error">
163         [% FOREACH message_loo IN message_loop %]
164                 [% IF ( message_loo.date_from ) %]ERROR: <em>Date from</em> is not a legal value ("[% message_loo.date_from %]").
165                 [% ELSIF ( message_loo.date_to ) %]ERROR: <em>Date to</em> is not a legal value ("[% message_loo.date_to %]").
166                 [% ELSIF ( message_loo.failed_ok ) %]ERROR: Failed to approve term ([% message_loo.failed_ok %]).
167                 [% ELSIF ( message_loo.failed_rej ) %]ERROR: Failed to reject term ([% message_loo.failed_rej %]).
168                 [% ELSIF ( message_loo.approver ) %]ERROR: No match for user ([% message_loo.approver %]). FILTER REQUIRES BORROWERNUMBER (not name).
169                 [% ELSIF ( message_loo.approved_by ) %]ERROR: No match for borrowernumber ([% message_loo.approved_by %]).
170                 [% ELSIF ( message_loo.op_zero ) %]ERROR: The root koha user in your KOHA_CONF file
171                                 (default: kohaadmin) is not a valid tag moderator.  These actions are logged 
172                                 by borrowernumber, so the moderator must exist in your borrowers table.
173                                 Please login as a different authorized staff user to moderate tags.  
174                 [% ELSE %]                                      Unrecognized error! 
175                 [% END %]
176                 <br />
177         [% END %]
178   </div>
179   [% END %]
180   [% IF ( pagination_bar ) %]
181   <div class="pages" id="pagination_top">
182         [% pagination_bar %]
183   </div>
184   [% END %]
185   [% IF ( tagloop ) %]
186   <p class="check"></p>
187   <table>
188     <tr>
189         <th>&nbsp;</th>
190         <th>&nbsp;</th>
191                 <th>Status</th>
192                 <th>Term</th>
193                 <th>Weight</th>
194                 <th>Actions</th>
195         [% UNLESS ( filter_approved_pending ) %]<th>Reviewer</th>[% END %]
196                 <th>Date</th>
197         </tr>
198         [% FOREACH tagloo IN tagloop %]
199         <tr>
200             <td class="count">[% offset + loop.count %]
201             </td>
202         [% IF ( tagloo.approved == 0 ) %]<td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" class="pending" /></span>
203         [% ELSE %]<td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" /></span>[% END %]
204             </td>
205             [% IF ( tagloo.approved == -1 ) %]<td class="red">rejected
206                 [% ELSIF ( tagloo.approved == 1 ) %]<td class="green"><img alt="OK" src="/intranet-tmpl/prog/img/approve.gif" />
207                 [% ELSE %]<td class="pending">
208                 [% END %]
209             </td>
210             <td><a href="/cgi-bin/koha/tags/list.pl?tag=[% tagloo.term %]">[% tagloo.term %]</a>
211             </td>
212                 <td>[% tagloo.weight_total %]
213             </td>
214                 [% IF ( tagloo.approved ) %]
215             <td><span class="ajax_buttons" style="visibility:hidden">
216             [% IF ( tagloo.approved == -1 ) %]
217                         <input class="ok"  type="submit" title="[% tagloo.term %]" value="Approve" name="approve" />
218                         <input class="rej" disabled="disabled" type="submit" title="[% tagloo.term %]" value="Rejected" name="reject" />
219                         [% ELSE %]
220                         <input class="ok"  disabled="disabled" type="submit" title="[% tagloo.term %]" value="Approved" name="approve" />
221                         <input class="rej" type="submit" title="[% tagloo.term %]" value="Reject" name="reject" />
222                         [% END %]
223                         </span>
224             </td>
225             <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 %]
226             </td>
227                 [% ELSE %]
228                 <td><span class="ajax_buttons" style="visibility:hidden">
229                 <input class="ok"  type="submit" title="[% tagloo.term %]" value="Approve" name="approve" />
230                         <input class="rej" type="submit" title="[% tagloo.term %]" value="Reject" name="reject" />
231                         </span>
232             </td>
233             [% UNLESS ( filter_approved_pending ) %]<td>&nbsp;</td>[% END %]
234                 [% END %]
235             <td>[% tagloo.date_approved %]
236             </td>
237         </tr>
238         [% END %]
239   </table>
240   [% END %]
241     [% IF ( tagloop ) %]<fieldset class="action">
242    <input type="submit" value="Approve" id="approve_button" name="op" />
243    <input type="submit" value="Reject"  id="reject_button"  name="op" />
244   </fieldset>[% END %]
245   </form>
246 </div>
247 <div class="yui-u">
248  <fieldset class="brief">
249   <h4>Terms summary</h4>
250   <ul>
251         <li><a href="/cgi-bin/koha/tags/review.pl?approved=1">Approved</a>:
252                 <span id="terms_summary_approved_count">[% approved_count %]</span>
253         </li>
254         <li><a href="/cgi-bin/koha/tags/review.pl?approved=-1">Rejected</a>:
255                 <span id="terms_summary_rejected_count">[% rejected_count %]</span>
256         </li>
257         <li><a href="/cgi-bin/koha/tags/review.pl?approved=0">Pending</a>:
258                 <span id="terms_summary_unapproved_count">[% unapproved_count %]</span>
259         </li>
260         <li><a href="/cgi-bin/koha/tags/review.pl?approved=all">Total</a>:
261                 <span id="terms_summary_approved_total">[% approved_total %]</span>
262         </li>
263   </ul>
264   <span id="terms_summary_status">&nbsp;</span>
265   </fieldset>
266   <fieldset class="brief">
267    <h4>Check lists</h4>
268    <div class="description">Enter a word or phrase to check against approved/rejected lists: </div>
269    <form method="post" action="/cgi-bin/koha/tags/review.pl">
270    <input type="text" size="14" name="test" id="test" />
271    <fieldset class="action"><input type="submit" value="Test" id="test_button" name="op" /></fieldset>
272    <div id="verdict">
273         [% IF ( test_term ) %]
274         [% IF ( verdict_ok ) %]
275                 &quot;[% test_term %]&quot; is permitted.
276         [% ELSIF ( verdict_rej ) %]
277                 &quot;[% test_term %]&quot; is prohibited.
278         [% ELSIF ( verdict_indeterminate ) %]
279                 &quot;[% test_term %]&quot; is neither permitted nor prohibited.
280         [% END %]
281         [% END %]
282    </div>
283    </form>
284   </fieldset>
285 </div>
286 </div>
287
288
289   </div>
290  </div>
291  <div class="yui-b">
292 <form method="post" action="/cgi-bin/koha/tags/review.pl">
293 <fieldset class="brief">
294   <h4>Filters</h4>
295         <ol>
296             <li><label for="tag">Term</label> <input type="text" name="tag" id="tag" value="[% filter_tag %]" />
297             </li>
298             <li><label for="approved">Status</label> 
299             <select name="approved" id="approved">
300             [% IF ( filter_approved_all ) %]<option selected="selected" value="all">all</option>
301             [% ELSE %]<option value="all">all</option>[% END %]
302             [% IF ( filter_approved_ok ) %]<option selected="selected" value="1">approved</option>
303             [% ELSE %]<option value="1">approved</option>[% END %]
304             [% IF ( filter_approved_pending ) %]<option selected="selected" value="0">pending</option>
305             [% ELSE %]<option value="0">pending</option>[% END %]
306             [% IF ( filter_approved_rej ) %]<option selected="selected" value="-1">rejected</option>
307             [% ELSE %]<option value="-1">rejected</option>[% END %]
308                         </select>
309             </li>
310             <li><label for="approver">Reviewer</label> <input type="text" name="approver" id="approver" value="[% filter_approver %]" />
311             </li>
312             <li>
313                         <label for="from">Date: from </label>
314             <input type="text" size="10" id="from" name="from" value="[% filter_date_approved_from %]" class="datepickerfrom" />
315                         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
316
317                         <label for="to">...to </label>
318             <input type="text" size="10" id="to" name="to" value="[% filter_date_approved_to %]" class="datepickerto" />
319                         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
320             </li>
321   </ol>
322  <fieldset class="action"><input type="submit" value="Apply filter(s)" /></fieldset>
323 </fieldset>
324 </form>
325 </div>
326 </div>
327 [% INCLUDE 'intranet-bottom.inc' %]
328