From afa8db75fc9cb502878627f87f7af91d3b1a12c6 Mon Sep 17 00:00:00 2001 From: arensb Date: Thu, 10 Oct 2002 05:32:20 +0000 Subject: [PATCH] Added some FIXMEs. Made code more Perlish. (bug fix): Allow whitespace in $HTTP_ACCEPT_LANGUAGE (Konqueror uses ", " as language separator). --- C4/Output.pm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/C4/Output.pm b/C4/Output.pm index 5bfbda6836..837e8b4066 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -28,6 +28,7 @@ require Exporter; use C4::Context; use C4::Database; use C4::Search; #for getting the systempreferences + # FIXME - Get rid of this, and use C4::Context->preference use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); @@ -228,6 +229,8 @@ document. =cut #' +# FIXME - Fix POD: it doesn't look in the directory given by the +# 'includes' option in /etc/koha.conf. sub pathtotemplate { my %params = @_; my $template = $params{'template'}; @@ -255,15 +258,12 @@ sub pathtotemplate { unshift (@tmpldirs, C4::Context->config('templatedirectory')) if C4::Context->config('templatedirectory'); unshift (@tmpldirs, $params{'path'}) if $params{'path'}; - my ($edir, $etheme, $elanguage, $epath); + my ($etheme, $elanguage, $epath); - # FIXME - Use 'foreach my $var (...)' - CHECK: foreach (@tmpldirs) { - $edir= $_; - foreach ($theme, 'all', 'default') { - $etheme=$_; - foreach ($language, @languageorder, 'all','en') { # 'en' is the fallback-language - $elanguage = $_; + CHECK: foreach my $edir (@tmpldirs) { + foreach $etheme ($theme, 'all', 'default') { + foreach $elanguage ($language, @languageorder, 'all','en') { + # 'en' is the fallback-language if (-e "$edir/$type$etheme/$elanguage/$template") { $epath = "$edir/$type$etheme/$elanguage/$template"; last CHECK; @@ -312,9 +312,9 @@ sub getlanguageorder () { my %prefs = systemprefs(); if ($ENV{'HTTP_ACCEPT_LANGUAGE'}) { - @languageorder = split (/,/ ,lc($ENV{'HTTP_ACCEPT_LANGUAGE'})); + @languageorder = split (/\s*,\s*/ ,lc($ENV{'HTTP_ACCEPT_LANGUAGE'})); } elsif ($prefs{'languageorder'}) { - @languageorder = split (/,/ ,lc($prefs{'languageorder'})); + @languageorder = split (/\s*,\s*/ ,lc($prefs{'languageorder'})); } else { # here should be another elsif checking for apache's languageorder @languageorder = ('en'); } -- 2.39.5