Author: richter Date: Wed Oct 1 05:48:28 2014 New Revision: 1628605 URL: http://svn.apache.org/r1628605 Log: get_display_text for duration
Modified: perl/embperl/trunk/Embperl/Form/Control/duration.pm Modified: perl/embperl/trunk/Embperl/Form/Control/duration.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/duration.pm?rev=1628605&r1=1628604&r2=1628605&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/duration.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/duration.pm Wed Oct 1 05:48:28 2014 @@ -34,23 +34,20 @@ sub init { my ($self) = @_ ; - $self->{unit} ||= '' ; + $self->{unit} ||= 'hh:mm' ; return $self ; } # ------------------------------------------------------------------------------------------ # -# init_data - daten aufteilen +# get_display_text - returns the text that should be displayed # -sub init_data +sub get_display_text { - my ($self, $req, $parentctrl) = @_ ; + my ($self, $req, $val) = @_ ; - my $fdat = $req -> {docdata} || \%fdat ; - my $name = $self->{name} ; - my $val = $fdat->{$name} ; return if ($val eq '') ; my $aval = abs ($val) ; @@ -63,7 +60,41 @@ sub init_data { $duration .= sprintf (':%02d', $sec) ; } - $fdat->{$name} = $duration ; + + return $duration ; + } + +# ------------------------------------------------------------------------------------------ +# +# init_data - daten aufteilen +# + +sub init_data + { + my ($self, $req, $parentctrl, $force) = @_ ; + + my $fdat = $req -> {docdata} || \%fdat ; + my $name = $self->{name} ; + my $time = $fdat->{$name} ; + return if ($time eq '' || ($req -> {"ef_duration_init_done_$name"} && !$force)) ; + + $fdat->{$name} = $self -> get_display_text ($req, $time) ; + $req -> {"ef_duration_init_done_$name"} = 1 ; + } + +# --------------------------------------------------------------------------- +# +# init_markup - add any dynamic markup to the form data +# + +sub init_markup + + { + my ($self, $req, $parentctl, $method) = @_ ; + + return if (!$self -> is_readonly($req) && (! $parentctl || ! $parentctl -> is_readonly($req))) ; + + return $self -> init_data ($req, $parentctl) ; } # ------------------------------------------------------------------------------------------ --------------------------------------------------------------------- To unsubscribe, e-mail: embperl-cvs-unsubscr...@perl.apache.org For additional commands, e-mail: embperl-cvs-h...@perl.apache.org