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,7 +233,11 @@
|
|||||||
'Value': 'Save',
|
'Value': 'Save',
|
||||||
'Name': 'Next',
|
'Name': 'Next',
|
||||||
'Label': null
|
'Label': null
|
||||||
}
|
},
|
||||||
|
'Input10': {
|
||||||
|
'Type': 'Submit',
|
||||||
|
'Value': 'Back',
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{ 'Name':'CheckAllDomains',
|
{ 'Name':'CheckAllDomains',
|
||||||
'route':'CHECKALLDOMAINS',
|
'route':'CHECKALLDOMAINS',
|
||||||
|
54
sm2gen.py
54
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()
|
||||||
@ -441,34 +440,35 @@ def capitalize_words_if_all_caps(s):
|
|||||||
return s
|
return 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 = re.compile(rf"{value_type}\((.*?)\)")
|
||||||
|
|
||||||
# Pattern to identify and strip the specified value type and surrounding brackets
|
# Iterate over each panel in the 'html' array
|
||||||
pattern = re.compile(rf"{value_type}\((.*?)\)")
|
for panel in json_data['html']:
|
||||||
|
panel_name = panel['route']
|
||||||
|
# Initialize an empty list for each panel
|
||||||
|
result[panel_name] = []
|
||||||
|
|
||||||
# Iterate over each panel in the 'html' array
|
# Iterate over each item in the panel
|
||||||
for panel in json_data['html']:
|
for key, value in panel.items():
|
||||||
panel_name = panel['route']
|
if key.startswith('Input') and isinstance(value, dict):
|
||||||
# Initialize an empty list for each panel
|
if value.get('Type').lower() in ['readonlytext', 'text', 'select','checkbox','textarea']:
|
||||||
result[panel_name] = []
|
# input_value = value.get('Value', '')
|
||||||
|
input_name = value.get('Name', '')
|
||||||
# Iterate over each item in the panel
|
print(input_name)
|
||||||
for key, value in panel.items():
|
# # Match and extract the value without the value_type and parentheses
|
||||||
if key.startswith('Input') and isinstance(value, dict):
|
# match = pattern.search(input_value)
|
||||||
if value.get('Type').lower() in ['readonlytext', 'text']:
|
# if match:
|
||||||
input_value = value.get('Value', '')
|
# # Extract the inner content of the matching pattern
|
||||||
# Match and extract the value without the value_type and parentheses
|
# clean_value = match.group(1)
|
||||||
match = pattern.search(input_value)
|
# # Take out any double quotes
|
||||||
if match:
|
# clean_value = clean_value.replace('"','')
|
||||||
# Extract the inner content of the matching pattern
|
# # Add the clean value to the list for the current panel
|
||||||
clean_value = match.group(1)
|
# result[panel_name].append(clean_value)
|
||||||
# Take out any double quotes
|
result[panel_name].append(input_name)
|
||||||
clean_value = clean_value.replace('"','')
|
# Note: Empty lists are not removed, so all panels will be present in the result
|
||||||
# Add the clean value to the list for the current panel
|
return result
|
||||||
result[panel_name].append(clean_value)
|
|
||||||
|
|
||||||
# Note: Empty lists are not removed, so all panels will be present in the result
|
|
||||||
return result
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user