1
0
Fork 0

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.
This commit is contained in:
Andy Wingo 2008-03-09 23:07:34 +01:00
parent c0f32d5484
commit f1ef3f80cf
2 changed files with 8 additions and 2 deletions

View file

@ -75,6 +75,10 @@
(timestamp->rfc822-date (post-timestamp post)) (timestamp->rfc822-date (post-timestamp post))
"")))) ""))))
(label (@ (for "date")) " <- date (empty == now)")) (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")) (div (textarea (@ (name "body") (rows "20") (cols "60"))
,(if post (post-raw-content post) ""))) ,(if post (post-raw-content post) "")))
(input (@ (type "submit") (name "status") (input (@ (type "submit") (name "status")

View file

@ -132,7 +132,7 @@
(for-each (for-each
(lambda (k) (lambda (k)
(format #t "~a: ~a\n" k (assq-ref parsed 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)))) (content (with-output-to-blob (display (assq-ref parsed 'body))))
(key (assq-ref parsed 'key)) (key (assq-ref parsed 'key))
(message (format #f "~a: \"~a\"" (message (format #f "~a: \"~a\""
@ -173,15 +173,17 @@
(body (assoc-ref post-data "body")) (body (assoc-ref post-data "body"))
(tags (assoc-ref post-data "tags")) (tags (assoc-ref post-data "tags"))
(status (assoc-ref post-data "status")) (status (assoc-ref post-data "status"))
(comments-open? (assoc-ref post-data "comments"))
(date-str (assoc-ref post-data "date"))) (date-str (assoc-ref post-data "date")))
(let ((timestamp (if (string-null? date-str) (let ((timestamp (if (string-null? date-str)
(time-second (current-time)) (time-second (current-time))
(rfc822-date->timestamp date))) (rfc822-date->timestamp date-str)))
(name (title->name title))) (name (title->name title)))
`((title . ,title) `((title . ,title)
(body . ,body) (body . ,body)
(tags . ,tags) (tags . ,tags)
(status . ,status) (status . ,status)
(comment_status . ,(if comments-open? "open" "closed"))
(timestamp . ,timestamp) (timestamp . ,timestamp)
(name . ,name) (name . ,name)
(key . ,(url:encode (key . ,(url:encode