$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";
-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}"; };
+if (-f "bin/mozilla/custom_$form->{script}") {
+ eval { require "bin/mozilla/custom_$form->{script}"; };
$form->error($@) if ($@);
}
&check_password;
- &$subroutine;
+ call_sub($subroutine);
} else {
. $locale->text('Login') . qq|"></td>
</tr>
<input type=hidden name=action value=login>
-<input type=hidden name=path value=$form->{path}>
</table>
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="|
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\///;
</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="|
<td><input type=submit name=action value="|
. $locale->text('Login') . qq|"></td>
</tr>
-<input type=hidden name=path value=$form->{path}>
</table>
</td>
</tr>
}
}
- opendir CSS, "css/.";
- @all = sort(grep({ /\.css$/ && ($_ ne "tabcontent.css") } readdir(CSS)));
- closedir CSS;
+# opendir CSS, "css/.";
+# @all = grep /.*\.css$/, readdir CSS;
+# closedir CSS;
+
+# css dir has styles that are not intended as general layouts.
+# reverting to hardcoded list
+ @all = qw(lx-office-erp.css Win2000.css);
foreach $item (@all) {
if ($item eq $myconfig->{stylesheet}) {
$form->header;
- if ($myconfig->{menustyle} eq "neu") { $neu = "checked"; }
- else { $old = "checked"; }
+ 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>
<table>
<tr>
<th align=right>| . $locale->text('Login') . qq|</th>
- <td><input name=login value="$myconfig->{login}"></td>
+ <td><input name="login" value="$myconfig->{login}"></td>
</tr>
<tr>
<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}>
+ <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>
- <td><input name=name size=15 value="$myconfig->{name}"></td>
+ <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('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>
</tr>
<tr>
<th align=right>| . $locale->text('Setup Menu') . qq|</th>
- <td><input name=menustyle type=radio class=radio value=neu $neu> New
- <input name=menustyle type=radio class=radio value=old $old> Old</td>
+ <td><input name=menustyle type=radio class=radio value=v3 $menustyle_v3> | .
+ $locale->text("Top (CSS)") . qq|
+ <input name=menustyle type=radio class=radio value=neu $menustyle_neu> | .
+ $locale->text("Top (Javascript)") . qq|
+ <input name=menustyle type=radio class=radio value=old $menustyle_old> | .
+ $locale->text("Old (on the side)") . qq|
+ </td>
</tr>
<input type=hidden name=templates value=$myconfig->{templates}>
</table>
print qq|
<th align=right>| . $locale->text('Driver') . qq|</th>
- <td><input name=dbdriver type=radio class=radio value=$item $checked> $item</td>
+ <td><input name="dbdriver" type="radio" class="radio" value="$item" $checked> $item</td>
<th align=right>| . $locale->text('Host') . qq|</th>
- <td><input name="${item}_dbhost" size=30 value=$form->{"${item}_dbhost"}></td>
+ <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>
- <td><input name=Pg_dbname size=15 value=$form->{Pg_dbname}></td>
+ <td><input name="Pg_dbname" size="15" value="$form->{Pg_dbname}"></td>
<th align=right>| . $locale->text('Port') . qq|</th>
- <td><input name=Pg_dbport size=4 value=$form->{Pg_dbport}></td>
+ <td><input name="Pg_dbport" size="4" value="$form->{Pg_dbport}"></td>
</tr>
<tr>
<th align=right>| . $locale->text('User') . qq|</th>
- <td><input name="${item}_dbuser" size=15 value=$form->{"${item}_dbuser"}></td>
+ <td><input name="${item}_dbuser" size=15 value="$form->{"${item}_dbuser"}"></td>
<th align=right>| . $locale->text('Password') . qq|</th>
- <td><input name="${item}_dbpasswd" type=password size=10 value=$form->{"${item}_dbpasswd"}></td>
+ <td><input name="${item}_dbpasswd" type=password size=10 value="$form->{"${item}_dbpasswd"}"></td>
</tr>|;
}
<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>
- <td><input name="${item}_dbpasswd" type=password size=10 value=$form->{"${item}_dbpasswd"}></td>
+ <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}>
+ <input type="hidden" name="old_dbpasswd" value="$myconfig->{dbpasswd}">
</table>
</td>
</tr>
@a = <FH>;
close(FH);
- if (open(FH, "custom_$menufile")) {
- push @a, <FH>;
- }
- close(FH);
-
foreach $item (@a) {
next unless $item =~ /\[/;
next if $item =~ /\#/;
}
}
+ $form->{templates} =~ s|.*/||;
+ $form->{mastertemplates} =~ s|.*/||;
+
# create user template directory and copy master files
if (!-d "$form->{templates}") {
umask(002);
</tr>
</table>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=rpw value=$form->{rpw}>
<p>
$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!'));
<tr>
<th align=right>| . $locale->text('User') . qq|</th>
- <td><input name=dbuser size=10 value=$form->{dbuser}></td>
+ <td><input name="dbuser" size="10" value="$form->{dbuser}"></td>
<th align=right>| . $locale->text('Password') . qq|</th>
- <td><input type=password name=dbpasswd size=10></td>
+ <td><input type="password" name="dbpasswd" size="10"></td>
</tr>
</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>
}
sub continue {
-
- &{ $form->{nextsub} };
-
+ call_sub($form->{"nextsub"});
}
sub update_dataset {
<table width=100%>
<form method=post action=$form->{script}>
-<input type=hidden name=dbdriver value=$form->{dbdriver}>
-<input type=hidden name=dbhost value=$form->{dbhost}>
-<input type=hidden name=dbport value=$form->{dbport}>
-<input type=hidden name=dbuser value=$form->{dbuser}>
-<input type=hidden name=dbpasswd value=$form->{dbpasswd}>
-<input type=hidden name=dbdefault value=$form->{dbdefault}>
+<input type=hidden name="dbdriver" value="$form->{dbdriver}">
+<input type=hidden name="dbhost" value="$form->{dbhost}">
+<input type=hidden name="dbport" value="$form->{dbport}">
+<input type=hidden name="dbuser" value="$form->{dbuser}">
+<input type=hidden name="dbpasswd" value="$form->{dbpasswd}">
+<input type=hidden name="dbdefault" value="$form->{dbdefault}">
<tr class=listheading>
<th>| . $locale->text('The following Datasets need to be updated') . qq|</th>
<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>
<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>|;
}
}
opendir SQLDIR, "sql/." or $form - error($!);
- foreach $item (sort grep /-chart\.sql/, readdir SQLDIR) {
+ foreach $item (sort grep /-chart\.sql\z/, readdir SQLDIR) {
next if ($item eq 'Default-chart.sql');
$item =~ s/-chart\.sql//;
push @charts,
}
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 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=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 "
<tr>
<th align=right nowrap>| . $locale->text('Multibyte Encoding') . qq|</th>
- <td><select name=encoding>$selectencoding</select></td>
+ <td>$selectencoding</td>
</tr>
<tr><td colspan=2>
<p>
-<input type=hidden name=dbdriver value=$form->{dbdriver}>
-<input type=hidden name=dbuser value=$form->{dbuser}>
-<input type=hidden name=dbhost value=$form->{dbhost}>
-<input type=hidden name=dbport value=$form->{dbport}>
-<input type=hidden name=dbpasswd value=$form->{dbpasswd}>
-<input type=hidden name=dbdefault value=$form->{dbdefault}>
+<input type=hidden name="dbdriver" value="$form->{dbdriver}">
+<input type=hidden name="dbuser" value="$form->{dbuser}">
+<input type=hidden name="dbhost" value="$form->{dbhost}">
+<input type=hidden name="dbport" value="$form->{dbport}">
+<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>
. 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>
<tr><td>
<p>
-<input type=hidden name=dbdriver value=$form->{dbdriver}>
-<input type=hidden name=dbuser value=$form->{dbuser}>
-<input type=hidden name=dbhost value=$form->{dbhost}>
-<input type=hidden name=dbport value=$form->{dbport}>
-<input type=hidden name=dbpasswd value=$form->{dbpasswd}>
-<input type=hidden name=dbdefault value=$form->{dbdefault}>
+<input type=hidden name="dbdriver" value="$form->{dbdriver}">
+<input type=hidden name="dbuser" value="$form->{dbuser}">
+<input type=hidden name="dbhost" value="$form->{dbhost}">
+<input type=hidden name="dbport" value="$form->{dbport}">
+<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>
. 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>
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!'));
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!'));