Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 287e81e0

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID 287e81e0c99c7e203b9c78bcd6a1cf1a7c28d6f6
  • Vorgänger 36a33b59
  • Nachfolger ea974a5a

render() in Controller+Presenter: Support für Typ "text"

Unterschiede anzeigen:

SL/Controller/Base.pm
82 82
  }
83 83

  
84 84
  # Only certain types are supported.
85
  croak "Unsupported type: " . $options->{type} unless $options->{type} =~ m/^(?:html|js|json)$/;
85
  croak "Unsupported type: " . $options->{type} unless $options->{type} =~ m/^(?:html|js|json|text)$/;
86 86

  
87 87
  # The "template" argument must be a string or a reference to one.
88 88
  $template = ${ $template }                                       if ((ref($template) || '') eq 'REF') && (ref(${ $template }) eq 'SL::Presenter::EscapedText');
......
112 112
      $::form->{header} = 1;
113 113
      my $content_type  = $options->{type} eq 'html' ? 'text/html'
114 114
                        : $options->{type} eq 'js'   ? 'text/javascript'
115
                        : $options->{type} eq 'text' ? 'text/plain'
115 116
                        :                              'application/json';
116 117

  
117 118
      print $::form->create_http_response(content_type => $content_type,
......
401 402

  
402 403
=item C<type>
403 404

  
404
The template type. Can be C<html> (the default), C<js> for JavaScript
405
or C<json> for JSON content. Affects the extension that's added to the
406
file name given with a non-reference C<$template> argument, the
407
content type HTTP header that is output and whether or not the layout
408
will be output as well (see description of C<layout> below).
405
The template type. Can be C<html> (the default), C<js> for JavaScript,
406
C<json> for JSON and C<text> for plain text content. Affects the
407
extension that's added to the file name given with a non-reference
408
C<$template> argument, the content type HTTP header that is output and
409
whether or not the layout will be output as well (see description of
410
C<layout> below).
409 411

  
410 412
=item C<process>
411 413

  

Auch abrufbar als: Unified diff