summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorGravatar Andy Wingo2008-03-09 23:07:34 +0100
committerGravatar Andy Wingo2008-03-09 23:07:34 +0100
commitf1ef3f80cf69cbfdeaf4f5a532ec7fa4da1f772d (patch)
tree9b2944872471abeda5e33f327106aa7ec5506071
parentc0f32d5484a0f84c1c7f9aefb4087836848649be (diff)
downloadtekuti-f1ef3f80cf69cbfdeaf4f5a532ec7fa4da1f772d.tar.gz
tekuti-f1ef3f80cf69cbfdeaf4f5a532ec7fa4da1f772d.zip
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.
-rw-r--r--tekuti/page-helpers.scm4
-rw-r--r--tekuti/post.scm6
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