239 |
} |
} |
240 |
|
|
241 |
if ( $ip && $ip ne $server::ip ) { |
if ( $ip && $ip ne $server::ip ) { |
|
my $hostname = client::conf( $ip, 'hostname' => $param->{hostname} ); |
|
242 |
|
|
243 |
|
my @editable = ( qw/hostname deploy homepage/ ); |
244 |
|
|
245 |
|
client::conf( $ip, $_ => $param->{$_} ) foreach @editable; |
246 |
|
|
247 |
|
my $conf = client::all_conf( $ip ); |
248 |
|
my $deploy = delete $conf->{deploy}; |
249 |
|
|
250 |
|
my $nmap = qq|<a href=/nmap?scan=$ip>nmap</a>|; |
251 |
my @table = ( |
my @table = ( |
252 |
'ip' => qq|<input type=text name=change_ip value="$ip" onChange="document.getElementById('old_ip').style.display = '';"><span id=old_ip style="display: none; color: #888;">old: $ip<span>|, |
'ip' => qq|<input type=text name=change_ip value="$ip" onChange="document.getElementById('old_ip').style.display = '';"><span id=old_ip style="display: none; color: #888;">old: $ip<span>|, |
253 |
'hostname' => qq|<input type=text name=hostname value="$hostname">|, |
'mac' => format::mac( delete $conf->{mac}, 'html' ), |
254 |
'ping' => ping::host($ip) ? qq|<span style="color:green">up</span>| : qq|<a href=/wol/$ip title=wol>down</a>|, |
'hostname' => qq|<input type=text name=hostname value="| . delete($conf->{hostname}) . qq|">|, |
255 |
|
'ping' => ping::host($ip) ? qq|<span style="color:green">up</span> $nmap| : qq|<span style="color: red">down</span> <a href=/wol/$ip>wol</a> $nmap|, |
256 |
|
'deploy' => html::select( 'deploy', $deploy, config::available ), |
257 |
|
html::conf( $ip, $conf, 'edit', @editable ) |
258 |
); |
); |
259 |
|
|
260 |
my $config; |
warn "XX conf ",dump( $conf ); |
261 |
|
|
262 |
|
my $config = ''; |
263 |
|
|
264 |
if ( my $mac = client::mac_from_ip( $ip ) ) { |
if ( $deploy ) { |
|
my $deploy = client::conf( $ip, 'deploy' => $param->{deploy} ); |
|
|
push @table, ( |
|
|
'mac' => format::mac( $mac => 'html' ), |
|
|
'deploy' => html::select( 'deploy', $deploy, config::available ) |
|
|
); |
|
265 |
if ( $config = config::for_ip( $ip ) ) { |
if ( $config = config::for_ip( $ip ) ) { |
266 |
$config = qq|<h2>config</h2>| . html::pre( $config ); |
$config = qq|<h2>config</h2>| . html::pre( $config ); |
267 |
} |
} |
295 |
|
|
296 |
print $client ok |
print $client ok |
297 |
, qq|<h2>Clients on $server::ip</h2>| |
, qq|<h2>Clients on $server::ip</h2>| |
298 |
, html::table( -6, |
, html::table( -5, |
299 |
'ip', 'mac', 'dev', 'hostname', 'deploy', 'conf', |
'ip', 'mac', 'dev', 'hostname', 'conf', |
300 |
map { |
map { |
301 |
my $ip = $_; |
my $ip = $_; |
302 |
my $conf = client::all_conf( $ip ); |
my $conf = client::all_conf( $ip ); |
313 |
, format::mac( $mac => 'html' ) |
, format::mac( $mac => 'html' ) |
314 |
, $arp->{$mac} |
, $arp->{$mac} |
315 |
, delete $conf->{hostname} |
, delete $conf->{hostname} |
316 |
, delete $conf->{deploy} |
, html::conf( $ip, $conf, 'inline' ) |
317 |
, ( %$conf ? html::pre_dump( $conf ) : qq|<a href=/nmap?scan=$ip>nmap</a>| ) |
) |
|
); |
|
318 |
} client::all_ips |
} client::all_ips |
319 |
) |
) |
320 |
; |
; |