summaryrefslogtreecommitdiff
path: root/perl/Locale/Po4a
diff options
context:
space:
mode:
Diffstat (limited to 'perl/Locale/Po4a')
0 files changed, 0 insertions, 0 deletions
  • $form->error($locale->text('DBI not installed!')) if ($@);
  • $form->{stylesheet} = "sql-ledger.css";
  • $form->{favicon} = "favicon.ico";
  • $form->{timeout} = 600;
  • require "$form->{path}/pw.pl";
  • # customization
  • if (-f "$form->{path}/custom_$form->{script}") {
  • eval { require "$form->{path}/custom_$form->{script}"; };
  • $form->error($@) if ($@);
  • }
  • if ($form->{action}) {
  • &check_password unless $form->{action} eq 'logout';
  • &{ $locale->findsub($form->{action}) };
  • } else {
  • # if there are no drivers bail out
  • $form->error($locale->text('No Database Drivers available!')) unless (User->dbdrivers);
  • # create memberfile
  • if (! -f $memberfile) {
  • open(FH, ">$memberfile") or $form->error("$memberfile : $!");
  • print FH qq|# LedgerSMB Accounting members
  • [root login]
  • password=
  • |;
  • close FH;
  • }
  • &adminlogin;
  • }
  • 1;
  • # end
  • sub adminlogin {
  • $form->{title} = qq|LedgerSMB $form->{version} |.$locale->text('Administration');
  • $form->header;
  • print qq|
  • <script language="JavaScript" type="text/javascript">
  • <!--
  • function sf(){
  • document.admin.password.focus();
  • }
  • // End -->
  • </script>
  • <body class=admin onload="sf()">
  • <div align=center>
  • <a href="http://sourceforge.net/projects/ledger-smb/"><img src="ledger-smb.png" width="200" height="100" border="0"></a>
  • <h1 class=login>|.$locale->text('Version').qq| $form->{version}<p>|.$locale->text('Administration').qq|</h1>
  • <form method=post action="$form->{script}" name=admin>
  • <table>
  • <tr>
  • <th>|.$locale->text('Password').qq|</th>
  • <td><input type=password name=password></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=path value=$form->{path}>
  • </table>
  • </form>
  • <a href="http://sourceforge.net/projects/ledger-smb/">LedgerSMB |.$locale->text('website').qq|</a>
  • </div>
  • </body>
  • </html>
  • |;
  • }
  • sub login {
  • &list_users;
  • }
  • sub logout {
  • $form->{callback} = "$form->{script}?path=$form->{path}&endsession=1";
  • $form->redirect($locale->text('You are logged out'));
  • unlink "$userspath/adminhash";
  • print qq|Set-Cookie: LedgerSMB=; path=/;\n|;
  • }
  • sub add_user {
  • $form->{title} = "LedgerSMB ".$locale->text('Accounting')." ".$locale->text('Administration')." / ".$locale->text('Add User');
  • $form->{Oracle_sid} = $sid;
  • $form->{Oracle_dbport} = '1521';
  • $form->{Oracle_dbhost} = `hostname`;
  • if (-f "css/sql-ledger.css") {
  • $myconfig->{stylesheet} = "sql-ledger.css";
  • }
  • $myconfig->{vclimit} = 1000;
  • $myconfig->{menuwidth} = 155;
  • $myconfig->{timeout} = 3600;
  • &form_header;
  • &form_footer;
  • }
  • sub edit {
  • $form->{title} = "LedgerSMB ".$locale->text('Accounting')." ".$locale->text('Administration')." / ".$locale->text('Edit User');
  • $form->{edit} = 1;
  • &form_header;
  • &form_footer;
  • }
  • sub form_footer {
  • if ($form->{edit}) {
  • $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}&sessionid=$form->{sessionid}">
  • <input type=hidden name=path value=$form->{path}>
  • <input type=hidden name=sessionid value=$form->{sessionid}>
  • <input type=submit class=submit name=action value="|.$locale->text('Save').qq|">
  • $delete
  • </form>
  • </body>
  • </html>
  • |;
  • }
  • 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|">|;
  • if (-e "$userspath/nologin") {
  • $nologin = 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;
  • }
  • }
  • close(FH);
  • # type=submit $locale->text('Pg Database Administration')
  • # type=submit $locale->text('PgPP 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|">|;
  • }
  • $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} = "LedgerSMB ".$locale->text('Accounting')." ".$locale->text('Administration');
  • $form->{login} = "root login";
  • $form->header;
  • print qq|
  • <body class=admin>
  • <form method=post action=$form->{script}>
  • <table width=100%>
  • <tr>
  • <tr class=listheading>
  • <th>$form->{title}</th>
  • </tr>
  • <tr size=5></tr>
  • <tr>
  • <td>
  • <table width=100%>
  • <tr class=listheading>|;
  • for (@column_index) { print "$column_header{$_}\n" }
  • print qq|
  • </tr>
  • |;
  • foreach $key (sort keys %member) {
  • $href = "$script?action=edit&login=$key&path=$form->{path}&sessionid=$form->{sessionid}";
  • $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>|;
  • for (@column_index) { print "$column_data{$_}\n" }
  • print qq|
  • </tr>|;
  • }
  • print qq|
  • </table>
  • </td>
  • </tr>
  • <tr>
  • <td><hr size=3 noshade></td>
  • </tr>
  • </table>
  • <input type=hidden name=path value=$form->{path}>
  • <input type=hidden name=sessionid value=$form->{sessionid}>
  • <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
  • <input type=submit class=submit name=action value="|.$locale->text('Logout').qq|">
  • </form>
  • |.$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|
  • </body>
  • </html>
  • |;
  • }
  • sub form_header {
  • # if there is a login, get user
  • if ($form->{login}) {
  • # get user
  • $myconfig = new User "$memberfile", "$form->{login}";
  • for (qw(company address signature)) { $myconfig->{$_} = $form->quote($myconfig->{$_}) }
  • for (qw(address signature)) { $myconfig->{$_} =~ s/\\n/\n/g }
  • # strip basedir from templates directory
  • $myconfig->{templates} =~ s/^$templates\///;
  • $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";
  • }
  • foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00 1'000.00)) {
  • $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}";
  • }
  • $countrycodes = qq|<option value="">English\n$countrycodes|;
  • # is there a templates basedir
  • 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;
  • closedir TEMPLATEDIR;
  • @allhtml = sort grep /\.html/, @all;
  • @alldir = ();
  • for (@all) {
  • if (-d "$templates/$_") {
  • push @alldir, $_;
  • }
  • }
  • @allhtml = reverse grep !/Default/, @allhtml;
  • push @allhtml, 'Default';
  • @allhtml = reverse @allhtml;
  • foreach $item (sort @alldir) {
  • if ($item eq $myconfig->{templates}) {
  • $usetemplates .= qq|<option selected>$item\n|;
  • } else {
  • $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|;
  • $lastitem = $item;
  • }
  • }
  • opendir CSS, "css/.";
  • @all = grep /.*\.css$/, readdir CSS;
  • closedir CSS;
  • foreach $item (@all) {
  • if ($item eq $myconfig->{stylesheet}) {
  • $selectstylesheet .= qq|<option selected>$item\n|;
  • } else {
  • $selectstylesheet .= qq|<option>$item\n|;
  • }
  • }
  • $selectstylesheet .= "<option>\n";
  • if (%printer && $latex) {
  • $selectprinter = "<option>\n";
  • foreach $item (sort keys %printer) {
  • if ($myconfig->{printer} eq $item) {
  • $selectprinter .= qq|<option value="$item" selected>$item\n|;
  • } else {
  • $selectprinter .= qq|<option value="$item">$item\n|;
  • }
  • }
  • $printer = qq|
  • <tr>
  • <th align=right>|.$locale->text('Printer').qq|</th>
  • <td><select name=printer>$selectprinter</select></td>
  • </tr>
  • |;
  • }
  • $user = $form->{login};
  • $form->{login} = "root login";
  • $form->header;