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-16 08:38:00.000000000 +0000 |
4 |
@@ -117,22 +117,41 @@ |
@@ -144,7 +144,7 @@ |
|
$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 { |
|
|
# |
|
|
# call to show scan results |
|
|
@@ -140,12 +159,13 @@ |
|
|
my $c = shift; |
|
|
my $title = $c->l("dhcpd_SCANNING_NETWORK_TITLE"); |
|
|
my $modul = ''; |
|
|
- my $trt = "NETSCAN"; |
|
|
+ my $trt = "SCAN"; |
|
5 |
$dhcp_data{trt} = $trt; |
$dhcp_data{trt} = $trt; |
6 |
$dhcp_data{"first"} = ''; |
$dhcp_data{"first"} = ''; |
7 |
# ..... get scan results into dhcp_data |
# ..... get scan results into dhcp_data |
8 |
- dhcp_data{"scanresults"} = get_scan_results($c); |
- dhcp_data{"scanresults"} = get_scan_results($c); |
9 |
- $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data ); |
+ $dhcp_data{"scanresults"} = get_scan_results($c); |
10 |
+ $dhcp_data{"cidr"} = netmask2cidr($c); |
$c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data ); |
|
+ my @scanresults = get_scan_results($c); |
|
|
+ $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data, scanresults => @scanresults ); |
|
11 |
$c->render( template => 'dhcpd' ); |
$c->render( template => 'dhcpd' ); |
12 |
} |
} |
13 |
|
@@ -332,10 +332,10 @@ |
|
@@ -314,7 +334,6 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
- |
|
|
# - 4 expand templates |
|
|
# changed to new sme standard signal-event |
|
|
system ("/sbin/e-smith/signal-event","workgroup-update") == 0 |
|
|
@@ -332,10 +351,10 @@ |
|
14 |
my $c = shift; |
my $c = shift; |
15 |
my $ret = delete_all_leases($c); |
my $ret = delete_all_leases($c); |
16 |
if ($ret == 'ok') { |
if ($ret == 'ok') { |
17 |
- dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS"; |
- dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS"; |
18 |
+ $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_REMOVED_ALL_LEASES"; |
+ $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS"; |
19 |
do_leases($c); |
do_leases($c); |
20 |
} |
} |
21 |
- else {dhcp_data{"error"}=$ret;} |
- else {dhcp_data{"error"}=$ret;} |
23 |
return ; |
return ; |
24 |
} |
} |
25 |
|
|
26 |
@@ -352,17 +371,39 @@ |
@@ -352,10 +352,10 @@ |
27 |
# else return "ok" |
# else return "ok" |
28 |
my $ret = delete_lease($c); |
my $ret = delete_lease($c); |
29 |
if ($ret == 'ok') { |
if ($ret == 'ok') { |
30 |
- dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS"; |
- dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS"; |
31 |
+ $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_DELETED_THE_CLIENT"; |
+ $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS"; |
32 |
do_leases($c); |
do_leases($c); |
33 |
} |
} |
34 |
- else {dhcp_data{"error"}=$ret;} |
- else {dhcp_data{"error"}=$ret;} |
36 |
return ; |
return ; |
37 |
} |
} |
38 |
|
|
39 |
sub get_scan_results { |
@@ -536,4 +536,4 @@ |
|
my $c = shift; |
|
|
- #...do it |
|
|
- return "results"; |
|
|
+ my $cidr = netmask2cidr($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; |
|
|
} |
|
|
|
|
|
|
|
|
@@ -374,13 +415,45 @@ |
|
|
|
|
|
sub delete_one_lease { |
|
|
my $c = shift; |
|
|
- # ...do it |
|
|
+ |
|
|
+ ###Pull entry to delete |
|
|
+ my $ip = $c->param('host'); |
|
|
+ my $name = $c->param('name'); |
|
|
+ my $name_in_file = '/var/lib/dhcpd/dhcpd.leases' ; |
|
|
+ my $name_tmp_file = '/var/lib/dhcpd/dhcpd.leases.tmp' ; |
|
|
+ my $name_out_file = '/var/lib/dhcpd/dhcpd.leases~' ; |
|
|
+ my $del_current = "0" ; |
|
|
+ |
|
|
+ open(INFILE,"<$name_in_file") || die "Read Error $name_in_file, Read: $!"; |
|
|
+ open(OUTFILE,">$name_tmp_file") || die "Write error $name_in_file, Write: $!"; |
|
|
+ while (<INFILE>) { |
|
|
+ if ( "$_" =~ /lease $ip/ ) { |
|
|
+ $del_current = "1" ; |
|
|
+ } |
|
|
+ if ( $del_current == "0" ) { print OUTFILE "$_" ; } |
|
|
+ if ( "$_" =~ /}/ ) { |
|
|
+ $del_current = "0" ; |
|
|
+ } |
|
|
+ } |
|
|
+ rename ($name_tmp_file,$name_in_file) ; |
|
|
+ system ("/bin/cp","-f","$name_in_file","$name_out_file") ; |
|
|
+ close(INFILE); |
|
|
+ close(OUTFILE); |
|
|
+ |
|
|
+ # changed to new sme standard signal-event |
|
|
+ system ("/sbin/e-smith/signal-event","workgroup-update") == 0 |
|
|
+ or die "Error while saving settings: $!"; |
|
|
return "ok"; |
|
|
} |
|
|
|
|
|
sub delete_all_leases { |
|
|
my $c = shift; |
|
|
- # ...do it |
|
|
+ system ('/bin/echo "" > /var/lib/dhcpd/dhcpd.leases') ==0 |
|
|
+ or die "Error while removing all leases: $!"; |
|
|
+ |
|
|
+ system ("/sbin/e-smith/signal-event","workgroup-update") == 0 |
|
|
+ or die "Error while saving settings: $!"; |
|
|
+ |
|
|
return "ok"; |
|
|
} |
|
|
|
|
|
@@ -498,13 +571,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 +602,4 @@ |
|
40 |
|
|
41 |
1; |
1; |
42 |
|
|
43 |
- |
- |
44 |
\ No newline at end of file |
\ No newline at end of file |
45 |
+ |
+ |
|
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 |
|
|
--- 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/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm 2023-12-30 11:30:00.000000000 +0000 |
|
|
@@ -0,0 +1,109 @@ |
|
|
+package SrvMngr::I18N::Modules::Dhcpd::en; |
|
|
+use strict; |
|
|
+use warnings; |
|
|
+use utf8; |
|
|
+use Mojo::Base 'SrvMngr::I18N'; |
|
|
+ |
|
|
+use SrvMngr::I18N::Modules::General::en; |
|
|
+ |
|
|
+my %lexicon = ( |
|
|
+ 'dhcpd_ACTION' => 'Action', |
|
|
+ 'dhcpd_ACTIVE_DEVICE' => 'Active Device', |
|
|
+ 'dhcpd_ALL_OF_THEM' => 'All of them', |
|
|
+ 'dhcpd_CHECK_CLIENT_STATUS' => 'Always check the status of computers (Disabled is much faster)', |
|
|
+ 'dhcpd_CLEAN_ALL_DHCPLEASES' => 'You may want to clean the dhcpd.leases', |
|
|
+ 'dhcpd_CLICK_HERE_TO_MAIN_PANEL' => 'Return to the main panel', |
|
|
+ 'dhcpd_CONNECTED_IP' => 'Show DHCP Clients', |
|
|
+ 'dhcpd_CUSTOM_DNS_STATUS' => 'Custom DNS', |
|
|
+ 'dhcpd_CUSTOM_DNS_TITLE' => 'Enable custom DNS servers.', |
|
|
+ 'dhcpd_CUSTOM_GATEWAY_ADDRESS' => 'Gateway address', |
|
|
+ 'dhcpd_CUSTOM_GATEWAY_STATUS' => 'Custom gateway', |
|
|
+ 'dhcpd_CUSTOM_GATEWAY_TITLE' => 'Enable a custom gateway address.', |
|
|
+ 'dhcpd_CUSTOM_LEASETIME' => 'Custom lease time', |
|
|
+ 'dhcpd_CUSTOM_LEASETIME_TITLE' => 'Set the lease time (default is 86400 seconds).', |
|
|
+ 'dhcpd_CUSTOM_WINSERVER_ADDRESS' => 'WINS Server address', |
|
|
+ 'dhcpd_CUSTOM_WINSERVER_STATUS' => 'WINS Server', |
|
|
+ 'dhcpd_CUSTOM_WINSERVER_TITLE' => 'Enable a WINS Server.', |
|
|
+ 'dhcpd_DHCPD_SETTING_ERRORS' => 'DHCPd Settings ERRORS', |
|
|
+ 'dhcpd_DHCPD_SETTINGS_TITLE' => 'DHCP server settings', |
|
|
+ 'dhcpd_DHCPD_TITLE' => 'DHCP Manager', |
|
|
+ 'dhcpd_DHCP_END' => 'DHCP End', |
|
|
+ 'dhcpd_DHCP manager' => 'DHCP Manager', |
|
|
+ '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', |
|
|
+ 'dhcpd_DHCP_RANGE_WITH_BAD_IP' => 'Incorrect IP in the DHCP range, Update unsuccessfull', |
|
|
+ 'dhcpd_DHCP_START' => 'DHCP Start', |
|
|
+ 'dhcpd_DHCP_START_GREATER_DHCP_END_ERRORS' =>'Incorrect range of IPs, the DHCP Start is greater than the DHCP End , Update unsuccessfull', |
|
|
+ 'dhcpd_DISABLED' => 'Disabled', |
|
|
+ 'dhcpd_DNS_SERVER_WITH_BAD_IP' => 'Incorrect IP for DNS servers, Update unsuccessfull', |
|
|
+ 'dhcpd_DO_YOU_WANT_TO_SENT' => 'Do you want to send this message to', |
|
|
+ 'dhcpd_ENABLED' => 'Enabled', |
|
|
+ 'dhcpd_END_DATE' => 'End Date', |
|
|
+ 'dhcpd_ERROR_WHILE_REMOVING_ALL_LEASES' => 'Error while removing all dhcpd Leases', |
|
|
+ 'dhcpd_ERROR_WHILE_SAVING_SETTINGS' => 'Error while saving settings', |
|
|
+ 'dhcpd_GATEWAY_BAD_IP' => 'Incorrect IP for Gateway, Update unsuccessfull', |
|
|
+ 'dhcpd_GLOBAL_WINPOPUP' => 'Send Global Netsend WinPopup', |
|
|
+ 'dhcpd_GLOBAL_WINPOPUP_TITLE' => 'Send a global WinPopup with the Net send protocol', |
|
|
+ 'dhcpd_IP' => 'Ip Address', |
|
|
+ 'dhcpd_MAC_ADDRESS' => 'MAC Address', |
|
|
+ 'dhcpd_MANAGING_DHCP_CLIENT' => 'Managing DHCP clients', |
|
|
+ 'dhcpd_NETWORK_NAME' => 'Network Name', |
|
|
+ 'dhcpd_NETWORK_VALUES_FOUND' => 'Please wait .... Your subnet and your netmask appear to be :', |
|
|
+ 'dhcpd_NO_CONNECTED_COMPUTERS' => 'There are no connected computers', |
|
|
+ 'dhcpd_NOT_CHECKED' => 'Not Checked...', |
|
|
+ 'dhcpd_PRIMARY_DNS_ADDRESS' => 'Primary DNS', |
|
|
+ 'dhcpd_REFRESH_CONNECTED_IP_LIST' => 'You may want to refresh this list ?', |
|
|
+ 'dhcpd_REFRESH' => 'Refresh the list', |
|
|
+ 'dhcpd_REMOVE_ACTION' => 'Remove...', |
|
|
+ 'dhcpd_REMOVE_A_DHCP_LEASE_ACTION' => 'You are about to remove a client from the dhcpd.leases file.', |
|
|
+ 'dhcpd_REMOVE_A_DHCP_LEASE' => 'Remove a DHCP lease', |
|
|
+ 'dhcpd_ARE_YOU_SURE' => 'are you sure ?', |
|
|
+ 'dhcpd_REMOVE_A_DHCP_LEASE_TITLE' => 'Removing a DHCP Lease', |
|
|
+ 'dhcpd_REMOVE_ALL_LEASES_ACTION' => 'Remove all dhcpd leases', |
|
|
+ 'dhcpd_REMOVE_ALL_LEASES' => 'Remove all leases', |
|
|
+ 'dhcpd_REMOVE_DHCP_LEASE_TITLE' => 'Removing all DHCP Lease', |
|
|
+ 'dhcpd_REMOVE_DHCP_LEASE_WARNING' => 'Remove all entries in dhcpd.leases may cause issues', |
|
|
+ 'dhcpd_REMOVE' => 'Remove', |
|
|
+ 'dhcpd_SAVE/RESTART' => 'Save/Restart', |
|
|
+ 'dhcpd_SAVE_TITLE' => 'After changing settings above, you must save and restart dhcpd.', |
|
|
+ 'dhcpd_SCANNING_NETWORK_TITLE' => 'Scanning your network, the time needed depends on your subnet mask', |
|
|
+ 'dhcpd_SCAN_YOUR_NETWORK' => 'Scan your network', |
|
|
+ 'dhcpd_SCAN_YOUR_NETWORK_TITLE' => 'Scan your network to show active devices :', |
|
|
+ 'dhcpd_SECONDARY_DNS_ADDRESS' => 'Secondary DNS', |
|
|
+ 'dhcpd_SENDING_A_WINPOPUP' => 'Sending a WinPopup', |
|
|
+ 'dhcpd_SENDING_A_WINPOPUP_TO' => 'You are about to send a WinPopup to ', |
|
|
+ 'dhcpd_SEND_WINPOPUP_TO' => 'Send a WinPopup to', |
|
|
+ 'dhcpd_SHOW_CONNECTED_IP_TITLE' => 'Show all devices connected to the dhcpd server :', |
|
|
+ 'dhcpd_START_DATE' => 'Start Date', |
|
|
+ 'dhcpd_STATUS_CLICK_FOR_WOL' => 'Status - click for WOL', |
|
|
+ 'dhcpd_STATUS_DHCP_SERVER' => 'State of DHCPD', |
|
|
+ 'dhcpd_STATUS_REPORT' => 'Operation status report :', |
|
|
+ 'dhcpd_SUCCESSFULLY_CLIENT_WOL_REQUEST' =>'Successfull request to wake up the client. The computer may take time to wake up.', |
|
|
+ 'dhcpd_SUCCESSFULLY_DELETED_THE_CLIENT' => 'Successfully deleted the client in dhcpd.leases : ', |
|
|
+ 'dhcpd_SUCCESSFULLY_REMOVED_ALL_LEASES' => 'Successfully deleted all leases.', |
|
|
+ 'dhcpd_SUCCESSFULLY_SAVED_SETTINGS' => 'Successfully saved settings', |
|
|
+ 'dhcpd_SUCCESSFULLY_SENT_MESSAGE' => 'Successfully sent message popup to', |
|
|
+ 'dhcpd_TERTIARY_DNS_ADDRESS' => 'Tertiary DNS', |
|
|
+ 'dhcpd_WAKE_UP_ACTION' => '<font color="red">Wake-Up...</font>', |
|
|
+ 'dhcpd_WAKE_UP' => 'Wake UP', |
|
|
+ 'dhcpd_WAKING_A_REMOTE_COMPUTER_ACTION' => 'Are you sure you want to wake on lan the client : ', |
|
|
+ 'dhcpd_WAKING_A_REMOTE_COMPUTER_TITLE' => 'Waking Up a remote computer', |
|
|
+ 'dhcpd_WAKING_A_REMOTE_COMPUTER' => 'You are about to wake up a remote computer.', |
|
|
+ 'dhcpd_WARNING_NO_WINPOPUP_GARANTY' =>'Warning, there is no guarantee that the popup will appear on the remote computer.', |
|
|
+ 'dhcpd_WINPOPUP_ACTION' => 'WinPopup...', |
|
|
+ 'dhcpd_WINSSERVER_BAD_IP' => 'Incorrect IP for WINS Server, Update unsuccessfull', |
|
|
+ 'dhcpd_WRITE_YOUR_MESSAGE' => 'Write your message here', |
|
|
+ 'dhcpd_YOUR_MESSAGE' => 'Your message', |
|
|
+ 'dhcpd_REMOVE_DHCP_LEASE_WARNING2' => 'The lease file is a log-structured file - whenever a lease changes, the |
|
|
+ contents of that lease are written to the end of the file. This means that it is entirely possible for there to be two |
|
|
+ or more declarations of the same lease in the lease file at the same |
|
|
+ time. In that case, the instance of that particular lease that |
|
|
+ appears last in the file is the one that is in effect.', |
|
|
+); |
|
|
+ |
|
|
+our %Lexicon = ( |
|
|
+ %{ SrvMngr::I18N::Modules::General::en::Lexicon }, |
|
|
+ %lexicon |
|
|
+); |
|
|
+ |
|
|
+ |
|
|
+1; |
|
46 |
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 |
47 |
--- 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 |
48 |
+++ 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 2023-12-19 11:12:00.000000000 +0000 |
49 |
@@ -49,23 +49,30 @@ |
@@ -63,9 +63,12 @@ |
|
|
|
|
% if ($dhcp_data->{trt} eq 'LEASES') { |
|
|
%= include 'partials/_dhcpd_leases' |
|
|
- %} elsif ($dhcp_data->{trt} eq 'WINPOPUP') { |
|
|
- %= include 'partials/_dhcpd_winpopup' |
|
|
%} elsif ($dhcp_data->{trt} eq 'SCAN') { |
|
|
- %= include 'partials/_dhcpd_scan' |
|
|
+ %= include 'partials/_dhcpd_scanresults' |
|
|
%} else { #PARAMS |
|
|
% 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])$'; |
|
|
<table><tr><td> |
|
|
- %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases" |
|
|
- <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true"> |
|
|
- Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')--> |
|
|
+ %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showLeasesSpinner()", id=>"scanLeases" |
|
|
+ <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadLeases" style="display:true"> |
|
|
+ Scanning |
|
|
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> |
|
50 |
</button> |
</button> |
|
+ |
|
51 |
</td><td> |
</td><td> |
52 |
- %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3' |
%= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3' |
53 |
- </td><td> |
- </td><td> |
54 |
- %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2' |
- %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2' |
|
+ %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3', onclick=>"showNetworkSpinner()", id=>"scanNetwork" |
|
|
+ <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadNetwork" style="display:true"> |
|
|
+ Scanning |
|
|
+ <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> |
|
|
+ </button> |
|
|
+ |
|
55 |
+ </td> |
+ </td> |
56 |
+ <!-- |
+ <!-- |
57 |
<td> |
<td> |
61 |
</tr> |
</tr> |
62 |
</table> |
</table> |
63 |
<hr /> |
<hr /> |
|
@@ -179,10 +186,15 @@ |
|
|
</div> |
|
|
|
|
|
%= javascript begin |
|
|
- document.getElementById("load").style.display="none"; |
|
|
- function showSpinner(){ |
|
|
+ document.getElementById("loadLeases").style.display="none"; |
|
|
+ document.getElementById("loadNetwork").style.display="none"; |
|
|
+ function showLeasesSpinner(){ |
|
|
document.getElementById("scanLeases").style.display="none"; |
|
|
- 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"; |
|
|
} |
|
|
%end |
|
|
|
|
64 |
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 |
65 |
--- 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 |
66 |
+++ 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-16 12:32:00.000000000 +0000 |
|
@@ -1,8 +1,8 @@ |
|
|
<div id='dhcpd-leases'> |
|
|
<table><tr><td> |
|
|
- %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases" |
|
|
- <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true"> |
|
|
- Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')--> |
|
|
+ %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showLeaseSpinner()", id=>"scanLeases" |
|
|
+ <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadLease" style="display:true"> |
|
|
+ Scanning |
|
|
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> |
|
|
</button> |
|
|
|
|
67 |
@@ -26,7 +26,7 @@ |
@@ -26,7 +26,7 @@ |
68 |
%= submit_button "$btn", class => 'action' |
%= submit_button "$btn", class => 'action' |
69 |
% end |
% end |
96 |
</tr> |
</tr> |
97 |
%} |
%} |
98 |
</tbody> |
</tbody> |
99 |
@@ -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 @@ |
|
100 |
%end |
%end |
101 |
|
|
102 |
|
|
103 |
-</div> |
-</div> |
104 |
\ No newline at end of file |
\ No newline at end of file |
105 |
+</div> |
+</div> |
|
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 |
|
|
--- 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/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep 2023-12-31 13:59:00.000000000 +0000 |
|
|
@@ -0,0 +1,55 @@ |
|
|
+<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.4/css/jquery.dataTables.css"> |
|
|
+<script type="text/javascript" charset="utf8" src="https://code.jquery.com/jquery-3.6.0.min.js"></script> |
|
|
+<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.11.4/js/jquery.dataTables.js"></script> |
|
|
+ |
|
|
+<div id='dhcpd-scanresults'> |
|
|
+ |
|
|
+%#= 1/0 |
|
|
+ %= $c->l('dhcpd_NETWORK_VALUES_FOUND').$dhcp_data->{"cidr"}; |
|
|
+ %= form_for '/dhcpd10' => (method => 'POST') => begin |
|
|
+ <br /> |
|
|
+ <table id="scanresults" class="sme-border table-sort"><thead> |
|
|
+ <tr> |
|
|
+ <th class='sme-border'> |
|
|
+ %=l 'dhcpd_NETWORK_NAME' |
|
|
+ </th> |
|
|
+ <th class='sme-border'> |
|
|
+ %=l 'dhcpd_IP' |
|
|
+ </th> |
|
|
+ <th class='sme-border'> |
|
|
+ %=l 'dhcpd_MAC_ADDRESS' |
|
|
+ </th> |
|
|
+ <th class='sme-border'> |
|
|
+ %=l 'dhcpd_STATUS_CLICK_FOR_WOL' |
|
|
+ </th> |
|
|
+ </tr> |
|
|
+ </thead> |
|
|
+ <tbody> |
|
|
+ % foreach my $line (@$scanresults) { |
|
|
+ % my @thisline = @$line; |
|
|
+ <tr> |
|
|
+ <td class='sme-border'> |
|
|
+ %= "$thisline[4]"; |
|
|
+ </td> |
|
|
+ <td class='sme-border'> |
|
|
+ %= "$thisline[5]"; |
|
|
+ </td> |
|
|
+ <td class='sme-border'> |
|
|
+ </td> |
|
|
+ <td class='sme-border'> |
|
|
+ </td> |
|
|
+ </tr> |
|
|
+ %} |
|
|
+ </table> |
|
|
+ % end |
|
|
+ %= 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> |
|
|
+ |
|