Handler interface reorg, take oportunity to cleanup default_master.tpl and move comments bits to bridge app.
This commit is contained in:
parent
11900bdb0e
commit
e75232761a
4 changed files with 80 additions and 91 deletions
|
|
@ -1,26 +1,35 @@
|
|||
fn bridge_init {
|
||||
if(! ~ $#allowComments 0 && ~ $REQUEST_METHOD POST) {
|
||||
get_post_args comment_text
|
||||
d=`{date -n} # FIXME Obvious race
|
||||
d=$local_path.md_werc/comments/$d/
|
||||
if(! ~ $#allowComments 0) {
|
||||
ll_add handlers_body_foot bridge_body_foot
|
||||
if(get_post_args comment_text) {
|
||||
dprint POST COMMNET $"comment_text
|
||||
d=`{date -n} # FIXME Obvious race
|
||||
d=$local_path^'_werc/comments/'^$d/
|
||||
|
||||
u=$logged_user
|
||||
if(~ $#logged_user 0) {
|
||||
get_post_args comment_user_name comment_user_password
|
||||
# TODO Should take this path too if the user can login but doesn't
|
||||
# belong to required group
|
||||
if(! login_user $comment_user_name $comment_user_password) {
|
||||
u=$comment_user_name ':' $comment_user_password
|
||||
d=$d^'_pending'
|
||||
u=$logged_user
|
||||
if(~ $#logged_user 0) {
|
||||
get_post_args comment_user_name comment_user_password
|
||||
# XXX Should do this too if user not in required group
|
||||
if(! login_user $comment_user_name $comment_user_password) {
|
||||
u=$comment_user_name ':' $comment_user_password
|
||||
d=$d^'_pending'
|
||||
}
|
||||
if not
|
||||
u = $logged_user
|
||||
}
|
||||
if not
|
||||
u = $logged_user
|
||||
}
|
||||
|
||||
umask 002
|
||||
mkdir -m 775 -p $d
|
||||
echo $u > $d/user
|
||||
echo $comment_text > $d/body
|
||||
umask 002
|
||||
mkdir -m 775 -p $d
|
||||
echo $u > $d/user
|
||||
echo $comment_text > $d/body
|
||||
}
|
||||
if not
|
||||
dprint SSS $status
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fn bridge_body_foot {
|
||||
template apps/bridge/foot.tpl
|
||||
}
|
||||
|
||||
|
|
|
|||
25
apps/bridge/foot.tpl
Normal file
25
apps/bridge/foot.tpl
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
% cdir = $local_path^'_werc/comments'
|
||||
% if(test -d $cdir) {
|
||||
<hr /><h2>Comments</h2>
|
||||
% for(c in `{ls $cdir/}) {
|
||||
<div>By: '`{cat $c/user} '<br />
|
||||
% cat $c/body | escape_html | sed 's,$,<br />,'
|
||||
<hr /></div>
|
||||
% }
|
||||
% }
|
||||
|
||||
% get_post_args action
|
||||
% dprint XXX $"action
|
||||
|
||||
<hr /><hr />
|
||||
<form action="" method="post">
|
||||
% 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>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue