Update custom generation for select, checkbox, textare, and expand Xml templates for other input types
This commit is contained in:
parent
7d7e4f1c5c
commit
6870aff511
@ -82,6 +82,20 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
||||
'Data1'=>'Data for PARAMS', #Example
|
||||
# fields from Inputs in PARAMS $fields['PARAMS']
|
||||
|
||||
'status'=>'status contents',
|
||||
|
||||
'hookScript'=>'hookScript contents',
|
||||
|
||||
'hostOverride'=>'hostOverride contents',
|
||||
|
||||
'ACCEPT_TERMS'=>'ACCEPT_TERMS contents',
|
||||
|
||||
'API'=>'API contents',
|
||||
|
||||
'keysize'=>'keysize contents',
|
||||
|
||||
'configure'=>'configure contents',
|
||||
|
||||
|
||||
);
|
||||
return %ret;
|
||||
@ -94,6 +108,8 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
||||
'Data1'=>'Data for CHECKALLDOMAINS', #Example
|
||||
# fields from Inputs in CHECKALLDOMAINS $fields['CHECKALLDOMAINS']
|
||||
|
||||
'AllDomainsCheck'=>'AllDomainsCheck contents',
|
||||
|
||||
|
||||
);
|
||||
return %ret;
|
||||
@ -106,6 +122,8 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
||||
'Data1'=>'Data for CHECKALLENABLEDDOMAINS', #Example
|
||||
# fields from Inputs in CHECKALLENABLEDDOMAINS $fields['CHECKALLENABLEDDOMAINS']
|
||||
|
||||
'EnabledDomainsCheck'=>'EnabledDomainsCheck contents',
|
||||
|
||||
|
||||
);
|
||||
return %ret;
|
||||
|
@ -8,7 +8,7 @@
|
||||
};
|
||||
</script>
|
||||
<pre>
|
||||
%= dumper $lets_data
|
||||
%# dumper $lets_data
|
||||
%# dumper $c->stash('DomainList')
|
||||
</pre>
|
||||
% my $btn = l('lets_APPLY');
|
||||
|
@ -80,7 +80,8 @@
|
||||
%=l('${prefix}_${Label}')
|
||||
</span><span class=data>
|
||||
%=Search field
|
||||
%=search_field , class => 'searc${type_serial}'
|
||||
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
|
||||
%=search_field '${Name}' , class => 'searc${type_serial}'
|
||||
</span>span></p>
|
||||
]]>
|
||||
</search>
|
||||
@ -89,7 +90,8 @@
|
||||
<p><span class=label>
|
||||
%=l('${Label}')
|
||||
</span><span class=data>
|
||||
%=URL_field , class => 'url${type_serial}'
|
||||
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
|
||||
%=URL_field '${Name}' , class => 'url${type_serial}'
|
||||
</span>span></p>
|
||||
]]>
|
||||
</url>
|
||||
@ -98,7 +100,8 @@
|
||||
<p><span class=label>
|
||||
%=l('${Label}')
|
||||
</span><span class=data>
|
||||
%=tel_field, class => 'tel${type_serial}'
|
||||
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
|
||||
%=tel_field '${Name}', class => 'tel${type_serial}'
|
||||
</span>span></p>
|
||||
]]>
|
||||
</tel>
|
||||
@ -107,7 +110,8 @@
|
||||
<p><span class=label>
|
||||
%=l('${Label}')
|
||||
</span><span class=data>
|
||||
%=email_field, class => 'emai${type_serial}'
|
||||
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
|
||||
%=email_field '${Name}', class => 'emai${type_serial}'
|
||||
</span>span></p>
|
||||
]]>
|
||||
</email>
|
||||
@ -116,7 +120,8 @@
|
||||
<p><span class='label'>
|
||||
%=l('${Label}')
|
||||
</span><span class=data>
|
||||
%=password_field, class => 'pass${type_serial}'
|
||||
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
|
||||
%=password_field '${Name}', class => 'pass${type_serial}'
|
||||
</span>span></p>
|
||||
]]>
|
||||
</password>
|
||||
@ -125,7 +130,8 @@
|
||||
<p><span class='label'>
|
||||
%=l('${Label}')
|
||||
</span><span class=data>
|
||||
%=timedate_field, class => 'time${type_serial}'
|
||||
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
|
||||
%=timedate_field '${Name}', class => 'time${type_serial}'
|
||||
</span>span></p>
|
||||
]]>
|
||||
</timedate>
|
||||
@ -134,7 +140,8 @@
|
||||
<p><span class='label'>
|
||||
%=l('${Label}')
|
||||
</span><span class=data>
|
||||
%=week_field, class => 'week${type_serial}'
|
||||
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
|
||||
%=week_field '${Name}', class => 'week${type_serial}'
|
||||
</span>span></p>
|
||||
]]>
|
||||
</week>
|
||||
@ -143,7 +150,8 @@
|
||||
<p><span class='label'>
|
||||
%=l('${Label}')
|
||||
</span><span class=data>
|
||||
%=month_field, class => 'mont${type_serial}'
|
||||
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
|
||||
%=month_field '${Name}', class => 'mont${type_serial}'
|
||||
</span>span></p>
|
||||
]]>
|
||||
</month>
|
||||
@ -152,7 +160,8 @@
|
||||
<p><span class='label'>
|
||||
%=l('${Label}')
|
||||
</span><span class=data>
|
||||
%=range_field, class => 'rang${type_serial}'
|
||||
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
|
||||
%=range_field '${Name}', class => 'rang${type_serial}'
|
||||
</span>span></p>
|
||||
]]>
|
||||
</range>
|
||||
@ -161,7 +170,8 @@
|
||||
<p><span class='label'>
|
||||
%=l('${Label}')
|
||||
</span><span class=data>
|
||||
%=radio_field, class => 'radi${type_serial}'
|
||||
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
|
||||
%=radio_field '${Name}', class => 'radi${type_serial}'
|
||||
</span>span></p>
|
||||
]]>
|
||||
</radio>
|
||||
@ -170,7 +180,8 @@
|
||||
<p><span class='label'>
|
||||
%=l('${Label}')
|
||||
</span><span class=data>
|
||||
%=number_field, class => 'numb${type_serial}'
|
||||
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
|
||||
%=number_field '${Name}', class => 'numb${type_serial}'
|
||||
</span>span></p>
|
||||
]]>
|
||||
</number>
|
||||
@ -179,7 +190,8 @@
|
||||
<p><span class='label'>
|
||||
%=l('${Label}')
|
||||
</span><span class=data>
|
||||
%=file_field, class => 'file${type_serial}'
|
||||
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
|
||||
%=file_field '${Name}', class => 'file${type_serial}'
|
||||
</span>span></p>
|
||||
]]>
|
||||
</file>
|
||||
@ -188,7 +200,8 @@
|
||||
<p><span class='label'>
|
||||
%=l('${Label}')
|
||||
</span><span class=data>
|
||||
%=color_field, class => 'colo${type_serial}'
|
||||
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
|
||||
%=color_field '${Name}', class => 'colo${type_serial}'
|
||||
</span>span></p>
|
||||
]]>
|
||||
</color>
|
||||
@ -197,7 +210,8 @@
|
||||
<p><span class='label'>
|
||||
%=l('${Label}')
|
||||
</span><span class=data>
|
||||
%=checkbox_field, class => 'chec${type_serial}'
|
||||
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
|
||||
%=checkbox_field '${Name}', class => 'chec${type_serial}'
|
||||
</span>span></p>
|
||||
]]>
|
||||
</checkbox>
|
||||
|
@ -7,6 +7,9 @@
|
||||
SelectInput();
|
||||
};
|
||||
</script>
|
||||
<pre>
|
||||
%= dumper $$${prefix}_data
|
||||
</pre>
|
||||
% my $btn = l('APPLY');
|
||||
%= form_for "${PackageName}d" => (method => 'POST') => begin
|
||||
|
||||
|
@ -33,7 +33,10 @@
|
||||
href="letsencrypt?page=0&page_stack=&Next=Next&wherenext=CHECK_DOMAINS_PAGE">CHECK_ALL_DOMAINS</a>
|
||||
<a class="button-like"
|
||||
href="letsencrypt?page=0&page_stack=&Next=Next&wherenext=CHECK_ENABLED_DOMAINS_PAGE">CHECK_ENABLED_DOMAINS</a>
|
||||
<p>> Issuer: /C=--/ST=----/L=Ottawa/O=XYZ Corporation/OU=Main/CN=sme11.thereadclan.me.uk/emailAddress=admin@thereadclan.me.uk<br> <br> Expiry: 2025-10-03T02:09:03Z<br> <br> Not Before: 2024-10-03T02:09:03Z</p>>
|
||||
|
||||
<p>> Issuer: /C=--/ST=----/L=Ottawa/O=XYZ Corporation/OU=Main/CN=sme11.thereadclan.me.uk/emailAddress=admin@thereadclan.me.uk<br>
|
||||
<br> Expiry: 2025-10-03T02:09:03Z<br>
|
||||
<br> Not Before: 2024-10-03T02:09:03Z</p>>
|
||||
|
||||
<h2>CURRENT_LIST_OF_DOMAINS</h2>
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
'MenuHeading': 'Network',
|
||||
'MenuDescription': 'Letsencrypt certificate',
|
||||
'MenuNavigation': '6000 6600',
|
||||
'firstPanel': 'LIST',
|
||||
'firstPanel': 'PARAMS',
|
||||
'signalEvent': 'smeserver-letsencrypt-update',
|
||||
'html': [
|
||||
{
|
||||
@ -96,7 +96,6 @@
|
||||
{
|
||||
'Name': 'params',
|
||||
'route': 'PARAMS',
|
||||
'Header': 'Configuration for Letsencrypt',
|
||||
'SubHeader': 'Manage letsencrypt-config settings:',
|
||||
'Paragraph1': 'CONFIG_LETSENCRYPT',
|
||||
'Input1': {
|
||||
@ -234,6 +233,10 @@
|
||||
'Value': 'Save',
|
||||
'Name': 'Next',
|
||||
'Label': null
|
||||
},
|
||||
'Input10': {
|
||||
'Type': 'Submit',
|
||||
'Value': 'Back',
|
||||
}
|
||||
},
|
||||
{ 'Name':'CheckAllDomains',
|
||||
|
28
sm2gen.py
28
sm2gen.py
@ -31,7 +31,6 @@ def example_function(**kwargs):
|
||||
print(kwargs)
|
||||
|
||||
def spell_check_and_correct(text):
|
||||
|
||||
try:
|
||||
# Initialize the spell checker
|
||||
spell = SpellChecker()
|
||||
@ -442,7 +441,6 @@ def capitalize_words_if_all_caps(s):
|
||||
|
||||
def extract_input_fields(json_data, value_type):
|
||||
result = {}
|
||||
|
||||
# Pattern to identify and strip the specified value type and surrounding brackets
|
||||
pattern = re.compile(rf"{value_type}\((.*?)\)")
|
||||
|
||||
@ -455,18 +453,20 @@ def extract_input_fields(json_data, value_type):
|
||||
# Iterate over each item in the panel
|
||||
for key, value in panel.items():
|
||||
if key.startswith('Input') and isinstance(value, dict):
|
||||
if value.get('Type').lower() in ['readonlytext', 'text']:
|
||||
input_value = value.get('Value', '')
|
||||
# Match and extract the value without the value_type and parentheses
|
||||
match = pattern.search(input_value)
|
||||
if match:
|
||||
# Extract the inner content of the matching pattern
|
||||
clean_value = match.group(1)
|
||||
# Take out any double quotes
|
||||
clean_value = clean_value.replace('"','')
|
||||
# Add the clean value to the list for the current panel
|
||||
result[panel_name].append(clean_value)
|
||||
|
||||
if value.get('Type').lower() in ['readonlytext', 'text', 'select','checkbox','textarea']:
|
||||
# input_value = value.get('Value', '')
|
||||
input_name = value.get('Name', '')
|
||||
print(input_name)
|
||||
# # Match and extract the value without the value_type and parentheses
|
||||
# match = pattern.search(input_value)
|
||||
# if match:
|
||||
# # Extract the inner content of the matching pattern
|
||||
# clean_value = match.group(1)
|
||||
# # Take out any double quotes
|
||||
# clean_value = clean_value.replace('"','')
|
||||
# # Add the clean value to the list for the current panel
|
||||
# result[panel_name].append(clean_value)
|
||||
result[panel_name].append(input_name)
|
||||
# Note: Empty lists are not removed, so all panels will be present in the result
|
||||
return result
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user