Benutzereinstellungen/Administration: Beschriftungen für die Menüart geändert.
[kivitendo-erp.git] / bin / mozilla / admin.pl
index 9856c29..cd08e3f 100644 (file)
@@ -37,46 +37,46 @@ $menufile = "menu.ini";
 use SL::Form;
 use SL::User;
 
-
 $form = new Form;
+$form->{"root"} = "root login";
 
 $locale = new Locale $language, "admin";
-  
+
 eval { require DBI; };
 $form->error($locale->text('DBI not installed!')) if ($@);
 
-
 # customization
 if (-f "$form->{path}/custom_$form->{script}") {
   eval { require "$form->{path}/custom_$form->{script}"; };
   $form->error($@) if ($@);
 }
 
-
 $form->{stylesheet} = "lx-office-erp.css";
-$form->{favicon} = "favicon.ico";
+$form->{favicon}    = "favicon.ico";
 
 if ($form->{action}) {
 
+
   $subroutine = $locale->findsub($form->{action});
-  
+
   if ($subroutine eq 'login') {
     if ($form->{rpw}) {
       $form->{rpw} = crypt $form->{rpw}, "ro";
     }
   }
-  
+
   &check_password;
-  
+
   &$subroutine;
-    
+
 } else {
 
   # if there are no drivers bail out
-  $form->error($locale->text('No Database Drivers available!')) unless (User->dbdrivers);
+  $form->error($locale->text('No Database Drivers available!'))
+    unless (User->dbdrivers);
 
   # create memberfile
-  if (! -f $memberfile) {
+  if (!-f $memberfile) {
     open(FH, ">$memberfile") or $form->error("$memberfile : $!");
     print FH qq|# SQL-Ledger Accounting members
 
@@ -92,15 +92,16 @@ password=
 }
 
 1;
-# end
 
+# end
 
 sub adminlogin {
 
-  $form->{title} = qq|Lx-Office ERP $form->{version} |.$locale->text('Administration');
+  $form->{title} =
+    qq|Lx-Office ERP $form->{version} | . $locale->text('Administration');
 
   $form->header;
-  
+
   print qq|
 <body class=admin>
 
@@ -108,25 +109,30 @@ sub adminlogin {
 <div align=center>
 
 <a href="http://www.lx-office.org"><img src="image/lx-office-erp.png" border=0></a>
-<h1 class=login>|.$locale->text('Version').qq| $form->{version}<p>|.$locale->text('Administration').qq|</h1>
+<h1 class=login>|
+    . $locale->text('Version')
+    . qq| $form->{version}<p>|
+    . $locale->text('Administration')
+    . qq|</h1>
 
 <form method=post action="$form->{script}">
 
 <table>
   <tr>
-    <th>|.$locale->text('Password').qq|</th>
+    <th>| . $locale->text('Password') . qq|</th>
     <td><input type=password name=rpw></td>
-    <td><input type=submit class=submit name=action value="|.$locale->text('Login').qq|"></td>
+    <td><input type=submit class=submit name=action value="|
+    . $locale->text('Login') . qq|"></td>
   </tr>
 <input type=hidden name=action value=login>
-<input type=hidden name=root value="root login">
 <input type=hidden name=path value=$form->{path}>
 </table>
 
 
 </form>
 
-<a href=http://www.lx-office.org>Lx-Office |.$locale->text('website').qq|</a>
+<a href=http://www.lx-office.org>Lx-Office |
+    . $locale->text('website') . qq|</a>
 
 </div>
 
@@ -136,22 +142,20 @@ sub adminlogin {
 
 }
 
-
-
-
 sub login {
 
   &list_users;
 
 }
 
-
-
 sub add_user {
-  
-  $form->{title} = "Lx-Office ERP ".$locale->text('Administration')." / ".$locale->text('Add User');
 
-  $form->{Oracle_sid} = $sid;
+  $form->{title} =
+      "Lx-Office ERP "
+    . $locale->text('Administration') . " / "
+    . $locale->text('Add User');
+
+  $form->{Oracle_sid}    = $sid;
   $form->{Oracle_dbport} = '1521';
   $form->{Oracle_dbhost} = `hostname`;
 
@@ -159,17 +163,22 @@ sub add_user {
     $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;
-  
-}
-
 
+}
 
 sub edit {
 
-  $form->{title} = "Lx-Office ERP ".$locale->text('Administration')." / ".$locale->text('Edit User');
+  $form->{title} =
+      "Lx-Office ERP "
+    . $locale->text('Administration') . " / "
+    . $locale->text('Edit User');
   $form->{edit} = 1;
 
   &form_header;
@@ -177,22 +186,23 @@ sub edit {
 
 }
 
-
 sub form_footer {
 
   if ($form->{edit}) {
-    $delete = qq|<input type=submit class=submit name=action value="|.$locale->text('Delete').qq|">
+    $delete =
+      qq|<input type=submit class=submit name=action value="|
+      . $locale->text('Delete') . qq|">
 <input type=hidden name=edit value=1>|;
   }
 
   print qq|
 
-<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&root=$form->{root}&rpw=$form->{rpw}">
-<input type=hidden name=root value="$form->{root}">
+<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&rpw=$form->{rpw}">
 <input type=hidden name=path value=$form->{path}>
 <input type=hidden name=rpw value=$form->{rpw}>
 
-<input type=submit class=submit name=action value="|.$locale->text('Save').qq|">
+<input type=submit class=submit name=action value="|
+    . $locale->text('Save') . qq|">
 $delete
 
 </form>
@@ -203,7 +213,6 @@ $delete
 
 }
 
-
 sub list_users {
 
   $form->error($locale->text('File locked!')) if (-f "${memberfile}.LCK");
@@ -211,49 +220,52 @@ sub list_users {
   open(FH, "$memberfile") or $form->error("$memberfile : $!");
 
   $nologin = qq|
-<input type=submit class=submit name=action value="|.$locale->text('Lock System').qq|">|;
+<input type=submit class=submit name=action value="|
+    . $locale->text('Lock System') . qq|">|;
 
   if (-e "$userspath/nologin") {
     $nologin = qq|
-<input type=submit class=submit name=action value="|.$locale->text('Unlock System').qq|">|;
+<input type=submit class=submit name=action value="|
+      . $locale->text('Unlock System') . qq|">|;
   }
 
-
   while (<FH>) {
     chop;
-    
+
     if (/^\[.*\]/) {
       $login = $_;
       $login =~ s/(\[|\])//g;
     }
 
     if (/^(name=|company=|templates=|dbuser=|dbdriver=|dbname=|dbhost=)/) {
-      chop ($var = $&);
-      ($null, $member{$login}{$var}) = split /=/, $_, 2;
+      chop($var = $&);
+      ($null, $member{$login}{$var}) = split(/=/, $_, 2);
     }
   }
-  
+
   close(FH);
 
-# type=submit $locale->text('Pg Database Administration')
-# type=submit $locale->text('Oracle Database Administration')
+  # type=submit $locale->text('Pg Database Administration')
+  # type=submit $locale->text('Oracle Database Administration')
 
   foreach $item (User->dbdrivers) {
-    $dbdrivers .= qq|<input name=action type=submit class=submit value="|.$locale->text("$item Database Administration").qq|">|;
+    $dbdrivers .=
+      qq|<input name=action type=submit class=submit value="|
+      . $locale->text("$item Database Administration") . qq|">|;
   }
 
-
-  $column_header{login} = qq|<th>|.$locale->text('Login').qq|</th>|;
-  $column_header{name} = qq|<th>|.$locale->text('Name').qq|</th>|;
-  $column_header{company} = qq|<th>|.$locale->text('Company').qq|</th>|;
-  $column_header{dbdriver} = qq|<th>|.$locale->text('Driver').qq|</th>|;
-  $column_header{dbhost} = qq|<th>|.$locale->text('Host').qq|</th>|;
-  $column_header{dataset} = qq|<th>|.$locale->text('Dataset').qq|</th>|;
-  $column_header{templates} = qq|<th>|.$locale->text('Templates').qq|</th>|;
+  $column_header{login}     = qq|<th>| . $locale->text('Login') . qq|</th>|;
+  $column_header{name}      = qq|<th>| . $locale->text('Name') . qq|</th>|;
+  $column_header{company}   = qq|<th>| . $locale->text('Company') . qq|</th>|;
+  $column_header{dbdriver}  = qq|<th>| . $locale->text('Driver') . qq|</th>|;
+  $column_header{dbhost}    = qq|<th>| . $locale->text('Host') . qq|</th>|;
+  $column_header{dataset}   = qq|<th>| . $locale->text('Dataset') . qq|</th>|;
+  $column_header{templates} =
+    qq|<th>| . $locale->text('Templates') . qq|</th>|;
 
   @column_index = qw(login name company dbdriver dbhost dataset templates);
 
-  $form->{title} = "Lx-Office ERP ".$locale->text('Administration');
+  $form->{title} = "Lx-Office ERP " . $locale->text('Administration');
 
   $form->header;
 
@@ -274,39 +286,42 @@ sub list_users {
         <tr class=listheading>|;
 
   map { print "$column_header{$_}\n" } @column_index;
-  
+
   print qq|
         </tr>
 |;
 
-foreach $key (sort keys %member) {
-  $href = "$script?action=edit&login=$key&path=$form->{path}&root=$form->{root}&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|<td><a href=$href>$key</a></td>|;
-  $column_data{name} = qq|<td>$member{$key}{name}</td>|;
-  $column_data{company} = qq|<td>$member{$key}{company}</td>|;
-  $column_data{dbdriver} = qq|<td>$member{$key}{dbdriver}</td>|;
-  $column_data{dbhost} = qq|<td>$member{$key}{dbhost}</td>|;
-  $column_data{dataset} = qq|<td>$member{$key}{dbname}</td>|;
-  $column_data{templates} = qq|<td>$member{$key}{templates}</td>|;
-  
-  $i++; $i %= 2;
-  print qq|
-        <tr class=listrow$i>|;
+  foreach $key (sort keys %member) {
+    $href =
+      "$script?action=edit&login=$key&path=$form->{path}&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|<td><a id="$key" href="$href">$key</a></td>|;
+    $column_data{name}      = qq|<td>$member{$key}{name}</td>|;
+    $column_data{company}   = qq|<td>$member{$key}{company}</td>|;
+    $column_data{dbdriver}  = qq|<td>$member{$key}{dbdriver}</td>|;
+    $column_data{dbhost}    = qq|<td>$member{$key}{dbhost}</td>|;
+    $column_data{dataset}   = qq|<td>$member{$key}{dbname}</td>|;
+    $column_data{templates} = qq|<td>$member{$key}{templates}</td>|;
+
+    $i++;
+    $i %= 2;
+    print qq|
+        <tr class="listrow$i">|;
 
-  map { print "$column_data{$_}\n" } @column_index;
+    map { print "$column_data{$_}\n" } @column_index;
 
-  print qq|
+    print qq|
         </tr>|;
-}
-
+  }
 
-print qq|
+  print qq|
       </table>
     </td>
   </tr>
@@ -317,19 +332,24 @@ print qq|
 
 <input type=hidden name=path value=$form->{path}>
 <input type=hidden name=rpw value=$form->{rpw}>
-<input type=hidden name=root value="$form->{root}">
 
-<br><input type=submit class=submit name=action value="|.$locale->text('Add User').qq|">
-<input type=submit class=submit name=action value="|.$locale->text('Change Admin Password').qq|">
+<br><input type=submit class=submit name=action value="|
+    . $locale->text('Add User') . qq|">
+<input type=submit class=submit name=action value="|
+    . $locale->text('Change Admin Password') . qq|">
 
 $dbdrivers
 $nologin
 
 </form>
 
-|.$locale->text('Click on login name to edit!').qq|
+| . $locale->text('Click on login name to edit!') . qq|
 <br>
-|.$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|
+|
+    . $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|
 
 <p>
 
@@ -337,20 +357,21 @@ $nologin
 
 <table border=0 width=100%>
   <tr class=listheading>
-    <th>Lx-Office ERP |.$locale->text('Login').qq|</th>
+    <th>Lx-Office ERP | . $locale->text('Login') . qq|</th>
   </tr>
   <tr>
     <td>
       <table>
         <tr>
-         <th align=right>|.$locale->text('Name').qq|</th>
+         <th align=right>| . $locale->text('Name') . qq|</th>
          <td><input class=login name=login></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('Password').qq|</th>
+         <th align=right>| . $locale->text('Password') . qq|</th>
          <td><input class=login type=password name=password></td>
-         <td><input type=submit name=action value="|.$locale->text('Login').qq|"></td>
+         <td><input type=submit name=action value="|
+    . $locale->text('Login') . qq|"></td>
        </tr>
 <input type=hidden name=path value=$form->{path}>
       </table>
@@ -368,17 +389,16 @@ $nologin
 
 }
 
-
-
 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;
+    $myconfig->{address}   =~ s/\\n/\r\n/g;
 
     # strip basedir from templates directory
     $myconfig->{templates} =~ s/^$templates\///;
@@ -386,39 +406,52 @@ sub form_header {
     # $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}) ? "<option selected>$item\n" : "<option>$item\n";
+    $dateformat .=
+      ($item eq $myconfig->{dateformat})
+      ? "<option selected>$item\n"
+      : "<option>$item\n";
   }
 
   foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
-    $numberformat .= ($item eq $myconfig->{numberformat}) ? "<option selected>$item\n" : "<option>$item\n";
+    $numberformat .=
+      ($item eq $myconfig->{numberformat})
+      ? "<option selected>$item\n"
+      : "<option>$item\n";
   }
 
-
   %countrycodes = User->country_codes;
   $countrycodes = "";
-  foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} } keys %countrycodes) {
-    $countrycodes .= ($myconfig->{countrycode} eq $key) ? "<option selected value=$key>$countrycodes{$key}" : "<option value=$key>$countrycodes{$key}";
+  foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
+                keys %countrycodes
+    ) {
+    $countrycodes .=
+      ($myconfig->{countrycode} eq $key)
+      ? "<option selected value=$key>$countrycodes{$key}"
+      : "<option value=$key>$countrycodes{$key}";
   }
   $countrycodes = qq|<option value="">American English\n$countrycodes|;
 
   # is there a templates basedir
-  if (! -d "$templates") {
-    $form->error($locale->text('Directory').": $templates ".$locale->text('does not exist'));
+  if (!-d "$templates") {
+    $form->error(  $locale->text('Directory')
+                 . ": $templates "
+                 . $locale->text('does not exist'));
   }
 
   opendir TEMPLATEDIR, "$templates/." or $form->error("$templates : $!");
-  @all = grep !/^\.\.?$/, readdir TEMPLATEDIR;
+  my @all = readdir(TEMPLATEDIR);
+  my @alldir = sort(grep({ -d "$templates/$_" && !/^\.\.?$/ } @all));
+  my @allhtml = sort(grep({ -f "$templates/$_" && /\.html$/ } @all));
   closedir TEMPLATEDIR;
 
-  @allhtml = sort grep /\.html/, @all;
-  @alldir = grep !/\.(html|tex)$/, @all;
-  
+  @alldir = grep !/\.(html|tex|sty|odt|xml|txb)$/, @alldir;
+  @alldir = grep !/^(webpages|\.svn)$/, @alldir;
+
   @allhtml = reverse grep !/Default/, @allhtml;
   push @allhtml, 'Default';
   @allhtml = reverse @allhtml;
-  
+
   foreach $item (@alldir) {
     if ($item eq $myconfig->{templates}) {
       $usetemplates .= qq|<option selected>$item\n|;
@@ -426,23 +459,24 @@ sub form_header {
       $usetemplates .= qq|<option>$item\n|;
     }
   }
-  
+
   $lastitem = $allhtml[0];
   $lastitem =~ s/-.*//g;
   $mastertemplates = qq|<option>$lastitem\n|;
   foreach $item (@allhtml) {
     $item =~ s/-.*//g;
-    
+
     if ($item ne $lastitem) {
-      $mastertemplates .= qq|<option>$item\n|;
+      my $selected = $item eq "German" ? " selected" : "";
+      $mastertemplates .= qq|<option$selected>$item\n|;
       $lastitem = $item;
     }
   }
 
   opendir CSS, "css/.";
-  @all = grep /.*\.css$/, readdir CSS;
+  @all = sort(grep({ /\.css$/ && ($_ ne "tabcontent.css") } readdir(CSS)));
   closedir CSS;
-  
+
   foreach $item (@all) {
     if ($item eq $myconfig->{stylesheet}) {
       $selectstylesheet .= qq|<option selected>$item\n|;
@@ -450,11 +484,17 @@ sub form_header {
       $selectstylesheet .= qq|<option>$item\n|;
     }
   }
-  $selectstylesheet .= "<option>\n";
-  
-  
+
   $form->header;
+
+  if ($myconfig->{menustyle} eq "v3") {
+    $menustyle_v3 = "checked";
+  } elsif ($myconfig->{menustyle} eq "neu") {
+    $menustyle_neu = "checked";
+  } else {
+    $menustyle_old = "checked";
+  }
+
   print qq|
 <body class=admin>
 
@@ -467,52 +507,52 @@ sub form_header {
     <td>
       <table>
        <tr>
-         <th align=right>|.$locale->text('Login').qq|</th>
+         <th align=right>| . $locale->text('Login') . qq|</th>
          <td><input name=login value="$myconfig->{login}"></td>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('Password').qq|</th>
+         <th align=right>| . $locale->text('Password') . qq|</th>
          <td><input type=password name=password size=8 value=$myconfig->{password}></td>
          <input type=hidden name=old_password value=$myconfig->{password}>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('Name').qq|</th>
+         <th align=right>| . $locale->text('Name') . qq|</th>
          <td><input name=name size=15 value="$myconfig->{name}"></td>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('E-mail').qq|</th>
+         <th align=right>| . $locale->text('E-mail') . qq|</th>
          <td><input name=email size=30 value="$myconfig->{email}"></td>
        </tr>
        <tr valign=top>
-         <th align=right>|.$locale->text('Signature').qq|</th>
+         <th align=right>| . $locale->text('Signature') . qq|</th>
          <td><textarea name=signature rows=3 cols=35>$myconfig->{signature}</textarea></td>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('Phone').qq|</th>
+         <th align=right>| . $locale->text('Phone') . qq|</th>
          <td><input name=tel size=14 value="$myconfig->{tel}"></td>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('Fax').qq|</th>
+         <th align=right>| . $locale->text('Fax') . qq|</th>
          <td><input name=fax size=14 value="$myconfig->{fax}"></td>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('Company').qq|</th>
+         <th align=right>| . $locale->text('Company') . qq|</th>
          <td><input name=company size=35 value="$myconfig->{company}"></td>
        </tr>
        <tr valign=top>
-         <th align=right>|.$locale->text('Address').qq|</th>
+         <th align=right>| . $locale->text('Address') . qq|</th>
          <td><textarea name=address rows=4 cols=35>$myconfig->{address}</textarea></td>
        </tr>
         <tr valign=top>
-         <th align=right>|.$locale->text('Steuernummer').qq|</th>
-         <td><input name=steuernummer size=14 value="$myconfig->{steuernummer}"></td>
+         <th align=right>| . $locale->text('Tax number') . qq|</th>
+         <td><input name=taxnumber size=14 value="$myconfig->{taxnumber}"></td>
        </tr>
         <tr valign=top>
-         <th align=right>|.$locale->text('Ust-IDNr').qq|</th>
-         <td><input name=ustid size=14 value="$myconfig->{ustid}"></td>
+         <th align=right>| . $locale->text('Ust-IDNr') . qq|</th>
+         <td><input name=co_ustid size=14 value="$myconfig->{co_ustid}"></td>
        </tr>
         <tr valign=top>
-         <th align=right>|.$locale->text('DUNS-Nr').qq|</th>
+         <th align=right>| . $locale->text('DUNS-Nr') . qq|</th>
          <td><input name=duns size=14 value="$myconfig->{duns}"></td>
        </tr>
       </table>
@@ -520,56 +560,64 @@ sub form_header {
     <td>
       <table>
        <tr>
-         <th align=right>|.$locale->text('Date Format').qq|</th>
+         <th align=right>| . $locale->text('Date Format') . qq|</th>
          <td><select name=dateformat>$dateformat</select></td>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('Number Format').qq|</th>
+         <th align=right>| . $locale->text('Number Format') . qq|</th>
          <td><select name=numberformat>$numberformat</select></td>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('Dropdown Limit').qq|</th>
+         <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
          <td><input name=vclimit value="$myconfig->{vclimit}"></td>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('Language').qq|</th>
+         <th align=right>| . $locale->text('Language') . qq|</th>
          <td><select name=countrycode>$countrycodes</select></td>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('Character Set').qq|</th>
+         <th align=right>| . $locale->text('Character Set') . qq|</th>
          <td><input name=charset value="$myconfig->{charset}"></td>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('Stylesheet').qq|</th>
+         <th align=right>| . $locale->text('Stylesheet') . qq|</th>
          <td><select name=userstylesheet>$selectstylesheet</select></td>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('Printer').qq|</th>
+         <th align=right>| . $locale->text('Printer') . qq|</th>
          <td><input name=printer size=20 value="$myconfig->{printer}"></td>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('Use Templates').qq|</th>
+         <th align=right>| . $locale->text('Use Templates') . qq|</th>
          <td><select name=usetemplates>$usetemplates</select></td>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('New Templates').qq|</th>
+         <th align=right>| . $locale->text('New Templates') . qq|</th>
          <td><input name=newtemplates></td>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('Setup Templates').qq|</th>
+         <th align=right>| . $locale->text('Setup Templates') . qq|</th>
          <td><select name=mastertemplates>$mastertemplates</select></td>
        </tr>
+       <tr>
+           <th align=right>| . $locale->text('Setup Menu') . qq|</th>
+           <td><input name=menustyle type=radio class=radio value=neu $menustyle_neu>&nbsp;| .
+           $locale->text("Top (Javascript)") . qq|
+           <input name=menustyle type=radio class=radio value=old $menustyle_old>&nbsp;| .
+           $locale->text("Old (on the side)") . qq|
+           </td>
+         </tr>
        <input type=hidden name=templates value=$myconfig->{templates}>
       </table>
     </td>
   </tr>
   <tr class=listheading>
-    <th colspan=2>|.$locale->text('Database').qq|</th>
+    <th colspan=2>| . $locale->text('Database') . qq|</th>
   </tr>|;
 
-    # list section for database drivers
-    foreach $item (User->dbdrivers) {
-      
+  # list section for database drivers
+  foreach $item (User->dbdrivers) {
+
     print qq|
   <tr>
     <td colspan=2>
@@ -578,29 +626,30 @@ sub form_header {
 
     $checked = "";
     if ($myconfig->{dbdriver} eq $item) {
-      map { $form->{"${item}_$_"} = $myconfig->{$_} } qw(dbhost dbport dbuser dbpasswd dbname sid);
+      map { $form->{"${item}_$_"} = $myconfig->{$_} }
+        qw(dbhost dbport dbuser dbpasswd dbname sid);
       $checked = "checked";
     }
 
     print qq|
-         <th align=right>|.$locale->text('Driver').qq|</th>
+         <th align=right>| . $locale->text('Driver') . qq|</th>
          <td><input name=dbdriver type=radio class=radio value=$item $checked>&nbsp;$item</td>
-         <th align=right>|.$locale->text('Host').qq|</th>
+         <th align=right>| . $locale->text('Host') . qq|</th>
          <td><input name="${item}_dbhost" size=30 value=$form->{"${item}_dbhost"}></td>
        </tr>
        <tr>|;
 
     if ($item eq 'Pg') {
       print qq|
-         <th align=right>|.$locale->text('Dataset').qq|</th>
+         <th align=right>| . $locale->text('Dataset') . qq|</th>
          <td><input name=Pg_dbname size=15 value=$form->{Pg_dbname}></td>
-         <th align=right>|.$locale->text('Port').qq|</th>
+         <th align=right>| . $locale->text('Port') . qq|</th>
          <td><input name=Pg_dbport size=4 value=$form->{Pg_dbport}></td>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('User').qq|</th>
+         <th align=right>| . $locale->text('User') . qq|</th>
          <td><input name="${item}_dbuser" size=15 value=$form->{"${item}_dbuser"}></td>
-         <th align=right>|.$locale->text('Password').qq|</th>
+         <th align=right>| . $locale->text('Password') . qq|</th>
          <td><input name="${item}_dbpasswd" type=password size=10 value=$form->{"${item}_dbpasswd"}></td>
        </tr>|;
 
@@ -610,19 +659,18 @@ sub form_header {
       print qq|
          <th align=right>SID</th>
          <td><input name=Oracle_sid value=$form->{Oracle_sid}></td>
-         <th align=right>|.$locale->text('Port').qq|</th>
+         <th align=right>| . $locale->text('Port') . qq|</th>
          <td><input name=Oracle_dbport size=4 value=$form->{Oracle_dbport}></td>
        </tr>
        <tr>
-         <th align=right>|.$locale->text('Dataset').qq|</th>
+         <th align=right>| . $locale->text('Dataset') . qq|</th>
          <td><input name="${item}_dbuser" size=15 value=$form->{"${item}_dbuser"}></td>
-         <th align=right>|.$locale->text('Password').qq|</th>
+         <th align=right>| . $locale->text('Password') . qq|</th>
          <td><input name="${item}_dbpasswd" type=password size=10 value=$form->{"${item}_dbpasswd"}></td>
-         
+
        </tr>|;
     }
-    
-      
+
     print qq|
        <input type=hidden name=old_dbpasswd value=$myconfig->{dbpasswd}>
       </table>
@@ -635,13 +683,13 @@ sub form_header {
 
   }
 
-
   # access control
   open(FH, $menufile) or $form->error("$menufile : $!");
+
   # scan for first menu level
   @a = <FH>;
   close(FH);
-  
+
   if (open(FH, "custom_$menufile")) {
     push @a, <FH>;
   }
@@ -657,7 +705,7 @@ sub form_header {
     if ($item =~ /--/) {
       ($level, $menuitem) = split /--/, $item, 2;
     } else {
-      $level = $item;
+      $level    = $item;
       $menuitem = $item;
       push @acsorder, $item;
     }
@@ -665,46 +713,48 @@ sub form_header {
     push @{ $acs{$level} }, $menuitem;
 
   }
-  
-  %role = ( 'admin' => $locale->text('Administrator'),
-            'user' => $locale->text('User'),
-            'manager' => $locale->text('Manager'),
-           'supervisor' => $locale->text('Supervisor')
-          );
-           
+
+  %role = ('admin'      => $locale->text('Administrator'),
+           'user'       => $locale->text('User'),
+           'manager'    => $locale->text('Manager'),
+           'supervisor' => $locale->text('Supervisor'));
+
   $selectrole = "";
   foreach $item (qw(user supervisor manager admin)) {
-    $selectrole .= ($myconfig->{role} eq $item) ? "<option selected value=$item>$role{$item}\n" : "<option value=$item>$role{$item}\n";
+    $selectrole .=
+      ($myconfig->{role} eq $item)
+      ? "<option selected value=$item>$role{$item}\n"
+      : "<option value=$item>$role{$item}\n";
   }
-  
+
   print qq|
   <tr class=listheading>
-    <th colspan=2>|.$locale->text('Access Control').qq|</th>
+    <th colspan=2>| . $locale->text('Access Control') . qq|</th>
   </tr>
   <tr>
     <td><select name=role>$selectrole</select></td>
   </tr>
 |;
-  
-  foreach $item (split /;/, $myconfig->{acs}) {
+
+  foreach $item (split(/;/, $myconfig->{acs})) {
     ($key, $value) = split /--/, $item, 2;
     $excl{$key}{$value} = 1;
   }
-  
+
   foreach $key (@acsorder) {
 
     $checked = "checked";
     if ($form->{login}) {
       $checked = ($excl{$key}{$key}) ? "" : "checked";
     }
-    
+
     # can't have variable names with spaces
     # the 1 is for apache 2
     $item = $form->escape("${key}--$key", 1);
-    
+
     $acsheading = $key;
     $acsheading =~ s/ /&nbsp;/g;
-    
+
     $acsheading = qq|
     <th align=left><input name="$item" class=checkbox type=checkbox value=1 $checked>&nbsp;$acsheading</th>\n|;
     $menuitems .= "$item;";
@@ -716,11 +766,11 @@ sub form_header {
 
       $checked = "checked";
       if ($form->{login}) {
-       $checked = ($excl{$key}{$item}) ? "" : "checked";
+        $checked = ($excl{$key}{$item}) ? "" : "checked";
       }
 
       $acsitem = $form->escape("${key}--$item", 1);
-      
+
       $acsdata .= qq|
     <br><input name="$acsitem" class=checkbox type=checkbox value=1 $checked>&nbsp;$item|;
       $menuitems .= "$acsitem;";
@@ -734,137 +784,141 @@ sub form_header {
   </tr>
 |;
   }
-  
+
   print qq|<input type=hidden name=acs value="$menuitems">
 |;
-   if ($webdav) {
-   @webdavdirs = qw(angebote bestellungen rechnungen anfragen lieferantenbestellungen einkaufsrechnungen);
-   foreach $directory (@webdavdirs) {
-     if ($myconfig->{$directory}) {
-       $webdav{"${directory}c"} = "checked";
-     } else {
-       $webdav{"${directory}c"} = "";
-       }
-   }
-   print qq|  
+  if ($webdav) {
+    @webdavdirs =
+      qw(angebote bestellungen rechnungen anfragen lieferantenbestellungen einkaufsrechnungen);
+    foreach $directory (@webdavdirs) {
+      if ($myconfig->{$directory}) {
+        $webdav{"${directory}c"} = "checked";
+      } else {
+        $webdav{"${directory}c"} = "";
+      }
+    }
+    print qq|
    <tr>
     <td colspan=2><hr size=3 noshade></td>
   </tr>
   <tr class=listheading>
-    <th colspan=2>|.$locale->text('WEBDAV-Zugriff').qq|</th>
+    <th colspan=2>| . $locale->text('WEBDAV-Zugriff') . qq|</th>
   </tr>
   <table width=100%>
        <tr>
        <td><input name=angebote class=checkbox type=checkbox value=1 $webdav{angebotec}>&nbsp;Angebot</td>
-       <td><input name=bestellungen class=checkbox type=checkbox value=1 $webdav{bestellungenc}>&nbsp;Bestellung</td> 
+       <td><input name=bestellungen class=checkbox type=checkbox value=1 $webdav{bestellungenc}>&nbsp;Bestellung</td>
        <td><input name=rechnungen class=checkbox type=checkbox value=1 $webdav{rechnungenc}>&nbsp;Rechnung</td>
        </tr>
        <tr>
        <td><input name=anfragen class=checkbox type=checkbox value=1 $webdav{anfragenc}>&nbsp;Angebot</td>
-       <td><input name=lieferantenbestellungen class=checkbox type=checkbox value=1 $webdav{lieferantenbestellungenc}>&nbsp;Lieferantenbestellung</td> 
+       <td><input name=lieferantenbestellungen class=checkbox type=checkbox value=1 $webdav{lieferantenbestellungenc}>&nbsp;Lieferantenbestellung</td>
        <td><input name=einkaufsrechnungen class=checkbox type=checkbox value=1 $webdav{einkaufsrechnungenc}>&nbsp;Einkaufsrechnung</td>
        </tr>
-  </table>    
+  </table>
   <tr>
     <td colspan=2><hr size=3 noshade></td>
   </tr>
 |;
-}
-print qq|
+  }
+  print qq|
 </table>
 </div>
 |;
 
 }
 
-
 sub save {
 
   # no driver checked
-  $form->error($locale->text('Database Driver not checked!')) unless $form->{dbdriver};
+  $form->error($locale->text('Database Driver not checked!'))
+    unless $form->{dbdriver};
 
   # no spaces allowed in login name
   ($form->{login}) = split / /, $form->{login};
 
   $form->isblank("login", $locale->text('Login name missing!'));
-  
+
   # check for duplicates
   if (!$form->{edit}) {
     $temp = new User "$memberfile", "$form->{login}";
-   
+
     if ($temp->{login}) {
-      $form->error("$form->{login} ".$locale->text('is already a member!'));
+      $form->error("$form->{login} " . $locale->text('is already a member!'));
     }
   }
-  
+
   # no spaces allowed in directories
   ($form->{newtemplates}) = split / /, $form->{newtemplates};
-  
+
   if ($form->{newtemplates}) {
     $form->{templates} = $form->{newtemplates};
   } else {
-    $form->{templates} = ($form->{usetemplates}) ? $form->{usetemplates} : $form->{login};
+    $form->{templates} =
+      ($form->{usetemplates}) ? $form->{usetemplates} : $form->{login};
   }
-  
+
   # is there a basedir
-  if (! -d "$templates") {
-    $form->error($locale->text('Directory').": $templates ".$locale->text('does not exist'));
+  if (!-d "$templates") {
+    $form->error(  $locale->text('Directory')
+                 . ": $templates "
+                 . $locale->text('does not exist'));
   }
 
   # add base directory to $form->{templates}
   $form->{templates} = "$templates/$form->{templates}";
 
-
   $myconfig = new User "$memberfile", "$form->{login}";
 
   # redo acs variable and delete all the acs codes
-  @acs = split /;/, $form->{acs};
+  @acs = split(/;/, $form->{acs});
 
   $form->{acs} = "";
   foreach $item (@acs) {
     $item = $form->escape($item, 1);
 
     if (!$form->{$item}) {
-      $form->{acs} .= $form->unescape($form->unescape($item)).";";
+      $form->{acs} .= $form->unescape($form->unescape($item)) . ";";
     }
     delete $form->{$item};
   }
 
   # check which database was filled in
   if ($form->{dbdriver} eq 'Oracle') {
-    $form->{sid} = $form->{Oracle_sid}, ;
-    $form->{dbhost} = $form->{Oracle_dbhost}, ;
-    $form->{dbport} = $form->{Oracle_dbport};
+    $form->{sid}      = $form->{Oracle_sid},;
+    $form->{dbhost}   = $form->{Oracle_dbhost},;
+    $form->{dbport}   = $form->{Oracle_dbport};
     $form->{dbpasswd} = $form->{Oracle_dbpasswd};
-    $form->{dbuser} = $form->{Oracle_dbuser};
-    $form->{dbname} = $form->{Oracle_dbuser};
+    $form->{dbuser}   = $form->{Oracle_dbuser};
+    $form->{dbname}   = $form->{Oracle_dbuser};
 
     $form->isblank("dbhost", $locale->text('Hostname missing!'));
     $form->isblank("dbport", $locale->text('Port missing!'));
     $form->isblank("dbuser", $locale->text('Dataset missing!'));
   }
   if ($form->{dbdriver} eq 'Pg') {
-    $form->{dbhost} = $form->{Pg_dbhost};
-    $form->{dbport} = $form->{Pg_dbport};
+    $form->{dbhost}   = $form->{Pg_dbhost};
+    $form->{dbport}   = $form->{Pg_dbport};
     $form->{dbpasswd} = $form->{Pg_dbpasswd};
-    $form->{dbuser} = $form->{Pg_dbuser};
-    $form->{dbname} = $form->{Pg_dbname};
-    
+    $form->{dbuser}   = $form->{Pg_dbuser};
+    $form->{dbname}   = $form->{Pg_dbname};
+
     $form->isblank("dbname", $locale->text('Dataset missing!'));
     $form->isblank("dbuser", $locale->text('Database User missing!'));
   }
 
   if ($webdav) {
-    @webdavdirs = qw(angebote bestellungen rechnungen anfragen lieferantenbestellungen einkaufsrechnungen);
+    @webdavdirs =
+      qw(angebote bestellungen rechnungen anfragen lieferantenbestellungen einkaufsrechnungen);
     foreach $directory (@webdavdirs) {
-       if ($form->{$directory}) {
-               $form->{$directory} = $form->{$directory};
-       } else {
-               $form->{$directory} = 0;
-       }
+      if ($form->{$directory}) {
+        $form->{$directory} = $form->{$directory};
+      } else {
+        $form->{$directory} = 0;
+      }
     }
   }
-  
+
   foreach $item (keys %{$form}) {
     $myconfig->{$item} = $form->{$item};
   }
@@ -873,104 +927,108 @@ sub save {
   if ($form->{userstylesheet}) {
     $myconfig->{stylesheet} = $form->{userstylesheet};
   }
-  
+
   $myconfig->save_member($memberfile, $userspath);
-  
+
   if ($webdav) {
-    @webdavdirs = qw(angebote bestellungen rechnungen anfragen lieferantenbestellungen einkaufsrechnungen);
+    @webdavdirs =
+      qw(angebote bestellungen rechnungen anfragen lieferantenbestellungen einkaufsrechnungen);
     foreach $directory (@webdavdirs) {
-      $file = "webdav/".$directory."/webdav-user";
+      $file = "webdav/" . $directory . "/webdav-user";
       if ($form->{$directory}) {
-        if (open (HTACCESS, "$file")) {
+        if (open(HTACCESS, "$file")) {
           while (<HTACCESS>) {
-            ($login,$password) = split(/:/, $_);
+            ($login, $password) = split(/:/, $_);
             if ($login ne $form->{login}) {
               $newfile .= $_;
             }
           }
-          close (HTACCESS);
+          close(HTACCESS);
         }
-        open (HTACCESS, "> $file") or die "cannot open $file $!\n";
-        $newfile .= $myconfig->{login}.":".$myconfig->{password}."\n";
-        print (HTACCESS $newfile);
-        close (HTACCESS);
+        open(HTACCESS, "> $file") or die "cannot open $file $!\n";
+        $newfile .= $myconfig->{login} . ":" . $myconfig->{password} . "\n";
+        print(HTACCESS $newfile);
+        close(HTACCESS);
       } else {
         $form->{$directory} = 0;
-        if (open (HTACCESS, "$file")) {
+        if (open(HTACCESS, "$file")) {
           while (<HTACCESS>) {
-            ($login,$password) = split(/:/, $_);
+            ($login, $password) = split(/:/, $_);
             if ($login ne $form->{login}) {
               $newfile .= $_;
             }
           }
-          close (HTACCESS);
+          close(HTACCESS);
         }
-        open (HTACCESS, "> $file") or die "cannot open $file $!\n";
-        print (HTACCESS $newfile);
-        close (HTACCESS);
+        open(HTACCESS, "> $file") or die "cannot open $file $!\n";
+        print(HTACCESS $newfile);
+        close(HTACCESS);
       }
     }
-  }    
+  }
 
   # create user template directory and copy master files
-  if (! -d "$form->{templates}") {
+  if (!-d "$form->{templates}") {
     umask(002);
-    
+
     if (mkdir "$form->{templates}", oct("771")) {
-      
+
       umask(007);
-      
+
       # copy templates to the directory
-      opendir TEMPLATEDIR, "$templates/." or $form-error("$templates : $!");
-      @templates = grep /$form->{mastertemplates}.*?\.(html|tex)$/, readdir TEMPLATEDIR;
+      opendir TEMPLATEDIR, "$templates/." or $form - error("$templates : $!");
+      @templates = grep /$form->{mastertemplates}.*?\.(html|tex|sty|xml|txb)$/,
+        readdir TEMPLATEDIR;
       closedir TEMPLATEDIR;
 
       foreach $file (@templates) {
-       open(TEMP, "$templates/$file") or $form->error("$templates/$file : $!");
-       
-       $file =~ s/$form->{mastertemplates}-//;
-       open(NEW, ">$form->{templates}/$file") or $form->error("$form->{templates}/$file : $!");
-         
-       while ($line = <TEMP>) {
-         print NEW $line;
-       }
-       close(TEMP);
-       close(NEW);
+        open(TEMP, "$templates/$file")
+          or $form->error("$templates/$file : $!");
+
+        $file =~ s/$form->{mastertemplates}-//;
+        open(NEW, ">$form->{templates}/$file")
+          or $form->error("$form->{templates}/$file : $!");
+
+        while ($line = <TEMP>) {
+          print NEW $line;
+        }
+        close(TEMP);
+        close(NEW);
       }
     } else {
       $form->error("$!: $form->{templates}");
     }
   }
-  
-
 
   $form->redirect($locale->text('User saved!'));
-  
-}
 
+}
 
 sub delete {
 
-  $form->{templates} = ($form->{templates}) ? "$templates/$form->{templates}" : "$templates/$form->{login}";
-  
-  $form->error($locale->text('File locked!')) if (-f ${memberfile}.LCK);
+  $form->{templates} =
+    ($form->{templates})
+    ? "$templates/$form->{templates}"
+    : "$templates/$form->{login}";
+
+  $form->error($locale->text('File locked!')) if (-f ${memberfile} . LCK);
   open(FH, ">${memberfile}.LCK") or $form->error("${memberfile}.LCK : $!");
   close(FH);
-  
+
   open(CONF, "+<$memberfile") or $form->error("$memberfile : $!");
 
   @config = <CONF>;
 
   seek(CONF, 0, 0);
   truncate(CONF, 0);
-  
+
   while ($line = shift @config) {
 
     if ($line =~ /^\[/) {
       last if ($line =~ /\[$form->{login}\]/);
       $login = &login_name($line);
     }
-    
+
     if ($line =~ /^templates=/) {
       $user{$login} = &get_value($line);
     }
@@ -991,17 +1049,16 @@ sub delete {
   print CONF $line;
 
   $login = &login_name($line);
-  
 
   while ($line = shift @config) {
     if ($line =~ /^\[/) {
       $login = &login_name($line);
     }
-    
+
     if ($line =~ /^templates=/) {
       $user{$login} = &get_value($line);
     }
-    
+
     print CONF $line;
   }
 
@@ -1015,71 +1072,80 @@ sub delete {
 
   # if found keep directory otherwise delete
   if (!$found) {
+
     # delete it if there is a template directory
     $dir = "$form->{templates}";
     if (-d "$dir") {
       unlink <$dir/*.html>;
       unlink <$dir/*.tex>;
+      unlink <$dir/*.sty>;
       rmdir "$dir";
     }
   }
-  
+
   # delete config file for user
   unlink "$userspath/$form->{login}.conf";
-    
+
   $form->redirect($locale->text('User deleted!'));
-  
-}
 
+}
 
 sub login_name {
   my $login = shift;
-  
+
   $login =~ s/\[\]//g;
   return ($login) ? $login : undef;
-  
-}
-
 
+}
 
 sub get_value {
   my $line = shift;
-  
+
   my ($null, $value) = split(/=/, $line, 2);
 
   # remove comments
   $value =~ s/\s#.*//g;
-      
+
   # remove any trailing whitespace
   $value =~ s/^\s*(.*?)\s*$/$1/;
 
   $value;
 }
 
-
-
 sub change_admin_password {
 
-  $form->{title} = qq|Lx-Office ERP |.$locale->text('Administration')." / ".$locale->text('Change Admin Password');
-  
+  $form->{title} =
+      qq|Lx-Office ERP |
+    . $locale->text('Administration') . " / "
+    . $locale->text('Change Admin Password');
+
   $form->header;
 
   print qq|
 <body class=admin>
 
 
-<h2>|.$locale->text('Change Admin Password').qq|</h2>
+<h2>| . $locale->text('Change Admin Password') . qq|</h2>
 
 <form method=post action=$form->{script}>
 
-<b>|.$locale->text('Password').qq|</b> <input type=password name=password size=8>
+<table>
+  <tr>
+    <td><b>| . $locale->text('Password') . qq|</b></td>
+    <td><input type=password name=password size=8></td>
+  </tr>
+  <tr>
+    <td><b>| . $locale->text('Repeat the password') . qq|</b></td>
+    <td><input type=password name=password_again size=8></b></td>
+  </tr>
+</table>
 
-<input type=hidden name=root value="$form->{root}">
 <input type=hidden name=path value=$form->{path}>
 <input type=hidden name=rpw value=$form->{rpw}>
 
 <p>
-<input type=submit class=submit name=action value="|.$locale->text('Change Password').qq|">
+<input type=submit class=submit name=action value="|
+    . $locale->text('Change Password') . qq|">
 
 </form>
 
@@ -1089,34 +1155,47 @@ sub change_admin_password {
 
 }
 
-
 sub change_password {
+  if ($form->{"password"} ne $form->{"password_again"}) {
+    $form->{title} =
+      qq|Lx-Office ERP |
+      . $locale->text('Administration') . " / "
+      . $locale->text('Change Admin Password');
+
+    $form->header;
+
+    print qq|
+<body class=admin>
+
+
+<h2>| . $locale->text('Change Admin Password') . qq|</h2>
+
+<p>| . $locale->text("The passwords do not match.") . qq|<br>
+<input type="button" onclick="history.back()" value="| . $locale->text("Back") . qq|">|;
+    return;
+  }
 
   $root->{password} = $form->{password};
-  
+
   $root->{'root login'} = 1;
   $root->save_member($memberfile);
 
-  $form->{callback} = "$form->{script}?action=list_users&path=$form->{path}&root=$form->{root}&rpw=$root->{password}";
+  $form->{callback} =
+    "$form->{script}?action=list_users&path=$form->{path}&rpw=$root->{password}";
 
   $form->redirect($locale->text('Password changed!'));
 
 }
 
-
 sub check_password {
-
   $root = new User "$memberfile", $form->{root};
 
-  if ($root->{password}) {
-    if ($root->{password} ne $form->{rpw}) {
-      $form->error($locale->text('Incorrect Password!'));
-    }
+  if (!defined($root->{password}) || ($root->{password} ne $form->{rpw})) {
+    $form->error($locale->text('Incorrect Password!'));
   }
 
 }
 
-
 sub pg_database_administration {
 
   $form->{dbdriver} = 'Pg';
@@ -1124,47 +1203,49 @@ sub pg_database_administration {
 
 }
 
-
 sub oracle_database_administration {
-  
+
   $form->{dbdriver} = 'Oracle';
   &dbselect_source;
 
 }
 
-
 sub dbdriver_defaults {
 
   # load some defaults for the selected driver
-  %driverdefaults = ( 'Pg' => { dbport => '5432',
-                                dbuser => 'postgres',
-                            dbdefault => 'template1',
-                               dbhost => 'localhost',
-                        connectstring => $locale->text('Connect to')
-                             },
-                  'Oracle' => { dbport => '1521',
-                               dbuser => 'oralin',
-                            dbdefault => $sid,
-                               dbhost => `hostname`,
-                        connectstring => 'SID'
-                             }
-                    );
-
-  map { $form->{$_} = $driverdefaults{$form->{dbdriver}}{$_} } keys %{ $driverdefaults{Pg} };
-  
+  %driverdefaults = (
+                     'Pg' => { dbport        => '5432',
+                               dbuser        => 'postgres',
+                               dbdefault     => 'template1',
+                               dbhost        => 'localhost',
+                               connectstring => $locale->text('Connect to')
+                     },
+                     'Oracle' => { dbport        => '1521',
+                                   dbuser        => 'oralin',
+                                   dbdefault     => $sid,
+                                   dbhost        => `hostname`,
+                                   connectstring => 'SID'
+                     });
+
+  map { $form->{$_} = $driverdefaults{ $form->{dbdriver} }{$_} }
+    keys %{ $driverdefaults{Pg} };
+
 }
-  
 
 sub dbselect_source {
 
   &dbdriver_defaults;
 
-  $msg{Pg} = $locale->text('Leave host and port field empty unless you want to make a remote connection.');
-  $msg{Oracle} = $locale->text('You must enter a host and port for local and remote connections!');
-  
+  $msg{Pg} =
+    $locale->text(
+    'Leave host and port field empty unless you want to make a remote connection.'
+    );
+  $msg{Oracle} =
+    $locale->text(
+           'You must enter a host and port for local and remote connections!');
 
- $form->{title} = "Lx-Office ERP / ".$locale->text('Database Administration');
-  
+  $form->{title} =
+    "Lx-Office ERP / " . $locale->text('Database Administration');
 
   $form->header;
 
@@ -1183,7 +1264,7 @@ sub dbselect_source {
 <table>
 
   <tr class=listheading>
-    <th colspan=4>|.$locale->text('Database').qq|</th>
+    <th colspan=4>| . $locale->text('Database') . qq|</th>
   </tr>
 
 <input type=hidden name=dbdriver value=$form->{dbdriver}>
@@ -1193,22 +1274,22 @@ sub dbselect_source {
 
   <tr>
 
-    <th align=right>|.$locale->text('Host').qq|</th>
+    <th align=right>| . $locale->text('Host') . qq|</th>
     <td><input name=dbhost size=25 value=$form->{dbhost}></td>
-    <th align=right>|.$locale->text('Port').qq|</th>
+    <th align=right>| . $locale->text('Port') . qq|</th>
     <td><input name=dbport size=5 value=$form->{dbport}></td>
 
   </tr>
 
   <tr>
 
-    <th align=right>|.$locale->text('User').qq|</th>
+    <th align=right>| . $locale->text('User') . qq|</th>
     <td><input name=dbuser size=10 value=$form->{dbuser}></td>
-    <th align=right>|.$locale->text('Password').qq|</th>
+    <th align=right>| . $locale->text('Password') . qq|</th>
     <td><input type=password name=dbpasswd size=10></td>
 
   </tr>
-  
+
   <tr>
 
     <th align=right>$form->{connectstring}</th>
@@ -1221,25 +1302,31 @@ sub dbselect_source {
 </td></tr>
 </table>
 
-<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&root=$form->{root}&rpw=$form->{rpw}">
-<input type=hidden name=root value="$form->{root}">
+<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&rpw=$form->{rpw}">
 <input type=hidden name=path value=$form->{path}>
 <input type=hidden name=rpw value=$form->{rpw}>
 
 <br>
 
-<input type=submit class=submit name=action value="|.$locale->text('Create Dataset').qq|">
-<input type=submit class=submit name=action value="|.$locale->text('Update Dataset').qq|">
-<input type=submit class=submit name=action value="|.$locale->text('Delete Dataset').qq|">
+<input type=submit class=submit name=action value="|
+    . $locale->text('Create Dataset') . qq|">|;
+# Vorübergehend Deaktiviert
+# <input type=submit class=submit name=action value="|
+#     . $locale->text('Update Dataset') . qq|">
+print qq| <input type=submit class=submit name=action value="|
+    . $locale->text('Delete Dataset') . qq|">
 
 </form>
 
 </td></tr>
 </table>
 
-<p>|.$locale->text('This is a preliminary check for existing sources. Nothing will be created or deleted at this stage!')
+<p>|
+    . $locale->text(
+    'This is a preliminary check for existing sources. Nothing will be created or deleted at this stage!'
+    )
 
-.qq|
+    . qq|
 <br>$msg{$form->{dbdriver}}
 
 
@@ -1249,20 +1336,21 @@ sub dbselect_source {
 
 }
 
-
 sub continue {
 
   &{ $form->{nextsub} };
 
 }
 
-
 sub update_dataset {
 
   %needsupdate = User->dbneedsupdate(\%$form);
 
-  $form->{title} = "Lx-Office ERP ".$locale->text('Database Administration')." / ".$locale->text('Update Dataset');
-  
+  $form->{title} =
+      "Lx-Office ERP "
+    . $locale->text('Database Administration') . " / "
+    . $locale->text('Update Dataset');
+
   $form->header;
 
   print qq|
@@ -1272,18 +1360,17 @@ sub update_dataset {
 <center>
 <h2>$form->{title}</h2>
 |;
-
-
+  my $field_id = 0;
   foreach $key (sort keys %needsupdate) {
     if ($needsupdate{$key} ne $form->{dbversion}) {
-      $upd .= qq|<input name="db$key" type=checkbox value=1 checked> $key\n|;
+      $upd .= qq|<input id="$field_id" name="db$key" type="checkbox" value="1" checked> $key\n|;
       $form->{dbupdate} .= "db$key ";
+      $field_id++;
     }
   }
 
   chop $form->{dbupdate};
 
-
   if ($form->{dbupdate}) {
 
     print qq|
@@ -1298,7 +1385,7 @@ sub update_dataset {
 <input type=hidden name=dbdefault value=$form->{dbdefault}>
 
 <tr class=listheading>
-  <th>|.$locale->text('The following Datasets need to be updated').qq|</th>
+  <th>| . $locale->text('The following Datasets need to be updated') . qq|</th>
 </tr>
 <tr>
 <td>
@@ -1312,9 +1399,8 @@ $upd
 
 <input name=dbupdate type=hidden value="$form->{dbupdate}">
 
-<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&root=$form->{root}&rpw=$form->{rpw}">
+<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&rpw=$form->{rpw}">
 
-<input type=hidden name=root value="$form->{root}">
 <input type=hidden name=path value=$form->{path}>
 <input type=hidden name=rpw value=$form->{rpw}>
 
@@ -1323,7 +1409,8 @@ $upd
 <hr size=3 noshade>
 
 <br>
-<input type=submit class=submit name=action value="|.$locale->text('Continue').qq|">
+<input type=submit class=submit name=action value="|
+      . $locale->text('Continue') . qq|">
 
 </td></tr>
 </table>
@@ -1335,7 +1422,7 @@ $upd
     print $locale->text('All Datasets up to date!');
 
   }
-  
+
   print qq|
 
 </body>
@@ -1344,15 +1431,32 @@ $upd
 
 }
 
-
 sub dbupdate {
+  $form->{"stylesheet"} = "lx-office-erp.css";
+  $form->{"title"} = $main::locale->text("Dataset upgrade");
+  $form->header();
+  my $dbname =
+    join(" ",
+         map({ s/\s//g; s/^db//; $_; }
+             grep({ $form->{$_} }
+                  split(/\s+/, $form->{"dbupdate"}))));
+  print($form->parse_html_template("dbupgrade/header",
+                                   { "dbname" => $dbname }));
 
   User->dbupdate(\%$form);
 
-  $form->redirect($locale->text('Dataset updated!'));
-  
-}
+  print qq|
+<hr>
+
+| . $locale->text('Dataset updated!') . qq|
+
+<br>
+
+<a id="enddatasetupdate" href="admin.pl?action=login&| .
+join("&", map({ "$_=" . $form->escape($form->{$_}); } qw(path rpw))) .
+qq|">| . $locale->text("Continue") . qq|</a>|;
 
+}
 
 sub create_dataset {
 
@@ -1360,11 +1464,12 @@ sub create_dataset {
     $dbsources .= "[$item] ";
   }
 
-  opendir SQLDIR, "sql/." or $form-error($!);
+  opendir SQLDIR, "sql/." or $form - error($!);
   foreach $item (sort grep /-chart\.sql/, readdir SQLDIR) {
     next if ($item eq 'Default-chart.sql');
     $item =~ s/-chart\.sql//;
-    push @charts, qq| <input name=chart class=radio type=radio value="$item">&nbsp;$item|;
+    push @charts,
+      qq| <input name=chart class=radio type=radio value="$item">&nbsp;$item|;
   }
   closedir SQLDIR;
 
@@ -1385,9 +1490,12 @@ sub create_dataset {
   <option value=WIN>Windows CP1251
   <option value=ALT>Windows CP866
   |;
-  
-  $form->{title} = "Lx-Office ERP ".$locale->text('Database Administration')." / ".$locale->text('Create Dataset');
-  
+
+  $form->{title} =
+      "Lx-Office ERP "
+    . $locale->text('Database Administration') . " / "
+    . $locale->text('Create Dataset');
+
   $form->header;
 
   print qq|
@@ -1406,32 +1514,33 @@ sub create_dataset {
 
   <tr>
 
-    <th align=right nowrap>|.$locale->text('Existing Datasets').qq|</th>
+    <th align=right nowrap>| . $locale->text('Existing Datasets') . qq|</th>
     <td>$dbsources</td>
 
   </tr>
-  
+
   <tr>
 
-    <th align=right nowrap>|.$locale->text('Create Dataset').qq|</th>
+    <th align=right nowrap>| . $locale->text('Create Dataset') . qq|</th>
     <td><input name=db></td>
 
   </tr>
 
   <tr>
 
-    <th align=right nowrap>|.$locale->text('Multibyte Encoding').qq|</th>
+    <th align=right nowrap>| . $locale->text('Multibyte Encoding') . qq|</th>
     <td><select name=encoding>$selectencoding</select></td>
 
   </tr>
+
   <tr>
 
-    <th align=right nowrap>|.$locale->text('Create Chart of Accounts').qq|</th>
+    <th align=right nowrap>|
+    . $locale->text('Create Chart of Accounts') . qq|</th>
     <td>@charts</td>
 
   </tr>
+
   <tr><td colspan=2>
 <p>
 <input type=hidden name=dbdriver value=$form->{dbdriver}>
@@ -1441,9 +1550,8 @@ sub create_dataset {
 <input type=hidden name=dbpasswd value=$form->{dbpasswd}>
 <input type=hidden name=dbdefault value=$form->{dbdefault}>
 
-<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&root=$form->{root}&rpw=$form->{rpw}">
+<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&rpw=$form->{rpw}">
 
-<input type=hidden name=root value="$form->{root}">
 <input type=hidden name=path value=$form->{path}>
 <input type=hidden name=rpw value=$form->{rpw}>
 
@@ -1452,7 +1560,8 @@ sub create_dataset {
 <hr size=3 noshade>
 
 <br>
-<input type=submit class=submit name=action value="|.$locale->text('Continue').qq|">
+<input type=submit class=submit name=action value="|
+    . $locale->text('Continue') . qq|">
 
   </td></tr>
 </table>
@@ -1466,14 +1575,16 @@ sub create_dataset {
 
 }
 
-
 sub dbcreate {
 
   $form->isblank("db", $locale->text('Dataset missing!'));
 
   User->dbcreate(\%$form);
-  
-  $form->{title} = "Lx-Office ERP ".$locale->text('Database Administration')." / ".$locale->text('Create Dataset');
+
+  $form->{title} =
+      "Lx-Office ERP "
+    . $locale->text('Database Administration') . " / "
+    . $locale->text('Create Dataset');
 
   $form->header;
 
@@ -1486,17 +1597,19 @@ sub dbcreate {
 
 <form method=post action=$form->{script}>|
 
-.$locale->text('Dataset')." $form->{db} ".$locale->text('successfully created!')
+    . $locale->text('Dataset')
+    . " $form->{db} "
+    . $locale->text('successfully created!')
 
-.qq|
+    . qq|
 
-<input type=hidden name=root value="$form->{root}">
 <input type=hidden name=path value="$form->{path}">
 <input type=hidden name=rpw value="$form->{rpw}">
 
 <input type=hidden name=nextsub value=list_users>
 
-<p><input type=submit class=submit name=action value="|.$locale->text('Continue').qq|">
+<p><input type=submit class=submit name=action value="|
+    . $locale->text('Continue') . qq|">
 </form>
 
 
@@ -1506,18 +1619,21 @@ sub dbcreate {
 
 }
 
-
 sub delete_dataset {
 
   if (@dbsources = User->dbsources_unused(\%$form, $memberfile)) {
     foreach $item (sort @dbsources) {
-      $dbsources .= qq|<input name=db class=radio type=radio value=$item>&nbsp;$item |;
+      $dbsources .=
+        qq|<input name=db class=radio type=radio value=$item>&nbsp;$item |;
     }
   } else {
     $form->error($locale->text('Nothing to delete!'));
   }
 
-  $form->{title} = "Lx-Office ERP ".$locale->text('Database Administration')." / ".$locale->text('Delete Dataset');
+  $form->{title} =
+      "Lx-Office ERP "
+    . $locale->text('Database Administration') . " / "
+    . $locale->text('Delete Dataset');
 
   $form->header;
 
@@ -1530,7 +1646,9 @@ sub delete_dataset {
 
 <table width=100%>
   <tr class=listheading>
-    <th>|.$locale->text('The following Datasets are not in use and can be deleted').qq|</th>
+    <th>|
+    . $locale->text('The following Datasets are not in use and can be deleted')
+    . qq|</th>
   </tr>
 
   <tr>
@@ -1538,7 +1656,7 @@ sub delete_dataset {
     $dbsources
     </td>
   </tr>
-  
+
   <tr><td>
 <p>
 <input type=hidden name=dbdriver value=$form->{dbdriver}>
@@ -1548,9 +1666,8 @@ sub delete_dataset {
 <input type=hidden name=dbpasswd value=$form->{dbpasswd}>
 <input type=hidden name=dbdefault value=$form->{dbdefault}>
 
-<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&root=$form->{root}&rpw=$form->{rpw}">
+<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&rpw=$form->{rpw}">
 
-<input type=hidden name=root value="$form->{root}">
 <input type=hidden name=path value="$form->{path}">
 <input type=hidden name=rpw value="$form->{rpw}">
 
@@ -1559,7 +1676,8 @@ sub delete_dataset {
 <hr size=3 noshade>
 
 <br>
-<input type=submit class=submit name=action value="|.$locale->text('Continue').qq|">
+<input type=submit class=submit name=action value="|
+    . $locale->text('Continue') . qq|">
 
   </td></tr>
 </table>
@@ -1572,7 +1690,6 @@ sub delete_dataset {
 
 }
 
-
 sub dbdelete {
 
   if (!$form->{db}) {
@@ -1581,7 +1698,10 @@ sub dbdelete {
 
   User->dbdelete(\%$form);
 
-  $form->{title} = "Lx-Office ERP ".$locale->text('Database Administration')." / ".$locale->text('Delete Dataset');
+  $form->{title} =
+      "Lx-Office ERP "
+    . $locale->text('Database Administration') . " / "
+    . $locale->text('Delete Dataset');
 
   $form->header;
 
@@ -1594,17 +1714,17 @@ sub dbdelete {
 
 <form method=post action=$form->{script}>
 
-$form->{db} |.$locale->text('successfully deleted!')
+$form->{db} | . $locale->text('successfully deleted!')
 
-.qq|
+    . qq|
 
-<input type=hidden name=root value="$form->{root}">
 <input type=hidden name=path value="$form->{path}">
 <input type=hidden name=rpw value="$form->{rpw}">
 
 <input type=hidden name=nextsub value=list_users>
 
-<p><input type=submit class=submit name=action value="|.$locale->text('Continue').qq|">
+<p><input type=submit class=submit name=action value="|
+    . $locale->text('Continue') . qq|">
 </form>
 
 
@@ -1614,27 +1734,26 @@ $form->{db} |.$locale->text('successfully deleted!')
 
 }
 
-
 sub unlock_system {
 
   unlink "$userspath/nologin";
-  
-  $form->{callback} = "$form->{script}?action=list_users&path=$form->{path}&root=$form->{root}&rpw=$root->{password}";
+
+  $form->{callback} =
+    "$form->{script}?action=list_users&path=$form->{path}&rpw=$root->{password}";
 
   $form->redirect($locale->text('Lockfile removed!'));
 
 }
 
-
 sub lock_system {
 
-  open(FH, ">$userspath/nologin") or $form->error($locale->text('Cannot create Lock!'));
+  open(FH, ">$userspath/nologin")
+    or $form->error($locale->text('Cannot create Lock!'));
   close(FH);
-  
-  $form->{callback} = "$form->{script}?action=list_users&path=$form->{path}&root=$form->{root}&rpw=$root->{password}";
+
+  $form->{callback} =
+    "$form->{script}?action=list_users&path=$form->{path}&rpw=$root->{password}";
 
   $form->redirect($locale->text('Lockfile created!'));
 
 }
-
-