summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--UI/form-confirmation.html16
-rw-r--r--bin/bp.pl49
-rw-r--r--bin/gl.pl48
3 files changed, 63 insertions, 50 deletions
diff --git a/UI/form-confirmation.html b/UI/form-confirmation.html
new file mode 100644
index 00000000..27256840
--- /dev/null
+++ b/UI/form-confirmation.html
@@ -0,0 +1,16 @@
+<?lsmb INCLUDE 'ui-header.html' ?>
+<?lsmb PROCESS elements.html ?>
+<body>
+<form method="post" action="<?lsmb form.script ?>">
+<h2 class="confirm"><?lsmb form.title ?></h2>
+<h4><?lsmb query ?></h4>
+<?lsmb FOREACH hidden IN hiddens.keys;
+ PROCESS input element_data={
+ type => 'hidden',
+ name => hidden,
+ value => hiddens.item(hidden)
+ }; END ?>
+<?lsmb FOREACH button IN buttons; PROCESS button element_data=button; END ?>
+</form>
+</body>
+</html>
diff --git a/bin/bp.pl b/bin/bp.pl
index cef343fb..a366697f 100644
--- a/bin/bp.pl
+++ b/bin/bp.pl
@@ -178,7 +178,8 @@ sub search {
sub remove {
- $selected = 0;
+ my $selected = 0;
+ my %hiddens;
for $i ( 1 .. $form->{rowcount} ) {
if ( $form->{"checked_$i"} ) {
@@ -191,36 +192,30 @@ sub remove {
$form->{title} = $locale->text('Confirm!');
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-|;
-
for (qw(action header)) { delete $form->{$_} }
-
- foreach $key ( keys %$form ) {
- print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
+ foreach my $key ( keys %$form ) {
+ $hiddens{$key} = $form->{$key};
}
- print qq|
-<h2 class=confirm>$form->{title}</h2>
-
-<h4>|
- . $locale->text(
- 'Are you sure you want to remove the marked entries from the queue?')
- . qq|</h4>
+ my $query = $locale->text(
+ 'Are you sure you want to remove the marked entries from the queue?');
-<button name="action" class="submit" type="submit" value="remove_from_queue">|
- . $locale->text('Yes')
- . qq|</button>
-</form>
-
-</body>
-</html>
-|;
+ my @buttons = ({
+ name => 'action',
+ value => 'remove_from_queue',
+ text => $locale->text('Yes'),
+ });
+ my $template = LedgerSMB::Template->new_UI(
+ user => \%myconfig,
+ locale => $locale,
+ template => 'form-confirmation',
+ );
+ $template->render({
+ form => $form,
+ query => $query,
+ hiddens => \%hiddens,
+ buttons => \@buttons,
+ });
}
diff --git a/bin/gl.pl b/bin/gl.pl
index dffa4c0a..ac46409c 100644
--- a/bin/gl.pl
+++ b/bin/gl.pl
@@ -51,6 +51,7 @@ use LedgerSMB::Template;
require "bin/arap.pl";
+$form->{login} = 'test';
1;
# end of main
@@ -1267,35 +1268,36 @@ sub form_footer {
sub delete {
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-|;
-
+ my %hiddens;
delete $form->{action};
+ foreach (keys %$form) {
+ $hiddens{$_} = $form->{$_} unless ref $form->{$_};
+ }
- $form->hide_form;
-
- print qq|
-<h2 class=confirm>| . $locale->text('Confirm!') . qq|</h2>
-
-<h4>|
- . $locale->text( 'Are you sure you want to delete Transaction [_1]',
+ $form->{title} = $locale->text('Confirm!');
+ my $query = $locale->text(
+ 'Are you sure you want to delete Transaction [_1]',
$form->{reference} )
- . qq|</h4>
-
-<button name="action" class="submit" type="submit" value="yes">|
- . $locale->text('Yes')
- . qq|</button>
-</form>
-|;
+ my @buttons = ({
+ name => 'action',
+ value => 'delete_transaction',
+ text => $locale->text('Yes'),
+ });
+ my $template = LedgerSMB::Template->new_UI(
+ user => \%myconfig,
+ locale => $locale,
+ template => 'form-confirmation',
+ );
+ $template->render({
+ form => $form,
+ query => $query,
+ hiddens => \%hiddens,
+ buttons => \@buttons,
+ });
}
-sub yes {
+sub delete_transaction {
if ( GL->delete_transaction( \%myconfig, \%$form ) ) {
$form->redirect( $locale->text('Transaction deleted!') );