Add Table creation code
This commit is contained in:
parent
2d3fabcc5b
commit
9840d4171e
@ -35,11 +35,11 @@ use esmith::DomainsDB;
|
|||||||
|
|
||||||
|
|
||||||
#The most common ones
|
#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 $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
||||||
our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
|
our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
|
||||||
our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
|
our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
|
||||||
our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
||||||
|
|
||||||
sub main {
|
sub main {
|
||||||
|
|
||||||
@ -50,7 +50,12 @@ sub main {
|
|||||||
my $title = $c->l("nfs_NFS data share");
|
my $title = $c->l("nfs_NFS data share");
|
||||||
my $modul = '';
|
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(
|
$c->stash(
|
||||||
title => $title,
|
title => $title,
|
||||||
@ -81,28 +86,38 @@ sub do_update {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# the value of trt will tell you which panel has returned
|
# 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';
|
my $ret = 'ok';
|
||||||
#Validate the parameters accordingly
|
#Validate the parameters accordingly
|
||||||
|
|
||||||
if ($trt eq 'PARAMS'){
|
if ($trt eq 'PARAMS'){
|
||||||
#Validate for panel PARAMS
|
#Validate form parameters for panel PARAMS
|
||||||
# set $ret = $c->l('Error message') if invalid'
|
# 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'){
|
if ($trt eq 'TABLE'){
|
||||||
#Validate for panel TABLE
|
#Validate form parameters for panel TABLE
|
||||||
# set $ret = $c->l('Error message') if invalid'
|
# 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>;
|
# set nfs_data{trt} = <route>;
|
||||||
$c->stash(
|
$c->stash(
|
||||||
title => $title,
|
title => $title,
|
||||||
|
@ -13,7 +13,11 @@
|
|||||||
% param 'trt' => $nfs_data->{trt} unless param 'trt';
|
% param 'trt' => $nfs_data->{trt} unless param 'trt';
|
||||||
%= hidden_field 'trt' => $nfs_data->{trt}
|
%= hidden_field 'trt' => $nfs_data->{trt}
|
||||||
%# Inputs etc in here.
|
%# 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>
|
<p><span class=label>
|
||||||
%=l('nfs_Information Bay name'), class => 'label'
|
%=l('nfs_Information Bay name'), class => 'label'
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
@ -43,7 +47,11 @@
|
|||||||
% param 'ShareOnLocalNetwork' => $nfs_data->{ShareOnLocalNetwork} unless param 'ShareOnLocalNetwork';
|
% param 'ShareOnLocalNetwork' => $nfs_data->{ShareOnLocalNetwork} unless param 'ShareOnLocalNetwork';
|
||||||
%= select_field 'ShareOnLocalNetwork' => @ShareOnLocalNetwork_options, class => 'input'
|
%= select_field 'ShareOnLocalNetwork' => @ShareOnLocalNetwork_options, class => 'input'
|
||||||
<br></span> </p>
|
<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>
|
<span class=label>
|
||||||
%=l('nfs_NFS Client(s) allowed')
|
%=l('nfs_NFS Client(s) allowed')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
@ -60,7 +68,7 @@
|
|||||||
<br></span> </p>
|
<br></span> </p>
|
||||||
|
|
||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('nfs_Write (a)synchronously.')
|
%=l('nfs_Write (a)synchronously')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% my @WriteAsync_options = ['Synchronous', 'Asynchronous'];
|
% my @WriteAsync_options = ['Synchronous', 'Asynchronous'];
|
||||||
% param 'WriteAsync' => $nfs_data->{WriteAsync} unless param 'WriteAsync';
|
% param 'WriteAsync' => $nfs_data->{WriteAsync} unless param 'WriteAsync';
|
||||||
@ -68,7 +76,7 @@
|
|||||||
<br></span> </p>
|
<br></span> </p>
|
||||||
|
|
||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('nfs_Delays the disk writings.')
|
%=l('nfs_Delays the disk writing')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% my @DelayWrite_options = ['Write delay', 'No write delay'];
|
% my @DelayWrite_options = ['Write delay', 'No write delay'];
|
||||||
% param 'DelayWrite' => $nfs_data->{DelayWrite} unless param 'DelayWrite';
|
% param 'DelayWrite' => $nfs_data->{DelayWrite} unless param 'DelayWrite';
|
||||||
@ -76,7 +84,7 @@
|
|||||||
<br></span> </p>
|
<br></span> </p>
|
||||||
|
|
||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('nfs_Squash the power of users.')
|
%=l('nfs_Squash the power of users')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% my @Squash_options = ['All users squash', 'No root squash', 'root squash'];
|
% my @Squash_options = ['All users squash', 'No root squash', 'root squash'];
|
||||||
% param 'Squash' => $nfs_data->{Squash} unless param 'Squash';
|
% param 'Squash' => $nfs_data->{Squash} unless param 'Squash';
|
||||||
@ -92,13 +100,17 @@
|
|||||||
<br></span> </p>
|
<br></span> </p>
|
||||||
|
|
||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('nfs_Requests on secure ports.')
|
%=l('nfs_Requests on secure ports')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% my @SecurePorts_options = ['Secure', 'Insecure'];
|
% my @SecurePorts_options = ['Secure', 'Insecure'];
|
||||||
% param 'SecurePorts' => $nfs_data->{SecurePorts} unless param 'SecurePorts';
|
% param 'SecurePorts' => $nfs_data->{SecurePorts} unless param 'SecurePorts';
|
||||||
%= select_field 'SecurePorts' => @SecurePorts_options, class => 'input'
|
%= select_field 'SecurePorts' => @SecurePorts_options, class => 'input'
|
||||||
<br></span> </p>
|
<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>
|
<p><span class=label>
|
||||||
%=l('nfs_Set the UID.')
|
%=l('nfs_Set the UID.')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
|
@ -13,6 +13,29 @@
|
|||||||
% param 'trt' => $nfs_data->{trt} unless param 'trt';
|
% param 'trt' => $nfs_data->{trt} unless param 'trt';
|
||||||
%= hidden_field 'trt' => $nfs_data->{trt}
|
%= hidden_field 'trt' => $nfs_data->{trt}
|
||||||
%# Inputs etc in here.
|
%# 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.
|
%# Probably finally by a submit.
|
||||||
% end
|
% end
|
||||||
|
@ -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_APPLY' => 'APPLY'
|
||||||
'nfs_Save' => 'Save'
|
'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_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_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'
|
||||||
|
@ -35,11 +35,11 @@ use esmith::DomainsDB;
|
|||||||
|
|
||||||
|
|
||||||
#The most common ones
|
#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 $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
||||||
our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
|
our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
|
||||||
our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
|
our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
|
||||||
our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
||||||
|
|
||||||
sub main {
|
sub main {
|
||||||
|
|
||||||
@ -52,6 +52,13 @@ sub main {
|
|||||||
|
|
||||||
$$${prefix}_data{trt} = '${firstPanel}';
|
$$${prefix}_data{trt} = '${firstPanel}';
|
||||||
|
|
||||||
|
#Load any DB entries into the <prefix>_data area so as they are preset in the form
|
||||||
|
# which DB
|
||||||
|
my $db = $$${db | 'cdb'}; #Default to config
|
||||||
|
<tal:block tal:repeat="dbentry dbentries">
|
||||||
|
$$${prefix}_data{${dbentry}} = $db->prop('${dbentry}') || ${dbdefault}
|
||||||
|
</tal:block>
|
||||||
|
|
||||||
$c->stash(
|
$c->stash(
|
||||||
title => $title,
|
title => $title,
|
||||||
modul => $modul,
|
modul => $modul,
|
||||||
@ -86,18 +93,22 @@ sub do_update {
|
|||||||
#Validate the parameters accordingly
|
#Validate the parameters accordingly
|
||||||
<tal:block tal:repeat="condition conditions">
|
<tal:block tal:repeat="condition conditions">
|
||||||
if ($trt eq '${condition}'){
|
if ($trt eq '${condition}'){
|
||||||
#Validate for panel ${condition}
|
#Validate form parameters for panel ${condition}
|
||||||
# set $ret = $c->l('Error message') if invalid'
|
# 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 = $$${db | 'cdb'}; #Default to config
|
||||||
|
<tal:block tal:repeat="dbentry dbentries">
|
||||||
|
$db->set_prop('${dbentry}'=> param{'${dbentry}'}; #Copy back into db
|
||||||
|
$$${prefix}_data{${dbentry}} = $db->prop('${dbentry}'); #Copy out into stash
|
||||||
|
</tal:block>
|
||||||
|
|
||||||
|
} $c->stash( success => $c->l('ok message'))
|
||||||
}
|
}
|
||||||
</tal:block>
|
</tal:block>
|
||||||
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 ${prefix}_data{trt} = <route>;
|
# set ${prefix}_data{trt} = <route>;
|
||||||
$c->stash(
|
$c->stash(
|
||||||
title => $title,
|
title => $title,
|
||||||
|
@ -44,7 +44,12 @@
|
|||||||
]]></Textinput>
|
]]></Textinput>
|
||||||
|
|
||||||
<SubHeader><![CDATA[<h2>${value}</h2>]]></SubHeader>
|
<SubHeader><![CDATA[<h2>${value}</h2>]]></SubHeader>
|
||||||
<Paragraph><![CDATA[<p>${value}</p>]]></Paragraph>
|
|
||||||
|
<Paragraph><![CDATA[
|
||||||
|
<p>
|
||||||
|
%= l('${prefix}_${value}')
|
||||||
|
</p>
|
||||||
|
]]></Paragraph>
|
||||||
|
|
||||||
<Submit><![CDATA[
|
<Submit><![CDATA[
|
||||||
<span class='data'>
|
<span class='data'>
|
||||||
@ -92,8 +97,23 @@
|
|||||||
]]>
|
]]>
|
||||||
</password>
|
</password>
|
||||||
|
|
||||||
<Extra6><![CDATA[
|
<Table><![CDATA[
|
||||||
|
<table class="sme-border TableSort">
|
||||||
|
<thead>
|
||||||
|
<tr><tal:block tal:repeat="ColHead TopHeadings">
|
||||||
|
<td>${ColHead}</td></tal:block>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
% my $control_data = $self->stash('${Control}');
|
||||||
|
% foreach my $row (@$control_data) {
|
||||||
|
<tr><tal:block tal:repeat="ColContent Columns">
|
||||||
|
<td><%=$row->${ColContent}%></td></tal:block>
|
||||||
|
</tr>
|
||||||
|
%}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
]]>
|
]]>
|
||||||
</Extra6>
|
</Table>
|
||||||
|
|
||||||
</root>
|
</root>
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
MenuHeading: 'Network',
|
MenuHeading: 'Network',
|
||||||
MenuDescription: 'NFS data share',
|
MenuDescription: 'NFS data share',
|
||||||
MenuNavigation: '2000 400',
|
MenuNavigation: '2000 400',
|
||||||
firstPanel: 'PARAMS',
|
firstPanel: 'TABLE',
|
||||||
html: [
|
html: [
|
||||||
{
|
{
|
||||||
Name: 'params',
|
Name: 'params',
|
||||||
route: 'PARAMS',
|
route: 'PARAMS',
|
||||||
Header: 'NFS Share Contrib',
|
Header: 'NFS Share Contrib',
|
||||||
SubHeader: 'Manage NFS Ibay settings:',
|
SubHeader: 'Manage NFS Ibay settings:',
|
||||||
Paragraph1: 'These parameters will be effective only if the share is enabled. The share is in /home/e-smith/files/ibays/$(STASH:ibayname)/files',
|
Paragraph1: 'These parameters will be effective only if the share is enabled. The share is in /home/e-smith/files/ibays//files',
|
||||||
Input1: {
|
Input1: {
|
||||||
Name: 'IbayName',
|
Name: 'IbayName',
|
||||||
Type: 'Text',
|
Type: 'Text',
|
||||||
@ -69,7 +69,7 @@
|
|||||||
Input7: {
|
Input7: {
|
||||||
Name: 'WriteAsync',
|
Name: 'WriteAsync',
|
||||||
Type: 'Selection',
|
Type: 'Selection',
|
||||||
Label: 'Write (a)synchronously.',
|
Label: 'Write (a)synchronously',
|
||||||
Value: [
|
Value: [
|
||||||
'Synchronous',
|
'Synchronous',
|
||||||
'Asynchronous',
|
'Asynchronous',
|
||||||
@ -78,7 +78,7 @@
|
|||||||
Input8: {
|
Input8: {
|
||||||
Name: 'DelayWrite',
|
Name: 'DelayWrite',
|
||||||
Type: 'Selection',
|
Type: 'Selection',
|
||||||
Label: 'Delays the disk writings.',
|
Label: 'Delays the disk writing',
|
||||||
Value: [
|
Value: [
|
||||||
'Write delay',
|
'Write delay',
|
||||||
'No write delay',
|
'No write delay',
|
||||||
@ -88,7 +88,7 @@
|
|||||||
Input9: {
|
Input9: {
|
||||||
Name: 'Squash',
|
Name: 'Squash',
|
||||||
Type: 'Selection',
|
Type: 'Selection',
|
||||||
Label: 'Squash the power of users.',
|
Label: 'Squash the power of users',
|
||||||
Value: [
|
Value: [
|
||||||
'All users squash',
|
'All users squash',
|
||||||
'No root squash',
|
'No root squash',
|
||||||
@ -109,14 +109,14 @@
|
|||||||
Input11: {
|
Input11: {
|
||||||
Name: 'SecurePorts',
|
Name: 'SecurePorts',
|
||||||
Type: 'Selection',
|
Type: 'Selection',
|
||||||
Label: 'Requests on secure ports.',
|
Label: 'Requests on secure ports',
|
||||||
Value: [
|
Value: [
|
||||||
'Secure',
|
'Secure',
|
||||||
'Insecure',
|
'Insecure',
|
||||||
],
|
],
|
||||||
Default: 0,
|
Default: 0,
|
||||||
},
|
},
|
||||||
Paragraph3: 'Set the uid and gid if you want all requests appear to be from one user or one group, otherwise leave blank.',
|
Paragraph3: 'Set the uid and gid if you want all requests appear to be from one user or one group, otherwise leave blank',
|
||||||
Input12: {
|
Input12: {
|
||||||
Name: 'SetUID',
|
Name: 'SetUID',
|
||||||
Type: 'Textinput',
|
Type: 'Textinput',
|
||||||
@ -130,7 +130,16 @@
|
|||||||
Submit: 'Save',
|
Submit: 'Save',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'select_ibay',route:"TABLE"
|
Name: 'select_ibay',
|
||||||
},
|
route:"TABLE",
|
||||||
],
|
Header: 'NFS Share Contrib',
|
||||||
|
SubHeader: 'Manage NFS Ibay settings:',
|
||||||
|
Table1: {
|
||||||
|
Type:"Table",
|
||||||
|
Control:"ibays",
|
||||||
|
TopHeadings: ['Name','Description','Nfs status', 'Action'],
|
||||||
|
Columns: ['Name','Description','flag','PARAMS']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@ -182,6 +182,8 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# Routes for each panel
|
# Routes for each panel
|
||||||
routes = get_all_routes();
|
routes = get_all_routes();
|
||||||
|
#print(routes)
|
||||||
|
|
||||||
lc_routes =lc_get_all_routes();
|
lc_routes =lc_get_all_routes();
|
||||||
|
|
||||||
#File names
|
#File names
|
||||||
@ -196,8 +198,9 @@ if __name__ == "__main__":
|
|||||||
#Generate controller file
|
#Generate controller file
|
||||||
try:
|
try:
|
||||||
controller_template = PageTemplateFile("Templates/controller.pm.tem")
|
controller_template = PageTemplateFile("Templates/controller.pm.tem")
|
||||||
|
dbentries = []
|
||||||
try:
|
try:
|
||||||
controller_perl = controller_template.render(**json5_dict,conditions=routes,lcPackageName=json5_dict['PackageName'].lower())
|
controller_perl = controller_template.render(dbentries=dbentries,**json5_dict,conditions=routes,lcPackageName=json5_dict['PackageName'].lower())
|
||||||
#print()
|
#print()
|
||||||
#print(controller_perl)
|
#print(controller_perl)
|
||||||
# Map '$ 'to '$' to overcome problem with escaping $ signs
|
# Map '$ 'to '$' to overcome problem with escaping $ signs
|
||||||
@ -219,7 +222,7 @@ if __name__ == "__main__":
|
|||||||
#layout_mojo = layout_mojo.replace("$ ", "$")
|
#layout_mojo = layout_mojo.replace("$ ", "$")
|
||||||
with open(layout_file, 'w') as file:
|
with open(layout_file, 'w') as file:
|
||||||
file.write(layout_mojo)
|
file.write(layout_mojo)
|
||||||
print(f"{layout_file} mojo template generated ok")
|
print(f"{layout_file} mojo template layout file generated ok")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"An chameleon render on layout file error occurred: {e}")
|
print(f"An chameleon render on layout file error occurred: {e}")
|
||||||
#print()
|
#print()
|
||||||
@ -245,9 +248,9 @@ if __name__ == "__main__":
|
|||||||
#partial_mojo_template = partial_mojo_template.replace("$ ", "$")
|
#partial_mojo_template = partial_mojo_template.replace("$ ", "$")
|
||||||
with open( partial_files[i], 'w') as file:
|
with open( partial_files[i], 'w') as file:
|
||||||
file.write(partial_mojo_template)
|
file.write(partial_mojo_template)
|
||||||
print(f"{partial_files[i]} mojo template generated ok")
|
print(f"{partial_files[i]} mojo template generated ok - phase 1")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"An chameleon render on partial file {html['route']} occurred: {e}")
|
print(f"An chameleon render error on partial file {html['route']} occurred: {e}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"An chameleon html {html['route']} error occurred: {e}")
|
print(f"An chameleon html {html['route']} error occurred: {e}")
|
||||||
|
|
||||||
@ -264,7 +267,7 @@ if __name__ == "__main__":
|
|||||||
try:
|
try:
|
||||||
control_template = PageTemplate(html_controls[inner_html['Type']])
|
control_template = PageTemplate(html_controls[inner_html['Type']])
|
||||||
try:
|
try:
|
||||||
control_html = control_template.render(**inner_html,prefix=prefix_is)
|
control_html = control_template.render(**inner_html,prefix=prefix_is) #Contents=Contents,Headings=Headings)
|
||||||
# Map '$ 'to '$' to overcome problem with escaping $ signs
|
# Map '$ 'to '$' to overcome problem with escaping $ signs
|
||||||
#control_html = control_html.replace("$ ", "$")
|
#control_html = control_html.replace("$ ", "$")
|
||||||
# Add in two tabs before each newline
|
# Add in two tabs before each newline
|
||||||
@ -272,6 +275,11 @@ if __name__ == "__main__":
|
|||||||
# and an extra tab before each "%"
|
# and an extra tab before each "%"
|
||||||
#control_html = control_html.replace("%", "\t%")
|
#control_html = control_html.replace("%", "\t%")
|
||||||
#print(control_html)
|
#print(control_html)
|
||||||
|
# And re-run it if the type is "table"
|
||||||
|
#if inner_html['Type'] == 'Table'
|
||||||
|
#Another scan
|
||||||
|
# print("Another scan for the table")
|
||||||
|
#Else just move on.
|
||||||
all_controls_html = all_controls_html + control_html
|
all_controls_html = all_controls_html + control_html
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"An chameleon render on partial file control {inner_html['Name']} error occurred: {e}")
|
print(f"An chameleon render on partial file control {inner_html['Name']} error occurred: {e}")
|
||||||
@ -291,7 +299,7 @@ if __name__ == "__main__":
|
|||||||
#simple_control_html = simple_control_html.replace("\n", "\n\t\t")
|
#simple_control_html = simple_control_html.replace("\n", "\n\t\t")
|
||||||
all_controls_html = all_controls_html + simple_control_html
|
all_controls_html = all_controls_html + simple_control_html
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"An chameleon render on partial file control {inner_html['Name']} error occurred: {e}")
|
print(f"An chameleon render on partial file control {html_control} error occurred: {e}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"An chameleon template partial file control {html_control} error occurred: {e}")
|
print(f"An chameleon template partial file control {html_control} error occurred: {e}")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user