[dw-free] Improve error/success for routing / Template Toolkit
[commit: http://hg.dwscoalition.org/dw-free/rev/d8a06401cdc4]
http://bugs.dwscoalition.org/show_bug.cgi?id=2260
Add success page shortcut for TT, and fix error page to accept lang
arguments.
Patch by
foxfirefey.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=2260
Add success page shortcut for TT, and fix error page to accept lang
arguments.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- bin/upgrading/en.dat
- cgi-bin/DW/Controller.pm
- views/error.tt
- views/success.tt
-------------------------------------------------------------------------------- diff -r fcfda13ceac5 -r d8a06401cdc4 bin/upgrading/en.dat --- a/bin/upgrading/en.dat Fri Jan 08 23:50:27 2010 +0000 +++ b/bin/upgrading/en.dat Fri Jan 08 23:53:00 2010 +0000 @@ -3385,6 +3385,8 @@ subscribe_interface.special_subs.note=Th subscribe_interface.subs.total=You are using [[active]] out of [[max_active]] active subscriptions. +success=Success + taglib.error.access=You are not allowed to tag entries in this journal. taglib.error.add=You are not allowed to create new tags for this journal; the entry was not tagged with [[tags]]. diff -r fcfda13ceac5 -r d8a06401cdc4 cgi-bin/DW/Controller.pm --- a/cgi-bin/DW/Controller.pm Fri Jan 08 23:50:27 2010 +0000 +++ b/cgi-bin/DW/Controller.pm Fri Jan 08 23:53:00 2010 +0000 @@ -24,7 +24,7 @@ use DW::Template::Apache2; our ( @ISA, @EXPORT ); @ISA = qw/ Exporter /; -@EXPORT = qw/ needlogin error_ml controller /; +@EXPORT = qw/ needlogin error_ml success_ml controller /; # redirects the user to the login page to handle that eventuality sub needlogin { @@ -43,7 +43,14 @@ sub needlogin { # returns an error page using a language string sub error_ml { return DW::Template::Apache2->render_template( - 'error.tt', { message => LJ::Lang::ml( $_[0] ) } + 'error.tt', { message => LJ::Lang::ml( @_ ) } + ); +} + +# return a success page using a language string +sub success_ml { + return DW::Template::Apache2->render_template( + 'success.tt', { message => LJ::Lang::ml( @_ ) } ); } diff -r fcfda13ceac5 -r d8a06401cdc4 views/error.tt --- a/views/error.tt Fri Jan 08 23:50:27 2010 +0000 +++ b/views/error.tt Fri Jan 08 23:53:00 2010 +0000 @@ -1,2 +1,2 @@ -[%- sections.title = 'Error' | ml -%] +[%- sections.title = 'error' | ml -%] <p><strong>[% message %]</strong></p> diff -r fcfda13ceac5 -r d8a06401cdc4 views/success.tt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/views/success.tt Fri Jan 08 23:53:00 2010 +0000 @@ -0,0 +1,2 @@ +[%- sections.title = 'success' | ml -%] +<p><strong>[% message %]</strong></p> --------------------------------------------------------------------------------