Changeset 950

Show
Ignore:
Timestamp:
12/19/06 08:23:11 (2 years ago)
Author:
takayama
Message:

Fixed BugId:42891

* Added template tag

  • <$MTTemplateCreatedOn$>

* Changed to <$MTTemplateCreatedOn$> instead of <$MTDate$> in the Atom template

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/wheeljack/default_templates/atom_index.tmpl

    r855 r950  
    44   <link rel="alternate" type="text/html" href="<$MTBlogURL encode_xml="1"$>" /> 
    55   <link rel="self" type="application/atom+xml" href="<$MTBlogURL$>atom.xml" /> 
    6    <id>tag:<$MTBlogHost exclude_port="1" encode_xml="1"$>,<$MTDate format="%Y-%m-%d"$>:<$MTBlogRelativeURL encode_xml="1"$>/<$MTBlogID$></id> 
     6   <id>tag:<$MTBlogHost exclude_port="1" encode_xml="1"$>,<$MTTemplateCreatedOn format="%Y-%m-%d"$>:<$MTBlogRelativeURL encode_xml="1"$>/<$MTBlogID$></id> 
    77   <updated><MTEntries lastn="1"><$MTEntryModifiedDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></MTEntries></updated> 
    88   <MTIfNonEmpty tag="MTBlogDescription"><subtitle><$MTBlogDescription remove_html="1" encode_xml="1"$></subtitle></MTIfNonEmpty> 
  • branches/wheeljack/lib/MT/DefaultTemplates.pm

    r873 r950  
    108108        ]; 
    109109 
    110 use MT::Util qw(format_ts); 
    111  
    112110sub templates { 
    113111    if (!$loaded) { 
     
    122120            if ((-e $file) && (-r $file)) { 
    123121                open FIN, "<$file"; my $data = <FIN>; close FIN; 
    124                 if ('Atom Index' eq $tmpl->{name}) { 
    125                     if ($data =~ m!<\$MTDate format="([\S]+)"\$>!) { 
    126                         my @ts = gmtime(time); 
    127                         my $ts = sprintf '%04d%02d%02d%02d%02d%02d', 
    128                                 $ts[5]+1900, $ts[4]+1, @ts[3,2,1,0]; 
    129                         my $date = format_ts($1, $ts); 
    130                         $data =~ s!<\$MTDate format="([\S]+)"\$>!$date!; 
    131                     } 
    132                 } 
    133122                $tmpl->{text} = $data; 
    134123            } else { 
  • branches/wheeljack/lib/MT/Template.pm

    r910 r950  
    6565    my $tmpl = shift; 
    6666    my($ctx, $cond) = @_; 
     67    $ctx->stash('template', $tmpl); 
    6768    my $tokens; 
    6869    my $build = MT::Builder->new; 
  • branches/wheeljack/lib/MT/Template/ContextHandlers.pm

    r949 r950  
    282282 
    283283        TemplateNote => sub { '' }, 
     284        TemplateCreatedOn => \&_hdlr_template_created_on, 
    284285        Ignore => [ sub { '' }, 1 ], 
    285286 
     
    965966    $file =~ s!(^/|/$)!!g; 
    966967    $file; 
     968} 
     969 
     970sub _hdlr_template_created_on { 
     971    my($ctx, $args, $cond) = @_; 
     972    my $template = $ctx->stash('template') 
     973        or return $ctx->error(MT->translate("Can't load template")); 
     974    $args->{ts} = $template->created_on; 
     975    _hdlr_date($_[0], $args); 
    967976} 
    968977