First rnun of SM1-2-json created json5

This commit is contained in:
Brian Read 2024-09-12 19:37:27 +01:00
parent 2ee6bd3bb6
commit 2200c50029
12 changed files with 225 additions and 65 deletions

109
Targets/_csw_PARAMS.html.ep Normal file
View File

@ -0,0 +1,109 @@
%#
%# Generated by SM2Gen version:0.8 Chameleon version:3.8.1 On Python:3.12.3 ( at 2024-09-12 19:31
%#
<div id="CreateStarterWebsite-PARAMS" class="partial CreateStarterWebsite-PARAMS">
<script>
window.onload = function() {
SelectInput();
};
</script>
<h2>
%= l('csw Hello PARAMS');
</h2>
% my $btn = l('APPLY');
%= form_for "CreateStarterWebsited" => (method => 'POST') => begin
% param 'trt' => ${prefix}_data->{trt} unless param 'trt';
%= hidden_field 'trt' => ${prefix}_data->{trt}
%# Inputs etc in here.
<h2><%=l('Manage CreateStarterWebsite settings:')%></h2>
<p>
%= l('To create a simple web page for your company, fill
in the fields below and click onCreate.')
</p>
<p>
%= l('You can leave any field blank if you do not need it.')
</p>
<p>
%= l('The text that you enter below will be line wrapped
for a nicer appearance in your web page. Leave a blank line
whenever you want to start a new paragraph. If you need
to force a line break without starting a new paragraph (for
example after each line of a mailing address), then type
the four-character sequence')
</p>
<p>
%= l('Do not use this optionif you have already customized your web site, since it will
overwrite the 'index.htm' file in your web site directory.')
</p>
<p><span class=label>
%=l('csw_')
</span><span class=data>
%=
</span></p>
<p>
%= l('First header, typically used for short phrases such
as 'Leader in the field of textile manufacturing'')
</p>
<p><span class=label>
%=l('csw_')
</span><span class=data>
%=
</span></p>
<p>
%= l('Text following first header, typically used for a
paragraph of marketing information.')
</p>
<span class=label>
%=l('csw_')
</span><span class=data>
% param 'text1' => ${prefix}_data->{text1} unless param 'text1';
%= text_area 'text1', cols=>40, rows=>10
</span><br>
<p>
%= l('Second header, typically used for short phrases such
as 'For more information' or 'To order our products':')
</p>
<p><span class=label>
%=l('csw_')
</span><span class=data>
%=
</span></p>
<p>
%= l('Text following second header, typically used for contact
or ordering information:')
</p>
<span class=label>
%=l('csw_')
</span><span class=data>
% param 'text2' => ${prefix}_data->{text2} unless param 'text2';
%= text_area 'text2', cols=>40, rows=>10
</span><br>
<p>
%= l('When you create this web page, the file
'index.htm' will be overwritten
in your web site directory.')
</p>
<p>
%= l('Do you wish to proceed?')
</p>
%# Probably finally by a submit.
%end
</div>

View File

@ -1,5 +1,5 @@
%#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.10.12 at 2024-09-03 13:54
%# Generated by SM2Gen version:0.8 Chameleon version:3.8.1 On Python:3.12.3 ( at 2024-09-12 19:29
%#
<div id="Nfsshare-PARAMS" class="partial Nfsshare-PARAMS">
<script>
@ -13,8 +13,8 @@
% my $btn = l('nfs_APPLY');
%= form_for "Nfsshared" => (method => 'POST') => begin
% param 'trt' => $nfs_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $nfs_data->{trt}
% param 'trt' => ${prefix}_data->{trt} unless param 'trt';
%= hidden_field 'trt' => ${prefix}_data->{trt}
%# Inputs etc in here.
<h2><%=l('nfs_Manage_NFS_Ibay_settings:')%></h2>
@ -33,7 +33,7 @@
%=l('nfs_Share_owner_Group')
</span><span class=data>
% my @ShareOwnerGrp_options = ['Write = admin, Read = group', 'Write = group, Read = everyone', 'Write = group, Read = group'];
% param 'ShareOwnerGrp' => $nfs_data->{ShareOwnerGrp} unless param 'ShareOwnerGrp';
% param 'ShareOwnerGrp' => ${prefix}_data->{ShareOwnerGrp} unless param 'ShareOwnerGrp';
%= select_field 'ShareOwnerGrp' => @ShareOwnerGrp_options, class => 'input'
<br></span> </p>
@ -41,7 +41,7 @@
%=l('nfs_Enable_the_NFS_Share')
</span><span class=data>
% my @EnableNFSshare_options = ['Disabled', 'Enabled'];
% param 'EnableNFSshare' => $nfs_data->{EnableNFSshare} unless param 'EnableNFSshare';
% param 'EnableNFSshare' => ${prefix}_data->{EnableNFSshare} unless param 'EnableNFSshare';
%= select_field 'EnableNFSshare' => @EnableNFSshare_options, class => 'input'
<br></span> </p>
@ -49,7 +49,7 @@
%=l('nfs_EnableShare_on_local_network')
</span><span class=data>
% my @ShareOnLocalNetwork_options = ['Disabled', 'Enabled'];
% param 'ShareOnLocalNetwork' => $nfs_data->{ShareOnLocalNetwork} unless param 'ShareOnLocalNetwork';
% param 'ShareOnLocalNetwork' => ${prefix}_data->{ShareOnLocalNetwork} unless param 'ShareOnLocalNetwork';
%= select_field 'ShareOnLocalNetwork' => @ShareOnLocalNetwork_options, class => 'input'
<br></span> </p>
@ -60,7 +60,7 @@
<span class=label>
%=l('nfs_NFS_Client(s)_allowed')
</span><span class=data>
% param 'NFSClientsAllowed' => $nfs_data->{NFSClientsAllowed} unless param 'NFSClientsAllowed';
% param 'NFSClientsAllowed' => ${prefix}_data->{NFSClientsAllowed} unless param 'NFSClientsAllowed';
%= text_area 'NFSClientsAllowed', cols=>40, rows=>5
</span><br>
@ -68,7 +68,7 @@
%=l('nfs_File_system_permissions')
</span><span class=data>
% my @FileSystemPermissions_options = ['Read only', 'Read and Write'];
% param 'FileSystemPermissions' => $nfs_data->{FileSystemPermissions} unless param 'FileSystemPermissions';
% param 'FileSystemPermissions' => ${prefix}_data->{FileSystemPermissions} unless param 'FileSystemPermissions';
%= select_field 'FileSystemPermissions' => @FileSystemPermissions_options, class => 'input'
<br></span> </p>
@ -76,7 +76,7 @@
%=l('nfs_Write_(a)synchronously')
</span><span class=data>
% my @WriteAsync_options = ['Synchronous', 'Asynchronous'];
% param 'WriteAsync' => $nfs_data->{WriteAsync} unless param 'WriteAsync';
% param 'WriteAsync' => ${prefix}_data->{WriteAsync} unless param 'WriteAsync';
%= select_field 'WriteAsync' => @WriteAsync_options, class => 'input'
<br></span> </p>
@ -84,7 +84,7 @@
%=l('nfs_Delays_the_disk_writing')
</span><span class=data>
% my @DelayWrite_options = ['Write delay', 'No write delay'];
% param 'DelayWrite' => $nfs_data->{DelayWrite} unless param 'DelayWrite';
% param 'DelayWrite' => ${prefix}_data->{DelayWrite} unless param 'DelayWrite';
%= select_field 'DelayWrite' => @DelayWrite_options, class => 'input'
<br></span> </p>
@ -92,7 +92,7 @@
%=l('nfs_Squash_the_power_of_users')
</span><span class=data>
% my @Squash_options = ['All users squash', 'No root squash', 'root squash'];
% param 'Squash' => $nfs_data->{Squash} unless param 'Squash';
% param 'Squash' => ${prefix}_data->{Squash} unless param 'Squash';
%= select_field 'Squash' => @Squash_options, class => 'input'
<br></span> </p>
@ -100,7 +100,7 @@
%=l('nfs_Browse_the_parent_folders')
</span><span class=data>
% my @BrowseParents_options = ['Hide folder', 'Show folder'];
% param 'BrowseParents' => $nfs_data->{BrowseParents} unless param 'BrowseParents';
% param 'BrowseParents' => ${prefix}_data->{BrowseParents} unless param 'BrowseParents';
%= select_field 'BrowseParents' => @BrowseParents_options, class => 'input'
<br></span> </p>
@ -108,7 +108,7 @@
%=l('nfs_Requests_on_secure_ports')
</span><span class=data>
% my @SecurePorts_options = ['Secure', 'Insecure'];
% param 'SecurePorts' => $nfs_data->{SecurePorts} unless param 'SecurePorts';
% param 'SecurePorts' => ${prefix}_data->{SecurePorts} unless param 'SecurePorts';
%= select_field 'SecurePorts' => @SecurePorts_options, class => 'input'
<br></span> </p>
@ -119,14 +119,14 @@
<p><span class=label>
%=l('nfs_Set_the_UID.')
</span><span class=data>
% param 'SetUID' => $nfs_data->{SetUID} unless param 'SetUID';
% param 'SetUID' => ${prefix}_data->{SetUID} unless param 'SetUID';
%= text_field 'SetUID', size => '50', class => 'input' , pattern=>'.*' , placeholder=>'SetUID'
<br></span></p>
<p><span class=label>
%=l('nfs_Set_the_GID.')
</span><span class=data>
% param 'SetGID' => $nfs_data->{SetGID} unless param 'SetGID';
% param 'SetGID' => ${prefix}_data->{SetGID} unless param 'SetGID';
%= text_field 'SetGID', size => '50', class => 'input' , pattern=>'.*' , placeholder=>'SetGID'
<br></span></p>

View File

@ -1,5 +1,5 @@
%#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.10.12 at 2024-09-03 13:54
%# Generated by SM2Gen version:0.8 Chameleon version:3.8.1 On Python:3.12.3 ( at 2024-09-12 19:29
%#
<div id="Nfsshare-TABLE" class="partial Nfsshare-TABLE">
<script>
@ -13,8 +13,8 @@
% my $btn = l('nfs_APPLY');
%= form_for "Nfsshared" => (method => 'POST') => begin
% param 'trt' => $nfs_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $nfs_data->{trt}
% param 'trt' => ${prefix}_data->{trt} unless param 'trt';
%= hidden_field 'trt' => ${prefix}_data->{trt}
%# Inputs etc in here.
<h2><%=l('nfs_Manage_NFS_Ibay_settings:')%></h2>

View File

@ -0,0 +1,50 @@
% layout 'default', title => "Sme server 2 - Create Starter Website", share_dir => './';
%#
%# Generated by SM2Gen version:0.8 Chameleon version:3.8.1 On Python:3.12.3 ( at 2024-09-12 19:31
%#
% content_for 'module' => begin
<div id="module" class="module CreateStarterWebsite-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 (${prefix}_data->{first}) {
<br><p>
%=$c->render_to_string(inline =>$c->l(${prefix}_data->{first}))
</p>
%} elsif (${prefix}_data->{success}) {
<div class='sme-border'>
<h2> Operation Status Report</h2><p>
%= $c->l(${prefix}_data->{success});
</p>
</div>
%} elsif (${prefix}_data->{error}) {
<div class='sme-error'>
<h2> Operation Status Report - error</h2><p>
%= $c->l(${prefix}_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 (${prefix}_data->{trt} eq "PARAMS") {
%= include 'partials/_csw_PARAMS'
%}
</div>
%end

View File

@ -1,6 +1,6 @@
% layout 'default', title => "Sme server 2 - NFS data share", share_dir => './';
%#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.10.12 at 2024-09-03 13:54
%# Generated by SM2Gen version:0.8 Chameleon version:3.8.1 On Python:3.12.3 ( at 2024-09-12 19:29
%#
% content_for 'module' => begin
<div id="module" class="module Nfsshare-panel">
@ -17,22 +17,22 @@
%= $c->render_to_string(inline => stash('modul') );
% }
%if ($nfs_data->{first}) {
%if (${prefix}_data->{first}) {
<br><p>
%=$c->render_to_string(inline =>$c->l($nfs_data->{first}))
%=$c->render_to_string(inline =>$c->l(${prefix}_data->{first}))
</p>
%} elsif ($nfs_data->{success}) {
%} elsif (${prefix}_data->{success}) {
<div class='sme-border'>
<h2> Operation Status Report</h2><p>
%= $c->l($nfs_data->{success});
%= $c->l(${prefix}_data->{success});
</p>
</div>
%} elsif ($nfs_data->{error}) {
%} elsif (${prefix}_data->{error}) {
<div class='sme-error'>
<h2> Operation Status Report - error</h2><p>
%= $c->l($nfs_data->{error});
%= $c->l(${prefix}_data->{error});
</p>
</div>
%}
@ -40,11 +40,11 @@
%#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 ($nfs_data->{trt} eq "PARAMS") {
% if (${prefix}_data->{trt} eq "PARAMS") {
%= include 'partials/_nfs_PARAMS'
%}
% if ($nfs_data->{trt} eq "TABLE") {
% if (${prefix}_data->{trt} eq "TABLE") {
%= include 'partials/_nfs_TABLE'
%}

View File

@ -1,28 +1,28 @@
'nfs_Save' => 'Save',
'nfs_EnableShare_on_local_network' => 'Enableshare on local network',
'nfs_NFS_data_share' => 'NFS data share',
'nfs_Set_the_uid_and_gid' => 'Set the uid and gid if you want all requests appear to be from one user or one group, Otherwise leave blank',
'nfs_Hello_PARAMS' => 'Hello PARAMS',
'nfs_These_parameters_will_be_effective' => 'These parameters will be effective only if the share is enabled. The share is in /home/e-smith/files/ibays//files',
'nfs_For_writing_permissions,allowing_the_root' => 'For writing permissions, Allowing the root user and using insecure ports, You must configure a list of one IP per line, Being part of the local network(s). ',
'nfs_APPLY' => 'Apply',
'nfs_NFS_Client(s)_allowed' => 'NFS Client(s) allowed',
'nfs_Browse_the_parent_folders' => 'Browse the parent folders',
'nfs_TABLE_panel_action_was_successful' => 'TABLE panel action was successful',
'nfs_Set_the_UID.' => 'Set the UID. ',
'nfs_Name' => 'Name',
'nfs_Share_owner_Group' => 'Share owner Group',
'Nfs_status' => 'Status',
'nfs_Requests_on_secure_ports' => 'Requests on secure ports',
'nfs_Enable_the_NFS_Share' => 'Enable the NFS Share',
'nfs_Write_(a)synchronously' => 'Write (a)synchronously',
'nfs_Hello_TABLE' => 'Hello TABLE',
'nfs_PARAMS_panel_action_was_successful' => 'PARAMS panel action was successful',
'nfs_Delays_the_disk_writing' => 'Delays the disk writing',
'nfs_Manage_NFS_Ibay_settings:' => 'Manage NFS Ibay settings:',
'nfs_Set_the_GID.' => 'Set the GID. ',
'nfs_Information_Bay_name' => 'Information Bay name',
'nfs_Squash_the_power_of_users' => 'Squash the power of users',
'nfs_Hello_TABLE' => 'Hello TABLE',
'nfs_Write_(a)synchronously' => 'Write (a)synchronously',
'nfs_TABLE_panel_action_was_successful' => 'TABLE panel action was successful',
'nfs_Hello_PARAMS' => 'Hello PARAMS',
'nfs_Save' => 'Save',
'nfs_For_writing_permissions,allowing_the_root' => 'For writing permissions, Allowing the root user and using insecure ports, You must configure a list of one IP per line, Being part of the local network(s). ',
'nfs_Enable_the_NFS_Share' => 'Enable the NFS Share',
'nfs_Action' => 'Action',
'nfs_Description' => 'Description',
'nfs_EnableShare_on_local_network' => 'Enableshare on local network',
'nfs_Browse_the_parent_folders' => 'Browse the parent folders',
'Nfs_status' => 'Status',
'nfs_Set_the_GID.' => 'Set the GID. ',
'nfs_File_system_permissions' => 'File system permissions',
'nfs_Share_owner_Group' => 'Share owner Group',
'nfs_These_parameters_will_be_effective' => 'These parameters will be effective only if the share is enabled. The share is in /home/e-smith/files/ibays//files',
'nfs_Name' => 'Name',
'nfs_NFS_Client(s)_allowed' => 'NFS Client(s) allowed',
'nfs_Requests_on_secure_ports' => 'Requests on secure ports',
'nfs_APPLY' => 'Apply',
'nfs_Delays_the_disk_writing' => 'Delays the disk writing',
'nfs_Information_Bay_name' => 'Information Bay name',
'nfs_Description' => 'Description',
'nfs_NFS_data_share' => 'NFS data share',
'nfs_Manage_NFS_Ibay_settings:' => 'Manage NFS Ibay settings:',
'nfs_PARAMS_panel_action_was_successful' => 'PARAMS panel action was successful',
'nfs_Set_the_uid_and_gid' => 'Set the uid and gid if you want all requests appear to be from one user or one group, Otherwise leave blank',
'nfs_Set_the_UID.' => 'Set the UID. ',

View File

@ -1,12 +1,13 @@
{
'PackageName': 'CreateStarterWebsite',
'prefix': 'CSW',
'prefix': 'csw',
'MenuHeading': 'Miscellaneous',
'MenuDescription': 'Create Starter Website',
'MenuNavigation': '2000 400',
'firstPanel': 'PARAMS',
'signalEvent': 'smeserver-createstarterwebsite-update',
'html': {
'html':[
{
'Name': 'params',
'route': 'PARAMS',
'Header': 'Create a starter website',
@ -58,4 +59,5 @@
'Label': null
}
}
]
}

View File

@ -1,6 +1,6 @@
{
'PackageName': 'DiskUsage',
'prefix': 'DU',
'prefix': 'du',
'MenuHeading': 'Miscellaneous',
'MenuDescription': 'Disk Usage',
'MenuNavigation': '2000 400',

View File

@ -6,8 +6,7 @@
MenuNavigation: '2000 400',
firstPanel: 'TABLE',
signalEvent: 'smeserver-nfsshare-update',
html: [
{
html: [ {
Name: 'params',
route: 'PARAMS',
Header: 'NFS Share Contrib',

View File

@ -148,8 +148,8 @@ def insert_spaces_before_caps(text):
def save_to_json5(data, output_filename, package_name, header, sub_header):
"""Save extracted data to a JSON5 file with a specific structure."""
# Generate prefix from uppercase letters in PackageName
prefix = ''.join(re.findall(r'[A-Z]', package_name))
# Generate prefix from uppercase letters in PackageName made into lowercase
prefix = ''.join(re.findall(r'[A-Z]', package_name)).lowercase()
# Prepare structured html list
structured_html = []

View File

@ -330,7 +330,7 @@ if __name__ == "__main__":
print(f"SM2 code from JSON5 - {strVersion}")
home_dir = "/home/brianr/clients/SM2/SM2Gen/"
json_filename = f"{home_dir}nfsshare.json5"
json_filename = f"{home_dir}/json5/nfsshare.json5" #CreateStarterWebsite.json5"
# read open ai key from ini file
# Check if the file exists
@ -617,8 +617,8 @@ if __name__ == "__main__":
print(f"Write out modified:{filename}")
# Now generate all the translated lex files from a list of the languages and codes
home_dir = os.path.dirname(json_filename)
languages_path = f"{home_dir}/languages.json"
#home_dir = os.path.dirname(json_filename)
languages_path = "Templates/languages.json"
with open(languages_path, "r") as file:
languages_str = file.read()
lang_dict = json.loads(languages_str)