diff --git a/Targets/Letsencrypt/Letsencrypt-Custom.pm b/Targets/Letsencrypt/Letsencrypt-Custom.pm index 4b0b1cd..fd25a08 100644 --- a/Targets/Letsencrypt/Letsencrypt-Custom.pm +++ b/Targets/Letsencrypt/Letsencrypt-Custom.pm @@ -6,10 +6,10 @@ # and provison of the control data for table(s) # use esmith::util; +use esmith::ConfigDB; use esmith::HostsDB; use esmith::AccountsDB; use esmith::NetworksDB; -use esmith::HostsDB; use esmith::DomainsDB; #use Net::SSLeay; @@ -81,14 +81,14 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); my %ret = ( 'Data1'=>'Data for PARAMS', #Example # fields from Inputs in PARAMS $fields['PARAMS'] - 'status'=>get_prop('letsencrypt', 'status', 'disabled', - 'hookScript'=>get_prop('letsencrypt', 'hookScript', 'disabled'), - 'hostOverride'=>get_prop('letsencrypt', 'hostOverride', 'disabled'), - 'ACCEPT_TERMS'=>get_prop('letsencrypt', 'ACCEPT_TERMS', ''), - 'API'=>get_prop('letsencrypt', 'API', '2'), - 'keysize'=>get_prop('letsencrypt', 'keysize', '4096'), - 'configure'=>get_prop('letsencrypt', 'configure', 'none' ), - 'Email'=>get_prop('letsencrypt', 'email') + 'status'=>$cdb->get_prop('letsencrypt', 'status', 'disabled'), + 'hookScript'=>$cdb->get_prop('letsencrypt', 'hookScript', 'disabled'), + 'hostOverride'=>$cdb->get_prop('letsencrypt', 'hostOverride', 'disabled'), + 'ACCEPT_TERMS'=>$cdb->get_prop('letsencrypt', 'ACCEPT_TERMS', ''), + 'API'=>$cdb->get_prop('letsencrypt', 'API', '2'), + 'keysize'=>$cdb->get_prop('letsencrypt', 'keysize', '4096'), + 'configure'=>$cdb->get_prop('letsencrypt', 'configure', 'none' ), + 'Email'=>$cdb->get_prop('letsencrypt', 'email') ); return %ret; } @@ -159,7 +159,7 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); # } my @data = (); - my $check = $c->l('CHECK'); + my $check = $c->l('Check Domain'); for ($ddb->domains) { @@ -167,7 +167,9 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); my $le = $_->prop('letsencryptSSLcert') || 'disabled';#letsencrypt configure all my $dname= $_->key; my $isincert = "N"; - my $check = $c->l('lets_CHECK'); + my $link = $c->create_link("letsencryptd","CHECKONEDOMAIN",""); + my $checklink = "".$check.""; + #my $checklink = "check"; $isincert = "Y" if ( $dname ~~ @list); # domain push @data, @@ -175,7 +177,7 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); $_->props, letsencryptSSLcert => $le, isincert => $isincert, - Check => $check, + Check => $checklink, Nameservers => $ns, }; #and hosts @@ -192,7 +194,7 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); Description=>$h->prop('ExternalIP')|| $h->prop('InternalIP')||"", Content => $h->prop('HostType'), isincert => $isincert, - Check => $check, + Check => "", #$checklink Nameservers => $c->l($ns), } } @@ -284,7 +286,7 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); sub create_link{ # WIP - my ($c,$route, $panel, $index) = shift; + my ($c,$route, $panel, $index) = @_; my $link = "$route?trt=$panel&Selected=$index"; return $link; } diff --git a/Targets/Letsencrypt/Letsencrypt.pm b/Targets/Letsencrypt/Letsencrypt.pm index eeeac5a..06890bd 100644 --- a/Targets/Letsencrypt/Letsencrypt.pm +++ b/Targets/Letsencrypt/Letsencrypt.pm @@ -1,6 +1,6 @@ package SrvMngr::Controller::Letsencrypt; # -# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-11-06 11:09:38 +# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-11-13 16:29:07 # #---------------------------------------------------------------------- # heading : Network @@ -35,7 +35,7 @@ use SrvMngr qw(theme_list init_session); use Data::Dumper; use esmith::util; -use esmith::HostsDB; +use esmith::ConfigDB; use esmith::AccountsDB; use esmith::NetworksDB; use esmith::HostsDB; @@ -70,7 +70,7 @@ sub main { my $title = $c->l('lets_Letsencrypt_certificate'); my $modul = ''; - $lets_data{'trt'} = 'CHECKALLDOMAINS'; + $lets_data{'trt'} = 'LIST'; #Load any DB entries into the _data area so as they are preset in the form # which DB - this only really works if the initial panel is a PARAMS type panel and not a TABLE @@ -80,7 +80,7 @@ sub main { #pickup any other contents needed and load them into hash shared with panel my %returned_hash; # subroutine returns a hash directly - %returned_hash = get_data_for_panel_CHECKALLDOMAINS(); + %returned_hash = get_data_for_panel_LIST(); # Copy each key-value pair from the returned hash to the prefix data hash while (my ($key, $value) = each %returned_hash) { $lets_data{$key} = $value; @@ -138,12 +138,12 @@ sub do_update { my $num_params = keys %params; #Params are available in the hash "params" - copy to the prefix_data hash - while (my ($key, $value) = each %{$c->req->params->to_hash}) { - $lets_data{$key} = $value; - } + #while (my ($key, $value) = each %{$c->req->params->to_hash}) { + # $lets_data{$key} = $value; + #} # the value of trt will tell you which panel has returned - my $trt = $c->param('trt') || 'CHECKALLDOMAINS'; #hidden control on every form. + my $trt = $c->param('trt') || 'LIST'; #hidden control on every form. my $ret = 'ok'; #Validate the parameters in a custom sub one for each panel (although only one of these will be executed) @@ -173,10 +173,10 @@ sub do_update { $thispanel = 'CHECKALLENABLEDDOMAINS'; } - if ($trt eq 'CHECKONEDDOMAINS'){ - #Validate form parameters for panel CHECKONEDDOMAINS - $ret = $c->validate_CHECKONEDDOMAINS(\%lets_data); - $thispanel = 'CHECKONEDDOMAINS'; + if ($trt eq 'CHECKONEDDOMAIN'){ + #Validate form parameters for panel CHECKONEDDOMAIN + $ret = $c->validate_CHECKONEDDOMAIN(\%lets_data); + $thispanel = 'CHECKONEDDOMAIN'; } @@ -235,15 +235,15 @@ sub do_update { } } - if ($trt eq 'CHECKONEDDOMAINS'){ + if ($trt eq 'CHECKONEDDOMAIN'){ #do whatever is required ... - $ret = $c->perform_CHECKONEDDOMAINS(\%lets_data); + $ret = $c->perform_CHECKONEDDOMAIN(\%lets_data); if ($ret ne "ok") { # return to the panel with error message $c->stash(error => $c->l($ret)); $c->render("letsencrypt"); } else { - $c->stash( success => $c->l('lets_CHECKONEDDOMAINS_panel_action_was_successful')); #A bit bland - edit it in the lex file + $c->stash( success => $c->l('lets_CHECKONEDDOMAIN_panel_action_was_successful')); #A bit bland - edit it in the lex file } } @@ -256,7 +256,7 @@ sub do_update { lets_data => \%lets_data ); if ('none' eq 'none') { - $lets_data{'trt'} = 'CHECKALLDOMAINS'; + $lets_data{'trt'} = 'LIST'; } else { $lets_data{'trt'} = 'none'; } @@ -292,12 +292,12 @@ sub do_display { my $is_new_record = ($c->req->method() eq 'POST'); #Params are available in the hash "params" - copy to the prefix_data hash - while (my ($key, $value) = each %{$c->req->params->to_hash}) { - $lets_data{$key} = $value; - } + #while (my ($key, $value) = each %{$c->req->params->to_hash}) { + # $lets_data{$key} = $value; + #} # the value of trt will tell you which panel has returned - my $trt = $c->param('trt') || 'CHECKALLDOMAINS'; #Indicates where to go now + my $trt = $c->param('trt') || 'LIST'; #Indicates where to go now # Now add in the params from the selected row from the table @@ -323,9 +323,9 @@ sub do_display { %selectedrow = $c->get_selected_CHECKALLENABLEDDOMAINS($lets_data{'Selected'},$is_new_record); } - if ($trt eq 'CHECKONEDDOMAINS'){ - #Validate form parameters for panel CHECKONEDDOMAINS - %selectedrow = $c->get_selected_CHECKONEDDOMAINS($lets_data{'Selected'},$is_new_record); + if ($trt eq 'CHECKONEDDOMAIN'){ + #Validate form parameters for panel CHECKONEDDOMAIN + %selectedrow = $c->get_selected_CHECKONEDDOMAIN($lets_data{'Selected'},$is_new_record); } @@ -382,11 +382,11 @@ sub do_display { } } - if ($trt eq 'CHECKONEDDOMAINS'){ + if ($trt eq 'CHECKONEDDOMAIN'){ # pickup any other contents needed and load them into hash shared with panel my %returned_hash; # subroutine returns a hash directly - %returned_hash = get_data_for_panel_CHECKONEDDOMAINS(); + %returned_hash = get_data_for_panel_CHECKONEDDOMAIN(); # Copy each key-value pair from the returned hash to the prefix data hash while (my ($key, $value) = each %returned_hash) { $lets_data{$key} = $value; diff --git a/Targets/Letsencrypt/_lets_CHECKONEDDOMAINS.html.ep b/Targets/Letsencrypt/_lets_CHECKONEDOMAIN.html.ep similarity index 59% rename from Targets/Letsencrypt/_lets_CHECKONEDDOMAINS.html.ep rename to Targets/Letsencrypt/_lets_CHECKONEDOMAIN.html.ep index 8aece5d..40ece1a 100644 --- a/Targets/Letsencrypt/_lets_CHECKONEDDOMAINS.html.ep +++ b/Targets/Letsencrypt/_lets_CHECKONEDOMAIN.html.ep @@ -1,7 +1,7 @@ %# -%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-11-06 10:28:31 +%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-11-13 16:37:25 %# -
+