Add list of singleton pamraeters to custom, refine letsencrypt json

This commit is contained in:
2024-11-04 17:08:38 +00:00
parent d5a771f6f3
commit f238fcfa70
27 changed files with 868 additions and 251 deletions

View File

@@ -1,11 +1,11 @@
package SrvMngr::Controller::Letsencrypt;
#
# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-10-18 19:00:38
# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-11-04 16:03:10
#
#----------------------------------------------------------------------
# heading : Miscellaneous
# description : letsencrypt
# navigation : 2000 400
# heading : Network
# description : Letsencrypt certificate
# navigation : 6000 6600
#
# name : letsencrypt, method : get, url : /letsencrypt, ctlact : Letsencrypt#main
# name : letsencryptu, method : post, url : /letsencryptu, ctlact : Letsencrypt#do_update
@@ -67,7 +67,7 @@ sub main {
$c->app->log->info( $c->log_req );
my %lets_data = ();
my $title = $c->l('lets_letsencrypt');
my $title = $c->l('lets_Letsencrypt_certificate');
my $modul = '';
$lets_data{'trt'} = 'LIST';
@@ -76,9 +76,19 @@ sub main {
# which DB - this only really works if the initial panel is a PARAMS type panel and not a TABLE
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 = 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->stash(DomainList=>$c->get_DomainList());
$c->stash(
@@ -119,7 +129,7 @@ sub do_update {
$c->app->log->info($c->log_req);
my %lets_data = ();
my $title = $c->l('lets_letsencrypt');
my $title = $c->l('lets_Letsencrypt_certificate');
# Accessing all POST parameters
my %params = $c->req->params->to_hash;
@@ -151,6 +161,18 @@ sub do_update {
$thispanel = 'PARAMS';
}
if ($trt eq 'CHECKALLDOMAINS'){
#Validate form parameters for panel CHECKALLDOMAINS
$ret = $c->validate_CHECKALLDOMAINS(\%lets_data);
$thispanel = 'CHECKALLDOMAINS';
}
if ($trt eq 'CHECKALLENABLEDDOMAINS'){
#Validate form parameters for panel CHECKALLENABLEDDOMAINS
$ret = $c->validate_CHECKALLENABLEDDOMAINS(\%lets_data);
$thispanel = 'CHECKALLENABLEDDOMAINS';
}
if ($ret ne "ok") {
# return to the panel with error message
@@ -183,9 +205,33 @@ sub do_update {
}
}
if ($trt eq 'CHECKALLDOMAINS'){
#do whatever is required ...
$ret = $c->perform_CHECKALLDOMAINS(\%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_CHECKALLDOMAINS_panel_action_was_successful')); #A bit bland - edit it in the lex file
}
}
if ($trt eq 'CHECKALLENABLEDDOMAINS'){
#do whatever is required ...
$ret = $c->perform_CHECKALLENABLEDDOMAINS(\%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_CHECKALLENABLEDDOMAINS_panel_action_was_successful')); #A bit bland - edit it in the lex file
}
}
# and call any signal-events needed
# Setup shared data and call panel
$c->stash(
title => $title,
@@ -196,7 +242,7 @@ sub do_update {
} else {
$lets_data{'trt'} = 'none';
}
$c->render("letsencrypt");
$c->do_display()
}
}
@@ -216,7 +262,7 @@ sub do_display {
$c->app->log->info($c->log_req);
my %lets_data = ();
my $title = $c->l('lets_letsencrypt');
my $title = $c->l('lets_Letsencrypt_certificate');
# Accessing all parameters
my %params = $c->req->params->to_hash;
@@ -249,6 +295,16 @@ sub do_display {
%selectedrow = $c->get_selected_PARAMS($lets_data{'Selected'},$is_new_record);
}
if ($trt eq 'CHECKALLDOMAINS'){
#Validate form parameters for panel CHECKALLDOMAINS
%selectedrow = $c->get_selected_CHECKALLDOMAINS($lets_data{'Selected'},$is_new_record);
}
if ($trt eq 'CHECKALLENABLEDDOMAINS'){
#Validate form parameters for panel CHECKALLENABLEDDOMAINS
%selectedrow = $c->get_selected_CHECKALLENABLEDDOMAINS($lets_data{'Selected'},$is_new_record);
}
#Copy in the selected row params to the prefix_data hash to pass to the panel
while (my ($key, $value) = each %selectedrow){
@@ -257,6 +313,58 @@ sub do_display {
# Where to go now
$lets_data{'trt'} = $trt;
# Set up other shared data according to the panel to go to
if ($trt eq 'LIST'){
# 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_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;
}
}
if ($trt eq 'PARAMS'){
# 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_PARAMS();
# 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;
}
}
if ($trt eq 'CHECKALLDOMAINS'){
# 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();
# 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;
}
}
if ($trt eq 'CHECKALLENABLEDDOMAINS'){
# 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_CHECKALLENABLEDDOMAINS();
# 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());
# Data for panel
$c->stash(
title => $title,
@@ -264,4 +372,4 @@ sub do_display {
);
$c->render("letsencrypt");
}
1;
1;