- my $langchoice = $query->param('fwklanguage') ||
- $query->cookie('KohaOpacLanguage') ;
- my $dir = C4::Context->config('intranetdir') . "/installer/data/";
- opendir( MYDIR, $dir );
- my @listdir = grep { !/^\.|CVS/ && -d "$dir/$_" } readdir(MYDIR);
- closedir MYDIR;
- my $frmwklangs = getFrameworkLanguages();
- my @languages;
- map { # inappropriate use of map in void context
- push @languages,
- {
- 'dirname' => $_->{'language_code'},
- 'languagedescription' => $_->{'language_name'},
- 'checked' => ( $_->{'language_code'} eq $langchoice )
- }
- if ( $_->{'language_code'} );
- } @$frmwklangs;
- $template->param( "languagelist" => \@languages );
- undef $/;
- $dir = C4::Context->config('intranetdir') . "/installer/data/$langchoice";
- opendir ( MYDIR, $dir ) or warn "Cannot read directory $dir";
- @listdir = sort grep { !/^\.|CVS/ && -d "$dir/$_" } readdir(MYDIR);
- closedir MYDIR;
- my @levellist;
- my $request = $dbh->prepare(
- "SELECT value FROM systempreferences WHERE variable='FrameworksLoaded'"
- );
- $request->execute;
- my ($frameworksloaded) = $request->fetchrow;
- my %frameworksloaded;
-
- foreach ( split( /\|/, $frameworksloaded ) ) {
- $frameworksloaded{$_} = 1;
+ my $langchoice = $query->param('fwklanguage');
+ $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice);
+ my $marcflavour = $query->param('marcflavour');
+ if ($marcflavour){
+ $installer->set_marcflavour_syspref($marcflavour);
+ };
+ $marcflavour = C4::Context->preference('marcflavour') unless ($marcflavour);
+ #Insert into database the selected marcflavour
+ undef $/;
+ my ($marc_defaulted_to_en, $fwklist) = $installer->marc_framework_sql_list($langchoice, $marcflavour);
+ $template->param('en_marc_frameworks' => $marc_defaulted_to_en);
+ $template->param( "frameworksloop" => $fwklist );
+ $template->param( "marcflavour" => ucfirst($marcflavour));
+
+ my ($sample_defaulted_to_en, $levellist) = $installer->sample_data_sql_list($langchoice, $marcflavour);
+ $template->param( "en_sample_data" => $sample_defaulted_to_en);
+ $template->param( "levelloop" => $levellist );
+ $template->param( "$op" => 1 );
+ }
+ elsif ( $op && $op eq 'choosemarc' ) {
+ #
+ #
+ # 1ST install, 2nd sub-step : show the user the marcflavour available.
+ #
+ #
+
+ #Choose Marc Flavour
+ #sql data are supposed to be located in installer/data/<dbms>/<language>/marcflavour/marcflavourname
+ # Where <dbms> is database type according to DBD syntax
+ # Where <language> is en|fr or any international abbreviation (provided language hash is updated... This will be a problem with internationlisation.)
+ # Where <level> is a category of requirement : required, recommended optional
+ # level should contain :
+ # SQL File for import With a readable name.
+ # txt File taht explains what this SQL File is meant for.
+ # Could be VERY useful to have A Big file for a kind of library.
+ # But could also be useful to have some Authorised values data set prepared here.
+ # Marcflavour Selection is achieved through radiobuttons.
+ my $langchoice = $query->param('fwklanguage');
+ $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice);
+ my $dir =
+ C4::Context->config('intranetdir') . "/installer/data/$info{dbms}/$langchoice/marcflavour";
+ 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";
+ }