Bug 11873 - Upgrade jstree jQuery plugin to the latest version
Summary: Upgrade jstree jQuery plugin to the latest version
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on: 29435
Blocks: 27750 29155 29940 31040
  Show dependency treegraph
 
Reported: 2014-02-28 16:33 UTC by Owen Leonard
Modified: 2023-06-08 22:26 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Medium patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00


Attachments
Bug 11873: Remove decoration on current authority (4.35 KB, patch)
2022-01-27 10:14 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11873: Upgrade jstree jQuery plugin to the latest version (1.06 MB, patch)
2022-02-09 22:37 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 11873: Remove decoration on current authority (4.34 KB, patch)
2022-02-09 22:37 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 11873: Remove decoration on current authority (4.26 KB, patch)
2022-02-10 01:26 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 11873: (QA follow-up) Add missing TT filters (3.00 KB, patch)
2022-02-10 01:27 UTC, Fridolin Somers
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2014-02-28 16:33:14 UTC
We use a jQuery plugin, jstree (http://www.jstree.com/), for displaying authorities hierarchies in the OPAC and staff client. The version we use is incompatible with the latest version of jQuery. If we are to upgrade the version of jQuery we use in Koha we need to also upgrade jstree.

The new version of jstree uses completely different configuration options, so all of the jstree code will have to be re-written.

Since the new version of jstree is incompatible with the old version of jQuery we will have to upgrade them simultaneously.
Comment 1 Owen Leonard 2014-02-28 16:45:11 UTC
I'm wrong. The old version of jstree does work with the latest jQuery. Upgrading at this time is not necessary.
Comment 2 Owen Leonard 2021-11-10 17:28:32 UTC
This patch is too large to attach, so I've pushed it to a GitLab branch:

https://gitlab.com/koha-dev/koha-dev/-/tree/bug-11783-upgrade-jstree

    Bug 11873: Upgrade jstree jQuery plugin to the latest version

    This patch upgrades the jstree plugin in the OPAC and the staff
    interface. The old version had compatibility issues with the latest
    jQuery.

    Also changed: When viewing an authority record in the OPAC's MARC view,
    clicking one of the hierarchy links should now open the MARC view again
    rather than reverting to the normal view.

    To test, apply the patch and rebuild the staff interface and OPAC CSS
    (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

    To test you must have the AuthDisplayHierarchy system preference
    enabled, and you must have some authorities data which can be displayed
    as a hierarchy. From the test plan for Bug 8523:

    "Create authority records with a hierarchy of see also fields (in
     MARC21/NORMARC, you'll be using 5xx fields for this, with a subfield
     $w = 'g' for broader terms and subfield $w = 'h' for narrower terms)"

    - Perform an authority search in the OPAC which will return one of your
      modified authority records.
    - View the record.
    - There should be an expanded tree menu at the top of the authority
      information.
      - Clicking the arrows in the tree should correctly expand
        and collapse the nodes.
      - Clicking the authority record link in the node should load that
        record.
    - Test also from the OPAC's MARC view of the authority record.
      - Confirm that clicking an authority record link in the MARC view
        opens the corresponding record in MARC view again.

    - Perform the same tests in the staff interface.
Comment 3 Eugene Espinoza 2022-01-13 08:16:14 UTC
Hi! There are several known security vulnerabilities in jsTree 1.0-rc3, please see: https://snyk.io/vuln/npm:jstree. Can the importance be changed from P5-low to P1-high? and from normal to critical? Thanks!
Comment 4 Owen Leonard 2022-01-13 11:17:21 UTC
The best way to get this bug moving is to test and sign off on the patch
Comment 5 Eugene Espinoza 2022-01-14 08:50:22 UTC
I am trying this out in the Koha sandboxes, it seems the patches are not being applied when I check in the git.log. I tried various combinations.
I tried for Enter repository url: https://gitlab.com/koha-dev/koha-dev https://gitlab.com/koha-dev/koha-dev/-/tree/bug-11783-upgrade-jstree https://gitlab.com/koha-dev/koha-dev.git
And for branch, either "bug-11783-upgrade-jstree" or "https://gitlab.com/koha-dev/koha-dev/-/tree/bug-11783-upgrade-jstree".
Comment 6 Eugene Espinoza 2022-01-15 03:59:54 UTC
Before signing this one off, just want to post my observation. Regarding "There should be an expanded tree menu at the top of the authority" means I am in the details page of the authority record. Because after searching for an authority record, I am presented with search results and when I go to the details page (/cgi-bin/koha/opac-authoritiesdetail.pl), that's the time I see a tree-like structure in the authorities. When I inspect the element for it, I see class "jstree-icon jstree-ocl" screenshot here: https://issuances-library.senate.gov.ph/sites/default/files/2022-01/jstree_screenshot.png. I can confirm that this is also present in MARC view as well as in the Administration panel.
Comment 7 Eugene Espinoza 2022-01-18 12:41:57 UTC
Signing this one off, patch too large to be attached from the sandbox. Tested it and I can see tree-like structure as discussed in test plan and upon reading jstree plugin and also as observed and described in Comment #6. Thanks oleonard!
Comment 8 Jonathan Druart 2022-01-26 13:50:27 UTC
Do we really need to include the non-minified version of jstree?
Comment 9 Owen Leonard 2022-01-26 14:06:19 UTC
(In reply to Jonathan Druart from comment #8)
> Do we really need to include the non-minified version of jstree?

It's not strictly necessary as long as the minified version includes version number information in it.
Comment 10 Jonathan Druart 2022-01-26 14:23:45 UTC
(In reply to Owen Leonard from comment #9)
> (In reply to Jonathan Druart from comment #8)
> > Do we really need to include the non-minified version of jstree?
> 
> It's not strictly necessary as long as the minified version includes version
> number information in it.

Yes, that's my point. If someone wants to debug it is easy to retrieve the corresponding non-minified version.
Comment 11 Owen Leonard 2022-01-26 16:27:01 UTC
Remote branch updated to remove the non-minified version.
Comment 12 Jonathan Druart 2022-01-27 10:14:11 UTC
Created attachment 129857 [details] [review]
Bug 11873: Remove decoration on current authority

Previously the current authority was not styled like a link. It was
useful to have a visual feedback knowing which authority is currently
displayed.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 13 Jonathan Druart 2022-01-27 10:14:47 UTC
(In reply to Jonathan Druart from comment #12)
> Created attachment 129857 [details] [review] [review]
> Bug 11873: Remove decoration on current authority
> 
> Previously the current authority was not styled like a link. It was
> useful to have a visual feedback knowing which authority is currently
> displayed.
> 
> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

This is a bit ugly (duplication code, and css applied with JS) but didn't find something better.
Comment 14 Fridolin Somers 2022-02-09 22:28:05 UTC
Hi,

How should I push to master ?
Merge the branch + this patch ?

This branch does not exist anymore :
https://gitlab.com/koha-dev/koha-dev/-/tree/bug-11783-upgrade-jstree
Comment 15 Owen Leonard 2022-02-09 22:37:51 UTC
Created attachment 130411 [details] [review]
Bug 11873: Upgrade jstree jQuery plugin to the latest version

This patch upgrades the jstree plugin in the OPAC and the staff
interface. The old version had compatibility issues with the latest
jQuery.

Also changed: When viewing an authority record in the OPAC's MARC view,
clicking one of the hierarchy links should now open the MARC view again
rather than reverting to the normal view.

To test, apply the patch and rebuild the staff interface and OPAC CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

To test you must have the AuthDisplayHierarchy system preference
enabled, and you must have some authorities data which can be displayed
as a hierarchy. From the test plan for Bug 8523:

"Create authority records with a hierarchy of see also fields (in
 MARC21/NORMARC, you'll be using 5xx fields for this, with a subfield
 $w = 'g' for broader terms and subfield $w = 'h' for narrower terms)"

- Perform an authority search in the OPAC which will return one of your
  modified authority records.
- View the record.
- There should be an expanded tree menu at the top of the authority
  information.
  - Clicking the arrows in the tree should correctly expand
    and collapse the nodes.
  - Clicking the authority record link in the node should load that
    record.
- Test also from the OPAC's MARC view of the authority record.
  - Confirm that clicking an authority record link in the MARC view
    opens the corresponding record in MARC view again.

- Perform the same tests in the staff interface.

Signed-off-by: Eugene Espinoza <eugenegf@yahoo.com>
Comment 16 Owen Leonard 2022-02-09 22:37:55 UTC
Created attachment 130412 [details] [review]
Bug 11873: Remove decoration on current authority

Previously the current authority was not styled like a link. It was
useful to have a visual feedback knowing which authority is currently
displayed.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 17 Fridolin Somers 2022-02-10 01:25:43 UTC
Patch  Bug 11873: Remove decoration on current authority removes a [% END %] in koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth-MARCdetail.tt
I fix that and reattach the patch

Plus a patch to add missing TT filters
Comment 18 Fridolin Somers 2022-02-10 01:26:15 UTC
Created attachment 130418 [details] [review]
Bug 11873: Remove decoration on current authority

Previously the current authority was not styled like a link. It was
useful to have a visual feedback knowing which authority is currently
displayed.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 19 Fridolin Somers 2022-02-10 01:27:03 UTC
Created attachment 130419 [details] [review]
Bug 11873: (QA follow-up) Add missing TT filters
Comment 20 Fridolin Somers 2022-02-10 01:36:21 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 21 Kyle M Hall 2022-02-11 11:26:58 UTC
It this does need backported, please let me know!