File Coverage

blib/lib/Wizard/Form/HTML.pm
Criterion Covered Total %
statement 6 42 14.2
branch 0 12 0.0
condition 0 13 0.0
subroutine 2 7 28.5
pod 0 5 0.0
total 8 79 10.1


line stmt bran cond sub pod time code
1             # -*- perl -*-
2             #
3             #
4             # Wizard - A Perl package for implementing system administration
5             # applications in the style of Windows wizards.
6             #
7             #
8             # This module is
9             #
10             # Copyright (C) 1999 Jochen Wiedmann
11             # Am Eisteich 9
12             # 72555 Metzingen
13             # Germany
14             #
15             # Email: joe@ispsoft.de
16             # Phone: +49 7123 14887
17             #
18             # and Amarendran R. Subramanian
19             # Grundstr. 32
20             # 72810 Gomaringen
21             # Germany
22             #
23             # Email: amar@ispsoft.de
24             # Phone: +49 7072 920696
25             #
26             # All Rights Reserved.
27             #
28             # You may distribute under the terms of either the GNU General Public
29             # License or the Artistic License, as specified in the Perl README file.
30             #
31              
32 1     1   5 use strict;
  1         2  
  1         27  
33              
34 1     1   610 use Wizard::Form ();
  1         3  
  1         469  
35              
36             package Wizard::Form::HTML;
37              
38             @Wizard::Form::HTML::ISA = qw(Wizard::Form);
39              
40             sub Display {
41 0     0 0   my($self, $wiz, $state) = @_;
42 0           $self->ResetHTML();
43 0           $self->AddHTML('');
44 0           my $table_finished=0;
45 0           $self->{'objects'} = {};
46 0           $wiz->{'ep'}->{'_ep_wizard_form'} = $self;
47 0           foreach my $elem (@{$self->{'elems'}}) {
  0            
48 0 0 0       if((ref($elem) =~ /Submit\:\:/) && (!($table_finished))) {
49 0           $table_finished = 1;
50 0           $self->AddHTML('
') ;
51             }
52 0           $elem->Display($wiz, $self, $state);
53             }
54             }
55              
56 0   0 0 0   sub ResetHTML { shift->{'html-' . (shift || 'body')} = '';};
57              
58             sub HelpUrl {
59 0     0 0   my $self = shift;
60 0 0         $self->{'help_url'} = shift if @_;
61 0           $self->{'help_url'};
62             }
63              
64             sub AddHTML {
65 0     0 0   my $self = shift; my $htmlout = shift;
  0            
66 0   0       my $part = shift || 'body';
67 0           $self->{'html-' . $part} .= "$htmlout\n";
68             }
69              
70             sub object {
71 0     0 0   my $self = shift; my $o = $self->{'objects'};
  0            
72 0           my $name = shift;
73 0 0 0       return (keys %$o) if wantarray && !$name;
74 0 0         if(@_) {
75 0           my $obj = shift;
76 0   0       $name ||= $obj->{'name'};
77 0 0         unless($name) {
78 0           my $pre = ref($obj); my $num = 0;
  0            
79 0 0         $pre = $2 if($pre =~ /^([^\:]+\:\:)*([^\:]+)\:\:HTML$/);
80 0           while(exists($o->{$pre. '_' . (++$num)})) {};
81 0           $name = $pre . '_' . $num;
82 0           $obj->{'name'} = $name;
83             }
84 0           $o->{$name} = $obj;
85             }
86 0           $o->{$name};
87             }
88              
89              
90