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

Contents of /rpms/smeserver-dhcpmanager/contribs10/smeserver-dhcpmanager-2.0.4-Add-panels-for-SM2.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Thu Mar 10 12:22:07 2022 UTC (2 years, 7 months ago) by brianr
Branch: MAIN
CVS Tags: smeserver-dhcpmanager-2_0_4-13_el7_sme, smeserver-dhcpmanager-2_0_4-16_el7_sme, smeserver-dhcpmanager-2_0_4-15_el7_sme, smeserver-dhcpmanager-2_0_4-18_el7_sme, smeserver-dhcpmanager-2_0_4-17_el7_sme, HEAD
* Tue Jan 18 2022 Brian Read <brianr@bjsystems.co.uk> 2.0.4-13.sme
- Add panels for SM2 [SME: 11850]

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 1970-01-01 01:00:00.000000000 +0100
3 +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm 2022-03-08 11:20:00.000000000 +0000
4 @@ -0,0 +1,539 @@
5 +package SrvMngr::Controller::Dhcpd;
6 +
7 +#----------------------------------------------------------------------
8 +# heading : Configuration
9 +# description : DHCP manager
10 +# navigation : 2000 2500
11 +#
12 +# name : dhcpd, method : get, url : /dhcpd, ctlact : Dhcpd#main
13 +# name : dhcpd1, method : get, url : /dhcpd1, ctlact : Dhcpd#do_leases
14 +# name : dhcpd2, method : get, url : /dhcpd2, ctlact : Dhcpd#do_winpopup
15 +# name : dhcpd3, method : get, url : /dhcpd3, ctlact : Dhcpd#do_scan
16 +# name : dhcpd4, method : get, url : /dhcpd4, ctlact : Dhcpd#do_delete_all_leases
17 +# name : dhcpd5, method : post, url : /dhcpd5, ctlact : Dhcpd#do_update_config
18 +# name : dhcpd6, method : get, url : /dhcpd6, ctlact : Dhcpd#do_delete_one_lease
19 +# name : dhcpd7, method : get, url : /dhcpd7, ctlact : Dhcpd#do_refresh_leases
20 +# name : dhcpd8, method : get, url : /dhcpd8, ctlact : Dhcpd#do_winpopup
21 +# name : dhcpd9, method : get, url : /dhcpd9, ctlact : Dhcpd#do_wol
22 +# name : dhcpd10, method : post, url : /dhcpd10, ctlact : Dhcpd#do_update_check
23 +#
24 +# routes : end
25 +#
26 +#
27 +# Documentation: https://wiki.koozali.org/Dhcpmanager
28 +#
29 +use strict;
30 +use warnings;
31 +use Mojo::Base 'Mojolicious::Controller';
32 +
33 +use constant FALSE => 0;
34 +use constant TRUE => 1;
35 +
36 +use Locale::gettext;
37 +use SrvMngr::I18N;
38 +use SrvMngr qw(theme_list init_session);
39 +
40 +use Data::Dumper;
41 +use esmith::util;
42 +use esmith::HostsDB;
43 +use esmith::AccountsDB;
44 +use Net::Ping;
45 +use esmith::util::network qw(:all);
46 +use Socket qw( inet_aton );
47 +
48 +
49 +#our $adb = esmith::AccountsDB->open() or die("Unable to open accounts DB");
50 +
51 +my %dhcp_data = ();
52 +
53 +sub main {
54 + #
55 + # Initial page - full summary of parameters etc
56 + # Initial para from the Wiki.
57 + #
58 + my $c = shift;
59 + %dhcp_data = ();
60 + do_display($c);
61 +}
62 +
63 +sub do_display {
64 + #
65 + # Front parameters page
66 + #
67 + my $c = shift;
68 + $c->app->log->info( $c->log_req );
69 + my $title = $c->l("dhcpd_DHCP manager");
70 + my $modul = '';
71 + my $trt = "SETTINGS";
72 + our $db = esmith::ConfigDB->open() or die("Unable to open Configuration DB");
73 + our %sme_conf = $db->get('dhcpd')->props;
74 + our %smb_conf = $db->get('smb')->props;
75 + $dhcp_data{trt} = $trt;
76 + $dhcp_data{"status"} = [[$c->l('dhcpd_ENABLED'),'enabled'],
77 + [$c->l('dhcpd_DISABLED'),'disabled']
78 + ];
79 +
80 + $dhcp_data{"check"} = [[$c->l('dhcpd_ENABLED'),'enabled'],
81 + [$c->l('dhcpd_DISABLED'),'disabled']
82 + ];
83 + if (! $sme_conf{'winscustom'} ) {
84 + $sme_conf{'winscustom'} = 'disabled' ;
85 + }
86 + if (! $sme_conf{'dnscustom'} ) {
87 + $sme_conf{'dnscustom'} = 'disabled' ;
88 + }
89 + if ( ! $sme_conf{'leasetime'} )
90 + { $sme_conf{'leasetime'} = "86400" ;
91 + }
92 + if (! $sme_conf{'gatewaycustom'} ) {
93 + $sme_conf{'gatewaycustom'} = 'disabled' ;
94 + }
95 + # Accumulate parameters for Configuration DB
96 + $dhcp_data{'params'} = \%sme_conf;
97 + $dhcp_data{'smbparams'} = \%smb_conf;
98 + $c->stash( title => $title,
99 + modul => $modul,
100 + dhcp_data => \%dhcp_data
101 + );
102 + #die("here");
103 + $c->render( template => 'dhcpd' );
104 +}
105 +
106 +sub do_leases {
107 + #
108 + # Show a table of the leases
109 + #
110 + my $c = shift;
111 + my $title = $c->l("dhcpd_MANAGING_DHCP_CLIENT");
112 + my $modul = '';
113 + my $trt = "LEASES";
114 + $dhcp_data{"check"} = [[$c->l('dhcpd_ENABLED'),'enabled'],
115 + [$c->l('dhcpd_DISABLED'),'disabled']
116 + ];
117 + $dhcp_data{trt} = $trt;
118 + $dhcp_data{"first"} = '';
119 + my @leases = get_leases_in_array($c);
120 + $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data, leases=> \@leases );
121 + $c->render( template => 'dhcpd' );
122 +}
123 +
124 +
125 +sub do_winpopup {
126 + #
127 + # call to win pop up
128 + #
129 + my $c = shift;
130 + my $title = $c->l("dhcpd_GLOBAL_WINPOPUP");
131 + my $modul = '';
132 + my $trt = "WINPOPUP";
133 + $dhcp_data{trt} = $trt;
134 + $dhcp_data{"first"} = '';
135 + #..... get winpopup details
136 + $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data );
137 + $c->render( template => 'dhcpd' );
138 +}
139 +
140 +sub do_scan {
141 + #
142 + # call to show scan results
143 + #
144 + my $c = shift;
145 + my $title = $c->l("dhcpd_SCANNING_NETWORK_TITLE");
146 + my $modul = '';
147 + my $trt = "NETSCAN";
148 + $dhcp_data{trt} = $trt;
149 + $dhcp_data{"first"} = '';
150 + # ..... get scan results into dhcp_data
151 + dhcp_data{"scanresults"} = get_scan_results($c);
152 + $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data );
153 + $c->render( template => 'dhcpd' );
154 +}
155 +
156 +sub do_update_config {
157 + #
158 + # Update config dhcp parameters
159 + # called through form submit.
160 + #
161 + my $c = shift;
162 + # Input results are in $c->param(<fieldname>).
163 + # If parameters do not validate, then return error message.
164 + # else write into config DB, and...
165 + # signal-event and ...return ok
166 + $dhcp_data{"success"} ="";
167 + my $ret = Main_Save($c);
168 + if ($ret eq 'ok') {
169 + $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";
170 + } else {
171 + $dhcp_data{"error"}=$ret;
172 + }
173 + do_display($c);
174 + return;
175 +}
176 +
177 +sub do_update_check {
178 + #Just update the check parameter
179 + my $c = shift;
180 + my $dhcpd_check = $c->param ('dhcp_check');
181 + ###Update SME configuration dbase
182 + my $dbh_sme = esmith::ConfigDB->open('/home/e-smith/db/configuration');
183 + ##Initiate get method --> create record object
184 + my $sme_record = $dbh_sme->get('dhcpd');
185 + $sme_record->set_prop('check' , $dhcpd_check);
186 + $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";
187 + do_display($c);
188 + return;
189 +}
190 +
191 +sub Main_Save ($){
192 +
193 + ##Pull CGI object from parameters array
194 + my $q = shift;
195 +
196 + ###Build Hash of config parameters to update from cgi submit
197 + my $dhcpd_status = $q->param ('dhcp_enable');
198 + my $dhcpd_winscustom = $q->param ('dhcp_winscustom');
199 + my $dhcpd_check = $q->param ('dhcp_check');
200 + my $dhcpd_start = $q->param ('dhcp_start');
201 + my $dhcpd_end = $q->param ('dhcp_end');
202 + my $dhcpd_winsserver = $q->param ('dhcp_winsserver');
203 + my $dhcpd_leasetime = $q->param ('dhcp_leasetime');
204 + my $dhcpd_dnscustom = $q->param ('dhcp_dnscustom');
205 + my $dhcpd_dns1server = $q->param ('dhcp_dns1server');
206 + my $dhcpd_dns2server = $q->param ('dhcp_dns2server');
207 + my $dhcpd_dns3server = $q->param ('dhcp_dns3server');
208 + my $dhcpd_gatewaycustom = $q->param ('dhcp_gatewaycustom');
209 + my $dhcpd_gateway = $q->param ('dhcp_gateway');
210 +
211 + ###Update SME configuration dbase
212 + my $dbh_sme = esmith::ConfigDB->open('/home/e-smith/db/configuration');
213 +
214 + ##Initiate get method --> create record object
215 + my $sme_record = $dbh_sme->get('dhcpd');
216 + #get localip of server
217 + my $local_ip = $dbh_sme->get_value('LocalIP');
218 +
219 + ##Set status of service
220 + $sme_record->set_prop('status', $dhcpd_status);
221 + $sme_record->set_prop('check' , $dhcpd_check);
222 + $sme_record->set_prop('winscustom', $dhcpd_winscustom);
223 + $sme_record->set_prop('leasetime' , $dhcpd_leasetime);
224 + $sme_record->set_prop('dnscustom' , $dhcpd_dnscustom);
225 + $sme_record->set_prop('gatewaycustom' , $dhcpd_gatewaycustom);
226 +
227 + #checkip to the dhcpserver, perform the save in DB configuration or display an error if value != of a valid ip or if dhcp_start is greater than dhcp_end
228 +
229 +
230 + if ($dhcpd_status eq "enabled")
231 + {
232 + if ( isValidIP ($dhcpd_start) && isValidIP ($dhcpd_end))
233 + {
234 + #check if $dhcpd_start is greater than $dhcpd_end and if yes, display an error message.
235 +
236 + if (inet_aton($dhcpd_start) ge inet_aton($dhcpd_end))
237 + {
238 + return $q->l('dhcpd_DHCP_START_GREATER_DHCP_END_ERRORS') . ' (' . $dhcpd_start . '/' . $dhcpd_end .')';
239 + }
240 + elsif ( ( (inet_aton($dhcpd_start) le inet_aton($local_ip) ) && ( inet_aton($dhcpd_end)) ge inet_aton($local_ip) ) )
241 + {
242 + #display an error if the range of dhcp server include the ip of the server address
243 + return $q->l('dhcpd_DHCP_RANGE_MUST_NOT_INCLUDE_SERVER_IP') . ' (' . $local_ip . ')';
244 + }
245 + else
246 + {
247 + #set value
248 + my $dhcpd_start = cleanIP($dhcpd_start);
249 + my $dhcpd_end = cleanIP($dhcpd_end);
250 +
251 + $sme_record->set_prop('end', $dhcpd_end);
252 + $sme_record->set_prop('start', $dhcpd_start);
253 + }
254 + }
255 + #if $dhcpd_start or $dhcpd_end are not valid ip then display an error
256 + else
257 + {
258 + return $q->l('dhcpd_DHCP_RANGE_WITH_BAD_IP') . ' (' . $dhcpd_start . '/' . $dhcpd_end .')';
259 + }
260 + }
261 +
262 + #checkip to the winserver perform the save in DB configuration or display an error if value != of a valid ip
263 + if ($dhcpd_winscustom eq "enabled")
264 + {
265 +
266 + if ( isValidIP ($dhcpd_winsserver) )
267 + {
268 + #set value
269 + my $dhcpd_winsserver = cleanIP($dhcpd_winsserver);
270 + $dbh_sme->set_prop('smb','WINSServer', $dhcpd_winsserver);
271 + }
272 + else
273 + {
274 + #if $dhcpd_winsserver is not valid ip then display an error
275 + return $q->l('dhcpd_WINSSERVER_BAD_IP') . ' (' . $dhcpd_winsserver .')';
276 + }
277 + }
278 + elsif ($dhcpd_winscustom eq "disabled")
279 + {
280 + my $delws = $dbh_sme->get('smb');
281 + $delws->delete_prop('WINSServer');
282 + }
283 +
284 + #checkip to the dnsserver custom, perform the save in DB configuration or display an error if value != of a valid ip
285 + if ($dhcpd_dnscustom eq "enabled")
286 + {
287 + #check if $dhcpd_dns1server and ( $dhcpd_dns2server are valid ip or $dhcpd_dns2server = null )
288 + if ( isValidIP ($dhcpd_dns1server) && (isValidIP($dhcpd_dns2server) || ( $dhcpd_dns2server eq "") ) && (isValidIP($dhcpd_dns3server) || ( $dhcpd_dns3server eq "") ) )
289 + {
290 + #set value
291 + my $dhcpd_dns1server = cleanIP($dhcpd_dns1server);
292 + $sme_record->set_prop('dns1server' , $dhcpd_dns1server);
293 + my $dhcpd_dns2server = cleanIP($dhcpd_dns2server);
294 + $sme_record->set_prop('dns2server' , $dhcpd_dns2server);
295 + my $dhcpd_dns3server = cleanIP($dhcpd_dns3server);
296 + $sme_record->set_prop('dns3server' , $dhcpd_dns3server);
297 + }
298 + else
299 + {
300 + ##if $dhcpd_dns1server or $dhcpd_dns2server or $dhcpd_dns3server are not valid ip then display an error
301 + return $q->l('dhcpd_DNS_SERVER_WITH_BAD_IP') . ' (' . $dhcpd_dns1server . '/' . $dhcpd_dns2server . '/' . $dhcpd_dns3server .')';
302 + }
303 + }
304 +
305 + #checkip to the gateway_custom perform the save in DB configuration or display an error if value != of a valid ip
306 + if ($dhcpd_gatewaycustom eq "enabled")
307 + {
308 + if ( isValidIP ($dhcpd_gateway) )
309 + {
310 + #set value
311 + my $dhcpd_gateway = cleanIP($dhcpd_gateway);
312 + $sme_record->set_prop('gateway' , $dhcpd_gateway);
313 + }
314 + else
315 + {
316 + #if $dhcpd_gateway is not valid ip then display an error
317 + return $q->l('dhcpd_GATEWAY_BAD_IP') . ' (' . $dhcpd_gateway .')';
318 + }
319 + }
320 +
321 +
322 + # - 4 expand templates
323 + # changed to new sme standard signal-event
324 + system ("/sbin/e-smith/signal-event","workgroup-update") == 0
325 + or die "Error while saving settings: $!";
326 + return 'ok';
327 + exit;
328 +}
329 +
330 +
331 +sub do_delete_all_leases {
332 + #
333 + # Delete all the specified lease
334 + # Called from button at top of leases list panel
335 + #
336 + my $c = shift;
337 + my $ret = delete_all_leases($c);
338 + if ($ret == 'ok') {
339 + dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";
340 + do_leases($c);
341 + }
342 + else {dhcp_data{"error"}=$ret;}
343 + return ;
344 +}
345 +
346 +sub do_delete_one_lease {
347 + #
348 + # Delete the specified lease
349 + # Called from link in table of leases
350 + #
351 + my $c = shift;
352 + # Lease in $c->param("lease")
353 + # Validate - if not return error message
354 + # delete it
355 + # If deletion not ok return message
356 + # else return "ok"
357 + my $ret = delete_lease($c);
358 + if ($ret == 'ok') {
359 + dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS";
360 + do_leases($c);
361 + }
362 + else {dhcp_data{"error"}=$ret;}
363 + return ;
364 +}
365 +
366 +sub get_scan_results {
367 + my $c = shift;
368 + #...do it
369 + return "results";
370 +}
371 +
372 +
373 +sub update_config {
374 + my $c = shift;
375 + #...do it
376 + return "ok";
377 +}
378 +
379 +sub delete_one_lease {
380 + my $c = shift;
381 + # ...do it
382 + return "ok";
383 +}
384 +
385 +sub delete_all_leases {
386 + my $c = shift;
387 + # ...do it
388 + return "ok";
389 +}
390 +
391 +sub get_leases_in_array {
392 + my $c = shift;
393 + my @leases = Load_leases($c);
394 + # ...do it
395 + return @leases;
396 +}
397 +
398 +#=========================================================================
399 +# Procedure qui charge le dhcpd.conf
400 +# retourne un tableau contenant les informations
401 +#=========================================================================
402 +sub Load_leases ($){
403 +
404 + my $q = shift;
405 + #Definition de variable
406 + use vars qw/
407 + @detail $work_line $header /;
408 + my $name_file = '/var/lib/dhcpd/dhcpd.leases' ;
409 + our @liste_computer = '' ;
410 + our $db = esmith::ConfigDB->open() or die("Unable to open Configuration DB");
411 + our %sme_conf = $db->get('dhcpd')->props;
412 + #Ouverture du fichier en lecture seule
413 + open(FILE,"<$name_file") || die "Read error $name_file, Error: $!" ;
414 +
415 + #Parcours du fichier dhcpd.leases
416 + while (<FILE>) {
417 + # suppression des commentaires
418 + if ($_ =~ /^#/) { next; }
419 +
420 + #spurresion des lignes vides
421 + if ($_ =~ /^$/) { next; }
422 + #supression de la ligne uid de windows
423 + if ($_ =~ /uid/) { next; }
424 + #supression de la ligne tstp de XP
425 + if ($_ =~ /tstp/) { next; }
426 + #supression de la ligne "binding state active"
427 + if ($_ =~ /binding/) { next; }
428 + #supression de la ligne "next binding state"
429 + if ($_ =~ /next/) { next; }
430 + #suprresion des commentaire et des ;
431 + $_ =~ s/\s#.*$//;
432 + $_ =~ s/(;|{) *$//;
433 +
434 + #supression des espace en debut de lignes
435 + $_ =~ s/^ *\s//;
436 +
437 + #Suppression des retours chariot en fin de lignes.
438 + chomp $_ ;
439 +
440 + #Chargement d'un tableau avec le contenu de la ligne.
441 + (@detail) = split(/ /, $_) ;
442 +
443 + #initialisation d'un nouveau poste connect�
444 + if ($_ =~ /lease/) {
445 + $work_line = "" ;
446 + }
447 +
448 + $header = shift(@detail);
449 + $work_line = $work_line . ";" . join(" ",@detail) ;
450 +
451 + if ($header =~ /}/) {
452 + $work_line =~ s/ /;/g;
453 + $work_line =~ s/^;//;
454 + $work_line =~ s/"//g;
455 + $work_line =~ s/;$//;
456 + #we want the last entry is the first element of the array
457 + unshift(@liste_computer,$work_line) ;
458 + }
459 + }
460 + close(FILE);
461 + # Now check if up and extract details
462 + my @mac = ();
463 + my @count = ();
464 + my @results = ();
465 + my @liste_connected = ();
466 + foreach (@liste_computer){
467 + my @computer = split(/;/, $_) ;
468 + #we want to sort elements the array by mac address
469 + $computer[11] = uc($computer[11]) ;
470 + push @mac, ($computer[11]);
471 + my @count;
472 + push @count , (grep /$computer[11]/ , @mac);
473 + next if (scalar @count > 1);
474 + #we start the table if it is a valid IP
475 + if ( $computer[0] ) {
476 + $computer[12] = uc($computer[12]) ;
477 + my $datedeb = $computer[2] . "-" . $computer[3] ;
478 + my $datefin = $computer[5] . "-" . $computer[6] ;
479 + my $status = 'dhcpd_NOT_CHECKED';
480 + #my $status = '<a href=/smanager/dhcpd1'."?state=wake_up&MAC=" . $computer[11] . "&name=" . $computer[12].">".$q->l('dhcpd_NOT_CHECKED')."</a>";
481 + if ( $sme_conf{'check'} =~ /enabled/ ) {
482 + use Net::Ping;
483 + my($ping_obj) = Net::Ping->new("icmp");
484 + # formatage des dates
485 + $computer[3] = substr($computer[3],0,5);
486 + $computer[6] = substr($computer[6],0,5);
487 + if ($ping_obj->ping("$computer[0]")) {
488 + push(@liste_connected,$computer[12]) ;
489 + $status = 'dhcpd_ACTIVE_DEVICE';
490 + #alimentation de la liste des connect�
491 + }
492 + else { $status = 'dhcpd_WAKE_UP_ACTION';}
493 + #else { $status = '<a href=/smanager/dhcpd1'."?state=wake_up&MAC=" . $computer[11] . "&name=" . $computer[12].">".$q->l('dhcpd_WAKE_UP_ACTION')."</a>";
494 + }
495 + my %ipdetails = (ip=>$computer[0],name=>$computer[12],wol=>$status,start=>$datedeb,end=>$datefin,mac=>$computer[11]);
496 + push(@results,\%ipdetails);
497 + }
498 + else {
499 + push(@liste_connected,$computer[12]) ;
500 + }
501 + }
502 + return @results;
503 +}
504 +
505 +sub winpopup{
506 + my $c = shift;
507 + # Message in $c->param("winpopupmsg")
508 + # .... do it
509 + return TRUE;
510 +}
511 +
512 +sub do_wol{
513 + my $c = shift;
514 + my $retVal = Perform_Wake_Up($c);
515 + if ($retVal) {$dhcp_data{"success"} = $retVal;}
516 + do_leases($c);
517 + return TRUE;
518 +}
519 +
520 +
521 +#===============================================================================
522 +#SUBROUTINE: Perform wake UP
523 +#===============================================================================
524 +sub Perform_Wake_Up($){
525 +
526 + ###Pull CGI object from parameters array
527 + my $q = shift;
528 +
529 + ###Get Mac Adress
530 + my $mac = uc($q->param('mac'));
531 + my $name = uc($q->param('name'));
532 +
533 + #Send Wake Up to the station
534 + #Old version obsolete since 1.5.0 - system ("/usr/bin/wol","$mac") ;
535 + system ("/sbin/ether-wake","$mac") ;
536 + ###Return action message
537 + return 'dhcpd_SUCCESSFULLY_CLIENT_WOL_REQUEST';
538 +}
539 +
540 +
541 +1;
542 +
543 +
544 \ No newline at end of file
545 diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/dhcpd_en.lex smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/dhcpd_en.lex
546 --- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/dhcpd_en.lex 1970-01-01 01:00:00.000000000 +0100
547 +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/dhcpd_en.lex 2022-02-04 11:51:00.000000000 +0000
548 @@ -0,0 +1,91 @@
549 + 'dhcpd_ACTION' => 'Action',
550 + 'dhcpd_ACTIVE_DEVICE' => 'Active Device',
551 + 'dhcpd_ALL_OF_THEM' => 'All of them',
552 + 'dhcpd_CHECK_CLIENT_STATUS' => 'Always check the status of computers (Disabled is much faster)',
553 + 'dhcpd_CLEAN_ALL_DHCPLEASES' => 'You may want to clean the dhcpd.leases',
554 + 'dhcpd_CLICK_HERE_TO_MAIN_PANEL' => 'Return to the main panel',
555 + 'dhcpd_CONNECTED_IP' => 'Show DHCP Clients',
556 + 'dhcpd_CUSTOM_DNS_STATUS' => 'Custom DNS',
557 + 'dhcpd_CUSTOM_DNS_TITLE' => 'Enable custom DNS servers.',
558 + 'dhcpd_CUSTOM_GATEWAY_ADDRESS' => 'Gateway address',
559 + 'dhcpd_CUSTOM_GATEWAY_STATUS' => 'Custom gateway',
560 + 'dhcpd_CUSTOM_GATEWAY_TITLE' => 'Enable a custom gateway address.',
561 + 'dhcpd_CUSTOM_LEASETIME' => 'Custom lease time',
562 + 'dhcpd_CUSTOM_LEASETIME_TITLE' => 'Set the lease time (default is 86400 seconds).',
563 + 'dhcpd_CUSTOM_WINSERVER_ADDRESS' => 'WINS Server address',
564 + 'dhcpd_CUSTOM_WINSERVER_STATUS' => 'WINS Server',
565 + 'dhcpd_CUSTOM_WINSERVER_TITLE' => 'Enable a WINS Server.',
566 + 'dhcpd_DHCPD_SETTING_ERRORS' => 'DHCPd Settings ERRORS',
567 + 'dhcpd_DHCPD_SETTINGS_TITLE' => 'DHCP server settings',
568 + 'dhcpd_DHCPD_TITLE' => 'DHCP Manager',
569 + 'dhcpd_DHCP_END' => 'DHCP End',
570 + 'dhcpd_DHCP manager' => 'DHCP Manager',
571 + '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',
572 + 'dhcpd_DHCP_RANGE_WITH_BAD_IP' => 'Incorrect IP in the DHCP range, Update unsuccessfull',
573 + 'dhcpd_DHCP_START' => 'DHCP Start',
574 + 'dhcpd_DHCP_START_GREATER_DHCP_END_ERRORS' =>'Incorrect range of IPs, the DHCP Start is greater than the DHCP End , Update unsuccessfull',
575 + 'dhcpd_DISABLED' => 'Disabled',
576 + 'dhcpd_DNS_SERVER_WITH_BAD_IP' => 'Incorrect IP for DNS servers, Update unsuccessfull',
577 + 'dhcpd_DO_YOU_WANT_TO_SENT' => 'Do you want to send this message to',
578 + 'dhcpd_ENABLED' => 'Enabled',
579 + 'dhcpd_END_DATE' => 'End Date',
580 + 'dhcpd_ERROR_WHILE_REMOVING_ALL_LEASES' => 'Error while removing all dhcpd Leases',
581 + 'dhcpd_ERROR_WHILE_SAVING_SETTINGS' => 'Error while saving settings',
582 + 'dhcpd_GATEWAY_BAD_IP' => 'Incorrect IP for Gateway, Update unsuccessfull',
583 + 'dhcpd_GLOBAL_WINPOPUP' => 'Send Global Netsend WinPopup',
584 + 'dhcpd_GLOBAL_WINPOPUP_TITLE' => 'Send a global WinPopup with the Net send protocol',
585 + 'dhcpd_IP' => 'Ip Address',
586 + 'dhcpd_MAC_ADDRESS' => 'MAC Address',
587 + 'dhcpd_MANAGING_DHCP_CLIENT' => 'Managing DHCP clients',
588 + 'dhcpd_NETWORK_NAME' => 'Network Name',
589 + 'dhcpd_NETWORK_VALUES_FOUND' => 'Please wait .... Your subnet and your netmask appear to be :',
590 + 'dhcpd_NO_CONNECTED_COMPUTERS' => 'There are no connected computers',
591 + 'dhcpd_NOT_CHECKED' => 'Not Checked...',
592 + 'dhcpd_PRIMARY_DNS_ADDRESS' => 'Primary DNS',
593 + 'dhcpd_REFRESH_CONNECTED_IP_LIST' => 'You may want to refresh this list ?',
594 + 'dhcpd_REFRESH' => 'Refresh the list',
595 + 'dhcpd_REMOVE_ACTION' => 'Remove...',
596 + 'dhcpd_REMOVE_A_DHCP_LEASE_ACTION' => 'You are about to remove a client from the dhcpd.leases file.',
597 + 'dhcpd_REMOVE_A_DHCP_LEASE' => 'Remove a DHCP lease',
598 + 'dhcpd_ARE_YOU_SURE' => 'are you sure ?',
599 + 'dhcpd_REMOVE_A_DHCP_LEASE_TITLE' => 'Removing a DHCP Lease',
600 + 'dhcpd_REMOVE_ALL_LEASES_ACTION' => 'Remove all dhcpd leases',
601 + 'dhcpd_REMOVE_ALL_LEASES' => 'Remove all leases',
602 + 'dhcpd_REMOVE_DHCP_LEASE_TITLE' => 'Removing all DHCP Lease',
603 + 'dhcpd_REMOVE_DHCP_LEASE_WARNING' => 'Remove all entries in dhcpd.leases may cause issues',
604 + 'dhcpd_REMOVE' => 'Remove',
605 + 'dhcpd_SAVE/RESTART' => 'Save/Restart',
606 + 'dhcpd_SAVE_TITLE' => 'After changing settings above, you must save and restart dhcpd.',
607 + 'dhcpd_SCANNING_NETWORK_TITLE' => 'Scanning your network, the time needed depends of your subnet mask',
608 + 'dhcpd_SCAN_YOUR_NETWORK' => 'Scan your network',
609 + 'dhcpd_SCAN_YOUR_NETWORK_TITLE' => 'Scan your network to show active devices :',
610 + 'dhcpd_SECONDARY_DNS_ADDRESS' => 'Secondary DNS',
611 + 'dhcpd_SENDING_A_WINPOPUP' => 'Sending a WinPopup',
612 + 'dhcpd_SENDING_A_WINPOPUP_TO' => 'You are about to send a WinPopup to ',
613 + 'dhcpd_SEND_WINPOPUP_TO' => 'Send a WinPopup to',
614 + 'dhcpd_SHOW_CONNECTED_IP_TITLE' => 'Show all devices connected to the dhcpd server :',
615 + 'dhcpd_START_DATE' => 'Start Date',
616 + 'dhcpd_STATUS_CLICK_FOR_WOL' => 'Status - click for WOL',
617 + 'dhcpd_STATUS_DHCP_SERVER' => 'State of DHCPD',
618 + 'dhcpd_STATUS_REPORT' => 'Operation status report :',
619 + 'dhcpd_SUCCESSFULLY_CLIENT_WOL_REQUEST' =>'Successfull request to wake up the client. The computer may take time to wake up.',
620 + 'dhcpd_SUCCESSFULLY_DELETED_THE_CLIENT' => 'Successfully deleted the client in dhcpd.leases : ',
621 + 'dhcpd_SUCCESSFULLY_REMOVED_ALL_LEASES' => 'Successfully deleted all leases.',
622 + 'dhcpd_SUCCESSFULLY_SAVED_SETTINGS' => 'Successfully saved settings',
623 + 'dhcpd_SUCCESSFULLY_SENT_MESSAGE' => 'Successfully sent message popup to',
624 + 'dhcpd_TERTIARY_DNS_ADDRESS' => 'Tertiary DNS',
625 + 'dhcpd_WAKE_UP_ACTION' => '<font color="red">Wake-Up...</font>',
626 + 'dhcpd_WAKE_UP' => 'Wake UP',
627 + 'dhcpd_WAKING_A_REMOTE_COMPUTER_ACTION' => 'Are you sure you want to wake on lan the client : ',
628 + 'dhcpd_WAKING_A_REMOTE_COMPUTER_TITLE' => 'Waking Up a remote computer',
629 + 'dhcpd_WAKING_A_REMOTE_COMPUTER' => 'You are about to wake up a remote computer.',
630 + 'dhcpd_WARNING_NO_WINPOPUP_GARANTY' =>'Warning, there is no guarantee that the popup will appear on the remote computer.',
631 + 'dhcpd_WINPOPUP_ACTION' => 'WinPopup...',
632 + 'dhcpd_WINSSERVER_BAD_IP' => 'Incorrect IP for WINS Server, Update unsuccessfull',
633 + 'dhcpd_WRITE_YOUR_MESSAGE' => 'Write your message here',
634 + 'dhcpd_YOUR_MESSAGE' => 'Your message',
635 + 'dhcpd_REMOVE_DHCP_LEASE_WARNING2' => 'The lease file is a log-structured file - whenever a lease changes, the
636 + contents of that lease are written to the end of the file. This means that it is entirely possible for there to be two
637 + or more declarations of the same lease in the lease file at the same
638 + time. In that case, the instance of that particular lease that
639 + appears last in the file is the one that is in effect.',
640 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
641 --- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep 1970-01-01 01:00:00.000000000 +0100
642 +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep 2022-03-09 11:51:00.000000000 +0000
643 @@ -0,0 +1,211 @@
644 +% layout 'default', title => "Sme server 2 - DHCP Manager", share_dir => './';
645 +
646 +% content_for 'module' => begin
647 +
648 +<div id="module" class="module dhcpman-panel">
649 +
650 + % if ($config->{debug} == 1) {
651 + <p>
652 + %= dumper $c->current_route
653 + </p>
654 + % }
655 +
656 + <h1><%=$title%></h1>
657 + %= $modul
658 +
659 + %if ($dhcp_data->{first}) {
660 + <br><p>
661 + %=$c->render_to_string(inline =>$c->l($dhcp_data->{first}))
662 + </p>
663 +
664 + %} elsif ($dhcp_data->{success}) {
665 + <div class='sme-border'>
666 + <h2> Operation Status Report - success</h2><p>
667 + <font color=green>
668 + %= $c->l($dhcp_data->{success});
669 + </font>
670 + </p>
671 + </div>
672 +
673 + %} elsif ($dhcp_data->{error}) {
674 + <div class='sme-error'>
675 + <h2> Operation Status Report - error</h2><p>
676 + <font color=red>
677 + %= $c->l($dhcp_data->{error});
678 + </font>
679 + </p>
680 + </div>
681 +
682 + %} elsif ($dhcp_data->{error}) {
683 + <div class='sme-warning'>
684 + <h2> Operation Status Report - warning</h2><p>
685 + <font color=orange>
686 + %= $c->l($dhcp_data->{error});
687 + </font>
688 + </p>
689 + </div>
690 +
691 + %}
692 +
693 + % if ($dhcp_data->{trt} eq 'LEASES') {
694 + %= include 'partials/_dhcpd_leases'
695 + %} elsif ($dhcp_data->{trt} eq 'WINPOPUP') {
696 + %= include 'partials/_dhcpd_winpopup'
697 + %} elsif ($dhcp_data->{trt} eq 'SCAN') {
698 + %= include 'partials/_dhcpd_scan'
699 + %} else { #PARAMS
700 + % 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])$';
701 + <table><tr><td>
702 + %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases"
703 + <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true">
704 + Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')-->
705 + <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
706 + </button>
707 + </td><td>
708 + %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3'
709 + </td><td>
710 + %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2'
711 + <td>
712 + </tr>
713 + </table>
714 + <hr />
715 + <h2>
716 + %= $c->l("dhcpd_DHCPD_SETTINGS_TITLE")
717 + </h2>
718 + % my $btn = l('dhcpd_SAVE/RESTART');
719 + %= form_for '/dhcpd5' => (method => 'POST') => begin
720 + <span class=label>
721 + %=l 'dhcpd_CHECK_CLIENT_STATUS'
722 + </span><span class=data>
723 + % param dhcp_check=>$dhcp_data->{"params"}->{"check"};
724 + %=select_field dhcp_check=>$dhcp_data->{"check"}
725 + </span><br>
726 + <br />
727 + <span class=label>
728 + %=l 'dhcpd_STATUS_DHCP_SERVER'
729 + </span><span class=data>
730 + % param dhcp_enable=>$dhcp_data->{"params"}->{"status"};
731 + %=select_field dhcp_enable=>$dhcp_data->{"status"}
732 + </span><br>
733 +
734 + <span class=label>
735 + %=l 'dhcpd_DHCP_START'
736 + </span><span class=data>
737 + % param dhcp_start=>$dhcp_data->{"params"}->{"start"};
738 + %=text_field 'dhcp_start',minlength=>'7',maxlength=>"15",size=>"15",placeholder=>"nnn.nnn.nnn.nnn", pattern=>"$ip_regex"
739 + </span><br>
740 +
741 + <span class=label>
742 + %=l 'dhcpd_DHCP_END'
743 + </span><span class=data>
744 + % param dhcp_end=>$dhcp_data->{"params"}->{"end"};
745 + %=text_field 'dhcp_end',minlength=>'7',maxlength=>"15",size=>"15",placeholder=>"nnn.nnn.nnn.nnn", pattern=>"$ip_regex"
746 + </span><br><br />
747 +
748 + %= $c->l("dhcpd_CUSTOM_WINSERVER_TITLE");
749 + <br />
750 +
751 + <span class=label>
752 + %=l 'dhcpd_CUSTOM_WINSERVER_STATUS'
753 + </span><span class=data>
754 + % param dhcp_winscustom=>$dhcp_data->{"params"}->{"winscustom"};
755 + %=select_field dhcp_winscustom=>$dhcp_data->{"status"}
756 + </span><br>
757 +
758 + <span class=label>
759 + %=l 'dhcpd_CUSTOM_WINSERVER_ADDRESS'
760 + </span><span class=data>
761 + % param dhcp_winsserver=>$dhcp_data->{"smbparams"}->{"WINSServer"};
762 + %=text_field 'dhcp_winsserver' ,minlength=>'7',maxlength=>"15",size=>"15",placeholder=>"nnn.nnn.nnn.nnn", pattern=>"$ip_regex"
763 + </span><br><br />
764 +
765 + %= $c->l("dhcpd_CUSTOM_DNS_TITLE");
766 + <br />
767 + <span class=label>
768 + %=l 'dhcpd_CUSTOM_DNS_STATUS'
769 + </span><span class=data>
770 + % param dhcp_dnscustom=>$dhcp_data->{"params"}->{"dnscustom"};
771 + %=select_field dhcp_dnscustom=>$dhcp_data->{"status"}
772 + </span><br>
773 +
774 + <span class=label>
775 + %=l 'dhcpd_PRIMARY_DNS_ADDRESS'
776 + </span><span class=data>
777 + % param dhcp_dns1server=>$dhcp_data->{"params"}->{"dns1server"};
778 + %=text_field 'dhcp_dns1server' ,minlength=>'7',maxlength=>"15",size=>"15",placeholder=>"nnn.nnn.nnn.nnn", pattern=>"$ip_regex"
779 + </span><br>
780 +
781 + <span class=label>
782 + %=l 'dhcpd_SECONDARY_DNS_ADDRESS'
783 + </span><span class=data>
784 + % param dhcp_dns2server=>$dhcp_data->{"params"}->{"dns2server"};
785 + %=text_field 'dhcp_dns2server' ,minlength=>'7',maxlength=>"15",size=>"15",placeholder=>"nnn.nnn.nnn.nnn", pattern=>"$ip_regex"
786 + </span><br>
787 +
788 + <span class=label>
789 + %=l 'dhcpd_TERTIARY_DNS_ADDRESS'
790 + </span><span class=data>
791 + % param dhcp_dns3server=>$dhcp_data->{"params"}->{"dns3server"};
792 + %=text_field 'dhcp_dns3server' ,minlength=>'7',maxlength=>"15",size=>"15",placeholder=>"nnn.nnn.nnn.nnn", pattern=>"$ip_regex"
793 + </span><br>
794 +
795 + %= $c->l("dhcpd_CUSTOM_GATEWAY_TITLE");
796 + <br />
797 + <span class=label>
798 + %=l 'dhcpd_CUSTOM_GATEWAY_STATUS'
799 + </span><span class=data>
800 + % param dhcp_gatewaycustom=>$dhcp_data->{"params"}->{"gatewaycustom"};
801 + %=select_field dhcp_gatewaycustom=>$dhcp_data->{"status"}
802 + </span><br>
803 +
804 + <span class=label>
805 + %=l 'dhcpd_CUSTOM_GATEWAY_ADDRESS'
806 + </span><span class=data>
807 + % param dhcp_gateway=>$dhcp_data->{"params"}->{"gateway"};
808 + %=text_field 'dhcp_gateway' ,minlength=>'7',maxlength=>"15",size=>"15",placeholder=>"nnn.nnn.nnn.nnn", pattern=>"$ip_regex"
809 + </span><br><br />
810 + %= $c->l("dhcpd_CUSTOM_LEASETIME_TITLE");
811 + <br />
812 + <span class=label>
813 + %=l 'dhcpd_CUSTOM_LEASETIME'
814 + </span><span class=data>
815 + % param dhcp_leasetime=>$dhcp_data->{"params"}->{"leasetime"};
816 + %=number_field 'dhcp_leasetime'
817 + </span><br><br />
818 + %= submit_button "$btn", class => 'action'
819 + % end
820 + %}
821 +
822 +</div>
823 +
824 +%= javascript begin
825 + document.getElementById("load").style.display="none";
826 + function showSpinner(){
827 + document.getElementById("scanLeases").style.display="none";
828 + document.getElementById("load").style.display="inline";
829 + }
830 +%end
831 +
832 +%= stylesheet begin
833 +.spinnerButtonOverlay,
834 +.spinnerButtonOverlay:hover,
835 +.spinnerButtonOverlay:any-link ,
836 +.spinnerButtonOverlay:focus ,
837 +.spinnerButtonOverlay:active {
838 + appearance: auto;
839 + user-select: none;
840 + align-items: flex-start;
841 + cursor: default;
842 + box-sizing: border-box;
843 + background-color: #efefef;
844 + color: black;
845 + padding: 1px 6px;
846 + border-width: 2px;
847 + border-style: outset;
848 + border-color: darkgrey;
849 + border-image: initial;
850 +}
851 +
852 +%end
853 +
854 +%end
855 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
856 --- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep 1970-01-01 01:00:00.000000000 +0100
857 +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep 2022-03-09 10:06:00.000000000 +0000
858 @@ -0,0 +1,113 @@
859 +<div id='dhcpd-leases'>
860 + <table><tr><td>
861 + %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases"
862 + <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true">
863 + Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')-->
864 + <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
865 + </button>
866 +
867 + </td><td>
868 + %= button_to $c->l('dhcpd_REMOVE_ALL_LEASES') => '/dhcpd4'
869 + </td>
870 + </tr>
871 + </table>
872 + <hr />
873 + % my $btn = l('dhcpd_SAVE/RESTART');
874 + %= form_for '/dhcpd10' => (method => 'POST') => begin
875 + <span class=label>
876 + %=l 'dhcpd_CHECK_CLIENT_STATUS'
877 + </span><span class=data>
878 + % param dhcp_check=>$dhcp_data->{"params"}->{"check"};
879 + %=select_field dhcp_check=>$dhcp_data->{"check"}
880 + </span><br>
881 + <br />
882 + %= $c->l("dhcpd_SAVE_TITLE");
883 + <br />
884 + %= submit_button "$btn", class => 'action'
885 + % end
886 + <br>
887 + <table class="sme-border table-sort"><tbody>
888 + <tr>
889 + <th class='sme-border'>
890 + %=l 'dhcpd_IP'
891 + </th>
892 + <th class='sme-border'>
893 + %=l 'dhcpd_NETWORK_NAME'
894 + </th>
895 + <th class='sme-border'>
896 + %=l 'dhcpd_STATUS_CLICK_FOR_WOL'
897 + </th>
898 + <th class='sme-border'>
899 + %=l('dhcpd_START_DATE',"")
900 + </th>
901 + <th class='sme-border'>
902 + %=l 'dhcpd_END_DATE'
903 + </th>
904 + <th class='sme-border'>
905 + %=l 'dhcpd_MAC_ADDRESS'
906 + </th>
907 + <th class='sme-border' colspan=2>
908 + %=l 'dhcpd_ACTION'
909 + </th>
910 + </tr>
911 + % foreach my $ip (@$leases) {
912 + <tr>
913 + %= t td => (class => 'sme-border') => $ip->{ip}
914 + %= t td => (class => 'sme-border') => $ip->{name}
915 + <td class='sme-border'>
916 + % if ($ip->{wol} =~ /ACTIVE/) {
917 + <center><%==l $ip->{wol}%></center>
918 + %} else {
919 + <a href="/smanager/dhcpd9??state=wake_up&MAC=<%= $ip->{mac}%>&name=<%= $ip->{name}%>" onclick="Wol_confirm(event,'<%=$c->l('dhcpd_WAKING_A_REMOTE_COMPUTER')%>',this);"><center><%==l $ip->{wol}%></center></a>
920 + %}
921 + </td>
922 + %= t td => (class => 'sme-border') => $ip->{start}
923 + %= t td => (class => 'sme-border') => $ip->{end}
924 + %= t td => (class => 'sme-border') => $ip->{mac}
925 + <td class = 'sme-border'>
926 + <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>
927 + </td><td class = 'sme-border'>
928 + <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>
929 + </td>
930 + </tr>
931 + %}
932 + </tbody>
933 + </table>
934 + %= hidden_field "hiddenmsg"=>"", id=>"hiddenmsg"
935 + <br />
936 + %= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd'
937 +
938 + %= javascript begin
939 + function Wol_confirm(event,msg,current){
940 + const getMAC = /.*MAC\=(.*)\&name.*/;
941 + var MAC = current.href.match(getMAC)[1];
942 + if (confirm(msg+": MAC: "+MAC))
943 + { return true;}
944 + else {event.preventDefault();return false;}
945 + }
946 +
947 + function Winpop_confirm(event,msg,current){
948 + const getIP = /.*ip\=(.*)/;
949 + var IP = ": IP: "+current.href.match(getIP)[1];
950 + msg = msg.replace("$",IP);
951 + var retVal = prompt(msg);
952 + if (retVal) {
953 + //Write it away in a hidden field
954 + $hidden = document.getElementById("hiddenMsg");
955 + $hidden.value = retVal;
956 + return true;
957 + } else {event.preventDefault();return false;}
958 + }
959 +
960 + function Remove_lease_confirm(event,msg,current){
961 + const getIP = /.*ip\=(.*)/;
962 + var IP = current.href.match(getIP)[1];
963 + if (prompt(msg+" IP: "+IP))
964 + { return true;}
965 + else {event.preventDefault();return false;}
966 + }
967 +
968 + %end
969 +
970 +
971 +</div>
972 \ No newline at end of file

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