Bugzilla – Attachment 29556 Details for
Bug 12539
PROG/CCSR deprecation: Remove hardcoded theme from C4/Templates.pm
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12539: PROG/CCSR deprecation: Remove hardcoded theme from C4/Templates.pm
Bug-12539-PROGCCSR-deprecation-Remove-hardcoded-th.patch (text/plain), 3.41 KB, created by
Bernardo Gonzalez Kriegel
on 2014-07-07 20:21:35 UTC
(
hide
)
Description:
Bug 12539: PROG/CCSR deprecation: Remove hardcoded theme from C4/Templates.pm
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2014-07-07 20:21:35 UTC
Size:
3.41 KB
patch
obsolete
>From cbd681a20c7dea4c3b5d39638eda1351d720fb5f Mon Sep 17 00:00:00 2001 >From: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Date: Mon, 7 Jul 2014 15:30:02 -0300 >Subject: [PATCH] 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. >--- > C4/Templates.pm | 31 ++++++++++++------------------- > 1 file changed, 12 insertions(+), 19 deletions(-) > >diff --git a/C4/Templates.pm b/C4/Templates.pm >index b326f53..5d31f96 100644 >--- a/C4/Templates.pm >+++ b/C4/Templates.pm >@@ -202,13 +202,8 @@ sub _get_template_file { > my $is_intranet = $interface eq 'intranet'; > my $htdocs = C4::Context->config($is_intranet ? 'intrahtdocs' : 'opachtdocs'); > my ($theme, $lang, $availablethemes) = themelanguage($htdocs, $tmplbase, $interface, $query); >- >- # if the template doesn't exist, load the English one as a last resort > my $filename = "$htdocs/$theme/$lang/modules/$tmplbase"; >- unless (-f $filename) { >- $lang = 'en'; >- $filename = "$htdocs/$theme/$lang/modules/$tmplbase"; >- } >+ > return ($htdocs, $theme, $lang, $filename); > } > >@@ -266,6 +261,7 @@ sub gettemplate { > > #--------------------------------------------------------------------------------------------------------- > # FIXME - POD >+# FIXME - Rewritten to remove hardcoded theme with minimal changes, need to be rethinked > sub themelanguage { > my ($htdocs, $tmpl, $interface, $query) = @_; > ($query) or warn "no query in themelanguage"; >@@ -273,20 +269,17 @@ sub themelanguage { > # Select a language based on cookie, syspref available languages & browser > my $lang = C4::Languages::getlanguage($query); > >- # Select theme >- my $is_intranet = $interface eq 'intranet'; >- my @themes = split(" ", C4::Context->preference( >- $is_intranet ? "template" : "opacthemes" )); >- push @themes, 'prog'; >- >- # Try to find first theme for the selected language >- for my $theme (@themes) { >- if ( -e "$htdocs/$theme/$lang/modules/$tmpl" ) { >- return ($theme, $lang, \@themes) >- } >+ # Get theme >+ my $theme = C4::Context->preference( ($interface eq 'intranet') ? 'template' : 'opacthemes' ); >+ my @themes = ($theme); >+ >+ # Return theme for selected language, otherwise return same theme for English 'en' >+ if ( -e "$htdocs/$theme/$lang/modules/$tmpl" ) { >+ return ($theme, $lang, \@themes); >+ } >+ else { >+ return ($theme, 'en', \@themes); > } >- # Otherwise, return prog theme in English 'en' >- return ('prog', 'en', \@themes); > } > > >-- >1.7.9.5
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 12539
:
29556
|
30439
|
30481
|
30516
|
31224
|
31225
|
31226
|
31295
|
31296