Replace blog_dir_handler with a template in lib/feeds/html.tpl

This commit is contained in:
Uriel 2008-10-18 03:32:13 +02:00
parent a1dd162124
commit a891993160
2 changed files with 23 additions and 16 deletions

View file

@ -123,21 +123,6 @@ fn dir_listing_handler {
fn 404_handler { template `{ get_lib_file 404.tpl } }
fn blog_dir_handler {
blogDirs = $*
if (! ~ $blogTitle '')
echo '<h1>'$"blogTitle'</h1>'
echo '<div style="text-align:right">(<a href="index.rss">rss feed</a>)</div>'
for (f in `{ sortedBlogPostList $blogDirs }) {
gen_blog_post_title $f
cat $f
echo
} | $formatter
}
fn blog_post_handler {
gen_blog_post_title $1 | $formatter
$formatter < $1
@ -203,7 +188,7 @@ fn select_handler {
extraHeaders=$"extraHeaders ^ \
'<link rel="alternate" type="application/rss+xml" title="RSS" href="'$rssuri'" />
'
set_handler blog_dir_handler $blogDirs
set_handler tpl_handler lib/feeds/html.tpl
}
# Global tpl (eg sitemap.tpl)

22
lib/feeds/html.tpl Normal file
View file

@ -0,0 +1,22 @@
% if (! ~ $blogTitle '')
% echo '<h1>'$"blogTitle'</h1>'
<div style="text-align:right">(<a href="index.rss">rss feed</a>)</div>
%{
for (f in `{ sortedBlogPostList $blogDirs }) {
gen_blog_post_title $f
cat $f
echo
} | $formatter
# TODO Should check if user has perms and so on
get_user
if(~ $#logged_user 1) {
%}
<form method="POST" action="/_apps/blog/post_form">
% echo '<input type="text" name="target_blog_dir" value="'^$blogDirs(1)^'" />'
<input type="submit" name="Submit" value="New post" />
</form>
% }
<hr />