From 1cb905e6427843114511232b8a4d75bd88135edd Mon Sep 17 00:00:00 2001 From: tetragon Date: Wed, 24 Oct 2007 17:50:22 +0000 Subject: Switching forms that use gifi_header to templating git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1810 4979c152-3d1c-0410-bac9-87ea11338e46 --- UI/am-gifi-form.html | 33 ++++++++++++++++++ bin/am.pl | 98 ++++++++++++++++++++++++---------------------------- 2 files changed, 79 insertions(+), 52 deletions(-) create mode 100644 UI/am-gifi-form.html diff --git a/UI/am-gifi-form.html b/UI/am-gifi-form.html new file mode 100644 index 00000000..f93c1432 --- /dev/null +++ b/UI/am-gifi-form.html @@ -0,0 +1,33 @@ + + + +
+ + + + + + + +
+ + + + + + + + + +
'accno', size => 20, value => form.accno} ?>
'description', size => 60, value => form.description} ?>
+

+ 'hidden', + name => hidden, + value => hiddens.item(hidden) + }; END ?> + +
+ + diff --git a/bin/am.pl b/bin/am.pl index 98538299..c02e96bd 100644 --- a/bin/am.pl +++ b/bin/am.pl @@ -487,8 +487,20 @@ sub add_gifi { $form->{coa} = 1; - &gifi_header; - &gifi_footer; + my %hiddens; + my @buttons; + &gifi_header(\%hiddens); + &gifi_footer(\%hiddens, \@buttons); + + my $template = LedgerSMB::Template->new_UI( + user => \%myconfig, + locale => $locale, + template => 'am-gifi-form'); + $template->render({ + form => $form, + buttons => \@buttons, + hiddens => \%hiddens, + }); } @@ -501,12 +513,25 @@ sub edit_gifi { $form->error( $locale->text('Account does not exist!') ) unless $form->{accno}; - &gifi_header; - &gifi_footer; + my %hiddens; + my @buttons; + &gifi_header(\%hiddens); + &gifi_footer(\%hiddens, \@buttons); + + my $template = LedgerSMB::Template->new_UI( + user => \%myconfig, + locale => $locale, + template => 'am-gifi-form'); + $template->render({ + form => $form, + buttons => \@buttons, + hiddens => \%hiddens, + }); } sub gifi_header { + my $hiddens = shift; $form->{title} = $locale->text("$form->{title} GIFI"); @@ -515,52 +540,21 @@ sub gifi_header { for (qw(accno description)) { $form->{$_} = $form->quote( $form->{$_} ) } - $form->header; - - print qq| - - -
{script}> - - - - - - - - - - - - - - - -
$form->{title}
- - - - - - - - - -
| . $locale->text('GIFI') . qq|
| . $locale->text('Description') . qq|
-

-|; + $hiddens->{id} = $form->{accno}; + $hiddens->{type} = 'gifi'; } sub gifi_footer { + my ($hiddens, $buttons) = @_; - $form->hide_form(qw(callback path login sessionid)); + $hiddens->{$_} = $form->{$_} foreach qw(callback path login sessionid); # type=submit $locale->text('Save') # type=submit $locale->text('Copy to COA') # type=submit $locale->text('Delete') - %button = (); + my %button = (); $button{'save'} = { ndx => 3, key => 'S', value => $locale->text('Save') }; @@ -577,20 +571,20 @@ sub gifi_footer { } for ( sort { $button{$a}->{ndx} <=> $button{$b}->{ndx} } keys %button ) { - $form->print_button( \%button, $_ ); - } - - if ( $form->{lynx} ) { - require "bin/menu.pl"; - &menubar; + push @{$buttons}, { + name => 'action', + value => $_, + accesskey => $button{$_}{key}, + title => "$button{$_}{value} [Alt-$button{$_}{key}]", + text => $button{$_}{value}, + }; } - print qq| -
- - - -|; +##SC: Temporary commenting +## if ( $form->{lynx} ) { +## require "bin/menu.pl"; +## &menubar; +## } } -- cgit v1.2.3