Optik in den Einkaufs- und Verkaufsformularen etwas verbessert:
[kivitendo-erp.git] / bin / mozilla / admin.pl
index 1e36297..4e33ef2 100644 (file)
 $menufile = "menu.ini";
 
 use DBI;
+use CGI;
+
 use SL::Form;
 use SL::User;
+use SL::Common;
 
 require "bin/mozilla/common.pl";
 
+our $cgi = new CGI('');
+
 $form = new Form;
 $form->{"root"} = "root login";
 
 $locale = new Locale $language, "admin";
 
 # customization
-if (-f "$form->{path}/custom_$form->{script}") {
-  eval { require "$form->{path}/custom_$form->{script}"; };
+if (-f "bin/mozilla/custom_$form->{script}") {
+  eval { require "bin/mozilla/custom_$form->{script}"; };
   $form->error($@) if ($@);
 }
 
@@ -125,7 +130,6 @@ sub adminlogin {
     . $locale->text('Login') . qq|"></td>
   </tr>
 <input type=hidden name=action value=login>
-<input type=hidden name=path value=$form->{path}>
 </table>
 
 
@@ -197,8 +201,7 @@ sub form_footer {
 
   print qq|
 
-<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 name=callback type=hidden value="$form->{script}?action=list_users&rpw=$form->{rpw}">
 <input type=hidden name=rpw value=$form->{rpw}>
 
 <input type=submit class=submit name=action value="|
@@ -293,7 +296,7 @@ sub list_users {
 
   foreach $key (sort keys %member) {
     $href =
-      "$script?action=edit&login=$key&path=$form->{path}&rpw=$form->{rpw}";
+      "$script?action=edit&login=$key&rpw=$form->{rpw}";
     $href =~ s/ /%20/g;
 
     $member{$key}{templates} =~ s/^$templates\///;
@@ -330,7 +333,6 @@ sub list_users {
   </tr>
 </table>
 
-<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="|
@@ -373,7 +375,6 @@ $nologin
          <td><input type=submit name=action value="|
     . $locale->text('Login') . qq|"></td>
        </tr>
-<input type=hidden name=path value=$form->{path}>
       </table>
     </td>
   </tr>
@@ -579,10 +580,6 @@ sub form_header {
          <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>
-         <td><input name=charset value="$myconfig->{charset}"></td>
-       </tr>
        <tr>
          <th align=right>| . $locale->text('Stylesheet') . qq|</th>
          <td><select name=userstylesheet>$selectstylesheet</select></td>
@@ -697,11 +694,6 @@ sub form_header {
   @a = <FH>;
   close(FH);
 
-  if (open(FH, "custom_$menufile")) {
-    push @a, <FH>;
-  }
-  close(FH);
-
   foreach $item (@a) {
     next unless $item =~ /\[/;
     next if $item =~ /\#/;
@@ -974,6 +966,9 @@ sub save {
     }
   }
 
+  $form->{templates}       =~ s|.*/||;
+  $form->{mastertemplates} =~ s|.*/||;
+
   # create user template directory and copy master files
   if (!-d "$form->{templates}") {
     umask(002);
@@ -1147,7 +1142,6 @@ sub change_admin_password {
   </tr>
 </table>
 
-<input type=hidden name=path value=$form->{path}>
 <input type=hidden name=rpw value=$form->{rpw}>
 
 <p>
@@ -1188,7 +1182,7 @@ sub change_password {
   $root->save_member($memberfile);
 
   $form->{callback} =
-    "$form->{script}?action=list_users&path=$form->{path}&rpw=$root->{password}";
+    "$form->{script}?action=list_users&rpw=$root->{password}";
 
   $form->redirect($locale->text('Password changed!'));
 
@@ -1309,8 +1303,7 @@ sub dbselect_source {
 </td></tr>
 </table>
 
-<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 name=callback type=hidden value="$form->{script}?action=list_users&rpw=$form->{rpw}">
 <input type=hidden name=rpw value=$form->{rpw}>
 
 <br>
@@ -1404,9 +1397,8 @@ $upd
 
 <input name=dbupdate type=hidden value="$form->{dbupdate}">
 
-<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&rpw=$form->{rpw}">
+<input name=callback type=hidden value="$form->{script}?action=list_users&rpw=$form->{rpw}">
 
-<input type=hidden name=path value=$form->{path}>
 <input type=hidden name=rpw value=$form->{rpw}>
 
 <input type=hidden name=nextsub value=dbupdate>
@@ -1458,7 +1450,7 @@ sub dbupdate {
 <br>
 
 <a id="enddatasetupdate" href="admin.pl?action=login&| .
-join("&", map({ "$_=" . $form->escape($form->{$_}); } qw(path rpw))) .
+join("&", map({ "$_=" . $form->escape($form->{$_}); } qw(rpw))) .
 qq|">| . $locale->text("Continue") . qq|</a>|;
 
 }
@@ -1478,24 +1470,24 @@ sub create_dataset {
   }
   closedir SQLDIR;
 
-  $selectencoding = qq|<option>
-  <option value="SQL_ASCII">ASCII
-  <option value="EUC_JP">Japanese Extended UNIX Code
-  <option value="EUC_CN">Chinese Extended UNIX Code
-  <option value="EUC_KR">Korean Extended UNIX Code
-  <option value="EUC_TW">Taiwan Extended UNIX Code
-  <option value="UNICODE">UTF-8 Unicode
-  <option value="MULE_INTERNAL">Mule internal type
-  <option selected="selected"  value="LATIN1">ISO 8859-1 
-  <option value="LATIN2">ISO 8859-2
-  <option value="LATIN3">ISO 8859-3
-  <option value="LATIN4">ISO 8859-4
-  <option value="LATIN5">ISO 8859-5
-  <option value="LATIN9">ISO 8859-15
-  <option value="KOI8">KOI8-R
-  <option value="WIN">Windows CP1251
-  <option value="ALT">Windows CP866
-  |;
+  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};
+
+    $default_encoding = $encoding->{dbencoding} if $encoding->{charset} eq $default_charset;
+  }
+
+  $selectencoding =
+    NTI($cgi->popup_menu('-name' => 'encoding',
+                         '-values' => \@values,
+                         '-labels' => \%labels,
+                         '-default' => $default_encoding));
 
   $form->{title} =
       "Lx-Office ERP "
@@ -1535,7 +1527,7 @@ sub create_dataset {
   <tr>
 
     <th align=right nowrap>| . $locale->text('Multibyte Encoding') . qq|</th>
-    <td><select name=encoding>$selectencoding</select></td>
+    <td>$selectencoding</td>
 
   </tr>
 
@@ -1556,9 +1548,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}&rpw=$form->{rpw}">
+<input name=callback type=hidden value="$form->{script}?action=list_users&rpw=$form->{rpw}">
 
-<input type=hidden name=path value=$form->{path}>
 <input type=hidden name=rpw value=$form->{rpw}>
 
 <input type=hidden name=nextsub value=dbcreate>
@@ -1609,7 +1600,6 @@ sub dbcreate {
 
     . qq|
 
-<input type=hidden name=path value="$form->{path}">
 <input type=hidden name=rpw value="$form->{rpw}">
 
 <input type=hidden name=nextsub value=list_users>
@@ -1672,9 +1662,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}&rpw=$form->{rpw}">
+<input name=callback type=hidden value="$form->{script}?action=list_users&rpw=$form->{rpw}">
 
-<input type=hidden name=path value="$form->{path}">
 <input type=hidden name=rpw value="$form->{rpw}">
 
 <input type=hidden name=nextsub value=dbdelete>
@@ -1724,7 +1713,6 @@ $form->{db} | . $locale->text('successfully deleted!')
 
     . qq|
 
-<input type=hidden name=path value="$form->{path}">
 <input type=hidden name=rpw value="$form->{rpw}">
 
 <input type=hidden name=nextsub value=list_users>
@@ -1745,7 +1733,7 @@ sub unlock_system {
   unlink "$userspath/nologin";
 
   $form->{callback} =
-    "$form->{script}?action=list_users&path=$form->{path}&rpw=$root->{password}";
+    "$form->{script}?action=list_users&rpw=$root->{password}";
 
   $form->redirect($locale->text('Lockfile removed!'));
 
@@ -1758,7 +1746,7 @@ sub lock_system {
   close(FH);
 
   $form->{callback} =
-    "$form->{script}?action=list_users&path=$form->{path}&rpw=$root->{password}";
+    "$form->{script}?action=list_users&rpw=$root->{password}";
 
   $form->redirect($locale->text('Lockfile created!'));