[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1817] trunk
- Subject: SF.net SVN: ledger-smb: [1817] trunk
- From: ..hidden..
- Date: Wed, 24 Oct 2007 17:03:29 -0700
Revision: 1817
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1817&view=rev
Author: tetragon
Date: 2007-10-24 17:03:28 -0700 (Wed, 24 Oct 2007)
Log Message:
-----------
Convert department_header using screens to templates
Modified Paths:
--------------
trunk/bin/am.pl
Added Paths:
-----------
trunk/UI/am-department-form.html
Added: trunk/UI/am-department-form.html
===================================================================
--- trunk/UI/am-department-form.html (rev 0)
+++ trunk/UI/am-department-form.html 2007-10-25 00:03:28 UTC (rev 1817)
@@ -0,0 +1,54 @@
+<?lsmb INCLUDE 'ui-header.html' ?>
+<?lsmb PROCESS elements.html ?>
+<body>
+<form method="post" action="<?lsmb form.script ?>">
+<table width="100%">
+ <tr><th class="listtop" colspan="2"><?lsmb form.title ?></th></tr>
+ <tr><td colspan="2"> </td></tr>
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <th align="right"><?lsmb text('Description') ?></th>
+<?lsmb IF row_count > 1 ?>
+ <td><?lsmb PROCESS textarea element_data={name => 'description', cols => 60, rows => row_count, text => form.description} ?></td>
+<?lsmb ELSE ?>
+ <td><?lsmb PROCESS input element_data={name => 'description', size => 60, value => form.description} ?></td>
+<?lsmb END ?>
+ </tr>
+ <tr><td> </td>
+ <td><?lsmb IF form.role == 'C';
+ cost = 'checked';
+ ELSIF form.role == 'P';
+ profit = 'checked';
+ END;
+ PROCESS input element_data={
+ name => 'role',
+ type => 'radio',
+ value => 'C',
+ label => text('Cost Center'),
+ ${cost} => cost,
+ };
+ PROCESS input element_data={
+ name => 'role',
+ type => 'radio',
+ value => 'P',
+ label => text('Profit Center'),
+ ${profit} => profit,
+ }; -?></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>
Modified: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl 2007-10-24 22:59:15 UTC (rev 1816)
+++ trunk/bin/am.pl 2007-10-25 00:03:28 UTC (rev 1817)
@@ -642,9 +642,21 @@
"$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}"
unless $form->{callback};
- &department_header;
- &form_footer;
+ my %hiddens;
+ my @buttons;
+ my $rows = &department_header(\%hiddens);
+ &form_footer_buttons(\%hiddens, ..hidden..);
+ my $template = LedgerSMB::Template->new_UI(
+ user => \%myconfig,
+ locale => $locale,
+ template => 'am-department-form');
+ $template->render({
+ form => $form,
+ row_count => $rows,
+ buttons => ..hidden..,
+ hiddens => \%hiddens,
+ });
}
sub edit_department {
@@ -653,9 +665,21 @@
AM->get_department( \%myconfig, \%$form );
- &department_header;
- &form_footer;
+ my %hiddens;
+ my @buttons;
+ my $rows = &department_header(\%hiddens);
+ &form_footer_buttons(\%hiddens, ..hidden..);
+ my $template = LedgerSMB::Template->new_UI(
+ user => \%myconfig,
+ locale => $locale,
+ template => 'am-department-form');
+ $template->render({
+ form => $form,
+ row_count => $rows,
+ buttons => ..hidden..,
+ hiddens => \%hiddens,
+ });
}
sub list_department {
@@ -735,6 +759,7 @@
}
sub department_header {
+ my $hiddens = shift;
$form->{title} = $locale->text("$form->{title} Department");
@@ -743,50 +768,12 @@
$form->{description} = $form->quote( $form->{description} );
- if ( ( $rows = $form->numtextrows( $form->{description}, 60 ) ) > 1 ) {
- $description =
-qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
- }
- else {
- $description =
- qq|<input name=description size=60 value="$form->{description}">|;
- }
+ my $rows = $form->numtextrows( $form->{description}, 60 );
- $costcenter = "checked" if $form->{role} eq "C";
- $profitcenter = "checked" if $form->{role} eq "P";
+ $hiddens->{id} = $form->{id};
+ $hiddens->{type} = 'department';
- $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=department>
-
-<table width=100%>
- <tr>
- <th class=listtop colspan=2>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <th align="right">| . $locale->text('Description') . qq|</th>
- <td>$description</td>
- </tr>
- <tr>
- <td></td>
- <td><input type=radio style=radio name=role value="C" $costcenter> |
- . $locale->text('Cost Center') . qq|
- <input type=radio style=radio name=role value="P" $profitcenter> |
- . $locale->text('Profit Center') . qq|
- </td>
- <tr>
- <td colspan=2><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
+ $rows;
}
sub save_department {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.