| 1 |
|
| 2 |
################################################################################### |
| 3 |
# |
| 4 |
# Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh www.ecos.de |
| 5 |
# Embperl - Copyright (c) 2008-2014 Gerald Richter |
| 6 |
# |
| 7 |
# You may distribute under the terms of either the GNU General Public |
| 8 |
# License or the Artistic License, as specified in the Perl README file. |
| 9 |
# |
| 10 |
# THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR |
| 11 |
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 12 |
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
# |
| 14 |
# $Id$ |
| 15 |
# |
| 16 |
################################################################################### |
| 17 |
|
| 18 |
package Embperl::Form::Control::file ; |
| 19 |
|
| 20 |
use strict ; |
| 21 |
use base 'Embperl::Form::Control' ; |
| 22 |
|
| 23 |
use Embperl::Inline ; |
| 24 |
|
| 25 |
1 ; |
| 26 |
|
| 27 |
__EMBPERL__ |
| 28 |
|
| 29 |
[# --------------------------------------------------------------------------- |
| 30 |
# |
| 31 |
# show_control - output the control |
| 32 |
#] |
| 33 |
|
| 34 |
[$ sub show_control ($self) |
| 35 |
|
| 36 |
$self -> {size} ||= 80 / ($self -> {width} || 2) ; |
| 37 |
$class = $self -> {class} ||= 'cControlWidthInput' ; |
| 38 |
$] |
| 39 |
|
| 40 |
<input type="file" class="cBase cControl [+ $class +]" name="[+ $self->{name} +]" id="[+ $self->{name} +]" |
| 41 |
[$if $self -> {size} $]size="[+ $self->{size} +]"[$endif$] |
| 42 |
[$if $self -> {maxlength} $]size="[+ $self->{maxlength} +]"[$endif$] |
| 43 |
> |
| 44 |
[$endsub$] |
| 45 |
|
| 46 |
__END__ |
| 47 |
|
| 48 |
=pod |
| 49 |
|
| 50 |
=head1 NAME |
| 51 |
|
| 52 |
Embperl::Form::Control::file - A file upload input control inside an Embperl Form |
| 53 |
|
| 54 |
|
| 55 |
=head1 SYNOPSIS |
| 56 |
|
| 57 |
{ |
| 58 |
type => 'file', |
| 59 |
text => 'blabla', |
| 60 |
name => 'foo', |
| 61 |
size => 10, |
| 62 |
} |
| 63 |
|
| 64 |
=head1 DESCRIPTION |
| 65 |
|
| 66 |
Used to create a file upload control inside an Embperl Form. |
| 67 |
See Embperl::Form on how to specify parameters. |
| 68 |
|
| 69 |
=head2 PARAMETER |
| 70 |
|
| 71 |
=head3 type |
| 72 |
|
| 73 |
Needs to be 'file' |
| 74 |
|
| 75 |
=head3 name |
| 76 |
|
| 77 |
Specifies the name of the upload control |
| 78 |
|
| 79 |
=head3 text |
| 80 |
|
| 81 |
Will be used as label for the file upload input control |
| 82 |
|
| 83 |
=head3 size |
| 84 |
|
| 85 |
Gives the size in characters |
| 86 |
|
| 87 |
=head3 maxlength |
| 88 |
|
| 89 |
Gives the maximun length in characters |
| 90 |
|
| 91 |
=head1 Author |
| 92 |
|
| 93 |
G. Richter (richter at embperl dot org) |
| 94 |
|
| 95 |
=head1 See Also |
| 96 |
|
| 97 |
perl(1), Embperl, Embperl::Form |
| 98 |
|
| 99 |
|