summaryrefslogtreecommitdiff
path: root/LedgerSMB/Template
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-04 02:35:26 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-04 02:35:26 +0000
commit5c3a962f492011bebe096a5a4b007062152df2d7 (patch)
tree4767953d3090870de43ccb992ed096545be9e4da /LedgerSMB/Template
parenta3a6064b492c70ecacaa5b413547deb695212487 (diff)
First round of template changes for new TT system
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1023 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/Template')
-rwxr-xr-xLedgerSMB/Template/HTML.pm57
1 files changed, 57 insertions, 0 deletions
diff --git a/LedgerSMB/Template/HTML.pm b/LedgerSMB/Template/HTML.pm
new file mode 100755
index 00000000..8e610e26
--- /dev/null
+++ b/LedgerSMB/Template/HTML.pm
@@ -0,0 +1,57 @@
+=head1 NAME
+
+LedgerSMB::Template::HTML Template support module for LedgerSMB
+
+=head1 METHODS
+
+=item get_template ()
+
+=item preprocess ($vars)
+This method returns a reference to a hash that contains a copy of the passed
+hashref's data with HTML entities converted to escapes.
+
+=item postprocess ()
+
+=head1 Copyright (C) 2007, The LedgerSMB core team.
+
+# This work contains copyrighted information from a number of sources all used
+# with permission.
+#
+# It is released under the GNU General Public License Version 2 or, at your
+# option, any later version. See COPYRIGHT file for details. For a full list
+# including contact information of contributors, maintainers, and copyright
+# holders, see the CONTRIBUTORS file.
+=cut
+
+use Error qw(:try);
+use CGI;
+
+package LedgerSMB::Template::HTML;
+
+sub get_template {
+ my $name = shift;
+ return "${name}.html";
+}
+
+sub preprocess {
+ my $rawvars = shift;
+ my $vars;
+ my $type = ref $rawvars;
+
+#XXX fix escaping function
+ if ($type eq 'ARRAY') {
+ } elsif ($type eq 'HASH') {
+ for (keys %{$rawvars}) {
+ $vars->{$_} = preprocess($rawvars[$_]);
+ }
+ } else {
+ return CGI::escapeHTML($rawvars);
+ }
+}
+
+sub postprocess {
+ my $parent = shift;
+ return;
+}
+
+1;