[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[3167] trunk
- Subject: SF.net SVN: ledger-smb:[3167] trunk
- From: ..hidden..
- Date: Sun, 22 May 2011 23:41:57 +0000
Revision: 3167
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3167&view=rev
Author: einhverfr
Date: 2011-05-22 23:41:57 +0000 (Sun, 22 May 2011)
Log Message:
-----------
Removing web db setup interface as it is now in addons
Removed Paths:
-------------
trunk/LedgerSMB/Initiate.pm
trunk/bin/initiate.pl
trunk/initiate.pl
Deleted: trunk/LedgerSMB/Initiate.pm
===================================================================
--- trunk/LedgerSMB/Initiate.pm 2011-05-22 23:40:57 UTC (rev 3166)
+++ trunk/LedgerSMB/Initiate.pm 2011-05-22 23:41:57 UTC (rev 3167)
@@ -1,682 +0,0 @@
-
-
-# inline documentation
-
-package LedgerSMB::Initiate;
-use LedgerSMB::Sysconfig;
-use LedgerSMB::Auth;
-use LedgerSMB::Locale;
-use Data::Dumper;
-use DBI;
-use Locale::Language;
-use Locale::Country;
-use LedgerSMB::Log;
-
-my $logger = Log::Log4perl->get_logger('LedgerSMB::Initiate');
-
-=over
-
-=item LedgerSMB::User->new($login);
-
-Create a LedgerSMB::User object. If the user $login exists, set the fields
-with values retrieved from the database.
-
-=back
-
-=cut
-
-
-sub new
-{
-
- my $class=shift;
-
- my $form = shift;
-
- my $self={};
-
- bless $self,$class;
-
- $self->initialize($form);
-
- return $self;
-
-}
-
-
-sub initialize
-{
-
- my $self=shift;
- my $form=shift;
-
- # In future if required use this function to initialize the attributes of the class "Initiate"
-
- $self->{initiateon}=$form->{initiateon};
-
- if(scalar($self->{initiateon})==1)
- {
- $form->{company}= 'template1';
- $form->{port}=${LedgerSMB::Sysconfig::port};
- $form->{host}=${LedgerSMB::Sysconfig::host};
-
- }
-
-
-
-}
-
-
-
-
-
-
-sub checksuperuser
-{
-
- my($self,$form)..hidden..;
-
- my $dbh=$form->{dbh};
-
- my $sth=$dbh->prepare("select rolsuper from pg_roles where rolname = session_user;") || $form->dberror(
- __FILE__ . ':' . __LINE__ . ': Finding Superuser Prepare failed : ' );;
-
- $sth->execute() or $form->dberror(
- __FILE__ . ':' . __LINE__ . ': Finding Superuser : execution failed' );
-
- my $super=0;
-
- $super=$sth->fetchrow_array;
-
-
- return($super);
-
-
-}
-
-
-
-
-
-sub get_countrys
-{
-
- my $dir=$ENV{SCRIPT_FILENAME};
-
- $dir =~s/\/[\w\d\.]*$/\/sql\/coa\//; # 2nd way is store path of coa in sysconfig file
-
-
- my @dir= sort LedgerSMB::Initiate->read_directory($form,$dir);
-
- my @allcodes = grep !/\.+/,@dir;
-
-
- my $returnvalue=qq|<option value="">null</option>|;
-
- for my $code(@allcodes)
- {
- $returnvalue.=qq|<option value="$code">$code</option>|;
- }
-
-
- return $returnvalue;
-
-
-}
-
-
-
-
-
-sub validateform
-{
- $logger->debug("Begin LedgerSMB::Initiate::validateform");
-
- ($self,$form,$locale)..hidden..;
-
-
-# print STDERR "DF database => $form->{database} dbhost= $form->{dbhost} $form->{dbport} $form->{contribpath} ";
-
-
-
- $form->{database}=~s/ //g;
-
- $form->error( __FILE__ . ':' . __LINE__ . ': '
- . $form->{locale}->text('Database Missing!') )
- unless $form->{database};
-
-
- $form->{dbhost}=~s/ //g;
-
-
-
- $form->{contribpath}=~s/ //g;
-
- $form->error( __FILE__ . ':' . __LINE__ . ': '
- . $locale->text('Contribution File Path Missing!') )
- unless $form->{contribpath};
-
-
- $form->{countrycode}=~s/ //g;
-
- $form->error( __FILE__ . ':' . __LINE__ . ': '
- . $locale->text('Country Code Missing!') )
- unless $form->{countrycode};
-
-
-
- $form->error( __FILE__ . ':' . __LINE__ . ': '
- . $locale->text('Chart Account Missing!') )
- unless $form->{chartaccount};
-
-
-
- # check for duplicates
-
- if ( !$form->{edit} ) {
-
- # If we can connect to the database, then it already exists
- my $tempdbh = DBI->connect(
- "dbi:Pg:db=$form->{database};host=$form->{dbhost};port=$form->{dbport}",
- $form->{username},
- $form->{password},
- { PrintError => 0 },
- );
-
-
- if ( defined($tempdbh)) {
- $tempdbh->disconnect;
- $form->error( __FILE__ . ':' . __LINE__ . ': '
- . $locale->text( '[_1] is already a database!', $form->{database} )
- );
- }
- }
- $logger->debug("End LedgerSMB::Initiate::validateform");
-}
-
-
-sub save_database
-{
- $logger->debug("Begin LedgerSMB::Initiate::save_database");
-
- my($self,$form)..hidden..;
- # check all files exist and valids (contrib files , pgdabase.sql and modules and chart accounts etc)
-
- my @contrib=LedgerSMB::Initiate->check_contrib_valid_exist($form); #check contrib files
-
- my @postsql=LedgerSMB::Initiate->check_Pg_database_valid_exist($form); #check sql/Pg-databse.sql files
-
- my @sqlmodules=LedgerSMB::Initiate->check_sql_modules_valid_exist($form); #check sql/modules/readme file content exist or not
-
- my @chartgififiles=LedgerSMB::Initiate->merge_chart_gifi_valid_exist($form); # check sql/coa/charts and sql/coa/gifi files
-
- my @totalexecutable_files;
-# push(@totalexecutable_files,@contrib);
- push(@totalexecutable_files,@postsql);
- push(@totalexecutable_files,@sqlmodules);
- push(@totalexecutable_files,@chartgififiles);
-
- # Now all the files are found now start execution process(Stages)
-
- # Initial setup operations are performed while connected to the postgres
- # database as the currently authenticated user. This database should be
- # present even on a fresh install of PostgreSQL. The authenticated user
- # must have superuser rights to complete this stage of the setup.
- $form->{dbh} = DBI->connect(
- "dbi:Pg:db=postgres;host=$form->{dbhost};port=$form->{dbport}",
- $form->{username},
- $form->{password},
- ) or $form->error( __FILE__ . ':' . __LINE__ . ': ' .
- $locale->text( 'unable to connect to postgres database on [_1]:[_2]',
- $form->{dbhost},$form->{dbport}));
-
- #Stage 1 - Create the databse $form->{database}
-
- # Initial setup operations are performed while connected to the postgres
- # database as the currently authenticated user. This database should be
- # present even on a fresh install of PostgreSQL. The authenticated user
- # must have superuser rights to complete this stage of the setup.
- $form->{dbh} = DBI->connect(
- "dbi:Pg:db=postgres;host=$form->{dbhost};port=$form->{dbport}",
- $form->{username},
- $form->{password},
- ) or $form->error( __FILE__ . ':' . __LINE__ . ': ' .
- $locale->text( 'unable to connect to postgres database on [_1]:[_2]',
- $form->{dbhost},$form->{dbport}));
-
- LedgerSMB::Initiate->create_database($form);
- LedgerSMB::Initiate->run_scripts_as_superuser($form,..hidden..);
-
- # Now connect to the newly created database as the admin user
- # This connection is used for all subsequent operations
- $form->{dbh} = DBI->connect(
- "dbi:Pg:db=$form->{database};host=$form->{dbhost};port=$form->{dbport}",
- $form->{admin_username},
- $form->{admin_password},
- ) or $form->error( __FILE__ . ':' . __LINE__ . ': ' .
- $locale->text( 'unable to connect to postgres database on [_1]:[_2]',
- $form->{dbhost},$form->{dbport}));
-
- #Stage 2 - CReate the language plpgsql
-
- LedgerSMB::Initiate->handle_create_language($form);
-
- #stage 3 - Execute series of files which are located in array @totalexecutable_files
-
- LedgerSMB::Initiate->run_scripts_as_admin_user($form,..hidden..);
-
- #Stage - Wind up completed the task
- process_roles($form);
-
- #Stage 5 - Load languages
- load_languages($form);
-
- $logger->debug("End LedgerSMB::Initiate::save_database");
-}
-
-sub load_languages {
- $logger->debug("Beging LedgerSMB::Initiate::load_languages");
- my ($form) = @_;
-
- opendir DIR, $LedgerSMB::Sysconfig::localepath;
- foreach my $dir (grep !/^\.\.?$/, readdir DIR) {
- my $code = substr( $dir, 0, -3);
- $logger->debug("add language $code");
- my $description = code2language( substr( $code, 0, 2) );
- $description .= '/' . code2country( substr( $code, 3, 2) ) if(length($code) > 4);
- $description .= ' ' . substr( $code, 5 ) if(length($code) > 5);
- $form->{dbh}->do("insert into language ( code, description ) values ( " .
- $form->{dbh}->quote( $code ) . ', ' .
- $form->{dbh}->quote( $description ) . ')'
- ) || $form->error( __FILE__ . ':' . __LINE__ . ': '
- . $locale->text( 'language [_1]/[_2] creation failed',
- $code, $description));
- }
- closedir(DIR);
- $logger->debug("End LedgerSMB::Initiate::load_languages");
-}
-
-
-
-sub process_roles {
-
- $logger->debug("Begin LedgerSMB::Initiate::process_roles");
-
- my ($form) = @_;
-
- $ENV{PGDATABASE} = $form->{database};
- $ENV{PGHOST} = $form->{dbhost};
- $ENV{PGPORT} = $form->{dbport};
- $ENV{PGUSER} = $form->{username};
- $ENV{PGPASSWORD} = $form->{password};
-
- open (PSQL, '|-', 'psql') ||
- $form->error($locale->text("Couldn't open psql"));
-
- my $company = $form->{company};
- $logger->debug("LedgerSMB::Initiate::process_roles: company = $company");
-
- open (ROLEFILE, '<', 'sql/modules/Roles.sql') || $form->error($locale->text("Couldn't open Roles.sql"));
-
- while ($roleline = <ROLEFILE>){
- $roleline =~ s/<\?lsmb dbname \?>/$company/;
- print PSQL $roleline;
- }
-
-
- #create admin user
-
- my $dbh = $form->{dbh}; # used only for quote and quote_identifier
-
- print PSQL "GRANT " .
- $dbh->quote_identifier("lsmb_${company}__users_manage") .
- " TO " .
- $dbh->quote_identifier($form->{admin_username}) . ";\n";
-
- print PSQL "INSERT INTO entity " .
- " (name, entity_class, created, country_id) " .
- " VALUES ( '" . $form->{admin_username} . "', 3, NOW(), " .
- " (SELECT id FROM country WHERE short_name = '" .
- uc($form->{countrycode}) . "' ));\n";
-
- print PSQL "INSERT INTO person " .
- " (entity_id, first_name, last_name, created)".
- " VALUES ( (SELECT id FROM entity WHERE name = '" .
- $form->{admin_username} . "'), 'database', 'creator', NOW());\n";
-
- print PSQL "INSERT INTO users " .
- " (username, entity_id) " .
- " VALUES ( '" . $form->{admin_username} . "', " .
- " (SELECT id FROM entity WHERE name = '" .
- $form->{admin_username} . "'));\n";
-
- print PSQL "INSERT INTO user_preference (id) " .
- " VALUES ((SELECT id FROM users WHERE entity_id = " .
- " (SELECT id FROM entity " .
- " WHERE name = '" . $form->{admin_username} . "')));\n";
-
- $logger->debug("End LedgerSMB::Initiate::process_roles");
-}
-
-sub run_all_sql_scripts
-{
-
- my ($self,$form,$totalexcfiles)..hidden..;
-
- foreach $dbfile(@$totalexcfiles)
- {
- print STDERR "Loading $dbfile\n";
-
- LedgerSMB::Initiate->run_db_file($form,$dbfile);
-
- }
-
-
-}
-
-
-sub run_db_file
-{
-
- my($self,$form,$dbfile)..hidden..;
- if ($ENV{PGDATABASE} eq 'template1'){
- $form->error('No database specified!');
- }
- $ENV{PGDATABASE} = $form->{database};
- $ENV{PGHOST} = $form->{dbhost};
- $ENV{PGPORT} = $form->{dbport};
- $ENV{PGUSER} = $form->{username};
- $ENV{PGPASSWORD} = $form->{password};
- system("psql < $dbfile");
-}
-
-
-
-
-
-sub create_database
-{
- my ($self,$form)..hidden..;
-
- # Create the admin user first, so it can be the owner of the new database
- if ($form->{createuser}){
- # Note: LedgerSMB setup for this user is done in process_roles()
- $form->{dbh}->do(
- "CREATE ROLE " .
- $form->{dbh}->quote_identifier($form->{admin_username}) .
- " CREATEROLE LOGIN" .
- " PASSWORD " . $form->{dbh}->quote($form->{admin_password}) .
- ";\n"
- ) || $logger->error(__FILE__ . ':' . __LINE__ . ': ',
- "create role $form->{admin_username} failed");
- }
-
- $form->{dbh}->do(
- "create database $form->{database} " .
- " with owner $form->{admin_username}"
- ) || $form->error( __FILE__ . ':' . __LINE__ . ': '
- . $locale->text( 'database [_1] creation failed',$database));
-
-}
-
-sub handle_create_language
-{
-
- my($self,$form)..hidden..;
-
- eval {
- local $form->{dbh}->{RaiseError} = 1;
- $form->{dbh}->do("create language plpgsql");
- };
- if($@) {
- $form->error( __FILE__ . ':' . __LINE__ . ': '
- . $locale->text( 'create language plpgsql failed on database [_1]!', $form->{database} )
- );
- }
-}
-
-
-
-
-
-
-sub check_contrib_valid_exist
-{
-
- my ($self,$form)..hidden..;
-
- $locale=$form->{locale};
-
- #Check contrib files exist at particular directory else through an error
-
- $dir = $form->{contribpath};
- if ($dir !~ /\/$/){
- $dir = "$dir/";
- }
-
- $locale=$form->{locale};
-
- my @dir=LedgerSMB::Initiate->read_directory($form,$dir);readdir(IMD);
-
- @dest=("pg_trgm.sql","tablefunc.sql","tsearch2.sql"); #just expand array if contrib files increases
-
-
- if(!LedgerSMB::Initiate->all_files_found(..hidden..,..hidden..))
- {
- $form->error( __FILE__ . ':' . __LINE__ . ': '
- . $locale->text( 'Required contrib files not exist under [_1]',$dir));
- exit;
- }
-
- for(my $i=0;$i<=$#dest;$i++)
- {
-
- $dest[$i]=$dir.$dest[$i];
-
- }
-
- return(@dest);
-
-
-}
-
-
-
-sub check_Pg_database_valid_exist
-{
-
-
- #check sql/Pg-databas
- my ($self,$form)..hidden..;
-
- $locale=$form->{locale};
-
- my $dir=$ENV{SCRIPT_FILENAME};
-
- my @dest=("Pg-database.sql"); # extend the array if files increase
-
- $dir =~s/\/[\w\d\.]*$/\/sql\//;
-
- my @dir=LedgerSMB::Initiate->read_directory($form,$dir);
-
- if(!LedgerSMB::Initiate->all_files_found(..hidden..,..hidden..))
- {
- $form->error( __FILE__ . ':' . __LINE__ . ': '
- . $locale->text( 'Required Pg-database files Missing under [_1]',$dir));
- exit;
- }
-
-
- for(my $i=0;$i<=$#dest;$i++)
- {
-
- $dest[$i]=$dir.$dest[$i];
-
- }
-
- return(@dest);
-
-}
-
-
-sub check_sql_modules_valid_exist
-{
-
- my ($self,$form)..hidden..;
-
- $locale=$form->{locale};
- my @dest;
- my $dir=$ENV{SCRIPT_FILENAME};
-
- my $dir = "sql/modules/";
-
-
- #now dilemma with search files($dest)
-
- #1.List from README file
- #2.Read all sql files from sql/modules/ -- Sadashiva
- #
- # I moved the info out of README into LOADORDER to be more friendly to
- # programmers. --Chris
-
- open(ORD, '<', $dir . "LOADORDER");
- while (my $line = <ORD>){
- $line =~ s/\#.*$//; # ignore comments
- next if $line =~ /^\s*$/;
- $line =~ s/^\s*//;
- $line =~ s/\s*$//;
- push @dest, $dir.$line;
- }
-
-
-
- return(@dest);
-
-
-}
-
-
-
-sub merge_chart_gifi_valid_exist
-{
-
- my ($self,$form)..hidden..;
-
- my @files;
-
- my $coa = $form->{coa} || 'General';
- $coa = "$coa.sql" unless $coa =~ /\.sql$/;
-
- my $dir = ($ENV{SCRIPT_FILENAME} =~ m/^(.*\/)/) ? $1 : './';
-
- $dir .= "/sql/coa/$form->{countrycode}/";
-
- if($form->{chartaccount}) {
- my $file = $dir . 'chart/' . $coa;
- if(-e $file) {
- push(@files, $file);
- } else {
- $logger->error("$file: not found");
- }
- }
-
- if($form->{gifiaccount}) {
- my $file = $dir . 'gifi/' . $coa;
- if(-e $file) {
- push(@files, $file);
- } else {
- $logger->error("$file: not found");
- }
- }
-
- return(@files);
-}
-
-
-sub run_scripts_as_superuser
-{
-
- my ($self,$form,$files)..hidden..;
-
- $ENV{PGDATABASE} = $form->{database};
- $ENV{PGHOST} = $form->{dbhost};
- $ENV{PGPORT} = $form->{dbport};
- $ENV{PGUSER} = $form->{username};
- $ENV{PGPASSWORD} = $form->{password};
-
- foreach $dbfile(@$files)
- {
- $logger->debug("Loading $dbfile");
- system("psql < $dbfile");
- }
-}
-
-
-
-
-
-
-sub read_directory
-{
-
- my($self,$form,$dir)..hidden..;
-
- $locale=$form->{locale};
-
- opendir(DIR,$dir) || $form->error( __FILE__ . ':' . __LINE__ . ': '
- . $locale->text( '[_1] directory Missing!', $dir));
-
- my @dircontent=readdir(DIR);
-
- closedir(DIR);
-
- return(@dircontent);
-
-}
-
-
-sub get_fullpath
-{
-
- my($self,$dir,$files)..hidden..;
-
- for(my $i=0;$i<..hidden..;$i++)
- {
-
- $files->[$i]=$dir.$files->[$i];
-
- }
-
-
- return(@$files);
-
-
-}
-
-
-
-
-
-sub all_files_found
-{
-
-
- my ($self,$search,$source)..hidden..;
-
- for my $file(@$search)
- {
- $allfiles = grep /^$file$/,@$source;
-
- return 0 unless($allfiles);
-
- }
-
- return 1;
-
-
-}
-
-
-1;
-
-
Deleted: trunk/bin/initiate.pl
===================================================================
--- trunk/bin/initiate.pl 2011-05-22 23:40:57 UTC (rev 3166)
+++ trunk/bin/initiate.pl 2011-05-22 23:41:57 UTC (rev 3167)
@@ -1,360 +0,0 @@
-
-use LedgerSMB::Form;
-use LedgerSMB::Locale;
-use LedgerSMB::User;
-use LedgerSMB::Initiate;
-use LedgerSMB::Auth;
-use LedgerSMB::Log;
-use Data::Dumper;
-
-my $logger = Log::Log4perl->get_logger('initiate');
-
-$logger->debug('start bin/initiate.pl');
-
-#use LedgerSMB::Session;
-
-$root="";
-
-$form = new Form;
-
-$locale = LedgerSMB::Locale->get_handle( ${LedgerSMB::Sysconfig::language} ) or $form->error( __FILE__ . ':' . __LINE__ . ': ' . "Locale not loaded: $!\n" );
-
-$locale->encoding('UTF-8');
-
-$form->{locale}=$locale;
-
-$form->{charset} = 'UTF-8';
-
-eval { require DBI; };
-
-$form->error(
- __FILE__ . ':' . __LINE__ . ': ' . $locale->text('DBI not installed!') )
- if ($@);
-
-$form->{stylesheet} = "ledgersmb.css";
-$form->{favicon} = "favicon.ico";
-$form->{timeout} = 600;
-
-require "bin/pw.pl";
-
-# customization
-if ( -f "bin/custom/$form->{script}" ) {
- eval { require "bin/custom/$form->{script}"; };
- $form->error( __FILE__ . ':' . __LINE__ . ': ' . $@ ) if ($@);
-}
-
-# because iniate.pl called only at admin for initializtion everything at default_db
-
-if ( $form->{action} ) {
-
- &check_password unless $form->{action} eq 'logout';
-
- &{ $form->{action} };
-
-}
-else {
-
- # if there are no drivers bail out
- $form->error( __FILE__ . ':' . __LINE__ . ':' . $locale->text('No Database Drivers available!') )
- unless ( LedgerSMB::User->dbdrivers );
-
- &check_password;
-
- $form->{'action'}='login';
-
- &{ $form->{action} };
-
-
-
-
-}
-
-1;
-
-# end
-
-sub check_password {
-
-
- my $auth_temp=LedgerSMB::Auth->get_credentials();
-
- LedgerSMB::Auth->credential_prompt unless($auth_temp);
-
- $form->{'login'}=$auth_temp->{'login'};
-
- $form->{'username'}=$auth_temp->{'login'};
-
- $form->{'password'}=$auth_temp->{'password'};
-
- $form->{'initiateon'}=1;
-
- $root=LedgerSMB::Initiate->new($form);
-
- $form->{dbh}=$root->getdbh($form); # get the connection if user exist as superuser
-
- if ( lc($form->{dbh}) eq "no999" or !$root->checksuperuser($form)) {
- LedgerSMB::Auth->credential_prompt;
- exit;
- }
-
-
-}
-
-
-sub login {
-
- &prepare_initiate($form);
-
-}
-
-
-sub prepare_initiate {
-
-
- # use the dynamic database handle (self = form )
-
- my ($self)..hidden..;
-
- #get the username and password from cookie for time being it would holds
-
- my $dbh = $self->{dbh};
-
-
- $self->{title} =
- "LedgerSMB Initial Database Set Up Vizard";
-
- $self->header;
-
-
- print qq|
- <body class="initiate">
- <form method="post" action="$self->{script}">
- <table width="100%">
- <tr class="listheading">
- <th>$self->{title}</th>
- </tr>
- <tr size="5"></tr>|;
-
-
- print qq|
- <tr>
- <td><hr size="3" noshade /></td>
- </tr>
- </table>
- <input type="hidden" name="path" value="$self->{path}" />
- <br />
- <button type="submit" class="submit" name="action" value="initiate_database">|
- . $locale->text('Initiate Database')
- . qq|</button>
- <button type="submit" class="submit" name="action" value="logout">|
- . $locale->text('Logout')
- . qq|</button>
- </form>
-
- | . qq|
-
- </body>
- </html>|;
-
-
-}
-
-
-
-
-
-sub logout {
-
- #$form->redirect( $locale->text('successfully logged Out') );
-
- LedgerSMB::Auth->credential_prompt;
-
-}
-
-sub initiate_database {
-
- $form->{title} =
- "LedgerSMB "
- . $locale->text('Administration') . " / "
- . $locale->text('Initial database Setup');
-
- if ( -f "css/ledgersmb.css" ) {
- $myconfig->{stylesheet} = "ledgersmb.css";
- }
-
- $myconfig->{vclimit} = 1000;
- $myconfig->{menuwidth} = 155;
- $myconfig->{timeout} = 3600;
-
- &form_header;
- &form_footer;
-}
-
-
-sub view_database {
-
- $form->{title} =
- "LedgerSMB "
- . $locale->text('Administration') . " / "
- . $locale->text('Initial database Setup');
-
-
- if ( -f "css/ledgersmb.css" ) {
- $myconfig->{stylesheet} = "ledgersmb.css";
- }
-
- $myconfig->{vclimit} = 1000;
- $myconfig->{menuwidth} = 155;
- $myconfig->{timeout} = 3600;
- $form->header;
- $form->redirect( $locale->text('Under Construction!') );
-
-}
-
-
-
-sub form_footer {
-
- if ( $form->{edit} ) {
- $delete =
- qq|<button type="submit" class="submit" name="action" value="delete">|
- . $locale->text('Delete')
- . qq|</button>
- <input type="hidden" name="edit" value="1" />|;
- }
-
- print qq|
- <input name="callback" type="hidden" value="$form->{script}?action=initiate_database&path=$form->{path}" />
- <input type="hidden" name="path" value="$form->{path}" />
- <button type="submit" class="submit" name="action" value="save">|
- . $locale->text('Save')
- . qq|</button>
- <button type="reset" class="reset" name="action" value="reset">|
- . $locale->text('Reset').
- qq|</button>
- $delete
- </form>
- </body>
- </html>
- |;
-}
-
-
-
-sub form_header
-{
-
-$form->header;
-
-
-print qq|
- <body class="admin">
- <form method="post" action="initiate.pl">
- <table width="100%">
- <tr class="listheading"><th colspan="2">$form->{title}</th></tr>
- <tr size="5"></tr>
- <tr valign="top">
- <td>
- <table>
- <tr>
- <th align="right">| . $locale->text('Database') . qq|</th>
- <td><input name="database" value="$myconfig->{database}" /></td>
- </tr>
- <tr>
- <th align="right">| . $locale->text('Host') . qq|</th>
- <td><input name="dbhost" value="$myconfig->{host}" /></td>
- </tr>
- <tr>
- <th align="right">| . $locale->text('Port') . qq|</th>
- <td><input name="dbport" size="5" value="$myconfig->{port}" /></td>
- </tr>
-
- </table>
- </td>
-
- </tr>
- <tr></tr>
- <tr class="listheading">
- <th colspan="2">| . $locale->text('Contrib Files') . qq|</th>
- </tr>
- <tr size="5"></tr>
- <tr valign="top">
- <td>
- <table>
- <tr>
- <th align="right">| . $locale->text('Path of Contrib Files') . qq|</th>
- <td><input name="contribpath" value="$myconfig->{contribpath}" /></td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr></tr>
- <tr class="listheading">
- <th colspan="2">| . $locale->text('Chart Accounts') . qq|</th>
- </tr>
- <tr size="5"></tr>
- <tr valign="top">
- <td>
- <table>
- <tr>
- <th align="right">| . $locale->text('Country Code');
- my $country=LedgerSMB::Initiate->get_countrys();
- # just testing manually $myconfig->{countrycode}="uk";
- $country=~s/<option value="$myconfig->{countrycode}">/<option value="$myconfig->{countrycode}" selected="selected">/;
-print qq| </th>
- <td><select name="countrycode">$country</select></td>
- </tr>
- <tr>
- <th align="right">| . $locale->text('Charts Account') . qq|</th>
- <td><input name="chartaccount" class="checkbox" type="checkbox" value="1">$myconfig->{chartaccount}</td>
- </tr>
-
- <tr>
- <th align="right">| . $locale->text('Gifi Account') . qq|</th>
- <td><input name="gifiaccount" class="checkbox" type="checkbox" value="2">$myconfig->{gifiaccount}</td>
- </tr>
- <tr><th align="right">|. $locale->text('Chart Name') .qq|</th>
- <td><input name="coa" type="text" size="32"></td>
- </table>
- <tr class="listheading">
- <th colspan="2">|.
- $locale->text('Admin User').
- qq|</th></tr><table>
- <tr> <th aligh="right">|.$locale->text('Admin User') . qq| </th>
- <td><input name="admin_username" type="text" size="32" /></td>
- </tr>
- <tr> <td colspan="2"> | . $locale->text('Create database user') . qq| <input name="createuser" class="checkbox" type="checkbox" value="1"></tr>
- <tr> <th align="right"> | . $locale->text('Password') . qq| </th>
- <td><input name="admin_password" type="password" size="32"></td>
- </table>
- </td>
- </tr>
-
-
-
- </table>|;
-
-
-
-
-}
-
-
-
-
-sub save {
-
- $form->{callback} = "initiate.pl?action=login";
- $form->header;
- print "<pre>";
-
- LedgerSMB::Initiate->validateform($form,$locale);
-
- LedgerSMB::Initiate->save_database($form);
- print "</pre>";
- # create user template directory and copy master files
-
-}
-
Deleted: trunk/initiate.pl
===================================================================
--- trunk/initiate.pl 2011-05-22 23:40:57 UTC (rev 3166)
+++ trunk/initiate.pl 2011-05-22 23:41:57 UTC (rev 3167)
@@ -1,127 +0,0 @@
-#!/usr/bin/perl
-#
-######################################################################
-# LedgerSMB Accounting and ERP
-# http://www.ledgersmb.org/
-#
-# Copyright (C) 2006
-# This work contains copyrighted information from a number of sources all used
-# with permission.
-#
-# This file contains source code included with or based on SQL-Ledger which
-# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
-# under the GNU General Public License version 2 or, at your option, any later
-# version. For a full list including contact information of contributors,
-# maintainers, and copyright holders, see the CONTRIBUTORS file.
-#
-# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
-# Copyright (C) 2001
-#
-# Author: Dieter Simader
-# Email: ..hidden..
-# Web: http://www.sql-ledger.org
-#
-# Contributors:
-#
-#
-# Web: http://www.ledgersmb.org/
-#
-# Contributors:
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#######################################################################
-#
-# this script sets up the terminal and runs the scripts
-# in bin/$terminal directory
-# admin.pl is linked to this script
-#
-#######################################################################
-
-use LedgerSMB::Sysconfig;
-require "common.pl";
-
-$| = 1;
-
-use LedgerSMB::Log;
-
-my $logger = Log::Log4perl->get_logger('initiate');
-
-if ( $ENV{CONTENT_LENGTH} > $LedgerSMB::Sysconfig::max_post_size ) {
- print "Status: 413\n Request entity too large\n\n";
- die "Error: Request entity too large\n";
-}
-
-if ( $ENV{CONTENT_LENGTH} > 0 ) {
- read( STDIN, $_, $ENV{CONTENT_LENGTH} );
-}
-
-$logger->debug("initiate.pl: \$_ = $_\n");
-
-if ( $ENV{QUERY_STRING} ) {
- $_ = $ENV{QUERY_STRING};
-}
-
-$logger->debug("initiate.pl: \$_ = $_\n");
-
-if ( $ARGV[0] ) {
- $_ = $ARGV[0];
-}
-
-$logger->debug("initiate.pl: \$_ = $_\n");
-
-%form = split /[&=]/;
-
-# fix for apache 2.0 bug
-map { $form{$_} =~ s/\\$// } keys %form;
-
-# name of this script
-$0 =~ tr/\\/\//;
-$pos = rindex $0, '/';
-$script = substr( $0, $pos + 1 );
-
-$logger->debug("initiate.pl: \$script = $script\n");
-
-#this needs to be a db based function
-#if (-e "${LedgerSMB::Sysconfig::userspath}/nologin" && $script ne 'admin.pl') {
-# print "Content-Type: text/html\n\n<html><body><strong>";
-# print "\nLogin disabled!\n";
-# print "\n</strong></body></html>";
-# exit;
-#}
-
-if ( $form{path} ) {
-
- if ( $form{path} ne 'bin/lynx' ) { $form{path} = 'bin/mozilla'; }
-
- $ARGV[0] = "$_&script=$script";
- require "bin/$script";
-
-}
-else {
-
- $form{terminal} = "lynx";
-
- if ( $ENV{HTTP_USER_AGENT} !~ /lynx/i ) {
- $form{terminal} = "mozilla";
- }
-
- $ARGV[0] = "path=bin/$form{terminal}&script=$script";
- map { $ARGV[0] .= "&${_}=$form{$_}" } keys %form;
-
- require "bin/$script";
-
-}
-
-# end of main
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.