Add Table creation code

This commit is contained in:
2024-04-24 16:09:23 +01:00
parent 2d3fabcc5b
commit 9840d4171e
8 changed files with 174 additions and 73 deletions

View File

@@ -35,11 +35,11 @@ use esmith::DomainsDB;
#The most common ones
our $db = esmith::ConfigDB->open() || die("Couldn't open config db");
our $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
our $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
sub main {
@@ -50,7 +50,12 @@ sub main {
my $title = $c->l("nfs_NFS data share");
my $modul = '';
$nfs_data{trt} = 'PARAMS';
$nfs_data{trt} = 'TABLE';
#Load any DB entries into the <prefix>_data area so as they are preset in the form
# which DB
my $db = $cdb; #Default to config
$c->stash(
title => $title,
@@ -81,28 +86,38 @@ sub do_update {
}
# the value of trt will tell you which panel has returned
my $trt = $c->param('trt') || 'PARAMS' ; #hidden control on every form.
my $trt = $c->param('trt') || 'TABLE' ; #hidden control on every form.
my $ret = 'ok';
#Validate the parameters accordingly
if ($trt eq 'PARAMS'){
#Validate for panel PARAMS
# set $ret = $c->l('Error message') if invalid'
#Validate form parameters for panel PARAMS
# and set $ret = $c->l('Error message') if invalid'
# otherwise set $ret to "ok"
if ($ret ne "ok"){
$c->stash(error => $c->l($ret))
} else {
#Do whatever is needed, including writing values to the DB
my $db = $cdb; #Default to config
} $c->stash( success => $c->l('ok message'))
}
if ($trt eq 'TABLE'){
#Validate for panel TABLE
# set $ret = $c->l('Error message') if invalid'
#Validate form parameters for panel TABLE
# and set $ret = $c->l('Error message') if invalid'
# otherwise set $ret to "ok"
if ($ret ne "ok"){
$c->stash(error => $c->l($ret))
} else {
#Do whatever is needed, including writing values to the DB
my $db = $cdb; #Default to config
} $c->stash( success => $c->l('ok message'))
}
if ($ret ne "ok"){
$c->stash(error => $c->l($ret))
} else {
$c->stash( success => $c->l('ok message'))
}
if ($ret eq 'ok'){
#Do whatever
}
# set nfs_data{trt} = <route>;
$c->stash(
title => $title,

View File

@@ -13,7 +13,11 @@
% param 'trt' => $nfs_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $nfs_data->{trt}
%# Inputs etc in here.
<h2>Manage NFS Ibay settings:</h2><p>These parameters will be effective only if the share is enabled. The share is in /home/e-smith/files/ibays/$(STASH:ibayname)/files</p>
<h2>Manage NFS Ibay settings:</h2>
<p>
%= l('nfs_These parameters will be effective only if the share is enabled. The share is in /home/e-smith/files/ibays//files')
</p>
<p><span class=label>
%=l('nfs_Information Bay name'), class => 'label'
</span><span class=data>
@@ -43,7 +47,11 @@
% param 'ShareOnLocalNetwork' => $nfs_data->{ShareOnLocalNetwork} unless param 'ShareOnLocalNetwork';
%= select_field 'ShareOnLocalNetwork' => @ShareOnLocalNetwork_options, class => 'input'
<br></span> </p>
<p>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).</p>
<p>
%= 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).')
</p>
<span class=label>
%=l('nfs_NFS Client(s) allowed')
</span><span class=data>
@@ -60,7 +68,7 @@
<br></span> </p>
<p><span class=label>
%=l('nfs_Write (a)synchronously.')
%=l('nfs_Write (a)synchronously')
</span><span class=data>
% my @WriteAsync_options = ['Synchronous', 'Asynchronous'];
% param 'WriteAsync' => $nfs_data->{WriteAsync} unless param 'WriteAsync';
@@ -68,7 +76,7 @@
<br></span> </p>
<p><span class=label>
%=l('nfs_Delays the disk writings.')
%=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';
@@ -76,7 +84,7 @@
<br></span> </p>
<p><span class=label>
%=l('nfs_Squash the power of users.')
%=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';
@@ -92,13 +100,17 @@
<br></span> </p>
<p><span class=label>
%=l('nfs_Requests on secure ports.')
%=l('nfs_Requests on secure ports')
</span><span class=data>
% my @SecurePorts_options = ['Secure', 'Insecure'];
% param 'SecurePorts' => $nfs_data->{SecurePorts} unless param 'SecurePorts';
%= select_field 'SecurePorts' => @SecurePorts_options, class => 'input'
<br></span> </p>
<p>Set the uid and gid if you want all requests appear to be from one user or one group, otherwise leave blank.</p>
<p>
%= l('nfs_Set the uid and gid if you want all requests appear to be from one user or one group, otherwise leave blank')
</p>
<p><span class=label>
%=l('nfs_Set the UID.')
</span><span class=data>

View File

@@ -13,7 +13,30 @@
% param 'trt' => $nfs_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $nfs_data->{trt}
%# Inputs etc in here.
<h2>Manage NFS Ibay settings:</h2>
<table class="sme-border TableSort">
<thead>
<tr>
<td>Name</td>
<td>Description</td>
<td>Nfs status</td>
<td>Action</td>
</tr>
</thead>
<tbody>
% my $control_data = $self->stash('ibays');
% foreach my $row (@$control_data) {
<tr>
<td><%=$row->Name%></td>
<td><%=$row->Description%></td>
<td><%=$row->flag%></td>
<td><%=$row->PARAMS%></td>
</tr>
%}
</tbody>
</table>
%# Probably finally by a submit.
% end
</div>

View File

@@ -1,20 +1,23 @@
'nfs_Set the UID.' => 'Set the UID.'
'nfs_Requests on secure ports' => 'Requests on secure ports'
'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_Delays the disk writing' => 'Delays the disk writing'
'nfs_Information Bay name' => 'Information Bay name'
'nfs_EnableShare on local network' => 'EnableShare on local network'
'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 Hello TABLE' => 'Hello TABLE'
'nfs_NFS Client(s) allowed' => 'NFS Client(s) allowed'
'nfs_Error message' => 'Error message'
'nfs_Browse the parent folders' => 'Browse the parent folders'
'nfs_APPLY' => 'APPLY'
'nfs_Save' => 'Save'
'nfs_Squash the power of users.' => 'Squash the power of users.'
'nfs Hello PARAMS' => 'Hello PARAMS'
'nfs_Requests on secure ports.' => 'Requests on secure ports.'
'nfs_Error message' => 'Error message'
'nfs_Enable the NFS Share' => 'Enable the NFS Share'
'nfs_NFS data share' => 'NFS data share'
'nfs_Delays the disk writings.' => 'Delays the disk writings.'
'nfs_Browse the parent folders' => 'Browse the parent folders'
'nfs_Write (a)synchronously.' => 'Write (a)synchronously.'
'nfs_NFS Client(s) allowed' => 'NFS Client(s) allowed'
'nfs_EnableShare on local network' => 'EnableShare on local network'
'nfs_Information Bay name' => 'Information Bay name'
'nfs_ok message' => 'ok message'
'nfs_Set the GID.' => 'Set the GID.'
'nfs_Share owner Group' => 'Share owner Group'
'nfs Hello TABLE' => 'Hello TABLE'
'nfs_Set the UID.' => 'Set the UID.'
'nfs_File system permissions' => 'File system permissions'
'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_Write (a)synchronously' => 'Write (a)synchronously'
'nfs_ok message' => 'ok message'
'nfs Hello PARAMS' => 'Hello PARAMS'
'nfs_Set the GID.' => 'Set the GID.'
'nfs_Squash the power of users' => 'Squash the power of users'
'nfs_NFS data share' => 'NFS data share'