From 59b539628096d57bc8803682bb9990939d5e9178 Mon Sep 17 00:00:00 2001 From: tetragon Date: Mon, 10 Sep 2007 21:13:14 +0000 Subject: Initial templating of the GL report. Adding CSV output git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1555 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/Template.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'LedgerSMB/Template.pm') diff --git a/LedgerSMB/Template.pm b/LedgerSMB/Template.pm index 2432b5f1..de0fa797 100755 --- a/LedgerSMB/Template.pm +++ b/LedgerSMB/Template.pm @@ -11,7 +11,7 @@ This module renders templates. =over -=item new(user => \%myconfig, template => $string, format => 'HTML', [language => $string,] [include_path => $path], [no_auto_output => $bool], [method => $string] ); +=item new(user => \%myconfig, template => $string, format => 'HTML', [language => $string,] [include_path => $path], [no_auto_output => $bool], [method => $string], [no_escape => $bool]] ); This command instantiates a new template: template is the file name of the template to be processed. @@ -19,6 +19,7 @@ format is the type of format to be used. Currently only HTML is supported language (optional) specifies the language for template selection. include_path allows one to override the template directory and use this with user interface templates. no_auto_output disables the automatic output of rendered templates. +no_escape disables escaping on the template variables. method is the output method to use, defaults to HTTP media is a synonym for method @@ -62,6 +63,7 @@ sub new { $self->{format} = $args{format}; $self->{format} = 'PS' if lc $self->{format} eq 'postscript'; $self->{language} = $args{language}; + $self->{no_escape} = $args{no_escape}; if ($args{outputfile}) { $self->{outputfile} = "${LedgerSMB::Sysconfig::tempdir}/$args{outputfile}"; @@ -112,7 +114,12 @@ sub render { throw Error::Simple $@; } - my $cleanvars = $format->can('preprocess')->($vars); + my $cleanvars; + if ($self->{no_escape}) { + $cleanvars = $vars; + } else { + $cleanvars = $format->can('preprocess')->($vars); + } if (UNIVERSAL::isa($self->{locale}, 'LedgerSMB::Locale')){ $cleanvars->{text} = sub { return $self->{locale}->text(@_)}; -- cgit v1.2.3