Add initial templates for user login and blog post entry. - swerc - anselm's si… | |
git clone git://git.suckless.org/swerc | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 85011d3fd613ffa758c61fe9095e8f2d702a5539 | |
parent 75e19747777c418e989b28f926cf7aaab279b9c2 | |
Author: [email protected] <unknown> | |
Date: Sat, 18 Oct 2008 03:40:30 +0200 | |
Add initial templates for user login and blog post entry. | |
Diffstat: | |
A lib/_apps/blog/post_form.tpl | 25 +++++++++++++++++++++++++ | |
A lib/_users/login.tpl | 13 +++++++++++++ | |
2 files changed, 38 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/lib/_apps/blog/post_form.tpl b/lib/_apps/blog/post_form.tpl | |
@@ -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 … | |
+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… | |
+ <input type="submit" /> | |
+</form> | |
diff --git a/lib/_users/login.tpl b/lib/_users/login.tpl | |
@@ -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> |