Changeset 324


Ignore:
Timestamp:
Oct 31, 2017, 1:29:33 PM (6 years ago)
Author:
g7moreau
Message:
  • Update with Table ip free and homogeneous html table
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r323 r324  
    26002600   my %result_ip = @_;
    26012601
    2602    printf "%-15s %-40s %-16s %s\n", qw(IPv4-Address Hostname-FQ Date VLAN);
    2603    print "-------------------------------------------------------------------------------\n";
     2602   my $tb_computer = Text::Table->new(
     2603      {align => 'left', align_title => 'left', title => 'IPv4-Address'},
     2604      {align => 'left', align_title => 'left', title => 'Hostname-FQ'},
     2605      {align => 'left', align_title => 'left', title => 'VLAN'},
     2606      {align => 'left', align_title => 'left', title => 'Date'},
     2607      );
     2608
     2609   #printf "%-15s %-40s %-16s %s\n", qw(IPv4-Address Hostname-FQ Date VLAN);
     2610   #print "-------------------------------------------------------------------------------\n";
    26042611   LOOP_ON_IP_ADDRESS:
    26052612   for my $ip (Net::Netmask::sort_by_ip_address(keys %result_ip)) {
    2606          my $vlan_nameid = $result_ip{$ip}->{'vlan'}.'('.get_current_vlan_id($result_ip{$ip}->{'vlan'}).')';
    2607          printf "%-15s %-40s %-16s %s\n", $ip, $result_ip{$ip}->{'hostname_fq'}, $result_ip{$ip}->{'date_last_detection'}, $vlan_nameid;
    2608       }
     2613      my $vlan_nameid = $result_ip{$ip}->{'vlan'}.'('.get_current_vlan_id($result_ip{$ip}->{'vlan'}).')';
     2614      #printf "%-15s %-40s %-16s %s\n", $ip, $result_ip{$ip}->{'hostname_fq'}, $result_ip{$ip}->{'date_last_detection'}, $vlan_nameid;
     2615      $tb_computer->add(
     2616         $ip,
     2617         $result_ip{$ip}->{'hostname_fq'},
     2618         $vlan_nameid,
     2619         $result_ip{$ip}->{'date_last_detection'},
     2620         ;
     2621      }
     2622   print $tb_computer->title();
     2623   print $tb_computer->rule('-');
     2624   print $tb_computer->body();
    26092625   }
    26102626
     
    26182634 <thead>
    26192635  <tr>
    2620    <th scope="col" class="klask-header-left">IPv4-Address</th>
    2621    <th scope="col" class="sorttable_alpha">Hostname-FQ</th>
    2622    <th scope="col" class="sorttable_alpha">VLAN</th>
    2623    <th scope="col" class="klask-header-right">Date</th>
     2636   <th scope="col" class="klask-header-left">IPv4-Address &#8645</th>
     2637   <th scope="col" class="sorttable_alpha">Hostname-FQ &#8645</th>
     2638   <th scope="col" class="sorttable_alpha">VLAN &#8645</th>
     2639   <th scope="col" class="klask-header-right">Date &#8645</th>
    26242640  </tr>
    26252641 </thead>
     
    26452661      my ( $host_short ) = split m/ \. /xms, $result_ip{$ip}->{'hostname_fq'};
    26462662
    2647       my $vlan_nameid = $result_ip{$ip}->{'vlan'}.'('.get_current_vlan_id($result_ip{$ip}->{'vlan'}).')';
     2663      my $vlan_nameid = $result_ip{$ip}->{'vlan'}.' ('.get_current_vlan_id($result_ip{$ip}->{'vlan'}).')';
     2664
     2665      fqdn_html_breakable(my $hostname_fq_html = $result_ip{$ip}->{'hostname_fq'});
    26482666
    26492667      print <<"END_HTML";
    26502668  <tr class="$typerow">
    26512669   <td sorttable_customkey="$ip_sort">$ip</td>
    2652    <td sorttable_customkey="$host_short">$result_ip{$ip}->{'hostname_fq'}</td>
     2670   <td sorttable_customkey="$host_short">$hostname_fq_html</td>
    26532671   <td>$vlan_nameid</td>
    26542672   <td>$result_ip{$ip}->{'date_last_detection'}</td>
Note: See TracChangeset for help on using the changeset viewer.