summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-22 23:44:03 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-22 23:44:03 +0000
commitd7a8533233dcddb29c3f3cfb57e041d52308aa17 (patch)
tree98c5ca83b8fbb86e4899bc9e33946367bd9021fc /bin
parent8ca6eaf928adfa785c16644b0d1d39d1311df800 (diff)
Templating template language selection form
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1652 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'bin')
-rw-r--r--bin/am.pl123
1 files changed, 46 insertions, 77 deletions
diff --git a/bin/am.pl b/bin/am.pl
index 2dbca015..9b57e979 100644
--- a/bin/am.pl
+++ b/bin/am.pl
@@ -1501,7 +1501,7 @@ sub list_templates {
unshift @{ $form->{ALL} },
{ code => '.', description => $locale->text('Default Template') };
- $href =
+ my $href =
"$form->{script}?action=list_templates&direction=$form->{direction}&oldsort=$form->{oldsort}&file=$form->{file}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
$form->sort_order();
@@ -1509,99 +1509,68 @@ sub list_templates {
$form->{callback} =
"$form->{script}?action=list_templates&direction=$form->{direction}&oldsort=$form->{oldsort}&file=$form->{file}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
- $callback = $form->escape( $form->{callback} );
+ my $callback = $form->escape( $form->{callback} );
chomp $myconfig{templates};
$form->{file} =~ s/$myconfig{templates}//;
$form->{file} =~ s/\///;
- $form->{title} = $form->{file};
-
- @column_index = $form->sort_columns(qw(code description));
+ $form->{title} = $form->{template};
- $column_header{code} =
- qq|<th><a class="listheading" href=$href&sort=code>|
- . $locale->text('Code')
- . qq|</a></th>|;
- $column_header{description} =
- qq|<th><a class="listheading" href=$href&sort=description>|
- . $locale->text('Description')
- . qq|</a></th>|;
-
- $form->header;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class="listheading">
-|;
-
- for (@column_index) { print "$column_header{$_}\n" }
+ my @column_index = $form->sort_columns(qw(code description));
- print qq|
- </tr>
-|;
+ $column_header{code} = { text => $locale->text('Code'),
+ href => "$href&sort=code" };
+ $column_header{description} = { text => $locale->text('Description'),
+ href => "$href&sort=description" };
- foreach $ref ( @{ $form->{ALL} } ) {
+ my @rows;
+ my $i = 0;
+ foreach my $ref ( @{ $form->{ALL} } ) {
+ my %column_data;
$i++;
$i %= 2;
+ $column_data{i} = $i;
- print qq|
- <tr valign=top class=listrow$i>
-|;
-
- $column_data{code} =
-qq|<td><a href=$form->{script}?action=display_form&file=$myconfig{templates}/$ref->{code}/$form->{file}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&code=$ref->{code}&callback=$callback>$ref->{code}</td>|;
- $column_data{description} = qq|<td>$ref->{description}</td>|;
-
- for (@column_index) { print "$column_data{$_}\n" }
+ $column_data{code} = { text => $ref->{code}, href =>
+ qq|$form->{script}?action=display_form&file=$myconfig{templates}/$ref->{code}/$form->{file}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&code=$ref->{code}&callback=$callback|};
+ $column_data{description} = $ref->{description};
- print qq|
- </tr>
-|;
+ push @rows, \%column_data;
+
}
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
+ $form->{type} = 'language';
+ my @hiddens = qw(sessionid login path calllback type);
-<br>
-<form method=post action=$form->{script}>
-
-<input name=callback type=hidden value="$form->{callback}">
-
-<input type=hidden name=type value=language>
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=sessionid value=$form->{sessionid}>
-|;
-
- if ( $form->{lynx} ) {
- require "bin/menu.pl";
- &menubar;
- }
+## SC: Temporary removal
+## if ( $form->{lynx} ) {
+## require "bin/menu.pl";
+## &menubar;
+## }
- print qq|
- </form>
-
- </body>
- </html>
-|;
+ my @buttons;
+ push @buttons, {
+ name => 'action',
+ value => 'add_language',
+ text => $locale->text('Add Lanugage'),
+ type => 'submit',
+ class => 'submit',
+ };
+ # SC: I'm not concerned about the wider description as code is 6 chars max
+ my $template = LedgerSMB::Template->new_UI(
+ user => \%myconfig,
+ locale => $locale,
+ template => 'am-list-departments');
+ $template->render({
+ form => $form,
+ buttons => \@buttons,
+ columns => \@column_index,
+ heading => \%column_header,
+ rows => \@rows,
+ hiddens => \@hiddens,
+ });
}
sub display_form {