diff --git a/Targets/Letsencrypt/Letsencrypt.pm b/Targets/Letsencrypt/Letsencrypt.pm index 55dc60b..fa92aed 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-27 16:15:50 +# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-11-29 13:00:55 # #---------------------------------------------------------------------- # heading : Network @@ -43,12 +43,6 @@ use esmith::HostsDB; use esmith::DomainsDB; -#The most common ones -our $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); -our $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); -our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); -our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); -our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); require '/usr/share/smanager/lib/SrvMngr/Controller/Letsencrypt-Custom.pm'; #The code that is to be added by the developer @@ -67,6 +61,13 @@ sub main { my $c = shift; $c->app->log->info( $c->log_req ); + #The most common ones + my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); + my $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); + my $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); + my $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); + my $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); + my %lets_data = (); my $title = $c->l('lets_Letsencrypt_certificate'); my $modul = ''; @@ -78,25 +79,8 @@ sub main { my $db = $cdb; #pickup local or global db or Default to config - #pickup any other contents needed and load them into hash shared with panel - my %returned_hash; - # subroutine returns a hash directly - %returned_hash = $c->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; - } - - # and table control fields - $c->stash(DomainList=>$c->get_DomainList()); - + $c->do_display($lets_data{'trt'}); - $c->stash( - title => $title, - modul => $modul, - lets_data => \%lets_data - ); - $c->render( template => "letsencrypt" ); } # Post request with params - submit from the form @@ -129,6 +113,13 @@ sub do_update { $c->app->log->info($c->log_req); my $modul = ''; + #The most common ones - you might want to comment out any not used. + my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); + my $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); + my $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); + my $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); + my $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); + my %lets_data = (); my $title = $c->l('lets_Letsencrypt_certificate'); @@ -182,14 +173,6 @@ sub do_update { if ($ret ne "ok"){ -# lets_data{'trt'} = $thispanel; -# $c->stash(error => $c->l($ret)); -# $c->stash( -# title => $title, -# modul => $modul, -# lets_data => \%lets_data -# ); -# $c->render( template => "letsencrypt" ); $c->do_display($thispanel); } else { #Do whatever is needed, including writing values to the DB @@ -287,12 +270,8 @@ sub do_update { } else { $lets_data{'trt'} = 'none'; } - $c->stash( - title => $title, - modul => $modul, - lets_data => \%lets_data - ); - $c->render( template => "letsencrypt" ); + $c->do_display($lets_data{'trt'}); + } } @@ -310,6 +289,13 @@ sub do_display { my ($c,$trt) = @_; $c->app->log->info($c->log_req); + + #The most common ones - you might want to comment out any not used. + my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); + my $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); + my $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); + my $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); + my $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); my %lets_data = (); my $title = $c->l('lets_Letsencrypt_certificate'); diff --git a/Targets/Letsencrypt/_lets_CHECKALLDOMAINS.html.ep b/Targets/Letsencrypt/_lets_CHECKALLDOMAINS.html.ep index d106344..68d38f1 100644 --- a/Targets/Letsencrypt/_lets_CHECKALLDOMAINS.html.ep +++ b/Targets/Letsencrypt/_lets_CHECKALLDOMAINS.html.ep @@ -1,5 +1,5 @@ %# -%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-11-27 16:15:50 +%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-11-29 13:00:55 %#