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

Mailing List Archive: ModPerl: Embperl-cvs

svn commit: r558530 - in /perl/embperl/trunk/Embperl: Form.pm Form/Control.pm Form/Control/grid.pm Form/Control/radio.pm Form/Control/selectdyn.pm Form/Control/tabs.pm Form/ControlMultValue.pm

 

 

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


richter at apache

Jul 22, 2007, 12:10 PM

Post #1 of 1 (562 views)
Permalink
svn commit: r558530 - in /perl/embperl/trunk/Embperl: Form.pm Form/Control.pm Form/Control/grid.pm Form/Control/radio.pm Form/Control/selectdyn.pm Form/Control/tabs.pm Form/ControlMultValue.pm

Author: richter
Date: Sun Jul 22 12:10:14 2007
New Revision: 558530

URL: http://svn.apache.org/viewvc?view=rev&rev=558530
Log:
- New grid implementation
- sub form bug fixes
- radio button with ignore case option

Modified:
perl/embperl/trunk/Embperl/Form.pm
perl/embperl/trunk/Embperl/Form/Control.pm
perl/embperl/trunk/Embperl/Form/Control/grid.pm
perl/embperl/trunk/Embperl/Form/Control/radio.pm
perl/embperl/trunk/Embperl/Form/Control/selectdyn.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?view=diff&rev=558530&r1=558529&r2=558530
==============================================================================
--- perl/embperl/trunk/Embperl/Form.pm (original)
+++ perl/embperl/trunk/Embperl/Form.pm Sun Jul 22 12:10:14 2007
@@ -51,6 +51,7 @@
my $self = ref $class?$class:{} ;

$self -> {controls} = $controls ;
+ $self -> {options} = $options ;
$self -> {id} = $id ;
$self -> {parentptr} = $parentptr ;
$self -> {formname} = $options -> {formname} || 'topform' ;
@@ -69,6 +70,19 @@
$validate_rules = $self -> {validate_rules} = [] ;
}

+ if ($toplevel)
+ {
+ $self -> {fields2empty} = [] ;
+ $self -> {init_data} = [] ;
+ $self -> {prepare_fdat} = [] ;
+ }
+ else
+ {
+ $self -> {fields2empty} = $self -> parent_form -> {fields2empty} ;
+ $self -> {init_data} = $self -> parent_form -> {init_data} ;
+ $self -> {prepare_fdat} = $self -> parent_form -> {prepare_fdat} ;
+ }
+
$self -> new_controls ($controls, $options, undef, $id, $validate_rules, $options -> {masks}, $options -> {defaults}) ;

$self -> {noframe} = 1 if ($controls && @$controls > 0 &&
@@ -79,11 +93,6 @@
{
my $epf = $self -> {validate} = Embperl::Form::Validate -> new ($validate_rules, $self -> {formname}) if ($self -> {validate_rules}) ;
$self -> add_code_at_bottom ($epf -> get_script_code) ;
- $self -> {fields2empty} = [] ;
- }
- else
- {
- $self -> {fields2empty} = $self -> parent_form -> {fields2empty} ;
}

return $self ;
@@ -243,6 +252,9 @@
{
my $type = $control -> {type} || ($control -> {name}?'input':'blank') ;
$control = $self -> new_object ($packages, $type, $control) ;
+ push @{$self -> {init_data}}, $control if ($control -> can ('init_data')) ;
+ push @{$self -> {prepare_fdat}}, $control if ($control -> can ('prepare_fdat')) ;
+
}

next if ($control -> is_disabled) ;
@@ -316,9 +328,10 @@
sub layout

{
- my ($self, $controls) = @_ ;
+ my ($self, $controls, $level) = @_ ;

$controls ||= $self -> {controls} ;
+ $level ||= 1 ;

my $x = 0 ;
my $max_x = 100 ;
@@ -335,7 +348,7 @@
if ($x < $max_x)
{
push @$line, Embperl::Form::Control::blank -> new (
- {width_percent => $max_x - $x }) ;
+ {width_percent => $max_x - $x, level => $level }) ;
}
push @lines, $line ;
$line = [] ;
@@ -345,6 +358,7 @@
push @$line, $control ;
$control -> {width_percent} = $width ;
$control -> {x_percent} = $x ;
+ $control -> {level} = $level ;
$x += $width ;
$num++ ;
$max_num = $num if ($num > $max_num) ;
@@ -367,7 +381,7 @@
foreach my $subcontrols (@{$control -> {sublines}})
{
next if (!$subcontrols) ;
- my $sublines = $self -> layout ($subcontrols) ;
+ my $sublines = $self -> layout ($subcontrols, $level + 1) ;
push @lines, @$sublines ;
}
}
@@ -401,20 +415,22 @@
my $lines = $self -> {layout} ;
my %n ;
my $activesubid ;
+ my @activesubid ;

$self -> show_controls_begin ($req, $activeid) ;
my $lineno = 0 ;
foreach my $line (@$lines)
{
- my $lineid = @$line && $line->[0]{parentid}?"$line->[0]{parentid}":'id' ;
+ my $linelevel = @$line?$line->[0]{level}:0 ;
+ my $lineid = @$line && $line->[0]{parentid}?"$line->[0]{parentid}":'id' ;
$n{$lineid} ||= 10 ;

- $self -> show_line_begin ($req, $lineno, "$lineid-$n{$lineid}", $activesubid);
+ my $visible = $self -> show_line_begin ($req, $lineno, "$lineid-$n{$lineid}", $activesubid[$linelevel-1] || $activeid);
foreach my $control (@$line)
{
- my $newactivesubid = $control -> get_active_id ($req) ;
+ my $newactivesubid = $visible?$control -> get_active_id ($req):'-' ;
$control -> show ($req);
- $activesubid = $newactivesubid if ($newactivesubid) ;
+ $activesubid[$control -> {level}] = $newactivesubid if ($newactivesubid) ;
if ($control -> {subobjects})
{
my @obj ;
@@ -422,7 +438,7 @@
foreach my $subobj (@{$control -> {subobjects}})
{
next if (!$subobj || !$subobj -> {controls} || !@{$subobj -> {controls}}) ;
- $subobj -> show ($req, $activesubid) ;
+ $subobj -> show ($req, $activesubid[$control -> {level}]) ;
}
$control -> show_sub_end ($req) ;
}
@@ -457,13 +473,34 @@

# ---------------------------------------------------------------------------
#
-# init_data -
+# init_data - init fdat before showing
#

sub init_data

{
+ my ($self, $req) = @_ ;
+
+ foreach my $control (@{$self -> {init_data}})
+ {
+ $control -> init_data ($req) ;
+ }
+ }
+
+# ---------------------------------------------------------------------------
+#
+# prepare_fdat - change fdat after submit
+#

+sub prepare_fdat
+
+ {
+ my ($self, $req) = @_ ;
+
+ foreach my $control (@{$self -> {prepare_fdat}})
+ {
+ $control -> prepare_fdat ($req) ;
+ }
}

# ---------------------------------------------------------------------------
@@ -741,9 +778,10 @@
my $class = $lineno == 0?'cTableRow1':'cTableRow' ;
$]
<tr class="[+ $class +]" valign="[+ $self->{valign} +]"
- [$if $id $] id="[+ $id +]"[$endif$]
- [$if ($baseid eq $baseaid && $baseidn != $baseaidn) $] style="display: none"[$endif$]
+ [$if $id $] id="[+ $id +]" [$endif$]
+ [.$if ($activeid eq '-' || ($baseid eq $baseaid && $baseidn != $baseaidn)) $] style="display: none" [$endif$]
>
+[.* return !($activeid eq '-' || ($baseid eq $baseaid && $baseidn != $baseaidn)) *]
[$endsub$]

[# ---------------------------------------------------------------------------

Modified: perl/embperl/trunk/Embperl/Form/Control.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control.pm?view=diff&rev=558530&r1=558529&r2=558530
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control.pm Sun Jul 22 12:10:14 2007
@@ -205,8 +205,8 @@
#]

[$sub show_label_icon ($self, $req) $]
-[$if $self -> {sublines} $]&nbsp;<img src="plus.png" style="vertical-align: middle;">[$endif$]
-[$if $self -> {parentid} $]&nbsp;<img src="vline.png" style="vertical-align: middle;">[$endif$]
+[$if $self -> {sublines} $]&nbsp;<img src="/images/plus.png" style="vertical-align: middle;">[$endif$]
+[$if $self -> {parentid} $]&nbsp;<img src="/images/vline.png" style="vertical-align: middle;">[$endif$]
[$endsub$]

[# ---------------------------------------------------------------------------

Modified: perl/embperl/trunk/Embperl/Form/Control/grid.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/grid.pm?view=diff&rev=558530&r1=558529&r2=558530
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/grid.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/grid.pm Sun Jul 22 12:10:14 2007
@@ -36,183 +36,98 @@

my $self = Embperl::Form::ControlMultValue -> new($args) ;
bless $self, $class ;
-
- $self -> {width} = 1 ;
+
+ $self -> init ;
+
return $self ;
}

-
# ---------------------------------------------------------------------------
#
-# get_on_show_code
-#
-# retuns js code that should be excuted when form becomes visible
+# init - init the new control
#

-sub get_on_show_code
- {
- my ($self) = @_ ;
- return "switch_grid('$self->{id}')";
- }
-
-# ---------------------------------------------------------------------------
+sub init

-sub get_object
{
- my $self = shift;
- return 'grid-entry';
- }
+ my ($self) = @_ ;

-# -------------------------------------------------------------------------------------- ----
+ $self -> {header_bottom} = 10 if (!exists ($self -> {header_bottom})) ;
+ $self -> {width} = 1 ;
+
+ my $form = $self -> form ;
+ $form -> new_controls ($self -> {fields}, $form -> {options}) ;

-sub gridname
- {
- return 'cGridSimple';
+ return $self ;
}

# ------------------------------------------------------------------------------------------
+#
+# init_data - daten aufteilen
+#

-sub prepare_fdat
+sub init_data
{
- my $self = shift;
-
- my %list;
- my $gridname = $self->gridname;
- my $ldap = $epreq->{ldap};
+ my ($self, $req) = @_ ;
+
+ my $ldap = $req->{ldap};
+ my $name = $self->{name} ;
+ my @entries = split("\t",$fdat{$name});
+ my $fields = $self -> {fields} ;

-
- foreach my $entry (keys %fdat)
+ my @data;
+ my $i = 0 ;
+ my $j ;
+ foreach my $entry (@entries)
{
-
- next if ($entry !~ /_($gridname)_/);
-
- if( $entry =~ /^_grid_[^_]+_([^_]+)_(\d+)/ )
+ @data = ecos::LdapBase -> splitAttrValue($entry);
+ my $rowno = shift @data ;
+ $j = 0 ;
+ foreach my $field (@$fields)
{
-
- my $name = $1;
- my $index = $2;
- my $value = $fdat{$entry};
- $list{$index}->{$name} = $value;
- delete $fdat{$entry};
+ $fdat{"$name-$field->{name}-$i"} = $data[$j++] ;
}
+ $i++ ;
}
-
- my @entries;
-
- foreach my $index (keys %list)
- {
- my $entry = $list{$index};
- $entry->{address} =~ s/^--(.*)--$//;
- $entry->{param} =~ s/^--(.*)--$//;
- my $attr = $ldap->joinAttrValue([$index,$entry->{active},$entry->{param}]);
- push @entries,$attr;
- }
-
- $fdat{$self->get_object} = join ("\t",@entries);
+ $fdat{"$name-max"} = $i?$i:1;
}

-
-
# ------------------------------------------------------------------------------------------
+#
+# prepare_fdat - daten zusammenfuehren
+#

-sub get_data
- {
- my $self = shift;
- my $ldap = $epreq->{ldap};
- my @data;
- my @create =
- (
- {
- param => '-- Bitte Daten eintragen --',
- active => 0,
- }
- ) ;
-
- my @entries = split("\t",$fdat{$self->get_object});
-
- foreach my $entry (@entries)
- {
- my ($index,$active,$param) = $ldap->splitAttrValue($entry);
- my $field = {};
- $param ||= $self->empty_line;
- $field->{active} = $active;
- $field->{param} = $param;
-
- push @data,$field;
- }
-
- @data = @create if (! @data);
-
- return (\@data, \@create) ;
- }
-
-sub init
- {
- my ($self) = @_;
- $self -> {gridname} = $self -> gridname ;
- ($self -> {data}, $self -> {create}) = $self -> get_data ;
- }
-
-sub trclass { 'cGridData' }
-sub hiddentrclass { '' }
-sub gridname { 'default' }
-sub onSubmit {'post_grid_data();return 1;'};
-sub prepare_fdat {}
-#sub empty_line {'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'}
-sub empty_line {' '}
-sub passmask {'****'}
-sub passmask {'****'}
-sub compare_pw_list
+sub prepare_fdat
{
- my ($self,$dn,$attrname,$attr2write,$attrindex,$savedindex) = @_;
- my $ldap = $epreq->{ldap};
- my $attrs = [$attrname];
- my $ldap_obj = $ldap->search($dn,'objectclass=*','base',$attrs);
- my $attrsaved = $ldap_obj->{$dn}->{$attrname};
- my %attrsaved;
- my %attr2write;
- my $passmask = $self->passmask;
-
-#print STDERR 'START';
-#print STDERR Data::Dumper::Dumper($attr2write);
-#print STDERR Data::Dumper::Dumper($attrsaved);
-
- foreach my $entry (@$attrsaved)
+ my ($self, $req) = @_ ;
+
+ my $ldap = $req->{ldap};
+ my $name = $self->{name} ;
+ my $fields = $self -> {fields} ;
+ my $max = $fdat{"$name-max"} ;
+
+ my @rows;
+ my $j ;
+ my $val ;
+ for (my $i = 0; $i < $max; $i++)
{
- my @entry = $ldap->splitAttrValue($entry);
- my $index = $entry[$savedindex];
- my $pass = $entry[$attrindex];
- $attrsaved{$index} = $pass;
- }
-
-#print STDERR Data::Dumper::Dumper(\%attrsaved);
-
- my $i = 0;
- foreach my $entry (@$attr2write)
- {
- my @entry = $ldap->splitAttrValue($entry);
- my $index = $entry[$savedindex];
- my $pass = $entry[$attrindex];
- if ($pass eq $passmask)
+ $j = 0 ;
+ my @data = ($i+1) ;
+ foreach my $field (@$fields)
{
- $pass = $attrsaved{$index};
- $entry[$attrindex] = $pass;
+ push @data, $fdat{"$name-$field->{name}-$i"} ;
}
- my $entry2write = $ldap->joinAttrValue(\@entry);
- $attr2write->[$i] = $entry2write;
- $i++;
+ $val = ecos::LdapBase -> joinAttrValue(\@data) ;
+ push @rows, $val if ($val ne '') ;
}
-#print STDERR Data::Dumper::Dumper($attr2write);
- return $attr2write;
+ $fdat{$name} = \@rows ;
}

-
-
-
1 ;

__EMBPERL__

+
[# ---------------------------------------------------------------------------
#
# show - output the control
@@ -220,213 +135,114 @@

[.$ sub show ($self)

-my $span = ($self->{width_percent}) ;
+ my $name = $self -> {name} ;
+ my $span = ($self->{width_percent}) ;
+ my $nsprefix = $self -> form -> {jsnamespace} ;
+ my $jsname = $name ;
+ $jsname =~ s/[^a-zA-Z0-9]/_/g ;
+ $jsname .= 'Grid' ;
+ my $max = $fdat{"$name-max"} ;
$]
<td class="cBase cLabelBox" colspan="[+ $span +]">
- [- shift -> showgrid (@_) -]
- </td>
-[$endsub$]
-
-
-
-[# ################################################################################################
- draw_additional_div
- ################################################################################################ #]
-[$ sub draw_additional_div $]
-<div id="additional[- $self->draw_table_id; -]" class="cGridHidden">
-</div>
-[$ endsub $]
-[# #--- draw_additional_div ----# #]
-
-[# ################################################################################################
- draw_auto_table
- ################################################################################################ #]
-[$ sub draw_auto_table $]
-<table id="auto_table" class="cGridHidden"></table>
-[$ endsub $]
-[# #--- draw_auto_table ----# #]
-
-[.# ################################################################################################
- draw_grid_table Erzeugt eine Grid-Tabelle
- in hidden wenn gestetzt wird eine dynamische Tabelle erzeugt
- ################################################################################################ #]
-[$ sub draw_grid_table $]
- [.-
- my ($self,$hidden) = @_;
-
- if($hidden)
- {
- $grid_data = $self -> {create};
- $trclass = $self -> hiddentrclass ;
- }
- else
- {
- $grid_data = $self -> {data};
- $trclass = $self -> trclass ;
- }
- $fields = $self -> {fields} ;
- $id = $self->{currentid};
- $id ||= 1 ;
- -]
- [$foreach $entry (@$grid_data)$]
-
- <TR [$if( $trclass )$]class="[+ $trclass +]"[$endif$]>
-
- [$foreach $field (@$fields)$]
- [.-
- $val = $entry->{$field->{'name'}};
- $domid = '_grid_'.$self->{gridname}.'_'.$field->{name}."_$id" ;
- if($field->{type} && $epreq -> can ($field->{type}))
- {
- my $method = $field -> {type} ;
- $epreq -> $method ($field);
- }
-
- -]
-
- [$if($field->{'type'} eq 'checkbox')$]
- <TD id="[+$domid+]" class="cGrid[+ ucfirst(lc($field->{'type'}))+]"><input name="[+$domid+]" type="checkbox" value="1" [$if($val)$]checked[$endif$]></TD>
- [$elsif($field->{'type'} eq 'select')$]
-[-
-#use Data::Dumper;
-#print STDERR Dumper($field);
--]
- <TD id="[+$domid+]" class="cGrid[+ ucfirst(lc($field->{'type'}))+]">
- <select name="[+$domid+]" size="[+ $field->{size} | 1 +]">
- [-$i=0-]
- [$foreach my $option (@{$field->{options}}) $][-$value = $field->{values}->[$i] -]
- <option value="[+$value+]" [$ if( $val eq $value)$]selected[$endif$]>[+$option+]</option>
- [-$i++-]
- [$endforeach$]
- </select></TD>
- [$elsif($field->{'type'} eq 'blank')$]
- <TD id="[+$domid+]" class="cGrid[+ ucfirst(lc($field->{'type'}))+]" width="[+$field->{'width'}+]"></TD>
- [$elsif($field->{'type'} eq 'hidden')$]
- <TD style="display:none;"> <input type="hidden" name="[+$domid+]" value="[+$val+]"></TD>
- [$else$]
- <TD id="[+$domid+]" class="cGrid[+ ucfirst(lc($field->{'type'}))+]" width="[+$field->{'width'}+]">[+$val+]</TD>
- [$endif$]
- [$endforeach$]
-
- </TR>
- [- $id++;-]
- [$endforeach$]
- [-$self->{currentid} = $id;-]
-[$ endsub $]
-[# #--- draw_grid_table ----# #]
-
-[.# ################################################################################################
- draw_grid_control Erzeugt die Buttons zur Grid Steuerung
- ################################################################################################ #]
-[$ sub draw_grid_control $]
[.-
- ($self) = @_;
+ $fdat{$name} = $self -> {default} if ($fdat{$name} eq '' && exists ($self -> {default})) ;
+ my $span = 0 ;
+ $self -> show_grid_title ($jsname);
-]
- <table class="control" align="center" cellpadding=0 cellspacing=0 border=0 rules="none" >
- <TR class="control">
- <TD colspan="[+self->{'control_colspan'}+]" align="center">
- <input class="cStandardButton" type="button" id="cmdAdd" name="-add" value="Hinzuf&uuml;gen" onclick="[+ $nsprefix +]appendRow('[+$self->{'appendline_for_js'}+]')" title="Hinzuf&uuml;gen">
- <input class="cStandardButton" type="button" id="cmdDelete" name="-delete" value="L&ouml;schen" onclick="[+ $nsprefix +]delete_from_form('[+$self->{'appendline_for_js'}+]')" title="L&ouml;schen">
- </TD>
- </TR>
- </table>
-[$ endsub $]
-[# #--- draw_grid_control ----# #]
-
-[# ################################################################################################
- draw_grid_header Erzeugt den Tabellenkopf
- ################################################################################################ #]
-[$ sub draw_grid_header $]
- [.-
- ($self) = @_;
- $gridfields = $self->{'fields'};
- -]
- <TR class="cGridHeader">[-$i=0-]
- [.* for (my $i = 0; $i < @$gridfields ; $i++) { *]
- [$if ($gridfields->[$i]->{text} )$]<TD class="cGridHeader" [$ if ($gridfields->[$i]->{sorted})$]axis="sorted"[$endif$] [$if($width = $gridfields->[$i]->{width})$]width="[+$width+]"[$endif$]>[+$gridfields->[$i]->{text}+]</TD>[$endif$]
- [* } *]
- </TR>
-[$ endsub $]
-[# #--- draw_grid_header ----# #]
+ <input type="hidden" name="[+ $self -> {name} +]-max" id="[+ $self -> {id} +]-max">
+ <table class="cGridTable cBase" id="[+ $self -> {id} +]">
+ [- $self -> show_grid_header (); -]
+ [- $self -> show_grid_table () ; -]
+ </table>
+ [.- $self -> show_grid_title ($jsname)
+ if ($max > $self -> {header_bottom}) -]
+ <table id="[+ $self -> {id} +]-newrow" style="display: none">
+ [- $self -> show_grid_table_row ('%row%') ; -]
+ </table>
+ <script>
+ [+ $jsname +] = new [+ $nsprefix +]Grid (document.getElementById('[+ $self -> {id} +]'),
+ document.getElementById('[+ $self -> {id} +]-newrow'),
+ document.getElementById('[+ $self -> {id} +]-max')) ;
+ </script>
+ </td>
+[$endsub$]
+

[# -----------------------------------------------------------------------------
#
# show_grid_title - Zeigt den Titel der Tabelle an
#]

-[$ sub show_grid_title $]
-[-
-($self) = @_;
--]
+[$ sub show_grid_title ($self, $jsname)
+$]
<table class="cBase cGridTitle">
<tr class="cTableRow">
<td class="cBase cGridLabelBox">[+ $self->{text} +]</td>
<td class="cBase cGridControlBox">
- <img src="button_neu.gif" id="cmdAdd" name="-add" title="Zeile Hinzuf&uuml;gen" onclick="[+ $nsprefix +]appendRow('[+$self->{'appendline_for_js'}+]')">
- <img src="button_loeschen.gif" id="cmdDelete" name="-delete" title="Markierte Zeile L&ouml;schen" onclick="[+ $nsprefix +]delete_from_form('[+$self->{'appendline_for_js'}+]')">
+ <img src="/images/button_neu.gif" id="cmdAdd" name="-add" title="Zeile Hinzuf&uuml;gen" onclick="[+ $jsname +].addRow()">
+ <img src="/images/button_loeschen.gif" id="cmdDelete" name="-delete" title="Markierte Zeile L&ouml;schen" onclick="[+ $jsname +].delRow()">
</td>
</tr>
</table>
[$ endsub $]
+
+[# ---------------------------------------------------------------------------
+#
+# show_grid_header Erzeugt den Tabellenkopf
+#]

-[.# ################################################################################################
- draw_table_id Zeigt die DOM Id der Tabelle an
- ################################################################################################ #]
-
-[$ sub draw_table_id $][- ($self) = @_;-][+$self -> {id} +][$ endsub $]
-[# #--- draw_title ----# #]
-
-
-
-[.# ################################################################################################
- show Erzeugt eine dynamische Tabelle
-
- in objektspezifische Grid-Daten Struktur :
-
- gridfields = Felder der Grid-Tabelle (angelehnt an das fields Format)
- griddata = Datensatz mit den Werten der Tabelle
- initdata = Datensatz mit den initialen Werten der Tabelle
- names2display = (optional) Arrayref mit den Titeln des Tabellenkopfes
- title = Titel der Grid-Tabelle
- trclass = css Klasse der Tabellenzeilen
- hiddentrclass = (optional) css Klasse für versteckte Tabellenfelder
- ################################################################################################ #]
-
-[$ sub showgrid $]
-[.-
-($self) = @_;
-
-$self -> init() ;
-$epreq -> {'onSubmitLdapData'} = $self -> onSubmit ;
-$nsprefix = $self -> form -> {jsnamespace} ;
-
--]
+[$ sub show_grid_header ($self)

-[- $self->show_grid_title; -]
-<table class="cBase cGridTable" id="[- $self->draw_table_id; -]" name="[- $self->draw_table_id; -]">
-[- $self->draw_grid_header; -]
-[- $self-> draw_grid_table; -]
-</table>
+ my $fields = $self->{'fields'};
+ $]
+ <tr class="cGridHeader">
+ [$ foreach my $field (@$fields) $]
+ <td class="cGridHeader" [$if($width = $field->{width})$]width="[+$width+]"[$endif$]>[+$field->{text}+]</td>
+ [$ endforeach $]
+ </tr>
+[$ endsub $]

-[- $self->draw_auto_table;-]
-[- $self->draw_additional_div; -]
+[# ---------------------------------------------------------------------------
+#
+# show_grid_table_row Erzeugt eine Grid-Tabelle-Zeile
+#]

-<div id="hidden_table_container[- $self->draw_table_id; -]" class="cGridHidden">
+[$ sub show_grid_table_row ($self, $i)

-<table id="hidden[- $self->draw_table_id; -]" class="cGridHidden">
-[- $self-> draw_grid_table(1); -]
-</table>
-</div>
+ $fields = $self -> {fields} ;
+ $id = $self -> {id};
+ $name = $self -> {name} ;
+ $]

-<div id="temp[- $self->draw_table_id; -]">
-</div>
+ <tr class="cGridRow" id="[+ "$id-row-$i" +]">

-<SCRIPT language="javascript">
-[+ $nsprefix +]init('[- $self->draw_table_id; -]');
-</SCRIPT>
+ [$foreach $field (@$fields)$]
+ <td class="cGridCell">[.-
+ local $field -> {name} = "$name-$field->{name}-$i" ;
+ $field -> show_control ($req)
+ -]</td>
+ [$endforeach$]
+ </tr>
+[$ endsub $]
+
+[# ---------------------------------------------------------------------------
+#
+# show_grid_table Erzeugt eine Grid-Tabelle
+#]

+[.$ sub show_grid_table ($self)
+ my $name = $self->{name} ;
+ my $fields = $self -> {fields} ;
+ my $id = $self -> {id};
+ my $i = 0 ;
+ my $max = $fdat{"$name-max"} || 1 ;
+ $]
+
+ [.* for ($i = 0; $i < $max ; $i++ ) { *]
+ [- $self -> show_grid_table_row ($i) ; -]
+ [* } *]
+
[$endsub$]
-[# #--- show ----# #]



@@ -453,6 +269,29 @@

Needs to be 'grid'

+=head3 fields
+
+Array ref with field definitions
+
+=head3 header_bottom
+
+If grid has more rows as given in this parameter,
+a header line is also displayed at the bottom of the
+grid. Default is 10. Set to -1 to always get a
+header at the bottom.
+
+=head2 Example
+
+ {
+ name => 'provider-path',
+ text => 'Suchpfad',
+ type => 'grid',
+ fields =>
+ [.
+ { name => 'active', text => 'Aktiv', type => 'checkbox', width => '30' },
+ { name => 'path', text => 'Pfad' },
+ ],
+ },

=head1 Author


Modified: perl/embperl/trunk/Embperl/Form/Control/radio.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/radio.pm?view=diff&rev=558530&r1=558529&r2=558530
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/radio.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/radio.pm Sun Jul 22 12:10:14 2007
@@ -72,6 +72,7 @@
$filter ||= $self -> {filter} ;
my $addtop = $self -> {addtop} || [] ;
my $addbottom= $self -> {addbottom} || [] ;
+ my $ignorecase= $self -> {ignorecase} ;
my $max = @$values ;
my $set = !defined ($fdat{$name})?1:0 ;
my $nsprefix = $self -> form -> {jsnamespace} ;
@@ -105,7 +106,8 @@
[$endforeach$]
[$ foreach $val (@$values) $]
[$if !defined ($filter) || ($val =~ /$filter/i) $]
- [.- $fdat{$name} = $val, $set = 0 if ($set) ; -]
+ [.- $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 +]"
[$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 }+]
@@ -175,6 +177,11 @@

If specified arranges the radio button vertically. The number given specifies
the number of <br>'s used the separate the radio buttons.
+
+=head3 ignorecase
+
+If given, ignore the case of the posted values in %fdat, when selecting
+a radio button.

=head3 addtop


Modified: perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm?view=diff&rev=558530&r1=558529&r2=558530
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm Sun Jul 22 12:10:14 2007
@@ -123,7 +123,7 @@
document.getElementById('_inp_[+ $jsname +]')) ;

[+ $jsname +]AutoComp = new [+ $nsprefix +]Ajax.Autocompleter(document.getElementById('_inp_[+ $jsname +]'),document.getElementById('_cont_[+ $jsname +]'),
- '/ebos/datasrc.exml', {paramName: "query", parameters: "datasrc=[+ $self -> {datasrc} +]", frequency: 0.3, afterUpdateElement: [+ $jsname +]savevalue}) ;
+ '/epfctrl/datasrc.exml', {paramName: "query", parameters: "datasrc=[+ $self -> {datasrc} +]", frequency: 0.3, afterUpdateElement: [+ $jsname +]savevalue}) ;
[+ $jsname +]AutoComp.updateChoices ;

</script>

Modified: perl/embperl/trunk/Embperl/Form/Control/tabs.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/tabs.pm?view=diff&rev=558530&r1=558529&r2=558530
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/tabs.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/tabs.pm Sun Jul 22 12:10:14 2007
@@ -124,7 +124,9 @@
}
my $js = join (';', @switch_code) ;
*]
- <td class="cBase [+ $cellclass +]"><div class="cBase [+ $divclass +]" id="__tabs_[+ $id +]">
+ <td class="cBase [+ $cellclass +]"><div class="cBase [+ $divclass +]"
+ [$ if $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 $]

Modified: perl/embperl/trunk/Embperl/Form/ControlMultValue.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/ControlMultValue.pm?view=diff&rev=558530&r1=558529&r2=558530
==============================================================================
--- perl/embperl/trunk/Embperl/Form/ControlMultValue.pm (original)
+++ perl/embperl/trunk/Embperl/Form/ControlMultValue.pm Sun Jul 22 12:10:14 2007
@@ -21,6 +21,8 @@

use base 'Embperl::Form::Control' ;

+use Embperl::Inline ;
+
# ---------------------------------------------------------------------------
#
# init - Init the new control
@@ -89,6 +91,9 @@


1 ;
+
+# damit %fdat etc definiert ist
+__EMBPERL__

__END__




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

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


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.