From bd0617fb0dacf138c17fecc14033bd37554269dd Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 21 Feb 2008 11:23:52 -0600 Subject: [PATCH] web installer: defaults for untranslated SQL scripts TODO: make more sophisticated by checking for frameworks/sample data that have been translated to the selected language, just a different location. Signed-off-by: Joshua Ferraro --- installer/install.pl | 35 +++++++++++++++++-- .../prog/en/modules/installer/step3.tmpl | 8 +++++ 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/installer/install.pl b/installer/install.pl index c88e742344..637594b263 100755 --- a/installer/install.pl +++ b/installer/install.pl @@ -420,7 +420,17 @@ elsif ( $step && $step == 3 ) { undef $/; my $dir = C4::Context->config('intranetdir') . "/installer/data/$info{dbms}/$langchoice/marcflavour/".lc($marcflavour); - opendir( MYDIR, $dir ) || warn "no open $dir"; + unless (opendir( MYDIR, $dir )) { + if ($langchoice eq 'en') { + warn "cannot open MARC frameworks directory $dir"; + } else { + # if no translated MARC framework is available, + # default to English + $dir = C4::Context->config('intranetdir') . "/installer/data/$info{dbms}/en/marcflavour/".lc($marcflavour); + opendir(MYDIR, $dir) or warn "cannot open English MARC frameworks directory $dir"; + $template->param('en_marc_frameworks' => 1); + } + } my @listdir = sort grep { !/^\.|marcflavour/ && -d "$dir/$_" } readdir(MYDIR); closedir MYDIR; @@ -480,7 +490,17 @@ elsif ( $step && $step == 3 ) { $dir = C4::Context->config('intranetdir') . "/installer/data/$info{dbms}/$langchoice"; - opendir( MYDIR, $dir ) || warn "no open $dir"; + unless (opendir( MYDIR, $dir )) { + if ($langchoice eq 'en') { + warn "cannot open sample data directory $dir"; + } else { + # if no sample data is available, + # default to English + $dir = C4::Context->config('intranetdir') . "/installer/data/$info{dbms}/en"; + opendir(MYDIR, $dir) or warn "cannot open English sample data directory $dir"; + $template->param('en_sample_data' => 1); + } + } @listdir = sort grep { !/^\.|marcflavour/ && -d "$dir/$_" } readdir(MYDIR); closedir MYDIR; my @levellist; @@ -547,7 +567,16 @@ elsif ( $step && $step == 3 ) { $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice); my $dir = C4::Context->config('intranetdir') . "/installer/data/$info{dbms}/$langchoice/marcflavour"; - opendir( MYDIR, $dir ) || warn "no open $dir"; + unless (opendir( MYDIR, $dir )) { + if ($langchoice eq 'en') { + warn "cannot open MARC frameworks directory $dir"; + } else { + # if no translated MARC framework is available, + # default to English + $dir = C4::Context->config('intranetdir') . "/installer/data/$info{dbms}/en/marcflavour"; + opendir(MYDIR, $dir) or warn "cannot open English MARC frameworks directory $dir"; + } + } my @listdir = grep { !/^\./ && -d "$dir/$_" } readdir(MYDIR); closedir MYDIR; my $marcflavour=C4::Context->preference("marcflavour"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tmpl index d3ed6ea280..9a4eb90df0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tmpl @@ -108,6 +108,10 @@

MARC Frameworks:

+ +

No MARC frameworks are available for your language. + Defaulting to the frameworks supplied for English (en)

+

@@ -132,6 +136,10 @@

Other data

+ +

No sample data and settings are available for your language. + Defaulting to the samples supplied for English (en)

+

-- 2.39.5