Add initial templates for user login and blog post entry.

This commit is contained in:
uriel 2008-10-18 03:40:30 +02:00
parent cb1cd1f2f9
commit d5e9b2dcb0
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,25 @@
%{
get_post_args target_blog_dir post_title post_body
if(~ $REQUEST_METHOD POST && ! ~ $#target_blog_dir 0 && ! ~ $#post_title 0) {
get_user
if(test -f $sitedir/$target_blog_dir/_werc/config)
. $sitedir/$target_blog_dir/_werc/config
if(~ $#blog_editors_group 0)
echo Cant post to $target_blog_dir, no editors group set.
if not if (! user_in_group $blog_editors_group)
echo Permission to post to $target_blog_dir denied, user $logged_user not in group $blog_editors_group
if not if(! make_blog_post $target_blog_dir $post_title $post_body)
echo Posting to $target_blog_dir failed: $status
if not
echo Posted to $target_blog_dir.
}
%}
<form method="POST">
Submit a new blog post
Post title: <input type="text" name="post_title" /><br />
<textarea name="post_body"></textarea><br />
% echo '<input type="text" name="target_blog_dir" value="'^$target_blog_dir^'" /><br />'
<input type="submit" />
</form>

13
lib/_users/login.tpl Normal file
View File

@ -0,0 +1,13 @@
%{
get_user
if(! ~ $#logged_user 0)
echo 'You are logged in as' $logged_user
if not if (~ $REQUEST_METHOD POST)
echo 'Login failed!'
%}
<form method="POST">
User name: <input type="text" name="user_name" /><br />
User password: <input type="password" name="user_password" /><br />
<input name="s" type="submit" value="Login" />
</form>