[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [916] trunk/LedgerSMB.pm
- Subject: SF.net SVN: ledger-smb: [916] trunk/LedgerSMB.pm
- From: ..hidden..
- Date: Thu, 15 Mar 2007 23:00:11 -0700
Revision: 916
http://svn.sourceforge.net/ledger-smb/?rev=916&view=rev
Author: einhverfr
Date: 2007-03-15 23:00:09 -0700 (Thu, 15 Mar 2007)
Log Message:
-----------
Moved LedgerSMB::new to use CGI.pm for parameter parsing.
Modified Paths:
--------------
trunk/LedgerSMB.pm
Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm 2007-03-16 05:07:02 UTC (rev 915)
+++ trunk/LedgerSMB.pm 2007-03-16 06:00:09 UTC (rev 916)
@@ -72,7 +72,8 @@
=item redo_rows (fields => ..hidden.., count => $integer, [index => $string);
This function is undergoing serious redesign at the moment. If index is
defined, that field is used for ordering the rows. If not, runningnumber is
-used.
+used. Behavior is not defined when index points to a field containing
+non-numbers.
=head1 Copyright (C) 2006, The LedgerSMB core team.
@@ -98,6 +99,7 @@
#======================================================================
=cut
+use CGI;
use Math::BigFloat lib=>'GMP';
use LedgerSMB::Sysconfig;
use Data::Dumper;
@@ -107,44 +109,30 @@
sub new {
- # This will probably be the last to be revised.
- # Based on SQL-Ledger's Form::new
+ my $type = shift @_;
+ my $argstr = shift @_;
- my $type = shift;
+ my $self = {};
+ $self->{version} = "1.3.0 Alpha 0 Pre";
+ $self->{dbversion} = "1.2.0";
+ bless $self, $type;
+
+ my $query = ($argstr) ? new CGI($argstr) : new CGI;
+ my $params = $query->Vars;
- my $argstr = shift;
+ $self->merge($params);
- read(STDIN, $_, $ENV{CONTENT_LENGTH});
+ $self->{action} =~ s/\W/_/g;
+ $self->{action} = lc $self->{action};
- if ($argstr){
- $_ = $argstr;
+ if ($self->{path} =~ /lynx/i){
+ $self->{menubar} = 1;
+ #menubar will be deprecated, replaced with below
+ $self->{lynx} = 1;
}
- elsif ($ENV{QUERY_STRING}) {
- $_ = $ENV{QUERY_STRING};
- }
- elsif ($ARGV[0]) {
- $_ = $ARGV[0];
- }
-
- my $self = {};
- %$self = split /[&=]/;
- for (keys %$self) { $self->{$_} = unescape("", $self->{$_}) }
+ $self;
- if (substr($self->{action}, 0, 1) !~ /( |\.)/) {
- $self->{action} = lc $self->{action};
- $self->{action} =~ s/( |-|,|\#|\/|\.$)/_/g;
- }
-
- $self->{menubar} = 1 if $self->{path} =~ /lynx/i;
- #menubar will be deprecated, replaced with below
- $self->{lynx} = 1 if $self->{path} =~ /lynx/i;
-
- $self->{version} = "1.3.0 Alpha 0 Pre";
- $self->{dbversion} = "1.2.0";
-
- bless $self, $type;
-
}
@@ -178,22 +166,6 @@
}
-sub unescape {
- # Based on SQL-Ledger's Form::unescape
- my ($self) = @_;
- my %args = @_;
- my $str = $args{string};
-
- $str =~ tr/+/ /;
- $str =~ s/\\$//;
-
- $str =~ s/%([0-9a-fA-Z]{2})/pack("c",hex($1))/eg;
- $str =~ s/\r?\n/\n/g;
-
- $str;
-
-}
-
sub is_blank {
my $self = shift @_;
my %args = @_;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.