- my ($myconfig) = @_;
-
- my $form = $main::form;
- my $locale = $main::locale;
-
- my @valid_dateformats = qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd);
- $form->{ALL_DATEFORMATS} = [ map { { "format" => $_, "selected" => $_ eq $myconfig->{dateformat} } } @valid_dateformats ];
-
- my @valid_numberformats = ('1,000.00', '1000.00', '1.000,00', '1000,00');
- $form->{ALL_NUMBERFORMATS} = [ map { { "format" => $_, "selected" => $_ eq $myconfig->{numberformat} } } @valid_numberformats ];
-
- my %countrycodes = User->country_codes;
- $form->{ALL_COUNTRYCODES} = [];
- foreach my $countrycode (sort { $countrycodes{$a} cmp $countrycodes{$b} } keys %countrycodes) {
- push @{ $form->{ALL_COUNTRYCODES} }, { "value" => $countrycode,
- "name" => $countrycodes{$countrycode},
- "selected" => $countrycode eq $myconfig->{countrycode} };
- }
-
- # is there a templates basedir
- if (!-d "$main::templates") {
- $form->error(sprintf($locale->text("The directory %s does not exist."), $main::templates));
- }
-
- opendir TEMPLATEDIR, "$main::templates/." or $form->error("$main::templates : $ERRNO");
- my @all = readdir(TEMPLATEDIR);
- my @alldir = sort grep { -d "$main::templates/$_" && !/^\.\.?$/ } @all;
- my @allhtml = sort grep { -f "$main::templates/$_" && /\.html$/ } @all;
- closedir TEMPLATEDIR;
-
- @alldir = grep !/\.(html|tex|sty|odt|xml|txb)$/, @alldir;
- @alldir = grep !/^(webpages|cache|\.svn)$/, @alldir;
-
- @allhtml = reverse grep !/Default/, @allhtml;
- push @allhtml, 'Default';
- @allhtml = reverse @allhtml;
-
- $form->{ALL_TEMPLATES} = [ map { { "name", => $_, "selected" => $_ eq $myconfig->{templates} } } @alldir ];
-
- my $lastitem = $allhtml[0];
- $lastitem =~ s/-.*//g;
- $form->{ALL_MASTER_TEMPLATES} = [ { "name" => $lastitem, "selected" => $lastitem eq "German" } ];
- foreach my $item (@allhtml) {
- $item =~ s/-.*//g;
- next if ($item eq $lastitem);
-
- push @{ $form->{ALL_MASTER_TEMPLATES} }, { "name" => $item, "selected" => $item eq "German" };
- $lastitem = $item;
- }
-
- # css dir has styles that are not intended as general layouts.
- # reverting to hardcoded list
- $form->{ALL_STYLESHEETS} = [ map { { "name" => $_, "selected" => $_ eq $myconfig->{stylesheet} } } qw(lx-office-erp.css Win2000.css) ];
-
- $form->{"menustyle_" . $myconfig->{menustyle} } = 1;
-
- map { $form->{"myc_${_}"} = $myconfig->{$_} } keys %{ $myconfig };