From d7a8533233dcddb29c3f3cfb57e041d52308aa17 Mon Sep 17 00:00:00 2001 From: tetragon Date: Sat, 22 Sep 2007 23:44:03 +0000 Subject: Templating template language selection form git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1652 4979c152-3d1c-0410-bac9-87ea11338e46 --- bin/am.pl | 123 +++++++++++++++++++++++--------------------------------------- 1 file changed, 46 insertions(+), 77 deletions(-) (limited to 'bin') 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|| - . $locale->text('Code') - . qq||; - $column_header{description} = - qq|| - . $locale->text('Description') - . qq||; - - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - for (@column_index) { print "$column_header{$_}\n" } + my @column_index = $form->sort_columns(qw(code description)); - print qq| - -|; + $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| - -|; - - $column_data{code} = -qq||; - $column_data{description} = qq||; - - 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| - -|; + push @rows, \%column_data; + } - print qq| -
{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}$ref->{description}
-

+ $form->{type} = 'language'; + my @hiddens = qw(sessionid login path calllback type); -
-
{script}> - - - - - -{path}> -{login}> -{sessionid}> -|; - - if ( $form->{lynx} ) { - require "bin/menu.pl"; - &menubar; - } +## SC: Temporary removal +## if ( $form->{lynx} ) { +## require "bin/menu.pl"; +## &menubar; +## } - print qq| -
- - - -|; + 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 { -- cgit v1.2.3