svn commit: r1723932 - in /perl/embperl/trunk/Embperl/Form: Control.pm Control/checkbox.pm
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}) ; $] [* 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 ; $] {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}) $][$endif$] [$endsub$] __END__ - To unsubscribe, e-mail: embperl-cvs-unsubscr...@perl.apache.org For additional commands, e-mail: embperl-cvs-h...@perl.apache.org
svn commit: r1723933 - in /perl/embperl/trunk/Embperl/Form: Control/selectdyn.pm ControlMultValue.pm DataSource.pm
Author: richter Date: Sun Jan 10 14:49:03 2016 New Revision: 1723933 URL: http://svn.apache.org/viewvc?rev=1723933&view=rev Log: Add support for replacing the databasename in the url Modified: perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm perl/embperl/trunk/Embperl/Form/ControlMultValue.pm perl/embperl/trunk/Embperl/Form/DataSource.pm Modified: perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm?rev=1723933&r1=1723932&r2=1723933&view=diff == --- perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm Sun Jan 10 14:49:03 2016 @@ -146,6 +146,7 @@ if ($datasrc) $datasrc .= $self -> add_query_param ($req, $datasource) ; ($self -> {url_from}, $self -> {url_to}) = $datasource -> get_url_modifier ($req, $self) ; +$self -> {dbname} = $datasource -> get_dbname ($req, $self) ; } } @@ -174,6 +175,7 @@ type="text" _ef_attach="ef_selectdyn" [$if $self -> {datasrcurl} $]_ef_datasrc_url="[+ $self -> {datasrcurl} +]" [$endif$] [$if $self -> {url_from}$]_ef_url_from="[+ $self -> {url_from} +]" [$endif$] [$if $self -> {url_to} $]_ef_url_to="[+ $self -> {url_to} +]" [$endif$] +[$if $self -> {dbname} $][+ '_ef_dbname' +]="[+ $self -> {dbname} +]" [$endif$] [$if $append$]_ef_datasrc_url_append="[+ $append +]" [$endif$] [$if $datasrc $]_ef_datasrc_nam="[+ $datasrc +]" [$endif$] [$if $self -> {datasrctermmax} $]_ef_datasrc_term_max="[+ $self -> {datasrctermmax} +]" [$endif$] Modified: perl/embperl/trunk/Embperl/Form/ControlMultValue.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/ControlMultValue.pm?rev=1723933&r1=1723932&r2=1723933&view=diff == --- perl/embperl/trunk/Embperl/Form/ControlMultValue.pm (original) +++ perl/embperl/trunk/Embperl/Form/ControlMultValue.pm Sun Jan 10 14:49:03 2016 @@ -222,6 +222,25 @@ sub get_id_from_value # --- # +# get_dbname - returns dbname to pass to control (selectdyn) +# +# in $reqrequest data +# ret $dbname if any +# + +sub get_dbname + +{ +my ($self, $req, $ctrl) = @_ ; + +return if (!$self -> {datasrcobj}) ; + +return $self -> {datasrcobj} -> get_dbname ($req, $self) ; +} + + +# --- +# # get_option_form_value - returns the option for a given value # # in $value value Modified: perl/embperl/trunk/Embperl/Form/DataSource.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/DataSource.pm?rev=1723933&r1=1723932&r2=1723933&view=diff == --- perl/embperl/trunk/Embperl/Form/DataSource.pm (original) +++ perl/embperl/trunk/Embperl/Form/DataSource.pm Sun Jan 10 14:49:03 2016 @@ -112,6 +112,23 @@ sub get_url_modifier return ; } +# --- +# +# get_dbname - returns dbname to pass to control (selectdyn) +# +# in $reqrequest data +# $ctrl control that will display the value +# ret $dbname if any +# + +sub get_dbname + +{ +my ($self, $req, $ctrl) = @_ ; + +return ; +} + # --- # # sorttype - returns information how to sort this datasource values for displaying - To unsubscribe, e-mail: embperl-cvs-unsubscr...@perl.apache.org For additional commands, e-mail: embperl-cvs-h...@perl.apache.org
svn commit: r1723934 - /perl/embperl/trunk/Embperl/Form.pm
Author: richter Date: Sun Jan 10 14:49:24 2016 New Revision: 1723934 URL: http://svn.apache.org/viewvc?rev=1723934&view=rev Log: Fix circular references Modified: perl/embperl/trunk/Embperl/Form.pm Modified: perl/embperl/trunk/Embperl/Form.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form.pm?rev=1723934&r1=1723933&r2=1723934&view=diff == --- perl/embperl/trunk/Embperl/Form.pm (original) +++ perl/embperl/trunk/Embperl/Form.pm Sun Jan 10 14:49:24 2016 @@ -101,8 +101,11 @@ sub sub_new $self -> {code_refs}= $self -> parent_form -> {code_refs} ; $self -> {do_validate} = $self -> parent_form -> {do_validate} ; } -push @{$self -> {code_refs}}, $self if ($self -> has_code_refs) ; - +if ($self -> has_code_refs) +{ +push @{$self -> {code_refs}}, $self ; +weaken ($self -> {code_refs}[-1]) ; +} $self -> new_controls ($controls, $options, undef, $id, $options -> {masks}, $options -> {defaults}) ; $self -> {noframe} = 1 if ($controls && @$controls > 0 && @@ -312,11 +315,31 @@ sub new_controls $control = $self -> new_object ($packages, $type, $control) ; if (!$no_init) { -push @{$self -> {init_data}}, $control if ($control -> can ('init_data')) ; -push @{$self -> {init_markup}}, $control if ($control -> can ('init_markup')) ; -push @{$self -> {prepare_fdat}}, $control if ($control -> can ('prepare_fdat')) ; -push @{$self -> {code_refs}}, $control if ($control -> has_code_refs) ; -push @{$self -> {do_validate}}, $control if ($control -> has_validate_rules) ; +if ($control -> can ('init_data')) +{ +push @{$self -> {init_data}}, $control ; +weaken ($self -> {init_data}[-1]) ; +} +if ($control -> can ('init_markup')) +{ +push @{$self -> {init_markup}}, $control ; +weaken ($self -> {init_markup}[-1]) ; +} +if ($control -> can ('prepare_fdat')) +{ +push @{$self -> {prepare_fdat}}, $control ; +weaken ($self -> {prepare_fdat}[-1]) ; +} +if ($control -> has_code_refs) +{ +push @{$self -> {code_refs}}, $control ; +weaken ($self -> {code_refs}[-1]) ; +} +if ($control -> has_code_refs) +{ +push @{$self -> {do_validate}}, $control ; +weaken ($self -> {do_validate}[-1]) ; +} push @{$self -> {constrain_attrs}}, $control -> constrain_attrs ; } } @@ -354,7 +377,8 @@ sub new_controls local $options -> {disable} = $control -> {disables}[$i] ; my $subform = $class -> sub_new ($subcontrols, $options, $ctlid, 0, $self -> {formptr}) ; $subform -> {text} ||= $control -> {options}[$i] if (exists ($control -> {options}) && $control -> {options}[$i]) ; -$subform -> {parent_control} = $control ; +$subform -> {parent_control} = $control ; +weaken ($subform -> {parent_control}) ; push @ids, $ctlid ; push @obj, $subform ; $i++ ; - To unsubscribe, e-mail: embperl-cvs-unsubscr...@perl.apache.org For additional commands, e-mail: embperl-cvs-h...@perl.apache.org