X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FPresenter.pm;fp=SL%2FPresenter.pm;h=d8add637898cf9dc158f0e00cd8259cb04947284;hb=287e81e0c99c7e203b9c78bcd6a1cf1a7c28d6f6;hp=61ddab4082922064730bfc1fec7efd780715042a;hpb=36a33b59b8785fff522ff7382ac7d576d13a9dc0;p=kivitendo-erp.git diff --git a/SL/Presenter.pm b/SL/Presenter.pm index 61ddab408..d8add6378 100644 --- a/SL/Presenter.pm +++ b/SL/Presenter.pm @@ -40,7 +40,7 @@ sub render { } # Only certain types are supported. - croak "Unsupported type: " . $options->{type} unless $options->{type} =~ m/^(?:html|js|json)$/; + croak "Unsupported type: " . $options->{type} unless $options->{type} =~ m/^(?:html|js|json|text)$/; # The "template" argument must be a string or a reference to one. $template = ${ $template } if ((ref($template) || '') eq 'REF') && (ref(${ $template }) eq 'SL::Presenter::EscapedText'); @@ -49,7 +49,8 @@ sub render { # Look for the file given by $template if $template is not a reference. my $source; if (!ref $template) { - $source = "templates/webpages/${template}." . $options->{type}; + my $ext = $options->{type} eq 'text' ? 'txt' : $options->{type}; + $source = "templates/webpages/${template}.${ext}"; croak "Template file ${source} not found" unless -f $source; } elsif (ref($template) eq 'SCALAR') { @@ -223,9 +224,10 @@ The following options are available: =item C -The template type. Can be C (the default), C for JavaScript -or C for JSON content. Affects only the extension that's added -to the file name given with a non-reference C<$template> argument. +The template type. Can be C (the default), C for JavaScript, +C for JSON and C for plain text content. Affects only the +extension that's added to the file name given with a non-reference +C<$template> argument. =item C