blib/lib/Embperl/Form/Control/radio.pm untested

filter: Statementstmt 0.0% 0 / 54 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 75 CC 1 SCAR 6.9
CC
1
Cov
0%
show_control_addons
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1  
2 ###################################################################################
3 #
4 # Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh www.ecos.de
5 # Embperl - Copyright (c) 2008-2015 Gerald Richter
6 # Embperl - Copyright (c) 2015-2023 actevy.io
7 #
8 # You may distribute under the terms of either the GNU General Public
9 # License or the Artistic License, as specified in the Perl README file.
10 #
11 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
12 # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
13 # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 #
15 # $Id$
16 #
17 ###################################################################################
18  
19 package Embperl::Form::Control::radio ;
20  
21 use strict ;
22 use vars qw{%fdat} ;
23 use base 'Embperl::Form::ControlMultValue' ;
24  
25 use Embperl::Inline ;
26  
27  
28 # ---------------------------------------------------------------------------
29  
30 sub show_control_addons
31 {
32 my ($self, $req) = @_ ;
33  
34 }
35  
36 1 ;
37  
38 __EMBPERL__
39  
40 [# ---------------------------------------------------------------------------
41 #
42 # show_control - output the control
43 #]
44  
45 [$ sub show_control ($self, $req, $filter, $values, $options)
46  
47 ($values, $options) = $self -> get_values ($req) if (!$values) ;
48 my $name = $self -> {name} ;
49 my $ignorecase= $self -> {ignorecase} ;
50 my $max = @$values ;
51 my $set = !defined ($fdat{$name})?1:0 ;
52 my $nsprefix = $self -> form -> {jsnamespace} ;
53 my $ctrlid = ($req -> {uuid} . '_' . $name) ;
54 my $val ;
55 my $i = 0 ;
56  
57 if ($self -> {vert})
58 {
59 $tr = '<tr>' ;
60 $trend = '</tr>' ;
61 $trglob = '' ;
62 $trendglob = '' ;
63 }
64 else
65 {
66 $tr = '' ;
67 $trend = '' ;
68 $trglob = '<tr>' ;
69 $trendglob = '</tr>' ;
70 }
71  
72 $]
73 <table class="ef-control-radiotab [+ $self -> {state} +]"
74 [$if ($self -> {trigger}) $]_ef_attach="ef_radio" name="[+ $self -> {force_name} || $self -> {name} +]"[$endif$]
75 >[+ do { local $escmode = 0 ; $trglob }+]
76 [$ foreach $val (@$values) $][- $x = ($val =~ /$filter/i) -]
77 [- $fdat{$name} = $val, $set = 0 if ($set) ;
78 $fdat{$name} = $val if ($ignorecase && lc($fdat{$name}) eq lc($val)) ; -]
79 [+ do { local $escmode = 0 ; $tr }+]<td><input type="radio" name="[+ $self -> {force_name} || $self -> {name} +]" [+ do { local $escmode = 0 ; $self -> get_std_control_attr($req, "$ctlid-_-$val") } +] value="[+ $val +]"
80 ></td><td>[+ $options ->[$i] || $val +]</td>[+ do { local $escmode = 0 ; $trend }+]
81 [* $i++ ; *]
82 [$endforeach$]
83 [+ do { local $escmode = 0 ; $trendglob }+]</table>
84 [$endsub$]
85  
86  
87  
88 __END__