/[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.7 - (show annotations) (download)
Mon Jan 22 20:02:27 2024 UTC (3 months, 3 weeks ago) by brianr
Branch: MAIN
Changes since 1.6: +12 -10 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-22 19:57: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 @@ -352,17 +352,17 @@
35 # else return "ok"
36 my $ret = delete_lease($c);
37 if ($ret == 'ok') {
38 - dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";
39 + $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";
40 do_leases($c);
41 }
42 - else {dhcp_data{"error"}=$ret;}
43 + else {$dhcp_data{"error"}=$ret;}
44 return ;
45 }
46
47 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,169 @@
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 + #return $ping_result;
189 + if($ping_result =~ m/1 packets transmitted, 1 received/) {
190 + # Fetch the ARP table and find the line with the IP address
191 + my $mac_result = `nmap -PR -sn $ip`;
192 + #return "*$arp_result *$ip*";
193 + # If found, return the MAC address
194 + #if ($arp_result =~ m/.*at ((?:[0-9a-f]{2}\:){5}[0-9a-f]{2})/) {
195 + if ($mac_result =~ /MAC Address: (..:..:..:..:..:..) /) {
196 + return $1;
197 + } else { return "mac not in nmap result";}
198 + } else { return "no ping";}
199 + return undef;
200 +}
201 +
202 +
203 +
204 +sub Scan_Local_Network ($) {
205 +
206 + my $nmap_sme = esmith::ConfigDB->open('/home/e-smith/db/configuration');
207 + my $mask = $nmap_sme->get_value('LocalNetmask');
208 + my $network = $nmap_sme->get_prop('InternalInterface','Network');
209 +
210 +#we start to calculate the method to find the cidr (we want to use network/cidr with nmap)
211 + my $cidr = netmask2cidr($mask, $network);
212 +
213 +#ok go to use nmap with nmap -T4 -sP network/cidr
214 + my @nmap_output= `/usr/bin/nmap --script smb-os-discovery.nse -p U:137,T:139 $cidr|
215 + /bin/grep -Ev "MAC|NetBIOS|OS CPE"| /bin/grep -E "scan|done|Computer|OS"|
216 + /bin/sed -e 's/Nmap scan/-- Scan/g'|/bin/sed -e 's/done/Done/g'|
217 + /bin/sed -e 's/Nmap//g'|/bin/sed -e 's/|/ /g'`;
218 +
219 + my @extracted_output;
220 + my $leasefile = "/var/lib/dhcpd/dhcpd.leases";
221 + foreach my $line (@nmap_output) {
222 + if ($line =~ m/Scan report for ([\w\.-]+) \(([\d\.\:]+)\)/) {
223 + my $ip = $2;
224 + my $mac = get_mac_address($ip,$leasefile);
225 + if (!$mac){
226 + $mac = get_mac_address_by_ping($ip);
227 + }
228 +# if (!$mac) {$mac = "unknown";}
229 + my %pair = ('Network' => $1, 'ip' => $ip, 'mac' => $mac); # $1 => PC Name, $2 => IP Address
230 + push @extracted_output, \%pair;
231 + }
232 + }
233 + return \@extracted_output;
234 +}
235 +
236 +
237 +
238 #=========================================================================
239 # Procedure qui charge le dhcpd.conf
240 # retourne un tableau contenant les informations
241 @@ -536,4 +699,4 @@
242
243 1;
244
245 -
246 \ No newline at end of file
247 +
248 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
249 --- 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
250 +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm 2024-01-20 08:46:00.000000000 +0000
251 @@ -0,0 +1,109 @@
252 +package SrvMngr::I18N::Modules::Dhcpd::en;
253 +use strict;
254 +use warnings;
255 +use utf8;
256 +use Mojo::Base 'SrvMngr::I18N';
257 +
258 +use SrvMngr::I18N::Modules::General::en;
259 +
260 +my %lexicon = (
261 + 'dhcpd_ACTION' => 'Action',
262 + 'dhcpd_ACTIVE_DEVICE' => 'Active Device',
263 + 'dhcpd_ALL_OF_THEM' => 'All of them',
264 + 'dhcpd_CHECK_CLIENT_STATUS' => 'Always check the status of computers (Disabled is much faster)',
265 + 'dhcpd_CLEAN_ALL_DHCPLEASES' => 'You may want to clean the dhcpd.leases',
266 + 'dhcpd_CLICK_HERE_TO_MAIN_PANEL' => 'Return to the main panel',
267 + 'dhcpd_CONNECTED_IP' => 'Show DHCP Clients',
268 + 'dhcpd_CUSTOM_DNS_STATUS' => 'Custom DNS',
269 + 'dhcpd_CUSTOM_DNS_TITLE' => 'Enable custom DNS servers.',
270 + 'dhcpd_CUSTOM_GATEWAY_ADDRESS' => 'Gateway address',
271 + 'dhcpd_CUSTOM_GATEWAY_STATUS' => 'Custom gateway',
272 + 'dhcpd_CUSTOM_GATEWAY_TITLE' => 'Enable a custom gateway address.',
273 + 'dhcpd_CUSTOM_LEASETIME' => 'Custom lease time',
274 + 'dhcpd_CUSTOM_LEASETIME_TITLE' => 'Set the lease time (default is 86400 seconds).',
275 + 'dhcpd_CUSTOM_WINSERVER_ADDRESS' => 'WINS Server address',
276 + 'dhcpd_CUSTOM_WINSERVER_STATUS' => 'WINS Server',
277 + 'dhcpd_CUSTOM_WINSERVER_TITLE' => 'Enable a WINS Server.',
278 + 'dhcpd_DHCPD_SETTING_ERRORS' => 'DHCPd Settings ERRORS',
279 + 'dhcpd_DHCPD_SETTINGS_TITLE' => 'DHCP server settings',
280 + 'dhcpd_DHCPD_TITLE' => 'DHCP Manager',
281 + 'dhcpd_DHCP_END' => 'DHCP End',
282 + 'dhcpd_DHCP manager' => 'DHCP Manager',
283 + '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',
284 + 'dhcpd_DHCP_RANGE_WITH_BAD_IP' => 'Incorrect IP in the DHCP range, Update unsuccessfull',
285 + 'dhcpd_DHCP_START' => 'DHCP Start',
286 + 'dhcpd_DHCP_START_GREATER_DHCP_END_ERRORS' =>'Incorrect range of IPs, the DHCP Start is greater than the DHCP End , Update unsuccessfull',
287 + 'dhcpd_DISABLED' => 'Disabled',
288 + 'dhcpd_DNS_SERVER_WITH_BAD_IP' => 'Incorrect IP for DNS servers, Update unsuccessfull',
289 + 'dhcpd_DO_YOU_WANT_TO_SENT' => 'Do you want to send this message to',
290 + 'dhcpd_ENABLED' => 'Enabled',
291 + 'dhcpd_END_DATE' => 'End Date',
292 + 'dhcpd_ERROR_WHILE_REMOVING_ALL_LEASES' => 'Error while removing all dhcpd Leases',
293 + 'dhcpd_ERROR_WHILE_SAVING_SETTINGS' => 'Error while saving settings',
294 + 'dhcpd_GATEWAY_BAD_IP' => 'Incorrect IP for Gateway, Update unsuccessfull',
295 + 'dhcpd_GLOBAL_WINPOPUP' => 'Send Global Netsend WinPopup',
296 + 'dhcpd_GLOBAL_WINPOPUP_TITLE' => 'Send a global WinPopup with the Net send protocol',
297 + 'dhcpd_IP' => 'Ip Address',
298 + 'dhcpd_MAC_ADDRESS' => 'MAC Address',
299 + 'dhcpd_MANAGING_DHCP_CLIENT' => 'Managing DHCP clients',
300 + 'dhcpd_NETWORK_NAME' => 'Network Name',
301 + 'dhcpd_NETWORK_VALUES_FOUND' => 'Please wait .... Your subnet and your netmask appear to be :',
302 + 'dhcpd_NO_CONNECTED_COMPUTERS' => 'There are no connected computers',
303 + 'dhcpd_NOT_CHECKED' => 'Not Checked...',
304 + 'dhcpd_PRIMARY_DNS_ADDRESS' => 'Primary DNS',
305 + 'dhcpd_REFRESH_CONNECTED_IP_LIST' => 'You may want to refresh this list ?',
306 + 'dhcpd_REFRESH' => 'Refresh the list',
307 + 'dhcpd_REMOVE_ACTION' => 'Remove...',
308 + 'dhcpd_REMOVE_A_DHCP_LEASE_ACTION' => 'You are about to remove a client from the dhcpd.leases file.',
309 + 'dhcpd_REMOVE_A_DHCP_LEASE' => 'Remove a DHCP lease',
310 + 'dhcpd_ARE_YOU_SURE' => 'are you sure ?',
311 + 'dhcpd_REMOVE_A_DHCP_LEASE_TITLE' => 'Removing a DHCP Lease',
312 + 'dhcpd_REMOVE_ALL_LEASES_ACTION' => 'Remove all dhcpd leases',
313 + 'dhcpd_REMOVE_ALL_LEASES' => 'Remove all leases',
314 + 'dhcpd_REMOVE_DHCP_LEASE_TITLE' => 'Removing all DHCP Lease',
315 + 'dhcpd_REMOVE_DHCP_LEASE_WARNING' => 'Remove all entries in dhcpd.leases may cause issues',
316 + 'dhcpd_REMOVE' => 'Remove',
317 + 'dhcpd_SAVE/RESTART' => 'Save/Restart',
318 + 'dhcpd_SAVE_TITLE' => 'After changing settings above, you must save and restart dhcpd.',
319 + 'dhcpd_SCANNING_NETWORK_TITLE' => 'Scanning your network, the time needed depends on your subnet mask',
320 + 'dhcpd_SCAN_YOUR_NETWORK' => 'Scan your network',
321 + 'dhcpd_SCAN_YOUR_NETWORK_TITLE' => 'Scan your network to show active devices :',
322 + 'dhcpd_SECONDARY_DNS_ADDRESS' => 'Secondary DNS',
323 + 'dhcpd_SENDING_A_WINPOPUP' => 'Sending a WinPopup',
324 + 'dhcpd_SENDING_A_WINPOPUP_TO' => 'You are about to send a WinPopup to ',
325 + 'dhcpd_SEND_WINPOPUP_TO' => 'Send a WinPopup to',
326 + 'dhcpd_SHOW_CONNECTED_IP_TITLE' => 'Show all devices connected to the dhcpd server :',
327 + 'dhcpd_START_DATE' => 'Start Date',
328 + 'dhcpd_STATUS_CLICK_FOR_WOL' => 'Status - click for WOL',
329 + 'dhcpd_STATUS_DHCP_SERVER' => 'State of DHCPD',
330 + 'dhcpd_STATUS_REPORT' => 'Operation status report :',
331 + 'dhcpd_SUCCESSFULLY_CLIENT_WOL_REQUEST' =>'Successfull request to wake up the client. The computer may take time to wake up.',
332 + 'dhcpd_SUCCESSFULLY_DELETED_THE_CLIENT' => 'Successfully deleted the client in dhcpd.leases : ',
333 + 'dhcpd_SUCCESSFULLY_REMOVED_ALL_LEASES' => 'Successfully deleted all leases.',
334 + 'dhcpd_SUCCESSFULLY_SAVED_SETTINGS' => 'Successfully saved settings',
335 + 'dhcpd_SUCCESSFULLY_SENT_MESSAGE' => 'Successfully sent message popup to',
336 + 'dhcpd_TERTIARY_DNS_ADDRESS' => 'Tertiary DNS',
337 + 'dhcpd_WAKE_UP_ACTION' => '<font color="red">Wake-Up...</font>',
338 + 'dhcpd_WAKE_UP' => 'Wake UP',
339 + 'dhcpd_WAKING_A_REMOTE_COMPUTER_ACTION' => 'Are you sure you want to wake on lan the client : ',
340 + 'dhcpd_WAKING_A_REMOTE_COMPUTER_TITLE' => 'Waking Up a remote computer',
341 + 'dhcpd_WAKING_A_REMOTE_COMPUTER' => 'You are about to wake up a remote computer.',
342 + 'dhcpd_WARNING_NO_WINPOPUP_GARANTY' =>'Warning, there is no guarantee that the popup will appear on the remote computer.',
343 + 'dhcpd_WINPOPUP_ACTION' => 'WinPopup...',
344 + 'dhcpd_WINSSERVER_BAD_IP' => 'Incorrect IP for WINS Server, Update unsuccessfull',
345 + 'dhcpd_WRITE_YOUR_MESSAGE' => 'Write your message here',
346 + 'dhcpd_YOUR_MESSAGE' => 'Your message',
347 + 'dhcpd_REMOVE_DHCP_LEASE_WARNING2' => 'The lease file is a log-structured file - whenever a lease changes, the
348 + contents of that lease are written to the end of the file. This means that it is entirely possible for there to be two
349 + or more declarations of the same lease in the lease file at the same
350 + time. In that case, the instance of that particular lease that
351 + appears last in the file is the one that is in effect.',
352 +);
353 +
354 +our %Lexicon = (
355 + %{ SrvMngr::I18N::Modules::General::en::Lexicon },
356 + %lexicon
357 +);
358 +
359 +
360 +1;
361 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
362 --- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep 2023-12-19 09:44:56.680590493 +0000
363 +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep 2024-01-20 17:01:00.000000000 +0000
364 @@ -49,24 +49,26 @@
365
366 % if ($dhcp_data->{trt} eq 'LEASES') {
367 %= include 'partials/_dhcpd_leases'
368 - %} elsif ($dhcp_data->{trt} eq 'WINPOPUP') {
369 - %= include 'partials/_dhcpd_winpopup'
370 %} elsif ($dhcp_data->{trt} eq 'SCAN') {
371 %= include 'partials/_dhcpd_scan'
372 %} else { #PARAMS
373 % 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])$';
374 - <table><tr><td>
375 - %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases"
376 - <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true">
377 - Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')-->
378 - <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
379 - </button>
380 - </td><td>
381 - %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3'
382 - </td><td>
383 - %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2'
384 - <td>
385 - </tr>
386 + <table>
387 + <tr>
388 + <td>
389 + %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinnerLeases()", id=>"scanLeases"
390 + <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true">
391 + Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')-->
392 + <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
393 + </button>
394 + </td><td>
395 + %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3', onclick=>"showSpinnerNetwork()", id=>"scanNetwork"
396 + <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadingNetwork" style="display:true">
397 + Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')-->
398 + <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
399 + </button>
400 + </td>
401 + </tr>
402 </table>
403 <hr />
404 <h2>
405 @@ -180,10 +182,17 @@
406
407 %= javascript begin
408 document.getElementById("load").style.display="none";
409 - function showSpinner(){
410 + document.getElementById("loadingNetwork").style.display="none";
411 +
412 + function showSpinnerLeases(){
413 document.getElementById("scanLeases").style.display="none";
414 document.getElementById("load").style.display="inline";
415 }
416 +
417 + function showSpinnerNetwork(){
418 + document.getElementById("scanNetwork").style.display="none";
419 + document.getElementById("loadingNetwork").style.display="inline";
420 + }
421 %end
422
423 %= stylesheet begin
424 @@ -205,7 +214,6 @@
425 border-color: darkgrey;
426 border-image: initial;
427 }
428 -
429 %end
430 -
431 %end
432 +1;
433 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
434 --- 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
435 +++ 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
436 @@ -1,17 +1,17 @@
437 <div id='dhcpd-leases'>
438 <table><tr><td>
439 - %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases"
440 - <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true">
441 - Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')-->
442 - <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
443 - </button>
444 -
445 - </td><td>
446 - %= button_to $c->l('dhcpd_REMOVE_ALL_LEASES') => '/dhcpd4'
447 - </td>
448 - </tr>
449 + %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showSpinnerLeases()", id=>"scanLeases"
450 + <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true">
451 + Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')-->
452 + <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
453 + </button>
454 +
455 + </td><td>
456 + %= button_to $c->l('dhcpd_REMOVE_ALL_LEASES') => '/dhcpd4'
457 + </td>
458 + </tr>
459 </table>
460 - <hr />
461 +
462 % my $btn = l('dhcpd_SAVE/RESTART');
463 %= form_for '/dhcpd10' => (method => 'POST') => begin
464 <span class=label>
465 @@ -26,7 +26,7 @@
466 %= submit_button "$btn", class => 'action'
467 % end
468 <br>
469 - <table class="sme-border table-sort"><tbody>
470 + <table class="sme-border table-sort"><thead>
471 <tr>
472 <th class='sme-border'>
473 %=l 'dhcpd_IP'
474 @@ -50,6 +50,8 @@
475 %=l 'dhcpd_ACTION'
476 </th>
477 </tr>
478 + </thead>
479 + <tbody>
480 % foreach my $ip (@$leases) {
481 <tr>
482 %= t td => (class => 'sme-border') => $ip->{ip}
483 @@ -66,9 +68,12 @@
484 %= t td => (class => 'sme-border') => $ip->{mac}
485 <td class = 'sme-border'>
486 <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>
487 - </td><td class = 'sme-border'>
488 + </td>
489 + <!--
490 + <td class = 'sme-border'>
491 <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>
492 </td>
493 + -->
494 </tr>
495 %}
496 </tbody>
497 @@ -110,4 +115,4 @@
498 %end
499
500
501 -</div>
502 \ No newline at end of file
503 +</div>
504 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
505 --- 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
506 +++ 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
507 @@ -0,0 +1,63 @@
508 +<div id='dhcpd-scan'>
509 + <table><tr><td>
510 + %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd3', onclick=>"showSpinnerNetwork1()", id=>"scanNetwork1"
511 + <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadingNetwork1" style="display:true">
512 + Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')-->
513 + <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
514 + </button>
515 +
516 + </td>
517 + </tr>
518 +
519 + </table>
520 + <table class="sme-border table-sort"><thead>
521 + <tr>
522 + <th class='sme-border'>
523 + %=l 'dhcpd_NETWORK_NAME'
524 + </th>
525 + <th class='sme-border'>
526 + %=l 'dhcpd_IP'
527 + </th>
528 + <th class='sme-border'>
529 + %=l 'dhcpd_MAC_ADDRESS'
530 + </th>
531 +
532 + </tr>
533 + </thead>
534 + <tbody>
535 + % foreach my $ip (@$scanresults) {
536 + <tr>
537 + %= t td => (class => 'sme-border') => $ip->{Network}
538 + %= t td => (class => 'sme-border') => $ip->{ip}
539 + %= t td => (class => 'sme-border') => $ip->{mac}
540 + </tr>
541 + %}
542 + </tbody>
543 + </table>
544 + %= hidden_field "hiddenmsg"=>"", id=>"hiddenmsg"
545 + <br />
546 + %= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd'
547 +
548 + %= javascript begin
549 + function Wol_confirm(event,msg,current){
550 + const getMAC = /.*MAC\=(.*)\&name.*/;
551 + var MAC = current.href.match(getMAC)[1];
552 + if (confirm(msg+": MAC: "+MAC))
553 + { return true;}
554 + else {event.preventDefault();return false;}
555 + }
556 +
557 +
558 + %end
559 +
560 +
561 +</div>
562 +%= javascript begin
563 + document.getElementById("loadingNetwork1").style.display="none";
564 +
565 + function showSpinnerNetwork1(){
566 + document.getElementById("scanNetwork1").style.display="none";
567 + document.getElementById("loadingNetwork1").style.display="inline";
568 + }
569 +
570 +%end

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