| 1 | # | ||
| 2 | # This file is part of CatalystX-ExtJS-Direct | ||
| 3 | # | ||
| 4 | # This software is Copyright (c) 2014 by Moritz Onken. | ||
| 5 | # | ||
| 6 | # This is free software, licensed under: | ||
| 7 | # | ||
| 8 | # The (three-clause) BSD License | ||
| 9 | # | ||
| 10 | package CatalystX::Action::ExtJS::Serialize; | ||
| 11 | $CatalystX::Action::ExtJS::Serialize::VERSION = '2.1.5'; | ||
| 12 | # ABSTRACT: Handle responses from uploads | ||
| 13 | use strict; | ||
| 14 | use warnings; | ||
| 15 | |||
| 16 | use base 'Catalyst::Action::Serialize'; | ||
| 17 | |||
| 18 | sub execute { | ||
| 19 | my ( $self, $controller, $c ) = @_; | ||
| 20 | $self->next::method( $controller, $c ); | ||
| 21 | if ( $c->stash->{upload} && $c->stash->{upload} eq 'true' ) { | ||
| 22 | $c->res->content_type('text/html'); | ||
| 23 | my $body = $c->res->body; | ||
| 24 | $body =~ s/"/\"/; | ||
| 25 | $c->res->body( | ||
| 26 | '<html><body><textarea>' . $body . '</textarea></body></html>' ); | ||
| 27 | } | ||
| 28 | } | ||
| 29 | |||
| 30 | 1; | ||
| 31 | |||
| 32 | __END__ |