diff --git a/Targets/Nfsshare.pm b/Targets/Nfsshare.pm
index 70d8c83..94360ba 100644
--- a/Targets/Nfsshare.pm
+++ b/Targets/Nfsshare.pm
@@ -1,6 +1,6 @@
package SrvMngr::Controller::Nfsshare;
#
-# Generated by version:SME2Gen version:0.6 Chameleon version:4.5.4 On Python:3.10.12 at 2024-04-28 11:53
+# Generated by version:SME2Gen version:0.6 Chameleon version:4.5.4 On Python:3.10.12 at 2024-05-03 17:51
#
#----------------------------------------------------------------------
# heading : Network
@@ -67,7 +67,7 @@ sub main {
$c->app->log->info( $c->log_req );
my %nfs_data = ();
- my $title = $c->l("nfs_NFS data share");
+ my $title = $c->l("nfs_NFS_data_share");
my $modul = '';
$nfs_data{'trt'} = 'TABLE';
@@ -119,7 +119,7 @@ sub do_update {
$c->app->log->info($c->log_req);
my %nfs_data = ();
- my $title = $c->l("nfs_NFS data share");
+ my $title = $c->l("nfs_NFS_data_share");
# Accessing all POST parameters
my %params = $c->req->params->to_hash;
@@ -167,7 +167,7 @@ sub do_update {
$c->stash(error => $c->l($ret));
$c->render("Nfsshare");
} else {
- $c->stash( success => $c->l("PARAMS panel action was successfull")); #A bit bland - edit it in the lex file
+ $c->stash( success => $c->l("nfs_PARAMS_panel_action_was_successfull")); #A bit bland - edit it in the lex file
}
}
@@ -179,7 +179,7 @@ sub do_update {
$c->stash(error => $c->l($ret));
$c->render("Nfsshare");
} else {
- $c->stash( success => $c->l("TABLE panel action was successfull")); #A bit bland - edit it in the lex file
+ $c->stash( success => $c->l("nfs_TABLE_panel_action_was_successfull")); #A bit bland - edit it in the lex file
}
}
@@ -214,7 +214,7 @@ sub do_display {
$c->app->log->info($c->log_req);
my %nfs_data = ();
- my $title = $c->l("nfs_NFS data share");
+ my $title = $c->l("nfs_NFS_data_share");
# Accessing all POST parameters
my %params = $c->req->params->to_hash;
diff --git a/Targets/_nfs_PARAMS.html.ep b/Targets/_nfs_PARAMS.html.ep
index faba353..a203351 100644
--- a/Targets/_nfs_PARAMS.html.ep
+++ b/Targets/_nfs_PARAMS.html.ep
@@ -1,5 +1,5 @@
%#
-%# Generated by SME2Gen version:0.6 Chameleon version:4.5.4 On Python:3.10.12 at 2024-04-28 11:53
+%# Generated by SME2Gen version:0.6 Chameleon version:4.5.4 On Python:3.10.12 at 2024-05-03 17:51
%#
- %= l("nfs Hello PARAMS");
+ %= l("nfs_Hello_PARAMS");
- % my $btn = l('APPLY');
+ % my $btn = l('nfs_APPLY');
%= form_for "Nfsshared" => (method => 'POST') => begin
% param 'trt' => $nfs_data->{trt} unless param 'trt';
@@ -20,17 +20,17 @@
Manage NFS Ibay settings:
- %= l('nfs_These parameters will be effective only if the share is enabled. The share is in /home/e-smith/files/ibays//files')
+ %= l('nfs_These_parameters_will_be_effective')
- %=l('nfs_Information Bay name'), class => 'label'
+ %=l('nfs_Information_Bay_name'), class => 'label'
%= stash("IbayName"), class => 'data'
- %=l('nfs_Share owner Group')
+ %=l('nfs_Share_owner_Group')
% my @ShareOwnerGrp_options = ['Write = admin, Read = group', 'Write = group, Read = everyone', 'Write = group, Read = group'];
% param 'ShareOwnerGrp' => $nfs_data->{ShareOwnerGrp} unless param 'ShareOwnerGrp';
@@ -38,7 +38,7 @@
- %=l('nfs_Enable the NFS Share')
+ %=l('nfs_Enable_the_NFS_Share')
% my @EnableNFSshare_options = ['Disabled', 'Enabled'];
% param 'EnableNFSshare' => $nfs_data->{EnableNFSshare} unless param 'EnableNFSshare';
@@ -46,7 +46,7 @@
- %=l('nfs_EnableShare on local network')
+ %=l('nfs_EnableShare_on_local_network')
% my @ShareOnLocalNetwork_options = ['Disabled', 'Enabled'];
% param 'ShareOnLocalNetwork' => $nfs_data->{ShareOnLocalNetwork} unless param 'ShareOnLocalNetwork';
@@ -54,18 +54,18 @@
- %= l('nfs_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).')
+ %= l('nfs_For_writing_permissions,allowing_the_root')
- %=l('nfs_NFS Client(s) allowed')
+ %=l('nfs_NFS_Client(s)_allowed')
% param 'NFSClientsAllowed' => $nfs_data->{NFSClientsAllowed} unless param 'NFSClientsAllowed';
%= text_area 'NFSClientsAllowed', cols=>40, rows=>5
- %=l('nfs_File system permissions')
+ %=l('nfs_File_system_permissions')
% my @FileSystemPermissions_options = ['Read only', 'Read and Write'];
% param 'FileSystemPermissions' => $nfs_data->{FileSystemPermissions} unless param 'FileSystemPermissions';
@@ -73,7 +73,7 @@
- %=l('nfs_Write (a)synchronously')
+ %=l('nfs_Write_(a)synchronously')
% my @WriteAsync_options = ['Synchronous', 'Asynchronous'];
% param 'WriteAsync' => $nfs_data->{WriteAsync} unless param 'WriteAsync';
@@ -81,7 +81,7 @@
- %=l('nfs_Delays the disk writing')
+ %=l('nfs_Delays_the_disk_writing')
% my @DelayWrite_options = ['Write delay', 'No write delay'];
% param 'DelayWrite' => $nfs_data->{DelayWrite} unless param 'DelayWrite';
@@ -89,7 +89,7 @@
- %=l('nfs_Squash the power of users')
+ %=l('nfs_Squash_the_power_of_users')
% my @Squash_options = ['All users squash', 'No root squash', 'root squash'];
% param 'Squash' => $nfs_data->{Squash} unless param 'Squash';
@@ -97,7 +97,7 @@
- %=l('nfs_Browse the parent folders')
+ %=l('nfs_Browse_the_parent_folders')
% my @BrowseParents_options = ['Hide folder', 'Show folder'];
% param 'BrowseParents' => $nfs_data->{BrowseParents} unless param 'BrowseParents';
@@ -105,7 +105,7 @@
- %=l('nfs_Requests on secure ports')
+ %=l('nfs_Requests_on_secure_ports')
% my @SecurePorts_options = ['Secure', 'Insecure'];
% param 'SecurePorts' => $nfs_data->{SecurePorts} unless param 'SecurePorts';
@@ -113,25 +113,25 @@
- %= l('nfs_Set the uid and gid if you want all requests appear to be from one user or one group, otherwise leave blank')
+ %= l('nfs_Set_the_uid_and_gid')
- %=l('nfs_Set the UID.')
+ %=l('nfs_Set_the_UID.')
% param 'SetUID' => $nfs_data->{SetUID} unless param 'SetUID';
%= text_field 'SetUID', size => '50', class => 'input' , pattern=>'.*' , placeholder=>'SetUID'
- %=l('nfs_Set the GID.')
+ %=l('nfs_Set_the_GID.')
% param 'SetGID' => $nfs_data->{SetGID} unless param 'SetGID';
%= text_field 'SetGID', size => '50', class => 'input' , pattern=>'.*' , placeholder=>'SetGID'
- %= submit_button l('Save'), class => 'action'
+ %= submit_button l('nfs_Save'), class => 'action'
%# Probably finally by a submit.
diff --git a/Targets/_nfs_TABLE.html.ep b/Targets/_nfs_TABLE.html.ep
index 3f997fb..cd61f9b 100644
--- a/Targets/_nfs_TABLE.html.ep
+++ b/Targets/_nfs_TABLE.html.ep
@@ -1,5 +1,5 @@
%#
-%# Generated by SME2Gen version:0.6 Chameleon version:4.5.4 On Python:3.10.12 at 2024-04-28 11:53
+%# Generated by SME2Gen version:0.6 Chameleon version:4.5.4 On Python:3.10.12 at 2024-05-03 17:51
%#
- %= l("nfs Hello TABLE");
+ %= l("nfs_Hello_TABLE");
- % my $btn = l('APPLY');
+ % my $btn = l('nfs_APPLY');
%= form_for "Nfsshared" => (method => 'POST') => begin
% param 'trt' => $nfs_data->{trt} unless param 'trt';
diff --git a/Targets/nfsshare_en.lex b/Targets/nfsshare_en.lex
index 7f361ba..5c001b6 100644
--- a/Targets/nfsshare_en.lex
+++ b/Targets/nfsshare_en.lex
@@ -1,23 +1,23 @@
-'nfs_Requests on secure ports' => 'Requests on secure ports'
-'nfs_APPLY' => 'APPLY'
-'nfs_EnableShare on local network' => 'EnableShare on local network'
-'nfs_Set the GID.' => 'Set the GID.'
-'nfs_Save' => 'Save'
-'nfs_Share owner Group' => 'Share owner Group'
-'nfs_Browse the parent folders' => 'Browse the parent folders'
-'nfs Hello TABLE' => 'Hello TABLE'
-'nfs_File system permissions' => 'File system permissions'
-'nfs_Delays the disk writing' => 'Delays the disk writing'
-'nfs_NFS data share' => 'NFS data share'
-'nfs_Set the UID.' => 'Set the UID.'
-'nfs_NFS Client(s) allowed' => 'NFS Client(s) allowed'
-'nfs_TABLE panel action was successfull' => 'TABLE panel action was successfull'
-'nfs_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).' => '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_These parameters will be effective only if the share is enabled. The share is in /home/e-smith/files/ibays//files' => 'These parameters will be effective only if the share is enabled. The share is in /home/e-smith/files/ibays//files'
-'nfs_Write (a)synchronously' => 'Write (a)synchronously'
-'nfs_Squash the power of users' => 'Squash the power of users'
-'nfs_Set the uid and gid if you want all requests appear to be from one user or one group, otherwise leave blank' => 'Set the uid and gid if you want all requests appear to be from one user or one group, otherwise leave blank'
-'nfs_Enable the NFS Share' => 'Enable the NFS Share'
-'nfs_PARAMS panel action was successfull' => 'PARAMS panel action was successfull'
-'nfs Hello PARAMS' => 'Hello PARAMS'
-'nfs_Information Bay name' => 'Information Bay name'
+'nfs_Enable_the_NFS_Share' => 'Enable the NFS Share',
+'nfs_Hello_TABLE' => 'Hello TABLE',
+'nfs_Write_(a)synchronously' => 'Write (a)synchronously',
+'nfs_NFS_Client(s)_allowed' => 'NFS Client(s) allowed',
+'nfs_Save' => 'Save',
+'nfs_Information_Bay_name' => 'Information Bay name',
+'nfs_Hello_PARAMS' => 'Hello PARAMS',
+'nfs_NFS_data_share' => 'NFS data share',
+'nfs_Share_owner_Group' => 'Share owner Group',
+'nfs_APPLY' => 'APPLY',
+'nfs_Set_the_GID.' => 'Set the GID.',
+'nfs_PARAMS_panel_action_was_successfull' => 'PARAMS panel action was successfull',
+'nfs_Requests_on_secure_ports' => 'Requests on secure ports',
+'nfs_Squash_the_power_of_users' => 'Squash the power of users',
+'nfs_Set_the_UID.' => 'Set the UID.',
+'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_Delays_the_disk_writing' => 'Delays the disk writing',
+'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_TABLE_panel_action_was_successfull' => 'TABLE panel action was successfull',
+'nfs_EnableShare_on_local_network' => 'EnableShare on local network',
+'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_File_system_permissions' => 'File system permissions',
+'nfs_Browse_the_parent_folders' => 'Browse the parent folders',
diff --git a/Templates/custom.pm.tem b/Templates/custom.pm.tem
index 2cd230b..864c3c1 100644
--- a/Templates/custom.pm.tem
+++ b/Templates/custom.pm.tem
@@ -56,6 +56,13 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
}
+sub create_link{
+ # WIP
+ my ($c,$route, $panel, $index) = shift;
+ my $link = "$route?trt=$panel&Selected=$index";
+ return $link;
+}
+
1;
diff --git a/nfsshare.json5 b/nfsshare.json5
index cdbf308..a41708f 100644
--- a/nfsshare.json5
+++ b/nfsshare.json5
@@ -135,6 +135,7 @@
route:"TABLE",
Header: 'NFS Share Contrib',
SubHeader: 'Manage NFS Ibay settings:',
+ Nextpanel: 'PARAMS',
Table1: {
Type:"Table",
TableControl:"ibays",
diff --git a/sm2gen.py b/sm2gen.py
index 2a69f74..dbf235b 100644
--- a/sm2gen.py
+++ b/sm2gen.py
@@ -377,23 +377,50 @@ if __name__ == "__main__":
all_strings = all_strings + extracted_strings
#Take out any duplicates
all_strings = deduplicate_array(all_strings)
- # Now process them one by one into the lexical file
- lex_all = "";
# '
_english-message' => 'English Message',
+ string_lib = [] #Array of dicts
for lex_message in all_strings:
# If has a prefix - leave it for left hand side but delete it for the right
- # If has no prefix - add one for left hand side but and lkeave it for the right
+ # If has no prefix - add one for left hand side but and leave it for the right
+ # Map all spaces to "_" on left hand side
+ # amd truncate it to max five words
+ original_str = lex_message
if lex_message.startswith(hl('prefix')):
left_str = lex_message
right_str = lex_message[len(hl('prefix'))+1:]
else:
left_str = hl('prefix')+"_"+lex_message
right_str = lex_message
- lex_all += f"'{left_str}' => '{right_str}'\n"
+ left_str = left_str.replace(" ","_")
+ words = left_str.split('_')[:6]
+ left_str = "_".join(words)
+ next_lex_str = {"orig":original_str,"left":left_str,"right":right_str}
+ string_lib.append(next_lex_str)
+ print(string_lib)
#And write it to lex file
+ # Now process them one by one into the lexical file
+ lex_all = "";
+ for lex_str in string_lib:
+ lex_all += f"\'{lex_str['left']}\' => \'{lex_str['right']}\',\n"
+ print(f"Writing {lex_file}")
with open( lex_file, 'w') as file:
file.write(lex_all)
-
+ #and then play the strings back into the partials and the layout file
+ for filename in all_files:
+ with open(filename, 'r') as file:
+ file_content = file.read()
+ # Scan through
+ for item in string_lib:
+ original_str = item["orig"]
+ left_str = item["left"]
+ right_str = item["right"]
+
+ # Replace all occurrences of original string with left string in 'contents'
+ file_content = file_content.replace(original_str, left_str)
+ # and write it back
+ with open(filename, 'w') as file:
+ file.write(file_content)
+