summaryrefslogtreecommitdiff
path: root/lsmb-request.pl
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-06-21 19:24:27 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-06-21 19:24:27 +0000
commitc31e62c0978a700b9f1b74c5c4ce6b4d3c919a1d (patch)
tree4d9b141ecfcc505aa933efb640287bfe3c5bd8ed /lsmb-request.pl
parent37e939f8e6882bf6588c4903855fae905b35634f (diff)
Adding first draft at new handler.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1293 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'lsmb-request.pl')
-rw-r--r--lsmb-request.pl60
1 files changed, 60 insertions, 0 deletions
diff --git a/lsmb-request.pl b/lsmb-request.pl
new file mode 100644
index 00000000..e5921553
--- /dev/null
+++ b/lsmb-request.pl
@@ -0,0 +1,60 @@
+#!/usr/bin/perl
+=head1 NAME
+The LedgerSMB Request Handler
+
+=head1 SYNOPSYS
+This file receives the web request, instantiates the proper objects, and passes
+execution off to the appropriate workflow scripts. This is for use with new
+code only and should not be used with old SQL-Ledger(TM) code as it is
+architecturally dissimilar.
+
+=head1 COPYRIGHT
+
+Copyright (C) 2007 The LedgerSMB Core Team
+
+This file is licensed under the GNU General Public License (GPL) version 2 or
+at your option any later version. A copy of the GNU GPL has been included with
+this software.
+
+=cut
+
+package LedgerSMB::Handler;
+
+use LedgerSMB::Sysconfig;
+use Digest::MD5;
+use Error qw(:try);
+
+$| = 1;
+
+use LedgerSMB::User;
+use LedgerSMB;
+use LedgerSMB::Locale;
+use LedgerSMB::Session;
+use Data::Dumper;
+
+# for custom preprocessing logic
+eval { require "custom.pl"; };
+
+$request = new LedgerSMB;
+
+$0 =~ m/([^\/\\]*.pl)$/;
+if (!$1){
+ $0 =~ m/([^\/\\]*.pl)[? ]/;
+}
+
+$script = $1;
+
+$locale = LedgerSMB::Locale->get_handle( ${LedgerSMB::Sysconfig::language} )
+ or $form->error( __FILE__ . ':' . __LINE__ . ": Locale not loaded: $!\n" );
+
+if (!$script){
+ $request->error($locale->text('No workflow script specified'));
+}
+
+eval { require "scripts/$script" } || $request->error($locale->text('Unable to open script' . ": $!";
+
+$script =~ s/\.pl$//;
+$script = "LedgerSMB::Scripts::$script";
+$script->can($request->{action}) || $request->error($locale->text("Action Not Defined: ") . $request->{action};
+
+$script->can($request->{action})->($request);