summaryrefslogtreecommitdiff
path: root/LedgerSMB/Template/HTML.pm
blob: 62834f70aee343cd1155723400011692ba7f110c (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. }
  32. elsif ( $type eq 'HASH' ) {
  33. for ( keys %{$rawvars} ) {
  34. $vars->{$_} = preprocess( $rawvars[$_] );
  35. }
  36. }
  37. else {
  38. return CGI::escapeHTML($rawvars);
  39. }
  40. }
  41. sub postprocess {
  42. my $parent = shift;
  43. return;
  44. }
  45. 1;