/[smecontribs]/rpms/smeserver-dhcpmanager/contribs10/smeserver-dhcpmanager-2.0.4-Yet-more-changes-for-SM2-panels.patch
ViewVC logotype

Diff of /rpms/smeserver-dhcpmanager/contribs10/smeserver-dhcpmanager-2.0.4-Yet-more-changes-for-SM2-panels.patch

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

Revision 1.1 by brianr, Sat Dec 30 15:47:19 2023 UTC Revision 1.6 by brianr, Sun Jan 21 16:59:03 2024 UTC
# Line 1  Line 1 
1  diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm  diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm
2  --- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm     2023-12-19 09:44:56.678590486 +0000  --- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm     2023-12-19 09:44:56.678590486 +0000
3  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm 2023-12-30 15:31:00.000000000 +0000  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm 2024-01-21 16:53:00.000000000 +0000
4  @@ -117,22 +117,41 @@  @@ -140,12 +140,12 @@
5            my $c = shift;
6         my $title = $c->l("dhcpd_SCANNING_NETWORK_TITLE");
7         my $modul = '';
8    -    my $trt   = "NETSCAN";
9    +    my $trt   = "SCAN";
10         $dhcp_data{trt} = $trt;
11         $dhcp_data{"first"} = '';
12    -       # ..... get scan results into dhcp_data
13    -       dhcp_data{"scanresults"} = get_scan_results($c);
14    -    $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data );
15    +       # ..... get scan results into stash for passing to html template
16    +       my $dhcp_scanresults = get_scan_results($c);
17    +    $c->stash( title => $title, modul => $modul, "dhcp_data" => \%dhcp_data, "scanresults" => $dhcp_scanresults);
18       $c->render( template => 'dhcpd' );       $c->render( template => 'dhcpd' );
19   }         }
20      
21    @@ -332,10 +332,10 @@
22            my $c = shift;
23         my $ret = delete_all_leases($c);
24            if ($ret == 'ok') {
25    -               dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";
26    +               $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";
27                    do_leases($c);
28            }      
29    -       else {dhcp_data{"error"}=$ret;}
30    +       else {$dhcp_data{"error"}=$ret;}
31         return ;
32     }
33    
34  -  @@ -352,17 +352,17 @@
35  -sub do_winpopup {       # else return "ok"
36  -       #       my $ret = delete_lease($c);
37  -       # call to win pop up          if ($ret == 'ok') {
38  -       #  -               dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";
39  +sub netmask2cidr {  +               $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";
40                    do_leases($c);
41            }      
42    -       else {dhcp_data{"error"}=$ret;}
43    +       else {$dhcp_data{"error"}=$ret;}
44         return ;
45     }
46    
47     sub get_scan_results {
48          my $c = shift;          my $c = shift;
49  -    my $title = $c->l("dhcpd_GLOBAL_WINPOPUP");          #...do it
50  -    my $modul = '';  -       return "results";
51  -    my $trt   = "WINPOPUP";  +       return Scan_Local_Network($c);
52  -    $dhcp_data{trt} = $trt;   }
53  -    $dhcp_data{"first"} = '';          
54  -       #..... get winpopup details  
55  -    $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data );  @@ -374,13 +374,13 @@
56  -    $c->render( template => 'dhcpd' );  
57  +    #my ($mask, $network) = @_;   sub delete_one_lease {
58  +       my $nmap_sme = esmith::ConfigDB->open('/home/e-smith/db/configuration');          my $c = shift;  
59  +       my $mask = $nmap_sme->get_value('LocalNetmask');  -    # ...do it
60  +       my $network = $nmap_sme->get_prop('InternalInterface','Network');  +       Perform_Del_Lease($c);
61         return "ok";
62     }
63    
64     sub delete_all_leases {
65            my $c = shift;  
66    -    # ...do it
67    +       Perform_del_all_Lease($c);
68         return "ok";
69     }
70    
71    @@ -391,6 +391,167 @@
72         return @leases;
73     }
74    
75    +
76    +sub Perform_del_all_Lease ($){
77    +
78    +       system ('/bin/echo "" > /var/lib/dhcpd/dhcpd.leases') ==0
79    +                or die "Error while removing all leases: $!";
80    +      
81    +       system ("/sbin/e-smith/signal-event","workgroup-update") == 0
82    +                or die "Error while saving settings: $!";
83    +                  
84    +     return 'ok';
85    +    exit;
86    +}  
87    +
88    +#===============================================================================
89    +#SUBROUTINE: Perform delete lease
90    +#===============================================================================
91    +sub Perform_Del_Lease($){
92    +
93    +    ###Pull CGI object from parameters array
94    +    my $c = shift;
95    +
96    +    ###Pull entry to delete
97    +    my $ip = $c->param('host');
98    +    my $name = $c->param('name');
99    +       my $name_in_file = '/var/lib/dhcpd/dhcpd.leases'  ;
100    +       my $name_tmp_file = '/var/lib/dhcpd/dhcpd.leases.tmp'  ;
101    +       my $name_out_file = '/var/lib/dhcpd/dhcpd.leases~'  ;
102    +       my $del_current = "0" ;
103    +
104    +       open(INFILE,"<$name_in_file") || die "Read Error $name_in_file, Read: $!";
105    +       open(OUTFILE,">$name_tmp_file") || die "Write error $name_in_file, Write: $!";
106    +       while (<INFILE>) {
107    +               if ( "$_" =~ /lease $ip/ ) {
108    +                       $del_current = "1" ;
109    +               }
110    +               if ( $del_current == "0" ) { print OUTFILE "$_" ; }
111    +               if ( "$_" =~ /}/ ) {
112    +                       $del_current = "0" ;
113    +               }
114    +       }
115    +       rename ($name_tmp_file,$name_in_file) ;
116    +       system ("/bin/cp","-f","$name_in_file","$name_out_file") ;
117    +       close(INFILE);
118    +       close(OUTFILE);
119    +
120    +    # changed to new sme standard signal-event
121    +    system ("/sbin/e-smith/signal-event","workgroup-update") == 0
122    +                or die "Error while saving settings: $!";
123    +    ###Return action message
124    +    return $c->l('SUCCESSFULLY_DELETED_THE_CLIENT') . ' (' . $name . '/' . $ip .')';
125    +}
126    +
127    +#===============================================================================
128    +#SUBROUTINE: Scan The Local Network
129    +#===============================================================================
130    +sub dec2bin {
131    +  my $str = unpack("B32", pack("N", shift));
132    +  return $str;
133    +}
134    +
135    +sub netmask2cidr {
136    +    my ($mask, $network) = @_;
137  +    my @octet = split (/\./, $mask);  +    my @octet = split (/\./, $mask);
138  +    my @bits;  +    my @bits;
139  +    my $binmask;  +    my $binmask;
# Line 34  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 144  diff -urN smeserver-dhcpmanager-2.0.4.ol
144  +      $binoct = dec2bin($_);  +      $binoct = dec2bin($_);
145  +      $binmask = $binmask . substr $binoct, -8;  +      $binmask = $binmask . substr $binoct, -8;
146  +    }  +    }
147  +  +
148  +    # let's count the 1s  +    # let's count the 1s
149  +    @bits = split (//,$binmask);  +    @bits = split (//,$binmask);
150  +    foreach (@bits) {  +    foreach (@bits) {
# Line 42  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 152  diff -urN smeserver-dhcpmanager-2.0.4.ol
152  +        $bitcount++;  +        $bitcount++;
153  +      }  +      }
154  +    }  +    }
 +  
155  +    my $cidr = $network . "/" . $bitcount;  +    my $cidr = $network . "/" . $bitcount;
156  +    return $cidr;  +    return $cidr;
157  +}  +}
158  +  +
159  +sub dec2bin {  +sub get_mac_address {
160  +  my $str = unpack("B32", pack("N", shift));  +       # From the leases file
161  +  return $str;  +    my ($ip, $file) = @_;
162   }  +    open(my $fh, '<', $file) or die "Could not open file '$file' $!";
163    +    my $mac_address = undef;
164    +    my $lease_block;
165    +    while(my $line = <$fh>) {
166    +        if($line =~ /lease $ip {/ .. $line =~ /}/) {
167    +            $lease_block .= $line;
168    +            if($line =~ /}/) {
169    +                if($lease_block =~ /hardware ethernet (\S+);/) {
170    +                    $mac_address = $1;
171    +                    last;
172    +                } else {
173    +                    $lease_block = '';
174    +                }
175    +            }
176    +        }
177    +    }
178    +    close $fh;
179    +    return $mac_address;
180    +}
181  +  +
182   sub do_scan {  +sub  trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s };
183          #  +
184          # call to show scan results  +sub get_mac_address_by_ping {
185  @@ -140,12 +159,13 @@  +    my ($ip) = trim(@_);
186          my $c = shift;  +    # Ping the IP to ensure it's in the ARP table
187       my $title = $c->l("dhcpd_SCANNING_NETWORK_TITLE");  +    my $ping_result = `ping -c 1 -W 1 $ip`;
188       my $modul = '';  +    if($ping_result =~ /1 packets transmitted, 1 received/) {
189  -    my $trt   = "NETSCAN";  +        # Fetch the ARP table and find the line with the IP address
190  +    my $trt   = "SCAN";  +        my $arp_result = `arp -an | grep "\($ip)"`;
191       $dhcp_data{trt} = $trt;  +        # If found, return the MAC address
192       $dhcp_data{"first"} = '';  +        return $arp_result;
193          # ..... get scan results into dhcp_data  +        if ($arp_result =~ /.*at ((?:[0-9a-f]{2}\:){5}[0-9a-f]{2})/) {
194  -       dhcp_data{"scanresults"} = get_scan_results($c);  +            return $1;
195  -    $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data );  +        } else { return "not in arp table"}
196  +       $dhcp_data{"cidr"} = netmask2cidr($c);  +    } else { return "no ping"}
197  +       my @scanresults =  get_scan_results($c);  +    return undef;
 +    $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data, scanresults => @scanresults );  
      $c->render( template => 'dhcpd' );  
  }  
     
 @@ -361,8 +381,30 @@  
   
  sub get_scan_results {  
         my $c = shift;  
 -       #...do it  
 -       return "results";  
 +       my $cidr = netmask2cidr($c);  
 +       my $res = execute_nmap($cidr);  
 +       return $res;  
198  +}  +}
199  +  +
200  +sub execute_nmap {  +
201  +    my ($ip, $port) = @_;  +
202  +    my @result;  +sub Scan_Local_Network ($) {          
203  +    my $nmapcmd = qq(/usr/bin/nmap --script smb-os-discovery.nse -p U:137,T:139 $ip| \  +  
204  +             /bin/grep -Ev "MAC|NetBIOS|OS CPE"| /bin/grep -E "scan|done|Computer|OS"| \  +        my $nmap_sme = esmith::ConfigDB->open('/home/e-smith/db/configuration');
205  +             /bin/sed -e 's/Nmap scan/-- Scan/g'|/bin/sed -e 's/done/Done/g'| \  +        my $mask = $nmap_sme->get_value('LocalNetmask');
206  +             /bin/sed -e 's/Nmap//g'|/bin/sed -e 's/|/  /g');  +        my $network = $nmap_sme->get_prop('InternalInterface','Network');
207  +  +
208  +    open my $nmap, '-|', "$nmapcmd" or die "Can't start nmap: $!";  +#we start to calculate the method to find the cidr (we want to use network/cidr with nmap)  
209  +  +   my $cidr = netmask2cidr($mask, $network);
210  +    while (my $line = <$nmap>) {  +
211  +        chomp $line;  +#ok go to use nmap with nmap -T4 -sP network/cidr
212  +        my @fields = split /\s+/, $line;  +       my @nmap_output= `/usr/bin/nmap --script smb-os-discovery.nse -p U:137,T:139 $cidr|
213  +        push @result, \@fields;  +                               /bin/grep -Ev "MAC|NetBIOS|OS CPE"| /bin/grep -E "scan|done|Computer|OS"|
214    +                               /bin/sed -e 's/Nmap scan/-- Scan/g'|/bin/sed -e 's/done/Done/g'|
215    +                               /bin/sed -e 's/Nmap//g'|/bin/sed -e 's/|/  /g'`;
216    +      
217    +    my @extracted_output;
218    +    my $leasefile = "/var/lib/dhcpd/dhcpd.leases";
219    +    foreach my $line (@nmap_output) {
220    +        if ($line =~ m/Scan report for ([\w\.-]+) \(([\d\.\:]+)\)/) {
221    +                       my $ip = $2;
222    +                       my $mac = get_mac_address($ip,$leasefile);
223    +                       if (!$mac){
224    +                               $mac = get_mac_address_by_ping($ip);
225    +                       }
226    +                       if (!$mac) {$mac = "unknown";}
227    +                       my %pair = ('Network' => $1, 'ip' => $ip, 'mac' => $mac);  # $1 => PC Name, $2 => IP Address
228    +                       push @extracted_output, \%pair;
229    +       }
230  +    }  +    }
231    +    return \@extracted_output;
232    +}
233    +                
234  +  +
 +    close $nmap;  
235  +  +
236  +    return \@result;   #=========================================================================
237   }   # Procedure qui charge le dhcpd.conf
238             # retourne un tableau contenant les informations
239    @@ -536,4 +697,4 @@
 @@ -498,13 +540,6 @@  
         return @results;  
  }  
   
 -sub winpopup{  
 -       my $c = shift;  
 -       # Message in $c->param("winpopupmsg")  
 -    # .... do it  
 -    return TRUE;  
 -}        
 -  
  sub do_wol{  
         my $c = shift;  
         my $retVal = Perform_Wake_Up($c);  
 @@ -536,4 +571,4 @@  
240    
241   1;   1;
242    
# Line 129  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 245  diff -urN smeserver-dhcpmanager-2.0.4.ol
245  +        +      
246  diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm  diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm
247  --- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm        1970-01-01 01:00:00.000000000 +0100  --- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm        1970-01-01 01:00:00.000000000 +0100
248  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm    2023-12-30 11:30:00.000000000 +0000  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm    2024-01-20 08:46:00.000000000 +0000
249  @@ -0,0 +1,109 @@  @@ -0,0 +1,109 @@
250  +package SrvMngr::I18N::Modules::Dhcpd::en;  +package SrvMngr::I18N::Modules::Dhcpd::en;
251  +use strict;  +use strict;
# Line 242  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 358  diff -urN smeserver-dhcpmanager-2.0.4.ol
358  +1;  +1;
359  diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep  diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep
360  --- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep      2023-12-19 09:44:56.680590493 +0000  --- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep      2023-12-19 09:44:56.680590493 +0000
361  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep  2023-12-30 10:10:00.000000000 +0000  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep  2024-01-20 17:01:00.000000000 +0000
362  @@ -49,10 +49,8 @@  @@ -49,24 +49,26 @@
363    
364          % if ($dhcp_data->{trt} eq 'LEASES') {          % if ($dhcp_data->{trt} eq 'LEASES') {
365                  %= include 'partials/_dhcpd_leases'                  %= include 'partials/_dhcpd_leases'
366  -       %} elsif ($dhcp_data->{trt} eq 'WINPOPUP') {  -       %} elsif ($dhcp_data->{trt} eq 'WINPOPUP') {
367  -               %= include 'partials/_dhcpd_winpopup'  -               %= include 'partials/_dhcpd_winpopup'
368          %} elsif ($dhcp_data->{trt} eq 'SCAN') {          %} elsif ($dhcp_data->{trt} eq 'SCAN') {
369  -               %= include 'partials/_dhcpd_scan'                  %= include 'partials/_dhcpd_scan'
 +               %= include 'partials/_dhcpd_scanresults'  
370          %} else {                                       #PARAMS          %} else {                                       #PARAMS
371                  % my $ip_regex = '^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$';                  % my $ip_regex = '^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$';
372                  <table><tr><td>  -               <table><tr><td>
373  @@ -63,9 +61,12 @@  -               %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases"
374                  </button>  -               <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="load" style="display:true">
375                  </td><td>  -                 Scanning  <!--%= $c->l('dhcpd_CONNECTED_IP')-->
376                  %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3'  -                 <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
377    -               </button>
378    -               </td><td>
379    -               %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3'
380  -               </td><td>  -               </td><td>
381  -               %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2'  -               %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2'
382  +               </td>  -               <td>
383  +               <!--  -               </tr>
384                  <td>  +               <table>
385  +               %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2'  +                       <tr>
386  +               </td>  +                       <td>
387  +               -->  +                               %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinnerLeases()", id=>"scanLeases"
388                  </tr>  +                               <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="load" style="display:true">
389    +                                 Scanning  <!--%= $c->l('dhcpd_CONNECTED_IP')-->
390    +                                 <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
391    +                               </button>
392    +                       </td><td>      
393    +                               %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3', onclick=>"showSpinnerNetwork()", id=>"scanNetwork"
394    +                               <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="loadingNetwork" style="display:true">
395    +                                 Scanning  <!--%= $c->l('dhcpd_CONNECTED_IP')-->
396    +                                 <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
397    +                               </button>
398    +                       </td>
399    +                       </tr>
400                  </table>                    </table>  
401                  <hr />                  <hr />
402                    <h2>
403    @@ -180,10 +182,17 @@
404    
405     %= javascript begin
406       document.getElementById("load").style.display="none";
407    -  function showSpinner(){
408    +  document.getElementById("loadingNetwork").style.display="none";
409    +
410    +  function showSpinnerLeases(){
411              document.getElementById("scanLeases").style.display="none";
412              document.getElementById("load").style.display="inline";
413        }
414    +
415    +  function showSpinnerNetwork(){
416    +         document.getElementById("scanNetwork").style.display="none";
417    +         document.getElementById("loadingNetwork").style.display="inline";
418    +   }
419     %end
420    
421     %= stylesheet begin
422    @@ -205,7 +214,6 @@
423         border-color: darkgrey;
424         border-image: initial;
425     }
426    -
427     %end
428    -
429     %end
430    +1;
431  diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep  diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep
432  --- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep     2023-12-19 09:44:56.681590497 +0000  --- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep     2023-12-19 09:44:56.681590497 +0000
433  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep 2023-12-29 15:16:00.000000000 +0000  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep 2024-01-20 11:29:00.000000000 +0000
434    @@ -1,17 +1,17 @@
435     <div id='dhcpd-leases'>
436            <table><tr><td>
437    -       %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases"
438    -       <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="load" style="display:true">
439    -         Scanning  <!--%= $c->l('dhcpd_CONNECTED_IP')-->
440    -         <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
441    -       </button>
442    -
443    -       </td><td>
444    -       %= button_to $c->l('dhcpd_REMOVE_ALL_LEASES') => '/dhcpd4'
445    -       </td>
446    -       </tr>
447    +               %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showSpinnerLeases()", id=>"scanLeases"
448    +               <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="load" style="display:true">
449    +                 Scanning  <!--%= $c->l('dhcpd_CONNECTED_IP')-->
450    +                 <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
451    +               </button>
452    +
453    +               </td><td>
454    +               %= button_to $c->l('dhcpd_REMOVE_ALL_LEASES') => '/dhcpd4'
455    +               </td>
456    +               </tr>
457         </table>    
458    -       <hr />
459    +
460            % my $btn = l('dhcpd_SAVE/RESTART');
461            %= form_for '/dhcpd10' => (method => 'POST') => begin
462                    <span class=label>
463  @@ -26,7 +26,7 @@  @@ -26,7 +26,7 @@
464                  %= submit_button "$btn", class => 'action'                  %= submit_button "$btn", class => 'action'
465       % end       % end
# Line 297  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 484  diff -urN smeserver-dhcpmanager-2.0.4.ol
484                                  <a href="/smanager/dhcpd6?trt=DEL&ip=<%= $ip->{ip}%>" onclick="Remove_lease_confirm(event,'<%=$c->l('dhcpd_REMOVE_A_DHCP_LEASE_ACTION')%>',this);"><center><%=l 'dhcpd_REMOVE'%></center></a>                                  <a href="/smanager/dhcpd6?trt=DEL&ip=<%= $ip->{ip}%>" onclick="Remove_lease_confirm(event,'<%=$c->l('dhcpd_REMOVE_A_DHCP_LEASE_ACTION')%>',this);"><center><%=l 'dhcpd_REMOVE'%></center></a>
485  -                       </td><td class = 'sme-border'>  -                       </td><td class = 'sme-border'>
486  +                       </td>  +                       </td>
487  +                       <!-->  +                       <!--
488  +                       <td class = 'sme-border'>  +                       <td class = 'sme-border'>
489                                  <a href="/smanager/dhcpd8?trt=WIN&ip=<%= $ip->{ip}%>" onclick="Winpop_confirm(event,'<%=$c->l('dhcpd_SENDING_A_WINPOPUP')%>',this);"><center><%=l 'dhcpd_WINPOPUP_ACTION'%></center></a>                                  <a href="/smanager/dhcpd8?trt=WIN&ip=<%= $ip->{ip}%>" onclick="Winpop_confirm(event,'<%=$c->l('dhcpd_SENDING_A_WINPOPUP')%>',this);"><center><%=l 'dhcpd_WINPOPUP_ACTION'%></center></a>
490                          </td>                          </td>
# Line 312  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 499  diff -urN smeserver-dhcpmanager-2.0.4.ol
499  -</div>  -</div>
500  \ No newline at end of file  \ No newline at end of file
501  +</div>  +</div>
502  diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep  diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scan.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scan.html.ep
503  --- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep        1970-01-01 01:00:00.000000000 +0100  --- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scan.html.ep       1970-01-01 01:00:00.000000000 +0100
504  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep    2023-12-30 15:30:00.000000000 +0000  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scan.html.ep   2024-01-20 17:30:00.000000000 +0000
505  @@ -0,0 +1,41 @@  @@ -0,0 +1,63 @@
506  +<div id='dhcpd-scanresults'>  +<div id='dhcpd-scan'>
507  +%#= 1/0  +       <table><tr><td>
508  +       %= $c->l('dhcpd_NETWORK_VALUES_FOUND').$dhcp_data->{"cidr"};  +       %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd3', onclick=>"showSpinnerNetwork1()", id=>"scanNetwork1"
509  +       %= form_for '/dhcpd10' => (method => 'POST') => begin  +       <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="loadingNetwork1" style="display:true">
510  +       <br />  +         Scanning  <!--%= $c->l('dhcpd_CONNECTED_IP')-->
511  +       <table class="sme-border table-sort"><thead>  +         <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
512    +       </button>
513    +
514    +       </td>
515    +       </tr>
516    +      
517    +    </table>          
518    +    <table class="sme-border table-sort"><thead>
519  +               <tr>  +               <tr>
520  +                               <th class='sme-border'>  +                       <th class='sme-border'>
521  +                               %=l 'dhcpd_NETWORK_NAME'  +                               %=l 'dhcpd_NETWORK_NAME'
522  +                       </th>  +                       </th>
523  +                       <th class='sme-border'>  +                       <th class='sme-border'>
# Line 332  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 526  diff -urN smeserver-dhcpmanager-2.0.4.ol
526  +                       <th class='sme-border'>  +                       <th class='sme-border'>
527  +                               %=l 'dhcpd_MAC_ADDRESS'  +                               %=l 'dhcpd_MAC_ADDRESS'
528  +                       </th>  +                       </th>
529  +                       <th class='sme-border'>  +
 +                               %=l 'dhcpd_STATUS_CLICK_FOR_WOL'  
 +                       </th>  
530  +               </tr>  +               </tr>
531  +               </thead>  +               </thead>
532  +               <tbody>  +               <tbody>
533  +               % foreach my $line (@$scanresults) {  +        % foreach my $ip (@$scanresults) {
534  +                       % my @thisline = @$line;  +        <tr>
535  +                       <tr>  +                       %= t td => (class => 'sme-border') => $ip->{Network}
536  +                       <td class='sme-border'>  +                       %= t td => (class => 'sme-border') => $ip->{ip}
537  +                       %= "$thisline[4]";  +                       %= t td => (class => 'sme-border') => $ip->{mac}
538  +                       </td>  +               </tr>
539  +                       <td class='sme-border'>  +               %}
540  +                       %= "$thisline[5]";  +               </tbody>
 +                       </td>  
 +                       <td class='sme-border'>  
 +                       </td>  
 +                       <td class='sme-border'>  
 +                       </td>  
 +                       </tr>  
 +               %}  
541  +       </table>  +       </table>
542  +    % end  +       %= hidden_field "hiddenmsg"=>"", id=>"hiddenmsg"
543    +       <br />
544  +       %= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd'  +       %= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd'
545    +
546    +       %= javascript begin
547    +               function Wol_confirm(event,msg,current){
548    +                       const getMAC = /.*MAC\=(.*)\&name.*/;
549    +                       var MAC = current.href.match(getMAC)[1];
550    +                       if (confirm(msg+": MAC: "+MAC))
551    +                       { return true;}
552    +                       else {event.preventDefault();return false;}
553    +               }
554    +
555    +                      
556    +       %end
557    +
558    +
559  +</div>  +</div>
560    +%= javascript begin
561    +       document.getElementById("loadingNetwork1").style.display="none";
562    +  
563    +       function showSpinnerNetwork1(){
564    +         document.getElementById("scanNetwork1").style.display="none";
565    +         document.getElementById("loadingNetwork1").style.display="inline";
566    +       }
567    +
568    +%end


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed