Sort out selection options
This commit is contained in:
parent
964771d876
commit
0f5c4f948c
@ -28,7 +28,7 @@
|
|||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('lets_SERVICE_STATUS')
|
%=l('lets_SERVICE_STATUS')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% my @status_options = Disabled;
|
% my @status_options = [{'Value': 'disabled', 'Text': 'Disabled'}, {'Value': 'enabled', 'Text': 'Enabled'}, {'Value': 'test', 'Text': 'TEST'}];
|
||||||
% param 'status' => $lets_data->{status} unless param 'status';
|
% param 'status' => $lets_data->{status} unless param 'status';
|
||||||
%= select_field 'status' => @status_options, class => 'input'
|
%= select_field 'status' => @status_options, class => 'input'
|
||||||
<br></span> </p>
|
<br></span> </p>
|
||||||
@ -36,7 +36,7 @@
|
|||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('lets_HOOKSCRIPT_STATUS')
|
%=l('lets_HOOKSCRIPT_STATUS')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% my @hookScript_options = ;
|
% my @hookScript_options = [{'Value': 'disabled', 'Text': 'Disabled'}, {'Value': 'enabled', 'Text': 'Enabled'}];
|
||||||
% param 'hookScript' => $lets_data->{hookScript} unless param 'hookScript';
|
% param 'hookScript' => $lets_data->{hookScript} unless param 'hookScript';
|
||||||
%= select_field 'hookScript' => @hookScript_options, class => 'input'
|
%= select_field 'hookScript' => @hookScript_options, class => 'input'
|
||||||
<br></span> </p>
|
<br></span> </p>
|
||||||
@ -44,7 +44,7 @@
|
|||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('lets_HOSTOVERRIDE_STATUS')
|
%=l('lets_HOSTOVERRIDE_STATUS')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% my @hostOverride_options = ;
|
% my @hostOverride_options = [{'Value': 'disabled', 'Text': 'Disabled'}, {'Value': 'yes', 'Text': 'Yes'}];
|
||||||
% param 'hostOverride' => $lets_data->{hostOverride} unless param 'hostOverride';
|
% param 'hostOverride' => $lets_data->{hostOverride} unless param 'hostOverride';
|
||||||
%= select_field 'hostOverride' => @hostOverride_options, class => 'input'
|
%= select_field 'hostOverride' => @hostOverride_options, class => 'input'
|
||||||
<br></span> </p>
|
<br></span> </p>
|
||||||
@ -52,7 +52,7 @@
|
|||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('lets_ACCEPT_TERMS_STATUS')
|
%=l('lets_ACCEPT_TERMS_STATUS')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% my @ACCEPT_TERMS_options = ;
|
% my @ACCEPT_TERMS_options = [{'Value': 'disabled', 'Text': 'Disabled'}, {'Value': 'yes', 'Text': 'Yes'}];
|
||||||
% param 'ACCEPT_TERMS' => $lets_data->{ACCEPT_TERMS} unless param 'ACCEPT_TERMS';
|
% param 'ACCEPT_TERMS' => $lets_data->{ACCEPT_TERMS} unless param 'ACCEPT_TERMS';
|
||||||
%= select_field 'ACCEPT_TERMS' => @ACCEPT_TERMS_options, class => 'input'
|
%= select_field 'ACCEPT_TERMS' => @ACCEPT_TERMS_options, class => 'input'
|
||||||
<br></span> </p>
|
<br></span> </p>
|
||||||
@ -60,7 +60,7 @@
|
|||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('lets_API_STATUS')
|
%=l('lets_API_STATUS')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% my @API_options = ;
|
% my @API_options = [{'Value': '2', 'Text': '2'}];
|
||||||
% param 'API' => $lets_data->{API} unless param 'API';
|
% param 'API' => $lets_data->{API} unless param 'API';
|
||||||
%= select_field 'API' => @API_options, class => 'input'
|
%= select_field 'API' => @API_options, class => 'input'
|
||||||
<br></span> </p>
|
<br></span> </p>
|
||||||
@ -68,7 +68,7 @@
|
|||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('lets_KEYSIZE_STATUS')
|
%=l('lets_KEYSIZE_STATUS')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% my @keysize_options = ;
|
% my @keysize_options = [{'Value': '2048', 'Text': '2048'}, {'Value': '3072', 'Text': '3072'}, {'Value': '4096', 'Text': '4096'}];
|
||||||
% param 'keysize' => $lets_data->{keysize} unless param 'keysize';
|
% param 'keysize' => $lets_data->{keysize} unless param 'keysize';
|
||||||
%= select_field 'keysize' => @keysize_options, class => 'input'
|
%= select_field 'keysize' => @keysize_options, class => 'input'
|
||||||
<br></span> </p>
|
<br></span> </p>
|
||||||
@ -76,7 +76,7 @@
|
|||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('lets_CONFIGUREMODE_STATUS')
|
%=l('lets_CONFIGUREMODE_STATUS')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% my @configure_options = ;
|
% my @configure_options = [{'Value': 'all', 'Text': 'ALL'}, {'Value': 'domains', 'Text': 'Domains'}, {'Value': 'hosts', 'Text': 'HOSTS'}, {'Value': 'none', 'Text': 'NONE'}];
|
||||||
% param 'configure' => $lets_data->{configure} unless param 'configure';
|
% param 'configure' => $lets_data->{configure} unless param 'configure';
|
||||||
%= select_field 'configure' => @configure_options, class => 'input'
|
%= select_field 'configure' => @configure_options, class => 'input'
|
||||||
<br></span> </p>
|
<br></span> </p>
|
||||||
|
129
Targets/letsencrypt-config/__PARAMS.html.ep
Normal file
129
Targets/letsencrypt-config/__PARAMS.html.ep
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
%#
|
||||||
|
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-10-19 16:14:17
|
||||||
|
%#
|
||||||
|
<div id="letsencrypt-config-PARAMS" class="partial letsencrypt-config-PARAMS">
|
||||||
|
<script>
|
||||||
|
window.onload = function() {
|
||||||
|
SelectInput();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<h2>
|
||||||
|
%= l('_Hello_PARAMS');
|
||||||
|
</h2>
|
||||||
|
% my $btn = l('APPLY');
|
||||||
|
%= form_for "letsencrypt-configd" => (method => 'POST') => begin
|
||||||
|
|
||||||
|
% param 'trt' => $_data->{trt} unless param 'trt';
|
||||||
|
%= hidden_field 'trt' => $_data->{trt}
|
||||||
|
%# Inputs etc in here.
|
||||||
|
|
||||||
|
<h1 class='head'><%=l('FORM_TITLE')%></h1>
|
||||||
|
|
||||||
|
<h2 class='subh'><%=l('Manage_letsencrypt-config_settings:')%></h2>
|
||||||
|
|
||||||
|
<p class='paragraph para1'>
|
||||||
|
%=l('CONFIG_LE')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class='paragraph para2'>
|
||||||
|
%=l('SERVICE_STATUS')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('_')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @status_options = [{'Value' => 'disabled', 'Text' => 'Disabled'}, {'Value' => 'enabled', 'Text' => 'Enabled'}, {'Value' => 'test', 'Text' => 'TEST'}];
|
||||||
|
% param 'status' => $_data->{status} unless param 'status';
|
||||||
|
%= select_field 'status' => @status_options, class => 'input'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p class='paragraph para3'>
|
||||||
|
%=l('HOOKSCRIPT_STATUS')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('_')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @hookScript_options = [{'Value' => 'disabled', 'Text' => 'Disabled'}, {'Value' => 'enabled', 'Text' => 'Enabled'}];
|
||||||
|
% param 'hookScript' => $_data->{hookScript} unless param 'hookScript';
|
||||||
|
%= select_field 'hookScript' => @hookScript_options, class => 'input'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p class='paragraph para4'>
|
||||||
|
%=l('HOSTOVERRIDE_STATUS')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('_')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @hostOverride_options = [{'Value' => 'disabled', 'Text' => 'Disabled'}, {'Value' => 'yes', 'Text' => 'Yes'}];
|
||||||
|
% param 'hostOverride' => $_data->{hostOverride} unless param 'hostOverride';
|
||||||
|
%= select_field 'hostOverride' => @hostOverride_options, class => 'input'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p class='paragraph para5'>
|
||||||
|
%=l('ACCEPT_TERMS_STATUS')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('_')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @ACCEPT_TERMS_options = [{'Value' => 'disabled', 'Text' => 'Disabled'}, {'Value' => 'yes', 'Text' => 'Yes'}];
|
||||||
|
% param 'ACCEPT_TERMS' => $_data->{ACCEPT_TERMS} unless param 'ACCEPT_TERMS';
|
||||||
|
%= select_field 'ACCEPT_TERMS' => @ACCEPT_TERMS_options, class => 'input'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p class='paragraph para6'>
|
||||||
|
%=l('API_STATUS')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('_')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @API_options = [{'Value' => '2', 'Text' => '2'}];
|
||||||
|
% param 'API' => $_data->{API} unless param 'API';
|
||||||
|
%= select_field 'API' => @API_options, class => 'input'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p class='paragraph para7'>
|
||||||
|
%=l('KEYSIZE_STATUS')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('_')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @keysize_options = [{'Value' => '2048', 'Text' => '2048'}, {'Value' => '3072', 'Text' => '3072'}, {'Value' => '4096', 'Text' => '4096'}];
|
||||||
|
% param 'keysize' => $_data->{keysize} unless param 'keysize';
|
||||||
|
%= select_field 'keysize' => @keysize_options, class => 'input'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p class='paragraph para8'>
|
||||||
|
%=l('CONFIGUREMODE_STATUS')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('_')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @configure_options = [{'Value' => 'all', 'Text' => 'ALL'}, {'Value' => 'domains', 'Text' => 'Domains'}, {'Value' => 'hosts', 'Text' => 'HOSTS'}, {'Value' => 'none', 'Text' => 'NONE'}];
|
||||||
|
% param 'configure' => $_data->{configure} unless param 'configure';
|
||||||
|
%= select_field 'configure' => @configure_options, class => 'input'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p class='paragraph para9'>
|
||||||
|
%=l('EMAIL')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('_')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'email' => $_data->{email} unless param 'email';
|
||||||
|
%= text_field 'email', size => '50', class => 'textinput email' , pattern=>'.*' , placeholder=>'email'
|
||||||
|
<br></span></p>
|
||||||
|
|
||||||
|
<span class='data'>
|
||||||
|
%= submit_button l('Save'), class => 'action subm9'
|
||||||
|
</span>
|
||||||
|
|
||||||
|
%# Probably finally by a submit.
|
||||||
|
%end
|
||||||
|
</div>
|
101
Targets/letsencrypt-config/_lets_PARAMS.html.ep
Normal file
101
Targets/letsencrypt-config/_lets_PARAMS.html.ep
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
%#
|
||||||
|
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-10-19 18:55:51
|
||||||
|
%#
|
||||||
|
<div id="letsencrypt-config-PARAMS" class="partial letsencrypt-config-PARAMS">
|
||||||
|
<script>
|
||||||
|
window.onload = function() {
|
||||||
|
SelectInput();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<h2>
|
||||||
|
%= l('lets_Hello_PARAMS');
|
||||||
|
</h2>
|
||||||
|
% my $btn = l('lets_APPLY');
|
||||||
|
%= form_for "letsencrypt-configd" => (method => 'POST') => begin
|
||||||
|
|
||||||
|
% param 'trt' => $lets_data->{trt} unless param 'trt';
|
||||||
|
%= hidden_field 'trt' => $lets_data->{trt}
|
||||||
|
%# Inputs etc in here.
|
||||||
|
|
||||||
|
<h1 class='head'><%=l('lets_FORM_TITLE')%></h1>
|
||||||
|
|
||||||
|
<h2 class='subh'><%=l('lets_Manage_letsencrypt-config_settings:')%></h2>
|
||||||
|
|
||||||
|
<p class='paragraph para1'>
|
||||||
|
%=l('lets_CONFIG_LE')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class='paragraph para2'>
|
||||||
|
%=l('lets_SERVICE_STATUS')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('lets_SERVICE_STATUS')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @status_options = [['Disabled' => 'disabled'], ['Enabled' => 'enabled'], ['TEST' => 'test']];
|
||||||
|
% param 'status' => $lets_data->{status} unless param 'status';
|
||||||
|
%= select_field 'status' => @status_options, class => 'input'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('lets_HOOKSCRIPT_STATUS')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @hookScript_options = [['Disabled' => 'disabled'], ['Enabled' => 'enabled']];
|
||||||
|
% param 'hookScript' => $lets_data->{hookScript} unless param 'hookScript';
|
||||||
|
%= select_field 'hookScript' => @hookScript_options, class => 'input'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('lets_HOSTOVERRIDE_STATUS')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @hostOverride_options = [['Disabled' => 'disabled'], ['Yes' => 'yes']];
|
||||||
|
% param 'hostOverride' => $lets_data->{hostOverride} unless param 'hostOverride';
|
||||||
|
%= select_field 'hostOverride' => @hostOverride_options, class => 'input'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('lets_ACCEPT_TERMS_STATUS')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @ACCEPT_TERMS_options = [['Disabled' => 'disabled'], ['Yes' => 'yes']];
|
||||||
|
% param 'ACCEPT_TERMS' => $lets_data->{ACCEPT_TERMS} unless param 'ACCEPT_TERMS';
|
||||||
|
%= select_field 'ACCEPT_TERMS' => @ACCEPT_TERMS_options, class => 'input'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('lets_API_STATUS')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @API_options = [['2' => '2']];
|
||||||
|
% param 'API' => $lets_data->{API} unless param 'API';
|
||||||
|
%= select_field 'API' => @API_options, class => 'input'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('lets_KEYSIZE_STATUS')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @keysize_options = [['2048' => '2048'], ['3072' => '3072'], ['4096' => '4096']];
|
||||||
|
% param 'keysize' => $lets_data->{keysize} unless param 'keysize';
|
||||||
|
%= select_field 'keysize' => @keysize_options, class => 'input'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('lets_CONFIGUREMODE_STATUS')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @configure_options = [['ALL' => 'all'], ['Domains' => 'domains'], ['HOSTS' => 'hosts'], ['NONE' => 'none']];
|
||||||
|
% param 'configure' => $lets_data->{configure} unless param 'configure';
|
||||||
|
%= select_field 'configure' => @configure_options, class => 'input'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('lets_EMAIL')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'email' => $lets_data->{email} unless param 'email';
|
||||||
|
%= text_field 'email', size => '50', class => 'textinput email' , pattern=>'.*' , placeholder=>'email'
|
||||||
|
<br></span></p>
|
||||||
|
|
||||||
|
<span class='data'>
|
||||||
|
%= submit_button l('lets_Save'), class => 'action subm9'
|
||||||
|
</span>
|
||||||
|
|
||||||
|
%# Probably finally by a submit.
|
||||||
|
%end
|
||||||
|
</div>
|
63
Targets/letsencrypt-config/letsencrypt-config-Custom.pm
Normal file
63
Targets/letsencrypt-config/letsencrypt-config-Custom.pm
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#
|
||||||
|
# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-10-19 18:55:51
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Routines to be edited by the developer to provide validation for parameters
|
||||||
|
# and provison of the control data for table(s)
|
||||||
|
#
|
||||||
|
use esmith::util;
|
||||||
|
use esmith::HostsDB;
|
||||||
|
use esmith::AccountsDB;
|
||||||
|
use esmith::NetworksDB;
|
||||||
|
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");
|
||||||
|
|
||||||
|
# Validation routines - parameters for each panel
|
||||||
|
|
||||||
|
sub validate_PARAMS {
|
||||||
|
my $c = shift;
|
||||||
|
my $prefix_data = shift; #Data hash as parameter
|
||||||
|
my $ret = 'ok';
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Get control data for tables(s)
|
||||||
|
|
||||||
|
|
||||||
|
# Return hash with values from row in which link clicked on table
|
||||||
|
|
||||||
|
sub get_selected_PARAMS {
|
||||||
|
my $c = shift;
|
||||||
|
my $selected = shift; #Parameter is name of selected row.
|
||||||
|
my $is_new_record = shift; #Indicates new record required (defaults)
|
||||||
|
my %ret = {};
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#after sucessful modify or create or whatever and submit then perfom (if the params validate)
|
||||||
|
|
||||||
|
sub perform_PARAMS {
|
||||||
|
my $c = shift;
|
||||||
|
my $prefix_data = shift; #Data hash as parameter
|
||||||
|
my $ret = 'ok';
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub create_link{
|
||||||
|
# WIP
|
||||||
|
my ($c,$route, $panel, $index) = shift;
|
||||||
|
my $link = "$route?trt=$panel&Selected=$index";
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
1;
|
19
Targets/letsencrypt-config/letsencrypt-config.css
Normal file
19
Targets/letsencrypt-config/letsencrypt-config.css
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Generated by SM2Gen version: SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-10-19 18:55:51
|
||||||
|
*/
|
||||||
|
.letsencrypt-config-panel {}
|
||||||
|
.name {}
|
||||||
|
.rout {}
|
||||||
|
.head {}
|
||||||
|
.subh {}
|
||||||
|
.para1 {}
|
||||||
|
.para2 {}
|
||||||
|
.sele1 {}
|
||||||
|
.sele2 {}
|
||||||
|
.sele3 {}
|
||||||
|
.sele4 {}
|
||||||
|
.sele5 {}
|
||||||
|
.sele6 {}
|
||||||
|
.sele7 {}
|
||||||
|
.text8 {}
|
||||||
|
.subm9 {}
|
52
Targets/letsencrypt-config/letsencrypt-config.html.ep
Normal file
52
Targets/letsencrypt-config/letsencrypt-config.html.ep
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
%#
|
||||||
|
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-10-19 18:55:51
|
||||||
|
%#
|
||||||
|
% layout 'default', title => "Sme server 2 - letsencrypt-config", share_dir => './';
|
||||||
|
%# css specific to this panel:
|
||||||
|
% content_for 'module' => begin
|
||||||
|
%= stylesheet '/css/letsencrypt-config.css'
|
||||||
|
<div id="module" class="module letsencrypt-config-panel">
|
||||||
|
|
||||||
|
% if ($config->{debug} == 1) {
|
||||||
|
<p>
|
||||||
|
%= dumper $c->current_route
|
||||||
|
</p>
|
||||||
|
% }
|
||||||
|
|
||||||
|
<h1><%=$title%></h1>
|
||||||
|
|
||||||
|
% if ( stash('modul') ) {
|
||||||
|
%= $c->render_to_string(inline => stash('modul') );
|
||||||
|
% }
|
||||||
|
|
||||||
|
%if ($lets_data->{first}) {
|
||||||
|
<br><p>
|
||||||
|
%=$c->render_to_string(inline =>$c->l($lets_data->{first}))
|
||||||
|
</p>
|
||||||
|
|
||||||
|
%} elsif ($lets_data->{success}) {
|
||||||
|
<div class='sme-border'>
|
||||||
|
<h2> Operation Status Report</h2><p>
|
||||||
|
%= $c->l($lets_data->{success});
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
%} elsif ($lets_data->{error}) {
|
||||||
|
<div class='sme-error'>
|
||||||
|
<h2> Operation Status Report - error</h2><p>
|
||||||
|
%= $c->l($lets_data->{error});
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
%}
|
||||||
|
|
||||||
|
%#Routing to partials according to trt parameter.
|
||||||
|
%#This ought to be cascading if/then/elsif, but is easier to just stack the if/then's rather like a case statement'
|
||||||
|
|
||||||
|
% if ($lets_data->{trt} eq "PARAMS") {
|
||||||
|
%= include 'partials/_lets_PARAMS'
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
%end
|
243
Targets/letsencrypt-config/letsencrypt-config.pm
Normal file
243
Targets/letsencrypt-config/letsencrypt-config.pm
Normal file
@ -0,0 +1,243 @@
|
|||||||
|
package SrvMngr::Controller::letsencrypt-config;
|
||||||
|
#
|
||||||
|
# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-10-19 18:55:51
|
||||||
|
#
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Miscellaneous
|
||||||
|
# description : letsencrypt-config
|
||||||
|
# navigation : 2000 400
|
||||||
|
#
|
||||||
|
# name : letsencrypt-config, method : get, url : /letsencrypt-config, ctlact : letsencrypt-config#main
|
||||||
|
# name : letsencrypt-configu, method : post, url : /letsencrypt-configu, ctlact : letsencrypt-config#do_update
|
||||||
|
# name : letsencrypt-configd, method : get, url : /letsencrypt-configd, ctlact : letsencrypt-config#do_display
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#
|
||||||
|
# Documentation: https://wiki.contribs.org/letsencrypt-config
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
#
|
||||||
|
# Scheme of things:
|
||||||
|
#
|
||||||
|
# TBA!!
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use constant FALSE => 0;
|
||||||
|
use constant TRUE => 1;
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
use Data::Dumper;
|
||||||
|
|
||||||
|
use esmith::util;
|
||||||
|
use esmith::HostsDB;
|
||||||
|
use esmith::AccountsDB;
|
||||||
|
use esmith::NetworksDB;
|
||||||
|
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-config-Custom.pm'; #The code that is to be added by the developer
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
#
|
||||||
|
# Initial entry - route is "/<whatever>"
|
||||||
|
#
|
||||||
|
#set initial panel
|
||||||
|
#for initial panel:
|
||||||
|
#Specifiy panel to enter
|
||||||
|
#load up _data hash with DB fields
|
||||||
|
#load up stash with pointer(s) to control fields hash(= get-))
|
||||||
|
#and a pointer to the prefix_data hash
|
||||||
|
#render initial panel
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info( $c->log_req );
|
||||||
|
|
||||||
|
my %lets_data = ();
|
||||||
|
my $title = $c->l('lets_letsencrypt-config');
|
||||||
|
my $modul = '';
|
||||||
|
|
||||||
|
$lets_data{'trt'} = 'PARAMS';
|
||||||
|
|
||||||
|
#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 = $cdb; #pickup local or global db or Default to config
|
||||||
|
|
||||||
|
|
||||||
|
# and table control fields
|
||||||
|
|
||||||
|
|
||||||
|
$c->stash(
|
||||||
|
title => $title,
|
||||||
|
modul => $modul,
|
||||||
|
lets_data => \%lets_data
|
||||||
|
);
|
||||||
|
$c->render( template => "letsencrypt-config" );
|
||||||
|
}
|
||||||
|
|
||||||
|
# Post request with params - submit from the form
|
||||||
|
sub do_update {
|
||||||
|
#
|
||||||
|
# Return after submit pushed on panel (this is a post) - route is "/<whatever>u"
|
||||||
|
# parameters in the params hash.
|
||||||
|
#
|
||||||
|
#load up all params into prefix_data hash:
|
||||||
|
#By panel (series of if statements - only one executed):
|
||||||
|
#call validate-PANEL() - return ret = ok or error message
|
||||||
|
|
||||||
|
#if validation not ok:
|
||||||
|
#render back to current panel with error message in stash
|
||||||
|
#otherwise:
|
||||||
|
#By panel (series of if statements - only one executed):
|
||||||
|
#do whatever is required: call perform-PANEL() - return "ok" or Error Message
|
||||||
|
#call signal-event for any global actions specified (check it exists - error and continue?)
|
||||||
|
#if action smeserver-<whatever>-update exists
|
||||||
|
#signal_event smeserver-<whatever>-update
|
||||||
|
#call signal-event for any specific actions for thids panel (check it exists first - error and continue)
|
||||||
|
#set success in stash
|
||||||
|
#if no "nextpanel" entry:
|
||||||
|
#set firstpanel
|
||||||
|
#else
|
||||||
|
#set nextpanel
|
||||||
|
#call render
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my %lets_data = ();
|
||||||
|
my $title = $c->l('lets_letsencrypt-config');
|
||||||
|
|
||||||
|
# Accessing all POST parameters
|
||||||
|
my %params = $c->req->params->to_hash;
|
||||||
|
|
||||||
|
# Get number of POST parameters
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
# the value of trt will tell you which panel has returned
|
||||||
|
my $trt = $c->param('trt') || 'PARAMS'; #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)
|
||||||
|
|
||||||
|
my $thispanel;
|
||||||
|
|
||||||
|
if ($trt eq 'PARAMS'){
|
||||||
|
#Validate form parameters for panel PARAMS
|
||||||
|
$ret = $c->validate_PARAMS(\%lets_data);
|
||||||
|
$thispanel = 'PARAMS';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($ret ne "ok") {
|
||||||
|
# return to the panel with error message
|
||||||
|
$c->stash(error => $c->l($ret));
|
||||||
|
$c->render("letsencrypt-config");
|
||||||
|
} else {
|
||||||
|
#Do whatever is needed, including writing values to the DB
|
||||||
|
|
||||||
|
if ($trt eq 'PARAMS'){
|
||||||
|
#do whatever is required ...
|
||||||
|
$ret = $c->perform_PARAMS(\%lets_data);
|
||||||
|
if ($ret ne "ok") {
|
||||||
|
# return to the panel with error message
|
||||||
|
$c->stash(error => $c->l($ret));
|
||||||
|
$c->render("letsencrypt-config");
|
||||||
|
} else {
|
||||||
|
$c->stash( success => $c->l('lets_PARAMS_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,
|
||||||
|
lets_data => \%lets_data
|
||||||
|
);
|
||||||
|
if ('none' eq 'none') {
|
||||||
|
$lets_data{'trt'} = 'PARAMS';
|
||||||
|
} else {
|
||||||
|
$lets_data{'trt'} = 'none';
|
||||||
|
}
|
||||||
|
$c->render("letsencrypt-config");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub do_display {
|
||||||
|
#
|
||||||
|
# Return after link clicked in table (this is a get) - route is "/<whatever>d"
|
||||||
|
# Expects ?trt=PANEL&selected="TableRowName" plus any other required
|
||||||
|
#
|
||||||
|
# OR it maybe a post from the main panel to add a new record
|
||||||
|
#
|
||||||
|
#load up all supplied params into prefix_data hash
|
||||||
|
#call get-selected-PANEL() - returns hash of all relevent parameters
|
||||||
|
#load up returned hash into prefix_data
|
||||||
|
#render - to called panel
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my %lets_data = ();
|
||||||
|
my $title = $c->l('lets_letsencrypt-config');
|
||||||
|
|
||||||
|
# Accessing all parameters
|
||||||
|
my %params = $c->req->params->to_hash;
|
||||||
|
|
||||||
|
# Get number of parameters
|
||||||
|
my $num_params = keys %params;
|
||||||
|
|
||||||
|
#Tag as Post or Get (ie. create new entry or edit existing one
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
# the value of trt will tell you which panel has returned
|
||||||
|
my $trt = $c->param('trt') || 'PARAMS'; #Indicates where to go now
|
||||||
|
|
||||||
|
# Now add in the params from the selected row from the table
|
||||||
|
|
||||||
|
my %selectedrow;
|
||||||
|
|
||||||
|
if ($trt eq 'PARAMS'){
|
||||||
|
#Validate form parameters for panel PARAMS
|
||||||
|
%selectedrow = $c->get_selected_PARAMS($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){
|
||||||
|
$lets_data{$key} = $value;
|
||||||
|
}
|
||||||
|
# Where to go now
|
||||||
|
$lets_data{'trt'} = $trt;
|
||||||
|
|
||||||
|
# Data for panel
|
||||||
|
$c->stash(
|
||||||
|
title => $title,
|
||||||
|
lets_data => \%lets_data
|
||||||
|
);
|
||||||
|
$c->render("letsencrypt-config");
|
||||||
|
}
|
||||||
|
1;
|
20
Targets/letsencrypt-config/letsencrypt-config_en.lex
Normal file
20
Targets/letsencrypt-config/letsencrypt-config_en.lex
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#
|
||||||
|
# Generated by SM2Gen version: SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-10-19 18:55:51
|
||||||
|
#
|
||||||
|
'lets_FORM_TITLE' => 'FORM TITLE',
|
||||||
|
'lets_PARAMS_panel_action_was_successful' => 'PARAMS panel action was successful',
|
||||||
|
'lets_Manage_letsencrypt-config_settings:' => 'Manage letsencrypt-config settings:',
|
||||||
|
'lets_Hello_PARAMS' => 'Hello PARAMS',
|
||||||
|
'lets_CONFIG_LE' => 'CONFIG LE',
|
||||||
|
'lets_Save' => 'Save',
|
||||||
|
'lets_SERVICE_STATUS' => 'SERVICE STATUS',
|
||||||
|
'lets_SERVICE_STATUS' => 'SERVICE STATUS',
|
||||||
|
'lets_API_STATUS' => 'API STATUS',
|
||||||
|
'lets_APPLY' => 'Apply',
|
||||||
|
'lets_CONFIGUREMODE_STATUS' => 'CONFIGUREMODE STATUS',
|
||||||
|
'lets_EMAIL' => 'Email',
|
||||||
|
'lets_KEYSIZE_STATUS' => 'KEYSIZE STATUS',
|
||||||
|
'lets_HOOKSCRIPT_STATUS' => 'HOOKSCRIPT STATUS',
|
||||||
|
'lets_letsencrypt-config' => 'Letsencrypt-config',
|
||||||
|
'lets_HOSTOVERRIDE_STATUS' => 'HOSTOVERRIDE STATUS',
|
||||||
|
'lets_ACCEPT_TERMS_STATUS' => 'ACCEPT TERMS STATUS',
|
@ -3,7 +3,7 @@
|
|||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('${prefix}_${Label}')
|
%=l('${prefix}_${Label}')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% my @${Name}_options = ${Value};
|
% my @${Name}_options = ${structure:OptionsInPerl};
|
||||||
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
|
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
|
||||||
%= select_field '${Name}' => @${Name}_options, class => 'input'
|
%= select_field '${Name}' => @${Name}_options, class => 'input'
|
||||||
<br></span> </p>
|
<br></span> </p>
|
||||||
|
1
activate-python-env
Normal file
1
activate-python-env
Normal file
@ -0,0 +1 @@
|
|||||||
|
source bin/activate
|
@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
{
|
{
|
||||||
'PackageName': 'letsencrypt-config',
|
'PackageName': 'letsencrypt-config',
|
||||||
'prefix': '',
|
'prefix': 'lets',
|
||||||
'MenuHeading': 'Miscellaneous',
|
'MenuHeading': 'Miscellaneous',
|
||||||
'MenuDescription': 'letsencrypt-config',
|
'MenuDescription': 'letsencrypt-config',
|
||||||
'MenuNavigation': '2000 400',
|
'MenuNavigation': '2000 400',
|
||||||
@ -17,11 +17,11 @@
|
|||||||
'SubHeader': 'Manage letsencrypt-config settings:',
|
'SubHeader': 'Manage letsencrypt-config settings:',
|
||||||
'Paragraph1': 'CONFIG_LE',
|
'Paragraph1': 'CONFIG_LE',
|
||||||
'Paragraph2': 'SERVICE_STATUS',
|
'Paragraph2': 'SERVICE_STATUS',
|
||||||
'Input1': {
|
'Input1': {
|
||||||
'Type': 'Select',
|
'Type': 'Select',
|
||||||
'Value': '',
|
'Value': 'Disabled',
|
||||||
'Name': 'status',
|
'Name': 'status',
|
||||||
'Label': null,
|
'Label': 'SERVICE_STATUS',
|
||||||
'Options': [
|
'Options': [
|
||||||
{
|
{
|
||||||
'Value': 'disabled',
|
'Value': 'disabled',
|
||||||
@ -37,12 +37,11 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'Paragraph3': 'HOOKSCRIPT_STATUS',
|
|
||||||
'Input2': {
|
'Input2': {
|
||||||
'Type': 'Select',
|
'Type': 'Select',
|
||||||
'Value': '',
|
'Value': '',
|
||||||
'Name': 'hookScript',
|
'Name': 'hookScript',
|
||||||
'Label': null,
|
'Label': 'HOOKSCRIPT_STATUS',
|
||||||
'Options': [
|
'Options': [
|
||||||
{
|
{
|
||||||
'Value': 'disabled',
|
'Value': 'disabled',
|
||||||
@ -54,12 +53,11 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'Paragraph4': 'HOSTOVERRIDE_STATUS',
|
|
||||||
'Input3': {
|
'Input3': {
|
||||||
'Type': 'Select',
|
'Type': 'Select',
|
||||||
'Value': '',
|
'Value': '',
|
||||||
'Name': 'hostOverride',
|
'Name': 'hostOverride',
|
||||||
'Label': null,
|
'Label': 'HOSTOVERRIDE_STATUS',
|
||||||
'Options': [
|
'Options': [
|
||||||
{
|
{
|
||||||
'Value': 'disabled',
|
'Value': 'disabled',
|
||||||
@ -71,12 +69,11 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'Paragraph5': 'ACCEPT_TERMS_STATUS',
|
|
||||||
'Input4': {
|
'Input4': {
|
||||||
'Type': 'Select',
|
'Type': 'Select',
|
||||||
'Value': '',
|
'Value': '',
|
||||||
'Name': 'ACCEPT_TERMS',
|
'Name': 'ACCEPT_TERMS',
|
||||||
'Label': null,
|
'Label': 'ACCEPT_TERMS_STATUS',
|
||||||
'Options': [
|
'Options': [
|
||||||
{
|
{
|
||||||
'Value': 'disabled',
|
'Value': 'disabled',
|
||||||
@ -88,12 +85,11 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'Paragraph6': 'API_STATUS',
|
|
||||||
'Input5': {
|
'Input5': {
|
||||||
'Type': 'Select',
|
'Type': 'Select',
|
||||||
'Value': '',
|
'Value': '',
|
||||||
'Name': 'API',
|
'Name': 'API',
|
||||||
'Label': null,
|
'Label': 'API_STATUS',
|
||||||
'Options': [
|
'Options': [
|
||||||
{
|
{
|
||||||
'Value': '2',
|
'Value': '2',
|
||||||
@ -101,12 +97,11 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'Paragraph7': 'KEYSIZE_STATUS',
|
|
||||||
'Input6': {
|
'Input6': {
|
||||||
'Type': 'Select',
|
'Type': 'Select',
|
||||||
'Value': '',
|
'Value': '',
|
||||||
'Name': 'keysize',
|
'Name': 'keysize',
|
||||||
'Label': null,
|
'Label': 'KEYSIZE_STATUS',
|
||||||
'Options': [
|
'Options': [
|
||||||
{
|
{
|
||||||
'Value': '2048',
|
'Value': '2048',
|
||||||
@ -122,12 +117,11 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'Paragraph8': 'CONFIGUREMODE_STATUS',
|
|
||||||
'Input7': {
|
'Input7': {
|
||||||
'Type': 'Select',
|
'Type': 'Select',
|
||||||
'Value': '',
|
'Value': '',
|
||||||
'Name': 'configure',
|
'Name': 'configure',
|
||||||
'Label': null,
|
'Label': 'CONFIGUREMODE_STATUS',
|
||||||
'Options': [
|
'Options': [
|
||||||
{
|
{
|
||||||
'Value': 'all',
|
'Value': 'all',
|
||||||
@ -147,12 +141,11 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'Paragraph9': 'EMAIL',
|
|
||||||
'Input8': {
|
'Input8': {
|
||||||
'Type': 'Text',
|
'Type': 'Text',
|
||||||
'Value': '',
|
'Value': '',
|
||||||
'Name': 'email',
|
'Name': 'email',
|
||||||
'Label': null
|
'Label': 'EMAIL'
|
||||||
},
|
},
|
||||||
'Input9': {
|
'Input9': {
|
||||||
'Type': 'Submit',
|
'Type': 'Submit',
|
@ -22,7 +22,7 @@
|
|||||||
Name: 'ShareOwnerGrp',
|
Name: 'ShareOwnerGrp',
|
||||||
Type: 'Select',
|
Type: 'Select',
|
||||||
Label: 'Share owner Group',
|
Label: 'Share owner Group',
|
||||||
Value: [
|
Options: [
|
||||||
'Write = admin, Read = group',
|
'Write = admin, Read = group',
|
||||||
'Write = group, Read = everyone',
|
'Write = group, Read = everyone',
|
||||||
'Write = group, Read = group',
|
'Write = group, Read = group',
|
||||||
@ -33,7 +33,7 @@
|
|||||||
Name: 'EnableNFSshare',
|
Name: 'EnableNFSshare',
|
||||||
Type: 'Select',
|
Type: 'Select',
|
||||||
Label: 'Enable the NFS Share',
|
Label: 'Enable the NFS Share',
|
||||||
Value: [
|
Options: [
|
||||||
'Disabled',
|
'Disabled',
|
||||||
'Enabled',
|
'Enabled',
|
||||||
],
|
],
|
||||||
@ -43,7 +43,7 @@
|
|||||||
Name: 'ShareOnLocalNetwork',
|
Name: 'ShareOnLocalNetwork',
|
||||||
Type: 'Select',
|
Type: 'Select',
|
||||||
Label: 'EnableShare on local network',
|
Label: 'EnableShare on local network',
|
||||||
Value: [
|
Options: [
|
||||||
'Disabled',
|
'Disabled',
|
||||||
'Enabled',
|
'Enabled',
|
||||||
],
|
],
|
||||||
@ -60,7 +60,7 @@
|
|||||||
Name: 'FileSystemPermissions',
|
Name: 'FileSystemPermissions',
|
||||||
Type: 'Select',
|
Type: 'Select',
|
||||||
Label: 'File system permissions',
|
Label: 'File system permissions',
|
||||||
Value: [
|
Options: [
|
||||||
'Read only',
|
'Read only',
|
||||||
'Read and Write',
|
'Read and Write',
|
||||||
],
|
],
|
||||||
@ -70,7 +70,7 @@
|
|||||||
Name: 'WriteAsync',
|
Name: 'WriteAsync',
|
||||||
Type: 'Select',
|
Type: 'Select',
|
||||||
Label: 'Write (a)synchronously',
|
Label: 'Write (a)synchronously',
|
||||||
Value: [
|
Options: [
|
||||||
'Synchronous',
|
'Synchronous',
|
||||||
'Asynchronous',
|
'Asynchronous',
|
||||||
],
|
],
|
||||||
@ -79,7 +79,7 @@
|
|||||||
Name: 'DelayWrite',
|
Name: 'DelayWrite',
|
||||||
Type: 'Select',
|
Type: 'Select',
|
||||||
Label: 'Delays the disk writing',
|
Label: 'Delays the disk writing',
|
||||||
Value: [
|
Options: [
|
||||||
'Write delay',
|
'Write delay',
|
||||||
'No write delay',
|
'No write delay',
|
||||||
],
|
],
|
||||||
@ -89,7 +89,7 @@
|
|||||||
Name: 'Squash',
|
Name: 'Squash',
|
||||||
Type: 'Select',
|
Type: 'Select',
|
||||||
Label: 'Squash the power of users',
|
Label: 'Squash the power of users',
|
||||||
Value: [
|
Options: [
|
||||||
'All users squash',
|
'All users squash',
|
||||||
'No root squash',
|
'No root squash',
|
||||||
'root squash',
|
'root squash',
|
||||||
@ -100,7 +100,7 @@
|
|||||||
Name: 'BrowseParents',
|
Name: 'BrowseParents',
|
||||||
Type: 'Select',
|
Type: 'Select',
|
||||||
Label: 'Browse the parent folders',
|
Label: 'Browse the parent folders',
|
||||||
Value: [
|
Options: [
|
||||||
'Hide folder',
|
'Hide folder',
|
||||||
'Show folder',
|
'Show folder',
|
||||||
],
|
],
|
||||||
@ -110,7 +110,7 @@
|
|||||||
Name: 'SecurePorts',
|
Name: 'SecurePorts',
|
||||||
Type: 'Select',
|
Type: 'Select',
|
||||||
Label: 'Requests on secure ports',
|
Label: 'Requests on secure ports',
|
||||||
Value: [
|
Options: [
|
||||||
'Secure',
|
'Secure',
|
||||||
'Insecure',
|
'Insecure',
|
||||||
],
|
],
|
||||||
|
25
sm2gen.py
25
sm2gen.py
@ -28,6 +28,24 @@ json5_html_list: list = []
|
|||||||
ini_file_path = os.path.expanduser("~/.smegit/conf")
|
ini_file_path = os.path.expanduser("~/.smegit/conf")
|
||||||
OPENAI_API_KEY = ""
|
OPENAI_API_KEY = ""
|
||||||
|
|
||||||
|
def example_function(**kwargs):
|
||||||
|
print(kwargs)
|
||||||
|
|
||||||
|
def python_to_perl_structure(data):
|
||||||
|
#print(data)
|
||||||
|
if data:
|
||||||
|
if isinstance(data, list):
|
||||||
|
# Convert each dictionary in the list to Perl format: ['text' => 'value']
|
||||||
|
elements = [
|
||||||
|
f"['{item['Text']}' => '{item['Value']}']"
|
||||||
|
for item in data
|
||||||
|
]
|
||||||
|
return '[' + ', '.join(elements) + ']'
|
||||||
|
else:
|
||||||
|
raise TypeError("Expected a list of dictionaries")
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
def assemble_version_string():
|
def assemble_version_string():
|
||||||
try:
|
try:
|
||||||
chameleon_version = pkg_resources.get_distribution("Chameleon").version
|
chameleon_version = pkg_resources.get_distribution("Chameleon").version
|
||||||
@ -600,6 +618,10 @@ if __name__ == "__main__":
|
|||||||
type_serial = "".join(char for char in html_control if char.isdigit())
|
type_serial = "".join(char for char in html_control if char.isdigit())
|
||||||
class_name = html_Type.lower()[:4]+type_serial
|
class_name = html_Type.lower()[:4]+type_serial
|
||||||
acc_css_entries += f".{class_name} {{}}\n"
|
acc_css_entries += f".{class_name} {{}}\n"
|
||||||
|
OptionsInPerl = python_to_perl_structure(inner_html.get("Options", ""))
|
||||||
|
#if html_Type == "Select":
|
||||||
|
# example_function(**inner_html)
|
||||||
|
# quit(1)
|
||||||
if html_Type == "Table":
|
if html_Type == "Table":
|
||||||
acc_css_entries += f"thead .{class_name} {{}}\n"
|
acc_css_entries += f"thead .{class_name} {{}}\n"
|
||||||
acc_css_entries += f"tbody .{class_name} {{}}\n"
|
acc_css_entries += f"tbody .{class_name} {{}}\n"
|
||||||
@ -609,7 +631,8 @@ if __name__ == "__main__":
|
|||||||
control_html = control_template.render(
|
control_html = control_template.render(
|
||||||
version=strVersion, **inner_html, prefix=prefix_is,
|
version=strVersion, **inner_html, prefix=prefix_is,
|
||||||
classname=class_name,
|
classname=class_name,
|
||||||
type_serial=type_serial
|
type_serial=type_serial,
|
||||||
|
OptionsInPerl=OptionsInPerl
|
||||||
)
|
)
|
||||||
all_controls_html = all_controls_html + control_html
|
all_controls_html = all_controls_html + control_html
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user