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

@@ -75,12 +75,22 @@ sub main {
#Load any DB entries into the <prefix>_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
my $db = $$${controldb | db | 'cdb'}; #pickup local or global db or Default to config
<tal:block tal:repeat="dbentry dbentries">
$$${prefix}_data{${dbentry}} = $db->prop('${dbentry}') || ${dbdefault | ""} || "";
<tal:block tal:repeat="dbfield dbfields">
$$${prefix}_data{${dbfield}} = $db->prop('${dbfield}') || ${dbdefault | ""} || "";
</tal:block>
#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_${firstPanel}();
# Copy each key-value pair from the returned hash to the prefix data hash
while (my ($key, $value) = each %returned_hash) {
$$${prefix}_data{$key} = $value;
}
# and table control fields
<tal:block tal:repeat="tablecontrol tablecontrols"> $c->stash(${tablecontrol}=>$c->get_${tablecontrol}());
<tal:block tal:repeat="tablecontrol tablecontrols">
$c->stash(${tablecontrol}=>$c->get_${tablecontrol}());
</tal:block>
$c->stash(
@@ -169,7 +179,7 @@ sub do_update {
</tal:block>
# and call any signal-events needed
# Setup shared data and call panel
$c->stash(
title => $title,
@@ -180,7 +190,7 @@ sub do_update {
} else {
$$${prefix}_data{'trt'} = '${NextPanel | "none"}';
}
$c->render("${lcPackageName}");
$c->do_display()
}
}
@@ -236,6 +246,25 @@ sub do_display {
# Where to go now
$$${prefix}_data{'trt'} = $trt;
# Set up other shared data according to the panel to go to
<tal:block tal:repeat="panel panels">
if ($trt eq '${panel}'){
# 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_${panel}();
# Copy each key-value pair from the returned hash to the prefix data hash
while (my ($key, $value) = each %returned_hash) {
$$${prefix}_data{$key} = $value;
}
}
</tal:block>
# and table control fields
<tal:block tal:repeat="tablecontrol tablecontrols">
$c->stash(${tablecontrol}=>$c->get_${tablecontrol}());
</tal:block>
# Data for panel
$c->stash(
title => $title,
@@ -243,4 +272,4 @@ sub do_display {
);
$c->render("${lcPackageName}");
}
1;
1;

View File

@@ -2,7 +2,7 @@
# Generated by ${version}
#
#
# Routines to be edited by the developer to provide validation for parameters
# Routines to be edited by the developer to provide content and validation for parameters
# and provison of the control data for table(s)
#
use esmith::util;
@@ -29,8 +29,26 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
return $ret;
}
</tal:block>
# Get singleton data for each panel
<tal:block tal:repeat="panel panels">
sub get_data_for_panel_${panel} {
# Return a hash with the fields required which will be loaded into the shared data
my $c = shift;
my %ret = (
'Data1'=>'Data for ${panel}', #Example
# fields from Inputs in ${panel} $fields['${panel}']
<tal:block tal:repeat="field fields[panel]">
'${field}'=>'${field} contents',
</tal:block>
);
return %ret;
}
</tal:block>
# Get control data for tables(s)
# Get control data for table(s)
<tal:block tal:repeat="tablecontrol tablecontrols">
sub get_${tablecontrol} {
# Return an array of hashes of the contents for each row and column for ${tablecontrol}

View File

@@ -222,11 +222,16 @@
</Table>
<Preformatted><![CDATA[
<pre class='preformatted pref${type_serial}'>
${Value}'
</pre>
<pre class='preformatted pref${type_serial}'>
${Value}
</pre>
]]>
</Preformatted>
<Link><![CDATA[
%= link_to l('${title}'), '${structure:href}' , class=>'link link${type_serial}'
]]>
</Link>
</root>

View File

@@ -49,4 +49,4 @@
</div>
%end
%end

View File

@@ -7,9 +7,6 @@
SelectInput();
};
</script>
<h2>
%= l('${prefix} Hello ${route}');
</h2>
% my $btn = l('APPLY');
%= form_for "${PackageName}d" => (method => 'POST') => begin
@@ -18,4 +15,4 @@
%# Inputs etc in here.
%# Probably finally by a submit.
%end
</div>
</div>