################################################################################### # # Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh www.ecos.de # Embperl - Copyright (c) 2008-2014 Gerald Richter # # 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::display ; use strict ; use base 'Embperl::Form::Control' ; use Embperl::Inline ; use vars qw{%fdat} ; # ------------------------------------------------------------------------------------------ # # init_data - daten aufteilen # sub init_data { my ($self, $req, $parentctrl) = @_ ; return if (!$self -> {value2text}) ; my $fdat = $req -> {docdata} || \%fdat ; my $name = $self->{name} ; my $value = $fdat->{$name} ; my $val ; my $txt ; if (ref $value eq 'ARRAY') { foreach (@$value) { $val = $self -> {value2text} . $_ ; $txt = $self -> form -> convert_text ($self, $val, undef, $req) ; $_ = $txt if ($txt ne $val) ; } } else { $val = $self -> {value2text} . $value ; $txt = $self -> form -> convert_text ($self, $val, undef, $req) ; $fdat->{$name} = $txt if ($txt ne $val) ; } } # ------------------------------------------------------------------------------------------ sub show_control_readonly { $_[0] -> show_control ($_[1], $_[2]) } 1 ; __EMBPERL__ [# --------------------------------------------------------------------------- # # show_control - output the control #] [$ sub show_control ($self, $req, $value) my $name = $self->{name}; my $id = $self->{id}; $value = exists $self->{value} ? $self->{value} : $fdat{$name} if (!defined ($value)) ; $value = [ split /\t/, $value ] if $self->{split}; $value = [ split /\n/, $value ] if $self->{splitlines}; $]