cvsuser     02/04/18 09:42:32

  Modified:    P5EEx/Blue/P5EEx/Blue/Context CGI.pm
  Log:
  added support for array-valued widget attributes
  
  Revision  Changes    Path
  1.12      +31 -21    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.11
  retrieving revision 1.12
  diff -u -w -r1.11 -r1.12
  --- CGI.pm    16 Apr 2002 03:53:34 -0000      1.11
  +++ CGI.pm    18 Apr 2002 16:42:32 -0000      1.12
  @@ -1,6 +1,6 @@
   
   #############################################################################
  -## $Id: CGI.pm,v 1.11 2002/04/16 03:53:34 spadkins Exp $
  +## $Id: CGI.pm,v 1.12 2002/04/18 16:42:32 spadkins Exp $
   #############################################################################
   
   package P5EEx::Blue::Context::CGI;
  @@ -378,7 +378,7 @@
               #  3. "wname{m}[1]"  variable is a "multi-level hash key" under 
$self->{widget}{$wname}
               #  4. "wname"        variable is a "multi-level hash key"
               ##########################################################
  -            my (@eventvars, $var, @values, $value, $mlhashkey, $name, $multiple);
  +            my (@eventvars, $var, @values, $value, $mlhashkey, $name);
               @eventvars = ();
               foreach $var ($cgi->param()) {
                   if ($var =~ /^p5ee\.event/) {
  @@ -389,8 +389,19 @@
                       # these vars are used in the Session restore() to restore state.
                   }
                   else {
  -                    foreach $value ($cgi->param($var)) {
  -                        # Indexed vars: e.g. "table_editor{data}[1][5]"
  +                    @values = $cgi->param($var);
  +                    if ($var =~ s/\[\]$//) {
  +                        $value = [ @values ];
  +                    }
  +                    elsif ($#values == -1) {
  +                        $value = "";
  +                    }
  +                    elsif ($#values == 0) {
  +                        $value = $values[0];
  +                    }
  +                    else {
  +                        $value = join(",",@values);
  +                    }
                           if ($var =~ /^([^\[\]\{\}]+)([\[\]\{\}].*)/) {
                               $self->wset($1, $2, $value);
                           }
  @@ -410,7 +421,6 @@
                               # Simple vars: e.g. "width" (gets dumped in the 
"session" widget)
                               else {
                                   $self->wset("session", $var, $value);
  -                            }
                           }
                       }
                   }
  
  
  


Reply via email to