diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js b/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js index 078b42fc72..1c3cbdbbdc 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js @@ -20,9 +20,9 @@ function pull_counts() { ); } -function count_approve() { +function count_approve(response) { if (response.status == "success") { - success_approve(response.tag); + //success_approve(response.tag); } else { failure_approve(response.tag); } @@ -35,7 +35,7 @@ function count_approve() { function count_reject(response) { if (response.status == "success") { - success_reject(response.tag); + //success_reject(response.tag); } else { failure_reject(response.tag); } @@ -46,28 +46,37 @@ function count_reject(response) { } } -var success_approve = function (tag) { - // window.alert(__("AJAX approved tag: ") + tag); -}; +//var success_approve = function (tag) { +// window.alert(__("AJAX approved tag: ") + tag); +//}; var failure_approve = function (tag) { window.alert(__("AJAX failed to approve tag: %s").format(escape_str(tag))); }; -var success_reject = function (tag) { - // window.alert(__("AJAX rejected tag: ") + tag); -}; +//var success_reject = function (tag) { +// window.alert(__("AJAX rejected tag: ") + tag); +//}; var failure_reject = function (tag) { window.alert(__("AJAX failed to reject tag: %s").format(escape_str(tag))); }; var success_test = function (tag) { - $("#verdict").html(__("%s is permitted!").format(escape_str(tag))); + const verdict = document.querySelector("#verdict"); + if (verdict) { + verdict.textContent = __("%s is permitted!").format(tag); + } }; var failure_test = function (tag) { - $("#verdict").html(__("%s is prohibited!").format(escape_str(tag))); + const verdict = document.querySelector("#verdict"); + if (verdict) { + verdict.textContent = __("%s is prohibited!").format(tag); + } }; var indeterminate_test = function (tag) { - $("#verdict").html( - __("%s is neither permitted nor prohibited!").format(escape_str(tag)) - ); + const verdict = document.querySelector("#verdict"); + if (verdict) { + verdict.textContent = __( + "%s is neither permitted nor prohibited!" + ).format(tag); + } }; var success_test_call = function (response) { diff --git a/tags/review.pl b/tags/review.pl index 34941b9c53..2e754ca1f7 100755 --- a/tags/review.pl +++ b/tags/review.pl @@ -23,9 +23,8 @@ use Modern::Perl; use POSIX qw( ceil ); use CGI qw ( -utf8 ); use CGI::Cookie; # need to check cookies before having CGI parse the POST request -use URI::Escape qw( uri_unescape ); -use JSON qw(encode_json); -use C4::Auth qw( check_cookie_auth get_template_and_user ); +use JSON qw(encode_json); +use C4::Auth qw( check_cookie_auth get_template_and_user ); use C4::Context; use C4::Output qw( output_with_http_headers is_ajax pagination_bar output_html_with_http_headers ); use C4::Tags qw( @@ -46,6 +45,8 @@ sub ajax_auth_cgi { # returns CGI object my $sessid = $cookies{'CGISESSID'}->value; my ($auth_status) = check_cookie_auth( $sessid, $needed_flags ); if ( $auth_status ne "ok" ) { + + #FIMXE: This should return a HTTP error and not a script output_with_http_headers $input, undef, "window.alert('Your CGI session cookie ($sessid) is not current. " . "Please refresh the page and try again.');\n", 'js'; @@ -73,7 +74,7 @@ if ( is_ajax() ) { status => $status, tag => $tag, }; - output_with_http_headers $input, undef, encode_json($response), 'js'; + output_with_http_headers $input, undef, encode_json($response), 'json'; exit; }