Bug 14004 - Add ability to temporarily disable added CSS and Javascript in OPAC and interface
Summary: Add ability to temporarily disable added CSS and Javascript in OPAC and inter...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Fridolin Somers
QA Contact: Testopia
URL:
Keywords: Manual
Depends on:
Blocks: 28583
  Show dependency treegraph
 
Reported: 2015-04-16 14:31 UTC by Barton Chittenden
Modified: 2022-12-12 21:23 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This allows to temporarily disable any of OPACUserCSS, OPACUserJS, OpacAdditionalStylesheet, opaclayoutstylesheet, IntranetUserCSS, IntranetUserJS, intranetcolorstylesheet, and intranetstylesheet system preference via an URL parameter. Alter the URL in OPAC or staff interface by adding an additional parameter DISABLE_SYSPREF_<system preference name>=1. Example: /cgi-bin/koha/mainpage.pl?DISABLE_SYSPREF_IntranetUserCSS=1
Version(s) released in:
21.05.00,20.11.03,20.05.09
Circulation function:


Attachments
Bug 14004: Add ability to temporarily disable JS/CSS sysprefs (2.03 KB, patch)
2021-01-12 10:52 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 14004: Add ability to temporarily disable JS/CSS sysprefs (2.03 KB, patch)
2021-01-14 00:00 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 14004: Add OpacAdditionalStylesheet and opaclayoutstylesheet (1000 bytes, patch)
2021-01-21 16:09 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 14004: Add ability to temporarily disable JS/CSS sysprefs (2.05 KB, patch)
2021-01-21 18:04 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14004: Add OpacAdditionalStylesheet and opaclayoutstylesheet (1.03 KB, patch)
2021-01-21 18:04 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14004: Add ability to temporarily disable JS/CSS sysprefs (2.11 KB, patch)
2021-01-21 18:30 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14004: Add OpacAdditionalStylesheet and opaclayoutstylesheet (1.08 KB, patch)
2021-01-21 18:30 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14004: Set the syspref's value to an empty string (1.25 KB, patch)
2021-01-27 11:04 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 14004: Set the syspref's value to an empty string (1.42 KB, patch)
2021-01-27 11:21 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 14004: Set the syspref's value to an empty string (1.53 KB, patch)
2021-01-27 12:03 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 14004: Set the syspref's value to an empty string (1.60 KB, patch)
2021-01-27 13:12 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 Barton Chittenden 2015-04-16 14:31:28 UTC
It would be *super* handy if intranetuserjs and/or opacuserjs could be temporarily disabled via a check-box or syspref. Right now, debugging issues in intranetuserjs usuaally starts with copying the contents into a text file, blanking the syspref and re-testing.
Comment 1 Barton Chittenden 2017-03-15 21:03:36 UTC
Actually, it would be even nicer if this could be handled via an option in the URL, eg.

   .../cgi-bin/koha/catalogue/itemsearch.pl?disbable_intranetuserjs=true
Comment 2 Fridolin Somers 2021-01-12 10:52:23 UTC
Created attachment 115064 [details] [review]
Bug 14004: Add ability to temporarily disable JS/CSS sysprefs

It would be *super* handy if intranetuserjs and/or opacuserjs could be temporarily disabled via a check-box or syspref.
Right now, debugging issues in intranetuserjs usuaally starts with copying the contents into a text file, blanking the syspref and re-testing.

This patch adds this feature by setting syspref via ENV OVERRIDE_SYSPREF
like override via Apache config.
Note that this only works for

Implemented only for preferences :
OPACUserCSS OPACUserJS IntranetUserCSS IntranetUserJS
=> replaced with ' '
intranetcolorstylesheet intranetstylesheet
=> replaced with 0

Test plan :
1) Set some CSS in IntranetUserCSS like : #breadcrumbs{color:red}
2) Go to staff interface home page like : /cgi-bin/koha/mainpage.pl
3) See CSS impact is visible
4) Edit URL : /cgi-bin/koha/mainpage.pl?DISABLE_SYSPREF_IntranetUserCSS=1
5) See CSS impact is not visible
6) Check with the other preferences
Comment 3 Lucas Gass (lukeg) 2021-01-13 23:58:53 UTC
Nice! This works well and its a great way to troubleshoot potential problems.
Comment 4 Lucas Gass (lukeg) 2021-01-14 00:00:54 UTC Comment hidden (obsolete)
Comment 5 Katrin Fischer 2021-01-17 17:30:37 UTC
Hi Frido,
could we please add OpacAdditionalStylesheet and  opaclayoutstylesheet to this to make the same options available for staff and intranet?
Comment 6 Fridolin Somers 2021-01-21 16:09:58 UTC Comment hidden (obsolete)
Comment 7 Owen Leonard 2021-01-21 18:04:21 UTC
Created attachment 115583 [details] [review]
Bug 14004: Add ability to temporarily disable JS/CSS sysprefs

It would be *super* handy if intranetuserjs and/or opacuserjs could be
temporarily disabled via a check-box or syspref.
Right now, debugging issues in intranetuserjs usuaally starts with
copying the contents into a text file, blanking the syspref and re-testing.

This patch adds this feature by setting syspref via ENV
OVERRIDE_SYSPREF like override via Apache config.

Implemented only for preferences :
OPACUserCSS OPACUserJS IntranetUserCSS IntranetUserJS
=> replaced with ' '
intranetcolorstylesheet intranetstylesheet
=> replaced with 0

Test plan :
1) Set some CSS in IntranetUserCSS like : #breadcrumbs{color:red}
2) Go to staff interface home page like : /cgi-bin/koha/mainpage.pl
3) See CSS impact is visible
4) Edit URL : /cgi-bin/koha/mainpage.pl?DISABLE_SYSPREF_IntranetUserCSS=1
5) See CSS impact is not visible
6) Check with the other preferences

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 8 Owen Leonard 2021-01-21 18:04:24 UTC
Created attachment 115584 [details] [review]
Bug 14004: Add OpacAdditionalStylesheet and opaclayoutstylesheet

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 9 Owen Leonard 2021-01-21 18:06:11 UTC
In case it helps, here are the links I tested:

/cgi-bin/koha/opac-main.pl?DISABLE_SYSPREF_OPACUserCSS=1
/cgi-bin/koha/opac-main.pl?DISABLE_SYSPREF_OPACUserJS=1
/cgi-bin/koha/mainpage.pl?DISABLE_SYSPREF_IntranetUserCSS=1
/cgi-bin/koha/mainpage.pl?DISABLE_SYSPREF_IntranetUserJS=1
/cgi-bin/koha/opac-main.pl?DISABLE_SYSPREF_OpacAdditionalStylesheet=1
/cgi-bin/koha/opac-main.pl?DISABLE_SYSPREF_opaclayoutstylesheet=1
/cgi-bin/koha/mainpage.pl?DISABLE_SYSPREF_intranetcolorstylesheet=1
/cgi-bin/koha/mainpage.pl?DISABLE_SYSPREF_intranetstylesheet=1


I also tested some doubling them up, e.g. 

/cgi-bin/koha/opac-main.pl?DISABLE_SYSPREF_opaclayoutstylesheet=1&DISABLE_SYSPREF_OPACUserJS=1
Comment 10 Katrin Fischer 2021-01-21 18:29:53 UTC
I am going to pass this. One idea for future improvement: make the syspref spelling case-insensitive!
Comment 11 Katrin Fischer 2021-01-21 18:30:19 UTC
Created attachment 115589 [details] [review]
Bug 14004: Add ability to temporarily disable JS/CSS sysprefs

It would be *super* handy if intranetuserjs and/or opacuserjs could be
temporarily disabled via a check-box or syspref.
Right now, debugging issues in intranetuserjs usuaally starts with
copying the contents into a text file, blanking the syspref and re-testing.

This patch adds this feature by setting syspref via ENV
OVERRIDE_SYSPREF like override via Apache config.

Implemented only for preferences :
OPACUserCSS OPACUserJS IntranetUserCSS IntranetUserJS
=> replaced with ' '
intranetcolorstylesheet intranetstylesheet
=> replaced with 0

Test plan :
1) Set some CSS in IntranetUserCSS like : #breadcrumbs{color:red}
2) Go to staff interface home page like : /cgi-bin/koha/mainpage.pl
3) See CSS impact is visible
4) Edit URL : /cgi-bin/koha/mainpage.pl?DISABLE_SYSPREF_IntranetUserCSS=1
5) See CSS impact is not visible
6) Check with the other preferences

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 12 Katrin Fischer 2021-01-21 18:30:23 UTC
Created attachment 115590 [details] [review]
Bug 14004: Add OpacAdditionalStylesheet and opaclayoutstylesheet

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 13 Jonathan Druart 2021-01-27 10:58:21 UTC
Why setting the env vars to 0 and " "?

I am expecting to have them set to an empty string.
Comment 14 Jonathan Druart 2021-01-27 11:04:36 UTC
Created attachment 115871 [details] [review]
Bug 14004: Set the syspref's value to an empty string

It's tested with "defined" in C4::Context->preference
Comment 15 Jonathan Druart 2021-01-27 11:21:19 UTC
Created attachment 115874 [details] [review]
Bug 14004: Set the syspref's value to an empty string

It's tested with "defined" in C4::Context->preference
Comment 16 Jonathan Druart 2021-01-27 12:03:39 UTC
Created attachment 115876 [details] [review]
Bug 14004: Set the syspref's value to an empty string

It's tested with "defined" in C4::Context->preference
Comment 17 Fridolin Somers 2021-01-27 13:12:50 UTC
Created attachment 115883 [details] [review]
Bug 14004: Set the syspref's value to an empty string

It's tested with "defined" in C4::Context->preference

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Comment 18 Jonathan Druart 2021-01-27 13:37:15 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 19 Fridolin Somers 2021-02-01 13:40:52 UTC
Small but very usefull feature, I choose to backport.

Pushed to 20.11.x for 20.11.03
Comment 20 Andrew Fuerste-Henry 2021-02-05 12:42:51 UTC
Small and useful and really no way someone's going to bump into it on accident. Backporting to 20.05.x for 20.05.09.
Comment 21 Victor Grousset/tuxayo 2021-02-09 23:10:04 UTC
> Small and useful and really no way someone's going to bump into it on accident.
Indeed !

Backported: Pushed to 19.11.x branch for 19.11.15