Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: Embperl-cvs

svn commit: r724282 - in /perl/embperl/trunk/Embperl: ./ Form/ Form/Control/

 

 

ModPerl embperl-cvs RSS feed   Index | Next | Previous | View Threaded


richter at apache

Dec 8, 2008, 12:11 AM

Post #1 of 1 (1576 views)
Permalink
svn commit: r724282 - in /perl/embperl/trunk/Embperl: ./ Form/ Form/Control/

Author: richter
Date: Mon Dec 8 00:11:43 2008
New Revision: 724282

URL: http://svn.apache.org/viewvc?rev=724282&view=rev
Log:
Update Embperl Forms

Added:
perl/embperl/trunk/Embperl/Form/Control/inputjoin.pm (with props)
perl/embperl/trunk/Embperl/Form/Control/inputlist.pm (with props)
perl/embperl/trunk/Embperl/Form/Control/line.pm (with props)
perl/embperl/trunk/Embperl/Form/Control/price.pm
perl/embperl/trunk/Embperl/Form/Control/scriptcode.pm
perl/embperl/trunk/Embperl/Form/Control/show.pm (with props)
Modified:
perl/embperl/trunk/Embperl/Form.pm
perl/embperl/trunk/Embperl/Form/Control.pm
perl/embperl/trunk/Embperl/Form/Control/addremove.pm
perl/embperl/trunk/Embperl/Form/Control/button.pm
perl/embperl/trunk/Embperl/Form/Control/checkbox.pm
perl/embperl/trunk/Embperl/Form/Control/checkboxes.pm
perl/embperl/trunk/Embperl/Form/Control/datetime.pm
perl/embperl/trunk/Embperl/Form/Control/display.pm
perl/embperl/trunk/Embperl/Form/Control/displaylink.pm
perl/embperl/trunk/Embperl/Form/Control/grid.pm
perl/embperl/trunk/Embperl/Form/Control/hidden.pm
perl/embperl/trunk/Embperl/Form/Control/info.pm
perl/embperl/trunk/Embperl/Form/Control/input.pm
perl/embperl/trunk/Embperl/Form/Control/number.pm
perl/embperl/trunk/Embperl/Form/Control/radio.pm
perl/embperl/trunk/Embperl/Form/Control/select.pm
perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm
perl/embperl/trunk/Embperl/Form/Control/table.pm
perl/embperl/trunk/Embperl/Form/Control/tabs.pm
perl/embperl/trunk/Embperl/Form/ControlMultValue.pm

Modified: perl/embperl/trunk/Embperl/Form.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form.pm (original)
+++ perl/embperl/trunk/Embperl/Form.pm Mon Dec 8 00:11:43 2008
@@ -29,6 +29,8 @@
use Embperl::Inline ;

use Data::Dumper ;
+use Storable ;
+use MIME::Base64 ;

our %forms ;
our %CLEANUP = ('forms' => 0) ;
@@ -60,6 +62,7 @@
$self -> {bottom_code} = [] ;
$self -> {validate_rules} = [] ;
$self -> {toplevel} = $toplevel ;
+ $self -> {checkitems} = $options -> {checkitems} ;
$self -> {valign} = $options -> {valign} || 'top' ;
$self -> {jsnamespace} = $options -> {jsnamespace} || '' ;
$self -> {jsnamespace} .= '.' if ($self -> {jsnamespace}) ;
@@ -336,6 +339,8 @@
$controls ||= $self -> {controls} ;
$level ||= 1 ;

+ my $hidden = $self -> {hidden} ||= [] ;
+
my $x = 0 ;
my $max_x = 100 ;
my $line = [] ;
@@ -345,13 +350,20 @@
foreach my $control (@$controls)
{
next if ($control -> is_disabled) ;
+ if ($control -> is_hidden)
+ {
+ $control -> {width_percent} = 0 ;
+ push @$hidden, $control ;
+ next ;
+ }
my $width = $control -> {width_percent} || int($max_x / ($control -> {width} || 2)) ;
+ $width = 21 if ($x == 0 && $width < 21) ;
if ($x + $width > $max_x || $control -> {newline} > 0 || (($control -> {sublines} || $control -> {subobjects}) && @$line))
{ # new line
if ($x < $max_x)
{
push @$line, Embperl::Form::Control::blank -> new (
- {width_percent => $max_x - $x, level => $level }) ;
+ {width_percent => int($max_x - $x), level => $level, x_percent => int($x) }) ;
}
push @lines, $line ;
$line = [] ;
@@ -359,8 +371,8 @@
$num = 0 ;
}
push @$line, $control ;
- $control -> {width_percent} = $width ;
- $control -> {x_percent} = $x ;
+ $control -> {width_percent} = int($width) ;
+ $control -> {x_percent} = int($x) ;
$control -> {level} = $level ;
$x += $width ;
$num++ ;
@@ -371,7 +383,9 @@
if ($x < $max_x)
{
push @$line, Embperl::Form::Control::blank -> new (
- {width_percent => $max_x - $x }) ;
+ {width_percent => int($max_x - $x), level => $level, x_percent => int($x) }) ;
+ $num++ ;
+ $max_num = $num if ($num > $max_num) ;
}
push @lines, $line ;
$line = [] ;
@@ -395,10 +409,19 @@
{
next if (!$subobj) ;
$subobj -> layout ;
+ push @$hidden, @{$subobj -> {hidden}} ;
+ delete $subobj -> {hidden} ;
}
}
}

+ if ($x > 0 && $x < $max_x)
+ {
+ push @$line, Embperl::Form::Control::blank -> new (
+ {width_percent => int($max_x - $x), level => $level, x_percent => int($x) }) ;
+ $num++ ;
+ $max_num = $num if ($num > $max_num) ;
+ }
push @lines, $line if (@$line);
$self -> {max_num} = $max_num ;
return $self -> {layout} = \@lines ;
@@ -451,6 +474,8 @@
$n{$lineid}++ ;
}
$self -> show_controls_end ($req) ;
+ $self -> show_controls_hidden ($req) if ($self -> {hidden}) ;
+ $self -> show_checkitems ($req) if ($self -> {checkitems} && $self -> {toplevel}) ;

return ;
}
@@ -530,12 +555,14 @@
# text => <anzeige text>
# fn => Dateiname
# fields => Felddefinitionen (alternativ zu fn)
+# $args wird an fields funktionen durchgereicht
+# $tabs_per_line anzahl tabs pro Zeile
#

sub add_tabs

{
- my ($self, $subforms, $args) = @_ ;
+ my ($self, $subforms, $args, $tabs_per_line) = @_ ;
my @forms ;
my @values ;
my @options ;
@@ -551,7 +578,7 @@
if ($fn)
{
my $obj = Execute ({object => $fn} ) ;
- $subfields = eval {$obj -> fields ($epreq, {%$file, %$args}) || undef};
+ $subfields = $obj -> fields ($epreq, {%$file, %$args}) ;
}
push @forms, $subfields;
push @grids, $file -> {grid};
@@ -572,6 +599,7 @@
options => \@options,
subforms=> \@forms,
width => 1,
+ 'tabs_per_line' => $tabs_per_line,
},
}

@@ -614,12 +642,8 @@
{
my ($self, $object_data, $subforms, $type) = @_;

- my $name = $object_data->{name};
- my $text = $object_data->{text};
- my $width = $object_data->{width};
- my $section = $object_data->{section};
-
- $text ||= $name;
+ $object_data ||= {} ;
+ $object_data -> {text} ||= $object_data -> {name} ;

my @forms ;
my @values ;
@@ -631,17 +655,17 @@
my $subfields = $file -> {fields} ;
if ($fn)
{
- my $obj = Execute ({object => "./$fn"} ) ;
- #$subfields = eval {$obj -> fields ($r,$file) || undef};
+ my $obj = Execute ({object => "$fn"} ) ;
+ $subfields = $obj -> fields ($epreq, $file) ;
}
push @forms, $subfields || [];
push @values, $file->{value} || $file->{name};
push @options, $file -> {text} || $file->{value} || $file->{name};
}

- return { section => $section , width => $width, name => $name , text => $text, type => $type || 'select',
+ return { %$object_data, type => $type || 'select',
values => \@values, options => \@options, sublines => \@forms,
- class => $object_data->{class}, controlclass => $object_data->{controlclass}};
+ };

}

@@ -706,14 +730,14 @@
# Can be overwritten to allow for example internationalization.
#
# in $ctrl Embperl::Form::Control object
-# $name optional: name to translate, if not given take $ctrl -> {name}
+# $name optional: name to translate, if not given take $ctrl -> {text}
#

sub convert_label
{
- my ($self, $ctrl, $name) = @_ ;
+ my ($self, $ctrl, $name, $text) = @_ ;

- return $name || $ctrl->{text} || $ctrl->{name} ;
+ return $text || $ctrl->{text} || $name || $ctrl->{name} ;
}

#------------------------------------------------------------------------------------------
@@ -745,17 +769,45 @@
# Can be overwritten to allow for example internationalization.
#
# in $ctrl Embperl::Form::Control object
-# $values values of the control i.e. values that are submitted
-# $options options of the control i.e. text that should be displayed
+# $value value that is shown
#

sub convert_text
{
- my ($self, $ctrl) = @_ ;
+ my ($self, $ctrl, $value) = @_ ;

- return $ctrl->{text} || $ctrl->{name} ;
+ return $value || $ctrl->{text} || $ctrl->{name} ;
+ }
+
+
+#------------------------------------------------------------------------------------------
+#
+# diff_checkitems
+#
+# Takes the posted form data and the checkitems, compares them and return the
+# fields that have changed
+#
+# in $check optional: arrayref with fieldnames that should be checked
+# ret \%diff fields that have changed
+#
+
+sub diff_checkitems
+ {
+ my ($self, $check) = @_ ;
+
+ my %diff ;
+ my $checkitems = eval { Storable::thaw(MIME::Base64::decode ($Embperl::fdat{-checkitems})) } ;
+
+ foreach ($check?@$check:keys %Embperl::fdat)
+ {
+ next if ($_ eq '-checkitems') ;
+ $diff{$_} = 1 if ($checkitems -> {$_} ne $Embperl::fdat{$_}) ;
+ }
+
+ return \%diff ;
}

+
1;


@@ -799,19 +851,13 @@
[.$ sub show_controls_begin ($self, $req, $activeid)

my $parent = $self -> parent_form ;
-my $class = $parent -> {noframe}?'cTableDivU':'cTableDiv' ;
+my $class = $self -> {options}{classdiv} || ($parent -> {noframe}?'cTableDivU':'cTableDiv') ;
$]
<div id="[+ $self->{id} +]"
[$if ($activeid && $self->{id} ne $activeid) $] style="display: none" [$endif$]
>
[$if (!$self -> {noframe}) $]<table class="[+ $class +]"><tr><td class="cTabTD"> [$endif$]
<table class="cBase cTable cTableInput">
-[.#
-<colgroup class="cLabelGroup" span="1">
-<colgroup class="cControlGroup" span="49">
-<colgroup class="cLabelGroup" span="1">
-<colgroup class="cControlGroup" span="49">
-#]
[.# -- this row is necessary for fixed table layout -- #]
<tr style="display: none">
<td class="cLabelGroup" colspan="20"></td>
@@ -841,6 +887,32 @@
[$endif$]
[$endsub$]

+[.# ---------------------------------------------------------------------------
+#
+# show_controls_hidden - output hidden controls and the end of form
+#]
+
+[$sub show_controls_hidden ($self, $req) $]
+
+[$ foreach my $ctl (@{$self->{hidden}}) $]
+[- $ctl -> show ($req) ; -]
+[$ endforeach $]
+
+[$endsub$]
+
+[.# ---------------------------------------------------------------------------
+#
+# show_checkitems - output data to allow verifying if any data has changed
+#]
+
+[.$sub show_checkitems ($self, $req)
+
+my $checkitems = MIME::Base64::encode (Storable::freeze (\%idat)) ;
+$]
+<input type="hidden" name="-checkitems" value="[+ $checkitems +]">
+
+[$endsub$]
+

[# ---------------------------------------------------------------------------
#
@@ -974,6 +1046,15 @@

jsnamespace => 'top'

+=item * classdiv
+
+Gives the CSS class of the DIV arround the form. Default cTableDiv.
+
+=item * checkitems
+
+If set to true, allow to call the function diff_checkitems after the data is
+posted and see which form fields are changed.
+
=back

=back

Modified: perl/embperl/trunk/Embperl/Form/Control.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control.pm Mon Dec 8 00:11:43 2008
@@ -50,6 +50,16 @@
{
my ($self) = @_ ;

+ my $eventattrs = '' ;
+ if (my $e = $self -> {event})
+ {
+ for (my $i = 0; $i < @$e; $i += 2)
+ {
+ $eventattrs .= $e -> [$i] . '="' . $e -> [$i+1] . '" ' ;
+ }
+ }
+ $self -> {eventattrs} = $eventattrs ;
+
return $self ;
}

@@ -93,6 +103,19 @@

# ---------------------------------------------------------------------------
#
+# is_hidden - returns true if this is a hidden control
+#
+
+sub is_hidden
+
+ {
+ my ($self, $req) = @_ ;
+
+ return ;
+ }
+
+# ---------------------------------------------------------------------------
+#
# show - output the whole control including the label
#

@@ -144,6 +167,22 @@

# ---------------------------------------------------------------------------
#
+# label_text - return text of label
+#
+
+sub label_text
+ {
+ my ($self) = @_ ;
+
+ return $self -> {label_text} if ($self -> {label_text}) ;
+
+ return $self -> {label_text} = $self -> {showtext}?($self->{text} ||
+ $self->{name}):$self -> form -> convert_label ($self) ;
+ }
+
+
+# ---------------------------------------------------------------------------
+#
# get_validate_rules - get rules for validation
#

@@ -156,12 +195,21 @@
{

@local_rules = ( -key => $self->{name} );
- push @local_rules, -name => $self->{text} if ($self -> {text}) ;
+ push @local_rules, -name => $self -> label_text ;
push @local_rules, @{$self -> {validate}};
}
return \@local_rules ;
}

+# ---------------------------------------------------------------------------
+#
+# has_auto_label_size - returns true if label should be auto sized for this control
+#
+
+sub has_auto_label_size
+ {
+ return 1 ;
+ }

1 ;

@@ -197,7 +245,15 @@
# show - output the label
#]

-[$ sub show_label ($self, $req) $][.+ $self -> {showtext}?($self->{text} || $self->{name}):$self -> form -> convert_label ($self) +][$endsub$]
+[$ sub show_label ($self, $req) $][.-
+
+ if ($self -> {showoptionslabel})
+ {
+ my $opts = $self -> form -> convert_options ($self, [$self -> {value}]) ;
+ $self -> {text} = $opts -> [0] ;
+ $self -> {showtext} = 1 ;
+ }
+-][+ $self -> label_text +][$endsub$]

[# ---------------------------------------------------------------------------
#
@@ -218,6 +274,12 @@

my $style = '';
my $addclass = '' ;
+my $span = 20 ;
+if ($self -> {width} > 2 && $self -> has_auto_label_size ())
+ {
+ $span = int(40 / $self -> {width}) if ($self -> {x_percent} != 0) ;
+ }
+
$style = 'white-space:nowrap; ' if ($self->{labelnowrap}) ;
if ($self -> {width_precent} && !$self -> {width})
{
@@ -229,13 +291,13 @@
}
$]
<td class="cLabelBox [+ $addclass +] [$ if $self->{labelclass} $][+ " $self->{labelclass}" +][$ endif $]"
- colspan="20" [$ if $style $]style="[+ $style +]"[$ endif $]>
+ colspan="[+ $span +]" [$ if $style $]style="[+ $style +]"[$ endif $]>
[.-
$self -> show_label ($req);
$self -> show_label_icon ($req) ;
-]
</td>
- [- return 20 ; -]
+ [- return $span ; -]
[$endsub$]

[.# ---------------------------------------------------------------------------
@@ -329,6 +391,10 @@

Could value of this control be changed ?

+=head2 label_text
+
+Returns the text of the label
+
=head2 show

Output the control

Modified: perl/embperl/trunk/Embperl/Form/Control/addremove.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/addremove.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/addremove.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/addremove.pm Mon Dec 8 00:11:43 2008
@@ -60,11 +60,10 @@

$]

-<td class="cBase cControlBox" colspan="[+ $span +]">
+<td class="cBase cControlBox cControlAddRemoveBox" colspan="[+ $span +]">
<input type="hidden" id="[+ $name +]" name="[+ $name +]">
-<img src="toleft.gif" title="Hinzufügen" onClick="[+ $nsprefix +]addremoveAddOption (document, document.getElementById('[+ $self->{src} +]'), document.getElementById('[+ $self->{dest} +]'), document.getElementById('[+ $name +]'), [+ $self->{removesource} +])">
-<br>
-<img src="toright.gif" title="Entfernen" onClick="[+ $nsprefix +]addremoveRemoveOption (document, document.getElementById('[+ $self->{src} +]'), document.getElementById('[+ $self->{dest} +]'), document.getElementById('[+ $name +]'), [+ $self->{removesource} +])">
+<img src="/images/toleft.gif" title="Hinzufügen" onClick="[+ $nsprefix +]addremoveAddOption (document, document.getElementById('[+ $self->{src} +]'), document.getElementById('[+ $self->{dest} +]'), document.getElementById('[+ $name +]'), [+ $self->{removesource} +])">
+<img src="/images/toright.gif" title="Entfernen" onClick="[+ $nsprefix +]addremoveRemoveOption (document, document.getElementById('[+ $self->{src} +]'), document.getElementById('[+ $self->{dest} +]'), document.getElementById('[+ $name +]'), [+ $self->{removesource} +])">

[#
print "<input class="cStandardButton" type=button value="Hinzufügen" onClick="[+ $nsprefix +]addremoveAddOption (document, this.form.elements['$self->{src}'], this.form.elements['$self->{dest}'], this.form.elements['$self->{name}'], $self->{removesource})">\n" ;

Modified: perl/embperl/trunk/Embperl/Form/Control/button.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/button.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/button.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/button.pm Mon Dec 8 00:11:43 2008
@@ -37,12 +37,20 @@
$]
<td class="cBase cControlBox cControlButtonBox" colspan="[+ $span +]">
[$ foreach my $button (@{$self->{button}}) $]
+ [$if $self -> {symbol} $]
+ <div class="cControlButtonDiv"
+ title="[+ $self -> {showtext}?($self->{text}):$self -> form -> convert_label ($self) +]"
+ [$if $self -> {onclick} $] onClick="[.+ do { local $escmode = 0 ; $self -> {onclick} } +]" [$endif$]
+ ><img class="cControlButtonSymbol" src="[+ $self -> {symbol} +]">
+ [.+ $self -> {showvalue}?($self -> {value} || $self->{text}):$self -> form -> convert_label ($self) +]
+ </div>
+[$else$]
[# Workaround around segfault in Embperl 2.1.1-dev *grmpf* #]
<[# #]input
class="cBase cControl cControlButton" name="[+ $self->{name} +]"
value="[.+ $self -> {showvalue}?($self -> {value} || $self->{text}):$self -> form -> convert_label ($self) +]"
title="[+ $self -> {showtext}?($self->{text}):$self -> form -> convert_label ($self) +]"
- [$if $self -> {onclick} $] onClick="[+ $self -> {onclick} +]" [$endif$]
+ [$if $self -> {onclick} $] onClick="[.+ do { local $escmode = 0 ; $self -> {onclick} } +]" [$endif$]
[$if $self -> {image} $]
type="image" src="[+ $self -> {image} +]"
[$else$]
@@ -57,6 +65,7 @@
[+ $attr +]="[+ $button->{$attr} +]"
[$ endif $]
[$ endforeach $]>
+ [$endif$]
[$ endforeach $]

</td>

Modified: perl/embperl/trunk/Embperl/Form/Control/checkbox.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/checkbox.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/checkbox.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/checkbox.pm Mon Dec 8 00:11:43 2008
@@ -41,6 +41,35 @@
}


+# ---------------------------------------------------------------------------
+#
+# has_auto_label_size - returns true if label should be auto sized for this control
+#
+
+sub has_auto_label_size
+ {
+ return 0 ;
+ }
+
+# ---------------------------------------------------------------------------
+#
+# show_control_readonly - output readonly control
+#
+
+sub show_control_readonly
+ {
+ my ($self, $req) = @_ ;
+
+ my $name = $self -> {name} ;
+ my $val = $self -> {value} ;
+ $val = 1 if ($val eq '') ;
+
+ $self -> {value} = $fdat{$name} eq $val?'X':'-' ;
+ $self -> SUPER::show_control_readonly ($req) ;
+ }
+
+
+
1 ;

__EMBPERL__
@@ -60,7 +89,7 @@
$]
<input type="checkbox" class="cBase cControlCheckbox" name="[+ $name +]" value="[+ $val +]"
[$if ($self -> {sublines} || $self -> {subobjects}) $] OnClick="[+ $nsprefix +]show_checked(document, this)" [$endif$]
->
+[.+ do { local $escmode = 0 ; $self -> {eventattrs} } +]>
[$endsub$]

__END__

Modified: perl/embperl/trunk/Embperl/Form/Control/checkboxes.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/checkboxes.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/checkboxes.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/checkboxes.pm Mon Dec 8 00:11:43 2008
@@ -32,7 +32,15 @@
my ($self, $req) = @_ ;

my $name = $self -> {name} ;
- $self -> show_control ($req, "^\Q$fdat{$name}\\E\$") ;
+ $self -> show_control ($req, "^\Q$fdat{$name}\E\$") ;
+ }
+
+# ---------------------------------------------------------------------------
+
+sub show_control_addons
+ {
+ my ($self, $req) = @_ ;
+
}

1 ;
@@ -53,34 +61,51 @@
my $addbottom= $self -> {addbottom} || [] ;
my $max = @$values ;
my $set = !defined ($fdat{$name})?1:0 ;
+ my $tab = $self -> {tab} ;
+ my $colcnt = 0 ;
+ push @{$self -> form -> {fields2empty}}, $name ;

my $val ;
my $i = 0 ;
$]
+[$if $tab $]<[# #]table>[$ endif $]
[$ foreach $val (@$addtop) $]
[$if !defined ($filter) || ($val->[0] =~ /$filter/i) $]
- [- $fdat{$name} = $val -> [0], $set = 0 if ($set) ; -]
- <input type="checkboxes" name="[+ $name +]" value="[+ $val -> [0] +]"
- >[+ $val ->[1] || $val -> [0] +]
+ [$ if $tab $][$ if $colcnt == 0 $]<[# #]tr>[- $colcnt = $tab -][$endif$]<td>[$endif$]
+ [#- $fdat{$name} = $val -> [0], $set = 0 if ($set) ; -#]
+ <input type="checkbox" name="[+ $name +]" value="[+ $val -> [0] +]"
+ >
+ [$ if $tab $]</td><td>[$endif$]
+ [+ $val ->[1] || $val -> [0] +]
+ [$ if $tab $]</td>[$ if $colcnt-- < 1 $]<[# #]/tr>[$endif$][$endif$]
[$endif$]
[$endforeach$]
[$ foreach $val (@$values) $]
[$if !defined ($filter) || ($val =~ /$filter/i) $]
- [.- $fdat{$name} = $val, $set = 0 if ($set) ; -]
+ [$ if $tab $][$ if $colcnt == 0 $]<[# #]tr>[- $colcnt = $tab -][$endif$]<td>[$endif$]
+ [.#- $fdat{$name} = $val, $set = 0 if ($set) ; -#]
<input type="checkbox" name="[+ $name +]" value="[+ $val +]"
[$if ($self -> {sublines} || $self -> {subobjects}) $] OnClick="show_checkboxes_checked(this,[+ $i +],[+ $max +])" [$endif$]
- >[+ $options ->[$i] || $val +]
+ >
+ [$ if $tab $]</td><td>[$endif$]
+ [+ $options ->[$i] || $val +]
[- $vert = $self -> {vert} -][$while $vert-- > 0 $]<br/>[$endwhile$]
+ [$ if $tab $]</td>[$ if $colcnt-- < 1 $]<[# #]/tr>[$endif$][$endif$]
[$endif$]
[* $i++ ; *]
[$endforeach$]
[$ foreach $val (@$addbottom) $]
[$if !defined ($filter) || ($val->[0] =~ /$filter/i) $]
- [- $fdat{$name} = $val -> [0], $set = 0 if ($set) ; -]
- <input type="checkboxes" name="[+ $name +]" value="[+ $val -> [0] +]"
- >[+ $val ->[1] || $val -> [0] +]
+ [$ if $tab $][$ if $colcnt == 0 $]<[# #]tr>[- $colcnt = $tab -][$endif$]<td>[$endif$]
+ [#- $fdat{$name} = $val -> [0], $set = 0 if ($set) ; -#]
+ <input type="checkbox" name="[+ $name +]" value="[+ $val -> [0] +]"
+ >
+ [$ if $tab $]</td><td>[$endif$]
+ [+ $val ->[1] || $val -> [0] +]
+ [$ if $tab $]</td>[$ if $colcnt-- < 1 $]<[# #]/tr>[$endif$][$endif$]
[$endif$]
[$endforeach$]
+[$if $tab $]<[# #]/table>[$ endif $]

[$endsub$]

@@ -138,6 +163,11 @@
If specified arranges the checkboxes button vertically. The number given specifies
the number of <br>'s used the separate the checkboxes buttons.

+=head3 tab
+
+if specified arranges the checkboxes in a table. The number given
+specifies the number of columns in one table row.
+
=head3 addtop

Array ref which contains items that should be added at the left or top

Modified: perl/embperl/trunk/Embperl/Form/Control/datetime.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/datetime.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/datetime.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/datetime.pm Mon Dec 8 00:11:43 2008
@@ -70,6 +70,11 @@
strftime ($format, @time[0..5]) ;
} ;

+ if ($time && !$date && ($time =~ /\d+\.\d+\.\d+/))
+ {
+ $date = $time ;
+ }
+
$fdat{$name} = $date ;
}

@@ -82,6 +87,8 @@
{
my ($self, $req) = @_ ;

+ return if ($self -> {readonly}) ;
+
my $name = $self->{name} ;
my $date = $fdat{$name} ;
return if ($date eq '') ;
@@ -96,6 +103,7 @@
}
else
{
+ $date =~ tr/,;/ / ;
my ($d, $t) = split (/\s+/, $date) ;
if ($d =~ /:/)
{
@@ -133,8 +141,6 @@
}

$fdat{$name} = $year?sprintf ('%04d%02d%02d%02d%02d%02dZ', $year, $mon, $day, $hour, $min, $sec):'' ;
-
-print STDERR "datetime: $date -> $year, $mon, $day $hour:$min:$sec\n" ;
}

1 ;

Modified: perl/embperl/trunk/Embperl/Form/Control/display.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/display.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/display.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/display.pm Mon Dec 8 00:11:43 2008
@@ -33,14 +33,15 @@
[.$ sub show_control ($self)

my $name = $self->{name};
+my $id = $self->{id};
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
+$]<span id="[+ $id +]">[$ 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 $]
+ else $][+ $value +][$ endif $]</span>

[$ if $self->{hidden} $]
<input type="hidden" name="[+ $name +]" value="[+ $value +]">

Modified: perl/embperl/trunk/Embperl/Form/Control/displaylink.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/displaylink.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/displaylink.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/displaylink.pm Mon Dec 8 00:11:43 2008
@@ -21,6 +21,18 @@

use Embperl::Inline ;

+# ---------------------------------------------------------------------------
+#
+# show_control_readonly - output readonly control
+#
+
+sub show_control_readonly
+ {
+ my ($self, $req) = @_ ;
+
+ $self -> show_control ($req) ;
+ }
+
1 ;

__EMBPERL__
@@ -37,6 +49,8 @@
my $targets = $self -> {target} ;
my $opens = $self -> {open} ;
my $displays = $self -> {link} || $self -> {value} ;
+my $form = $self -> form ;
+my $showoptions = $self -> {showoptions} ;

$hrefs = [$hrefs] if (!ref $hrefs) ;
$targets = [$targets] if ($targets && !ref $targets) ;
@@ -48,11 +62,11 @@

[$ foreach $display (@$displays) $]
[$if $opens -> [$dispn] $]
- <a href="#" onclick="[+ $opens -> [$dispn] +]('[+ $hrefs -> [$dispn] +]')">
+ <a href="#" onclick="[+ $opens -> [$dispn] +][$if $hrefs -> [$dispn] $]('[+ $hrefs -> [$dispn] +]')[$endif$]">
[$else$]
<a href="[+ do {local $escmode=0;$hrefs -> [$dispn]} +]"
[$if $targets -> [$dispn] $]target="[+ $targets -> [$dispn] +]"[$endif$]>
- [$endif$][+ $display +]</a>&nbsp;
+ [$endif$][+ $showoptions?$display:$form -> convert_text ($self, $display) +]</a>&nbsp;
[- $dispn++ -]
[$endforeach$]

@@ -107,6 +121,10 @@

Arrayref with targets

+=head3 showtext
+
+If set the texts from the link parameter will not be passed thru convert_text
+
=head1 Author

G. Richter (richter [at] dev)

Modified: perl/embperl/trunk/Embperl/Form/Control/grid.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/grid.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/grid.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/grid.pm Mon Dec 8 00:11:43 2008
@@ -72,7 +72,7 @@

my $ldap = $req->{ldap};
my $name = $self->{name} ;
- my @entries = split("\t",$fdat{$name});
+ my @entries = ref $fdat{$name} eq 'ARRAY'?@{$fdat{$name}}:split("\t",$fdat{$name});
my $fields = $self -> {fields} ;

my @data;
@@ -121,6 +121,8 @@
{
my ($self, $req) = @_ ;

+ return if ($self -> {readonly}) ;
+
my $ldap = $req->{ldap};
my $name = $self->{name} ;
my $fields = $self -> {fields} ;
@@ -135,6 +137,7 @@
my $order ;
for (my $i = 0; $i < $max; $i++)
{
+ my $ok = 0 ;
foreach my $field (@$fields)
{
if ((ref ($field) =~ /::/) && $field -> can ('prepare_fdat'))
@@ -142,8 +145,11 @@
local $field->{name} = "$name-$field->{name}-$i" ;
$field -> prepare_fdat ($req) ;
}
+ $ok++ ;
}

+ next if (!$ok) ;
+
$order = $fdat{"$name-#row#-$i"} ;
$order = $i + 10000 if (!defined($order)) ;
$orders{$order} = $i ;
@@ -226,12 +232,14 @@
<table class="cBase cGridTitle">
<tr class="cTableRow">
<td class="cBase cGridLabelBox">[+ $self -> form -> convert_label ($self) +]</td>
+ [$if !($self -> {readonly}) $]
<td class="cBase cGridControlBox">
<img src="/images/toup.gif" id="cmdUp" name="-up" title="Zeile Hoch" onclick="[+ $jsname +].upRow()">
<img src="/images/todown.gif" id="cmdDown" name="-down" title="Zeile runter" onclick="[+ $jsname +].downRow()">
<img src="/images/button_neu.gif" id="cmdAdd" name="-add" title="Zeile Hinzuf&uuml;gen Alt-NUM+" onclick="[+ $jsname +].addRow()">
<img src="/images/button_loeschen.gif" id="cmdDelete" name="-delete" title="Markierte Zeile L&ouml;schen Alt-NUM-" onclick="[+ $jsname +].delRow()">
</td>
+ [$endif$]
</tr>
</table>
[$ endsub $]
@@ -269,7 +277,14 @@
[$foreach $field (@$fields)$]
<td class="cGridCell">[$if $n++ == 0$]<input type="hidden" name="[+ "$name-#row#-$i" +]" value="[+ $i +]">[$endif$][.-
local $field -> {name} = "$name-$field->{name}-$i" ;
- $field -> show_control ($req)
+ if ($self -> {readonly})
+ {
+ $field -> show_control_readonly ($req)
+ }
+ else
+ {
+ $field -> show_control ($req)
+ }
-]</td>
[$endforeach$]
</tr>

Modified: perl/embperl/trunk/Embperl/Form/Control/hidden.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/hidden.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/hidden.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/hidden.pm Mon Dec 8 00:11:43 2008
@@ -22,32 +22,37 @@

sub noframe { return 1; }

+# ---------------------------------------------------------------------------
+#
+# is_hidden - returns true if this is a hidden control
+#
+
+sub is_hidden
+
+ {
+ my ($self, $req) = @_ ;
+
+ 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)
+[.$ sub show ($self, $req)

my $name = $self->{name};
my $value = exists $self->{value} ? $self->{value} : $fdat{$name};

$]
-<input type="hidden" name="[+ $name +]" value="[+ $value +]">
+<input type="hidden" name="[+ $name +]" value="[+ $value +]" id="[+ $self->{id} +]">
[$endsub$]

__END__
@@ -81,10 +86,6 @@

Will be used as name for the hidden input field.

-=head3 value
-
-Value for the hidden field.
-
=head1 Author

G. Richter (richter [at] dev), A. Beckert (beckert [at] ecos)

Modified: perl/embperl/trunk/Embperl/Form/Control/info.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/info.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/info.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/info.pm Mon Dec 8 00:11:43 2008
@@ -35,7 +35,7 @@
my $span = ($self->{width_percent});
my $section = $self->{section};
$]
-<td class="cBase cInfoBox" colspan="[+ $span +]">[$ if $section $]<b>[$ endif $][+ $self->{text} +][$ if $section $]</b>[$ endif $]</td>
+<td class="cBase cInfoBox" colspan="[+ $span +]">[$ if $section $]<b>[$ endif $][+ $self -> {showtext}?($self->{text}):$self -> form -> convert_text ($self) +]&nbsp;[$ if $section $]</b>[$ endif $]</td>
[$endsub$]



Modified: perl/embperl/trunk/Embperl/Form/Control/input.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/input.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/input.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/input.pm Mon Dec 8 00:11:43 2008
@@ -39,7 +39,7 @@
<input type="text" class="cBase cControl [+ $class +]" name="[+ $self->{name} +]" id="[+ $self->{name} +]"
[$if $self -> {size} $]size="[+ $self->{size} +]"[$endif$]
[$if $self -> {maxlength} $]maxlength="[+ $self->{maxlength} +]"[$endif$]
->
+[.+ do { local $escmode = 0 ; $self -> {eventattrs} } +]>
[$endsub$]

__END__

Added: perl/embperl/trunk/Embperl/Form/Control/inputjoin.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/inputjoin.pm?rev=724282&view=auto
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/inputjoin.pm (added)
+++ perl/embperl/trunk/Embperl/Form/Control/inputjoin.pm Mon Dec 8 00:11:43 2008
@@ -0,0 +1,171 @@
+
+###################################################################################
+#
+# 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::inputjoin ;
+
+use strict ;
+use base 'Embperl::Form::Control' ;
+
+use Embperl::Inline ;
+
+use vars qw{%fdat} ;
+
+# ------------------------------------------------------------------------------------------
+#
+# init_data - daten aufteilen
+#
+
+sub init_data
+ {
+ my ($self, $req) = @_ ;
+
+ my $name = $self -> {name} ;
+ my $split = $self -> {split} || $self -> {join} ;
+ my $num = $self -> {numinputs} || 1 ;
+ my $i = 0 ;
+ my @vals = split /$split/, $fdat{$name} ;
+ for (my $i = 0; $i < $num; $i++)
+ {
+ $fdat{"$name-_-$i"} = $vals[$i] ;
+ }
+ }
+
+# ------------------------------------------------------------------------------------------
+#
+# prepare_fdat - daten zusammenfuehren
+#
+
+sub prepare_fdat
+ {
+ my ($self, $req) = @_ ;
+
+ my $name = $self -> {name} ;
+ my $join = $self -> {join} ;
+ my $num = $self -> {numinputs} || 1 ;
+ my @vals ;
+ for (my $i = 0; $i < $num; $i++)
+ {
+ push @vals, $fdat{"$name-_-$i"} ;
+ }
+ $fdat{$name} = join ($join, @vals) ;
+ }
+
+
+
+1 ;
+
+__EMBPERL__
+
+[# ---------------------------------------------------------------------------
+#
+# show_control - output the control
+#]
+
+[.$ sub show_control ($self)
+
+my $class = $self -> {class} ;
+my $numinputs = $self -> {numinputs} ;
+my $size = $self -> {size} ||= 80 / ($self -> {width} || 2) / $numinputs ;
+my $sep = $self -> {separator} || ' ' ;
+my $i = 0 ;
+$]
+[$ while ($i < $numinputs) $]
+<input type="text" class="cBase cControl [+ $class +]" name="[+ $self->{name} +]-_-[+ $i +]"
+[$if $size $]size="[+ $size +]"[$endif$]
+[$if $self -> {maxlength} $]maxlength="[+ $self->{maxlength} +]"[$endif$]
+[.+ do { local $escmode = 0 ; $self -> {eventattrs} } +]>[+ $i + 1 < $numinputs?$sep:'' +]
+[- $i++ -]
+[$endwhile$]
+[$endsub$]
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Embperl::Form::Control::inputjoin - A number of text input controls inside an Embperl Form
+
+
+=head1 SYNOPSIS
+
+ {
+ type => 'input',
+ text => 'blabla',
+ name => 'foo',
+ size => 10,
+ maxlength => 50,
+ numinputs => 4
+ }
+
+=head1 DESCRIPTION
+
+Used to create a number of input control inside an Embperl Form,
+which contents are joined.
+See Embperl::Form on how to specify parameters.
+
+=head2 PARAMETER
+
+=head3 type
+
+Needs to be 'input'
+
+=head3 name
+
+Specifies the name of the control
+
+=head3 text
+
+Will be used as label for the text input control
+
+=head3 size
+
+Gives the size in characters
+
+=head3 maxlength
+
+Gives the maximum possible input length in characters
+
+=head3 class
+
+Alternative CSS class name
+
+=head3 numinputs
+
+Number of input boxes
+
+=head3 join
+
+Strings which is used to join the input fields
+
+=head3 split
+
+Regex which is used to split the data into the input fields.
+Default is /join/
+
+=head3 separator
+
+String to display between the input boxes
+
+=head1 Author
+
+G. Richter (richter [at] dev)
+
+=head1 See Also
+
+perl(1), Embperl, Embperl::Form
+
+

Propchange: perl/embperl/trunk/Embperl/Form/Control/inputjoin.pm
------------------------------------------------------------------------------
svn:executable = *

Added: perl/embperl/trunk/Embperl/Form/Control/inputlist.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/inputlist.pm?rev=724282&view=auto
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/inputlist.pm (added)
+++ perl/embperl/trunk/Embperl/Form/Control/inputlist.pm Mon Dec 8 00:11:43 2008
@@ -0,0 +1,123 @@
+
+###################################################################################
+#
+# 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::inputlist ;
+
+use strict ;
+use base 'Embperl::Form::Control' ;
+
+use Embperl::Inline ;
+
+use vars qw{%fdat} ;
+
+1 ;
+
+__EMBPERL__
+
+[# ---------------------------------------------------------------------------
+#
+# show_control - output the control
+#]
+
+[.$ sub show_control ($self)
+
+my $class = $self -> {class} ;
+my $opts = $self -> {options} ;
+my $vals = $self -> {values} ;
+my $sep = $self -> {seperator};
+my $sizes = $self -> {sizes} ;
+$sizes ||= [];
+$sep ||= ' ';
+$opts ||= $vals;
+my $i = 0;
+$]
+[$ while ($i < @$vals) $][-$size = $sizes->[$i] ; $size ||= $self->{size} -]
+<input type="text" class="cBase cControl [+ $class +]" name="[+ $vals->[$i]+]" id="[+ $vals->[$i]+]"
+[$if $size $]size="[+ $size +]" maxlength="[+$size+]" [$endif$]
+[.+ do { local $escmode = 0 ; $self -> {eventattrs} } +]>[+ ($i +1) < @$vals?$sep:'' +]
+[- $i++ -]
+[$endwhile$]
+[$endsub$]
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Embperl::Form::Control::inputjoin - A number of text input controls inside an Embperl Form
+
+
+=head1 SYNOPSIS
+
+ {
+ type => 'inputlist',
+ text => 'blabla',
+ name => 'foo',
+ size => 10,
+ class => 'bar',
+ seperator => '.',
+ sizes => [2,4,5],
+ }
+
+=head1 DESCRIPTION
+
+Used to create a number of input controls inside an Embperl Form.
+See Embperl::Form on how to specify parameters.
+
+=head2 PARAMETER
+
+=head3 type
+
+Needs to be 'inputlist'
+
+=head3 name
+
+Specifies the name of the control
+
+=head3 text
+
+Will be used as label for the text input control
+
+=head3 size
+
+Gives the default size in characters
+
+=head3 sizes
+
+Gives the size in characters for each input field, this parameter has to be given as an array reference
+
+=head3 class
+
+Alternative CSS class name
+
+=head3 values
+
+Gives the names for each input field, this parameter has to be given as an array reference
+
+=head3 separator
+
+String to display between the input boxes
+
+=head1 Author
+
+H. Jung (jung [at] dev)
+
+=head1 See Also
+
+perl(1), Embperl, Embperl::Form
+
+

Propchange: perl/embperl/trunk/Embperl/Form/Control/inputlist.pm
------------------------------------------------------------------------------
svn:executable = *

Added: perl/embperl/trunk/Embperl/Form/Control/line.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/line.pm?rev=724282&view=auto
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/line.pm (added)
+++ perl/embperl/trunk/Embperl/Form/Control/line.pm Mon Dec 8 00:11:43 2008
@@ -0,0 +1,76 @@
+
+###################################################################################
+#
+# 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::line ;
+
+use strict ;
+use base 'Embperl::Form::Control' ;
+
+use Embperl::Inline ;
+
+1 ;
+
+__EMBPERL__
+
+[# ---------------------------------------------------------------------------
+#
+# show - output the control
+#]
+
+[.$ sub show ($self, $req)
+
+my $span = ($self->{width_percent}) ;
+$]
+<td class="cBase cTransparentBox" colspan="[+ $span +]"><hr class="cControlLine"></td>
+[$endsub$]
+
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Embperl::Form::Control::line - A horizontal line an Embperl Form
+
+
+=head1 SYNOPSIS
+
+ {
+ type => 'line',
+ }
+
+=head1 DESCRIPTION
+
+Used to create a horizontal line inside an Embperl Form.
+See Embperl::Form on how to specify parameters.
+
+=head2 PARAMETER
+
+=head3 type
+
+Needs to be 'line'
+
+
+=head1 Author
+
+G. Richter (richter [at] dev)
+
+=head1 See Also
+
+perl(1), Embperl, Embperl::Form
+
+

Propchange: perl/embperl/trunk/Embperl/Form/Control/line.pm
------------------------------------------------------------------------------
svn:executable = *

Modified: perl/embperl/trunk/Embperl/Form/Control/number.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/number.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/number.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/number.pm Mon Dec 8 00:11:43 2008
@@ -34,9 +34,11 @@

$self->{size} ||= 10 ;
$self->{class} ||= 'cControlWidthNumber' ;
+
+ my $unit = $self->{unit} ;
$]
[- $self -> SUPER::show_control ; -]
-[$if ($self->{unit}) $][+ $self ->{unit} +][$endif$]
+[$if ($unit) $][.+ $self -> form -> convert_text ($self, ($unit =~ /:/)?$unit:"unit:$unit", $unit) +][$endif$]
[$endsub$]

__END__

Added: perl/embperl/trunk/Embperl/Form/Control/price.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/price.pm?rev=724282&view=auto
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/price.pm (added)
+++ perl/embperl/trunk/Embperl/Form/Control/price.pm Mon Dec 8 00:11:43 2008
@@ -0,0 +1,179 @@
+
+###################################################################################
+#
+# 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::price ;
+
+use strict ;
+use base 'Embperl::Form::Control::number' ;
+
+use Embperl::Inline ;
+
+use vars qw{%fdat} ;
+
+# ---------------------------------------------------------------------------
+#
+# init - init the new control
+#
+
+sub init
+
+ {
+ my ($self) = @_ ;
+
+ $self -> {use_comma} = 1 if (!defined $self -> {use_comma}) ;
+ $self->{unit} = '€' if (!exists ($self->{unit}) && !defined ($self->{unit} ));
+
+ return $self ;
+ }
+
+# ------------------------------------------------------------------------------------------
+#
+# init_data - daten aufteilen
+#
+
+sub init_data
+ {
+ my ($self, $req, $parentctrl) = @_ ;
+
+ delete $self -> {unit} if ($parentctrl) ;
+ my $name = $self->{name} ;
+ my $val = $fdat{$name} ;
+ return if ($val eq '') ;
+
+ my $sep ;
+ my $dec ;
+ my $int ;
+ my @int ;
+ my $frac ;
+ my $minus = $val =~ s/^-// ;
+ ($int, $frac) = split (/\./, $val, 2) ;
+ if ($self -> {use_comma})
+ {
+ $sep = '.' ;
+ $dec = ',' ;
+ }
+ else
+ {
+ $sep = ',' ;
+ $dec = '.' ;
+ }
+
+ $int = '0' x ((3 - length($int)) % 3) . $int;
+
+ while ($int =~ /(...)/g)
+ {
+ push @int, $1 ;
+ }
+
+ $int[0] =~ s/^0+// ;
+ $int[0] = '0' if (@int == 1 && !$int[0]) ;
+ $frac = substr ($frac . '00', 0, 2) ;
+ $fdat{$name} = ($minus?'-':'') . join ($sep, @int) . $dec . $frac ;
+ }
+
+# ------------------------------------------------------------------------------------------
+#
+# prepare_fdat - daten zusammenfuehren
+#
+
+sub prepare_fdat
+ {
+ my ($self, $req) = @_ ;
+
+ my $name = $self->{name} ;
+ my $val = $fdat{$name} ;
+ return if ($val eq '') ;
+
+ $val =~ s/\s+//g ;
+ if ($self -> {use_comma})
+ {
+ $val =~ s/\.//g ;
+ $val =~ s/\,/./ ;
+ }
+
+ $fdat{$name} = $val + 0 ;
+ }
+
+1 ;
+
+__EMBPERL__
+
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Embperl::Form::Control::price - A price input control with optional unit inside an Embperl Form
+
+
+=head1 SYNOPSIS
+
+ {
+ type => 'price',
+ text => 'blabla',
+ name => 'foo',
+ unit => 'sec',
+ }
+
+=head1 DESCRIPTION
+
+Used to create a price input control inside an Embperl Form.
+Will format number as a money ammout.
+Optionaly it can display an unit after the input field.
+See Embperl::Form on how to specify parameters.
+
+=head2 PARAMETER
+
+=head3 type
+
+Needs to be 'price'
+
+=head3 name
+
+Specifies the name of the control
+
+=head3 text
+
+Will be used as label for the numeric input control
+
+=head3 size
+
+Gives the size in characters. (Default: 10)
+
+=head3 maxlength
+
+Gives the maximun length in characters
+
+=head3 unit
+
+Gives a string that should be displayed right of the input field.
+(Default: €)
+
+=head3 use_comma
+
+If set the decimal character is comma instead of point (Default: on)
+
+=head1 Author
+
+G. Richter (richter [at] dev)
+
+=head1 See Also
+
+perl(1), Embperl, Embperl::Form
+
+

Modified: perl/embperl/trunk/Embperl/Form/Control/radio.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/radio.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/radio.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/radio.pm Mon Dec 8 00:11:43 2008
@@ -53,7 +53,7 @@
}
}

- $self -> show_control ($req, "^\Q$fdat{$name}\\E\$", $values, $options) ;
+ $self -> show_control ($req, "^\Q$fdat{$name}\E\$", $values, $options) ;
}

# ---------------------------------------------------------------------------
@@ -85,9 +85,6 @@
my $set = !defined ($fdat{$name})?1:0 ;
my $nsprefix = $self -> form -> {jsnamespace} ;

- $options = $self -> form -> convert_options ($self, $values, $options)
- if (!$self -> {showoptions}) ;
-
my $val ;
my $i = 0 ;

@@ -115,11 +112,11 @@
></td><td>[+ $val ->[1] || $val -> [0] +]</td>[+ do { local $escmode = 0 ; $trend }+]
[$endif$]
[$endforeach$]
-[$ foreach $val (@$values) $]
+[$ foreach $val (@$values) $][- $x = ($val =~ /$filter/i) -]
[$if !defined ($filter) || ($val =~ /$filter/i) $]
[.- $fdat{$name} = $val, $set = 0 if ($set) ;
$fdat{$name} = $val if ($ignorecase && lc($fdat{$name}) eq lc($val)) ; -]
- [+ do { local $escmode = 0 ; $tr }+]<td><input type="radio" name="[+ $name +]" value="[+ $val +]" id="[+ "$name-$val" +]"
+ [+ do { local $escmode = 0 ; $tr }+]<td><input type="radio" name="[+ $name +]" value="[+ $val +]" id="[+ "$name-_-$val" +]"
[$if ($self -> {sublines} || $self -> {subobjects}) $] OnClick="[+ $nsprefix +]show_radio_checked(document, this,[+ $i +],[+ $max +])" [$endif$]
></td><td>[+ $options ->[$i] || $val +]</td>[+ do { local $escmode = 0 ; $trend }+]
[$endif$]

Added: perl/embperl/trunk/Embperl/Form/Control/scriptcode.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/scriptcode.pm?rev=724282&view=auto
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/scriptcode.pm (added)
+++ perl/embperl/trunk/Embperl/Form/Control/scriptcode.pm Mon Dec 8 00:11:43 2008
@@ -0,0 +1,111 @@
+###################################################################################
+#
+# 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::scriptcode ;
+
+use strict ;
+use base 'Embperl::Form::Control' ;
+
+use Embperl::Inline ;
+
+sub noframe { return 1; }
+
+# ---------------------------------------------------------------------------
+#
+# is_hidden - returns true if this is a hidden control
+#
+
+sub is_hidden
+
+ {
+ my ($self, $req) = @_ ;
+
+ return 1 ;
+ }
+
+
+
+1 ;
+
+__EMBPERL__
+
+[# ---------------------------------------------------------------------------
+#
+# show_control - output the control
+#]
+
+[.$ sub show ($self, $req)
+
+my $name = $self -> {name};
+my $type = $self -> {scripttype} || 'text/javascript' ;
+
+$]
+<script type="[+ $type +]">
+//<!--
+[.+ do { local $escmode = 0 ; $self -> {code} } +]
+//-->
+</script>
+[$endsub$]
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Embperl::Form::Control::scriptcode - A control to add script code to an Embperl Form
+
+
+=head1 SYNOPSIS
+
+ {
+ type => 'scriptcode',
+ code => 'function onEvent { .... }',
+ }
+
+=head1 DESCRIPTION
+
+Used to create a script code blockinside an Embperl Form.
+The code block is added to the end of the form.
+See Embperl::Form on how to specify parameters.
+
+=head2 PARAMETER
+
+=head3 type
+
+Needs to be set to 'scriptcode'.
+
+=head3 name
+
+optional
+
+=head3 scripttype
+
+Type of script code. Default: text/javascript
+
+=head3 code
+
+The actual script code.
+
+
+=head1 Author
+
+G. Richter (richter [at] dev), A. Beckert (beckert [at] ecos)
+
+=head1 See Also
+
+perl(1), Embperl, Embperl::Form
+
+

Modified: perl/embperl/trunk/Embperl/Form/Control/select.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/select.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/select.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/select.pm Mon Dec 8 00:11:43 2008
@@ -24,6 +24,30 @@

# ---------------------------------------------------------------------------
#
+# get_select_values - return values of control
+#
+
+sub get_select_values
+ {
+ my ($self, $req) = @_ ;
+
+ my ($values, $options) = $self -> get_values ($req) ;
+ my $addtop = $self -> {addtop} || [] ;
+ my $addbottom= $self -> {addbottom} || [] ;
+ my $addtop_options = [] ;
+ my $addbottom_options = [] ;
+ if (!$self -> {showoptions})
+ {
+ $addtop_options = $self -> form -> convert_options ($self, $addtop) if ($self -> {addtop}) ;
+ $addbottom_options = $self -> form -> convert_options ($self, $addbottom) if ($self -> {addbottom}) ;
+ }
+
+ return ($values, $options, $addtop, $addtop_options, $addbottom, $addbottom_options) ;
+ }
+
+
+# ---------------------------------------------------------------------------
+#
# show_control_readonly - output readonly control
#

@@ -32,7 +56,58 @@
my ($self, $req) = @_ ;

my $name = $self -> {name} ;
- $self -> show_control ($req, "^\Q$fdat{$name}\\E\$") ;
+
+ my ($values, $options, $addtop, $addtop_options, $addbottom, $addbottom_options) = $self -> get_select_values ($req) ;
+
+ my $val = $fdat{$name} ;
+ my $opt ;
+ my $i = 0 ;
+ foreach (@$addtop)
+ {
+ if ($_ eq $val)
+ {
+ $opt = $addtop_options -> [$i] || $val ;
+ last ;
+ }
+ $i++ ;
+ }
+
+ if (!$opt)
+ {
+ $i = 0 ;
+ foreach (@$values)
+ {
+ if ($_ eq $val)
+ {
+ $opt = $options -> [$i] || $val ;
+ last ;
+ }
+ $i++ ;
+ }
+ }
+
+ if (!$opt)
+ {
+ $i = 0 ;
+ foreach (@$addbottom)
+ {
+ if ($_ eq $val)
+ {
+ $opt = $addbottom_options -> [$i] || $val ;
+ last ;
+ }
+ $i++ ;
+ }
+ }
+
+ if (!$opt)
+ {
+ $opt = $self -> form -> convert_text ($self, 'err:select_not_found') ;
+ }
+
+ $self -> {value} = $opt ;
+ $self -> show_hidden ($req) ;
+ $self -> SUPER::show_control_readonly ($req) ;
}


@@ -43,39 +118,52 @@

[# ---------------------------------------------------------------------------
#
+# show_hidden - out hidden field
+#]
+
+[$ sub show_hidden ($self, $req) $]
+<input type="hidden" name="[+ $self -> {name} +]">
+[$endsub$]
+
+[# ---------------------------------------------------------------------------
+#
# show_control - output the control
#]

[.$ sub show_control ($self, $req, $filter)

- my ($values, $options) = $self -> get_values ($req) ;
my $name = $self -> {name} ;
$filter ||= $self -> {filter} ;
- my $addtop = $self -> {addtop} || [] ;
- my $addbottom= $self -> {addbottom} || [] ;
my $nsprefix = $self -> form -> {jsnamespace} ;
my $val ;
my $i = 0 ;
+ my ($values, $options, $addtop, $addtop_options, $addbottom, $addbottom_options) = $self -> get_select_values ($req) ;
+
$]
<select class="cBase cControl cControlWidthSelect" name="[+ $name +]" id="[+ $name +]"
[$if ($self -> {sublines} || $self -> {subobjects}) $] OnChange="[+ $nsprefix +]show_selected(document, this)" [$endif$]
[$if ($self -> {rows}) $] size="[+ $self->{rows} +]" [$endif$]
->
+[.+ do { local $escmode = 0 ; $self -> {eventattrs} } +]>
+[* $i = 0 ; *]
[$ foreach $val (@$addtop) $]
[$if !defined ($filter) || ($val->[0] =~ /$filter/i) $]
- <option value="[+ $val->[0] +]">[+ $val ->[1] || $val -> [0] +]</option>
+ <option value="[+ $val->[0] +]">[+ $addtop_options -> [$i] || $val ->[1] || $val -> [0] +]</option>
[$endif$]
+ [* $i++ ; *]
[$endforeach$]
+[* $i = 0 ; *]
[$ foreach $val (@$values) $]
[$if !defined ($filter) || ($val =~ /$filter/i) $]
<option value="[+ $val +]">[+ $options ->[$i] || $val +]</option>
[$endif$]
[* $i++ ; *]
[$endforeach$]
+[* $i = 0 ; *]
[$ foreach $val (@$addbottom) $]
[$if !defined ($filter) || ($val->[0] =~ /$filter/i) $]
- <option value="[+ $val->[0] +]">[+ $val ->[1] || $val -> [0] +]</option>
+ <option value="[+ $val->[0] +]">[+ $addbottom_options -> [$i] || $val ->[1] || $val -> [0] +]</option>
[$endif$]
+ [* $i++ ; *]
[$endforeach$]
</select>


Modified: perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm Mon Dec 8 00:11:43 2008
@@ -32,7 +32,24 @@
my ($self, $req) = @_ ;

my $name = $self -> {name} ;
- $self -> show_control ($req, "^\Q$fdat{$name}\\E\$") ;
+
+ my ($values, $options) = $self -> get_values ($req) ;
+ my $initval ;
+ my $fdatval = $fdat{$name} ;
+ my $i = 0 ;
+ foreach (@$values)
+ {
+ if ($_ eq $fdatval)
+ {
+ $initval = $options->[$i] ;
+ last ;
+ }
+ $i++ ;
+ }
+
+ $self -> {value} = $initval ;
+ $self -> show_hidden ($req) ;
+ $self -> SUPER::show_control_readonly ($req) ;
}


@@ -53,6 +70,15 @@

[# ---------------------------------------------------------------------------
#
+# show_hidden - out hidden field
+#]
+
+[$ sub show_hidden ($self, $req) $]
+<input type="hidden" name="[+ $self -> {name} +]">
+[$endsub$]
+
+[# ---------------------------------------------------------------------------
+#
# show_control - output the control
#]


Added: perl/embperl/trunk/Embperl/Form/Control/show.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/show.pm?rev=724282&view=auto
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/show.pm (added)
+++ perl/embperl/trunk/Embperl/Form/Control/show.pm Mon Dec 8 00:11:43 2008
@@ -0,0 +1,126 @@
+
+###################################################################################
+#
+# 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::show ;
+
+use strict ;
+use base 'Embperl::Form::Control' ;
+
+use Embperl::Inline ;
+
+1 ;
+
+__EMBPERL__
+
+[# ---------------------------------------------------------------------------
+#
+# show_control - output the control
+#]
+
+[.$ sub show_control ($self)
+
+my $name = $self->{name};
+my $value = exists $self->{value} ? $self->{value} : $fdat{$name};
+
+$value = int($value) if ($self -> {int}) ;
+$value = $value?1:0 if ($self -> {bool}) ;
+
+my $options = $value ;
+$options = [ split /\t/, $value ] if $self->{split};
+$options = [ split /\n/, $value ] if $self->{splitlines};
+$options = [$options] if (!ref $options) ;
+
+$options = $self -> form -> convert_options ($self, $options, $options)
+ if (ref $options eq 'ARRAY' && !$self -> {showoptions}) ;
+
+$][$ if ref $options eq 'ARRAY' $][- $n = @$options -][$ foreach $v (@$options) $][+ $v +][$ if $n-- > 1 $]<br />[$endif$][$ 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 $]
+
+[$ if $self->{hidden} $]
+<input type="hidden" name="[+ $name +]" value="[+ $value +]">
+[$endif$]
+[$endsub$]
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Embperl::Form::Control::display - A text display control inside an Embperl Form
+
+
+=head1 SYNOPSIS
+
+ {
+ type => 'display',
+ text => 'blabla',
+ hidden => 1,
+ name => 'foo',
+ split => 1
+ }
+
+=head1 DESCRIPTION
+
+Used to create a display only control inside an Embperl Form.
+See Embperl::Form on how to specify parameters.
+
+=head2 PARAMETER
+
+=head3 type
+
+Needs to be set to 'display'.
+
+=head3 text
+
+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
+automatically.
+
+=head3 name
+
+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 (richter [at] dev), A. Beckert (beckert [at] ecos)
+
+=head1 See Also
+
+perl(1), Embperl, Embperl::Form
+
+

Propchange: perl/embperl/trunk/Embperl/Form/Control/show.pm
------------------------------------------------------------------------------
svn:executable = *

Modified: perl/embperl/trunk/Embperl/Form/Control/table.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/table.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/table.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/table.pm Mon Dec 8 00:11:43 2008
@@ -65,7 +65,13 @@
<tr style="background: white">
[$foreach $c (@$line) $][-
$attr = ref $c?$c -> [0]:$c ;
- $item = $o -> {$attr}
+ $item = $o -> {$attr} ;
+ $item = ref $item?join ('; ',@$item):$item ;
+ if ($filter = $c -> [6])
+ {
+ die "unknown filter '$filter'" if (!($filtercode = $self -> {filters}{$filter})) ;
+ $item = &{$filtercode}($item, $c, $o, $epreq) ;
+ }
-]<td colspan="[+ ref $c?$c -> [2] || 1:1 +]" class="[.# +$self -> {line2} || (@{$self->{columns}} > 1 && $i == 0)?'cGridLabelBox':'cControlBox'+ #] cLdapReportTd" style="[+ $self -> cellstyle ($item, $o, $r, $i, $attr) +]">[$ if $c -> [3] && ($item =~ /^&(.*?),(.*?),(.*)$/) $]
[$ if $1 eq 'checkbox' $]<input type="checkbox" name="[+ $2 +]" value="[+ $3 +]">[$endif$]
[$ if $1 eq 'radio' $]<input type="radio" name="[+ $2 +]" value="[+ $3 +]">[$endif$]
@@ -170,6 +176,11 @@

target for link

+=item 6
+
+Name of filter function. The value of the cell is process through this filter.
+Filter functions are passed as hashref of subs in the paramter 'filters' .
+
=back

=head3 line2
@@ -177,6 +188,22 @@
Arrayref with names of which the values should concated and displayed
below each entry.

+=head3 filters
+
+Hashref of coderefs which contains filter functions. The following example
+shows one filter called 'date' which passes the data throught the perl
+function format_date. The value is passed as first argument to the filter
+function. The second argument is the column description (see above),
+the third argument is the row data and the last argument is the
+current Embperl request record.
+
+ filters =>
+ {
+ 'date' => sub
+ {
+ return format_date ($_[0]) ;
+ }
+ }

=head1 Author


Modified: perl/embperl/trunk/Embperl/Form/Control/tabs.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/tabs.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/tabs.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/tabs.pm Mon Dec 8 00:11:43 2008
@@ -39,6 +39,8 @@
bless $self, $class ;

$self -> {width} = 1 ;
+ $self -> {nameprefix} ||= 'tab:' ;
+
return $self ;
}

@@ -101,15 +103,27 @@
my $dataval = $fdat{$name} || $values -> [0] ;
my $activeid = $self -> get_active_id ;
my $nsprefix = $self -> form -> {jsnamespace} ;
+ my $tabs_per_line = $self -> {'tabs_per_line'} || 99;
+ $tabs_per_line = [$tabs_per_line, $tabs_per_line, $tabs_per_line, $tabs_per_line]
+ if (!ref $tabs_per_line) ;

my $val ;
my $i = 0 ;
+ my $more = 1 ;
+ my $start_i = 0 ;
+ my $line = 0 ;
$]

<td class="cBase cTabTD" colspan="[+ $span +]">
- <table class="cBase cTabTable" ><tr class="cBase cTabRow">
- [$ foreach $val (@$values) $]
+ [$ while ($more) $]
+ <table class="cBase cTabTable" ><tr class="cBase cTabRow">
+ [.*
+ $more = 0 ;
+ my $tabs = $tabs_per_line -> [$line++] ;
+ *]
+ [$ while ($i < @$values) $]
[*
+ $val = $values -> [$i] ;
my $id = $self -> {subids}[$i] ;
my $cellclass = $id eq $activeid?'cTabCellOn':'cTabCellOff' ;
my $divclass = $id eq $activeid?'cTabDivOn':'cTabDivOff' ;
@@ -125,14 +139,22 @@
my $js = join (';', @switch_code) ;
*]
<td class="cBase [+ $cellclass +]"><div class="cBase [+ $divclass +]"
- [$ if $i == 0 $]style="border-left: black 1px solid" [$endif$]
+ [$ if $i - $start_i == 0 $]style="border-left: black 1px solid" [$endif$]
id="__tabs_[+ $id +]">
<a href="#" onClick="[+ $nsprefix +]tab_selected(document, '[+ $id +]','[+ $name +]'); [.+ do { local $escmode = 0 ; $js } +]" style="color:black; text-decoration: none;">[+ $options ->[$i] || $val +]</a></div></td>
- [* $i++ *]
- [$endforeach $]
- <td class="cBase cTabCellBlank">&nbsp;</td>
+ [.* $i++ ;
+ if ($i - $start_i >= $tabs && @$values > $i)
+ {
+ $more = 1 ;
+ $start_i = $i ;
+ last ;
+ }
+ *]
+ [$endwhile $]
+ [$if ($i == @$values) $]<td class="cBase cTabCellBlank">&nbsp;</td>[$endif$]
+ </tr></table>
+ [$endwhile$]
<input type="hidden" name="[+ $name +]" id="[+ $name +]" value="[+ $activeid +]">
- </tr></table>
</td>
[$endsub$]


Modified: perl/embperl/trunk/Embperl/Form/ControlMultValue.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/ControlMultValue.pm?rev=724282&r1=724281&r2=724282&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/ControlMultValue.pm (original)
+++ perl/embperl/trunk/Embperl/Form/ControlMultValue.pm Mon Dec 8 00:11:43 2008
@@ -41,6 +41,8 @@
$self -> {datasrcobj} = $form -> new_object ($packages, $self -> {datasrc}, $self) ;
}

+ $self -> SUPER::init ;
+
return $self ;
}

@@ -56,7 +58,12 @@
my ($self, $req) = @_ ;

return $self -> {datasrcobj} -> get_values ($req, $self) if ($self -> {datasrcobj}) ;
- return ($self -> {values}, $self -> {options}) ;
+
+ my $options = $self -> {options} ;
+ $options = $self -> form -> convert_options ($self, $self -> {values}, $options)
+ if (!$self -> {showoptions}) ;
+
+ return ($self -> {values}, $options) ;
}

# ---------------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-cvs-unsubscribe [at] perl
For additional commands, e-mail: embperl-cvs-help [at] perl

ModPerl embperl-cvs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.