summaryrefslogtreecommitdiff
path: root/doc/todo
diff options
context:
space:
mode:
Diffstat (limited to 'doc/todo')
0 files changed, 0 insertions, 0 deletions
GNU General Public License
  • # along with this program; if not, write to the Free Software
  • # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  • #======================================================================
  • #
  • # setup module
  • # add/edit/delete users
  • #
  • #======================================================================
  • $menufile = "menu.ini";
  • use SL::Form;
  • use SL::User;
  • $form = new Form;
  • $locale = new Locale $language, "admin";
  • $form->{charset} = $locale->{charset};
  • eval { require DBI; };
  • $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 Small Medium Business 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 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'));
  • }
  • 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}";