Finally got Table column names in comment for table control custom procedure

This commit is contained in:
2024-11-15 17:23:49 +00:00
parent a52983cc13
commit c00230a998
7 changed files with 308 additions and 116 deletions

View File

@@ -12,6 +12,9 @@ use esmith::AccountsDB;
use esmith::NetworksDB;
use esmith::DomainsDB;
use constant FALSE => 0;
use constant TRUE => 1;
#The most common ones
our $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
@@ -25,7 +28,13 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
sub validate_${panel} {
my $c = shift;
my $prefix_data = shift; #Data hash as parameter
my $ret = 'ok';
# Validation for each field
my $ret = "";
<tal:block tal:repeat="field fields[panel]">
if (! TRUE) #validate $c->param('${field}')
{$ret .= 'Validation for ${field} failed';}
</tal:block>
if ($ret eq "") {$ret = 'ok';}
return $ret;
}
</tal:block>
@@ -48,21 +57,24 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
</tal:block>
# Get control data for table(s)
<tal:block tal:repeat="tablecontrol tablecontrols">
sub get_${tablecontrol} {
# Return an array of hashes of the contents for each row and column for ${tablecontrol}
# default is a single row of strings "col1header-1, col2header-1, col3Header-1 etc"
my $c = shift;
my $control_data = $c->stash('${tablecontrol}');
my @ret = {};
# foreach my $colHead (@$control_data) {
# my ret{$colHead} = "$colhead-1";
# };
return \@ret;
}
Get control data for table(s)
<tal:block repeat="tablecontrol tablecontrols">
sub get_${tablecontrol[0]} {
# Return an array of hashes of the contents for each row and column for ${tablecontrol[0]}
# default is a single row of strings "col1header-1, col2header-1, col3Header-1 etc"
# Cols needed are:
# <tal:block repeat="col tablecontrol[1]['columns']">${col}<tal:condition condition="not: repeat['col'].end">,
# </tal:condition></tal:block>
my $c = shift;
my $control_data = $c->stash('${tablecontrol[0]}');
my @ret = {};
return \@ret;
}
</tal:block>
# Return hash with values from row in which link clicked on table
<tal:block tal:repeat="panel panels">
sub get_selected_${panel} {
@@ -79,7 +91,12 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
sub perform_${panel} {
my $c = shift;
my $prefix_data = shift; #Data hash as parameter
my $ret = 'ok';
my $ret = "";
<tal:block tal:repeat="field fields[panel]">
if (! TRUE) #copy or perform with value: ${field} e.g. $c->setprop(dbentry,dbkey,$c->param('${field}')
{$ret .= 'Perform failed for ${field} failed';}
</tal:block>
if ($ret eq "") {$ret = 'ok';}
return $ret;
}
</tal:block>

View File

@@ -258,6 +258,16 @@
</span>
]]>
</Back>
<Group><![CDATA[
<div ${Value}>
]]>
</Group>
<Endgroup><![CDATA[
<div></div>
]]>
</Endgroup>