diff options
-rw-r--r-- | modules/comment/controllers/admin_comments.php | 34 | ||||
-rw-r--r-- | modules/comment/views/admin_comments.html.php | 4 |
2 files changed, 22 insertions, 16 deletions
diff --git a/modules/comment/controllers/admin_comments.php b/modules/comment/controllers/admin_comments.php index a4b1a94c..c5fab259 100644 --- a/modules/comment/controllers/admin_comments.php +++ b/modules/comment/controllers/admin_comments.php @@ -25,6 +25,7 @@ class Admin_Comments_Controller extends Admin_Controller { $view->content->published = $this->_query(array("published")); $view->content->unpublished = $this->_query(array("unpublished")); $view->content->spam = $this->_query(array("spam")); + $view->content->deleted = $this->_query(array("deleted")); $view->content->menu = Menu::factory("root") ->append(Menu::factory("link") ->id("unpublished") @@ -43,7 +44,13 @@ class Admin_Comments_Controller extends Admin_Controller { ->label(t(array("one" => "Spam ({{count}})", "other" => "Spam ({{count}})"), array("count" => $view->content->spam->count()))) - ->url(url::site("admin/comments/queue/spam"))); + ->url(url::site("admin/comments/queue/spam"))) + ->append(Menu::factory("link") + ->id("deleted") + ->label(t(array("one" => "Recently Deleted ({{count}})", + "other" => "Recently Deleted ({{count}})"), + array("count" => $view->content->deleted->count()))) + ->url(url::site("admin/comments/queue/deleted"))); return $view; } @@ -55,7 +62,8 @@ class Admin_Comments_Controller extends Admin_Controller { $view = $this->_get_base_view(); print json_encode(array($view->content->menu->get("unpublished")->label, $view->content->menu->get("published")->label, - $view->content->menu->get("spam")->label)); + $view->content->menu->get("spam")->label, + $view->content->menu->get("deleted")->label)); } public function queue($state) { @@ -77,15 +85,20 @@ class Admin_Comments_Controller extends Admin_Controller { $view->content->comments = $view->content->spam; $view->content->spam_caught = module::get_var("comment", "spam_caught"); break; + + case "deleted": + $view->content->title = t("Recently Deleted Comments"); + $view->content->comments = $view->content->deleted; + break; } $view->content->queue = $state; $view->content->pager = new Pagination(); $view->content->pager->initialize( - array('query_string' => 'page', - 'total_items' => $view->content->comments->count(), - 'items_per_page' => 20, - 'style' => 'classic')); + array("query_string" => "page", + "total_items" => $view->content->comments->count(), + "items_per_page" => 20, + "style" => "classic")); print $view; } @@ -110,15 +123,6 @@ class Admin_Comments_Controller extends Admin_Controller { } } - public function delete($id) { - access::verify_csrf(); - $comment = ORM::factory("comment", $id); - if ($comment->loaded) { - module::event("comment_before_delete", $comment); - $comment->delete(); - } - } - public function delete_all_spam() { access::verify_csrf(); ORM::factory("comment") diff --git a/modules/comment/views/admin_comments.html.php b/modules/comment/views/admin_comments.html.php index ae3051ad..4091270b 100644 --- a/modules/comment/views/admin_comments.html.php +++ b/modules/comment/views/admin_comments.html.php @@ -155,13 +155,15 @@ function update_menu() { <?= t("Reply") ?> </a> </li> + <li> <a href="javascript:Edit(<?=$comment->id?>)"> <?= t("Edit") ?> </a> </li> + <li> - <a href="javascript:del(<?=$comment->id?>)"> + <a href="javascript:set_state('deleted',<?=$comment->id?>)"> <?= t("Delete") ?> </a> </li> |