Bugzilla – Attachment 168335 Details for
Bug 37226
Authority hierarchy tree broken when a child (narrower) term appears under more than one parent (greater) term
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37226: append a random number to the `id` attribute of each <li>
Bug-37226-append-a-random-number-to-the-id-attribu.patch (text/plain), 4.20 KB, created by
David Nind
on 2024-07-02 01:26:21 UTC
(
hide
)
Description:
Bug 37226: append a random number to the `id` attribute of each <li>
Filename:
MIME Type:
Creator:
David Nind
Created:
2024-07-02 01:26:21 UTC
Size:
4.20 KB
patch
obsolete
>From a34924bc6e50f9fc245f9dbff67cb71f124eddf1 Mon Sep 17 00:00:00 2001 >From: Andreas Roussos <a.roussos@dataly.gr> >Date: Mon, 1 Jul 2024 14:27:42 +0000 >Subject: [PATCH] Bug 37226: append a random number to the `id` attribute of > each <li> > >When you view the authority details page for a term that contains more >than one terms with broader relationship, clicking on the expand/collapse >arrows next to the top-level terms in the hierarchy tree will not work >properly, i.e. *only one* broader term will show the narrower term under >it at any given time. > >This is affecting both the OPAC and the Staff interface. > >This is happening because in the HTML source of the page the individual ><li> elements associated with each node do not have unique `id` values, >which confuses the JavaScript library (jsTree) responsible for rendering >the hierarchy tree. > >This patch fixes that by appending a random number to each `id` attribute. > >Test plan: > >0) Enable the AuthDisplayHierarchy System Preference (set to 'Show'). > >1) Copy the provided MARC21 Authority sample data (sample-data.mrc) > to your KTD Koha container (it must have MARC21 marc flavour): > > docker cp sample-data.mrc koha-koha-1:/kohadevbox/ > >2) Import the provided authorities (the sample file contains three > Geographic Name records): > > WARNING! the --delete switch is passed to bulkmarcimport.pl > WARNING! this will erase any authority data you have in your instance! > (this is done to retain the broader/narrower authid associations) > > misc/migration_tools/bulkmarcimport.pl --authorities --file=/kohadevbox/sample-data.mrc --verbose -c=MARC21 --delete -m=ISO2709 > >3) Visit the authority details page for 'Athens' in OPAC/Staff: > > http://localhost:8080/cgi-bin/koha/opac-authoritiesdetail.pl?authid=3 > http://localhost:8081/cgi-bin/koha/authorities/detail.pl?authid=3 > > In the authority hierarchy tree, click the arrows next to 'Europe' > and 'Greece' to expand and show the narrower term: notice how only > one item works at any given time. > >4) Apply the patch. > >5) Repeat step 3) (refresh the pages) -- this time you should be able > to view 'Athens' as a narrower term of both 'Europe' and 'Greece' > at the same time. > >Signed-off-by: David Nind <david@davidnind.com> >--- > koha-tmpl/intranet-tmpl/prog/en/includes/authorities.inc | 3 ++- > koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-authorities.inc | 3 ++- > 2 files changed, 4 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities.inc >index 1e37b65c7f..12926ed8f6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities.inc >@@ -1,3 +1,4 @@ >+[% USE Math %] > [% BLOCK showhierarchy %] > [% FOREACH tree IN trees %] > [% PROCESS showtree tree = tree %] >@@ -6,7 +7,7 @@ > [% BLOCK showtree %] > <ul class="hierarchy"> > [% FOREACH node IN tree %] >- <li id="hier[% node.authid | html %]" class="[% node.class | html %] authnode"> >+ <li id="hier[% node.authid | html %]_[% Math.rand( 1 ).remove( '\.' ) | html %]" class="[% node.class | html %] authnode"> > [% IF ( node.current_value ) %] > <span class='currentauth'>[% node.value | html %]</span> > [% ELSE %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-authorities.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-authorities.inc >index 2bbad1a9e3..fcf74b31dc 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-authorities.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-authorities.inc >@@ -1,3 +1,4 @@ >+[% USE Math %] > [% BLOCK showhierarchy %] > [% FOREACH tree IN trees %] > [% PROCESS showtree tree = tree marc = marc %] >@@ -7,7 +8,7 @@ > [% BLOCK showtree %] > <ul class="hierarchy"> > [% FOREACH node IN tree %] >- <li id="hier[% node.authid | html %]" class="[% node.class | html %] authnode"> >+ <li id="hier[% node.authid | html %]_[% Math.rand( 1 ).remove( '\.' ) | html %]" class="[% node.class | html %] authnode"> > [% IF ( node.current_value ) %] > <span class="currentauth">[% node.value | html %]</span> > [% ELSE %] >-- >2.39.2
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 37226
:
168314
|
168318
|
168319
|
168320
|
168335
|
169188