Bug 41665

Summary: Only include Greybox in OPAC if IdRef is enabled
Product: Koha Reporter: David Cook <dcook>
Component: OPACAssignee: David Cook <dcook>
Status: Passed QA --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: minor    
Priority: P5 - low CC: fridolin.somers, lari.taskula, m.de.rooy, oleonard
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32333
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8290
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34710
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Crowdfunding committed: 0
Crowdfunding contact: Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 34710, 38366    
Attachments: Bug 41665: Only include Greybox in OPAC if IdRef is enabled
Bug 41665: Only include Greybox in OPAC if IdRef is enabled
Screenshot of IdRef popup
Bug 41665: Only include Greybox in OPAC if IdRef is enabled

Description David Cook 2026-01-20 00:26:15 UTC
Greybox is only used in the OPAC for the IdRef feature in the UNIMARC XSLT. So we should only include it in that context.
Comment 1 David Cook 2026-01-20 00:31:58 UTC
Created attachment 191659 [details] [review]
Bug 41665: Only include Greybox in OPAC if IdRef is enabled

This patch wraps the Greybox include in the OPAC with a syspref
check on IdRef, so that it's only loaded when it's needed.

Test plan:
0. Apply the patch
1. Go to http://localhost:8080/cgi-bin/koha/opac-detail.pl?biblionumber=29
2. Search through the HTML or the Sources tab in F12 tools and note
that Greybox assets are not loaded
3. Enable the IdRef system preference
4. Note that the Greybox assets are loaded
Comment 2 Owen Leonard 2026-01-20 15:41:51 UTC
Created attachment 191708 [details] [review]
Bug 41665: Only include Greybox in OPAC if IdRef is enabled

This patch wraps the Greybox include in the OPAC with a syspref
check on IdRef, so that it's only loaded when it's needed.

Test plan:
0. Apply the patch
1. Go to http://localhost:8080/cgi-bin/koha/opac-detail.pl?biblionumber=29
2. Search through the HTML or the Sources tab in F12 tools and note
   that Greybox assets are not loaded
3. Enable the IdRef system preference
4. Note that the Greybox assets are loaded

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 3 David Cook 2026-01-20 23:29:38 UTC
Legend. Thanks, Owen!
Comment 4 Marcel de Rooy 2026-03-13 08:10:31 UTC
This seems to be a very old library?
I am wondering how we use it? I dont really see it being used in the idref context.
Only came across this line:

koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslimUtils.xsl:                  <xsl:attribute name="rel">gb_page_center[600,500]</xsl:attribute>
Which looks odd too btw.

And if it is that old, should we even use it?
There is a reference to an official site: http://orangoo.com/labs/GreyBox
This site does not respond

Adding
Comment 5 Marcel de Rooy 2026-03-13 08:10:54 UTC
(In reply to Marcel de Rooy from comment #4)
> Adding Fridolin for feedback
Comment 6 Marcel de Rooy 2026-03-13 08:11:18 UTC
Changing status for now
Comment 7 Fridolin Somers 2026-03-13 08:37:37 UTC
This is used indeed for opening a popup with IdRef datas.

Bug 34710 will manage rewriting this.

I attach a screenshot from AMU OPAC.
Comment 8 Fridolin Somers 2026-03-13 08:38:11 UTC
Created attachment 195253 [details]
Screenshot of IdRef popup

Screenshot of IdRef popup
Comment 9 Marcel de Rooy 2026-03-13 08:41:54 UTC
(In reply to Fridolin Somers from comment #7)
> This is used indeed for opening a popup with IdRef datas.
> 
> Bug 34710 will manage rewriting this.
> 
> I attach a screenshot from AMU OPAC.

Could you confirm that Greybox is not used here?
Comment 10 Fridolin Somers 2026-03-13 09:03:51 UTC
On the contrary, it is used here.

From XSLT file :

koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslimUtils.xsl:
<xsl:attribute name="rel">gb_page_center[600,500]</xsl:attribute>

gb_page_center is JS from Greybox


I've found a page speaking about it (looks very old) :
https://www.jqueryscript.net/demo/Simple-Pop-up-Window-Plugin-GreyBox/normal_usage.html
Comment 12 Marcel de Rooy 2026-03-13 09:25:31 UTC
Thx for confirming that it is still used. Note also comment4 btw; it was not obvious from there only.
Comment 13 Marcel de Rooy 2026-03-13 09:27:50 UTC
Created attachment 195261 [details] [review]
Bug 41665: Only include Greybox in OPAC if IdRef is enabled

This patch wraps the Greybox include in the OPAC with a syspref
check on IdRef, so that it's only loaded when it's needed.

Test plan:
0. Apply the patch
1. Go to http://localhost:8080/cgi-bin/koha/opac-detail.pl?biblionumber=29
2. Search through the HTML or the Sources tab in F12 tools and note
   that Greybox assets are not loaded
3. Enable the IdRef system preference
4. Note that the Greybox assets are loaded

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 14 Marcel de Rooy 2026-03-13 09:30:50 UTC
Lets move on with bug 34710 and remove this very old unsupported js lib.
Comment 15 Owen Leonard 2026-03-13 12:17:36 UTC
(In reply to Marcel de Rooy from comment #14)
> Lets move on with bug 34710 and remove this very old unsupported js lib.

We need to move on with Bug 32333!