diff --git a/lib/Act/Dispatcher.pm b/lib/Act/Dispatcher.pm index ead3ac22b..d18fc168d 100644 --- a/lib/Act/Dispatcher.pm +++ b/lib/Act/Dispatcher.pm @@ -5,6 +5,7 @@ use Encode qw(decode_utf8); use Plack::Builder; use Plack::Request; use Plack::App::Cascade; +use Plack::App::File; use Act::Config; use Act::Handler::Static; @@ -117,6 +118,21 @@ sub conference_app { }; }; Plack::App::Cascade->new( catch => [99], apps => [ + builder { + # XXX ugly, but functional for now + enable sub { + my ( $app ) = @_; + + return sub { + my ( $env ) = @_; + + my $res = $app->($env); + $res->[0] = 99 if $res->[0] == 404; + return $res; + }; + }; + Plack::App::File->new(root => $Config->general_root)->to_app; + }, builder { enable '+Act::Middleware::Auth'; for my $uri ( keys %public_handlers ) { diff --git a/lib/Act/Handler/User/Register.pm b/lib/Act/Handler/User/Register.pm index cee2ff036..12b040340 100644 --- a/lib/Act/Handler/User/Register.pm +++ b/lib/Act/Handler/User/Register.pm @@ -45,6 +45,12 @@ sub handler # conference is closed if ($Config->closed) { $Request{status} = 403; + my $template = Act::Template::HTML->new(); + $template->variables( + closed => 1, + end_date => DateTime::Format::Pg->parse_timestamp($Config->talks_end_date)->epoch, + ); + $template->process('user/register'); return; } # special case of logged in users! diff --git a/lib/Act/Util.pm b/lib/Act/Util.pm index d256afbcf..9b7f030b4 100644 --- a/lib/Act/Util.pm +++ b/lib/Act/Util.pm @@ -13,7 +13,7 @@ use Act::Database; use vars qw(@ISA @EXPORT %Languages); @ISA = qw(Exporter); -@EXPORT = qw(make_uri make_uri_info self_uri localize); +@EXPORT = qw(make_uri make_abs_uri make_uri_info self_uri localize); # password generation data my %grams = ( @@ -96,6 +96,14 @@ sub make_uri return _build_uri($uri, %params); } +sub make_abs_uri { + my ( $action, %params ) = @_; + + my $uri = $Request{r}->uri; + $uri->path(make_uri(@_)); + return $uri; +} + # create a uri pathinfo-style sub make_uri_info { @@ -348,6 +356,10 @@ Returns an URI that points to I, with an optional query string built from I<%params>. For more details on actions, refer to the Act::Dispatcher documentation. +=item make_abs_uri(I<$action>, I<%params>) + +Similar to L, but returns an absolute URI. + =item self_uri(I<%params>) Returns a self-referential URI (a URI that points to the current location) diff --git a/po/en.po b/po/en.po index 09e5fb903..976860c66 100644 --- a/po/en.po +++ b/po/en.po @@ -1413,3 +1413,5 @@ msgstr "Unknown order ID." msgid "User is not registered." msgstr "User is not registered." +msgid "Sorry, registration for this conference has been closed." +msgstr "Sorry, registration for this conference has been closed." diff --git a/templates/core/user/register b/templates/core/user/register index 943814f76..59cdccd89 100644 --- a/templates/core/user/register +++ b/templates/core/user/register @@ -3,6 +3,10 @@

{{Sorry, this conference is over.}}

+[% ELSIF closed %] +

+ {{Sorry, registration for this conference has been closed.}} +

[% ELSE %]