Bug 7720: add options for controlling display of an item's home and/or holdings location
[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="[% interface %]/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: %s").format(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: %s").format(tag));
64         };
65         var success_test    = function(tag){
66                 $('#verdict').html(_("%s is permitted!").format(tag));
67         };
68         var failure_test    = function(tag){
69                 $('#verdict').html(_("%s is prohibited!").format(tag));
70         };
71         var indeterminate_test = function(tag){
72                 $('#verdict').html(_("%s is neither permitted nor prohibited!").format(tag));
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 (%s alert)").format(alerted)); }
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             "sPaginationType": "four_button"
140         }));
141         var reviewerField = $("#approver");
142         reviewerField.autocomplete({
143             source: "/cgi-bin/koha/circ/ysearch.pl",
144             minLength: 3,
145             select: function( event, ui ) {
146                 reviewerField.val( ui.item.borrowernumber );
147                 return false;
148             }
149         })
150         .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
151             return $( "<li></li>" )
152             .data( "ui-autocomplete-item", item )
153             .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
154             .appendTo( ul );
155         };
156         });
157 //]]>
158 </script>
159 </head>
160 <body id="tags_review" class="tools">
161 [% INCLUDE 'header.inc' %]
162 [% INCLUDE 'cat-search.inc' %]
163
164 <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>
165
166 <div id="doc3" class="yui-t2">
167  <div id="bd">
168   <div id="yui-main">
169    <div class="yui-b">
170    
171 <div class="yui-ge">
172 <div class="yui-u first">
173 <h1>Tags</h1>
174 <form method="post" action="/cgi-bin/koha/tags/review.pl" class="checkboxed">
175   <h4>Displaying 
176         [% IF ( filter_approved_all ) %]ALL[% END %]
177         [% IF ( filter_approved_ok ) %]Approved[% END %]
178         [% IF ( filter_approved_pending ) %]Pending[% END %]
179         [% IF ( filter_approved_rej ) %]Rejected[% END %]
180         Terms
181   </h4>
182
183   [% IF ( op_count ) %]
184   <div class="dialog message" id="main_status">
185                 [% IF ( op == 'approve' ) %]            Approved
186                 [% ELSIF ( op == 'reject' ) %]  Rejected
187                 [% ELSIF ( op == 'test' ) %]            Tested
188                 [% ELSE %]Unknown Operation ([% op %]) on
189                 [% END %]
190         [% op_count %] Term(s).
191   </div>
192   [% END %]
193   [% IF ( message_loop ) %]
194   <div class="dialog alert" id="main_error">
195         [% FOREACH message_loo IN message_loop %]
196                 [% IF ( message_loo.date_from ) %]ERROR: <em>Date from</em> is not a legal value ("[% message_loo.date_from %]").
197                 [% ELSIF ( message_loo.date_to ) %]ERROR: <em>Date to</em> is not a legal value ("[% message_loo.date_to %]").
198                 [% ELSIF ( message_loo.failed_ok ) %]ERROR: Failed to approve term ([% message_loo.failed_ok %]).
199                 [% ELSIF ( message_loo.failed_rej ) %]ERROR: Failed to reject term ([% message_loo.failed_rej %]).
200                 [% ELSIF ( message_loo.approver ) %]ERROR: No match for user ([% message_loo.approver %]). FILTER REQUIRES BORROWERNUMBER (not name).
201                 [% ELSIF ( message_loo.approved_by ) %]ERROR: No match for borrowernumber ([% message_loo.approved_by %]).
202                 [% ELSIF ( message_loo.op_zero ) %]ERROR: The root koha user in your KOHA_CONF file
203                                 (default: kohaadmin) is not a valid tag moderator.  These actions are logged 
204                                 by borrowernumber, so the moderator must exist in your borrowers table.
205                                 Please login as a different authorized staff user to moderate tags.  
206                 [% ELSE %]                                      Unrecognized error! 
207                 [% END %]
208                 <br />
209         [% END %]
210   </div>
211   [% END %]
212   [% IF ( pagination_bar ) %]
213   <div class="pages" id="pagination_top">
214         [% pagination_bar %]
215   </div>
216   [% END %]
217   [% IF ( tagloop ) %]
218   <p class="check"></p>
219   <table id="tagst">
220     <thead>
221         <tr>
222                 <th>&nbsp;</th>
223                 <th>&nbsp;</th>
224                 <th>Status</th>
225                 <th>Term</th>
226                 <th>Weight</th>
227                 <th>Actions</th>
228             [% UNLESS ( filter_approved_pending ) %]<th>Reviewer</th>[% END %]
229                 <th>Date</th>
230         </tr>
231     </thead>
232     <tbody>
233     [% FOREACH tagloo IN tagloop %]
234         <tr>
235             <td class="count">[% offset + loop.count %]
236             </td>
237                 [% IF ( tagloo.approved == 0 ) %]<td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" class="pending" /></span>
238                 [% ELSE %]<td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" /></span>[% END %]
239             </td>
240             [% IF ( tagloo.approved == -1 ) %]<td class="red">rejected
241                 [% ELSIF ( tagloo.approved == 1 ) %]<td class="green"><img alt="OK" src="[% interface %]/[% theme %]/img/approve.gif" />
242             [% ELSE %]<td class="pending">
243             [% END %]
244             </td>
245             <td><a href="/cgi-bin/koha/tags/list.pl?tag=[% tagloo.term|uri %]">[% tagloo.term %]</a>
246             </td>
247             <td>[% tagloo.weight_total %]
248             </td>
249             [% IF ( tagloo.approved ) %]
250             <td><span class="ajax_buttons" style="visibility:hidden">
251                     [% IF ( tagloo.approved == -1 ) %]
252                 <input class="ok"  type="submit" title="[% tagloo.term %]" value="Approve" name="approve" />
253                 <input class="rej" disabled="disabled" type="submit" title="[% tagloo.term %]" value="Rejected" name="reject" />
254                 [% ELSE %]
255                 <input class="ok"  disabled="disabled" type="submit" title="[% tagloo.term %]" value="Approved" name="approve" />
256                 <input class="rej" type="submit" title="[% tagloo.term %]" value="Reject" name="reject" />
257                 [% END %]
258                 </span>
259             </td>
260             <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 %]
261             </td>
262             [% ELSE %]
263             <td><span class="ajax_buttons" style="visibility:hidden">
264             <input class="ok"  type="submit" title="[% tagloo.term %]" value="Approve" name="approve" />
265                 <input class="rej" type="submit" title="[% tagloo.term %]" value="Reject" name="reject" />
266                 </span>
267             </td>
268             [% UNLESS ( filter_approved_pending ) %]<td>&nbsp;</td>[% END %]
269             [% END %]
270             <td>
271                 <span title="[% tagloo.date_approved %]">[% tagloo.date_approved | $KohaDates %]</span>
272             </td>
273         </tr>
274     [% END %]
275     </tbody>
276   </table>
277   [% END %]
278     [% IF ( tagloop ) %]<fieldset class="action">
279    <input type="submit" value="Approve" id="approve_button" name="op-approve" />
280    <input type="submit" value="Reject"  id="reject_button"  name="op-reject" />
281   </fieldset>[% END %]
282   </form>
283 </div>
284 <div class="yui-u">
285  <fieldset class="brief">
286   <h4>Terms summary</h4>
287   <ul>
288         <li><a href="/cgi-bin/koha/tags/review.pl?approved=1">Approved</a>:
289                 <span id="terms_summary_approved_count">[% approved_count %]</span>
290         </li>
291         <li><a href="/cgi-bin/koha/tags/review.pl?approved=-1">Rejected</a>:
292                 <span id="terms_summary_rejected_count">[% rejected_count %]</span>
293         </li>
294         <li><a href="/cgi-bin/koha/tags/review.pl?approved=0">Pending</a>:
295                 <span id="terms_summary_unapproved_count">[% unapproved_count %]</span>
296         </li>
297         <li><a href="/cgi-bin/koha/tags/review.pl?approved=all">Total</a>:
298                 <span id="terms_summary_approved_total">[% approved_total %]</span>
299         </li>
300   </ul>
301   <span id="terms_summary_status">&nbsp;</span>
302   </fieldset>
303   <fieldset class="brief">
304    <h4>Check lists</h4>
305    <div class="description">Enter a word or phrase to check against approved/rejected lists: </div>
306    <form method="post" action="/cgi-bin/koha/tags/review.pl">
307    <input type="text" size="14" name="test" id="test" />
308    <fieldset class="action"><input type="submit" value="Test" id="test_button" name="op-test" /></fieldset>
309    <div id="verdict">
310         [% IF ( test_term ) %]
311         [% IF ( verdict_ok ) %]
312                 &quot;[% test_term %]&quot; is permitted.
313         [% ELSIF ( verdict_rej ) %]
314                 &quot;[% test_term %]&quot; is prohibited.
315         [% ELSIF ( verdict_indeterminate ) %]
316                 &quot;[% test_term %]&quot; is neither permitted nor prohibited.
317         [% END %]
318         [% END %]
319    </div>
320    </form>
321   </fieldset>
322 </div>
323 </div>
324
325
326   </div>
327  </div>
328  <div class="yui-b">
329 <form method="post" action="/cgi-bin/koha/tags/review.pl">
330 <fieldset class="brief">
331   <h4>Filters</h4>
332         <ol>
333             <li><label for="tag">Term</label> <input type="text" name="tag" id="tag" value="[% filter_tag %]" />
334             </li>
335             <li><label for="approved">Status</label> 
336             <select name="approved" id="approved">
337             [% IF ( filter_approved_all ) %]<option selected="selected" value="all">all</option>
338             [% ELSE %]<option value="all">all</option>[% END %]
339             [% IF ( filter_approved_ok ) %]<option selected="selected" value="1">approved</option>
340             [% ELSE %]<option value="1">approved</option>[% END %]
341             [% IF ( filter_approved_pending ) %]<option selected="selected" value="0">pending</option>
342             [% ELSE %]<option value="0">pending</option>[% END %]
343             [% IF ( filter_approved_rej ) %]<option selected="selected" value="-1">rejected</option>
344             [% ELSE %]<option value="-1">rejected</option>[% END %]
345                         </select>
346             </li>
347             <li><label for="approver">Reviewer</label> <input type="text" name="approver" id="approver" value="[% filter_approver %]" />
348             </li>
349             <li>
350                         <label for="from">Date: from </label>
351             <input type="text" size="10" id="from" name="from" value="[% filter_date_approved_from %]" class="datepickerfrom" />
352                         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
353
354                         <label for="to">...to </label>
355             <input type="text" size="10" id="to" name="to" value="[% filter_date_approved_to %]" class="datepickerto" />
356                         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
357             </li>
358   </ol>
359  <fieldset class="action"><input type="submit" value="Apply filter(s)" /></fieldset>
360 </fieldset>
361 </form>
362 </div>
363 </div>
364 [% INCLUDE 'intranet-bottom.inc' %]
365