cvsuser     02/02/05 14:19:27

  Modified:    P5EEx/Blue/P5EEx/Blue/Context CGI.pm
  Log:
  cleaned it up so it is starting to work
  
  Revision  Changes    Path
  1.4       +22 -18    p5ee/P5EEx/Blue/P5EEx/Blue/Context/CGI.pm
  
  Index: CGI.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/P5EEx/Blue/P5EEx/Blue/Context/CGI.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- CGI.pm    1 Feb 2002 20:33:16 -0000       1.3
  +++ CGI.pm    5 Feb 2002 22:19:27 -0000       1.4
  @@ -1,6 +1,6 @@
   
   #############################################################################
  -## $Id: CGI.pm,v 1.3 2002/02/01 20:33:16 spadkins Exp $
  +## $Id: CGI.pm,v 1.4 2002/02/05 22:19:27 spadkins Exp $
   #############################################################################
   
   package P5EEx::Blue::Context::CGI;
  @@ -88,6 +88,7 @@
   sub init {
       my ($self, $args) = @_;
       my ($cgi, $var, $value, $lang, $prog, $file);
  +    $args = {} if (!defined $args);
   
       # untaint the $prog
       $0 =~ /(.*)/;
  @@ -97,7 +98,7 @@
       # read environment variables
       #################################################################
   
  -    if (defined $main::conf{debugmode} && $main::conf{debugmode} eq "replay") {
  +    if (defined $args->{debugmode} && $args->{debugmode} eq "replay") {
           $file = "$prog.env";
           if (open(main::FILE, "< $file")) {
               foreach $var (keys %ENV) {
  @@ -114,7 +115,7 @@
           }
       }
   
  -    if (defined $main::conf{debugmode} && $main::conf{debugmode} eq "record") {
  +    if (defined $args->{debugmode} && $args->{debugmode} eq "record") {
          $file = "$prog.env";
          if (open(main::FILE, "> $file")) {
             foreach $var (keys %ENV) {
  @@ -127,8 +128,8 @@
       # include the environment variables in the configuration
       while (($var,$value) = each %ENV) {
          $var = lc($var);    # make lower case
  -       if ($value ne "" && (!defined $main::conf{$var} || $main::conf{$var} eq "")) 
{
  -          $main::conf{$var} = $value;
  +       if ($value ne "" && (!defined $args->{$var} || $args->{$var} eq "")) {
  +          $args->{$var} = $value;
          }
       }
   
  @@ -136,7 +137,7 @@
       # READ CGI VARIABLES
       #################################################################
   
  -    if (defined $main::conf{debugmode} && $main::conf{debugmode} eq "replay") {
  +    if (defined $args->{debugmode} && $args->{debugmode} eq "replay") {
           # when the "debugmode" is in "replay", the saved CGI environment from
           # a previous query (when "debugmode" was "record") is used
           $file = "$prog.vars";
  @@ -155,11 +156,12 @@
               # this is the normal path for P5EE execution, where the Context::CGI
               # is responsible for reading its environment
               $cgi = CGI->new();
  +            $args->{cgi} = $cgi if (defined $args);
           }
       }
   
       # when the "debugmode" is "record", save the CGI vars
  -    if (defined $main::conf{debugmode} && $main::conf{debugmode} eq "record") {
  +    if (defined $args->{debugmode} && $args->{debugmode} eq "record") {
           $file = "$prog.vars";
           if (open(main::FILE, "> $file")) {
               $cgi->save(*main::FILE);     # Save vars to debug file
  @@ -177,11 +179,10 @@
       #    -debug=3,P5EEx::Blue::Context,P5EEx::Blue::Session  (multiple classes)
       #    -debug=6,P5EEx::Blue::Repository::DBI.select_rows (individual methods)
       my ($debug, $pkg);
  -    $debug = $main::conf{debug};
  +    $debug = $args->{debug};
       if (defined $debug && $debug ne "") {
           if ($debug =~ s/^([0-9]+),?//) {
               $P5EEx::Blue::Context::DEBUG = $1;
  -            $P5EEx::Blue::Context::DEBUG += 0; # use again to avoid a warning
           }
           if ($debug) {
               foreach $pkg (split(/,/,$debug)) {
  @@ -194,7 +195,7 @@
       # LANGUAGE
       #################################################################
   
  -    # Hmmm... do I use $ENV{HTTP_ACCEPT_LANGUAGE} or 
$main::conf{http_accept_language} ?
  +    # Hmmm... do I use $ENV{HTTP_ACCEPT_LANGUAGE} or $args->{http_accept_language} ?
       if (defined $ENV{HTTP_ACCEPT_LANGUAGE}) {
           $lang = $ENV{HTTP_ACCEPT_LANGUAGE};
           $lang =~ s/ *,.*//;
  @@ -364,10 +365,10 @@
   
       if (defined $cgi) {
           my ($session, $wname);
  -        $session = $self->session();        # get the Session
  +        $session = $self->{session};        # get the Session
  +
           $wname = $cgi->param("wname");      # the "wname" variable is treated 
specially
           $wname = "" if (!defined $wname);
  -        $session->set("state.Widget.default.wname", $wname) if ($wname ne "");
   
           ##########################################################
           # For each CGI variable, do the appropriate thing
  @@ -404,22 +405,25 @@
                   }
                   else {
                       # check to see if the value should be multi-valued
  -                    $multiple = $session->get("Widget.{$var}.multiple");
  +                    $multiple = $self->wget($var, "multiple");
                       if ($multiple && ref($value) eq "") {
                           $value = [ $value ];
                       }
   
  +                    if ($var eq "wname") {
  +                        ;
  +                    }
                       # Subwidget vars: e.g. "app.nav.toolbar"
  -                    if ($var =~ /\./) {
  -                        $session->set("Widget.$var", $value);
  +                    elsif ($var =~ /^(.+)\.([^.]+)$/) {
  +                        $self->wset($1, $2, $value);
                       }
                       # Autoattribute vars: e.g. "width" (an attribute of widget 
named in request)
                       elsif ($wname) {
  -                        $session->set("Widget.{$wname}.$var", $value);
  +                        $self->wset($wname, $var, $value);
                       }
  -                    # Simple vars: e.g. "width" (gets dumped in the "default" 
widget)
  +                    # Simple vars: e.g. "width" (gets dumped in the "global" widget)
                       else {
  -                        $session->set("Widget.default.$var", $value);
  +                        $self->wset("global", $var, $value);
                       }
                   }
               }
  
  
  


Reply via email to