[Rt-commit] r11423 - rtfm/branches/2.2-RELEASE/html/Callbacks/RTFM/Elements/MessageBox
ruz at bestpractical.com
ruz at bestpractical.com
Thu Apr 3 02:36:19 EDT 2008
Author: ruz
Date: Thu Apr 3 02:36:19 2008
New Revision: 11423
Modified:
rtfm/branches/2.2-RELEASE/html/Callbacks/RTFM/Elements/MessageBox/Default
Log:
* switch from mason to pure perl what is much readable.
Modified: rtfm/branches/2.2-RELEASE/html/Callbacks/RTFM/Elements/MessageBox/Default
==============================================================================
--- rtfm/branches/2.2-RELEASE/html/Callbacks/RTFM/Elements/MessageBox/Default (original)
+++ rtfm/branches/2.2-RELEASE/html/Callbacks/RTFM/Elements/MessageBox/Default Thu Apr 3 02:36:19 2008
@@ -15,21 +15,25 @@
%# GNU General Public License for more details.
%#
%# END LICENSE BLOCK
-%foreach my $arg (keys %ARGS) {
-%
-% if ($arg =~ /^RTFM-Include-Article-(\d+)$/) {
-% my $art = RT::FM::Article->new($session{'CurrentUser'});
-% $art->Load($1);
-<& /RTFM/Article/Elements/Preformatted, Article => $art &>\
-% }
-% if ($arg =~ /RTFM-Include-Article-Named/ && $ARGS{$arg} =~ /\D/) {
-% my $art = RT::FM::Article->new($session{'CurrentUser'});
-% $art->LoadByCols(Name => $ARGS{$arg});
-<& /RTFM/Article/Elements/Preformatted, Article => $art &>\
-% } elsif ($arg =~ /RTFM-Include-Article-Named/ && $ARGS{$arg}) {
-% my $art = RT::FM::Article->new($session{'CurrentUser'});
-% $art->LoadByCols(id => $ARGS{$arg});
-<& /RTFM/Article/Elements/Preformatted, Article => $art &>\
-% }
-% }
-% return(1);
\ No newline at end of file
+<%INIT>
+foreach my $arg ( keys %ARGS ) {
+ my $article;
+ if ( $arg =~ /^RTFM-Include-Article-(\d+)$/ ) {
+ $article = RT::FM::Article->new($session{'CurrentUser'});
+ $article->Load($1);
+ } elsif ( $arg =~ /^RTFM-Include-Article-Named/ && $ARGS{ $arg } ) {
+ $article = RT::FM::Article->new($session{'CurrentUser'});
+ if ( $ARGS{$arg} =~ /\D/ ) {
+ $article->LoadByCols( Name => $ARGS{ $arg } );
+ } else {
+ $article->LoadByCols( id => $ARGS{ $arg } );
+ }
+ }
+ next unless $article && $article->id;
+
+ $m->comp('/RTFM/Article/Elements/Preformatted',
+ Article => $article,
+ );
+}
+return;
+</%INIT>
More information about the Rt-commit
mailing list