From a43c94fd42214048fc61bcd4404f2800e92c49de Mon Sep 17 00:00:00 2001 From: Udo Spallek Date: Fri, 15 Dec 2006 02:48:36 +0000 Subject: [PATCH] =?utf8?q?Neues=20parsingtemplate=20f=C3=BCr=20XML=20oder?= =?utf8?q?=20andere=20einfache=20unformatierte=20Dateien=20angelegt?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Betrifft USTVA --- SL/Template.pm | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/SL/Template.pm b/SL/Template.pm index b4c6bf509..27ebb36a3 100644 --- a/SL/Template.pm +++ b/SL/Template.pm @@ -1259,4 +1259,63 @@ sub uses_temp_file { return 1; } + +########################################################## +#### +#### XMLTemplate +#### +########################################################## + +package XMLTemplate; + +use vars qw(@ISA); + +@ISA = qw(HTMLTemplate); + +sub new { + #evtl auskommentieren + my $type = shift; + + return $type->SUPER::new(@_); +} + +sub format_string { + my ($self, $variable) = @_; + my $form = $self->{"form"}; + + my %replace = + ('order' => ['<', '>', quotemeta("\n")], + '<' => '<', + '>' => '>', + quotemeta("\n") => '
', + ); + + map({ $variable =~ s/$_/$replace{$_}/g; } @{ $replace{"order"} }); + + # Allow no markup to be converted into the output format + my @markup_replace = ('b', 'i', 's', 'u', 'sub', 'sup'); + + foreach my $key (@markup_replace) { + $variable =~ s/\<(\/?)${key}\>//g; + } + + return $variable; +} + +sub get_mime_type() { + my ($self) = @_; + + if ($self->{"form"}->{"format"} =~ /xml/i) { + return "application/xml "; + } else { + return "text/xml"; + } +} + +sub uses_temp_file { +# my ($self) = @_; + # no tempfile needet for XML Output + return 1; +} + 1; -- 2.20.1