Lines 6-11
Link Here
|
6 |
[% INCLUDE 'datatables.inc' %] |
6 |
[% INCLUDE 'datatables.inc' %] |
7 |
[% INCLUDE 'calendar.inc' %] |
7 |
[% INCLUDE 'calendar.inc' %] |
8 |
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script> |
8 |
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script> |
|
|
9 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/pages/tags-review.js"></script> |
10 |
<script type="text/javascript"> |
11 |
var MSG_AJAX_APPROVE_FAILED = _("AJAX failed to approve tag: %s"); |
12 |
var MSG_AJAX_REJECTION_FAILED = _("AJAX failed to reject tag: %s"); |
13 |
var MSG_AJAX_TAG_PERMITTED = _("%s is permitted!"); |
14 |
var MSG_AJAX_TAG_PROHIBITED = _("%s is prohibited!"); |
15 |
var MSG_AJAX_TAG_UNCLASSIFIED = _("%s is neither permitted nor prohibited!"); |
16 |
var MSG_AJAX_ERROR = _("AJAX error (%s alert)"); |
17 |
var LABEL_SELECT_ALL = _("Select all"); |
18 |
var LABEL_CLEAR_ALL = _("Clear all"); |
19 |
var LABEL_SELECT_ALL_PENDING = _("Select all pending"); |
20 |
var LABEL_APPROVE = _("Approve"); |
21 |
var LABEL_APPROVED = _("Approved"); |
22 |
var LABEL_REJECT = _("Reject"); |
23 |
var LABEL_REJECTED = _("Rejected"); |
24 |
var LABEL_TESTING = _("Testing..."); |
25 |
</script> |
9 |
<style type="text/css"> |
26 |
<style type="text/css"> |
10 |
.setlabel {width: 6em; font-family: courier; background-color:#E8E8E8;} |
27 |
.setlabel {width: 6em; font-family: courier; background-color:#E8E8E8;} |
11 |
.rejected { color: #CC0033; } |
28 |
.rejected { color: #CC0033; } |
Lines 13-181
Link Here
|
13 |
.pending { color: #CCC; font-style: italic; } |
30 |
.pending { color: #CCC; font-style: italic; } |
14 |
tr > td input,td input[type="submit"] { font-size: 85%; padding: 1px; } |
31 |
tr > td input,td input[type="submit"] { font-size: 85%; padding: 1px; } |
15 |
</style> |
32 |
</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').prop('disabled', false); |
77 |
$('#test_button').html("<i class='fa fa-check-square-o' aria-hidden='true'></i>" +_(" Test")); |
78 |
}; |
79 |
$(document).ready(function() { |
80 |
$('.ajax_buttons' ).css({visibility:"visible"}); |
81 |
$("p.check").html("<div id=\"searchheader\"><a id=\"CheckAll\" href=\"/cgi-bin/koha/tags/review.pl\"><i class=\"fa fa-check\"><\/i>"+_(" Select all")+"<\/a> | <a id=\"CheckNone\" href=\"/cgi-bin/koha/tags/review.pl\"><i class=\"fa fa-remove\"><\/i>"+_(" Clear all")+"<\/a> | <a id=\"CheckPending\" href=\"/cgi-bin/koha/tags/review.pl\"> "+_("Select all pending")+"<\/a><\/div>"); |
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").prop('disabled', false).css("color","#000"); |
103 |
$(event.target).next(".rej").html("<i class='fa fa-remove'></i>" + _(" Reject")); |
104 |
$(event.target).prop('disabled', true).css("color","#666"); |
105 |
$(event.target).html("<i class='fa fa-check'></i>" + _(" Approved")); |
106 |
var getelement = $(event.target).attr("title"); |
107 |
var gettitle = "span[data-title|=" + getelement + "]"; |
108 |
$(gettitle).text(_("Approved")); |
109 |
if ($(gettitle).attr("class") == "pending"){ |
110 |
$(gettitle).toggleClass("pending approved"); |
111 |
} else { |
112 |
$(gettitle).toggleClass("rejected approved"); |
113 |
} |
114 |
return false; // cancel submit |
115 |
} |
116 |
if ($(event.target).is('.rej')) { |
117 |
$.ajax({ |
118 |
data: {rej: $(event.target).attr("title")}, |
119 |
success: count_reject // success_reject |
120 |
}); |
121 |
$(event.target).prev(".ok").prop('disabled', false).css("color","#000"); |
122 |
$(event.target).prev(".ok").html("<i class='fa fa-check'></i>" + _(" Approve")); |
123 |
$(event.target).prop('disabled', true).css("color","#666"); |
124 |
$(event.target).html("<i class='fa fa-remove'></i>" + _(" Rejected")); |
125 |
var getelement = $(event.target).attr("title"); |
126 |
var gettitle = "span[data-title|=" + getelement + "]"; |
127 |
$(gettitle).text(_("Rejected")); |
128 |
if ($(gettitle).attr("class") == "pending"){ |
129 |
$(gettitle).toggleClass("pending rejected"); |
130 |
} else { |
131 |
$(gettitle).toggleClass("approved rejected"); |
132 |
} |
133 |
return false; // cancel submit |
134 |
} |
135 |
if ($(event.target).is('#test_button')) { |
136 |
$(event.target).text(_("Testing...")).prop('disabled', true); |
137 |
$.ajax({ |
138 |
data: {test: $('#test').attr("value")}, |
139 |
success: success_test_call // success_reject |
140 |
}); |
141 |
return false; // cancel submit |
142 |
} |
143 |
}); |
144 |
$("*").ajaxError(function(evt, request, settings){ |
145 |
if ((alerted +=1) <= 1){ window.alert(_("AJAX error (%s alert)").format(alerted)); } |
146 |
}); |
147 |
$("#tagst").dataTable($.extend(true, {}, dataTablesDefaults, { |
148 |
"aoColumnDefs": [ |
149 |
[% IF ( filter_approved_pending ) %] |
150 |
{ "aTargets": [ 0,1,-2 ], "bSortable": false, "bSearchable": false } |
151 |
[% ELSE %] |
152 |
{ "aTargets": [ 0,1,-3 ], "bSortable": false, "bSearchable": false } |
153 |
[% END %] |
154 |
], |
155 |
"aoColumns": [ |
156 |
null,null,null,null,null,null,[% UNLESS ( filter_approved_pending ) %]null,[% END %]{ "sType": "title-string" } |
157 |
], |
158 |
"aaSorting": [[ 4, "desc" ]], |
159 |
"sPaginationType": "four_button" |
160 |
})); |
161 |
var reviewerField = $("#approver"); |
162 |
reviewerField.autocomplete({ |
163 |
source: "/cgi-bin/koha/circ/ysearch.pl", |
164 |
minLength: 3, |
165 |
select: function( event, ui ) { |
166 |
reviewerField.val( ui.item.borrowernumber ); |
167 |
return false; |
168 |
} |
169 |
}) |
170 |
.data( "ui-autocomplete" )._renderItem = function( ul, item ) { |
171 |
return $( "<li></li>" ) |
172 |
.data( "ui-autocomplete-item", item ) |
173 |
.append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) |
174 |
.appendTo( ul ); |
175 |
}; |
176 |
}); |
177 |
//]]> |
178 |
</script> |
179 |
</head> |
33 |
</head> |
180 |
<body id="tags_review" class="tools"> |
34 |
<body id="tags_review" class="tools"> |
181 |
[% INCLUDE 'header.inc' %] |
35 |
[% INCLUDE 'header.inc' %] |
Lines 239-252
tr > td input,td input[type="submit"] { font-size: 85%; padding: 1px; }
Link Here
|
239 |
<table id="tagst"> |
93 |
<table id="tagst"> |
240 |
<thead> |
94 |
<thead> |
241 |
<tr> |
95 |
<tr> |
242 |
<th> </th> |
96 |
<th class="NoSort"> </th> |
243 |
<th> </th> |
97 |
<th class="NoSort"> </th> |
244 |
<th>Status</th> |
98 |
<th>Status</th> |
245 |
<th>Term</th> |
99 |
<th>Term</th> |
246 |
<th>Weight</th> |
100 |
<th>Weight</th> |
247 |
<th>Actions</th> |
101 |
<th class="NoSort">Actions</th> |
248 |
[% UNLESS ( filter_approved_pending ) %]<th>Reviewer</th>[% END %] |
102 |
[% UNLESS ( filter_approved_pending ) %]<th>Reviewer</th>[% END %] |
249 |
<th>Date</th> |
103 |
<th class="title-string">Date</th> |
250 |
</tr> |
104 |
</tr> |
251 |
</thead> |
105 |
</thead> |
252 |
<tbody> |
106 |
<tbody> |
Lines 254-283
tr > td input,td input[type="submit"] { font-size: 85%; padding: 1px; }
Link Here
|
254 |
<tr> |
108 |
<tr> |
255 |
<td class="count">[% offset + loop.count %] |
109 |
<td class="count">[% offset + loop.count %] |
256 |
</td> |
110 |
</td> |
257 |
[% IF ( tagloo.approved == 0 ) %]<td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" class="pending" /></span> |
111 |
[% IF ( tagloo.approved == 0 ) %]<td><span><input type="checkbox" value="[% tagloo.term|html %]" name="tags" class="pending" /></span> |
258 |
[% ELSE %]<td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" /></span>[% END %] |
112 |
[% ELSE %]<td><span><input type="checkbox" value="[% tagloo.term|html %]" name="tags" /></span>[% END %] |
259 |
</td> |
113 |
</td> |
260 |
<td> |
114 |
<td> |
261 |
[% IF ( tagloo.approved == -1 ) %] |
115 |
[% IF ( tagloo.approved == -1 ) %] |
262 |
<span class="rejected" data-title="[% tagloo.term %]">Rejected</span> |
116 |
<span class="rejected status[% offset + loop.count %]">Rejected</span> |
263 |
[% ELSIF ( tagloo.approved == 1 ) %] |
117 |
[% ELSIF ( tagloo.approved == 1 ) %] |
264 |
<span class="approved" data-title="[% tagloo.term %]">Approved</span> |
118 |
<span class="approved status[% offset + loop.count %]">Approved</span> |
265 |
[% ELSE %] |
119 |
[% ELSE %] |
266 |
<span class="pending" data-title="[% tagloo.term %]">Pending</span> |
120 |
<span class="pending status[% offset + loop.count %]">Pending</span> |
267 |
[% END %] |
121 |
[% END %] |
268 |
</td> |
122 |
</td> |
269 |
<td><a href="/cgi-bin/koha/tags/list.pl?tag=[% tagloo.term|uri %]">[% tagloo.term %]</a> |
123 |
<td><a href="/cgi-bin/koha/tags/list.pl?tag=[% tagloo.term|uri %]">[% tagloo.term|html %]</a> |
270 |
</td> |
124 |
</td> |
271 |
<td>[% tagloo.weight_total %] |
125 |
<td>[% tagloo.weight_total %] |
272 |
</td> |
126 |
</td> |
273 |
[% IF ( tagloo.approved ) %] |
127 |
[% IF ( tagloo.approved ) %] |
274 |
<td class="actions"><span class="ajax_buttons" style="visibility:hidden"> |
128 |
<td class="actions"><span class="ajax_buttons" style="visibility:hidden"> |
275 |
[% IF ( tagloo.approved == -1 ) %] |
129 |
[% IF ( tagloo.approved == -1 ) %] |
276 |
<button class="ok btn btn-default btn-xs" type="submit" title="[% tagloo.term %]" value="Approve" name="approve"><i class="fa fa-check"></i> Approve</button> |
130 |
<button data-num="[% offset + loop.count %]" class="approval_btn ok btn btn-default btn-xs" type="submit" title="[% tagloo.term|html %]" value="Approve" name="approve"><i class="fa fa-check"></i> Approve</button> |
277 |
<button class="rej btn btn-default btn-xs" disabled="disabled" type="submit" title="[% tagloo.term %]" value="Rejected" name="reject"><i class="fa fa-remove"></i> Rejected</button> |
131 |
<button data-num="[% offset + loop.count %]" class="approval_btn rej btn btn-default btn-xs" disabled="disabled" type="submit" title="[% tagloo.term|html %]" value="Rejected" name="reject"><i class="fa fa-remove"></i> Rejected</button> |
278 |
[% ELSE %] |
132 |
[% ELSE %] |
279 |
<button class="ok btn btn-default btn-xs" disabled="disabled" type="submit" title="[% tagloo.term %]" value="Approved" name="approve"><i class="fa fa-check"></i> Approved</button> |
133 |
<button data-num="[% offset + loop.count %]" class="approval_btn ok btn btn-default btn-xs" disabled="disabled" type="submit" title="[% tagloo.term|html %]" value="Approved" name="approve"><i class="fa fa-check"></i> Approved</button> |
280 |
<button class="rej btn btn-default btn-xs" type="submit" title="[% tagloo.term %]" value="Reject" name="reject"><i class="fa fa-remove"></i> Reject</button> |
134 |
<button data-num="[% offset + loop.count %]" class="approval_btn rej btn btn-default btn-xs" type="submit" title="[% tagloo.term|html %]" value="Reject" name="reject"><i class="fa fa-remove"></i> Reject</button> |
281 |
[% END %] |
135 |
[% END %] |
282 |
</span> |
136 |
</span> |
283 |
</td> |
137 |
</td> |
Lines 285-292
tr > td input,td input[type="submit"] { font-size: 85%; padding: 1px; }
Link Here
|
285 |
</td> |
139 |
</td> |
286 |
[% ELSE %] |
140 |
[% ELSE %] |
287 |
<td class="actions"><span class="ajax_buttons" style="visibility:hidden"> |
141 |
<td class="actions"><span class="ajax_buttons" style="visibility:hidden"> |
288 |
<button class="ok btn btn-default btn-xs" type="submit" title="[% tagloo.term %]" value="Approve" name="approve"><i class="fa fa-check"></i> Approve</button> |
142 |
<button data-num="[% offset + loop.count %]" class="approval_btn ok btn btn-default btn-xs" type="submit" title="[% tagloo.term|html %]" value="Approve" name="approve"><i class="fa fa-check"></i> Approve</button> |
289 |
<button class="rej btn btn-default btn-xs" type="submit" title="[% tagloo.term %]" value="Reject" name="reject"><i class="fa fa-remove"></i> Reject</button> |
143 |
<button data-num="[% offset + loop.count %]" class="approval_btn rej btn btn-default btn-xs" type="submit" title="[% tagloo.term|html %]" value="Reject" name="reject"><i class="fa fa-remove"></i> Reject</button> |
290 |
</span> |
144 |
</span> |
291 |
</td> |
145 |
</td> |
292 |
[% UNLESS ( filter_approved_pending ) %]<td> </td>[% END %] |
146 |
[% UNLESS ( filter_approved_pending ) %]<td> </td>[% END %] |
Lines 329-335
tr > td input,td input[type="submit"] { font-size: 85%; padding: 1px; }
Link Here
|
329 |
<div class="description">Enter a word or phrase to check against approved/rejected lists: </div> |
183 |
<div class="description">Enter a word or phrase to check against approved/rejected lists: </div> |
330 |
<form method="post" action="/cgi-bin/koha/tags/review.pl"> |
184 |
<form method="post" action="/cgi-bin/koha/tags/review.pl"> |
331 |
<input type="text" size="14" name="test" id="test" /> |
185 |
<input type="text" size="14" name="test" id="test" /> |
332 |
<fieldset class="action"><button type="submit" value="Test" class="btn btn-default btn-sm" id="test_button" name="op-test"><i class="fa fa-check-square-o" aria-hidden="true"></i> Test</button></fieldset> |
186 |
<fieldset class="action"><button type="submit" value="Test" class="approval_btn btn btn-default btn-sm" id="test_button" name="op-test"><i class="fa fa-check-square-o" aria-hidden="true"></i> Test</button></fieldset> |
333 |
<div id="verdict"> |
187 |
<div id="verdict"> |
334 |
[% IF ( test_term ) %] |
188 |
[% IF ( test_term ) %] |
335 |
[% IF ( verdict_ok ) %] |
189 |
[% IF ( verdict_ok ) %] |