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

Contents 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


Revision 1.8 - (show annotations) (download)
Tue Jan 23 10:54:38 2024 UTC (3 months, 1 week ago) by brianr
Branch: MAIN
CVS Tags: smeserver-dhcpmanager-2_0_4-17_el7_sme, smeserver-dhcpmanager-2_0_4-16_el7_sme, smeserver-dhcpmanager-2_0_4-15_el7_sme, HEAD
Changes since 1.7: +27 -16 lines
*** empty log message ***

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
2 --- 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-23 10:14:00.000000000 +0000
4 @@ -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' );
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 # delete it
36 # If deletion not ok return message
37 # else return "ok"
38 - my $ret = delete_lease($c);
39 + 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;
52 #...do it
53 - return "results";
54 + return Scan_Local_Network($c);
55 }
56
57
58 @@ -374,13 +374,13 @@
59
60 sub delete_one_lease {
61 my $c = shift;
62 - # ...do it
63 + 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);
143 + my @bits;
144 + my $binmask;
145 + my $binoct;
146 + my $bitcount=0;
147 +
148 + foreach (@octet) {
149 + $binoct = dec2bin($_);
150 + $binmask = $binmask . substr $binoct, -8;
151 + }
152 +
153 + # let's count the 1s
154 + @bits = split (//,$binmask);
155 + foreach (@bits) {
156 + if ($_ eq "1") {
157 + $bitcount++;
158 + }
159 + }
160 + my $cidr = $network . "/" . $bitcount;
161 + return $cidr;
162 +}
163 +
164 +sub get_mac_address {
165 + # From the leases file
166 + 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 trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s };
188 +
189 +sub get_mac_address_by_ping {
190 + my ($ip) = trim(@_);
191 + # Ping the IP to ensure it's in the ARP table
192 + my $ping_result = `ping -c 1 -W 1 $ip`;
193 + #return $ping_result;
194 + if($ping_result =~ m/1 packets transmitted, 1 received/) {
195 + # Fetch the ARP table and find the line with the IP address
196 + my $mac_result = `nmap -PR -sn $ip`;
197 + #return "*$arp_result *$ip*";
198 + # If found, return the MAC address
199 + #if ($arp_result =~ m/.*at ((?:[0-9a-f]{2}\:){5}[0-9a-f]{2})/) {
200 + if ($mac_result =~ /MAC Address: (..:..:..:..:..:..) /) {
201 + return $1;
202 + } else { return "mac not in nmap result";}
203 + } else { return "no ping";}
204 + return undef;
205 +}
206 +
207 +
208 +
209 +sub Scan_Local_Network ($) {
210 +
211 + my $nmap_sme = esmith::ConfigDB->open('/home/e-smith/db/configuration');
212 + my $mask = $nmap_sme->get_value('LocalNetmask');
213 + my $network = $nmap_sme->get_prop('InternalInterface','Network');
214 +
215 +#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 +
218 +#ok go to use nmap with nmap -T4 -sP network/cidr
219 + my @nmap_output= `/usr/bin/nmap --script smb-os-discovery.nse -p U:137,T:139 $cidr|
220 + /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 +
242 +
243 #=========================================================================
244 # Procedure qui charge le dhcpd.conf
245 # retourne un tableau contenant les informations
246 @@ -536,4 +701,4 @@
247
248 1;
249
250 -
251 \ No newline at end of file
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
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
255 +++ 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 @@
257 +package SrvMngr::I18N::Modules::Dhcpd::en;
258 +use strict;
259 +use warnings;
260 +use utf8;
261 +use Mojo::Base 'SrvMngr::I18N';
262 +
263 +use SrvMngr::I18N::Modules::General::en;
264 +
265 +my %lexicon = (
266 + 'dhcpd_ACTION' => 'Action',
267 + 'dhcpd_ACTIVE_DEVICE' => 'Active Device',
268 + 'dhcpd_ALL_OF_THEM' => 'All of them',
269 + 'dhcpd_CHECK_CLIENT_STATUS' => 'Always check the status of computers (Disabled is much faster)',
270 + 'dhcpd_CLEAN_ALL_DHCPLEASES' => 'You may want to clean the dhcpd.leases',
271 + 'dhcpd_CLICK_HERE_TO_MAIN_PANEL' => 'Return to the main panel',
272 + 'dhcpd_CONNECTED_IP' => 'Show DHCP Clients',
273 + 'dhcpd_CUSTOM_DNS_STATUS' => 'Custom DNS',
274 + 'dhcpd_CUSTOM_DNS_TITLE' => 'Enable custom DNS servers.',
275 + 'dhcpd_CUSTOM_GATEWAY_ADDRESS' => 'Gateway address',
276 + 'dhcpd_CUSTOM_GATEWAY_STATUS' => 'Custom gateway',
277 + 'dhcpd_CUSTOM_GATEWAY_TITLE' => 'Enable a custom gateway address.',
278 + 'dhcpd_CUSTOM_LEASETIME' => 'Custom lease time',
279 + 'dhcpd_CUSTOM_LEASETIME_TITLE' => 'Set the lease time (default is 86400 seconds).',
280 + 'dhcpd_CUSTOM_WINSERVER_ADDRESS' => 'WINS Server address',
281 + 'dhcpd_CUSTOM_WINSERVER_STATUS' => 'WINS Server',
282 + 'dhcpd_CUSTOM_WINSERVER_TITLE' => 'Enable a WINS Server.',
283 + 'dhcpd_DHCPD_SETTING_ERRORS' => 'DHCPd Settings ERRORS',
284 + 'dhcpd_DHCPD_SETTINGS_TITLE' => 'DHCP server settings',
285 + 'dhcpd_DHCPD_TITLE' => 'DHCP Manager',
286 + 'dhcpd_DHCP_END' => 'DHCP End',
287 + 'dhcpd_DHCP manager' => 'DHCP Manager',
288 + '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',
289 + 'dhcpd_DHCP_RANGE_WITH_BAD_IP' => 'Incorrect IP in the DHCP range, Update unsuccessfull',
290 + 'dhcpd_DHCP_START' => 'DHCP Start',
291 + 'dhcpd_DHCP_START_GREATER_DHCP_END_ERRORS' =>'Incorrect range of IPs, the DHCP Start is greater than the DHCP End , Update unsuccessfull',
292 + 'dhcpd_DISABLED' => 'Disabled',
293 + 'dhcpd_DNS_SERVER_WITH_BAD_IP' => 'Incorrect IP for DNS servers, Update unsuccessfull',
294 + 'dhcpd_DO_YOU_WANT_TO_SENT' => 'Do you want to send this message to',
295 + 'dhcpd_ENABLED' => 'Enabled',
296 + 'dhcpd_END_DATE' => 'End Date',
297 + 'dhcpd_ERROR_WHILE_REMOVING_ALL_LEASES' => 'Error while removing all dhcpd Leases',
298 + 'dhcpd_ERROR_WHILE_SAVING_SETTINGS' => 'Error while saving settings',
299 + 'dhcpd_GATEWAY_BAD_IP' => 'Incorrect IP for Gateway, Update unsuccessfull',
300 + 'dhcpd_GLOBAL_WINPOPUP' => 'Send Global Netsend WinPopup',
301 + 'dhcpd_GLOBAL_WINPOPUP_TITLE' => 'Send a global WinPopup with the Net send protocol',
302 + 'dhcpd_IP' => 'Ip Address',
303 + 'dhcpd_MAC_ADDRESS' => 'MAC Address',
304 + 'dhcpd_MANAGING_DHCP_CLIENT' => 'Managing DHCP clients',
305 + 'dhcpd_NETWORK_NAME' => 'Network Name',
306 + 'dhcpd_NETWORK_VALUES_FOUND' => 'Please wait .... Your subnet and your netmask appear to be :',
307 + 'dhcpd_NO_CONNECTED_COMPUTERS' => 'There are no connected computers',
308 + 'dhcpd_NOT_CHECKED' => 'Not Checked...',
309 + 'dhcpd_PRIMARY_DNS_ADDRESS' => 'Primary DNS',
310 + 'dhcpd_REFRESH_CONNECTED_IP_LIST' => 'You may want to refresh this list ?',
311 + 'dhcpd_REFRESH' => 'Refresh the list',
312 + 'dhcpd_REMOVE_ACTION' => 'Remove...',
313 + 'dhcpd_REMOVE_A_DHCP_LEASE_ACTION' => 'You are about to remove a client from the dhcpd.leases file.',
314 + 'dhcpd_REMOVE_A_DHCP_LEASE' => 'Remove a DHCP lease',
315 + 'dhcpd_ARE_YOU_SURE' => 'are you sure ?',
316 + 'dhcpd_REMOVE_A_DHCP_LEASE_TITLE' => 'Removing a DHCP Lease',
317 + 'dhcpd_REMOVE_ALL_LEASES_ACTION' => 'Remove all dhcpd leases',
318 + 'dhcpd_REMOVE_ALL_LEASES' => 'Remove all leases',
319 + 'dhcpd_REMOVE_DHCP_LEASE_TITLE' => 'Removing all DHCP Lease',
320 + 'dhcpd_REMOVE_DHCP_LEASE_WARNING' => 'Remove all entries in dhcpd.leases may cause issues',
321 + 'dhcpd_REMOVE' => 'Remove',
322 + 'dhcpd_SAVE/RESTART' => 'Save/Restart',
323 + 'dhcpd_SAVE_TITLE' => 'After changing settings above, you must save and restart dhcpd.',
324 + 'dhcpd_SCANNING_NETWORK_TITLE' => 'Scanning your network, the time needed depends on your subnet mask',
325 + 'dhcpd_SCAN_YOUR_NETWORK' => 'Scan your network',
326 + 'dhcpd_SCAN_YOUR_NETWORK_TITLE' => 'Scan your network to show active devices :',
327 + 'dhcpd_SECONDARY_DNS_ADDRESS' => 'Secondary DNS',
328 + 'dhcpd_SENDING_A_WINPOPUP' => 'Sending a WinPopup',
329 + 'dhcpd_SENDING_A_WINPOPUP_TO' => 'You are about to send a WinPopup to ',
330 + 'dhcpd_SEND_WINPOPUP_TO' => 'Send a WinPopup to',
331 + 'dhcpd_SHOW_CONNECTED_IP_TITLE' => 'Show all devices connected to the dhcpd server :',
332 + 'dhcpd_START_DATE' => 'Start Date',
333 + 'dhcpd_STATUS_CLICK_FOR_WOL' => 'Status - click for WOL',
334 + 'dhcpd_STATUS_DHCP_SERVER' => 'State of DHCPD',
335 + 'dhcpd_STATUS_REPORT' => 'Operation status report :',
336 + 'dhcpd_SUCCESSFULLY_CLIENT_WOL_REQUEST' =>'Successfull request to wake up the client. The computer may take time to wake up.',
337 + 'dhcpd_SUCCESSFULLY_DELETED_THE_CLIENT' => 'Successfully deleted the client in dhcpd.leases : ',
338 + 'dhcpd_SUCCESSFULLY_REMOVED_ALL_LEASES' => 'Successfully deleted all leases.',
339 + 'dhcpd_SUCCESSFULLY_SAVED_SETTINGS' => 'Successfully saved settings',
340 + 'dhcpd_SUCCESSFULLY_SENT_MESSAGE' => 'Successfully sent message popup to',
341 + 'dhcpd_TERTIARY_DNS_ADDRESS' => 'Tertiary DNS',
342 + 'dhcpd_WAKE_UP_ACTION' => '<font color="red">Wake-Up...</font>',
343 + 'dhcpd_WAKE_UP' => 'Wake UP',
344 + 'dhcpd_WAKING_A_REMOTE_COMPUTER_ACTION' => 'Are you sure you want to wake on lan the client : ',
345 + 'dhcpd_WAKING_A_REMOTE_COMPUTER_TITLE' => 'Waking Up a remote computer',
346 + 'dhcpd_WAKING_A_REMOTE_COMPUTER' => 'You are about to wake up a remote computer.',
347 + 'dhcpd_WARNING_NO_WINPOPUP_GARANTY' =>'Warning, there is no guarantee that the popup will appear on the remote computer.',
348 + 'dhcpd_WINPOPUP_ACTION' => 'WinPopup...',
349 + 'dhcpd_WINSSERVER_BAD_IP' => 'Incorrect IP for WINS Server, Update unsuccessfull',
350 + 'dhcpd_WRITE_YOUR_MESSAGE' => 'Write your message here',
351 + 'dhcpd_YOUR_MESSAGE' => 'Your message',
352 + 'dhcpd_REMOVE_DHCP_LEASE_WARNING2' => 'The lease file is a log-structured file - whenever a lease changes, the
353 + contents of that lease are written to the end of the file. This means that it is entirely possible for there to be two
354 + or more declarations of the same lease in the lease file at the same
355 + time. In that case, the instance of that particular lease that
356 + appears last in the file is the one that is in effect.',
357 +);
358 +
359 +our %Lexicon = (
360 + %{ SrvMngr::I18N::Modules::General::en::Lexicon },
361 + %lexicon
362 +);
363 +
364 +
365 +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
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
368 +++ 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,24 +49,26 @@
370
371 % if ($dhcp_data->{trt} eq 'LEASES') {
372 %= include 'partials/_dhcpd_leases'
373 - %} elsif ($dhcp_data->{trt} eq 'WINPOPUP') {
374 - %= include 'partials/_dhcpd_winpopup'
375 %} elsif ($dhcp_data->{trt} eq 'SCAN') {
376 %= include 'partials/_dhcpd_scan'
377 %} 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])$';
379 - <table><tr><td>
380 - %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases"
381 - <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true">
382 - Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')-->
383 - <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>
388 - %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2'
389 - <td>
390 - </tr>
391 + <table>
392 + <tr>
393 + <td>
394 + %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinnerLeases()", id=>"scanLeases"
395 + <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>
408 <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
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
440 +++ 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 @@
471 %= submit_button "$btn", class => 'action'
472 % end
473 <br>
474 - <table class="sme-border table-sort"><tbody>
475 + <table class="sme-border table-sort"><thead>
476 <tr>
477 <th class='sme-border'>
478 %=l 'dhcpd_IP'
479 @@ -50,6 +50,8 @@
480 %=l 'dhcpd_ACTION'
481 </th>
482 </tr>
483 + </thead>
484 + <tbody>
485 % foreach my $ip (@$leases) {
486 <tr>
487 %= t td => (class => 'sme-border') => $ip->{ip}
488 @@ -65,9 +67,7 @@
489 %= t td => (class => 'sme-border') => $ip->{end}
490 %= t td => (class => 'sme-border') => $ip->{mac}
491 <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>
493 - </td><td class = 'sme-border'>
494 - <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>
496 </td>
497 </tr>
498 %}
499 @@ -102,7 +102,7 @@
500 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
510
511
512 -</div>
513 \ No newline at end of file
514 +</div>
515 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_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_scan.html.ep 2024-01-20 17:30:00.000000000 +0000
518 @@ -0,0 +1,63 @@
519 +<div id='dhcpd-scan'>
520 + <table><tr><td>
521 + %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd3', onclick=>"showSpinnerNetwork1()", id=>"scanNetwork1"
522 + <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadingNetwork1" style="display:true">
523 + Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')-->
524 + <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>
533 + <th class='sme-border'>
534 + %=l 'dhcpd_NETWORK_NAME'
535 + </th>
536 + <th class='sme-border'>
537 + %=l 'dhcpd_IP'
538 + </th>
539 + <th class='sme-border'>
540 + %=l 'dhcpd_MAC_ADDRESS'
541 + </th>
542 +
543 + </tr>
544 + </thead>
545 + <tbody>
546 + % foreach my $ip (@$scanresults) {
547 + <tr>
548 + %= t td => (class => 'sme-border') => $ip->{Network}
549 + %= t td => (class => 'sme-border') => $ip->{ip}
550 + %= t td => (class => 'sme-border') => $ip->{mac}
551 + </tr>
552 + %}
553 + </tbody>
554 + </table>
555 + %= hidden_field "hiddenmsg"=>"", id=>"hiddenmsg"
556 + <br />
557 + %= 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>
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

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