ref: 733c0f37f2989b1941db63895b7f64c3bb66cb1a
parent: 67285813c6584cfed752084e0192386eb727bf32
author: uriel <uriel@engel.se.cat-v.org>
date: Fri Oct 17 23:40:30 EDT 2008
Add initial templates for user login and blog post entry.
--- /dev/null
+++ b/lib/_apps/blog/post_form.tpl
@@ -1,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>
--- /dev/null
+++ b/lib/_users/login.tpl
@@ -1,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>