Show
Ignore:
Timestamp:
05/16/08 07:45:14 (19 months ago)
Author:
takayama
Message:

Fixed BugId:79763
* When author object was not found in the context, try to load author object from entry in the context

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-38/lib/MT/Template/ContextHandlers.pm

    r2333 r2356  
    62736273sub _hdlr_author_id { 
    62746274    my ($ctx) = @_; 
    6275     my $author = $ctx->stash('author') 
    6276         or return $ctx->_no_author_error(); 
     6275    my $author = $ctx->stash('author'); 
     6276    unless ($author) { 
     6277        my $e = $ctx->stash('entry');  
     6278        $author = $e->author if $e;  
     6279    } 
     6280    return $ctx->_no_author_error() unless $author; 
    62776281    return $author->id; 
    62786282} 
     
    62906294sub _hdlr_author_name { 
    62916295    my ($ctx) = @_; 
    6292     my $author = $ctx->stash('author') 
    6293         or return $ctx->_no_author_error(); 
     6296    my $author = $ctx->stash('author'); 
     6297    unless ($author) { 
     6298        my $e = $ctx->stash('entry');  
     6299        $author = $e->author if $e;  
     6300    } 
     6301    return $ctx->_no_author_error() unless $author; 
    62946302    return $author->name; 
    62956303} 
     
    63096317        my $e = $ctx->stash('entry');  
    63106318        $a = $e->author if $e;  
    6311     }  
     6319    } 
    63126320    return $ctx->_no_author_error() unless $a; 
    63136321    return $a->nickname || MT->translate('(Display Name not set)', $a->id); 
    6314 }  
     6322} 
    63156323 
    63166324########################################################################### 
     
    63266334sub _hdlr_author_email { 
    63276335    my ($ctx, $args) = @_; 
    6328     my $author = $ctx->stash('author') 
    6329         or return $ctx->_no_author_error(); 
     6336    my $author = $ctx->stash('author'); 
     6337    unless ($author) { 
     6338        my $e = $ctx->stash('entry');  
     6339        $author = $e->author if $e;  
     6340    } 
     6341    return $ctx->_no_author_error() unless $author; 
    63306342    my $email = $author->email; 
    63316343    return '' unless defined $email; 
     
    63436355sub _hdlr_author_url { 
    63446356    my ($ctx) = @_; 
    6345     my $author = $ctx->stash('author') 
    6346         or return $ctx->_no_author_error(); 
     6357    my $author = $ctx->stash('author'); 
     6358    unless ($author) { 
     6359        my $e = $ctx->stash('entry');  
     6360        $author = $e->author if $e;  
     6361    } 
     6362    return $ctx->_no_author_error() unless $author; 
    63476363    my $url = $author->url; 
    63486364    return defined $url ? $url : ''; 
     
    63606376sub _hdlr_author_auth_type { 
    63616377    my ($ctx) = @_; 
    6362     my $author = $ctx->stash('author') 
    6363         or return $ctx->_no_author_error(); 
     6378    my $author = $ctx->stash('author'); 
     6379    unless ($author) { 
     6380        my $e = $ctx->stash('entry');  
     6381        $author = $e->author if $e;  
     6382    } 
     6383    return $ctx->_no_author_error() unless $author; 
    63646384    my $auth_type = $author->auth_type; 
    63656385    return defined $auth_type ? $auth_type : ''; 
     
    63996419sub _hdlr_author_auth_icon_url { 
    64006420    my ($ctx, $args) = @_; 
    6401     my $author = $ctx->stash('author') 
    6402         or return $ctx->_no_author_error(); 
     6421    my $author = $ctx->stash('author'); 
     6422    unless ($author) {  
     6423        my $e = $ctx->stash('entry');  
     6424        $author = $e->author if $e;  
     6425    } 
     6426    return $ctx->_no_author_error() unless $author; 
    64036427    my $size = $args->{size} || 'logo_small'; 
    64046428    return $author->auth_icon_url($size); 
     
    64196443sub _hdlr_author_userpic { 
    64206444    my ($ctx) = @_; 
    6421     my $author = $ctx->stash('author') 
    6422         or return $ctx->_no_author_error(); 
     6445    my $author = $ctx->stash('author'); 
     6446    unless ($author) { 
     6447        my $e = $ctx->stash('entry');  
     6448        $author = $e->author if $e;  
     6449    } 
     6450    return $ctx->_no_author_error() unless $author; 
    64236451    return $author->userpic_html() || ''; 
    64246452} 
     
    64376465sub _hdlr_author_userpic_url { 
    64386466    my ($ctx) = @_; 
    6439     my $author = $ctx->stash('author') 
    6440         or return $ctx->_no_author_error(); 
     6467    my $author = $ctx->stash('author'); 
     6468    unless ($author) { 
     6469        my $e = $ctx->stash('entry');  
     6470        $author = $e->author if $e;  
     6471    } 
     6472    return $ctx->_no_author_error() unless $author; 
    64416473    return $author->userpic_url() || ''; 
    64426474} 
     
    64656497    my ($ctx, $args, $cond) = @_; 
    64666498 
    6467     my $author = $ctx->stash('author') 
    6468         or return $ctx->_no_author_error(); 
     6499    my $author = $ctx->stash('author'); 
     6500    unless ($author) { 
     6501        my $e = $ctx->stash('entry');  
     6502        $author = $e->author if $e;  
     6503    } 
     6504    return $ctx->_no_author_error() unless $author; 
    64696505    my $asset = $author->userpic or return ''; 
    64706506