X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/a6199e53215a8519f45bf5a751d0ea2bb8b8574e..296b4f44a5ba0b3d3a172c8de4c884b34737a33d:/bin/mozilla/admin.pl diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl index 4e33ef200..20e5be24d 100644 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -105,51 +105,48 @@ sub adminlogin { $form->{title} = qq|Lx-Office ERP $form->{version} | . $locale->text('Administration'); - $form->header; - - print qq| - - + $form->header(); + print $form->parse_html_template('admin/adminlogin'); +} -
+sub login { + list_users(); +} - -

| - . $locale->text('Version') - . qq| $form->{version}

| - . $locale->text('Administration') - . qq|

+sub list_users { -
+ $form->error($locale->text('File locked!')) if (-f "${memberfile}.LCK"); - - - - - - - -
| . $locale->text('Password') . qq|
+ open(FH, "$memberfile") or $form->error("$memberfile : $!"); + my %members; -
+ while () { + chomp; -Lx-Office | - . $locale->text('website') . qq| + if (/^\[.*\]/) { + $login = $_; + $login =~ s/(\[|\])//g; -
+ $members{$login} = { "login" => $login }; + } - - -|; + if (/^([a-z]+)=(.*)/) { + $members{$login}->{$1} = $2; + } + } -} + close(FH); -sub login { + delete $members{"root login"}; + map { $_->{templates} =~ s|.*/||; } values %members; - &list_users; + $form->{title} = "Lx-Office ERP " . $locale->text('Administration'); + $form->{LOCKED} = -e "$userspath/nologin"; + $form->{MEMBERS} = [ @members{sort { lc $a cmp lc $b } keys %members} ]; + $form->header(); + print $form->parse_html_template("admin/list_users"); } sub add_user { @@ -166,11 +163,11 @@ sub add_user { 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"; + $myconfig->{vclimit} = 200; + $myconfig->{countrycode} = "de"; + $myconfig->{numberformat} = "1000,00"; + $myconfig->{dateformat} = "dd.mm.yy"; &form_header; &form_footer; @@ -216,180 +213,6 @@ $delete } -sub list_users { - - $form->error($locale->text('File locked!')) if (-f "${memberfile}.LCK"); - - open(FH, "$memberfile") or $form->error("$memberfile : $!"); - - $nologin = qq| -|; - - if (-e "$userspath/nologin") { - $nologin = qq| -|; - } - - while () { - chop; - - if (/^\[.*\]/) { - $login = $_; - $login =~ s/(\[|\])//g; - } - - if (/^(name=|company=|templates=|dbuser=|dbdriver=|dbname=|dbhost=)/) { - chop($var = $&); - ($null, $member{$login}{$var}) = split(/=/, $_, 2); - } - } - - close(FH); - - # type=submit $locale->text('Pg Database Administration') - # type=submit $locale->text('Oracle Database Administration') - - foreach $item (User->dbdrivers) { - $dbdrivers .= - qq||; - } - - $column_header{login} = qq|| . $locale->text('Login') . qq||; - $column_header{name} = qq|| . $locale->text('Name') . qq||; - $column_header{company} = qq|| . $locale->text('Company') . qq||; - $column_header{dbdriver} = qq|| . $locale->text('Driver') . qq||; - $column_header{dbhost} = qq|| . $locale->text('Host') . qq||; - $column_header{dataset} = qq|| . $locale->text('Dataset') . qq||; - $column_header{templates} = - qq|| . $locale->text('Templates') . qq||; - - @column_index = qw(login name company dbdriver dbhost dataset templates); - - $form->{title} = "Lx-Office ERP " . $locale->text('Administration'); - - $form->header; - - print qq| - - -
{script}> - - - - - - - - - - - - - -
$form->{title}
- - |; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - foreach $key (sort keys %member) { - $href = - "$script?action=edit&login=$key&rpw=$form->{rpw}"; - $href =~ s/ /%20/g; - - $member{$key}{templates} =~ s/^$templates\///; - $member{$key}{dbhost} = $locale->text('localhost') - unless $member{$key}{dbhost}; - $member{$key}{dbname} = $member{$key}{dbuser} - if ($member{$key}{dbdriver} eq 'Oracle'); - - $column_data{login} = qq||; - $column_data{name} = qq||; - $column_data{company} = qq||; - $column_data{dbdriver} = qq||; - $column_data{dbhost} = qq||; - $column_data{dataset} = qq||; - $column_data{templates} = qq||; - - $i++; - $i %= 2; - print qq| - |; - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - |; - } - - print qq| -
$key$member{$key}{name}$member{$key}{company}$member{$key}{dbdriver}$member{$key}{dbhost}$member{$key}{dbname}$member{$key}{templates}
-

- -{rpw}> - -
- - -$dbdrivers -$nologin - -
- -| . $locale->text('Click on login name to edit!') . qq| -
-| - . $locale->text( - 'To add a user to a group edit a name, change the login name and save. A new user with the same variables will then be saved under the new login name.' - ) - . qq| - -

- -

- - - - - - - - -
Lx-Office ERP | . $locale->text('Login') . qq|
- - - - - - - - - - - -
| . $locale->text('Name') . qq| 
| . $locale->text('Password') . qq|
-
- -
- -
- - - -|; - -} - sub form_header { # if there is a login, get user @@ -1121,39 +944,8 @@ sub change_admin_password { . $locale->text('Administration') . " / " . $locale->text('Change Admin Password'); - $form->header; - - print qq| - - - -

| . $locale->text('Change Admin Password') . qq|

- -
{script}> - - - - - - - - - - -
| . $locale->text('Password') . qq|
| . $locale->text('Repeat the password') . qq|
- -{rpw}> - -

- - -

- - - -|; - + $form->header(); + print $form->parse_html_template("admin/change_admin_password"); } sub change_password { @@ -1163,17 +955,8 @@ sub change_password { . $locale->text('Administration') . " / " . $locale->text('Change Admin Password'); - $form->header; - - print qq| - - - -

| . $locale->text('Change Admin Password') . qq|

- -

| . $locale->text("The passwords do not match.") . qq|
-|; - return; + $form->header(); + $form->error($locale->text("The passwords do not match.")); } $root->{password} = $form->{password}; @@ -1185,7 +968,6 @@ sub change_password { "$form->{script}?action=list_users&rpw=$root->{password}"; $form->redirect($locale->text('Password changed!')); - } sub check_password { @@ -1456,124 +1238,40 @@ qq|">| . $locale->text("Continue") . qq||; } sub create_dataset { + $form->{dbsources} = join " ", map { "[${_}]" } sort User->dbsources(\%$form); - foreach $item (sort User->dbsources(\%$form)) { - $dbsources .= "[$item] "; - } + $form->{CHARTS} = []; opendir SQLDIR, "sql/." or $form - error($!); foreach $item (sort grep /-chart\.sql\z/, readdir SQLDIR) { next if ($item eq 'Default-chart.sql'); $item =~ s/-chart\.sql//; - push @charts, - qq|  $item|; + push @{ $form->{CHARTS} }, { "name" => $item, + "selected" => $item eq "Germany-DATEV-SKR03EU" }; } closedir SQLDIR; - my (@values, %labels); - my $default_charset = $dbcharset; $default_charset ||= Common::DEFAULT_CHARSET; - my $default_encoding; - foreach my $encoding (@Common::db_encodings) { - push @values, $encoding->{dbencoding}; - $labels{$encoding->{dbencoding}} = $encoding->{label}; + $form->{DBENCODINGS} = []; - $default_encoding = $encoding->{dbencoding} if $encoding->{charset} eq $default_charset; + foreach my $encoding (@Common::db_encodings) { + push @{ $form->{DBENCODINGS} }, { "dbencoding" => $encoding->{dbencoding}, + "label" => $encoding->{label}, + "selected" => $encoding->{charset} eq $default_charset }; } - $selectencoding = - NTI($cgi->popup_menu('-name' => 'encoding', - '-values' => \@values, - '-labels' => \%labels, - '-default' => $default_encoding)); - $form->{title} = "Lx-Office ERP " . $locale->text('Database Administration') . " / " . $locale->text('Create Dataset'); - $form->header; - - print qq| - - - -

-

$form->{title}

- -
{script}> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
| . $locale->text('Existing Datasets') . qq|$dbsources
| . $locale->text('Create Dataset') . qq|
| . $locale->text('Multibyte Encoding') . qq|$selectencoding
| - . $locale->text('Create Chart of Accounts') . qq|@charts
-

- - - - - - - - - -{rpw}> - - - -


- -
- - -
- -
- - - - -|; - + $form->header(); + print $form->parse_html_template("admin/create_dataset"); } sub dbcreate { - $form->isblank("db", $locale->text('Dataset missing!')); User->dbcreate(\%$form); @@ -1583,106 +1281,22 @@ sub dbcreate { . $locale->text('Database Administration') . " / " . $locale->text('Create Dataset'); - $form->header; - - print qq| - - - -
-

$form->{title}

- -
{script}>| - - . $locale->text('Dataset') - . " $form->{db} " - . $locale->text('successfully created!') - - . qq| - - - - - -

-

- - - - -|; - + $form->header(); + print $form->parse_html_template("admin/dbcreate"); } sub delete_dataset { - - if (@dbsources = User->dbsources_unused(\%$form, $memberfile)) { - foreach $item (sort @dbsources) { - $dbsources .= - qq| $item |; - } - } else { - $form->error($locale->text('Nothing to delete!')); - } + @dbsources = User->dbsources_unused(\%$form, $memberfile); + $form->error($locale->text('Nothing to delete!')) unless @dbsources; $form->{title} = "Lx-Office ERP " . $locale->text('Database Administration') . " / " . $locale->text('Delete Dataset'); + $form->{DBSOURCES} = [ map { { "name", $_ } } sort @dbsources ]; - $form->header; - - print qq| - - -

$form->{title}

- -
{script}> - - - - - - - - - - - -
| - . $locale->text('The following Datasets are not in use and can be deleted') - . qq|
- $dbsources -
-

- - - - - - - - - - - - - -


- -
- - -
- -
- - - -|; - + $form->header(); + print $form->parse_html_template("admin/delete_dataset"); } sub dbdelete { @@ -1698,34 +1312,8 @@ sub dbdelete { . $locale->text('Database Administration') . " / " . $locale->text('Delete Dataset'); - $form->header; - - print qq| - - - -
-

$form->{title}

- -
{script}> - -$form->{db} | . $locale->text('successfully deleted!') - - . qq| - - - - - -

-

- - - - -|; - + $form->header(); + print $form->parse_html_template("admin/dbdelete"); } sub unlock_system {