Bugzilla – Attachment 95652 Details for
Bug 23276
Don't show tags on tag cloud when tagging is disabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23276: Do not display tag if pref TagsEnabled is off
Bug-23276-Do-not-display-tag-if-pref-TagsEnabled-i.patch (text/plain), 5.51 KB, created by
Jonathan Druart
on 2019-11-21 10:43:26 UTC
(
hide
)
Description:
Bug 23276: Do not display tag if pref TagsEnabled is off
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-11-21 10:43:26 UTC
Size:
5.51 KB
patch
obsolete
>From 6ac4e20f8f0272b6879414cf051dd0f7f834f086 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 20 Nov 2019 15:40:10 +0100 >Subject: [PATCH] Bug 23276: Do not display tag if pref TagsEnabled is off > >If the pref TagsEnabled is off we should not display the tags at the >OPAC. >There is a message to tell that tags system is disabled, but the tags >are displayed. > >This patch introduces the blocking_errors include file at the OPAC. > >Test plan: >- Turn TagsEnabled on >- Add some tags >- Turn TagsEnabled off >- Hit /cgi-bin/koha/opac-tags.pl >=> Without this patch you see a warning messaging saying that the tag >system is disabled, but the tags are displayed >=> With this patch you see a (ugly) short screen saying that the tag >system is disabled. >--- > .../bootstrap/en/includes/blocking_errors.inc | 15 +++++++++ > .../opac-tmpl/bootstrap/en/includes/masthead.inc | 1 + > .../opac-tmpl/bootstrap/en/modules/opac-tags.tt | 4 +-- > opac/opac-tags.pl | 38 +++++++++++----------- > 4 files changed, 36 insertions(+), 22 deletions(-) > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/blocking_errors.inc > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/blocking_errors.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/blocking_errors.inc >new file mode 100644 >index 0000000000..21f0290bfd >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/blocking_errors.inc >@@ -0,0 +1,15 @@ >+<div class="main"> >+ <div class="container-fluid"> >+ <div class="row-fluid"> >+ [% IF blocking_error %] >+ [% SWITCH blocking_error %] >+ [% CASE "tags_disabled" %]Sorry, tags are not enabled on this system. >+ [% CASE %][%# Do not display the blocking error at the OPAC if not handled previously %] >+ [% END %] >+ >+ [% INCLUDE 'opac-bottom.inc' %] >+ [% STOP %] [%# Will stop gracefully without processing any more of the template document.%] >+ [% END %] >+ </div> >+ </div> >+</div> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index c61938a205..fc277fc4f4 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -374,3 +374,4 @@ > </div> > </form> <!-- /#auth --> > </div> <!-- /#modalAuth --> >+ [% INCLUDE 'blocking_errors.inc' %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt >index d5938ecfde..92ae6d51a1 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt >@@ -54,9 +54,7 @@ > [% FOREACH ERROR IN ERRORS %] > <div class="alert"> > There was a problem with this operation: >- [% IF ( ERROR.tagsdisabled ) %] >- Sorry, tags are not enabled on this system. >- [% ELSIF ( ERROR.badparam ) %] >+ [% IF ( ERROR.badparam ) %] > ERROR: illegal parameter [% ERROR.badparam | html %] > [% ELSIF ( ERROR.login ) %] > ERROR: You must log in to complete that action. >diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl >index bc5ac8a9e3..24691e8a8a 100755 >--- a/opac/opac-tags.pl >+++ b/opac/opac-tags.pl >@@ -38,7 +38,7 @@ use CGI::Cookie; # need to check cookies before having CGI parse the POST reques > use C4::Auth qw(:DEFAULT check_cookie_auth); > use C4::Context; > use C4::Debug; >-use C4::Output qw(:html :ajax pagination_bar); >+use C4::Output qw(:html :ajax output_and_exit ); > use C4::Scrubber; > use C4::Biblio; > use C4::Items qw(GetItemsInfo GetHiddenItemnumbers); >@@ -86,24 +86,20 @@ sub ajax_auth_cgi { # returns CGI object > my $is_ajax = is_ajax(); > my $openadds = C4::Context->preference('TagsModeration') ? 0 : 1; > my $query = ($is_ajax) ? &ajax_auth_cgi({}) : CGI->new(); >-unless (C4::Context->preference('TagsEnabled')) { >- push @errors, {+ tagsdisabled=>1 }; >- push @globalErrorIndexes, $#errors; >-} else { >- foreach ($query->param) { >- if (/^newtag(.*)/) { >- my $biblionumber = $1; >- unless ($biblionumber =~ /^\d+$/) { >- $debug and warn "$_ references non numerical biblionumber '$biblionumber'"; >- push @errors, {+'badparam' => $_ }; >- push @globalErrorIndexes, $#errors; >- next; >- } >- $newtags{$biblionumber} = $query->param($_); >- } elsif (/^del(\d+)$/) { >- push @deltags, $1; >- } >- } >+foreach ($query->param) { >+ if (/^newtag(.*)/) { >+ warn "marches"; >+ my $biblionumber = $1; >+ unless ($biblionumber =~ /^\d+$/) { >+ $debug and warn "$_ references non numerical biblionumber '$biblionumber'"; >+ push @errors, {+'badparam' => $_ }; >+ push @globalErrorIndexes, $#errors; >+ next; >+ } >+ $newtags{$biblionumber} = $query->param($_); >+ } elsif (/^del(\d+)$/) { >+ push @deltags, $1; >+ } > } > > my $add_op = (scalar(keys %newtags) + scalar(@deltags)) ? 1 : 0; >@@ -121,6 +117,10 @@ if ($is_ajax) { > }); > } > >+ >+output_and_exit( $query, $cookie, $template, 'tags_disabled' ) >+ unless C4::Context->preference('TagsEnabled'); >+ > if ($add_op) { > unless ($loggedinuser) { > push @errors, {+'login' => 1 }; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23276
:
95618
|
95652
|
95653
|
95750
|
95825
|
105349
|
105354
|
105428