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
|
'Data1'=>'Data for PARAMS', #Example
|
||||||
# fields from Inputs in PARAMS $fields['PARAMS']
|
# 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;
|
return %ret;
|
||||||
@ -94,6 +108,8 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
|||||||
'Data1'=>'Data for CHECKALLDOMAINS', #Example
|
'Data1'=>'Data for CHECKALLDOMAINS', #Example
|
||||||
# fields from Inputs in CHECKALLDOMAINS $fields['CHECKALLDOMAINS']
|
# fields from Inputs in CHECKALLDOMAINS $fields['CHECKALLDOMAINS']
|
||||||
|
|
||||||
|
'AllDomainsCheck'=>'AllDomainsCheck contents',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
return %ret;
|
return %ret;
|
||||||
@ -106,6 +122,8 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
|||||||
'Data1'=>'Data for CHECKALLENABLEDDOMAINS', #Example
|
'Data1'=>'Data for CHECKALLENABLEDDOMAINS', #Example
|
||||||
# fields from Inputs in CHECKALLENABLEDDOMAINS $fields['CHECKALLENABLEDDOMAINS']
|
# fields from Inputs in CHECKALLENABLEDDOMAINS $fields['CHECKALLENABLEDDOMAINS']
|
||||||
|
|
||||||
|
'EnabledDomainsCheck'=>'EnabledDomainsCheck contents',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
return %ret;
|
return %ret;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<pre>
|
<pre>
|
||||||
%= dumper $lets_data
|
%# dumper $lets_data
|
||||||
%# dumper $c->stash('DomainList')
|
%# dumper $c->stash('DomainList')
|
||||||
</pre>
|
</pre>
|
||||||
% my $btn = l('lets_APPLY');
|
% my $btn = l('lets_APPLY');
|
||||||
|
@ -80,7 +80,8 @@
|
|||||||
%=l('${prefix}_${Label}')
|
%=l('${prefix}_${Label}')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
%=Search field
|
%=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>
|
</span>span></p>
|
||||||
]]>
|
]]>
|
||||||
</search>
|
</search>
|
||||||
@ -89,7 +90,8 @@
|
|||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('${Label}')
|
%=l('${Label}')
|
||||||
</span><span class=data>
|
</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>
|
</span>span></p>
|
||||||
]]>
|
]]>
|
||||||
</url>
|
</url>
|
||||||
@ -98,7 +100,8 @@
|
|||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('${Label}')
|
%=l('${Label}')
|
||||||
</span><span class=data>
|
</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>
|
</span>span></p>
|
||||||
]]>
|
]]>
|
||||||
</tel>
|
</tel>
|
||||||
@ -107,7 +110,8 @@
|
|||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('${Label}')
|
%=l('${Label}')
|
||||||
</span><span class=data>
|
</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>
|
</span>span></p>
|
||||||
]]>
|
]]>
|
||||||
</email>
|
</email>
|
||||||
@ -116,7 +120,8 @@
|
|||||||
<p><span class='label'>
|
<p><span class='label'>
|
||||||
%=l('${Label}')
|
%=l('${Label}')
|
||||||
</span><span class=data>
|
</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>
|
</span>span></p>
|
||||||
]]>
|
]]>
|
||||||
</password>
|
</password>
|
||||||
@ -125,7 +130,8 @@
|
|||||||
<p><span class='label'>
|
<p><span class='label'>
|
||||||
%=l('${Label}')
|
%=l('${Label}')
|
||||||
</span><span class=data>
|
</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>
|
</span>span></p>
|
||||||
]]>
|
]]>
|
||||||
</timedate>
|
</timedate>
|
||||||
@ -134,7 +140,8 @@
|
|||||||
<p><span class='label'>
|
<p><span class='label'>
|
||||||
%=l('${Label}')
|
%=l('${Label}')
|
||||||
</span><span class=data>
|
</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>
|
</span>span></p>
|
||||||
]]>
|
]]>
|
||||||
</week>
|
</week>
|
||||||
@ -143,7 +150,8 @@
|
|||||||
<p><span class='label'>
|
<p><span class='label'>
|
||||||
%=l('${Label}')
|
%=l('${Label}')
|
||||||
</span><span class=data>
|
</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>
|
</span>span></p>
|
||||||
]]>
|
]]>
|
||||||
</month>
|
</month>
|
||||||
@ -152,7 +160,8 @@
|
|||||||
<p><span class='label'>
|
<p><span class='label'>
|
||||||
%=l('${Label}')
|
%=l('${Label}')
|
||||||
</span><span class=data>
|
</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>
|
</span>span></p>
|
||||||
]]>
|
]]>
|
||||||
</range>
|
</range>
|
||||||
@ -161,7 +170,8 @@
|
|||||||
<p><span class='label'>
|
<p><span class='label'>
|
||||||
%=l('${Label}')
|
%=l('${Label}')
|
||||||
</span><span class=data>
|
</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>
|
</span>span></p>
|
||||||
]]>
|
]]>
|
||||||
</radio>
|
</radio>
|
||||||
@ -170,7 +180,8 @@
|
|||||||
<p><span class='label'>
|
<p><span class='label'>
|
||||||
%=l('${Label}')
|
%=l('${Label}')
|
||||||
</span><span class=data>
|
</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>
|
</span>span></p>
|
||||||
]]>
|
]]>
|
||||||
</number>
|
</number>
|
||||||
@ -179,7 +190,8 @@
|
|||||||
<p><span class='label'>
|
<p><span class='label'>
|
||||||
%=l('${Label}')
|
%=l('${Label}')
|
||||||
</span><span class=data>
|
</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>
|
</span>span></p>
|
||||||
]]>
|
]]>
|
||||||
</file>
|
</file>
|
||||||
@ -188,7 +200,8 @@
|
|||||||
<p><span class='label'>
|
<p><span class='label'>
|
||||||
%=l('${Label}')
|
%=l('${Label}')
|
||||||
</span><span class=data>
|
</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>
|
</span>span></p>
|
||||||
]]>
|
]]>
|
||||||
</color>
|
</color>
|
||||||
@ -197,7 +210,8 @@
|
|||||||
<p><span class='label'>
|
<p><span class='label'>
|
||||||
%=l('${Label}')
|
%=l('${Label}')
|
||||||
</span><span class=data>
|
</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>
|
</span>span></p>
|
||||||
]]>
|
]]>
|
||||||
</checkbox>
|
</checkbox>
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
SelectInput();
|
SelectInput();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
<pre>
|
||||||
|
%= dumper $$${prefix}_data
|
||||||
|
</pre>
|
||||||
% my $btn = l('APPLY');
|
% my $btn = l('APPLY');
|
||||||
%= form_for "${PackageName}d" => (method => 'POST') => begin
|
%= 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>
|
href="letsencrypt?page=0&page_stack=&Next=Next&wherenext=CHECK_DOMAINS_PAGE">CHECK_ALL_DOMAINS</a>
|
||||||
<a class="button-like"
|
<a class="button-like"
|
||||||
href="letsencrypt?page=0&page_stack=&Next=Next&wherenext=CHECK_ENABLED_DOMAINS_PAGE">CHECK_ENABLED_DOMAINS</a>
|
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>
|
<h2>CURRENT_LIST_OF_DOMAINS</h2>
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
'MenuHeading': 'Network',
|
'MenuHeading': 'Network',
|
||||||
'MenuDescription': 'Letsencrypt certificate',
|
'MenuDescription': 'Letsencrypt certificate',
|
||||||
'MenuNavigation': '6000 6600',
|
'MenuNavigation': '6000 6600',
|
||||||
'firstPanel': 'LIST',
|
'firstPanel': 'PARAMS',
|
||||||
'signalEvent': 'smeserver-letsencrypt-update',
|
'signalEvent': 'smeserver-letsencrypt-update',
|
||||||
'html': [
|
'html': [
|
||||||
{
|
{
|
||||||
@ -96,7 +96,6 @@
|
|||||||
{
|
{
|
||||||
'Name': 'params',
|
'Name': 'params',
|
||||||
'route': 'PARAMS',
|
'route': 'PARAMS',
|
||||||
'Header': 'Configuration for Letsencrypt',
|
|
||||||
'SubHeader': 'Manage letsencrypt-config settings:',
|
'SubHeader': 'Manage letsencrypt-config settings:',
|
||||||
'Paragraph1': 'CONFIG_LETSENCRYPT',
|
'Paragraph1': 'CONFIG_LETSENCRYPT',
|
||||||
'Input1': {
|
'Input1': {
|
||||||
@ -234,6 +233,10 @@
|
|||||||
'Value': 'Save',
|
'Value': 'Save',
|
||||||
'Name': 'Next',
|
'Name': 'Next',
|
||||||
'Label': null
|
'Label': null
|
||||||
|
},
|
||||||
|
'Input10': {
|
||||||
|
'Type': 'Submit',
|
||||||
|
'Value': 'Back',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ 'Name':'CheckAllDomains',
|
{ 'Name':'CheckAllDomains',
|
||||||
|
28
sm2gen.py
28
sm2gen.py
@ -31,7 +31,6 @@ def example_function(**kwargs):
|
|||||||
print(kwargs)
|
print(kwargs)
|
||||||
|
|
||||||
def spell_check_and_correct(text):
|
def spell_check_and_correct(text):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Initialize the spell checker
|
# Initialize the spell checker
|
||||||
spell = SpellChecker()
|
spell = SpellChecker()
|
||||||
@ -442,7 +441,6 @@ def capitalize_words_if_all_caps(s):
|
|||||||
|
|
||||||
def extract_input_fields(json_data, value_type):
|
def extract_input_fields(json_data, value_type):
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
# Pattern to identify and strip the specified value type and surrounding brackets
|
# Pattern to identify and strip the specified value type and surrounding brackets
|
||||||
pattern = re.compile(rf"{value_type}\((.*?)\)")
|
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
|
# Iterate over each item in the panel
|
||||||
for key, value in panel.items():
|
for key, value in panel.items():
|
||||||
if key.startswith('Input') and isinstance(value, dict):
|
if key.startswith('Input') and isinstance(value, dict):
|
||||||
if value.get('Type').lower() in ['readonlytext', 'text']:
|
if value.get('Type').lower() in ['readonlytext', 'text', 'select','checkbox','textarea']:
|
||||||
input_value = value.get('Value', '')
|
# input_value = value.get('Value', '')
|
||||||
# Match and extract the value without the value_type and parentheses
|
input_name = value.get('Name', '')
|
||||||
match = pattern.search(input_value)
|
print(input_name)
|
||||||
if match:
|
# # Match and extract the value without the value_type and parentheses
|
||||||
# Extract the inner content of the matching pattern
|
# match = pattern.search(input_value)
|
||||||
clean_value = match.group(1)
|
# if match:
|
||||||
# Take out any double quotes
|
# # Extract the inner content of the matching pattern
|
||||||
clean_value = clean_value.replace('"','')
|
# clean_value = match.group(1)
|
||||||
# Add the clean value to the list for the current panel
|
# # Take out any double quotes
|
||||||
result[panel_name].append(clean_value)
|
# 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
|
# Note: Empty lists are not removed, so all panels will be present in the result
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user