[Rt-commit] r12198 - in rtfm/branches/2.2-RELEASE: . html/RTFM/Article/Elements

falcone at bestpractical.com falcone at bestpractical.com
Fri May 9 16:37:58 EDT 2008


Author: falcone
Date: Fri May  9 16:37:57 2008
New Revision: 12198

Removed:
   rtfm/branches/2.2-RELEASE/lib/RT/FM/Config.pod
Modified:
   rtfm/branches/2.2-RELEASE/   (props changed)
   rtfm/branches/2.2-RELEASE/Changelog
   rtfm/branches/2.2-RELEASE/html/RTFM/Article/Elements/Preformatted
   rtfm/branches/2.2-RELEASE/lib/RT/FM/Article_Overlay.pm

Log:
 r32413 at ketch:  falcone | 2008-05-09 16:34:40 -0400
 * remove ParseTemplate code/changelog notes
   moving to an extension


Modified: rtfm/branches/2.2-RELEASE/Changelog
==============================================================================
--- rtfm/branches/2.2-RELEASE/Changelog	(original)
+++ rtfm/branches/2.2-RELEASE/Changelog	Fri May  9 16:37:57 2008
@@ -1,10 +1,5 @@
 2.2.2
 
-FEATURES
-========
-
- * add new option $RT::RTFM_ParseContentAsTemplate
-
 CLEANUPS
 ========
 

Modified: rtfm/branches/2.2-RELEASE/html/RTFM/Article/Elements/Preformatted
==============================================================================
--- rtfm/branches/2.2-RELEASE/html/RTFM/Article/Elements/Preformatted	(original)
+++ rtfm/branches/2.2-RELEASE/html/RTFM/Article/Elements/Preformatted	Fri May  9 16:37:57 2008
@@ -79,14 +79,8 @@
     my $content = $value->Content;
     return '' unless defined $content && length $content;
 
-    if ( $RT::RTFM_ParseContentAsTemplate ) {
-        my ($new, $msg) = $Article->ParseTemplate( $content, Ticket => $Ticket );
-        unless ( defined $new && length $new ) {
-            $RT::Logger->error("Couldn't parse article's content: $msg");
-        } else {
-            $content = $new;
-        }
-    }
+    $$m->comp('/Elements/Callback', _CallbackName => 'UpdateLogic', 
+              content => \$content, %ARGS );
 
     if ( $content =~ /<.{1,5}>/ ) {
         $content = $de_htmlify->( $content );

Modified: rtfm/branches/2.2-RELEASE/lib/RT/FM/Article_Overlay.pm
==============================================================================
--- rtfm/branches/2.2-RELEASE/lib/RT/FM/Article_Overlay.pm	(original)
+++ rtfm/branches/2.2-RELEASE/lib/RT/FM/Article_Overlay.pm	Fri May  9 16:37:57 2008
@@ -476,64 +476,6 @@
     }
 }
 
-=head2 ParseTemplate $CONTENT, %TEMPLATE_ARGS
-
-Parses $CONTENT string as a template (L<Text::Template>).
-$Article and other arguments from %TEMPLATE_ARGS are
-available in code of the template as perl variables.
-
-=cut
-
-sub ParseTemplate {
-    my $self = shift;
-    my $content = shift;
-    my %args = (
-        Ticket => undef,
-        @_
-    );
-
-    return ($content) unless defined $content && length $content;
-
-    $args{'Article'} = $self;
-    $args{'rtname'}  = $RT::rtname;
-    if ( $args{'Ticket'} ) {
-        my $t = $args{'Ticket'}; # avoid memory leak
-        $args{'loc'} = sub { $t->loc(@_) };
-    } else {
-        $args{'loc'} = sub { $self->loc(@_) };
-    }
-
-    foreach my $key ( keys %args ) {
-        next unless ref $args{ $key };
-        next if ref $args{ $key } =~ /^(ARRAY|HASH|SCALAR|CODE)$/;
-        my $val = $args{ $key };
-        $args{ $key } = \$val;
-    }
-
-    # We need to untaint the content of the template, since we'll be working
-    # with it
-    $content =~ s/^(.*)$/$1/;
-    my $template = Text::Template->new(
-        TYPE   => 'STRING',
-        SOURCE => $content
-    );
-
-    my $is_broken = 0;
-    my $retval = $template->fill_in(
-        HASH => \%args,
-        BROKEN => sub {
-            my (%args) = @_;
-            $RT::Logger->error("Article parsing error: $args{error}")
-                unless $args{error} =~ /^Died at /; # ignore intentional die()
-            $is_broken++;
-            return undef;
-        },
-    );
-    return ( undef, $self->loc('Article parsing error') ) if $is_broken;
-
-    return ($retval);
-}
-
 =head2 CurrentUserHasRight
 
 Returns true if the current user has the right for this article, for the whole system or for this article's class


More information about the Rt-commit mailing list