From a5f8e153a2d569e69ee0552a1fedf146dff2820e Mon Sep 17 00:00:00 2001 From: Brian Read Date: Mon, 6 May 2024 10:05:43 +0100 Subject: [PATCH] More fixes to lexical scan --- Targets/Nfsshare-Custom.pm | 54 ++++++++++++++++++++++------------ Targets/Nfsshare-Custom.pm.new | 40 +++++++++++++++---------- Targets/Nfsshare.html.ep | 2 +- Targets/Nfsshare.pm | 39 ++++++++++++++---------- Targets/_nfs_PARAMS.html.ep | 6 ++-- Targets/_nfs_TABLE.html.ep | 8 ++--- Targets/nfsshare_en.lex | 44 +++++++++++++-------------- Templates/controller.pm.tem | 27 ++++++++++------- Templates/custom.pm.tem | 20 ++++++++----- Templates/partial.html.ep.tem | 2 +- nfsshare.json5 | 4 +-- sm2gen.py | 11 +++++-- 12 files changed, 152 insertions(+), 105 deletions(-) diff --git a/Targets/Nfsshare-Custom.pm b/Targets/Nfsshare-Custom.pm index 5ff90d7..c250937 100644 --- a/Targets/Nfsshare-Custom.pm +++ b/Targets/Nfsshare-Custom.pm @@ -2,7 +2,7 @@ # Routines to be editted by the developer to provide validation for parameters # and provison of the control data for table(s) # -# Generated by SME2Gen version:0.6 Chameleon version:4.5.4 On Python:3.10.12 at 2024-04-27 10:35 +# Generated by SME2Gen version:0.7 Chameleon version:4.5.4 On Python:3.10.12 at 2024-05-06 08:40 # use esmith::util; @@ -23,14 +23,16 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); # Validation routines - parameters for each panel sub validate_PARAMS { - $prefix_data = shift; #Data hash as parameter - $ret = 'ok'; + my $c = shift; + my $prefix_data = shift; #Data hash as parameter + my $ret = 'ok'; return $ret; } sub validate_TABLE { - $prefix_data = shift; #Data hash as parameter - $ret = 'ok'; + my $c = shift; + my $prefix_data = shift; #Data hash as parameter + my $ret = 'ok'; return $ret; } @@ -39,7 +41,7 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); sub get_ibays { my $c = shift; - my @res; + my @ret = {}; my @ibays = $adb->ibays(); foreach my $i (@ibays){ # Taken pretty well verbatim from /usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/nfsshare.pm @@ -59,7 +61,7 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); my $actionModify = ' '; if ($modifiable eq 'yes'){ - $actionModify .= ""." " + $actionModify .= ""." " } my %hash = ('Name'=> $ibayname, @@ -67,22 +69,27 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); 'Flag' => $ibaynfs, 'Modify' => $actionModify ); - push(@res,\%hash); + push(@ret,\%hash); } - return \@res + return \@ret } + # Return hash with values from row in which link clicked on table - sub validate_get_selected_PARAMS { - $selected = shift; #Parameter is name of selected row. - %ret = {}; + sub get_selected_PARAMS { + my $c = shift; + my $selected = shift; #Parameter is name of selected row. + my $is_new_record = shift; #Indicates new record required (defaults) + my %ret = {}; return $ret; } - sub validate_get_selected_TABLE { - $selected = shift; #Parameter is name of selected row. - %ret = {}; + sub get_selected_TABLE { + my $c = shift; + my $selected = shift; #Parameter is name of selected row. + my $is_new_record = shift; #Indicates new record required (defaults) + my %ret = {}; return $ret; } @@ -90,18 +97,27 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); #after sucessful modify or create or whatever and submit then perfom (if the params validate) sub perform_PARAMS { - $prefix_data = shift; #Data hash as parameter - $ret = 'ok'; + my $c = shift; + my $prefix_data = shift; #Data hash as parameter + my $ret = 'ok'; return $ret; } sub perform_TABLE { - $prefix_data = shift; #Data hash as parameter - $ret = 'ok'; + my $c = shift; + my $prefix_data = shift; #Data hash as parameter + my $ret = 'ok'; return $ret; } +sub create_link{ + # WIP + my ($c,$route, $panel, $index) = shift; + my $link = "$route?trt=$panel&Selected=$index"; + return $link; +} + 1; diff --git a/Targets/Nfsshare-Custom.pm.new b/Targets/Nfsshare-Custom.pm.new index 11c228c..1293875 100644 --- a/Targets/Nfsshare-Custom.pm.new +++ b/Targets/Nfsshare-Custom.pm.new @@ -2,7 +2,7 @@ # Routines to be editted by the developer to provide validation for parameters # and provison of the control data for table(s) # -# Generated by SME2Gen version:0.6 Chameleon version:4.5.4 On Python:3.10.12 at 2024-05-05 09:26 +# Generated by SME2Gen version:0.7 Chameleon version:4.5.4 On Python:3.10.12 at 2024-05-06 10:02 # use esmith::util; @@ -23,14 +23,16 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); # Validation routines - parameters for each panel sub validate_PARAMS { - $prefix_data = shift; #Data hash as parameter - $ret = 'ok'; + my $c = shift; + my $prefix_data = shift; #Data hash as parameter + my $ret = 'ok'; return $ret; } sub validate_TABLE { - $prefix_data = shift; #Data hash as parameter - $ret = 'ok'; + my $c = shift; + my $prefix_data = shift; #Data hash as parameter + my $ret = 'ok'; return $ret; } @@ -39,22 +41,26 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); sub get_ibays { my $c = shift; - @ret = {} + my @ret = {}; return \@ret } # Return hash with values from row in which link clicked on table - sub validate_get_selected_PARAMS { - $selected = shift; #Parameter is name of selected row. - %ret = {}; + sub get_selected_PARAMS { + my $c = shift; + my $selected = shift; #Parameter is name of selected row. + my $is_new_record = shift; #Indicates new record required (defaults) + my %ret = {}; return $ret; } - sub validate_get_selected_TABLE { - $selected = shift; #Parameter is name of selected row. - %ret = {}; + sub get_selected_TABLE { + my $c = shift; + my $selected = shift; #Parameter is name of selected row. + my $is_new_record = shift; #Indicates new record required (defaults) + my %ret = {}; return $ret; } @@ -62,14 +68,16 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); #after sucessful modify or create or whatever and submit then perfom (if the params validate) sub perform_PARAMS { - $prefix_data = shift; #Data hash as parameter - $ret = 'ok'; + my $c = shift; + my $prefix_data = shift; #Data hash as parameter + my $ret = 'ok'; return $ret; } sub perform_TABLE { - $prefix_data = shift; #Data hash as parameter - $ret = 'ok'; + my $c = shift; + my $prefix_data = shift; #Data hash as parameter + my $ret = 'ok'; return $ret; } diff --git a/Targets/Nfsshare.html.ep b/Targets/Nfsshare.html.ep index 372925c..a7db0ba 100644 --- a/Targets/Nfsshare.html.ep +++ b/Targets/Nfsshare.html.ep @@ -1,6 +1,6 @@ % layout 'default', title => "Sme server 2 - NFS data share", share_dir => './'; %# -%# Generated by SME2Gen version:0.6 Chameleon version:4.5.4 On Python:3.10.12 at 2024-05-05 09:26 +%# Generated by SME2Gen version:0.7 Chameleon version:4.5.4 On Python:3.10.12 at 2024-05-06 10:02 %# % content_for 'module' => begin
diff --git a/Targets/Nfsshare.pm b/Targets/Nfsshare.pm index 1d7c209..3a34df7 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-05-05 09:26 +# Generated by version:SME2Gen version:0.7 Chameleon version:4.5.4 On Python:3.10.12 at 2024-05-06 10:02 # #---------------------------------------------------------------------- # heading : Network @@ -10,6 +10,7 @@ package SrvMngr::Controller::Nfsshare; # name : nfsshare, method : get, url : /nfsshare, ctlact : nfsshare#main # name : nfsshareu, method : post, url : /nfsshareu, ctlact : nfsshare#do_update # name : nfsshared, method : get, url : /nfsshared, ctlact : nfsshare#do_display +# name : nfssharee, method : post, url : /nfsshared, ctlact : nfsshare#do_display # # routes : end # @@ -67,7 +68,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'; @@ -89,7 +90,7 @@ sub main { $c->render( template => "Nfsshare" ); } -# Post request with params - submit from a form +# Post request with params - submit from the form sub do_update { # # Return after submit pushed on panel (this is a post) - route is "/u" @@ -119,7 +120,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; @@ -141,13 +142,13 @@ sub do_update { if ($trt eq 'PARAMS'){ #Validate form parameters for panel PARAMS - $ret = validate_PARAMS(\%nfs_data); + $ret = validate_PARAMS($c,\%nfs_data); $thispanel = 'PARAMS'; } if ($trt eq 'TABLE'){ #Validate form parameters for panel TABLE - $ret = validate_TABLE(\%nfs_data); + $ret = validate_TABLE($c,\%nfs_data); $thispanel = 'TABLE'; } @@ -161,25 +162,25 @@ sub do_update { if ($trt eq 'PARAMS'){ #do whatever is required ... - $ret = perform_PARAMS(\%nfs_data); + $ret = perform_PARAMS($c,\%nfs_data); if ($ret ne "ok") { # return to the panel with error message $c->stash(error => $c->l($ret)); $c->render("Nfsshare"); } else { - $c->stash( success => $c->l("nfs_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 } } if ($trt eq 'TABLE'){ #do whatever is required ... - $ret = perform_TABLE(\%nfs_data); + $ret = perform_TABLE($c,\%nfs_data); if ($ret ne "ok") { # return to the panel with error message $c->stash(error => $c->l($ret)); $c->render("Nfsshare"); } else { - $c->stash( success => $c->l("nfs_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 } } @@ -203,7 +204,9 @@ sub do_update { sub do_display { # # Return after link clicked in table (this is a get) - route is "/d" -# Expects ?trt=PANEL&selected="TableRownfs_Name" plus any other required +# Expects ?trt=PANEL&selected="TableRowName" plus any other required +# +# OR it maybe a post from the main panel to add a new record # #load up all supplied params into prefix_data hash #call get-selected-PANEL() - returns hash of all relevent parameters @@ -214,14 +217,17 @@ 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 + # Accessing all parameters my %params = $c->req->params->to_hash; - # Get number of POST parameters + # Get number of parameters my $num_params = keys %params; + #Tag as Post or Get (ie. create new entry or edit existing one + my $is_new_record = ($c->req->method() eq 'POST'); + #Params are available in the hash "params" - copy to the prefix_data hash while (my ($key, $value) = each %{$c->req->params->to_hash}) { $nfs_data{$key} = $value; @@ -231,16 +237,17 @@ sub do_display { my $trt = $c->param('trt') || 'TABLE'; #Indicates where to go now # Now add in the params from the selected row from the table + my %selectedrow; if ($trt eq 'PARAMS'){ #Validate form parameters for panel PARAMS - %selectedrow = selected_PARAMS($nfs_data{'Selected'}); + %selectedrow = get_selected_PARAMS($c,$nfs_data{'Selected'},$is_new_record); } if ($trt eq 'TABLE'){ #Validate form parameters for panel TABLE - %selectedrow = selected_TABLE($nfs_data{'Selected'}); + %selectedrow = get_selected_TABLE($c,$nfs_data{'Selected'},$is_new_record); } diff --git a/Targets/_nfs_PARAMS.html.ep b/Targets/_nfs_PARAMS.html.ep index 8cbefa4..0e8757c 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-05-05 09:26 +%# Generated by SME2Gen version:0.7 Chameleon version:4.5.4 On Python:3.10.12 at 2024-05-06 10:02 %#

- %= l("nfs_Hello_PARAMS"); + %= l('nfs_Hello_PARAMS');

% my $btn = l('nfs_APPLY'); %= form_for "Nfsshared" => (method => 'POST') => begin @@ -26,7 +26,7 @@

%=l('nfs_Information_Bay_name'), class => 'label' - %= stash("Ibaynfs_Name"), class => 'data' + %= stash("IbayName"), class => 'data'

diff --git a/Targets/_nfs_TABLE.html.ep b/Targets/_nfs_TABLE.html.ep index aeebd68..caf577f 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-05-05 09:26 +%# Generated by SME2Gen version:0.7 Chameleon version:4.5.4 On Python:3.10.12 at 2024-05-06 10:02 %#

- %= l("nfs_Hello_TABLE"); + %= l('nfs_Hello_TABLE');

% my $btn = l('nfs_APPLY'); %= form_for "Nfsshared" => (method => 'POST') => begin @@ -32,8 +32,8 @@ % my $control_data = $self->stash('ibays'); % foreach my $row (@$control_data) { - <%=$c->render_to_string(inline=>$row->{nfs_Name})%> - <%=$c->render_to_string(inline=>$row->{nfs_Description})%> + <%=$c->render_to_string(inline=>$row->{Name})%> + <%=$c->render_to_string(inline=>$row->{Description})%> <%=$c->render_to_string(inline=>$row->{flag})%> <%=$c->render_to_string(inline=>$row->{Modify})%> diff --git a/Targets/nfsshare_en.lex b/Targets/nfsshare_en.lex index 0370fe3..6317830 100644 --- a/Targets/nfsshare_en.lex +++ b/Targets/nfsshare_en.lex @@ -1,28 +1,28 @@ -'nfs_PARAMS_panel_action_was_successfull' => 'PARAMS panel action was successfull', -'nfs_Information_Bay_name' => 'Information Bay name', +'nfs_Name' => 'Name', +'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_Manage_NFS_Ibay_settings:' => 'Manage NFS Ibay settings:', +'nfs_NFS_data_share' => 'NFS data share', +'nfs_NFS_Client(s)_allowed' => 'NFS Client(s) allowed', +'nfs_Hello_TABLE' => 'Hello TABLE', +'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_Write_(a)synchronously' => 'Write (a)synchronously', +'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_Set_the_UID.' => 'Set the UID. ', +'nfs_File_system_permissions' => 'File system permissions', +'nfs_Delays_the_disk_writing' => 'Delays the disk writing', 'nfs_Squash_the_power_of_users' => 'Squash the power of users', +'nfs_Information_Bay_name' => 'Information Bay name', +'nfs_Share_owner_Group' => 'Share owner Group', +'nfs_Save' => 'Save', +'nfs_APPLY' => 'Apply', +'nfs_Description' => 'Description', +'nfs_Hello_PARAMS' => 'Hello PARAMS', +'nfs_TABLE_panel_action_was_successfull' => 'TABLE panel action was successfull', 'nfs_Enable_the_NFS_Share' => 'Enable the NFS Share', 'nfs_EnableShare_on_local_network' => 'Enableshare on local network', -'nfs_Share_owner_Group' => 'Share owner Group', -'nfs_Browse_the_parent_folders' => 'Browse the parent folders', -'nfs_Hello_PARAMS' => 'Hello PARAMS', -'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_Hello_TABLE' => 'Hello TABLE', -'nfs_NFS_Client(s)_allowed' => 'NFS Client(s) allowed', -'nfs_File_system_permissions' => 'File system permissions', -'nfs_Description' => 'Description', +'nfs_PARAMS_panel_action_was_successfull' => 'PARAMS panel action was successfull', +'nfs_Set_the_GID.' => 'Set the GID. ', 'nfs_Action' => 'Action', -'nfs_NFS_data_share' => 'NFS data share', -'nfs_Manage_NFS_Ibay_settings:' => 'Manage NFS Ibay settings:', -'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_Browse_the_parent_folders' => 'Browse the parent folders', 'Nfs_status' => 'Status', 'nfs_Requests_on_secure_ports' => 'Requests on secure ports', -'nfs_TABLE_panel_action_was_successfull' => 'TABLE panel action was successfull', -'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_APPLY' => 'Apply', -'nfs_Set_the_UID.' => 'Set the UID. ', -'nfs_Name' => 'Name', -'nfs_Set_the_GID.' => 'Set the GID. ', -'nfs_Save' => 'Save', -'nfs_Write_(a)synchronously' => 'Write (a)synchronously', diff --git a/Templates/controller.pm.tem b/Templates/controller.pm.tem index b25239e..1a12bcd 100644 --- a/Templates/controller.pm.tem +++ b/Templates/controller.pm.tem @@ -10,6 +10,7 @@ package SrvMngr::Controller::${PackageName}; # name : ${lcPackageName}, method : get, url : /${lcPackageName}, ctlact : ${lcPackageName}#main # name : ${lcPackageName}u, method : post, url : /${lcPackageName}u, ctlact : ${lcPackageName}#do_update # name : ${lcPackageName}d, method : get, url : /${lcPackageName}d, ctlact : ${lcPackageName}#do_display +# name : ${lcPackageName}e, method : post, url : /${lcPackageName}d, ctlact : ${lcPackageName}#do_display # # routes : end # @@ -67,7 +68,7 @@ sub main { $c->app->log->info( $c->log_req ); my %${prefix}_data = (); - my $title = $c->l("${prefix}_${MenuDescription}"); + my $title = $c->l('${prefix}_${MenuDescription}'); my $modul = ''; $$${prefix}_data{'trt'} = '${firstPanel}'; @@ -91,7 +92,7 @@ sub main { $c->render( template => "${PackageName}" ); } -# Post request with params - submit from a form +# Post request with params - submit from the form sub do_update { # # Return after submit pushed on panel (this is a post) - route is "/u" @@ -121,7 +122,7 @@ sub do_update { $c->app->log->info($c->log_req); my %${prefix}_data = (); - my $title = $c->l("${prefix}_${MenuDescription}"); + my $title = $c->l('${prefix}_${MenuDescription}'); # Accessing all POST parameters my %params = $c->req->params->to_hash; @@ -143,7 +144,7 @@ sub do_update { if ($trt eq '${panel}'){ #Validate form parameters for panel ${panel} - $ret = validate_${panel}(\%${prefix}_data); + $ret = validate_${panel}($c,\%${prefix}_data); $thispanel = '${panel}'; } @@ -157,13 +158,13 @@ sub do_update { if ($trt eq '${panel}'){ #do whatever is required ... - $ret = perform_${panel}(\%${prefix}_data); + $ret = perform_${panel}($c,\%${prefix}_data); if ($ret ne "ok") { # return to the panel with error message $c->stash(error => $c->l($ret)); $c->render("${PackageName}"); } else { - $c->stash( success => $c->l("${panel} panel action was successfull")); #A bit bland - edit it in the lex file + $c->stash( success => $c->l('${panel} panel action was successfull')); #A bit bland - edit it in the lex file } } @@ -189,6 +190,8 @@ sub do_display { # Return after link clicked in table (this is a get) - route is "/d" # Expects ?trt=PANEL&selected="TableRowName" plus any other required # +# OR it maybe a post from the main panel to add a new record +# #load up all supplied params into prefix_data hash #call get-selected-PANEL() - returns hash of all relevent parameters #load up returned hash into prefix_data @@ -198,14 +201,17 @@ sub do_display { $c->app->log->info($c->log_req); my %${prefix}_data = (); - my $title = $c->l("${prefix}_${MenuDescription}"); + my $title = $c->l('${prefix}_${MenuDescription}'); - # Accessing all POST parameters + # Accessing all parameters my %params = $c->req->params->to_hash; - # Get number of POST parameters + # Get number of parameters my $num_params = keys %params; + #Tag as Post or Get (ie. create new entry or edit existing one + my $is_new_record = ($c->req->method() eq 'POST'); + #Params are available in the hash "params" - copy to the prefix_data hash while (my ($key, $value) = each %{$c->req->params->to_hash}) { $$${prefix}_data{$key} = $value; @@ -215,11 +221,12 @@ sub do_display { my $trt = $c->param('trt') || '${firstPanel}'; #Indicates where to go now # Now add in the params from the selected row from the table + my %selectedrow; if ($trt eq '${panel}'){ #Validate form parameters for panel ${panel} - %selectedrow = selected_${panel}($$${prefix}_data{'Selected'}); + %selectedrow = get_selected_${panel}($c,$$${prefix}_data{'Selected'},$is_new_record); } diff --git a/Templates/custom.pm.tem b/Templates/custom.pm.tem index 864c3c1..f3eb2d5 100644 --- a/Templates/custom.pm.tem +++ b/Templates/custom.pm.tem @@ -23,8 +23,9 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); # Validation routines - parameters for each panel sub validate_${panel} { - $prefix_data = shift; #Data hash as parameter - $ret = 'ok'; + my $c = shift; + my $prefix_data = shift; #Data hash as parameter + my $ret = 'ok'; return $ret; } @@ -33,16 +34,18 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); sub get_${tablecontrol} { my $c = shift; - @ret = {} + my @ret = {}; return \@ret } # Return hash with values from row in which link clicked on table - sub validate_get_selected_${panel} { - $selected = shift; #Parameter is name of selected row. - %ret = {}; + sub get_selected_${panel} { + my $c = shift; + my $selected = shift; #Parameter is name of selected row. + my $is_new_record = shift; #Indicates new record required (defaults) + my %ret = {}; return $ret; } @@ -50,8 +53,9 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); #after sucessful modify or create or whatever and submit then perfom (if the params validate) sub perform_${panel} { - $prefix_data = shift; #Data hash as parameter - $ret = 'ok'; + my $c = shift; + my $prefix_data = shift; #Data hash as parameter + my $ret = 'ok'; return $ret; } diff --git a/Templates/partial.html.ep.tem b/Templates/partial.html.ep.tem index 6fb1f9a..7146219 100644 --- a/Templates/partial.html.ep.tem +++ b/Templates/partial.html.ep.tem @@ -8,7 +8,7 @@ };

- %= l("${prefix} Hello ${route}"); + %= l('${prefix} Hello ${route}');

% my $btn = l('APPLY'); %= form_for "${PackageName}d" => (method => 'POST') => begin diff --git a/nfsshare.json5 b/nfsshare.json5 index a41708f..e3eb3b6 100644 --- a/nfsshare.json5 +++ b/nfsshare.json5 @@ -132,12 +132,12 @@ }, { Name: 'select_ibay', - route:"TABLE", + route:'TABLE', Header: 'NFS Share Contrib', SubHeader: 'Manage NFS Ibay settings:', Nextpanel: 'PARAMS', Table1: { - Type:"Table", + Type:'Table', TableControl:"ibays", TopHeadings: ['Name','Description','Nfs status', 'Action'], Columns: ['Name','Description','flag','Modify'] diff --git a/sm2gen.py b/sm2gen.py index 13a5341..4df57ff 100644 --- a/sm2gen.py +++ b/sm2gen.py @@ -1,5 +1,4 @@ import json5 -#import pandas as pd import sys import argparse from chameleon import PageTemplateFile,PageTemplate @@ -11,6 +10,12 @@ import pkg_resources from datetime import datetime import xml.etree.ElementTree as ET +# +#To Do +# 1. Get routing working +# 2. Deal with ? and ! as sentence ends in text-format +# 3. Make lexical scan work with double or single quotes (if possible) + SME2Gen_version = '0.7' json5_dict: dict = {} json5_html_list: list = [] @@ -440,13 +445,13 @@ if __name__ == "__main__": left_str = hl('prefix')+"_"+lex_message right_str = lex_message right_str = right_str.replace("_"," ") + print(f"Right:{right_str}") right_str = format_text(right_str) 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 = ""; @@ -466,7 +471,7 @@ if __name__ == "__main__": 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) + file_content = file_content.replace("l('"+original_str+"')", "l('"+left_str+"')") # and write it back with open(filename, 'w') as file: file.write(file_content)