From f1ef3f80cf69cbfdeaf4f5a532ec7fa4da1f772d Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sun, 9 Mar 2008 23:07:34 +0100 Subject: [PATCH] fix comment openage * tekuti/page-helpers.scm (post-editing-form): * tekuti/post.scm (munge-post, parse-post-data): Add foo to allow comments to be opened or closed. Fix date setting. --- tekuti/page-helpers.scm | 4 ++++ tekuti/post.scm | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tekuti/page-helpers.scm b/tekuti/page-helpers.scm index 72bbe23..bb998d0 100644 --- a/tekuti/page-helpers.scm +++ b/tekuti/page-helpers.scm @@ -75,6 +75,10 @@ (timestamp->rfc822-date (post-timestamp post)) "")))) (label (@ (for "date")) " <- date (empty == now)")) + (p (input (@ (name "comments") (type "checkbox") + ,@(if (or (not post) (post-comments-open? post)) + `((checked "checked")) '()))) + (label (@ (for "comments")) " comments open?")) (div (textarea (@ (name "body") (rows "20") (cols "60")) ,(if post (post-raw-content post) ""))) (input (@ (type "submit") (name "status") diff --git a/tekuti/post.scm b/tekuti/post.scm index a0012a9..e295c9d 100644 --- a/tekuti/post.scm +++ b/tekuti/post.scm @@ -132,7 +132,7 @@ (for-each (lambda (k) (format #t "~a: ~a\n" k (assq-ref parsed k))) - '(timestamp tags status title name)))) + '(timestamp tags status title name comment_status)))) (content (with-output-to-blob (display (assq-ref parsed 'body)))) (key (assq-ref parsed 'key)) (message (format #f "~a: \"~a\"" @@ -173,15 +173,17 @@ (body (assoc-ref post-data "body")) (tags (assoc-ref post-data "tags")) (status (assoc-ref post-data "status")) + (comments-open? (assoc-ref post-data "comments")) (date-str (assoc-ref post-data "date"))) (let ((timestamp (if (string-null? date-str) (time-second (current-time)) - (rfc822-date->timestamp date))) + (rfc822-date->timestamp date-str))) (name (title->name title))) `((title . ,title) (body . ,body) (tags . ,tags) (status . ,status) + (comment_status . ,(if comments-open? "open" "closed")) (timestamp . ,timestamp) (name . ,name) (key . ,(url:encode