/[pxelator]/lib/PXElator/html.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/PXElator/html.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 315 by dpavlin, Thu Aug 27 19:58:18 2009 UTC revision 354 by dpavlin, Sat Aug 29 22:10:55 2009 UTC
# Line 66  sub pre_dump { Line 66  sub pre_dump {
66          qq|<pre>$dump</pre>|;          qq|<pre>$dump</pre>|;
67  }  }
68    
69    sub conf {
70            my ($ip,$conf,$format) = @_;
71            my @editable = splice(@_,3);
72    
73            warn "# conf ",dump( $ip, $conf, $format, [ @editable ] );
74    
75            $format ||= 'inline';
76    
77            my @opts = map {
78                    my $name = $_;
79                    my $html = $conf->{$name};
80    
81                    if ( $format eq 'edit' && grep { m/^$name$/ } @editable ) {
82                            $size = length($html);
83                            ( $name, qq|<input name=$name value="$html" size=$size>| )
84                    } else {
85                            if ( $name eq 'amt' ) {
86                                    $html = qq|<a title="$html" href=http://$ip:16992/logon.htm>logon</a>|;
87                            } elsif ( $name eq 'ssh' ) {
88                                    $html =~ s{\s(\S{16}).+(\S{16})\s}{ $1..$2 };
89                            }
90                            $html = qq|<pre style="display: inline">$html</pre>|
91                            unless
92                            $html =~ s{\b(\S+)\t(\S+)\t(\S+)\b}{<b title="$1/$2">$3</b> }gs;
93                    
94                            if ( $format =~ /edit|table/ ) {
95                                    ( $name, $html );
96                            } else {
97                                    qq|<em>$name</em> $html<br>|
98                            }
99                    }
100            } keys %$conf;
101    
102            $format eq 'inline' ? join("\n", @opts) : @opts;
103    }
104    
105  warn "loaded";  warn "loaded";
106    
107  1;  1;

Legend:
Removed from v.315  
changed lines
  Added in v.354

  ViewVC Help
Powered by ViewVC 1.1.26