/[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.2 - (show annotations) (download)
Sun Dec 31 14:45:40 2023 UTC (4 months, 2 weeks ago) by brianr
Branch: MAIN
Changes since 1.1: +164 -18 lines
* Sat Dec 30 2023 Brian Read <brianr@koozali.org> 2.0.4-15.sme
- And more fixes for SM2 panels [SME: ]

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 2023-12-31 13:44:00.000000000 +0000
4 @@ -117,22 +117,41 @@
5 $c->render( template => 'dhcpd' );
6 }
7
8 -
9 -sub do_winpopup {
10 - #
11 - # call to win pop up
12 - #
13 +sub netmask2cidr {
14 my $c = shift;
15 - my $title = $c->l("dhcpd_GLOBAL_WINPOPUP");
16 - my $modul = '';
17 - my $trt = "WINPOPUP";
18 - $dhcp_data{trt} = $trt;
19 - $dhcp_data{"first"} = '';
20 - #..... get winpopup details
21 - $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data );
22 - $c->render( template => 'dhcpd' );
23 + #my ($mask, $network) = @_;
24 + my $nmap_sme = esmith::ConfigDB->open('/home/e-smith/db/configuration');
25 + my $mask = $nmap_sme->get_value('LocalNetmask');
26 + my $network = $nmap_sme->get_prop('InternalInterface','Network');
27 + my @octet = split (/\./, $mask);
28 + my @bits;
29 + my $binmask;
30 + my $binoct;
31 + my $bitcount=0;
32 +
33 + foreach (@octet) {
34 + $binoct = dec2bin($_);
35 + $binmask = $binmask . substr $binoct, -8;
36 + }
37 +
38 + # let's count the 1s
39 + @bits = split (//,$binmask);
40 + foreach (@bits) {
41 + if ($_ eq "1") {
42 + $bitcount++;
43 + }
44 + }
45 +
46 + my $cidr = $network . "/" . $bitcount;
47 + return $cidr;
48 }
49
50 +sub dec2bin {
51 + my $str = unpack("B32", pack("N", shift));
52 + return $str;
53 +}
54 +
55 +
56 sub do_scan {
57 #
58 # call to show scan results
59 @@ -140,12 +159,13 @@
60 my $c = shift;
61 my $title = $c->l("dhcpd_SCANNING_NETWORK_TITLE");
62 my $modul = '';
63 - my $trt = "NETSCAN";
64 + my $trt = "SCAN";
65 $dhcp_data{trt} = $trt;
66 $dhcp_data{"first"} = '';
67 # ..... get scan results into dhcp_data
68 - dhcp_data{"scanresults"} = get_scan_results($c);
69 - $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data );
70 + $dhcp_data{"cidr"} = netmask2cidr($c);
71 + my @scanresults = get_scan_results($c);
72 + $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data, scanresults => @scanresults );
73 $c->render( template => 'dhcpd' );
74 }
75
76 @@ -314,7 +334,6 @@
77 }
78 }
79
80 -
81 # - 4 expand templates
82 # changed to new sme standard signal-event
83 system ("/sbin/e-smith/signal-event","workgroup-update") == 0
84 @@ -332,10 +351,10 @@
85 my $c = shift;
86 my $ret = delete_all_leases($c);
87 if ($ret == 'ok') {
88 - dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";
89 + $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_REMOVED_ALL_LEASES";
90 do_leases($c);
91 }
92 - else {dhcp_data{"error"}=$ret;}
93 + else {$dhcp_data{"error"}=$ret;}
94 return ;
95 }
96
97 @@ -352,17 +371,39 @@
98 # else return "ok"
99 my $ret = delete_lease($c);
100 if ($ret == 'ok') {
101 - dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";
102 + $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_DELETED_THE_CLIENT";
103 do_leases($c);
104 }
105 - else {dhcp_data{"error"}=$ret;}
106 + else {$dhcp_data{"error"}=$ret;}
107 return ;
108 }
109
110 sub get_scan_results {
111 my $c = shift;
112 - #...do it
113 - return "results";
114 + my $cidr = netmask2cidr($c);
115 + my $res = execute_nmap($cidr);
116 + return $res;
117 +}
118 +
119 +sub execute_nmap {
120 + my ($ip, $port) = @_;
121 + my @result;
122 + my $nmapcmd = qq(/usr/bin/nmap --script smb-os-discovery.nse -p U:137,T:139 $ip| \
123 + /bin/grep -Ev "MAC|NetBIOS|OS CPE"| /bin/grep -E "scan|done|Computer|OS"| \
124 + /bin/sed -e 's/Nmap scan/-- Scan/g'|/bin/sed -e 's/done/Done/g'| \
125 + /bin/sed -e 's/Nmap//g'|/bin/sed -e 's/|/ /g');
126 +
127 + open my $nmap, '-|', "$nmapcmd" or die "Can't start nmap: $!";
128 +
129 + while (my $line = <$nmap>) {
130 + chomp $line;
131 + my @fields = split /\s+/, $line;
132 + push @result, \@fields;
133 + }
134 +
135 + close $nmap;
136 +
137 + return \@result;
138 }
139
140
141 @@ -374,13 +415,45 @@
142
143 sub delete_one_lease {
144 my $c = shift;
145 - # ...do it
146 +
147 + ###Pull entry to delete
148 + my $ip = $c->param('host');
149 + my $name = $c->param('name');
150 + my $name_in_file = '/var/lib/dhcpd/dhcpd.leases' ;
151 + my $name_tmp_file = '/var/lib/dhcpd/dhcpd.leases.tmp' ;
152 + my $name_out_file = '/var/lib/dhcpd/dhcpd.leases~' ;
153 + my $del_current = "0" ;
154 +
155 + open(INFILE,"<$name_in_file") || die "Read Error $name_in_file, Read: $!";
156 + open(OUTFILE,">$name_tmp_file") || die "Write error $name_in_file, Write: $!";
157 + while (<INFILE>) {
158 + if ( "$_" =~ /lease $ip/ ) {
159 + $del_current = "1" ;
160 + }
161 + if ( $del_current == "0" ) { print OUTFILE "$_" ; }
162 + if ( "$_" =~ /}/ ) {
163 + $del_current = "0" ;
164 + }
165 + }
166 + rename ($name_tmp_file,$name_in_file) ;
167 + system ("/bin/cp","-f","$name_in_file","$name_out_file") ;
168 + close(INFILE);
169 + close(OUTFILE);
170 +
171 + # changed to new sme standard signal-event
172 + system ("/sbin/e-smith/signal-event","workgroup-update") == 0
173 + or die "Error while saving settings: $!";
174 return "ok";
175 }
176
177 sub delete_all_leases {
178 my $c = shift;
179 - # ...do it
180 + system ('/bin/echo "" > /var/lib/dhcpd/dhcpd.leases') ==0
181 + or die "Error while removing all leases: $!";
182 +
183 + system ("/sbin/e-smith/signal-event","workgroup-update") == 0
184 + or die "Error while saving settings: $!";
185 +
186 return "ok";
187 }
188
189 @@ -498,13 +571,6 @@
190 return @results;
191 }
192
193 -sub winpopup{
194 - my $c = shift;
195 - # Message in $c->param("winpopupmsg")
196 - # .... do it
197 - return TRUE;
198 -}
199 -
200 sub do_wol{
201 my $c = shift;
202 my $retVal = Perform_Wake_Up($c);
203 @@ -536,4 +602,4 @@
204
205 1;
206
207 -
208 \ No newline at end of file
209 +
210 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
211 --- 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
212 +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm 2023-12-30 11:30:00.000000000 +0000
213 @@ -0,0 +1,109 @@
214 +package SrvMngr::I18N::Modules::Dhcpd::en;
215 +use strict;
216 +use warnings;
217 +use utf8;
218 +use Mojo::Base 'SrvMngr::I18N';
219 +
220 +use SrvMngr::I18N::Modules::General::en;
221 +
222 +my %lexicon = (
223 + 'dhcpd_ACTION' => 'Action',
224 + 'dhcpd_ACTIVE_DEVICE' => 'Active Device',
225 + 'dhcpd_ALL_OF_THEM' => 'All of them',
226 + 'dhcpd_CHECK_CLIENT_STATUS' => 'Always check the status of computers (Disabled is much faster)',
227 + 'dhcpd_CLEAN_ALL_DHCPLEASES' => 'You may want to clean the dhcpd.leases',
228 + 'dhcpd_CLICK_HERE_TO_MAIN_PANEL' => 'Return to the main panel',
229 + 'dhcpd_CONNECTED_IP' => 'Show DHCP Clients',
230 + 'dhcpd_CUSTOM_DNS_STATUS' => 'Custom DNS',
231 + 'dhcpd_CUSTOM_DNS_TITLE' => 'Enable custom DNS servers.',
232 + 'dhcpd_CUSTOM_GATEWAY_ADDRESS' => 'Gateway address',
233 + 'dhcpd_CUSTOM_GATEWAY_STATUS' => 'Custom gateway',
234 + 'dhcpd_CUSTOM_GATEWAY_TITLE' => 'Enable a custom gateway address.',
235 + 'dhcpd_CUSTOM_LEASETIME' => 'Custom lease time',
236 + 'dhcpd_CUSTOM_LEASETIME_TITLE' => 'Set the lease time (default is 86400 seconds).',
237 + 'dhcpd_CUSTOM_WINSERVER_ADDRESS' => 'WINS Server address',
238 + 'dhcpd_CUSTOM_WINSERVER_STATUS' => 'WINS Server',
239 + 'dhcpd_CUSTOM_WINSERVER_TITLE' => 'Enable a WINS Server.',
240 + 'dhcpd_DHCPD_SETTING_ERRORS' => 'DHCPd Settings ERRORS',
241 + 'dhcpd_DHCPD_SETTINGS_TITLE' => 'DHCP server settings',
242 + 'dhcpd_DHCPD_TITLE' => 'DHCP Manager',
243 + 'dhcpd_DHCP_END' => 'DHCP End',
244 + 'dhcpd_DHCP manager' => 'DHCP Manager',
245 + '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',
246 + 'dhcpd_DHCP_RANGE_WITH_BAD_IP' => 'Incorrect IP in the DHCP range, Update unsuccessfull',
247 + 'dhcpd_DHCP_START' => 'DHCP Start',
248 + 'dhcpd_DHCP_START_GREATER_DHCP_END_ERRORS' =>'Incorrect range of IPs, the DHCP Start is greater than the DHCP End , Update unsuccessfull',
249 + 'dhcpd_DISABLED' => 'Disabled',
250 + 'dhcpd_DNS_SERVER_WITH_BAD_IP' => 'Incorrect IP for DNS servers, Update unsuccessfull',
251 + 'dhcpd_DO_YOU_WANT_TO_SENT' => 'Do you want to send this message to',
252 + 'dhcpd_ENABLED' => 'Enabled',
253 + 'dhcpd_END_DATE' => 'End Date',
254 + 'dhcpd_ERROR_WHILE_REMOVING_ALL_LEASES' => 'Error while removing all dhcpd Leases',
255 + 'dhcpd_ERROR_WHILE_SAVING_SETTINGS' => 'Error while saving settings',
256 + 'dhcpd_GATEWAY_BAD_IP' => 'Incorrect IP for Gateway, Update unsuccessfull',
257 + 'dhcpd_GLOBAL_WINPOPUP' => 'Send Global Netsend WinPopup',
258 + 'dhcpd_GLOBAL_WINPOPUP_TITLE' => 'Send a global WinPopup with the Net send protocol',
259 + 'dhcpd_IP' => 'Ip Address',
260 + 'dhcpd_MAC_ADDRESS' => 'MAC Address',
261 + 'dhcpd_MANAGING_DHCP_CLIENT' => 'Managing DHCP clients',
262 + 'dhcpd_NETWORK_NAME' => 'Network Name',
263 + 'dhcpd_NETWORK_VALUES_FOUND' => 'Please wait .... Your subnet and your netmask appear to be :',
264 + 'dhcpd_NO_CONNECTED_COMPUTERS' => 'There are no connected computers',
265 + 'dhcpd_NOT_CHECKED' => 'Not Checked...',
266 + 'dhcpd_PRIMARY_DNS_ADDRESS' => 'Primary DNS',
267 + 'dhcpd_REFRESH_CONNECTED_IP_LIST' => 'You may want to refresh this list ?',
268 + 'dhcpd_REFRESH' => 'Refresh the list',
269 + 'dhcpd_REMOVE_ACTION' => 'Remove...',
270 + 'dhcpd_REMOVE_A_DHCP_LEASE_ACTION' => 'You are about to remove a client from the dhcpd.leases file.',
271 + 'dhcpd_REMOVE_A_DHCP_LEASE' => 'Remove a DHCP lease',
272 + 'dhcpd_ARE_YOU_SURE' => 'are you sure ?',
273 + 'dhcpd_REMOVE_A_DHCP_LEASE_TITLE' => 'Removing a DHCP Lease',
274 + 'dhcpd_REMOVE_ALL_LEASES_ACTION' => 'Remove all dhcpd leases',
275 + 'dhcpd_REMOVE_ALL_LEASES' => 'Remove all leases',
276 + 'dhcpd_REMOVE_DHCP_LEASE_TITLE' => 'Removing all DHCP Lease',
277 + 'dhcpd_REMOVE_DHCP_LEASE_WARNING' => 'Remove all entries in dhcpd.leases may cause issues',
278 + 'dhcpd_REMOVE' => 'Remove',
279 + 'dhcpd_SAVE/RESTART' => 'Save/Restart',
280 + 'dhcpd_SAVE_TITLE' => 'After changing settings above, you must save and restart dhcpd.',
281 + 'dhcpd_SCANNING_NETWORK_TITLE' => 'Scanning your network, the time needed depends on your subnet mask',
282 + 'dhcpd_SCAN_YOUR_NETWORK' => 'Scan your network',
283 + 'dhcpd_SCAN_YOUR_NETWORK_TITLE' => 'Scan your network to show active devices :',
284 + 'dhcpd_SECONDARY_DNS_ADDRESS' => 'Secondary DNS',
285 + 'dhcpd_SENDING_A_WINPOPUP' => 'Sending a WinPopup',
286 + 'dhcpd_SENDING_A_WINPOPUP_TO' => 'You are about to send a WinPopup to ',
287 + 'dhcpd_SEND_WINPOPUP_TO' => 'Send a WinPopup to',
288 + 'dhcpd_SHOW_CONNECTED_IP_TITLE' => 'Show all devices connected to the dhcpd server :',
289 + 'dhcpd_START_DATE' => 'Start Date',
290 + 'dhcpd_STATUS_CLICK_FOR_WOL' => 'Status - click for WOL',
291 + 'dhcpd_STATUS_DHCP_SERVER' => 'State of DHCPD',
292 + 'dhcpd_STATUS_REPORT' => 'Operation status report :',
293 + 'dhcpd_SUCCESSFULLY_CLIENT_WOL_REQUEST' =>'Successfull request to wake up the client. The computer may take time to wake up.',
294 + 'dhcpd_SUCCESSFULLY_DELETED_THE_CLIENT' => 'Successfully deleted the client in dhcpd.leases : ',
295 + 'dhcpd_SUCCESSFULLY_REMOVED_ALL_LEASES' => 'Successfully deleted all leases.',
296 + 'dhcpd_SUCCESSFULLY_SAVED_SETTINGS' => 'Successfully saved settings',
297 + 'dhcpd_SUCCESSFULLY_SENT_MESSAGE' => 'Successfully sent message popup to',
298 + 'dhcpd_TERTIARY_DNS_ADDRESS' => 'Tertiary DNS',
299 + 'dhcpd_WAKE_UP_ACTION' => '<font color="red">Wake-Up...</font>',
300 + 'dhcpd_WAKE_UP' => 'Wake UP',
301 + 'dhcpd_WAKING_A_REMOTE_COMPUTER_ACTION' => 'Are you sure you want to wake on lan the client : ',
302 + 'dhcpd_WAKING_A_REMOTE_COMPUTER_TITLE' => 'Waking Up a remote computer',
303 + 'dhcpd_WAKING_A_REMOTE_COMPUTER' => 'You are about to wake up a remote computer.',
304 + 'dhcpd_WARNING_NO_WINPOPUP_GARANTY' =>'Warning, there is no guarantee that the popup will appear on the remote computer.',
305 + 'dhcpd_WINPOPUP_ACTION' => 'WinPopup...',
306 + 'dhcpd_WINSSERVER_BAD_IP' => 'Incorrect IP for WINS Server, Update unsuccessfull',
307 + 'dhcpd_WRITE_YOUR_MESSAGE' => 'Write your message here',
308 + 'dhcpd_YOUR_MESSAGE' => 'Your message',
309 + 'dhcpd_REMOVE_DHCP_LEASE_WARNING2' => 'The lease file is a log-structured file - whenever a lease changes, the
310 + contents of that lease are written to the end of the file. This means that it is entirely possible for there to be two
311 + or more declarations of the same lease in the lease file at the same
312 + time. In that case, the instance of that particular lease that
313 + appears last in the file is the one that is in effect.',
314 +);
315 +
316 +our %Lexicon = (
317 + %{ SrvMngr::I18N::Modules::General::en::Lexicon },
318 + %lexicon
319 +);
320 +
321 +
322 +1;
323 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
324 --- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep 2023-12-19 09:44:56.680590493 +0000
325 +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep 2023-12-31 13:55:00.000000000 +0000
326 @@ -49,23 +49,30 @@
327
328 % if ($dhcp_data->{trt} eq 'LEASES') {
329 %= include 'partials/_dhcpd_leases'
330 - %} elsif ($dhcp_data->{trt} eq 'WINPOPUP') {
331 - %= include 'partials/_dhcpd_winpopup'
332 %} elsif ($dhcp_data->{trt} eq 'SCAN') {
333 - %= include 'partials/_dhcpd_scan'
334 + %= include 'partials/_dhcpd_scanresults'
335 %} else { #PARAMS
336 % 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])$';
337 <table><tr><td>
338 - %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases"
339 - <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true">
340 - Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')-->
341 + %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showLeasesSpinner()", id=>"scanLeases"
342 + <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadLeases" style="display:true">
343 + Scanning
344 <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
345 </button>
346 +
347 </td><td>
348 - %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3'
349 - </td><td>
350 - %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2'
351 + %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3', onclick=>"showNetworkSpinner()", id=>"scanNetwork"
352 + <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadNetwork" style="display:true">
353 + Scanning
354 + <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
355 + </button>
356 +
357 + </td>
358 + <!--
359 <td>
360 + %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2'
361 + </td>
362 + -->
363 </tr>
364 </table>
365 <hr />
366 @@ -179,10 +186,15 @@
367 </div>
368
369 %= javascript begin
370 - document.getElementById("load").style.display="none";
371 - function showSpinner(){
372 + document.getElementById("loadLeases").style.display="none";
373 + document.getElementById("loadNetwork").style.display="none";
374 + function showLeasesSpinner(){
375 document.getElementById("scanLeases").style.display="none";
376 - document.getElementById("load").style.display="inline";
377 + document.getElementById("loadLeases").style.display="inline";
378 + }
379 + function showNetworkSpinner(){
380 + document.getElementById("scanNetwork").style.display="none";
381 + document.getElementById("loadNetwork").style.display="inline";
382 }
383 %end
384
385 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
386 --- 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
387 +++ 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
388 @@ -1,8 +1,8 @@
389 <div id='dhcpd-leases'>
390 <table><tr><td>
391 - %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases"
392 - <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true">
393 - Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')-->
394 + %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showLeaseSpinner()", id=>"scanLeases"
395 + <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadLease" style="display:true">
396 + Scanning
397 <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
398 </button>
399
400 @@ -26,7 +26,7 @@
401 %= submit_button "$btn", class => 'action'
402 % end
403 <br>
404 - <table class="sme-border table-sort"><tbody>
405 + <table class="sme-border table-sort"><thead>
406 <tr>
407 <th class='sme-border'>
408 %=l 'dhcpd_IP'
409 @@ -50,6 +50,8 @@
410 %=l 'dhcpd_ACTION'
411 </th>
412 </tr>
413 + </thead>
414 + <tbody>
415 % foreach my $ip (@$leases) {
416 <tr>
417 %= t td => (class => 'sme-border') => $ip->{ip}
418 @@ -66,9 +68,12 @@
419 %= t td => (class => 'sme-border') => $ip->{mac}
420 <td class = 'sme-border'>
421 <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>
422 - </td><td class = 'sme-border'>
423 + </td>
424 + <!--
425 + <td class = 'sme-border'>
426 <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>
427 </td>
428 + -->
429 </tr>
430 %}
431 </tbody>
432 @@ -78,6 +83,7 @@
433 %= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd'
434
435 %= javascript begin
436 + document.getElementById("loadLease").style.display="none";
437 function Wol_confirm(event,msg,current){
438 const getMAC = /.*MAC\=(.*)\&name.*/;
439 var MAC = current.href.match(getMAC)[1];
440 @@ -110,4 +116,4 @@
441 %end
442
443
444 -</div>
445 \ No newline at end of file
446 +</div>
447 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
448 --- 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
449 +++ 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
450 @@ -0,0 +1,55 @@
451 +<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.4/css/jquery.dataTables.css">
452 +<script type="text/javascript" charset="utf8" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
453 +<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.11.4/js/jquery.dataTables.js"></script>
454 +
455 +<div id='dhcpd-scanresults'>
456 +
457 +%#= 1/0
458 + %= $c->l('dhcpd_NETWORK_VALUES_FOUND').$dhcp_data->{"cidr"};
459 + %= form_for '/dhcpd10' => (method => 'POST') => begin
460 + <br />
461 + <table id="scanresults" class="sme-border table-sort"><thead>
462 + <tr>
463 + <th class='sme-border'>
464 + %=l 'dhcpd_NETWORK_NAME'
465 + </th>
466 + <th class='sme-border'>
467 + %=l 'dhcpd_IP'
468 + </th>
469 + <th class='sme-border'>
470 + %=l 'dhcpd_MAC_ADDRESS'
471 + </th>
472 + <th class='sme-border'>
473 + %=l 'dhcpd_STATUS_CLICK_FOR_WOL'
474 + </th>
475 + </tr>
476 + </thead>
477 + <tbody>
478 + % foreach my $line (@$scanresults) {
479 + % my @thisline = @$line;
480 + <tr>
481 + <td class='sme-border'>
482 + %= "$thisline[4]";
483 + </td>
484 + <td class='sme-border'>
485 + %= "$thisline[5]";
486 + </td>
487 + <td class='sme-border'>
488 + </td>
489 + <td class='sme-border'>
490 + </td>
491 + </tr>
492 + %}
493 + </table>
494 + % end
495 + %= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd'
496 +</div>
497 +<script>
498 +$(document).ready(function() {
499 + $("table.table-sort").each(function() {
500 + // Enable DataTable on this table
501 + $(this).DataTable();
502 + });
503 +});
504 +</script>
505 +

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