SL/Template.pm in eine Datei pro Package aufgeteilt.
[kivitendo-erp.git] / SL / Template / XML.pm
1 package SL::Template::XML;
2
3 use SL::Template::HTML;
4
5 use vars qw(@ISA);
6
7 @ISA = qw(SL::Template::HTML);
8
9 use strict;
10
11 sub new {
12   #evtl auskommentieren
13   my $type = shift;
14
15   return $type->SUPER::new(@_);
16 }
17
18 sub format_string {
19   my ($self, $variable) = @_;
20   my $form = $self->{"form"};
21
22   $variable = $main::locale->quote_special_chars('Template/XML', $variable);
23
24   # Allow no markup to be converted into the output format
25   my @markup_replace = ('b', 'i', 's', 'u', 'sub', 'sup');
26
27   foreach my $key (@markup_replace) {
28     $variable =~ s/\<(\/?)${key}\>//g;
29   }
30
31   return $variable;
32 }
33
34 sub get_mime_type() {
35   my ($self) = @_;
36
37   if ($self->{"form"}->{"format"} =~ /elsterwinston/i) {
38     return "application/xml ";
39   } elsif ($self->{"form"}->{"format"} =~ /elstertaxbird/i) {
40     return "application/x-taxbird";
41   } else {
42     return "text";
43   }
44 }
45
46 sub uses_temp_file {
47   # tempfile needet for XML Output
48   return 1;
49 }
50
51 1;