cvs commit: p5ee/App-Widget/lib/App/Widget Button.pm ImageButton.pm Select.pm

[email protected] (Stephen Adkins)
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
cvsuser     04/11/10 07:45:09

  Modified:    App-Widget/lib/App Widget.pm
               App-Widget/lib/App/Widget Button.pm ImageButton.pm Select.pm
  Log:
  beginning of new support for arbitrary HTML attributes
  
  Revision  Changes    Path
  1.5       +22 -2     p5ee/App-Widget/lib/App/Widget.pm
  
  Index: Widget.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/App-Widget/lib/App/Widget.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Widget.pm	2 Sep 2004 21:05:00 -0000	1.4
  +++ Widget.pm	10 Nov 2004 15:45:09 -0000	1.5
  @@ -1,10 +1,10 @@
   
   ######################################################################
  -## $Id: Widget.pm,v 1.4 2004/09/02 21:05:00 spadkins Exp $
  +## $Id: Widget.pm,v 1.5 2004/11/10 15:45:09 spadkins Exp $
   ######################################################################
   
   package App::Widget;
  -$VERSION = do { my @r=(q$Revision: 1.4 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
  +$VERSION = do { my @r=(q$Revision: 1.5 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
   
   use App::SessionObject;
   @ISA = ( "App::SessionObject" );
  @@ -166,8 +166,16 @@
           }
       }
   
  +    my $context = $self->{context};
  +    my $response = $context->response();
       my $context_head = "";
       my $context_body = "";
  +    if ($response->{include}{javascript}) {
  +        my $javascript = $response->{include}{javascript};
  +        foreach my $url (keys %$javascript) {
  +            $context_head .= "<script src=\"$url\"></script>\n";
  +        }
  +    }
   
       #$context_head = $self->{context}->head_html();
       #$context_body = $self->{context}->body_html(\%main::conf);
  @@ -349,6 +357,18 @@
      return $text;
   }
   
  +sub html_attribs {
  +   my ($self) = @_;
  +   my $html_attribs = "";
  +   if ($self->{attrib}) {
  +      my $attrib_value = $self->{attrib};
  +      foreach my $attrib (keys %$attrib_value) {
  +         $html_attribs .= " $attrib=\"$attrib_value->{$attrib}\"";
  +      }
  +   }
  +   return($html_attribs);
  +}
  +
   sub html {
      my ($self) = @_;
      return $self->html_escape($self->{name});
  
  
  
  1.4       +4 -3      p5ee/App-Widget/lib/App/Widget/Button.pm
  
  Index: Button.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/App-Widget/lib/App/Widget/Button.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Button.pm	2 Sep 2004 21:05:00 -0000	1.3
  +++ Button.pm	10 Nov 2004 15:45:09 -0000	1.4
  @@ -1,10 +1,10 @@
   
   ######################################################################
  -## $Id: Button.pm,v 1.3 2004/09/02 21:05:00 spadkins Exp $
  +## $Id: Button.pm,v 1.4 2004/11/10 15:45:09 spadkins Exp $
   ######################################################################
   
   package App::Widget::Button;
  -$VERSION = do { my @r=(q$Revision: 1.3 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
  +$VERSION = do { my @r=(q$Revision: 1.4 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
   
   use App;
   use App::Widget;
  @@ -82,7 +82,8 @@
       my $self = shift;
       my $name = $self->{name};
       my $label = $self->html_escape($self->{label});
  -    return "<input type=\"submit\" name=\"app.event.${name}.click\" value=\"$label\"/>";
  +    my $html_attribs = $self->html_attribs();
  +    return "<input type=\"submit\" name=\"app.event.${name}.click\" value=\"$label\"$html_attribs/>";
   }
   
   1;
  
  
  
  1.6       +6 -5      p5ee/App-Widget/lib/App/Widget/ImageButton.pm
  
  Index: ImageButton.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/App-Widget/lib/App/Widget/ImageButton.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ImageButton.pm	2 Sep 2004 21:05:00 -0000	1.5
  +++ ImageButton.pm	10 Nov 2004 15:45:09 -0000	1.6
  @@ -1,10 +1,10 @@
   
   ######################################################################
  -## $Id: ImageButton.pm,v 1.5 2004/09/02 21:05:00 spadkins Exp $
  +## $Id: ImageButton.pm,v 1.6 2004/11/10 15:45:09 spadkins Exp $
   ######################################################################
   
   package App::Widget::ImageButton;
  -$VERSION = do { my @r=(q$Revision: 1.5 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
  +$VERSION = do { my @r=(q$Revision: 1.6 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
   
   use App;
   use App::Widget;
  @@ -69,6 +69,7 @@
       $selected     = $self->{selected} ? "&selected=1" : "&selected=0";
   
       $image = $self->get("image");
  +    my $html_attribs = $self->html_attribs();
       if ($image) {
           $height     = $self->get("height");
           $width      = $self->get("width");
  @@ -83,7 +84,7 @@
               $url    = "$html_url_dir/$image";
           }
   
  -        return "<input type=\"image\" name=\"app.event.$event_target.$event$args\" src=\"$url\" border=\"0\"$height$width alt=\"$html_label\"$tabindex/>";
  +        return "<input type=\"image\" name=\"app.event.$event_target.$event$args\" src=\"$url\" border=\"0\"$height$width alt=\"$html_label\"$tabindex$html_attribs/>";
       }
   
       $image_script = $self->get("image_script","app-button");
  @@ -100,10 +101,10 @@
               $url    = "$script_url_dir/$image_script";
           }
           $url .= "?mode=$type&width=$width&height=$height&bevel=$bevel&text=$url_label$selected";
  -        return "<input type=\"image\" name=\"app.event.$event_target.$event$args\" src=\"$url\" border=\"0\" height=\"$height\" width=\"$width\" alt=\"$html_label\"$tabindex/>";
  +        return "<input type=\"image\" name=\"app.event.$event_target.$event$args\" src=\"$url\" border=\"0\" height=\"$height\" width=\"$width\" alt=\"$html_label\"$tabindex$html_attribs/>";
       }
   
  -    return "<input type=\"submit\" name=\"app.event.$event_target.$event$args\" value=\"$html_label\"$tabindex/>";
  +    return "<input type=\"submit\" name=\"app.event.$event_target.$event$args\" value=\"$html_label\"$tabindex$html_attribs/>";
   }
   
   1;
  
  
  
  1.3       +4 -3      p5ee/App-Widget/lib/App/Widget/Select.pm
  
  Index: Select.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/App-Widget/lib/App/Widget/Select.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Select.pm	2 Sep 2004 21:05:00 -0000	1.2
  +++ Select.pm	10 Nov 2004 15:45:09 -0000	1.3
  @@ -1,10 +1,10 @@
   
   ######################################################################
  -## $Id: Select.pm,v 1.2 2004/09/02 21:05:00 spadkins Exp $
  +## $Id: Select.pm,v 1.3 2004/11/10 15:45:09 spadkins Exp $
   ######################################################################
   
   package App::Widget::Select;
  -$VERSION = do { my @r=(q$Revision: 1.2 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
  +$VERSION = do { my @r=(q$Revision: 1.3 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
   
   use App::Widget::Stylizable;
   @ISA = ( "App::Widget::Stylizable" );
  @@ -101,7 +101,8 @@
               "</option>\n");
       }
   
  -    return "<select name='$tagname'${size}${multiple}${tabindex}>\n" . join("",@html) . "</select>";
  +    my $html_attribs = $self->html_attribs();
  +    return "<select name='$tagname'${size}${multiple}${tabindex}$html_attribs>\n" . join("",@html) . "</select>";
   }
   
   1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.