[Koha-patches] [PATCH 4/4] bug 4403: look in appropriate theme/lang for bib display XSL

Galen Charlton gmcharlt at gmail.com
Sun May 9 01:01:39 CEST 2010


Note: approach used can be described as a hack at best; the current
language should probably become a session attribute.

Signed-off-by: Galen Charlton <gmcharlt at gmail.com>
---
 C4/Output.pm |   13 +++++++++++++
 C4/XSLT.pm   |    9 +++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/C4/Output.pm b/C4/Output.pm
index b512f30..49a0ff0 100644
--- a/C4/Output.pm
+++ b/C4/Output.pm
@@ -134,6 +134,17 @@ sub gettemplate {
     return $template;
 }
 
+# FIXME - this is a horrible hack to cache
+# the current known-good language, temporarily
+# put in place to resolve bug 4403.  It is
+# used only by C4::XSLT::XSLTParse4Display;
+# the language is set via the usual call
+# to themelanguage.
+my $_current_language = 'en';
+sub _current_language {
+    return $_current_language;
+}
+
 #---------------------------------------------------------------------------------------------------------
 # FIXME - POD
 sub themelanguage {
@@ -193,6 +204,8 @@ sub themelanguage {
             #}
         }
     }
+
+    $_current_language = $lang; # FIXME part of bad hack to paper over bug 4403
     return ( $theme, $lang );
 }
 
diff --git a/C4/XSLT.pm b/C4/XSLT.pm
index e67aa54..6fd93b4 100644
--- a/C4/XSLT.pm
+++ b/C4/XSLT.pm
@@ -27,6 +27,7 @@ use C4::Koha;
 use C4::Biblio;
 use C4::Circulation;
 use C4::Reserves;
+use C4::Output qw//;
 use Encode;
 use XML::LibXML;
 use XML::LibXSLT;
@@ -146,12 +147,16 @@ sub XSLTParse4Display {
         my $xslfile;
         if ($interface eq 'intranet') {
             $xslfile = C4::Context->config('intrahtdocs') . 
-                      "/prog/en/xslt/" .
+                      '/' . C4::Context->preference("template") . 
+                      '/' . C4::Output::_current_language() .
+                      '/xslt/' .
                       C4::Context->preference('marcflavour') .
                       "slim2intranet$xsl_suffix.xsl";
         } else {
             $xslfile = C4::Context->config('opachtdocs') . 
-                      "/prog/en/xslt/" .
+                      '/' . C4::Context->preference("opacthemes") . 
+                      '/' . C4::Output::_current_language() .
+                      '/xslt/' .
                       C4::Context->preference('marcflavour') .
                       "slim2OPAC$xsl_suffix.xsl";
         }
-- 
1.7.0




More information about the Koha-patches mailing list