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