diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2009-10-08 15:13:47 +0200 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2009-10-08 15:13:47 +0200 |
commit | 28c73ca74250aa95438f6ae88dcde759df225336 (patch) | |
tree | 1838ced159fee4525d8e1f598bbe72325be4f752 /main.lisp | |
parent | b78afdb907940e989129845be28888f3dbc8b297 (diff) |
Add a comment and trackback moderation page.
Ignore-this: 45d484506c4f5f4b0560f6397e5b61a2
darcs-hash:9cc1720d761894eff92ca76970a7c750dccc69d1
Diffstat (limited to 'main.lisp')
-rw-r--r-- | main.lisp | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -52,6 +52,7 @@ ((string= "preview" (car (last *subpath*))) :preview-entry) ((string= "trackback" (car (last *subpath*))) :post-trackback) ((string= "save" (car (last *subpath*))) :save-entry) + ((string= "moderate" (car (last *subpath*))) :moderate) (*post-number* :view) (t nil)))) (*method* (keywordify (gethash "REQUEST_METHOD" *http-env*))) @@ -96,6 +97,7 @@ (defun dispatch-admin-action () + #.(locally-enable-sql-reader-syntax) (case *action* (:preview-entry (let ((entry (and *post-number* (find-entry *post-number*)))) @@ -124,7 +126,24 @@ (title-of entry) (getf *query* :title)) (update-records-from-instance entry))) (show-web-journal)) - (otherwise (show-web-journal)))) + (:moderate (let* ((id (getf *query* :id nil)) + (type (getf *query* :type nil)) + (acceptp (getf *query* :acceptp nil)) + (table (if (string= type "trackback") + 'journal_trackback + 'journal_comment))) + (with-transaction () + (when (and id type acceptp (string= acceptp "t")) + (update-records table + :where [= [id] id] + :av-pairs `((spam_p "f")))) + (when (and id type acceptp (string= acceptp "f")) + (update-records table + :where [= [id] id] + :av-pairs `((spam_p "t"))))) + (show-moderation-page))) + (otherwise (show-web-journal))) + #.(restore-sql-reader-syntax-state)) (defun dispatch-user-action () |