C4/Templates.pm has hardcoded theme
Created attachment 29556 [details] [review] Bug 12539: PROG/CCSR deprecation: Remove hardcoded theme from C4/Templates.pm This patch removes hardcoded 'prog' from themelanguage on C4/Templates.pm Now that function only provides a fallback to 'en' on active theme (opac & intranet) Also removes a test already done on themelanguage This also breaks definitely CCSR To test: 1) Apply the patch 2) CCSR is now broken, prog & bootstrap must work as usual 3) Need to test language fallback a) translate for your preferred language (xx-YY) b) enable language on opac c) go to opac, select that language d) login on opac, go to personal details e) remove koha-tmpl/opac-tmpl/bootstrap/xx-YY/modules/opac-memberentry.tt d) reload page, must load in English f) click other member options, must load on translated language (can use other pages, prog or bootstrap) 4) Do a similar test but for a staff page, enable lang, switch to it, rm koha-tmpl/intranet-tmpl/prog/xx-YY/modules/admin/admin-home.tt, any page must be translated except for admin home.
Yeah, this breaks themes, which im not sure we need to do. We can remove the ccsr and prog themes from the distribution, and change the syspref without breaking it for everyone who has their own custom theme going. I don't think we need to remove the ability to have more than one theme just to deprecate prog and ccsr I would not like to see this patch pushed as it stands My 2 cents
Created attachment 30439 [details] [review] Bug 12539: PROG/CCSR deprecation: Remove hardcoded theme from C4/Templates.pm This patch removes hardcoded 'prog' from themelanguage on C4/Templates.pm It adds a new syspref OPACFallback to hold the prefferred fallback theme for new themes with minimal changes. This does not brake CCSR if new syspref value is 'prog', using 'bootstrap' works somehow, but with strange results. To test: 1) Apply the patch 2) Run updatedatbase.pl 3) CCSR, prog & bootstrap must work as usual 4) Need to test theme/language fallback a) translate for your preferred language (xx-YY) b) enable language on opac c) go to opac, select that language d) login on opac, go to personal details e) remove koha-tmpl/opac-tmpl/bootstrap/xx-YY/modules/opac-memberentry.tt d) reload page, must load in English f) click other member options, must load on translated language (can use other pages, ccsr, prog or bootstrap) 5) Do a similar test but for a staff page, enable lang, switch to it, rm koha-tmpl/intranet-tmpl/prog/xx-YY/modules/admin/admin-home.tt, any page must be translated except for admin home.
(In reply to Chris Cormack from comment #2) > Yeah, this breaks themes, which im not sure we need to do. We can remove the > ccsr and prog themes from the distribution, and change the syspref without > breaking it for everyone who has their own custom theme going. > > I don't think we need to remove the ability to have more than one theme just > to deprecate prog and ccsr > Agreed. New version preserves the feature.
Created attachment 30481 [details] [review] Bug 12539: PROG/CCSR deprecation: Remove hardcoded theme from C4/Templates.pm This patch removes hardcoded 'prog' from themelanguage on C4/Templates.pm It adds a new syspref OPACFallback to hold the prefferred fallback theme for new themes with minimal changes. This does not brake CCSR if new syspref value is 'prog', using 'bootstrap' works somehow, but with strange results. To test: 1) Apply the patch 2) Run updatedatbase.pl 3) CCSR, prog & bootstrap must work as usual 4) Need to test theme/language fallback a) translate for your preferred language (xx-YY) b) enable language on opac c) go to opac, select that language d) login on opac, go to personal details e) remove koha-tmpl/opac-tmpl/bootstrap/xx-YY/modules/opac-memberentry.tt d) reload page, must load in English f) click other member options, must load on translated language (can use other pages, ccsr, prog or bootstrap) 5) Do a similar test but for a staff page, enable lang, switch to it, rm koha-tmpl/intranet-tmpl/prog/xx-YY/modules/admin/admin-home.tt, any page must be translated except for admin home. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
I am not sure why, but I am running into problems here: 1) removed opac-shelves.tt from the German bootstrap translation 2) switched opac to German bootstrap theme 3) tried accessing opac-shelves.pl Template process failed: file error - cssinclude: not found at /home/katrin/kohaclone/C4/Templates.pm line 131. Also and just as a note: It looks to me like the CCSR theme in master is partially broken without the patch already, Firebug shows lots of errors about missing Javascript libraries.
Created attachment 30516 [details] [review] Bug 12539: Follow up to fix fallback theme The is a problem in the logic, fallback must be: 1. Requested (theme, lang, tmpl) a. return (theme, lang, tmpl), if not b. return (fallback, lang, tmpl), if not c. return (theme, 'en', tmpl), if not as last resort d. return (fallback, 'en', tmpl) Previous patch missed option 'c', worked for CCSR but not bootstrap, sorry.
(In reply to Katrin Fischer from comment #6) > I am not sure why, but I am running into problems here: > > 1) removed opac-shelves.tt from the German bootstrap translation > 2) switched opac to German bootstrap theme > 3) tried accessing opac-shelves.pl > > Template process failed: file error - cssinclude: not found at > /home/katrin/kohaclone/C4/Templates.pm line 131. > Katrin, the followup fix the problem, no sure about the correct status. Switched to Need Signoff
Created attachment 31224 [details] [review] Bug 12539: PROG/CCSR deprecation: Remove hardcoded theme from C4/Templates.pm This patch removes hardcoded 'prog' from themelanguage on C4/Templates.pm It adds a new syspref OPACFallback to hold the prefferred fallback theme for new themes with minimal changes. This does not brake CCSR if new syspref value is 'prog', using 'bootstrap' works somehow, but with strange results. To test: 1) Apply the patch 2) Run updatedatbase.pl 3) CCSR, prog & bootstrap must work as usual 4) Need to test theme/language fallback a) translate for your preferred language (xx-YY) b) enable language on opac c) go to opac, select that language d) login on opac, go to personal details e) remove koha-tmpl/opac-tmpl/bootstrap/xx-YY/modules/opac-memberentry.tt d) reload page, must load in English f) click other member options, must load on translated language (can use other pages, ccsr, prog or bootstrap) 5) Do a similar test but for a staff page, enable lang, switch to it, rm koha-tmpl/intranet-tmpl/prog/xx-YY/modules/admin/admin-home.tt, any page must be translated except for admin home. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
sorry, missed my SO message
Created attachment 31225 [details] [review] Bug 12539: PROG/CCSR deprecation: Remove hardcoded theme from C4/Templates.pm This patch removes hardcoded 'prog' from themelanguage on C4/Templates.pm It adds a new syspref OPACFallback to hold the prefferred fallback theme for new themes with minimal changes. This does not brake CCSR if new syspref value is 'prog', using 'bootstrap' works somehow, but with strange results. To test: 1) Apply the patch 2) Run updatedatbase.pl 3) CCSR, prog & bootstrap must work as usual 4) Need to test theme/language fallback a) translate for your preferred language (xx-YY) b) enable language on opac c) go to opac, select that language d) login on opac, go to personal details e) remove koha-tmpl/opac-tmpl/bootstrap/xx-YY/modules/opac-memberentry.tt d) reload page, must load in English f) click other member options, must load on translated language (can use other pages, ccsr, prog or bootstrap) 5) Do a similar test but for a staff page, enable lang, switch to it, rm koha-tmpl/intranet-tmpl/prog/xx-YY/modules/admin/admin-home.tt, any page must be translated except for admin home. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Petter Goksoyr Asen <boutrosboutrosboutros@gmail.com>
Created attachment 31226 [details] [review] Bug 12539: Follow up to fix fallback theme The is a problem in the logic, fallback must be: 1. Requested (theme, lang, tmpl) a. return (theme, lang, tmpl), if not b. return (fallback, lang, tmpl), if not c. return (theme, 'en', tmpl), if not as last resort d. return (fallback, 'en', tmpl) Previous patch missed option 'c', worked for CCSR but not bootstrap, sorry. Signed-off-by: Petter Goksoyr Asen <boutrosboutrosboutros@gmail.com>
Rebased updatedatabase.pl. Followed test plan. Removed Norwegian template files on OPAC and intranet - fallback to English works, in all themes, with no issues.
When I remove koha-tmpl/opac-tmpl/bootstrap/fr-FR/modules/opac-memberentry.tt I got Template process failed: file error - cssinclude: not found at /home/koha/src/C4/Templates.pm line 131. What I missed?
(In reply to Jonathan Druart from comment #14) > When I remove > koha-tmpl/opac-tmpl/bootstrap/fr-FR/modules/opac-memberentry.tt > I got > > Template process failed: file error - cssinclude: not found at > /home/koha/src/C4/Templates.pm line 131. > > What I missed? Have you changed OPACFallback to 'bootstrap'? Default value is 'prog', but in this case you need to change it to 'bootstrap' With that it works for me, shows english page.
(In reply to Bernardo Gonzalez Kriegel from comment #15) > Have you changed OPACFallback to 'bootstrap'? > Default value is 'prog', but in this case you need to change it to > 'bootstrap' > With that it works for me, shows english page. The pref is set to prog. I was expecting to get the prog page, but it would have been quite weird indeed.
Created attachment 31295 [details] [review] Bug 12539: PROG/CCSR deprecation: Remove hardcoded theme from C4/Templates.pm This patch removes hardcoded 'prog' from themelanguage on C4/Templates.pm It adds a new syspref OPACFallback to hold the prefferred fallback theme for new themes with minimal changes. This does not brake CCSR if new syspref value is 'prog', using 'bootstrap' works somehow, but with strange results. To test: 1) Apply the patch 2) Run updatedatbase.pl 3) CCSR, prog & bootstrap must work as usual 4) Need to test theme/language fallback a) translate for your preferred language (xx-YY) b) enable language on opac c) go to opac, select that language d) login on opac, go to personal details e) remove koha-tmpl/opac-tmpl/bootstrap/xx-YY/modules/opac-memberentry.tt d) reload page, must load in English f) click other member options, must load on translated language (can use other pages, ccsr, prog or bootstrap) 5) Do a similar test but for a staff page, enable lang, switch to it, rm koha-tmpl/intranet-tmpl/prog/xx-YY/modules/admin/admin-home.tt, any page must be translated except for admin home. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Petter Goksoyr Asen <boutrosboutrosboutros@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Created attachment 31296 [details] [review] Bug 12539: Follow up to fix fallback theme The is a problem in the logic, fallback must be: 1. Requested (theme, lang, tmpl) a. return (theme, lang, tmpl), if not b. return (fallback, lang, tmpl), if not c. return (theme, 'en', tmpl), if not as last resort d. return (fallback, 'en', tmpl) Previous patch missed option 'c', worked for CCSR but not bootstrap, sorry. Signed-off-by: Petter Goksoyr Asen <boutrosboutrosboutros@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
The changes in C4::Templates should have provided unit tests. But I did not manage to write them.
Pushed to MM_OPAC/theme_dep
Patches merged into master. Thanks Bernardo!