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