/[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.3 by brianr, Tue Jan 16 12:41:01 2024 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 2024-01-16 08:38: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  @@ -144,7 +144,7 @@  @@ -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;       $dhcp_data{trt} = $trt;
11       $dhcp_data{"first"} = '';       $dhcp_data{"first"} = '';
12          # ..... get scan results into dhcp_data  -       # ..... get scan results into dhcp_data
13  -       dhcp_data{"scanresults"} = get_scan_results($c);  -       dhcp_data{"scanresults"} = get_scan_results($c);
14  +       $dhcp_data{"scanresults"} = get_scan_results($c);  -    $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data );
15       $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data );  +       # ..... 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 @@  @@ -332,10 +332,10 @@
22          my $c = shift;          my $c = shift;
23       my $ret = delete_all_leases($c);       my $ret = delete_all_leases($c);
# Line 23  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 31  diff -urN smeserver-dhcpmanager-2.0.4.ol
31       return ;       return ;
32   }   }
33    
34  @@ -352,10 +352,10 @@  @@ -352,17 +352,17 @@
35       # else return "ok"       # else return "ok"
36       my $ret = delete_lease($c);       my $ret = delete_lease($c);
37          if ($ret == 'ok') {          if ($ret == 'ok') {
# Line 36  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 44  diff -urN smeserver-dhcpmanager-2.0.4.ol
44       return ;       return ;
45   }   }
46    
47  @@ -536,4 +536,4 @@   sub get_scan_results {
48            my $c = shift;
49            #...do it
50    -       return "results";
51    +       return Scan_Local_Network($c);
52     }
53            
54    
55    @@ -374,13 +374,13 @@
56    
57     sub delete_one_lease {
58            my $c = shift;  
59    -    # ...do it
60    +       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);
138    +    my @bits;
139    +    my $binmask;
140    +    my $binoct;
141    +    my $bitcount=0;
142    +
143    +    foreach (@octet) {
144    +      $binoct = dec2bin($_);
145    +      $binmask = $binmask . substr $binoct, -8;
146    +    }
147    +
148    +    # let's count the 1s
149    +    @bits = split (//,$binmask);
150    +    foreach (@bits) {
151    +      if ($_ eq "1") {
152    +        $bitcount++;
153    +      }
154    +    }
155    +    my $cidr = $network . "/" . $bitcount;
156    +    return $cidr;
157    +}
158    +
159    +sub get_mac_address {
160    +       # From the leases file
161    +    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  trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s };
183    +
184    +sub get_mac_address_by_ping {
185    +    my ($ip) = trim(@_);
186    +    # Ping the IP to ensure it's in the ARP table
187    +    my $ping_result = `ping -c 1 -W 1 $ip`;
188    +    if($ping_result =~ /1 packets transmitted, 1 received/) {
189    +        # Fetch the ARP table and find the line with the IP address
190    +        my $arp_result = `arp -an | grep "\($ip)"`;
191    +        # If found, return the MAC address
192    +        return $arp_result;
193    +        if ($arp_result =~ /.*at ((?:[0-9a-f]{2}\:){5}[0-9a-f]{2})/) {
194    +            return $1;
195    +        } else { return "not in arp table"}
196    +    } else { return "no ping"}
197    +    return undef;
198    +}
199    +
200    +
201    +
202    +sub Scan_Local_Network ($) {          
203    +  
204    +        my $nmap_sme = esmith::ConfigDB->open('/home/e-smith/db/configuration');
205    +        my $mask = $nmap_sme->get_value('LocalNetmask');
206    +        my $network = $nmap_sme->get_prop('InternalInterface','Network');
207    +
208    +#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    +
211    +#ok go to use nmap with nmap -T4 -sP network/cidr
212    +       my @nmap_output= `/usr/bin/nmap --script smb-os-discovery.nse -p U:137,T:139 $cidr|
213    +                               /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    +
235    +
236     #=========================================================================
237     # Procedure qui charge le dhcpd.conf
238     # retourne un tableau contenant les informations
239    @@ -536,4 +697,4 @@
240    
241   1;   1;
242    
243  -        -      
244  \ No newline at end of file  \ No newline at end of file
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
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
248    +++ 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 @@
250    +package SrvMngr::I18N::Modules::Dhcpd::en;
251    +use strict;
252    +use warnings;
253    +use utf8;
254    +use Mojo::Base 'SrvMngr::I18N';
255    +
256    +use SrvMngr::I18N::Modules::General::en;
257    +
258    +my %lexicon = (
259    +    'dhcpd_ACTION'                      => 'Action',
260    +    'dhcpd_ACTIVE_DEVICE'           => 'Active Device',
261    +    'dhcpd_ALL_OF_THEM'               => 'All of them',
262    +    'dhcpd_CHECK_CLIENT_STATUS'  =>      'Always check the status of computers (Disabled is much faster)',
263    +    'dhcpd_CLEAN_ALL_DHCPLEASES'    => 'You may want to clean the dhcpd.leases',
264    +    'dhcpd_CLICK_HERE_TO_MAIN_PANEL'              => 'Return to the main panel',
265    +    'dhcpd_CONNECTED_IP'         => 'Show DHCP Clients',
266    +    'dhcpd_CUSTOM_DNS_STATUS'        => 'Custom DNS',
267    +    'dhcpd_CUSTOM_DNS_TITLE'         => 'Enable custom DNS servers.',
268    +    'dhcpd_CUSTOM_GATEWAY_ADDRESS'   => 'Gateway address',
269    +    'dhcpd_CUSTOM_GATEWAY_STATUS'    => 'Custom gateway',
270    +    'dhcpd_CUSTOM_GATEWAY_TITLE'     => 'Enable a custom gateway address.',
271    +    'dhcpd_CUSTOM_LEASETIME' => 'Custom lease time',
272    +    'dhcpd_CUSTOM_LEASETIME_TITLE'   =>      'Set the lease time (default is 86400 seconds).',
273    +    'dhcpd_CUSTOM_WINSERVER_ADDRESS' => 'WINS Server address',
274    +    'dhcpd_CUSTOM_WINSERVER_STATUS'  => 'WINS Server',
275    +    'dhcpd_CUSTOM_WINSERVER_TITLE'   => 'Enable a WINS Server.',
276    +    'dhcpd_DHCPD_SETTING_ERRORS'               => 'DHCPd Settings ERRORS',
277    +    'dhcpd_DHCPD_SETTINGS_TITLE' => 'DHCP server settings',
278    +    'dhcpd_DHCPD_TITLE'          => 'DHCP Manager',
279    +    'dhcpd_DHCP_END'                 => 'DHCP End',
280    +    'dhcpd_DHCP manager'         => 'DHCP Manager',
281    +    'dhcpd_DHCP_RANGE_MUST_NOT_INCLUDE_SERVER_IP' =>'Incorrect range of IPs, the range of IP address allocation must not include the server address, Update unsuccessfull',
282    +    'dhcpd_DHCP_RANGE_WITH_BAD_IP' =>      'Incorrect IP in the DHCP range, Update unsuccessfull',
283    +    'dhcpd_DHCP_START'               => 'DHCP Start',
284    +    'dhcpd_DHCP_START_GREATER_DHCP_END_ERRORS' =>'Incorrect range of IPs, the DHCP Start is greater than the DHCP End , Update unsuccessfull',
285    +    'dhcpd_DISABLED'                    => 'Disabled',
286    +    'dhcpd_DNS_SERVER_WITH_BAD_IP' =>      'Incorrect IP for DNS servers, Update unsuccessfull',
287    +    'dhcpd_DO_YOU_WANT_TO_SENT'       => 'Do you want to send this message to',
288    +    'dhcpd_ENABLED'                     => 'Enabled',
289    +    'dhcpd_END_DATE'                => 'End Date',
290    +    'dhcpd_ERROR_WHILE_REMOVING_ALL_LEASES' =>      'Error while removing all dhcpd Leases',
291    +    'dhcpd_ERROR_WHILE_SAVING_SETTINGS' => 'Error while saving settings',
292    +    'dhcpd_GATEWAY_BAD_IP' => 'Incorrect IP for Gateway, Update unsuccessfull',
293    +    'dhcpd_GLOBAL_WINPOPUP'      => 'Send Global Netsend WinPopup',
294    +    'dhcpd_GLOBAL_WINPOPUP_TITLE' =>      'Send a global WinPopup with the Net send protocol',
295    +    'dhcpd_IP'                          => 'Ip Address',
296    +    'dhcpd_MAC_ADDRESS'             => 'MAC Address',
297    +    'dhcpd_MANAGING_DHCP_CLIENT'      => 'Managing DHCP clients',
298    +    'dhcpd_NETWORK_NAME'            => 'Network Name',
299    +    'dhcpd_NETWORK_VALUES_FOUND' =>      'Please wait .... Your subnet and your netmask appear to be :',
300    +    'dhcpd_NO_CONNECTED_COMPUTERS'  => 'There are no connected computers',
301    +    'dhcpd_NOT_CHECKED'             => 'Not Checked...',
302    +    'dhcpd_PRIMARY_DNS_ADDRESS'      => 'Primary DNS',
303    +    'dhcpd_REFRESH_CONNECTED_IP_LIST' => 'You may want to refresh this list ?',
304    +    'dhcpd_REFRESH'                   => 'Refresh the list',
305    +    'dhcpd_REMOVE_ACTION'           => 'Remove...',
306    +    'dhcpd_REMOVE_A_DHCP_LEASE_ACTION' =>      'You are about to remove a client from the dhcpd.leases file.',
307    +    'dhcpd_REMOVE_A_DHCP_LEASE' => 'Remove a DHCP lease',
308    +    'dhcpd_ARE_YOU_SURE' => 'are you sure ?',
309    +    'dhcpd_REMOVE_A_DHCP_LEASE_TITLE'   => 'Removing a DHCP Lease',
310    +    'dhcpd_REMOVE_ALL_LEASES_ACTION' => 'Remove all dhcpd leases',
311    +    'dhcpd_REMOVE_ALL_LEASES'       => 'Remove all leases',
312    +    'dhcpd_REMOVE_DHCP_LEASE_TITLE' => 'Removing all DHCP Lease',
313    +    'dhcpd_REMOVE_DHCP_LEASE_WARNING' =>      'Remove all entries in dhcpd.leases may cause issues',
314    +    'dhcpd_REMOVE'                          => 'Remove',
315    +    'dhcpd_SAVE/RESTART'                       => 'Save/Restart',
316    +    'dhcpd_SAVE_TITLE'       =>      'After changing settings above, you must save and restart dhcpd.',
317    +    'dhcpd_SCANNING_NETWORK_TITLE'   =>      'Scanning your network, the time needed depends on your subnet mask',
318    +    'dhcpd_SCAN_YOUR_NETWORK'    => 'Scan your network',
319    +    'dhcpd_SCAN_YOUR_NETWORK_TITLE' =>      'Scan your network to show active devices :',
320    +    'dhcpd_SECONDARY_DNS_ADDRESS'    => 'Secondary DNS',
321    +    'dhcpd_SENDING_A_WINPOPUP'        => 'Sending a WinPopup',
322    +    'dhcpd_SENDING_A_WINPOPUP_TO'     => 'You are about to send a WinPopup to ',
323    +    'dhcpd_SEND_WINPOPUP_TO'          => 'Send a WinPopup to',
324    +    'dhcpd_SHOW_CONNECTED_IP_TITLE' =>      'Show all devices connected to the dhcpd server :',
325    +    'dhcpd_START_DATE'              => 'Start Date',
326    +    'dhcpd_STATUS_CLICK_FOR_WOL'    => 'Status - click for WOL',
327    +    'dhcpd_STATUS_DHCP_SERVER'       => 'State of DHCPD',
328    +    'dhcpd_STATUS_REPORT'             => 'Operation status report :',
329    +    'dhcpd_SUCCESSFULLY_CLIENT_WOL_REQUEST' =>'Successfull request to wake up the client. The computer may take time to wake up.',
330    +    'dhcpd_SUCCESSFULLY_DELETED_THE_CLIENT' =>      'Successfully deleted  the client in dhcpd.leases  : ',
331    +    'dhcpd_SUCCESSFULLY_REMOVED_ALL_LEASES' =>      'Successfully deleted all leases.',
332    +    'dhcpd_SUCCESSFULLY_SAVED_SETTINGS' => 'Successfully saved settings',
333    +    'dhcpd_SUCCESSFULLY_SENT_MESSAGE' => 'Successfully sent message popup to',
334    +    'dhcpd_TERTIARY_DNS_ADDRESS'     => 'Tertiary DNS',
335    +    'dhcpd_WAKE_UP_ACTION'          => '<font color="red">Wake-Up...</font>',
336    +    'dhcpd_WAKE_UP'                         => 'Wake UP',
337    +    'dhcpd_WAKING_A_REMOTE_COMPUTER_ACTION' =>      'Are you sure you want to wake on lan the client  : ',
338    +    'dhcpd_WAKING_A_REMOTE_COMPUTER_TITLE' => 'Waking Up a remote computer',
339    +    'dhcpd_WAKING_A_REMOTE_COMPUTER'       =>      'You are about to wake up  a remote computer.',
340    +    'dhcpd_WARNING_NO_WINPOPUP_GARANTY' =>'Warning, there is no guarantee that the popup will appear on the remote computer.',
341    +    'dhcpd_WINPOPUP_ACTION'         => 'WinPopup...',
342    +    'dhcpd_WINSSERVER_BAD_IP' =>      'Incorrect IP for WINS Server, Update unsuccessfull',
343    +    'dhcpd_WRITE_YOUR_MESSAGE'        => 'Write your message here',
344    +    'dhcpd_YOUR_MESSAGE'              => 'Your message',
345    +    'dhcpd_REMOVE_DHCP_LEASE_WARNING2' =>      'The lease file is a log-structured file - whenever a lease changes, the
346    +       contents of that lease are written to the end of the file. This means that it is entirely possible for there to  be  two
347    +       or  more  declarations  of the same lease in the lease file at the same
348    +       time. In that case,  the  instance  of  that  particular  lease  that
349    +       appears last in the file is the one that is in effect.',
350    +);
351    +
352    +our %Lexicon = (
353    +       %{ SrvMngr::I18N::Modules::General::en::Lexicon },
354    +       %lexicon
355    +);
356    +
357    +
358    +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-19 11:12: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  @@ -63,9 +63,12 @@  @@ -49,24 +49,26 @@
363                  </button>  
364                  </td><td>          % if ($dhcp_data->{trt} eq 'LEASES') {
365                  %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3'                  %= include 'partials/_dhcpd_leases'
366    -       %} elsif ($dhcp_data->{trt} eq 'WINPOPUP') {
367    -               %= include 'partials/_dhcpd_winpopup'
368            %} elsif ($dhcp_data->{trt} eq 'SCAN') {
369                    %= include 'partials/_dhcpd_scan'
370            %} 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])$';
372    -               <table><tr><td>
373    -               %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases"
374    -               <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="load" style="display:true">
375    -                 Scanning  <!--%= $c->l('dhcpd_CONNECTED_IP')-->
376    -                 <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 2024-01-16 12:32: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 103  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_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_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_scan.html.ep   2024-01-20 17:30:00.000000000 +0000
505    @@ -0,0 +1,63 @@
506    +<div id='dhcpd-scan'>
507    +       <table><tr><td>
508    +       %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd3', onclick=>"showSpinnerNetwork1()", id=>"scanNetwork1"
509    +       <button class ="btn btn-primary spinnerButtonOverlay"  type = "submit" id="loadingNetwork1" style="display:true">
510    +         Scanning  <!--%= $c->l('dhcpd_CONNECTED_IP')-->
511    +         <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>
520    +                       <th class='sme-border'>
521    +                               %=l 'dhcpd_NETWORK_NAME'
522    +                       </th>
523    +                       <th class='sme-border'>
524    +                               %=l 'dhcpd_IP'
525    +                       </th>
526    +                       <th class='sme-border'>
527    +                               %=l 'dhcpd_MAC_ADDRESS'
528    +                       </th>
529    +
530    +               </tr>
531    +               </thead>
532    +               <tbody>
533    +        % foreach my $ip (@$scanresults) {
534    +        <tr>
535    +                       %= t td => (class => 'sme-border') => $ip->{Network}
536    +                       %= t td => (class => 'sme-border') => $ip->{ip}
537    +                       %= t td => (class => 'sme-border') => $ip->{mac}
538    +               </tr>
539    +               %}
540    +               </tbody>
541    +       </table>
542    +       %= hidden_field "hiddenmsg"=>"", id=>"hiddenmsg"
543    +       <br />
544    +       %= 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>
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