/[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 361 by dpavlin, Sun Aug 30 10:37:07 2009 UTC revision 404 by dpavlin, Tue Sep 8 20:45:24 2009 UTC
# Line 1  Line 1 
1  package html;  package html;
2    
3  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
4    use amt;
5    
6  sub table {  sub table {
7          my $cols = shift;          my $cols = shift;
# Line 50  sub select { Line 51  sub select {
51                  , qq|<select type=select name=$name>|                  , qq|<select type=select name=$name>|
52                  , join("\n", map { my $selected = $_ eq $selected_option ? 'selected' : ''; qq|<option name=$_ $selected>$_</option>| } @_ )                  , join("\n", map { my $selected = $_ eq $selected_option ? 'selected' : ''; qq|<option name=$_ $selected>$_</option>| } @_ )
53                  , qq|</select>|                  , qq|</select>|
                 , qq|</form>|  
54          );          );
55  }  }
56    
# Line 83  sub conf { Line 83  sub conf {
83                          ( $name, qq|<input name=$name value="$html" size=$size>| )                          ( $name, qq|<input name=$name value="$html" size=$size>| )
84                  } else {                  } else {
85                          if ( $name eq 'amt' ) {                          if ( $name eq 'amt' ) {
86                                  $html = qq|<a title="$html" href=http://$ip:16992/logon.htm>logon</a>|;                                  my $amt_ip = amt::ip($ip,$html);
87                                    $html = qq|<a title="$html" href=http://$amt_ip:16992/logon.htm target=$amt_ip>$amt_ip</a>|;
88    
89                                    if ( $format ne 'inline' ) {
90                                            my $power = amt::power_on($ip);
91                                            $html .= qq| power: |
92                                            . ( $power
93                                                    ? qq|<a href=/amt/PowerDown/$ip title="turn off">on</a>|
94                                                    : qq|<a href=/amt/PowerUp/$ip   title="turn on" >off</a>|
95                                            );
96                                            client::conf( $ip, 'power' => $power ? 'on' : 'off' );
97                                    }
98                          } elsif ( $name eq 'ssh' ) {                          } elsif ( $name eq 'ssh' ) {
99                                  $html =~ s{\s(\S{16}).+(\S{16})\s}{ $1..$2 };                                  $html =~ s{\s(\S{16}).+(\S{16})\s}{ $1..$2 };
100                                  chomp($html);                                  chomp($html);
101                            } elsif ( $name eq 'kvm' ) {
102                                    $html = qq|<a href="/start_stop/kvm?nr=$html">$html</a>|;
103                          }                          }
104                          $html = qq|<pre style="display: inline">$html</pre>|                          $html = qq|<tt>$html</tt>|
105                          unless                          unless
106                          $html =~ s{\b(\S+)\t(\S+)\t(\S+)\b}{<b title="$1/$2">$3</b> }gs;                          $html =~ s{\b(\S+)\t(\S+)\t(\S+)\b}{<b title="$1/$2">$3</b> }gs;
107                                    
108                          if ( $format =~ /edit|table/ ) {                          if ( $format =~ /edit|table/ ) {
109                                  ( $name, $html );                                  ( $name, $html );
110                          } else {                          } else {
111                                  qq|<em>$name</em> $html<br>|                                  qq|<div class="config $name"><em>$name</em> $html</div>|
112                          }                          }
113                  }                  }
114          } keys %$conf;          } grep { length($conf->{$_}) > 0 } sort keys %$conf;
115    
116          $format eq 'inline' ? join("\n", @opts) : @opts;          $format eq 'inline' ? join("\n", @opts) : @opts;
117  }  }

Legend:
Removed from v.361  
changed lines
  Added in v.404

  ViewVC Help
Powered by ViewVC 1.1.26