[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [959] branches/1.2/menu.pl



Revision: 959
          http://svn.sourceforge.net/ledger-smb/?rev=959&view=rev
Author:   tetragon
Date:     2007-03-20 12:33:15 -0700 (Tue, 20 Mar 2007)

Log Message:
-----------
Rearranging menu.pl

Modified Paths:
--------------
    branches/1.2/menu.pl

Modified: branches/1.2/menu.pl
===================================================================
--- branches/1.2/menu.pl	2007-03-20 06:33:21 UTC (rev 958)
+++ branches/1.2/menu.pl	2007-03-20 19:33:15 UTC (rev 959)
@@ -77,23 +77,28 @@
 # pull in DBI
 use DBI qw(:sql_types);
 
-# grab user config. This is ugly and unecessary if/when 
-# we get rid of myconfig and use User as a real object 
-%myconfig = %{LedgerSMB::User->fetch_config($form->{login})};
+# send warnings to browser
+$SIG{__WARN__} = sub { $form->info($_[0]) };
 
-if ($@) {
-	$locale = LedgerSMB::Locale->get_handle($myconfig{countrycode}) or
+# send errors to browser
+$SIG{__DIE__} = sub { $form->error(__FILE__.':'.__LINE__.': '.$_[0]) };
+
+# did sysadmin lock us out
+if (-f "${LedgerSMB::Sysconfig::userspath}/nologin") {
+	$locale = LedgerSMB::Locale->get_handle(${LedgerSMB::Sysconfig::language}) or
 		$form->error(__FILE__.':'.__LINE__.": Locale not loaded: $!\n");
-	$form->{charset} = $locale->encoding;
 	$form->{charset} = 'UTF-8';
 	$locale->encoding('UTF-8');
 
 	$form->{callback} = "";
-	$msg1 = $locale->text('You are logged out!');
-	$msg2 = $locale->text('Login');
-	$form->redirect("$msg1 <p><a href=\"login.pl\" target=\"_top\">$msg2</a></p>");
+	$form->error(__FILE__.':'.__LINE__.': '.$locale->text('System currently down for maintenance!'));
 }
 
+&check_password;
+# grab user config. This is ugly and unecessary if/when 
+# we get rid of myconfig and use User as a real object 
+%myconfig = %{LedgerSMB::User->fetch_config($form->{login})};
+
 # locale messages
 $locale = LedgerSMB::Locale->get_handle($myconfig{countrycode}) or
 	$form->error(__FILE__.':'.__LINE__.": Locale not loaded: $!\n");
@@ -101,20 +106,17 @@
 $form->{charset} = 'UTF-8';
 $locale->encoding('UTF-8');
 
-# send warnings to browser
-$SIG{__WARN__} = sub { $form->info($_[0]) };
+if ($@) {
+	$form->{callback} = "";
+	$msg1 = $locale->text('You are logged out!');
+	$msg2 = $locale->text('Login');
+	$form->redirect("$msg1 <p><a href=\"login.pl\" target=\"_top\">$msg2</a></p>");
+}
 
-# send errors to browser
-$SIG{__DIE__} = sub { $form->error(__FILE__.':'.__LINE__.': '.$_[0]) };
+map { $form->{$_} = $myconfig{$_} } qw(stylesheet timeout) unless ($form->{type} eq 'preferences');
 
-map { $form->{$_} = $myconfig{$_} } qw(stylesheet timeout) unless ($form->{type} eq 'preferences');
 $form->db_init(\%myconfig);
 
-# did sysadmin lock us out
-if (-f "${LedgerSMB::Sysconfig::userspath}/nologin") {
-	$form->error(__FILE__.':'.__LINE__.': '.$locale->text('System currently down for maintenance!'));
-}
-
 # pull in the main code
 require "bin/$form->{script}";
 
@@ -133,7 +135,6 @@
 	# window title bar, user info
 	$form->{titlebar} = "LedgerSMB ".$locale->text('Version'). " $form->{version} - $myconfig{name} - $myconfig{dbname}";
 
-	&check_password;
 
 	&{ $form->{action} };
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.