lib/TWiki/Form/Text.pm
author Colas Nahaboo <colas@nahaboo.net>
Sat, 26 Jan 2008 15:50:53 +0100
changeset 0 414e01d06fd5
permissions -rw-r--r--
RELEASE 4.2.0 freetown
     1 # See bottom of file for license and copyright details
     2 package TWiki::Form::Text;
     3 use base 'TWiki::Form::FieldDefinition';
     4 
     5 use strict;
     6 
     7 sub new {
     8     my $class = shift;
     9     my $this = $class->SUPER::new( @_ );
    10     my $size = $this->{size} || '';
    11     $size =~ s/\D//g;
    12     $size = 10 if( !$size || $size < 1 );
    13     $this->{size} = $size;
    14     return $this;
    15 }
    16 
    17 sub renderForEdit {
    18     my( $this, $web, $topic, $value ) = @_;
    19 
    20     return (
    21         '',
    22         CGI::textfield(
    23             -class => $this->cssClasses('twikiInputField',
    24                                         'twikiEditFormTextField'),
    25             -name => $this->{name},
    26             -size => $this->{size},
    27             -value => $value ));
    28 }
    29 
    30 1;
    31 __DATA__
    32 
    33 Module of TWiki Enterprise Collaboration Platform, http://TWiki.org/
    34 
    35 Copyright (C) 2001-2007 TWiki Contributors. All Rights Reserved.
    36 TWiki Contributors are listed in the AUTHORS file in the root of
    37 this distribution. NOTE: Please extend that file, not this notice.
    38 
    39 This program is free software; you can redistribute it and/or
    40 modify it under the terms of the GNU General Public License
    41 as published by the Free Software Foundation; either version 2
    42 of the License, or (at your option) any later version. For
    43 more details read LICENSE in the root of this distribution.
    44 
    45 This program is distributed in the hope that it will be useful,
    46 but WITHOUT ANY WARRANTY; without even the implied warranty of
    47 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    48 
    49 As per the GPL, removal of this notice is prohibited.
    50