diff options
author | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-10-24 18:18:50 +0000 |
---|---|---|
committer | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-10-24 18:18:50 +0000 |
commit | ebddc26487a0649cc0f8abd039188f887ace3e90 (patch) | |
tree | 3ed217ea001dd1129861d9f4ba04f31d8cc7b49e | |
parent | 1cb905e6427843114511232b8a4d75bd88135edd (diff) |
Convert functions that use business_header to templates
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1811 4979c152-3d1c-0410-bac9-87ea11338e46
-rw-r--r-- | UI/am-business-form.html | 33 | ||||
-rw-r--r-- | bin/am.pl | 70 |
2 files changed, 64 insertions, 39 deletions
diff --git a/UI/am-business-form.html b/UI/am-business-form.html new file mode 100644 index 00000000..115c90e3 --- /dev/null +++ b/UI/am-business-form.html @@ -0,0 +1,33 @@ +<?lsmb INCLUDE 'ui-header.html' ?> +<?lsmb PROCESS elements.html ?> +<body> +<form method="post" action="<?lsmb form.script ?>"> +<table width="100%"> + <tr><th class="listtop"><?lsmb form.title ?></th></tr> + <tr><td> </td></tr> + <tr> + <td> + <table> + <tr> + <th align="right"><?lsmb text('Type of Business') ?></th> + <td><?lsmb PROCESS input element_data={name => 'description', size => 30, value => form.description} ?></td> + </tr> + <tr> + <th align="right"><?lsmb text('Discount') ?></th> + <td><?lsmb PROCESS input element_data={name => 'discount', size => 5, value => form.discount} ?></td> + </tr> + </table> + </td> + </tr> + <tr><td colspan="2"><hr size="3" noshade="noshade" /></td></tr> +</table> +<?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> @@ -812,8 +812,20 @@ sub add_business { "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback}; - &business_header; - &form_footer; + my %hiddens; + my @buttons; + my $checked = &business_header(\%hiddens); + &form_footer_buttons(\%hiddens, \@buttons); + + my $template = LedgerSMB::Template->new_UI( + user => \%myconfig, + locale => $locale, + template => 'am-business-form'); + $template->render({ + form => $form, + buttons => \@buttons, + hiddens => \%hiddens, + }); } @@ -823,11 +835,22 @@ sub edit_business { AM->get_business( \%myconfig, \%$form ); - &business_header; - $form->{orphaned} = 1; - &form_footer; + my %hiddens; + my @buttons; + my $checked = &business_header(\%hiddens); + &form_footer_buttons(\%hiddens, \@buttons); + + my $template = LedgerSMB::Template->new_UI( + user => \%myconfig, + locale => $locale, + template => 'am-business-form'); + $template->render({ + form => $form, + buttons => \@buttons, + hiddens => \%hiddens, + }); } sub list_business { @@ -904,6 +927,7 @@ sub list_business { } sub business_header { + my $hiddens = shift; $form->{title} = $locale->text("$form->{title} Business"); @@ -914,40 +938,8 @@ sub business_header { $form->{discount} = $form->format_amount( \%myconfig, $form->{discount} * 100 ); - $form->header; - - print qq| -<body> - -<form method=post action=$form->{script}> - -<input type=hidden name=id value=$form->{id}> -<input type=hidden name=type value=business> - -<table width=100%> - <tr> - <th class=listtop>$form->{title}</th> - </tr> - <tr height="5"></tr> - <tr> - <td> - <table> - <tr> - <th align="right">| . $locale->text('Type of Business') . qq|</th> - <td><input name=description size=30 value="$form->{description}"></td> - <tr> - <tr> - <th align="right">| . $locale->text('Discount') . qq| %</th> - <td><input name=discount size=5 value=$form->{discount}></td> - </tr> - </table> - </td> - </tr> - <tr> - <td><hr size=3 noshade></td> - </tr> -</table> -|; + $hiddens->{id} = $form->{id}; + $hiddens->{type} = 'business'; } |