[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1708] trunk
- Subject: SF.net SVN: ledger-smb: [1708] trunk
- From: ..hidden..
- Date: Fri, 05 Oct 2007 17:33:19 -0700
Revision: 1708
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1708&view=rev
Author: tetragon
Date: 2007-10-05 17:33:18 -0700 (Fri, 05 Oct 2007)
Log Message:
-----------
Template the tax config screen
Add UI header file
Modified Paths:
--------------
trunk/bin/am.pl
Added Paths:
-----------
trunk/UI/am-taxes.html
trunk/UI/ui-header.html
Added: trunk/UI/am-taxes.html
===================================================================
--- trunk/UI/am-taxes.html (rev 0)
+++ trunk/UI/am-taxes.html 2007-10-06 00:33:18 UTC (rev 1708)
@@ -0,0 +1,47 @@
+<?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>
+ <table>
+ <tr>
+ <th></th>
+ <th><?lsmb text('Rate (%)') ?></th>
+ <th><?lsmb text('Number') ?></th>
+ <th><?lsmb text('Valid To') ?></th>
+ <th><?lsmb text('Ordering') ?></th>
+ <th><?lsmb text('Tax Rules') ?></th>
+ </tr>
+<?lsmb FOREACH row IN rows; i = loop.count ?>
+ <tr>
+ <th align="right"><?lsmb row.0 ?></th>
+ <td><input name="taxrate_<?lsmb i ?>" size="6" value="<?lsmb form.item("taxrate_$i") ?>" /></td>
+ <td><input name="taxnumber_<?lsmb i ?>" value="<?lsmb form.item("taxnumber_$i") ?>" /></td>
+ <td><input class="date" name="validto_<?lsmb i ?>" size="11" value="<?lsmb form.item("validto_$i") ?>" title="<?lsmb user.dateformat ?>" /></td>
+ <td><input name="pass_<?lsmb i ?>" size="6" value="<?lsmb form.item("pass_$i") ?>" /></td>
+ <td><?lsmb PROCESS select element_data=row.1 ?></td>
+ </tr>
+<?lsmb END ?>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td><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;
+PROCESS button element_data={name => 'action', value => 'update', text => text('Update')};
+PROCESS button element_data={name => 'action', value => 'save_taxes', text => text('Save')} ?>
+ </form>
+
+</body>
+</html>
Added: trunk/UI/ui-header.html
===================================================================
--- trunk/UI/ui-header.html (rev 0)
+++ trunk/UI/ui-header.html 2007-10-06 00:33:18 UTC (rev 1708)
@@ -0,0 +1,14 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title><?lsmb form.titlebar ?></title>
+ <meta http-equiv="Pragma" content="no-cache" />
+ <meta http-equiv="Expires" content="-1" />
+ <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
+ <link rel="stylesheet" href="css/<?lsmb form.stylesheet ?>" type="text/css" title="LedgerSMB stylesheet" />
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+ <meta name="robots" content="noindex,nofollow" />
+
+</head>
Modified: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl 2007-10-05 22:09:23 UTC (rev 1707)
+++ trunk/bin/am.pl 2007-10-06 00:33:18 UTC (rev 1708)
@@ -1763,31 +1763,14 @@
sub display_taxes {
$form->{title} = $locale->text('Taxes');
+ my %hiddens = (
+ path => $form->{path},
+ login => $form->{login},
+ sessionid => $form->{sessionid},
+ type => 'taxes',
+ );
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=type value=taxes>
-
-<table width=100%>
- <tr><th class=listtop>$form->{title}</th></tr>
- <tr>
- <td>
- <table>
- <tr>
- <th></th>
- <th>| . $locale->text('Rate') . qq| (%)</th>
- <th>| . $locale->text('Number') . qq|</th>
- <th>| . $locale->text('Valid To') . qq|</th>
- <th>| . $locale->text('Ordering') . qq|</th>
- <th>| . $locale->text('Tax Rules') . qq|</th>
- </tr>
-|;
-
+ my @rows;
for ( split( / /, $form->{taxaccounts} ) ) {
( $null, $i ) = split /_/, $_;
@@ -1795,81 +1778,52 @@
$form->{"taxrate_$i"} =
$form->format_amount( \%myconfig, $form->{"taxrate_$i"} );
- $form->hide_form("taxdescription_$i");
+ $hiddens{"taxdescription_$i"} = $form->{"taxdescription_$i"};
- print qq|
- <tr>
- <th align="right">|;
-
- if ( $form->{"taxdescription_$i"} eq $sametax ) {
- print "";
- }
- else {
- print qq|$form->{"taxdescription_$i"}|;
- }
-
- print qq|</th>
- <td><input name="taxrate_$i" size=6 value=$form->{"taxrate_$i"}></td>
- <td><input name="taxnumber_$i" value="$form->{"taxnumber_$i"}"></td>
- <td><input class="date" name="validto_$i" size=11 value="$form->{"validto_$i"}" title="$myconfig{dateformat}"></td>
- <td><input name="pass_$i" size=6 value="$form->{"pass_$i"}"></td>
- <td><select name="taxmodule_id_$i" size=1>|;
+ my %select = (name => "taxmodule_id_$i", options => []);
foreach my $taxmodule ( sort keys %$form ) {
next if ( $taxmodule !~ /^taxmodule_/ );
next if ( $taxmodule =~ /^taxmodule_id_/ );
my $modulenum = $taxmodule;
$modulenum =~ s/^taxmodule_//;
- print '<option label="'
- . $form->{$taxmodule}
- . '" value="'
- . $modulenum . '"';
- print " SELECTED "
+ push @{$select{options}},
+ {text => $form->{$taxmodule}, value => $modulenum};
+ $select{default_values} = $modulenum
if $form->{$taxmodule} eq $form->{"taxmodulename_$i"};
- print ">" . $form->{$taxmodule} . "</option>\n";
}
- print qq|</select></td>
- </tr> |;
- $sametax = $form->{"taxdescription_$i"};
+ if ( $form->{"taxdescription_$i"} eq $sametax ) {
+ push @rows, ["", \%select];
+ } else {
+ push @rows, [$form->{"taxdescription_$i"}, \%select];
+ }
+ $sametax = $form->{"taxdescription_$i"};
+
}
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
- $form->hide_form(qw(taxaccounts path login sessionid));
+ $hiddens{taxaccounts} = $form->{taxaccounts};
foreach my $taxmodule ( sort keys %$form ) {
next if ( $taxmodule !~ /^taxmodule_/ );
next if ( $taxmodule =~ /^taxmodule_id_/ );
- $form->hide_form("$taxmodule");
+ $hiddens{$taxmodule};
}
- print qq|
-<button type="submit" class="submit" name="action" value="update">|
- . $locale->text('Update')
- . qq|</button>
-<button type="submit" class="submit" name="action" value="save_taxes">|
- . $locale->text('Save')
- . qq|</button>|;
+##SC: Temporary removal
+## if ( $form->{lynx} ) {
+## require "bin/menu.pl";
+## &menubar;
+## }
- if ( $form->{lynx} ) {
- require "bin/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
-</body>
-</html>
-|;
-
+ my $template = LedgerSMB::Template->new_UI(
+ user => \%myconfig,
+ locale => $locale,
+ template => 'am-taxes');
+ $template->render({
+ form => $form,
+ hiddens => \%hiddens,
+ selects => \%selects,
+ rows => ..hidden..,
+ });
}
sub update {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.