Author: richter
Date: Tue Apr 25 00:10:49 2006
New Revision: 396795
URL: http://svn.apache.org/viewcvs?rev=396795&view=rev
Log:
Embperl::Form addtions
Added:
perl/embperl/trunk/Embperl/Form/Control/button.pm
perl/embperl/trunk/Embperl/Form/Control/dump.pm
perl/embperl/trunk/Embperl/Form/Control/hidden.pm
Modified:
perl/embperl/trunk/Embperl/Form.pm
perl/embperl/trunk/Embperl/Form/Control/display.pm
perl/embperl/trunk/Embperl/Form/Control/info.pm
perl/embperl/trunk/Embperl/Form/Control/input.pm
perl/embperl/trunk/Embperl/Form/Control/tabs.pm
perl/embperl/trunk/Embperl/Form/Control/textarea.pm
perl/embperl/trunk/MANIFEST
Modified: perl/embperl/trunk/Embperl/Form.pm
URL:
http://svn.apache.org/viewcvs/perl/embperl/trunk/Embperl/Form.pm?rev=396795&r1=396794&r2=396795&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form.pm (original)
+++ perl/embperl/trunk/Embperl/Form.pm Tue Apr 25 00:10:49 2006
@@ -57,6 +57,7 @@
$self -> {bottom_code} = [] ;
$self -> {validate_rules} = [] ;
$self -> {toplevel} = $toplevel ;
+ $self -> {valign} = $options -> {valign} || 'top' ;
bless $self, $class if (!ref $class);
@@ -201,6 +202,8 @@
foreach my $control (@$controls)
{
+ die "control definition must be a hashref or an object, is '$control'
" if (!ref $control || ref $control eq 'ARRAY');
+
my $name = $control -> {name} ;
$control -> {type} =~ s/sf_select.+/select/ ;
$control -> {parentid} = $id if ($id) ;
@@ -710,7 +713,7 @@
my $class = $lineno == 0?'cTableRow1':'cTableRow' ;
$]
- <tr class="[+ $class +]"
+ <tr class="[+ $class +]" valign="[+ $self->{valign} +]"
[$if $id $] id="[+ $id +]"[$endif$]
[$if ($baseid eq $baseaid && $baseidn != $baseaidn) $] style="display:
none"[$endif$]
>
@@ -811,6 +814,10 @@
it will set the default class for the labels of all controls to
myclass and not to wrap the text.
+=item * valign
+
+valign for control cells. Defaults to 'top' .
+
=back
=back
@@ -827,8 +834,6 @@
=head1 SEE ALSO
perl(1), Embperl, Embperl::Form::Control
-
-
Added: perl/embperl/trunk/Embperl/Form/Control/button.pm
URL:
http://svn.apache.org/viewcvs/perl/embperl/trunk/Embperl/Form/Control/button.pm?rev=396795&view=auto
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/button.pm (added)
+++ perl/embperl/trunk/Embperl/Form/Control/button.pm Tue Apr 25 00:10:49 2006
@@ -0,0 +1,114 @@
+
+###################################################################################
+#
+# Embperl - Copyright (c) 1997-2005 Gerald Richter / ecos gmbh www.ecos.de
+#
+# You may distribute under the terms of either the GNU General Public
+# License or the Artistic License, as specified in the Perl README file.
+#
+# THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+#
+# $Id$
+#
+###################################################################################
+
+package Embperl::Form::Control::button ;
+
+use strict ;
+use base 'Embperl::Form::Control' ;
+
+use Embperl::Inline ;
+
+1 ;
+
+__EMBPERL__
+
+[# ---------------------------------------------------------------------------
+#
+# show - output the control
+#]
+
+[$ sub show ($self, $data)
+
+my $span = ($self->{width_percent});
+my $section = $self->{section};
+$]
+<td class="cBase cInfoBox" colspan="[+ $span +]"
+ style="[+ $self->{style} || 'text-align: center;' +]">
+
+[$ foreach my $button (@{$self->{button}}) $]
+ [- $button->{class} ||= "cStandardButton"; -]
+ [# Workaround around segfault in Embperl 2.1.1-dev *grmpf* #]
+ <[# #]input
+ type="button"
+ onMouseOver="buttonover(this);" onMouseOut="buttonout(this);"
+ [$ foreach my $attr (keys %$button) $]
+ [$ if exists $button->{"__$attr".'_escmode'} $]
+ [+ $attr +]="[+ do { local $escmode = int
$button->{"__${attr}_escmode"}; $button->{$attr}; } +]"
+ [$ else $]
+ [+ $attr +]="[+ $button->{$attr} +]"
+ [$ endif $]
+ [$ endforeach $]>
+[$ endforeach $]
+</td>
+[$ endsub $]
+
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Embperl::Form::Control::button - A fully configurable button inside an Embperl
Form
+
+
+=head1 SYNOPSIS
+
+ {
+ type => 'button',
+ width => 1,
+ button => [
+ {
+ name => 'blafasel',
+ value => 'Click here',
+ onclick => 'do_something()',
+ style => 'border: 1px solid black;',
+ },
+ {
+ name => 'foobar',
+ value => 'Click here, too',
+ onclick => 'do_something()',
+ class => 'HurzCSSClass',
+ onmouseover => 'do(this)';
+ onmouseout => 'do(that)';
+ }
+ ]
+ }
+
+=head1 DESCRIPTION
+
+Used to create a click button inside an Embperl Form.
+See Embperl::Form on how to specify parameters.
+
+=head2 PARAMETER
+
+=head3 type
+
+Needs to be 'button'
+
+=head3 button
+
+hashref of the key-value pairs of all attribute the button needs.
+
+=head1 Author
+
+G. Richter ([EMAIL PROTECTED]), A. Beckert ([EMAIL PROTECTED])
+
+=head1 See Also
+
+perl(1), Embperl, Embperl::Form
+
+
Modified: perl/embperl/trunk/Embperl/Form/Control/display.pm
URL:
http://svn.apache.org/viewcvs/perl/embperl/trunk/Embperl/Form/Control/display.pm?rev=396795&r1=396794&r2=396795&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/display.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/display.pm Tue Apr 25 00:10:49 2006
@@ -34,8 +34,14 @@
my $name = $self->{name};
my $value = exists $self->{value} ? $self->{value} : $fdat{$name};
+$value = [ split /\t/, $value ] if $self->{split};
+$value = [ split /\n/, $value ] if $self->{splitlines};
+
+$][$ if ref $value eq 'ARRAY' $][$ foreach $v (@$value) $][+ $v +]<br />[$
endforeach
+$][$ elsif ref $value eq 'HASH' $][$ foreach $k (keys %$value) $][+ $k +]: [+
$value->{$k} +]<br />[$ endforeach
+$][$ elsif ref $value $]<em>[+ ref $value +]</em>[$
+ else $][+ $value +][$ endif $]
-$][+ $value +]
[$ if $self->{hidden} $]
<input type="hidden" name="[+ $name +]" value="[+ $value +]">
[$endif$]
@@ -57,6 +63,7 @@
text => 'blabla',
hidden => 1,
name => 'foo',
+ split => 1
}
=head1 DESCRIPTION
@@ -74,6 +81,12 @@
Will be used as label for the text display control.
+=head3 value
+
+value to display. If not given $fdat{<name>} will be used.
+If the data given within value is an arrayref, every element will be displayed
+on a separate line.
+
=head3 hidden
If set, an appropriate hidden input field will be created
@@ -83,9 +96,19 @@
Will be used as name for the hidden input field.
+=head3 split
+
+Splits the value into an array at \t if set and displays every array element
+on a new line.
+
+=head3 splitlines
+
+Splits the value into an array at \n if set and displays every array element
+on a new line.
+
=head1 Author
-G. Richter ([EMAIL PROTECTED])
+G. Richter ([EMAIL PROTECTED]), A. Beckert ([EMAIL PROTECTED])
=head1 See Also
Added: perl/embperl/trunk/Embperl/Form/Control/dump.pm
URL:
http://svn.apache.org/viewcvs/perl/embperl/trunk/Embperl/Form/Control/dump.pm?rev=396795&view=auto
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/dump.pm (added)
+++ perl/embperl/trunk/Embperl/Form/Control/dump.pm Tue Apr 25 00:10:49 2006
@@ -0,0 +1,86 @@
+
+###################################################################################
+#
+# Embperl - Copyright (c) 1997-2005 Gerald Richter / ecos gmbh www.ecos.de
+#
+# You may distribute under the terms of either the GNU General Public
+# License or the Artistic License, as specified in the Perl README file.
+#
+# THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+#
+# $Id$
+#
+###################################################################################
+
+package Embperl::Form::Control::dump ;
+
+use strict ;
+use base 'Embperl::Form::Control' ;
+
+use Embperl::Inline ;
+use Data::Dumper;
+1 ;
+
+__EMBPERL__
+
+[# ---------------------------------------------------------------------------
+#
+# show_control - output the control
+#]
+
+[$ sub show_control ($self)
+
+my $name = $self->{name};
+my $value = exists $self->{value} ? $self->{value} : exists $fdat{$name} ?
$fdat{$name} : \%fdat;
+
+$]
+<pre>[+ Dumper($value) +]</pre>
+[$endsub$]
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Embperl::Form::Control::dump - A debug control inside an Embperl Form
+
+
+=head1 SYNOPSIS
+
+ {
+ type => 'dump',
+ text => 'blabla',
+ data => $some_data_structure_to_be_displayed
+ }
+
+=head1 DESCRIPTION
+
+Used to create a debug control inside an Embperl Form.
+See Embperl::Form on how to specify parameters.
+
+=head2 PARAMETER
+
+=head3 type
+
+Needs to be set to 'dump'.
+
+=head3 text
+
+Will be used as label for the debug control.
+
+=head3 data
+
+Some data structure to be displayed, e.g. hashref, arrayref or scalar.
+
+=head1 Author
+
+G. Richter ([EMAIL PROTECTED]), A. Beckert ([EMAIL PROTECTED])
+
+=head1 See Also
+
+perl(1), Embperl, Embperl::Form
+
+
Added: perl/embperl/trunk/Embperl/Form/Control/hidden.pm
URL:
http://svn.apache.org/viewcvs/perl/embperl/trunk/Embperl/Form/Control/hidden.pm?rev=396795&view=auto
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/hidden.pm (added)
+++ perl/embperl/trunk/Embperl/Form/Control/hidden.pm Tue Apr 25 00:10:49 2006
@@ -0,0 +1,92 @@
+###################################################################################
+#
+# Embperl - Copyright (c) 1997-2005 Gerald Richter / ecos gmbh www.ecos.de
+#
+# You may distribute under the terms of either the GNU General Public
+# License or the Artistic License, as specified in the Perl README file.
+#
+# THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+#
+# $Id$
+#
+###################################################################################
+
+package Embperl::Form::Control::hidden ;
+
+use strict ;
+use base 'Embperl::Form::Control' ;
+
+use Embperl::Inline ;
+
+sub noframe { return 1; }
+
+1 ;
+
+__EMBPERL__
+
+[$ sub show_sub_begin ($self) $][$ endsub $]
+[$ sub show_sub_end ($self) $][$ endsub $]
+[$ sub show_label ($self) $][$ endsub $]
+[$ sub show_label_icon ($self) $][$ endsub $]
+[$ sub show_label_cell ($self) $][$ endsub $]
+
+[$ sub show_control_cell ($self, $x) $]
+ [* my @ret = $self->show_control; return @ret; *]
+[$ endsub $]
+
+[# ---------------------------------------------------------------------------
+#
+# show_control - output the control
+#]
+
+[$ sub show_control ($self)
+
+my $name = $self->{name};
+my $value = exists $self->{value} ? $self->{value} : $fdat{$name};
+
+$]
+<input type="hidden" name="[+ $name +]" value="[+ $value +]">
+[$endsub$]
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Embperl::Form::Control::hidden - A hidden form field control inside an Embperl
Form
+
+
+=head1 SYNOPSIS
+
+ {
+ type => 'hidden',
+ name => 'foo',
+ }
+
+=head1 DESCRIPTION
+
+Used to create a hidden form field control inside an Embperl Form.
+See Embperl::Form on how to specify parameters.
+
+=head2 PARAMETER
+
+=head3 type
+
+Needs to be set to 'hidden'.
+
+=head3 name
+
+Will be used as name for the hidden input field.
+
+=head1 Author
+
+G. Richter ([EMAIL PROTECTED]), A. Beckert ([EMAIL PROTECTED])
+
+=head1 See Also
+
+perl(1), Embperl, Embperl::Form
+
+
Modified: perl/embperl/trunk/Embperl/Form/Control/info.pm
URL:
http://svn.apache.org/viewcvs/perl/embperl/trunk/Embperl/Form/Control/info.pm?rev=396795&r1=396794&r2=396795&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/info.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/info.pm Tue Apr 25 00:10:49 2006
@@ -32,9 +32,10 @@
[$ sub show ($self, $data)
-my $span = ($self->{width_percent}) ;
+my $span = ($self->{width_percent});
+my $section = $self->{section};
$]
-<td class="cBase cInfoBox" colspan="[+ $span +]">[+ $self->{text} +]</td>
+<td class="cBase cInfoBox" colspan="[+ $span +]">[$ if $section $]<b>[$ endif
$][+ $self->{text} +][$ if $section $]</b>[$ endif $]</td>
[$endsub$]
Modified: perl/embperl/trunk/Embperl/Form/Control/input.pm
URL:
http://svn.apache.org/viewcvs/perl/embperl/trunk/Embperl/Form/Control/input.pm?rev=396795&r1=396794&r2=396795&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/input.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/input.pm Tue Apr 25 00:10:49 2006
@@ -35,8 +35,9 @@
$]
<input type="text" class="cBase cControl" name="[+ $self->{name} +]"
-[$if $self -> {size} $]size="[+ $self->{size} +]"[$endif$]
-[$if $self -> {maxlength} $]maxlength="[+ $self->{maxlength} +]"[$endif$]
+ style="width: [+ $self->{css_width} || '100%' +];"
+ [$ if $self->{size} $]size="[+ $self->{size} +]"[$ endif $]
+ [$ if $self->{maxlength} $]maxlength="[+ $self->{maxlength} +]"[$ endif $]
>
[$endsub$]
@@ -57,6 +58,7 @@
name => 'foo',
size => 10,
maxlength => 50,
+ css_width => '50px',
}
=head1 DESCRIPTION
@@ -85,6 +87,10 @@
=head3 maxlength
Gives the maximum possible input length in characters
+
+=head3 css_width
+
+width style of the input field. Defaults to "100%".
=head1 Author
Modified: perl/embperl/trunk/Embperl/Form/Control/tabs.pm
URL:
http://svn.apache.org/viewcvs/perl/embperl/trunk/Embperl/Form/Control/tabs.pm?rev=396795&r1=396794&r2=396795&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/tabs.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/tabs.pm Tue Apr 25 00:10:49 2006
@@ -123,7 +123,7 @@
}
my $js = join (';', @switch_code) ;
*]
- <td class="cBase $cellclass"><div class="cBase [+ $divclass +]"
id="__tabs_[+ $id +]">
+ <td class="cBase [+ $cellclass +]"><div class="cBase [+ $divclass +]"
id="__tabs_[+ $id +]">
<a href="#" onClick="tab_selected('[+ $id +]','[+ $name +]'); [+ do {
local $escmode = 0 ; $js } +]" style="color:black; text-decoration: none;">[+
$options ->[$i] || $val +]</a></div></td>
[* $i++ *]
[$endforeach $]
Modified: perl/embperl/trunk/Embperl/Form/Control/textarea.pm
URL:
http://svn.apache.org/viewcvs/perl/embperl/trunk/Embperl/Form/Control/textarea.pm?rev=396795&r1=396794&r2=396795&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/textarea.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/textarea.pm Tue Apr 25 00:10:49 2006
@@ -35,6 +35,7 @@
<textarea type="text" class="cBase cControl" name="[+ $self->{name} +]"
[$if $self -> {cols} $]cols="[+ $self->{cols} +]"[$endif$]
[$if $self -> {rows} $]rows="[+ $self->{rows} +]"[$endif$]
+[$if $self -> {id} $]id="[+ $self->{id} +]"[$endif$]
></textarea>
[$endsub$]
@@ -53,6 +54,7 @@
type => 'textarea',
text => 'blabla',
name => 'foo',
+ id => 'id_foo',
rows => 10,
cols => 80,
}
@@ -71,6 +73,14 @@
=head3 text
Will be used as label for the text input control
+
+=head3 name
+
+Will be used as field name for the text input control
+
+=head3 name
+
+Will be used as id of the text input control
=head3 cols
Modified: perl/embperl/trunk/MANIFEST
URL:
http://svn.apache.org/viewcvs/perl/embperl/trunk/MANIFEST?rev=396795&r1=396794&r2=396795&view=diff
==============================================================================
--- perl/embperl/trunk/MANIFEST (original)
+++ perl/embperl/trunk/MANIFEST Tue Apr 25 00:10:49 2006
@@ -10,26 +10,32 @@
Embperl/App.pm
Embperl/Constant.pm
Embperl/Form.pm
-Embperl/Form/Control/select.pm
+Embperl/Form/Control.pm
+Embperl/Form/Control/addremove.pm
+Embperl/Form/Control/blank.pm
Embperl/Form/Control/checkbox.pm
+Embperl/Form/Control/display.pm
+Embperl/Form/Control/dump.pm
Embperl/Form/Control/blank.pm
Embperl/Form/Control/tabs.pm
Embperl/Form/Control/table.pm
Embperl/Form/Control/transparent.pm
Embperl/Form/Control/radio.pm
Embperl/Form/Control/file.pm
-Embperl/Form/Control/submit.pm
-Embperl/Form/Control/password.pm
-Embperl/Form/Control/label.pm
Embperl/Form/Control/grid.pm
-Embperl/Form/Control/textarea.pm
-Embperl/Form/Control/addremove.pm
-Embperl/Form/Control/display.pm
+Embperl/Form/Control/hidden.pm
Embperl/Form/Control/info.pm
-Embperl/Form/Control/number.pm
Embperl/Form/Control/input.pm
+Embperl/Form/Control/label.pm
+Embperl/Form/Control/number.pm
+Embperl/Form/Control/password.pm
+Embperl/Form/Control/radio.pm
+Embperl/Form/Control/select.pm
+Embperl/Form/Control/submit.pm
+Embperl/Form/Control/tabs.pm
+Embperl/Form/Control/textarea.pm
+Embperl/Form/Control/transparent.pm
Embperl/Form/ControlMultValue.pm
-Embperl/Form/Control.pm
Embperl/Form/Validate.pm
Embperl/Form/Validate/Default.pm
Embperl/Form/Validate/Number.pm
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]