19 |
/; |
/; |
20 |
# FormValidator |
# FormValidator |
21 |
|
|
22 |
our $VERSION = '0.31-dev'; |
our $VERSION = '0.32-dev'; |
23 |
|
|
24 |
# |
# |
25 |
# Configure the application |
# Configure the application |
60 |
|
|
61 |
my $site_name = shift @{ $c->req->args }; |
my $site_name = shift @{ $c->req->args }; |
62 |
|
|
63 |
|
$c->log->debug("trying site name: $site_name"); |
64 |
|
|
65 |
if (my $sites_root = $c->config->{sites_root}) { |
if (my $sites_root = $c->config->{sites_root}) { |
66 |
my $site_path = $c->path_to('root', $sites_root, $site_name); |
my $site_path = $c->path_to('root', $sites_root, $site_name); |
67 |
|
|
68 |
if (-e $site_path) { |
if (-e $site_path) { |
69 |
$c->stash->{site} = $site_name; |
$c->stash->{site} = $site_name; |
70 |
if (my $action = shift @{ $c->req->args }) { |
if (my $action = join('/', @{ $c->req->args })) { |
71 |
$c->log->debug( "site: $site_name, action: $action" ); |
$c->log->debug( "site: $site_name, action: $action" ); |
72 |
$c->internal_redirect( $action, $c->stash ); |
# TODO can I really change base like this? |
73 |
|
$c->stash->{base} = "/$site_name/" . $c->stash->{base} |
74 |
|
if ($c->stash->{base} && $$c->stash->{base} !~ m#^/\Q$site_name\E/#); |
75 |
|
$c->internal_redirect( $action, $c->stash, @{ $c->req->args } ); |
76 |
} else { |
} else { |
77 |
$c->log->debug( "site: $site_name" ); |
$c->log->debug( "site: $site_name" ); |
78 |
} |
} |
96 |
if ($c->response->body) { |
if ($c->response->body) { |
97 |
$c->log->debug("at end body exists, we won't touch it!"); |
$c->log->debug("at end body exists, we won't touch it!"); |
98 |
} else { |
} else { |
|
$c->fillform( $c->req->params ); |
|
|
|
|
99 |
if (my $site_name = $c->stash->{site}) { |
if (my $site_name = $c->stash->{site}) { |
100 |
my $template_path = $c->path_to('root', $c->config->{sites_root}, $site_name, $c->stash->{template}); |
my $template_path = $c->path_to('root', $c->config->{sites_root}, $site_name, $c->stash->{template}); |
101 |
if (-e $template_path) { |
if (-e $template_path) { |
109 |
# Forward to View unless response body is already defined |
# Forward to View unless response body is already defined |
110 |
$c->forward('View::TT'); |
$c->forward('View::TT'); |
111 |
|
|
112 |
|
$c->fillform( $c->req->params ); |
113 |
|
|
114 |
$c->response->{body} =~ s#\Qnew Ajax.Autocompleter(\E#new WebPAC.Suggest(#gs; |
$c->response->{body} =~ s#\Qnew Ajax.Autocompleter(\E#new WebPAC.Suggest(#gs; |
115 |
$c->response->{body} =~ s#\Qnew Ajax.Updater(\E#new WebPAC.Updater(#gs; |
$c->response->{body} =~ s#\Qnew Ajax.Updater(\E#new WebPAC.Updater(#gs; |
116 |
|
|