From 21367a6c50d7a0f56c4e4a71a69f3e68b02edbb6 Mon Sep 17 00:00:00 2001 From: tetragon Date: Mon, 15 Oct 2007 22:14:50 +0000 Subject: Add confirmation template Rename yes in gl.pl git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1763 4979c152-3d1c-0410-bac9-87ea11338e46 --- UI/form-confirmation.html | 16 ++++++++++++++++ bin/bp.pl | 49 +++++++++++++++++++++-------------------------- bin/gl.pl | 48 ++++++++++++++++++++++++---------------------- 3 files changed, 63 insertions(+), 50 deletions(-) create mode 100644 UI/form-confirmation.html 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 @@ + + + +
+

+

+ 'hidden', + name => hidden, + value => hiddens.item(hidden) + }; END ?> + +
+ + 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| - - -
{script}> -|; - for (qw(action header)) { delete $form->{$_} } - - foreach $key ( keys %$form ) { - print qq|\n|; + foreach my $key ( keys %$form ) { + $hiddens{$key} = $form->{$key}; } - print qq| -

$form->{title}

- -

| - . $locale->text( - 'Are you sure you want to remove the marked entries from the queue?') - . qq|

+ my $query = $locale->text( + 'Are you sure you want to remove the marked entries from the queue?'); - -
- - - -|; + 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| - - -
{script}> -|; - + my %hiddens; delete $form->{action}; + foreach (keys %$form) { + $hiddens{$_} = $form->{$_} unless ref $form->{$_}; + } - $form->hide_form; - - print qq| -

| . $locale->text('Confirm!') . qq|

- -

| - . $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|

- - -
-|; + 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!') ); -- cgit v1.2.3