Author: richter Date: Tue Apr 17 04:41:39 2012 New Revision: 1326924 URL: http://svn.apache.org/viewvc?rev=1326924&view=rev Log: trigger option for select
Added: perl/embperl/trunk/Embperl/Form/Control/passwordonce.pm (with props) Modified: perl/embperl/trunk/Embperl/Form/Control.pm perl/embperl/trunk/Embperl/Form/Control/checkbox.pm perl/embperl/trunk/Embperl/Form/Control/select.pm Modified: perl/embperl/trunk/Embperl/Form/Control.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control.pm?rev=1326924&r1=1326923&r2=1326924&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control.pm Tue Apr 17 04:41:39 2012 @@ -60,7 +60,7 @@ sub init } $self -> {eventattrs} = $eventattrs ; $self -> {imagedir} ||= '/images' ; - + return $self ; } @@ -290,14 +290,15 @@ sub get_std_control_attr my ($self, $req, $id, $type, $addclass) = @_ ; my $name = $self -> {force_name} || $self -> {name} ; - my $ctrlid = $id || $name ; + my $ctrlid = $id || ($req -> {uuid} . '_' . $name) ; my $class = $self -> {class} ; my $width = $self -> {width_percent} ; my $events = $self -> {eventattrs} ; $type ||= $self -> {type} ; my $state = $self -> {state} ; - return qq{class="ef-control ef-control-width-$width ef-control-$type ef-control-$type-width-$width $addclass $class $state" id="$ctrlid" $events} ; + my $attrs = qq{class="ef-control ef-control-width-$width ef-control-$type ef-control-$type-width-$width $addclass $class $state" id="$ctrlid" $events} ; + return wantarray?($attrs, $ctrlid, $name):$attrs ; } Modified: perl/embperl/trunk/Embperl/Form/Control/checkbox.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/checkbox.pm?rev=1326924&r1=1326923&r2=1326924&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/checkbox.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/checkbox.pm Tue Apr 17 04:41:39 2012 @@ -87,11 +87,12 @@ __EMBPERL__ $val =~ s/%%%name%%%/$fdat{$name}/g ; $val =~ s/%%(.+?)%%/$fdat{$1}/g ; + my ($ctlattrs, $ctlid, $ctlname) = $self -> get_std_control_attr($req) ; push @{$self -> form -> {fields2empty}}, $name ; $] -<input type="checkbox" name="[+ $self -> {force_name} || $self -> {name} +]" [+ do { local $escmode = 0 ; $self -> get_std_control_attr($req) } +] value="[+ $val +]" +<input type="checkbox" name="[+ $ctlname +]" [+ do { local $escmode = 0 ; $ctlattrs } +] value="[+ $val +]" [$if ($self -> {sublines} || $self -> {subobjects}) $] OnClick="[+ $nsprefix +]show_checked(document, this)" [$endif$] ->[$if ($self -> {trigger}) $]<script >$('#[+ $self -> {name} +]').ef_checkbox ()</script>[$endif$] +>[$if ($self -> {trigger}) $]<script >$('#[+ $ctlid +]').ef_checkbox ()</script>[$endif$] [$endsub$] __END__ Added: perl/embperl/trunk/Embperl/Form/Control/passwordonce.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/passwordonce.pm?rev=1326924&view=auto ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/passwordonce.pm (added) +++ perl/embperl/trunk/Embperl/Form/Control/passwordonce.pm Tue Apr 17 04:41:39 2012 @@ -0,0 +1,104 @@ + +################################################################################### +# +# 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::passwordonce ; + +use strict ; +use base 'Embperl::Form::Control' ; + +use Embperl::Inline ; + +1 ; + +__EMBPERL__ + +[# --------------------------------------------------------------------------- +# +# show_control - output the control +#] + +[$ sub show_control ($self) $] + +<input type="[+ $fdat{$self->{name}}?'password':'text' +]" class="cBase cControl cControlWidthInput" name="[+ $self->{name} +]" +[$if $self -> {size} $]size="[+ $self->{size} +]"[$endif$] +[$if $self -> {maxlength} $]size="[+ $self->{maxlength} +]"[$endif$] +> +[$endsub$] + + +[# --------------------------------------------------------------------------- +# +# show_control_readonly - output the control as readonly +#] + +[$ sub show_control_readonly ($self) $]*****[$endsub$] + + + +__END__ + +=pod + +=head1 NAME + +Embperl::Form::Control::password - A password input control inside an Embperl Form + + +=head1 SYNOPSIS + + { + type => 'password', + text => 'blabla', + name => 'foo', + size => 10, + } + +=head1 DESCRIPTION + +Used to create a password control inside an Embperl Form. +See Embperl::Form on how to specify parameters. + +=head2 PARAMETER + +=head3 type + +Needs to be 'password' + +=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 maximun length in characters + +=head1 Author + +G. Richter (rich...@dev.ecos.de) + +=head1 See Also + +perl(1), Embperl, Embperl::Form + + Propchange: perl/embperl/trunk/Embperl/Form/Control/passwordonce.pm ------------------------------------------------------------------------------ svn:executable = * Modified: perl/embperl/trunk/Embperl/Form/Control/select.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/select.pm?rev=1326924&r1=1326923&r2=1326924&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/select.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/select.pm Tue Apr 17 04:41:39 2012 @@ -50,9 +50,10 @@ __EMBPERL__ my $val ; my $i = 0 ; my ($values, $options) = $self -> get_all_values ($req) ; + my ($ctlattrs, $ctlid, $ctlname) = $self -> get_std_control_attr($req) ; $] -<select name="[+ $self -> {force_name} || $self -> {name} +]" [+ $self->{multiple}?'multiple':''+] [+ do { local $escmode = 0 ; $self -> get_std_control_attr($req) } +] +<select name="[+ $ctlname +]" [+ $self->{multiple}?'multiple':''+] [+ do { local $escmode = 0 ; $ctlattrs } +] [$if ($self -> {sublines} || $self -> {subobjects}) $] OnChange="[+ $nsprefix +]show_selected(document, this)" [$endif$] [$if ($self -> {rows}) $] size="[+ $self->{rows} +]" [$endif$] > @@ -64,7 +65,7 @@ $] [* $i++ ; *] [$endforeach$] </select> - +[$if ($self -> {trigger}) $]<script >$('#[+ $ctlid +]').ef_select ()</script>[$endif$] [$endsub$] __END__ --------------------------------------------------------------------- To unsubscribe, e-mail: embperl-cvs-unsubscr...@perl.apache.org For additional commands, e-mail: embperl-cvs-h...@perl.apache.org