added last changed timestamp for pages

master
joey 2006-03-20 19:56:37 +00:00
parent 3a6d0d3a77
commit b7c86dda2f
3 changed files with 8 additions and 6 deletions

View File

@ -121,8 +121,4 @@ A cgi page to allow a user to log out and to edit their prefs, including passwor
ikiwiki needs a logo. I'm thinking something simple like the word "ikiwiki" with the first "k" backwards; drawn to show that it's "wiki" reflected. ikiwiki needs a logo. I'm thinking something simple like the word "ikiwiki" with the first "k" backwards; drawn to show that it's "wiki" reflected.
## Page last-changed timestamps
Of course you can go to the history to see when a page last changed in svn, still, it will be nice to have a timestamp at the bottom of pages. Should be based on the modification date of the source file, not the last rebuild date.
## [[Bugs]] ## [[Bugs]]

View File

@ -324,9 +324,10 @@ sub indexlink () { #{{{
return "<a href=\"$config{url}\">$config{wikiname}</a>"; return "<a href=\"$config{url}\">$config{wikiname}</a>";
} #}}} } #}}}
sub finalize ($$) { #{{{ sub finalize ($$$) { #{{{
my $content=shift; my $content=shift;
my $page=shift; my $page=shift;
my $mtime=shift;
my $title=basename($page); my $title=basename($page);
$title=~s/_/ /g; $title=~s/_/ /g;
@ -354,6 +355,7 @@ sub finalize ($$) { #{{{
content => $content, content => $content,
backlinks => [backlinks($page)], backlinks => [backlinks($page)],
discussionlink => htmllink($page, "Discussion", 1, 1), discussionlink => htmllink($page, "Discussion", 1, 1),
mtime => scalar(gmtime($mtime)),
); );
return $template->output; return $template->output;
@ -385,7 +387,8 @@ sub render ($) { #{{{
$content=linkify($content, $page); $content=linkify($content, $page);
$content=htmlize($type, $content); $content=htmlize($type, $content);
$content=finalize($content, $page); $content=finalize($content, $page,
mtime("$config{srcdir}/$file"));
check_overwrite("$config{destdir}/".htmlpage($page), $page); check_overwrite("$config{destdir}/".htmlpage($page), $page);
writefile("$config{destdir}/".htmlpage($page), $content); writefile("$config{destdir}/".htmlpage($page), $content);

View File

@ -35,7 +35,10 @@
</p> </p>
</TMPL_IF> </TMPL_IF>
<p>
<!-- from <TMPL_VAR NAME=WIKINAME> --> <!-- from <TMPL_VAR NAME=WIKINAME> -->
last edited <TMPL_VAR NAME=MTIME>
</p>
</body> </body>
</html> </html>