web installer: defaults for untranslated SQL scripts
authorGalen Charlton <galen.charlton@liblime.com>
Thu, 21 Feb 2008 17:23:52 +0000 (11:23 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Thu, 21 Feb 2008 17:26:27 +0000 (11:26 -0600)
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 <jmf@liblime.com>
installer/install.pl
koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tmpl

index c88e742..637594b 100755 (executable)
@@ -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");    
index d3ed6ea..9a4eb90 100644 (file)
     
     <!--TMPL_IF Name="frameworksloop"-->
     <h2>MARC Frameworks: <!--TMPL_VAR Name="marcflavour"--></h2>
+    <!-- TMPL_IF Name="en_marc_frameworks" -->
+        <h4><span class="error">No MARC frameworks are available for your language.  
+                Defaulting to the frameworks supplied for English (en)<span></h4>
+    <!-- /TMPL_IF -->
     <!--TMPL_LOOP Name="frameworksloop"-->
     <div>
     <h3><!--TMPL_VAR Name="label"--></h3>
     <!--/TMPL_LOOP-->
     <h2>Other data</h2>
     <!--/TMPL_IF -->
+    <!-- TMPL_IF Name="en_sample_data" -->
+        <h4><span class="error">No sample data and settings are available for your language.  
+                Defaulting to the samples supplied for English (en)<span></h4>
+    <!-- /TMPL_IF -->
     <!--TMPL_LOOP Name="levelloop"-->
     <div>
     <h3><!--TMPL_VAR Name="label"--></h3>