cvsuser     05/11/18 11:23:07

  Added:       App-Widget/lib/App/Widget TextArea.pm
  Log:
  new
  
  Revision  Changes    Path
  1.1                  p5ee/App-Widget/lib/App/Widget/TextArea.pm
  
  Index: TextArea.pm
  ===================================================================
  
  ######################################################################
  ## $Id: TextArea.pm,v 1.1 2005/11/18 19:23:07 spadkins Exp $
  ######################################################################
  
  package App::Widget::TextArea;
  $VERSION = do { my @r=(q$Revision: 1.1 $=~/\d+/g); sprintf 
"%d."."%02d"x$#r,@r};
  
  use App;
  use App::Widget::Stylizable;
  @ISA = ( "App::Widget::Stylizable" );
  
  use strict;
  
  =head1 NAME
  
  App::Widget::TextArea - An HTML textarea field
  
  =head1 SYNOPSIS
  
     $name = "first_name";
     # official way
     use App;
     $context = App->context();
     $w = $context->widget($name);
     # OR ...
     $w = $context->widget($name,
        class => "App::Widget::TextArea",
        size  => 8,                 # from HTML spec
        maxlength => 18,            # from HTML spec
        tabindex => 1,              # from HTML spec
        style => "mystyle",         # from HTML to support CSS
        color => "#6666CC",         # from CSS spec
        font_size => "10px",        # from CSS spec
        border_style => "solid",    # from CSS spec
        border_width => "1px",      # from CSS spec
        border_color => "#6666CC",  # from CSS spec
        padding => "2px",           # from CSS spec
        background_color => "#ccffcc",           # from CSS spec
        font_family => "Verdana, Geneva, Arial", # from CSS spec
        override => 1,              # increase precedence of following options 
to "override" from "default"
        #validate => "date",         # not impl. yet ("date", "time", 
"datetime", "enum", "number", "integer", ":regexp")
        #autocomplete => [EMAIL PROTECTED],  # not impl. yet
     );
  
     # internal way
     use App::Widget::TextArea;
     $w = App::Widget::TextArea->new($name);
  
  =cut
  
  ######################################################################
  # CONSTANTS
  ######################################################################
  
  ######################################################################
  # ATTRIBUTES
  ######################################################################
  
  # INPUTS FROM THE ENVIRONMENT
  
  =head1 DESCRIPTION
  
  This class is a <textarea> HTML element.
  
  =cut
  
  ######################################################################
  # INITIALIZATION
  ######################################################################
  
  # no special initialization
  
  ######################################################################
  # EVENTS
  ######################################################################
  
  # no events
  
  ######################################################################
  # OUTPUT METHODS
  ######################################################################
  
  sub unstyled_html {
      my $self = shift;
      my ($html);
      my $name = $self->{name};
      my $value = $self->get_value();
      my $html_value = $self->html_escape($value);
      my $rows = $self->{rows} || 40;
      my $cols = $self->{cols} || 10;
      my $wrap_html = "";
      my $wrap = $self->{wrap};
      if (defined $wrap) {
          if ($wrap =~ /^(hard|off|physical|soft|virtual)$/) {
              $wrap_html = " wrap=\"$wrap\"";
          }
          else {
              $wrap_html = " wrap";
          }
      }
      my $tabindex = $self->{tabindex};
      $html = "<textarea name=\"${name}\" rows=\"$rows\" 
cols=\"$cols\"$wrap_html>\n";
      $html .= $html_value;
      $html .= "</textarea>";
      $html;
  }
  
  1;
  
  
  
  

Reply via email to