Get success message working after save

This commit is contained in:
Brian Read 2024-11-22 15:09:21 +00:00
parent b9b939223b
commit edb245df07
2 changed files with 25 additions and 20 deletions

View File

@ -77,7 +77,7 @@ sub main {
# which DB - this only really works if the initial panel is a PARAMS type panel and not a TABLE
my $db = $$${controldb | db | 'cdb'}; #pickup local or global db or Default to config
<tal:block tal:repeat="dbfield dbfields">
$$${prefix}_data{${dbfield}} = $db->prop('${dbfield}') || ${dbdefault | ""} || "";
$$${prefix}_data{'${dbfield}'} = $db->prop('${dbfield}') || ${dbdefault | ""} || "";
</tal:block>
#pickup any other contents needed and load them into hash shared with panel
@ -160,7 +160,7 @@ sub do_update {
</tal:block>
if ($ret ne "ok") {
${prefix}_data{trt} = $thispanel;
${prefix}_data{'trt'} = $thispanel;
$c->stash(error => $c->l($ret));
$c->stash(
title => $title,
@ -177,26 +177,31 @@ sub do_update {
if ($ret ne "ok") {
# return to the panel with error message
$c->stash(error => $c->l($ret));
$c->render("${lcPackageName}");
$c->stash(
title => $title,
modul => $modul,
${prefix}_data => \%${prefix}_data
);
$c->render(template => "${lcPackageName}");
} else {
$c->stash( success => $c->l('${panel} panel action was successful')); #A bit bland - edit it in the lex file
}
}
</tal:block>
# and call any signal-events needed
#TBD
# Setup shared data and call panel
$c->stash(
title => $title,
${prefix}_data => \%${prefix}_data
);
if ('${nextpanel | "none"}' eq 'none') {
$$${prefix}_data{'trt'} = '${firstPanel}';
} else {
$$${prefix}_data{'trt'} = '${NextPanel | "none"}';
}
$c->do_display()
$c->stash(
title => $title,
modul => $modul,
${prefix}_data => \%${prefix}_data
);
$c->render( template => "${lcPackageName}" );
}
}
@ -275,6 +280,6 @@ sub do_display {
title => $title,
${prefix}_data => \%${prefix}_data
);
$c->render("${lcPackageName}");
$c->render(template => "${lcPackageName}");
}
1;

View File

@ -20,22 +20,22 @@
%= $c->render_to_string(inline => stash('modul') );
% }
%if ($$${prefix}_data->{first}) {
%if ($c->stash('first')) {
<br><p>
%=$c->render_to_string(inline =>$c->l($$${prefix}_data->{first}))
%=$c->render_to_string(inline =>$c->l($c->stash('first')))
</p>
%} elsif ($$${prefix}_data->{success}) {
%} elsif ($c->stash('success')) {
<div class='sme-border'>
<h2> Operation Status Report</h2><p>
%= $c->l($$${prefix}_data->{success});
<h2><%=$c->l('Status Report') %></h2><p>
%= $c->l($c->stash('success'));
</p>
</div>
%} elsif ($$${prefix}_data->{error}) {
%} elsif ($c->stash('error')) {
<div class='sme-error'>
<h2> Operation Status Report - error</h2><p>
%= $c->l($$${prefix}_data->{error});
<h2><%=$c->l('Error Status Report') %></h2><p>
%= $c->l($c->stash('error'));
</p>
</div>
%}