X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fadmin.pl;h=3fba37cc8ccbdb757f37399eeeeb17481c743080;hb=6ebad56e58db857141565f397c555524cba43109;hp=e478d6ba1f68e86c657c61b9711272ef8b7856c2;hpb=2d6988532a665bd7e42bb88a38a8b52cbb352646;p=kivitendo-erp.git diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl index e478d6ba1..3fba37cc8 100644 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -36,10 +36,19 @@ $menufile = "menu.ini"; use DBI; use CGI; +use POSIX qw(strftime); +use IO::File; +use Fcntl; +use English qw(-no_match_vars); +use Sys::Hostname; use SL::Form; +use SL::Mailer; use SL::User; use SL::Common; +use SL::Inifile; +use SL::DBUpgrade2; +use SL::DBUtils; require "bin/mozilla/common.pl"; @@ -70,7 +79,7 @@ if ($form->{action}) { } } - &check_password; + check_password(); call_sub($subroutine); @@ -82,7 +91,7 @@ if ($form->{action}) { # create memberfile if (!-f $memberfile) { - open(FH, ">$memberfile") or $form->error("$memberfile : $!"); + open(FH, ">$memberfile") or $form->error("$memberfile : $ERRNO"); print FH qq|# SQL-Ledger Accounting members [root login] @@ -92,7 +101,7 @@ password= close FH; } - &adminlogin; + adminlogin(); } @@ -106,7 +115,7 @@ sub adminlogin { qq|Lx-Office ERP $form->{version} | . $locale->text('Administration'); $form->header(); - print $form->parse_html_template('admin/adminlogin'); + print $form->parse_html_template2('admin/adminlogin'); } sub login { @@ -117,7 +126,7 @@ sub list_users { $form->error($locale->text('File locked!')) if (-f "${memberfile}.LCK"); - open(FH, "$memberfile") or $form->error("$memberfile : $!"); + open(FH, "$memberfile") or $form->error("$memberfile : $ERRNO"); my %members; @@ -146,7 +155,7 @@ sub list_users { $form->{MEMBERS} = [ @members{sort { lc $a cmp lc $b } keys %members} ]; $form->header(); - print $form->parse_html_template("admin/list_users"); + print $form->parse_html_template2("admin/list_users"); } sub add_user { @@ -156,22 +165,16 @@ sub add_user { . $locale->text('Administration') . " / " . $locale->text('Add User'); - $form->{Oracle_sid} = $sid; - $form->{Oracle_dbport} = '1521'; - $form->{Oracle_dbhost} = `hostname`; - - if (-f "css/lx-office-erp.css") { - $myconfig->{stylesheet} = "lx-office-erp.css"; - } - - $myconfig->{vclimit} = 200; - $myconfig->{countrycode} = "de"; - $myconfig->{numberformat} = "1000,00"; - $myconfig->{dateformat} = "dd.mm.yy"; - - &form_header; - &form_footer; + my $myconfig = { + "vclimit" => 200, + "countrycode" => "de", + "numberformat" => "1.000,00", + "dateformat" => "dd.mm.yy", + "stylesheet" => "lx-office-erp.css", + "menustyle" => "v3", + }; + edit_user_form($myconfig); } sub edit { @@ -182,91 +185,46 @@ sub edit { . $locale->text('Edit User'); $form->{edit} = 1; - &form_header; - &form_footer; - -} - -sub form_footer { - - if ($form->{edit}) { - $delete = - qq| -|; - } - - print qq| + $form->isblank("login", $locale->text("The login is missing.")); - -{rpw}> + # get user + my $myconfig = new User "$memberfile", "$form->{login}"; - -$delete + $myconfig->{signature} =~ s/\\n/\r\n/g; + $myconfig->{address} =~ s/\\n/\r\n/g; - - - - -|; + # strip basedir from templates directory + $myconfig->{templates} =~ s|.*/||; + edit_user_form($myconfig); } -sub form_header { - - # if there is a login, get user - if ($form->{login}) { - - # get user - $myconfig = new User "$memberfile", "$form->{login}"; - - $myconfig->{signature} =~ s/\\n/\r\n/g; - $myconfig->{address} =~ s/\\n/\r\n/g; +sub edit_user_form { + my ($myconfig) = @_; - # strip basedir from templates directory - $myconfig->{templates} =~ s/^$templates\///; - - # $myconfig->{dbpasswd} = unpack 'u', $myconfig->{dbpasswd}; - } - - foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) { - $dateformat .= - ($item eq $myconfig->{dateformat}) - ? "