summaryrefslogtreecommitdiff
path: root/modules/comment/controllers
diff options
context:
space:
mode:
authorJozef Selesi <jozefs@users.sourceforge.net>2008-11-15 17:39:14 +0000
committerJozef Selesi <jozefs@users.sourceforge.net>2008-11-15 17:39:14 +0000
commitfbc810098f797d6cacecadb39fab2016ab9a8429 (patch)
treeaf688f8ce62b605cfac495f77cc3e8d973a0d263 /modules/comment/controllers
parent5e10b44a951a40d9877843b381a5ba6d6c511c48 (diff)
Do comment add in a single request, some code cleanup.
Diffstat (limited to 'modules/comment/controllers')
-rw-r--r--modules/comment/controllers/comment.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/modules/comment/controllers/comment.php b/modules/comment/controllers/comment.php
index fab18498..67a4897b 100644
--- a/modules/comment/controllers/comment.php
+++ b/modules/comment/controllers/comment.php
@@ -77,14 +77,21 @@ class Comment_Controller extends REST_Controller {
$comment->datetime = time();
$comment->item_id = $this->input->post('item_id');
$comment->save();
+
+ $data = array('valid' => true, 'html' => sprintf(comment::show_comment_list($item_id)));
} else {
- print $form->render("form.html");
+ $data = array('valid' => false, 'html' => sprintf($form->render("form.html")));
+ }
+
+ if (request::method() == "get") {
+ print $data['html'];
+ } else if (request::method() == "post") {
+ print json_encode($data);
}
}
public function get_item_comments($item_id) {
- $v = comment::show_comment_list($item_id);
- print $v;
+ print comment::show_comment_list($item_id);
}
/**