/[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.2 by brianr, Sun Dec 31 14:45:40 2023 UTC Revision 1.4 by brianr, Sat Jan 20 14:09:56 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-31 13:44:00.000000000 +0000  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm 2024-01-20 13:24:00.000000000 +0000
4  @@ -117,22 +117,41 @@  @@ -137,15 +137,16 @@
      $c->render( template => 'dhcpd' );  
  }        
   
 -  
 -sub do_winpopup {  
 -       #  
 -       # call to win pop up  
 -       #  
 +sub netmask2cidr {  
         my $c = shift;  
 -    my $title = $c->l("dhcpd_GLOBAL_WINPOPUP");  
 -    my $modul = '';  
 -    my $trt   = "WINPOPUP";  
 -    $dhcp_data{trt} = $trt;  
 -    $dhcp_data{"first"} = '';  
 -       #..... get winpopup details  
 -    $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data );  
 -    $c->render( template => 'dhcpd' );  
 +    #my ($mask, $network) = @_;  
 +       my $nmap_sme = esmith::ConfigDB->open('/home/e-smith/db/configuration');  
 +       my $mask = $nmap_sme->get_value('LocalNetmask');  
 +       my $network = $nmap_sme->get_prop('InternalInterface','Network');  
 +    my @octet = split (/\./, $mask);  
 +    my @bits;  
 +    my $binmask;  
 +    my $binoct;  
 +    my $bitcount=0;  
 +  
 +    foreach (@octet) {  
 +      $binoct = dec2bin($_);  
 +      $binmask = $binmask . substr $binoct, -8;  
 +    }  
 +  
 +    # let's count the 1s  
 +    @bits = split (//,$binmask);  
 +    foreach (@bits) {  
 +      if ($_ eq "1") {  
 +        $bitcount++;  
 +      }  
 +    }  
 +  
 +    my $cidr = $network . "/" . $bitcount;  
 +    return $cidr;  
  }  
   
 +sub dec2bin {  
 +  my $str = unpack("B32", pack("N", shift));  
 +  return $str;  
 +}  
 +  
 +  
  sub do_scan {  
5          #          #
6          # call to show scan results          # call to show scan results
7  @@ -140,12 +159,13 @@          #
8    +       my $y = 1/0;
9          my $c = shift;          my $c = shift;
10       my $title = $c->l("dhcpd_SCANNING_NETWORK_TITLE");       my $title = $c->l("dhcpd_SCANNING_NETWORK_TITLE");
11       my $modul = '';       my $modul = '';
# Line 64  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 13  diff -urN smeserver-dhcpmanager-2.0.4.ol
13  +    my $trt   = "SCAN";  +    my $trt   = "SCAN";
14       $dhcp_data{trt} = $trt;       $dhcp_data{trt} = $trt;
15       $dhcp_data{"first"} = '';       $dhcp_data{"first"} = '';
16          # ..... get scan results into dhcp_data  -       # ..... get scan results into dhcp_data
17  -       dhcp_data{"scanresults"} = get_scan_results($c);  -       dhcp_data{"scanresults"} = get_scan_results($c);
18  -    $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data );  -    $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data );
19  +       $dhcp_data{"cidr"} = netmask2cidr($c);  +       # ..... get scan results into stash for passing to html template
20  +       my @scanresults =  get_scan_results($c);  +       my $dhcp_scanresults = get_scan_results($c);
21  +    $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data, scanresults => @scanresults );  +    $c->stash( title => $title, modul => $modul, "dhcp_data" => \%dhcp_data, "scanresults" => $dhcp_scanresults);
22       $c->render( template => 'dhcpd' );       $c->render( template => 'dhcpd' );
23   }   }
24        
25  @@ -314,7 +334,6 @@  @@ -332,10 +333,10 @@
          }  
      }      
         
 -  
      # - 4 expand templates  
      # changed to new sme standard signal-event  
      system ("/sbin/e-smith/signal-event","workgroup-update") == 0  
 @@ -332,10 +351,10 @@  
26          my $c = shift;          my $c = shift;
27       my $ret = delete_all_leases($c);       my $ret = delete_all_leases($c);
28          if ($ret == 'ok') {          if ($ret == 'ok') {
29  -               dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";  -               dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";
30  +               $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_REMOVED_ALL_LEASES";  +               $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";
31                  do_leases($c);                  do_leases($c);
32          }                }      
33  -       else {dhcp_data{"error"}=$ret;}  -       else {dhcp_data{"error"}=$ret;}
# Line 94  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 35  diff -urN smeserver-dhcpmanager-2.0.4.ol
35       return ;       return ;
36   }   }
37    
38  @@ -352,17 +371,39 @@  @@ -352,17 +353,17 @@
39       # else return "ok"       # else return "ok"
40       my $ret = delete_lease($c);       my $ret = delete_lease($c);
41          if ($ret == 'ok') {          if ($ret == 'ok') {
42  -               dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";  -               dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";
43  +               $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_DELETED_THE_CLIENT";  +               $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";
44                  do_leases($c);                  do_leases($c);
45          }                }      
46  -       else {dhcp_data{"error"}=$ret;}  -       else {dhcp_data{"error"}=$ret;}
# Line 109  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 50  diff -urN smeserver-dhcpmanager-2.0.4.ol
50    
51   sub get_scan_results {   sub get_scan_results {
52          my $c = shift;          my $c = shift;
53  -       #...do it          #...do it
54  -       return "results";  -       return "results";
55  +       my $cidr = netmask2cidr($c);  +       return Scan_Local_Network($c);
 +       my $res = execute_nmap($cidr);  
 +       return $res;  
 +}  
 +  
 +sub execute_nmap {  
 +    my ($ip, $port) = @_;  
 +    my @result;  
 +    my $nmapcmd = qq(/usr/bin/nmap --script smb-os-discovery.nse -p U:137,T:139 $ip| \  
 +             /bin/grep -Ev "MAC|NetBIOS|OS CPE"| /bin/grep -E "scan|done|Computer|OS"| \  
 +             /bin/sed -e 's/Nmap scan/-- Scan/g'|/bin/sed -e 's/done/Done/g'| \  
 +             /bin/sed -e 's/Nmap//g'|/bin/sed -e 's/|/  /g');  
 +  
 +    open my $nmap, '-|', "$nmapcmd" or die "Can't start nmap: $!";  
 +  
 +    while (my $line = <$nmap>) {  
 +        chomp $line;  
 +        my @fields = split /\s+/, $line;  
 +        push @result, \@fields;  
 +    }  
 +  
 +    close $nmap;  
 +  
 +    return \@result;  
56   }   }
57                    
58    
59  @@ -374,13 +415,45 @@  @@ -374,13 +375,13 @@
60    
61   sub delete_one_lease {   sub delete_one_lease {
62          my $c = shift;            my $c = shift;  
63  -    # ...do it  -    # ...do it
64    +       Perform_Del_Lease($c);
65         return "ok";
66     }
67    
68     sub delete_all_leases {
69            my $c = shift;  
70    -    # ...do it
71    +       Perform_del_all_Lease($c);
72         return "ok";
73     }
74    
75    @@ -391,6 +392,118 @@
76         return @leases;
77     }
78    
79    +
80    +sub Perform_del_all_Lease ($){
81    +
82    +       system ('/bin/echo "" > /var/lib/dhcpd/dhcpd.leases') ==0
83    +                or die "Error while removing all leases: $!";
84    +      
85    +       system ("/sbin/e-smith/signal-event","workgroup-update") == 0
86    +                or die "Error while saving settings: $!";
87    +                  
88    +     return 'ok';
89    +    exit;
90    +}  
91    +
92    +#===============================================================================
93    +#SUBROUTINE: Perform delete lease
94    +#===============================================================================
95    +sub Perform_Del_Lease($){
96    +
97    +    ###Pull CGI object from parameters array
98    +    my $c = shift;
99  +  +
100  +    ###Pull entry to delete  +    ###Pull entry to delete
101  +    my $ip = $c->param('host');  +    my $ip = $c->param('host');
# Line 171  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 124  diff -urN smeserver-dhcpmanager-2.0.4.ol
124  +    # changed to new sme standard signal-event  +    # changed to new sme standard signal-event
125  +    system ("/sbin/e-smith/signal-event","workgroup-update") == 0  +    system ("/sbin/e-smith/signal-event","workgroup-update") == 0
126  +                or die "Error while saving settings: $!";  +                or die "Error while saving settings: $!";
127       return "ok";  +    ###Return action message
128   }  +    return $c->l('SUCCESSFULLY_DELETED_THE_CLIENT') . ' (' . $name . '/' . $ip .')';
129    +}
130   sub delete_all_leases {  +
131          my $c = shift;    +#===============================================================================
132  -    # ...do it  +#SUBROUTINE: Scan The Local Network
133  +       system ('/bin/echo "" > /var/lib/dhcpd/dhcpd.leases') ==0  +#===============================================================================
134  +                       or die "Error while removing all leases: $!";  +sub dec2bin {
135  +    +  my $str = unpack("B32", pack("N", shift));
136  +   system ("/sbin/e-smith/signal-event","workgroup-update") == 0  +  return $str;
137  +                       or die "Error while saving settings: $!";  +}
138  +                            +
139       return "ok";  +sub netmask2cidr {
140   }  +    my ($mask, $network) = @_;
141    +    my @octet = split (/\./, $mask);
142  @@ -498,13 +571,6 @@  +    my @bits;
143          return @results;  +    my $binmask;
144   }  +    my $binoct;
145    +    my $bitcount=0;
146  -sub winpopup{  +
147  -       my $c = shift;  +    foreach (@octet) {
148  -       # Message in $c->param("winpopupmsg")  +      $binoct = dec2bin($_);
149  -    # .... do it  +      $binmask = $binmask . substr $binoct, -8;
150  -    return TRUE;  +    }
151  -}        +
152  -  +    # let's count the 1s
153   sub do_wol{  +    @bits = split (//,$binmask);
154          my $c = shift;  +    foreach (@bits) {
155          my $retVal = Perform_Wake_Up($c);  +      if ($_ eq "1") {
156  @@ -536,4 +602,4 @@  +        $bitcount++;
157    +      }
158    +    }
159    +
160    +    my $cidr = $network . "/" . $bitcount;
161    +    return $cidr;
162    +}
163    +
164    +sub Scan_Local_Network ($) {          
165    +    
166    +        my $nmap_sme = esmith::ConfigDB->open('/home/e-smith/db/configuration');
167    +        my $mask = $nmap_sme->get_value('LocalNetmask');
168    +        my $network = $nmap_sme->get_prop('InternalInterface','Network');
169    +
170    +#we start to calculate the method to find the cidr (we want to use network/cidr with nmap)  
171    +   my $cidr = netmask2cidr($mask, $network);
172    +
173    +#ok go to use nmap with nmap -T4 -sP network/cidr
174    +       my @nmap_output= `/usr/bin/nmap --script smb-os-discovery.nse -p U:137,T:139 $cidr|
175    +                               /bin/grep -Ev "MAC|NetBIOS|OS CPE"| /bin/grep -E "scan|done|Computer|OS"|
176    +                               /bin/sed -e 's/Nmap scan/-- Scan/g'|/bin/sed -e 's/done/Done/g'|
177    +                               /bin/sed -e 's/Nmap//g'|/bin/sed -e 's/|/  /g'`;
178    +      
179    +    my @extracted_output;
180    +    foreach my $line (@nmap_output) {
181    +        if ($line =~ m/Scan report for ([\w\.-]+) \(([\d\.\:]+)\)/) {
182    +            my %pair = ('Network' => $1, 'ip' => $2);  # $1 => PC Name, $2 => IP Address
183    +            push @extracted_output, \%pair;
184    +        }
185    +    }
186    +    return \@extracted_output;
187    +}
188    +                
189    +
190    +
191     #=========================================================================
192     # Procedure qui charge le dhcpd.conf
193     # retourne un tableau contenant les informations
194    @@ -536,4 +649,4 @@
195    
196   1;   1;
197    
# Line 209  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 200  diff -urN smeserver-dhcpmanager-2.0.4.ol
200  +        +      
201  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
202  --- 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
203  +++ 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
204  @@ -0,0 +1,109 @@  @@ -0,0 +1,109 @@
205  +package SrvMngr::I18N::Modules::Dhcpd::en;  +package SrvMngr::I18N::Modules::Dhcpd::en;
206  +use strict;  +use strict;
# Line 322  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 313  diff -urN smeserver-dhcpmanager-2.0.4.ol
313  +1;  +1;
314  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
315  --- 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
316  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep  2023-12-31 13:55:00.000000000 +0000  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep  2024-01-20 13:44:00.000000000 +0000
317  @@ -49,23 +49,30 @@  @@ -49,24 +49,26 @@
318    
319          % if ($dhcp_data->{trt} eq 'LEASES') {          % if ($dhcp_data->{trt} eq 'LEASES') {
320                  %= include 'partials/_dhcpd_leases'                  %= include 'partials/_dhcpd_leases'
321  -       %} elsif ($dhcp_data->{trt} eq 'WINPOPUP') {  -       %} elsif ($dhcp_data->{trt} eq 'WINPOPUP') {
322  -               %= include 'partials/_dhcpd_winpopup'  -               %= include 'partials/_dhcpd_winpopup'
323          %} elsif ($dhcp_data->{trt} eq 'SCAN') {          %} elsif ($dhcp_data->{trt} eq 'SCAN') {
324  -               %= include 'partials/_dhcpd_scan'                  %= include 'partials/_dhcpd_scan'
 +               %= include 'partials/_dhcpd_scanresults'  
325          %} else {                                       #PARAMS          %} else {                                       #PARAMS
326                  % 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])$';
327                  <table><tr><td>  -               <table><tr><td>
328  -               %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases"  -               %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases"
329  -               <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="load" style="display:true">  -               <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="load" style="display:true">
330  -                 Scanning  <!--%= $c->l('dhcpd_CONNECTED_IP')-->  -                 Scanning  <!--%= $c->l('dhcpd_CONNECTED_IP')-->
331  +               %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showLeasesSpinner()", id=>"scanLeases"  -                 <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
332  +               <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="loadLeases" style="display:true">  -               </button>
333  +                 Scanning  -               </td><td>
                   <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>  
                 </button>  
 +                
                 </td><td>  
334  -               %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3'  -               %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3'
335  -               </td><td>  -               </td><td>
336  -               %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2'  -               %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2'
337  +               %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3', onclick=>"showNetworkSpinner()", id=>"scanNetwork"  -               <td>
338  +               <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="loadNetwork" style="display:true">  -               </tr>
339  +                       Scanning  +               <table>
340  +                       <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>  +                       <tr>
341  +               </button>  +                       <td>
342  +  +                               %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinnerLeases()", id=>"scanLeases"
343  +               </td>  +                               <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="load" style="display:true">
344  +               <!--  +                                 Scanning  <!--%= $c->l('dhcpd_CONNECTED_IP')-->
345                  <td>  +                                 <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
346  +               %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2'  +                               </button>
347  +               </td>  +                       </td><td>      
348  +               -->  +                               %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3, onclick=>"showSpinnerNetwork()", id=>"scanNetwork'
349                  </tr>  +                               <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="loadingNetwork" style="display:true">
350    +                                 Scanning  <!--%= $c->l('dhcpd_CONNECTED_IP')-->
351    +                                 <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
352    +                               </button>
353    +                       </td>
354    +                       </tr>
355                  </table>                    </table>  
356                  <hr />                  <hr />
357  @@ -179,10 +186,15 @@                  <h2>
358   </div>  @@ -180,10 +182,17 @@
359    
360   %= javascript begin   %= javascript begin
361  -  document.getElementById("load").style.display="none";     document.getElementById("load").style.display="none";
362  -  function showSpinner(){  -  function showSpinner(){
363  +  document.getElementById("loadLeases").style.display="none";  +  document.getElementById("loadingNetwork").style.display="none";
364  +  document.getElementById("loadNetwork").style.display="none";  +
365  +  function showLeasesSpinner(){  +  function showSpinnerLeases(){
366            document.getElementById("scanLeases").style.display="none";            document.getElementById("scanLeases").style.display="none";
367  -         document.getElementById("load").style.display="inline";            document.getElementById("load").style.display="inline";
 +         document.getElementById("loadLeases").style.display="inline";  
 +   }  
 +  function showNetworkSpinner(){  
 +         document.getElementById("scanNetwork").style.display="none";  
 +         document.getElementById("loadNetwork").style.display="inline";  
368      }      }
369    +
370    +  function showSpinnerNetwork(){
371    +         document.getElementById("scanNetwork").style.display="none";
372    +         document.getElementById("loadingNetwork").style.display="inline";
373    +   }
374   %end   %end
375    
376     %= stylesheet begin
377    @@ -205,7 +214,6 @@
378         border-color: darkgrey;
379         border-image: initial;
380     }
381    -
382     %end
383    -
384     %end
385    +1;
386  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
387  --- 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
388  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep 2023-12-31 14:11: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
389  @@ -1,8 +1,8 @@  @@ -1,17 +1,17 @@
390   <div id='dhcpd-leases'>   <div id='dhcpd-leases'>
391          <table><tr><td>          <table><tr><td>
392  -       %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases"  -       %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases"
393  -       <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="load" style="display:true">  -       <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="load" style="display:true">
394  -         Scanning  <!--%= $c->l('dhcpd_CONNECTED_IP')-->  -         Scanning  <!--%= $c->l('dhcpd_CONNECTED_IP')-->
395  +       %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showLeaseSpinner()", id=>"scanLeases"  -         <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
396  +       <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="loadLease" style="display:true">  -       </button>
397  +         Scanning    -
398            <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>  -       </td><td>
399          </button>  -       %= button_to $c->l('dhcpd_REMOVE_ALL_LEASES') => '/dhcpd4'
400    -       </td>
401    -       </tr>
402    +               %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showSpinnerLeases()", id=>"scanLeases"
403    +               <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="load" style="display:true">
404    +                 Scanning  <!--%= $c->l('dhcpd_CONNECTED_IP')-->
405    +                 <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
406    +               </button>
407    +
408    +               </td><td>
409    +               %= button_to $c->l('dhcpd_REMOVE_ALL_LEASES') => '/dhcpd4'
410    +               </td>
411    +               </tr>
412         </table>    
413    -       <hr />
414    +
415            % my $btn = l('dhcpd_SAVE/RESTART');
416            %= form_for '/dhcpd10' => (method => 'POST') => begin
417                    <span class=label>
418  @@ -26,7 +26,7 @@  @@ -26,7 +26,7 @@
419                  %= submit_button "$btn", class => 'action'                  %= submit_button "$btn", class => 'action'
420       % end       % end
# Line 429  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 447  diff -urN smeserver-dhcpmanager-2.0.4.ol
447                  </tr>                  </tr>
448                  %}                  %}
449                  </tbody>                  </tbody>
450  @@ -78,6 +83,7 @@  @@ -110,4 +115,4 @@
         %= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd'  
   
         %= javascript begin  
 +               document.getElementById("loadLease").style.display="none";  
                 function Wol_confirm(event,msg,current){  
                         const getMAC = /.*MAC\=(.*)\&name.*/;  
                         var MAC = current.href.match(getMAC)[1];  
 @@ -110,4 +116,4 @@  
451          %end          %end
452    
453    
454  -</div>  -</div>
455  \ No newline at end of file  \ No newline at end of file
456  +</div>  +</div>
457  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
458  --- 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
459  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep    2023-12-31 13:59:00.000000000 +0000  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scan.html.ep   2024-01-20 11:34:00.000000000 +0000
460  @@ -0,0 +1,55 @@  @@ -0,0 +1,49 @@
461  +<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.4/css/jquery.dataTables.css">  +<div id='dhcpd-scan'>
462  +<script type="text/javascript" charset="utf8" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>  +       <table><tr><td>
463  +<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.11.4/js/jquery.dataTables.js"></script>  +       %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd3', onclick=>"showSpinnerNetwork()", id=>"scanNetwork"
464  +  +       <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="loadingNetwork" style="display:true">
465  +<div id='dhcpd-scanresults'>  +         Scanning  <!--%= $c->l('dhcpd_CONNECTED_IP')-->
466  +  +         <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
467  +%#= 1/0  +       </button>
468  +       %= $c->l('dhcpd_NETWORK_VALUES_FOUND').$dhcp_data->{"cidr"};  +
469  +       %= form_for '/dhcpd10' => (method => 'POST') => begin  +       </td>
470  +       <br />  +       </tr>
471  +       <table id="scanresults" class="sme-border table-sort"><thead>  +      
472    +    </table>          
473    +    <table class="sme-border table-sort"><thead>
474  +               <tr>  +               <tr>
475  +                               <th class='sme-border'>  +                       <th class='sme-border'>
476  +                               %=l 'dhcpd_NETWORK_NAME'  +                               %=l 'dhcpd_NETWORK_NAME'
477  +                       </th>  +                       </th>
478  +                       <th class='sme-border'>  +                       <th class='sme-border'>
479  +                               %=l 'dhcpd_IP'  +                               %=l 'dhcpd_IP'
480  +                       </th>  +                       </th>
 +                       <th class='sme-border'>  
 +                               %=l 'dhcpd_MAC_ADDRESS'  
 +                       </th>  
 +                       <th class='sme-border'>  
 +                               %=l 'dhcpd_STATUS_CLICK_FOR_WOL'  
 +                       </th>  
481  +               </tr>  +               </tr>
482  +               </thead>  +               </thead>
483  +               <tbody>  +               <tbody>
484  +               % foreach my $line (@$scanresults) {  +        % foreach my $ip (@$scanresults) {
485  +                       % my @thisline = @$line;  +        <tr>
486  +                       <tr>  +                       %= t td => (class => 'sme-border') => $ip->{Network}
487  +                       <td class='sme-border'>  +                       %= t td => (class => 'sme-border') => $ip->{ip}
488  +                       %= "$thisline[4]";  +               </tr>
489  +                       </td>  +               %}
490  +                       <td class='sme-border'>  +               </tbody>
 +                       %= "$thisline[5]";  
 +                       </td>  
 +                       <td class='sme-border'>  
 +                       </td>  
 +                       <td class='sme-border'>  
 +                       </td>  
 +                       </tr>  
 +               %}  
491  +       </table>  +       </table>
492  +    % end  +       %= hidden_field "hiddenmsg"=>"", id=>"hiddenmsg"
493    +       <br />
494  +       %= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd'  +       %= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd'
 +</div>  
 +<script>  
 +$(document).ready(function() {  
 +       $("table.table-sort").each(function() {  
 +               // Enable DataTable on this table  
 +               $(this).DataTable();  
 +       });  
 +});  
 +</script>  
495  +  +
496    +       %= javascript begin
497    +               function Wol_confirm(event,msg,current){
498    +                       const getMAC = /.*MAC\=(.*)\&name.*/;
499    +                       var MAC = current.href.match(getMAC)[1];
500    +                       if (confirm(msg+": MAC: "+MAC))
501    +                       { return true;}
502    +                       else {event.preventDefault();return false;}
503    +               }
504    +
505    +                      
506    +       %end
507    +
508    +
509    +</div>


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