Benutzereinstellungen/Administration: Beschriftungen für die Menüart geändert.
[kivitendo-erp.git] / bin / mozilla / admin.pl
index 566f29a..cd08e3f 100644 (file)
@@ -38,6 +38,7 @@ use SL::Form;
 use SL::User;
 
 $form = new Form;
+$form->{"root"} = "root login";
 
 $locale = new Locale $language, "admin";
 
@@ -55,6 +56,7 @@ $form->{favicon}    = "favicon.ico";
 
 if ($form->{action}) {
 
+
   $subroutine = $locale->findsub($form->{action});
 
   if ($subroutine eq 'login') {
@@ -120,11 +122,9 @@ sub adminlogin {
     <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>
+    . $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>
 
@@ -164,6 +164,10 @@ sub add_user {
   }
   $myconfig->{vclimit} = 200;
 
+  $myconfig->{"countrycode"} = "de";
+  $myconfig->{"numberformat"} = "1000,00";
+  $myconfig->{"dateformat"} = "dd.mm.yy";
+
   &form_header;
   &form_footer;
 
@@ -193,8 +197,7 @@ sub form_footer {
 
   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}>
 
@@ -236,7 +239,7 @@ sub list_users {
 
     if (/^(name=|company=|templates=|dbuser=|dbdriver=|dbname=|dbhost=)/) {
       chop($var = $&);
-      ($null, $member{$login}{$var}) = split /=/, $_, 2;
+      ($null, $member{$login}{$var}) = split(/=/, $_, 2);
     }
   }
 
@@ -290,7 +293,7 @@ sub list_users {
 
   foreach $key (sort keys %member) {
     $href =
-      "$script?action=edit&login=$key&path=$form->{path}&root=$form->{root}&rpw=$form->{rpw}";
+      "$script?action=edit&login=$key&path=$form->{path}&rpw=$form->{rpw}";
     $href =~ s/ /%20/g;
 
     $member{$key}{templates} =~ s/^$templates\///;
@@ -299,7 +302,7 @@ sub list_users {
     $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{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>|;
@@ -310,7 +313,7 @@ sub list_users {
     $i++;
     $i %= 2;
     print qq|
-        <tr class=listrow$i>|;
+        <tr class="listrow$i">|;
 
     map { print "$column_data{$_}\n" } @column_index;
 
@@ -329,7 +332,6 @@ sub list_users {
 
 <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|">
@@ -369,8 +371,7 @@ $nologin
          <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>
+    . $locale->text('Login') . qq|"></td>
        </tr>
 <input type=hidden name=path value=$form->{path}>
       </table>
@@ -422,7 +423,8 @@ sub form_header {
   %countrycodes = User->country_codes;
   $countrycodes = "";
   foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
-                keys %countrycodes) {
+                keys %countrycodes
+    ) {
     $countrycodes .=
       ($myconfig->{countrycode} eq $key)
       ? "<option selected value=$key>$countrycodes{$key}"
@@ -438,11 +440,13 @@ sub form_header {
   }
 
   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';
@@ -463,13 +467,14 @@ sub form_header {
     $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) {
@@ -479,10 +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>
 
@@ -532,12 +544,12 @@ sub form_header {
          <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>
+         <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>
@@ -587,6 +599,14 @@ sub form_header {
          <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>
@@ -716,7 +736,7 @@ sub form_header {
   </tr>
 |;
 
-  foreach $item (split /;/, $myconfig->{acs}) {
+  foreach $item (split(/;/, $myconfig->{acs})) {
     ($key, $value) = split /--/, $item, 2;
     $excl{$key}{$value} = 1;
   }
@@ -851,7 +871,7 @@ sub save {
   $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) {
@@ -957,7 +977,7 @@ sub save {
 
       # copy templates to the directory
       opendir TEMPLATEDIR, "$templates/." or $form - error("$templates : $!");
-      @templates = grep /$form->{mastertemplates}.*?\.(html|tex)$/,
+      @templates = grep /$form->{mastertemplates}.*?\.(html|tex|sty|xml|txb)$/,
         readdir TEMPLATEDIR;
       closedir TEMPLATEDIR;
 
@@ -1058,6 +1078,7 @@ sub delete {
     if (-d "$dir") {
       unlink <$dir/*.html>;
       unlink <$dir/*.tex>;
+      unlink <$dir/*.sty>;
       rmdir "$dir";
     }
   }
@@ -1108,11 +1129,17 @@ sub change_admin_password {
 
 <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}>
 
@@ -1129,6 +1156,24 @@ 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};
 
@@ -1136,20 +1181,17 @@ sub change_password {
   $root->save_member($memberfile);
 
   $form->{callback} =
-    "$form->{script}?action=list_users&path=$form->{path}&root=$form->{root}&rpw=$root->{password}";
+    "$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!'));
   }
 
 }
@@ -1260,18 +1302,18 @@ 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('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>
@@ -1318,11 +1360,12 @@ 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++;
     }
   }
 
@@ -1356,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}>
 
@@ -1390,10 +1432,29 @@ $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>|;
 
 }
 
@@ -1475,8 +1536,7 @@ sub create_dataset {
   <tr>
 
     <th align=right nowrap>|
-    . $locale->text('Create Chart of Accounts')
-    . qq|</th>
+    . $locale->text('Create Chart of Accounts') . qq|</th>
     <td>@charts</td>
 
   </tr>
@@ -1490,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}>
 
@@ -1544,7 +1603,6 @@ sub dbcreate {
 
     . 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}">
 
@@ -1608,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}">
 
@@ -1661,7 +1718,6 @@ $form->{db} | . $locale->text('successfully deleted!')
 
     . 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}">
 
@@ -1683,7 +1739,7 @@ sub unlock_system {
   unlink "$userspath/nologin";
 
   $form->{callback} =
-    "$form->{script}?action=list_users&path=$form->{path}&root=$form->{root}&rpw=$root->{password}";
+    "$form->{script}?action=list_users&path=$form->{path}&rpw=$root->{password}";
 
   $form->redirect($locale->text('Lockfile removed!'));
 
@@ -1696,7 +1752,7 @@ sub lock_system {
   close(FH);
 
   $form->{callback} =
-    "$form->{script}?action=list_users&path=$form->{path}&root=$form->{root}&rpw=$root->{password}";
+    "$form->{script}?action=list_users&path=$form->{path}&rpw=$root->{password}";
 
   $form->redirect($locale->text('Lockfile created!'));