Changeset 1710

Show
Ignore:
Timestamp:
04/02/08 06:52:31 (23 months ago)
Author:
fumiakiy
Message:

Comment reply should not have assumed the existence of template modules even if it was one of default templates. BugId:67976

Location:
branches/release-33
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • branches/release-33/lib/MT/CMS/Comment.pm

    r1642 r1710  
    12611261      unless $comment; 
    12621262 
    1263     my $cmt_tmpl = 
    1264       $app->model('template')->load( { identifier => 'comment_detail' } ); 
    1265     my $tmpl_name = $cmt_tmpl->name; 
    1266     require MT::Template; 
    1267     my $tmpl = MT::Template->new( 
    1268         type   => 'scalarref', 
    1269         source => \"<\$MTInclude module=\"$tmpl_name\"\$>", 
    1270     ); 
    1271     my $ctx = $tmpl->context; 
    12721263    ## Set timestamp as we would usually do in ObjectDriver. 
    12731264    my @ts = MT::Util::offset_time_list( time, $entry->blog_id ); 
     
    12761267    $comment->created_on($ts); 
    12771268    $comment->commenter_id( $app->user->id ); 
    1278     $ctx->stash( 'comment', $comment ); 
     1269    $param->{'comment'} = $comment; 
    12791270 
    12801271    require MT::Serialize; 
     
    12821273    my $state = $comment->column_values; 
    12831274    $state->{static} = $q->param('static'); 
    1284     $ctx->stash( 'comment_state', unpack 'H*', $ser->serialize( \$state ) ); 
    1285     $ctx->stash( 'comment_is_static', 1 ); 
    1286     $ctx->stash( 'entry',             $entry ); 
    1287     $ctx->{current_timestamp} = $ts; 
    1288     $ctx->stash( 'commenter', $app->user ); 
    1289     $ctx->stash( 'blog_id',   $parent->blog_id ); 
    1290     $ctx->stash( 'blog',      $parent->blog ); 
    1291     my %cond; 
    1292     my $html = $tmpl->build( $ctx, \%cond ); 
     1275    $param->{'comment_state'} = unpack 'H*', $ser->serialize( \$state ); 
     1276    $param->{'comment_is_static'} = 1; 
     1277    $param->{'entry'} = $entry; 
     1278    $param->{'current_timestamp'} = $ts; 
     1279    $param->{'commenter'} = $app->user; 
     1280    $param->{'blog_id'} = $parent->blog_id; 
     1281    $param->{'blog'} = $parent->blog; 
     1282 
    12931283    return $app->build_page( 'dialog/comment_reply.tmpl', 
    1294         { %$param, error => $tmpl->errstr } ) 
    1295       unless defined $html; 
    1296  
    1297     return $app->build_page( 'dialog/comment_reply.tmpl', 
    1298         { %$param, text => $q->param('text'), preview_html => $html } ); 
     1284        { %$param, text => $q->param('text') } ); 
    12991285} 
    13001286 
  • branches/release-33/tmpl/cms/dialog/comment_reply.tmpl

    r1309 r1710  
    3131        <div class="intro"><__trans phrase="Preview of your comment"></div> 
    3232        <div id="reply-body"> 
    33             <$mt:var name="preview_html"$> 
     33<$mt:include name="include/comment_detail.tmpl"$> 
    3434        </div> 
    3535    </div>