shithub: werc

Download patch

ref: f0a9a6d6b08b946867ab99d72ec52c87ded4ba7b
parent: dddf12c59b1de6288ba3024b4f406a220ba5c5ca
author: uriel <uriel@engel.se.cat-v.org>
date: Wed Oct 22 05:20:06 EDT 2008

Improvements to wiki and comments code, take advantage of improvements in user auth interfaca

--- a/lib/default_master.tpl
+++ b/lib/default_master.tpl
@@ -26,8 +26,7 @@
 %}
 </div>
 
-% # TODO: probably should check if we have the right perms
-% if (! ~ $#wiki 0 && test -f $body.md  && get_user && ! ~ $#logged_user 0) {
+% if (! ~ $#wiki 0 && test -f $body.md  && check_user $wiki_editors_group) {
 <div> 
     <form action="/_apps/dirdir/edit" method="POST">
         <input type="hidden" name="edit_wiki_page" value="%($req_path%)" />
@@ -43,7 +42,6 @@
 % }
 
 <div id="main-copy">
-
 % genbody
 
 % if (! ~ $#allowComments 0) {
@@ -52,20 +50,26 @@
 cdir = $body.md_werc/comments
 if (test -d $cdir) { 
     echo '<hr /><h2>Comments</h2>'
-    for(c in `{ls $cdir}) {
-        parse_rec $c
-    
-        echo '<div>'
-        echo User: $rec_user_name '<br />'
-        echo $rec_data | escape_html | sed 's,$,<br />,'
-        echo '<hr /></div>' 
+    for(c in `{ls $cdir/}) {
+%}
+        <div>
+%       echo  By: `{cat $c/user}
+        <br />
+%       cat $c/body | escape_html | sed 's,$,<br />,'
+        <hr /></div>
+%{
     }
 }
 %}
-
+<hr /><hr />
 <form action="" method="post">
-    <input type="text" name="comment_user_name" value="Anonimous glenda" /><input type="submit" name="post_comment" value="Post a comment" />
+% if(! check_user) {
+    User: <input type="text" name="comment_user_name" value="" /> Password:
+    <input type="password" name="comment_user_password" value="" />
+    <small>If you are not registered enter your desired user/password and your account will be created when your comment is approved.</small>
+% }
     <textarea name="comment_text" id="comment_text" cols="80" rows="16"></textarea>
+    <input type="submit" name="post_comment" value="Post a comment" />
 </form>
 % }