Author: richter Date: Sun Jan 10 14:48:06 2016 New Revision: 1723932 URL: http://svn.apache.org/viewvc?rev=1723932&view=rev Log: Add Support for checkbox as button
Modified: perl/embperl/trunk/Embperl/Form/Control.pm perl/embperl/trunk/Embperl/Form/Control/checkbox.pm Modified: perl/embperl/trunk/Embperl/Form/Control.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control.pm?rev=1723932&r1=1723931&r2=1723932&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control.pm Sun Jan 10 14:48:06 2016 @@ -680,6 +680,7 @@ sub show_control_readonly_array my $ro = $self -> is_readonly ($req) ; my $addclass = 'ef-control-box-width-' . ($self->{width_percent} || 50 ) ; $addclass .= ' ef-control-box-readonly' if ($ro) ; + $addclass .= ' ' . $self->{controlclass} if ($self->{controlclass}) ; $] <td class="ef-control-box [+ $addclass +]"> [* Modified: perl/embperl/trunk/Embperl/Form/Control/checkbox.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/checkbox.pm?rev=1723932&r1=1723931&r2=1723932&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/checkbox.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/checkbox.pm Sun Jan 10 14:48:06 2016 @@ -126,7 +126,23 @@ sub init_markup $fdat -> {'_opt_' . $name} = $opt if ($opt ne '') ; } } - + +# --------------------------------------------------------------------------- +# +# label_text - return text of label +# + +sub label_text + { + my ($self, $req) = @_ ; + + if ($self -> {button} && !$self -> is_readonly) + { + $self->{controlclass} ||= 'ef-control-checkbox-button' ; + return '' ; + } + return $self -> SUPER::label_text ($req) ; + } 1 ; @@ -166,8 +182,10 @@ $] push @{$self -> form -> {fields2empty}}, $name ; $] <input type="checkbox" name="[+ $ctlname +]" [+ do { local $escmode = 0 ; $ctlattrs } +] value="[+ $val +]" -[$if ($self -> {trigger}) $]_ef_attach="ef_checkbox"[$endif$] -> +[$if ($self -> {trigger} || $self -> {button}) $]_ef_attach="ef_checkbox"[$endif$] +[$if ($self -> {button}) $]_ef_button="1"[$endif$] +[$if (ref $self -> {button}) $]_ef_buttonlabels="[+ join(',', @{$self -> {button}}) +]"[$endif$] +>[$if ($self -> {button}) $]<label for="[+ $ctlid +]"></label>[$endif$] [$endsub$] __END__ --------------------------------------------------------------------- To unsubscribe, e-mail: embperl-cvs-unsubscr...@perl.apache.org For additional commands, e-mail: embperl-cvs-h...@perl.apache.org