summaryrefslogtreecommitdiff
path: root/LedgerSMB/Template/HTML.pm
blob: 8e610e266720807c94ba5bb5bcc58517581681ea (plain)
  1. =head1 NAME
  2. LedgerSMB::Template::HTML Template support module for LedgerSMB
  3. =head1 METHODS
  4. =item get_template ()
  5. =item preprocess ($vars)
  6. This method returns a reference to a hash that contains a copy of the passed
  7. hashref's data with HTML entities converted to escapes.
  8. =item postprocess ()
  9. =head1 Copyright (C) 2007, The LedgerSMB core team.
  10. # This work contains copyrighted information from a number of sources all used
  11. # with permission.
  12. #
  13. # It is released under the GNU General Public License Version 2 or, at your
  14. # option, any later version. See COPYRIGHT file for details. For a full list
  15. # including contact information of contributors, maintainers, and copyright
  16. # holders, see the CONTRIBUTORS file.
  17. =cut
  18. use Error qw(:try);
  19. use CGI;
  20. package LedgerSMB::Template::HTML;
  21. sub get_template {
  22. my $name = shift;
  23. return "${name}.html";
  24. }
  25. sub preprocess {
  26. my $rawvars = shift;
  27. my $vars;
  28. my $type = ref $rawvars;
  29. #XXX fix escaping function
  30. if ($type eq 'ARRAY') {
  31. } elsif ($type eq 'HASH') {
  32. for (keys %{$rawvars}) {
  33. $vars->{$_} = preprocess($rawvars[$_]);
  34. }
  35. } else {
  36. return CGI::escapeHTML($rawvars);
  37. }
  38. }
  39. sub postprocess {
  40. my $parent = shift;
  41. return;
  42. }
  43. 1;