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