summaryrefslogtreecommitdiff
path: root/modules/comment
diff options
context:
space:
mode:
Diffstat (limited to 'modules/comment')
-rw-r--r--modules/comment/controllers/admin_comments.php8
-rw-r--r--modules/comment/controllers/comments.php8
-rw-r--r--modules/comment/css/comment.css45
-rw-r--r--modules/comment/helpers/comment.php24
-rw-r--r--modules/comment/helpers/comment_block.php8
-rw-r--r--modules/comment/helpers/comment_event.php24
-rw-r--r--modules/comment/helpers/comment_installer.php1
-rw-r--r--modules/comment/helpers/comment_rss.php2
-rw-r--r--modules/comment/helpers/comment_theme.php8
-rw-r--r--modules/comment/js/comment.js30
-rw-r--r--modules/comment/models/comment.php2
-rw-r--r--modules/comment/tests/Comment_Event_Test.php2
-rw-r--r--modules/comment/tests/Comment_Helper_Test.php6
-rw-r--r--modules/comment/tests/Comment_Model_Test.php8
-rw-r--r--modules/comment/views/admin_block_recent_comments.html.php6
-rw-r--r--modules/comment/views/admin_comments.html.php313
-rw-r--r--modules/comment/views/comment.html.php6
-rw-r--r--modules/comment/views/comments.html.php16
18 files changed, 303 insertions, 214 deletions
diff --git a/modules/comment/controllers/admin_comments.php b/modules/comment/controllers/admin_comments.php
index a164f79f..2c278d64 100644
--- a/modules/comment/controllers/admin_comments.php
+++ b/modules/comment/controllers/admin_comments.php
@@ -33,10 +33,10 @@ class Admin_Comments_Controller extends Admin_Controller {
public function menu_labels() {
$menu = $this->_menu($this->_counts());
- print json_encode(array($menu->get("unpublished")->label,
- $menu->get("published")->label,
- $menu->get("spam")->label,
- $menu->get("deleted")->label));
+ print json_encode(array($menu->get("unpublished")->label->for_js(),
+ $menu->get("published")->label->for_js(),
+ $menu->get("spam")->label->for_js(),
+ $menu->get("deleted")->label->for_js()));
}
public function queue($state) {
diff --git a/modules/comment/controllers/comments.php b/modules/comment/controllers/comments.php
index 82b12893..09b9c607 100644
--- a/modules/comment/controllers/comments.php
+++ b/modules/comment/controllers/comments.php
@@ -65,7 +65,7 @@ class Comments_Controller extends REST_Controller {
$form = comment::get_add_form($item);
$valid = $form->validate();
if ($valid) {
- if (user::active()->guest && !$form->add_comment->inputs["name"]->value) {
+ if (identity::active_user()->guest && !$form->add_comment->inputs["name"]->value) {
$form->add_comment->inputs["name"]->add_error("missing", 1);
$valid = false;
}
@@ -78,13 +78,13 @@ class Comments_Controller extends REST_Controller {
if ($valid) {
$comment = comment::create(
- $item, user::active(),
+ $item, identity::active_user(),
$form->add_comment->text->value,
$form->add_comment->inputs["name"]->value,
$form->add_comment->email->value,
$form->add_comment->url->value);
- $active = user::active();
+ $active = identity::active_user();
if ($active->guest) {
$form->add_comment->inputs["name"]->value("");
$form->add_comment->email->value("");
@@ -192,7 +192,7 @@ class Comments_Controller extends REST_Controller {
* @see REST_Controller::form_edit($resource)
*/
public function _form_edit($comment) {
- if (!user::active()->admin) {
+ if (!identity::active_user()->admin) {
access::forbidden();
}
print comment::get_edit_form($comment);
diff --git a/modules/comment/css/comment.css b/modules/comment/css/comment.css
new file mode 100644
index 00000000..f58391b0
--- /dev/null
+++ b/modules/comment/css/comment.css
@@ -0,0 +1,45 @@
+#g-content #g-comment-form {
+ margin-top: 2em;
+}
+
+#g-content #g-comments {
+ margin-top: 2em;
+ position: relative;
+}
+
+#g-content #g-comments ul li {
+ margin: 1em 0;
+}
+
+#g-content #g-comments .g-author {
+ border-bottom: 1px solid #ccc;
+ color: #999;
+ height: 32px;
+ line-height: 32px;
+}
+
+#g-content #g-comments ul li div {
+ padding: 0 8px 8px 43px;
+}
+
+#g-content #g-comments .g-avatar {
+ height: 32px;
+ margin-right: .4em;
+ width: 32px;
+}
+
+#g-admin-comment-button {
+ position: absolute;
+ right: 0;
+ top: 2px;
+}
+
+#g-admin-comments-menu {
+ margin: 1em 0;
+}
+
+#g-admin-comments-menu a {
+ margin: 0;
+ padding: .2em .6em;
+}
+
diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php
index f74a8644..35685d8c 100644
--- a/modules/comment/helpers/comment.php
+++ b/modules/comment/helpers/comment.php
@@ -65,17 +65,17 @@ class comment_Core {
}
static function get_add_form($item) {
- $form = new Forge("comments", "", "post", array("id" => "gAddCommentForm"));
+ $form = new Forge("comments", "", "post", array("id" => "g-comment-form"));
$group = $form->group("add_comment")->label(t("Add comment"));
- $group->input("name") ->label(t("Name")) ->id("gAuthor");
- $group->input("email") ->label(t("Email (hidden)")) ->id("gEmail");
- $group->input("url") ->label(t("Website (hidden)"))->id("gUrl");
- $group->textarea("text")->label(t("Comment")) ->id("gText");
+ $group->input("name") ->label(t("Name")) ->id("g-author");
+ $group->input("email") ->label(t("Email (hidden)")) ->id("g-email");
+ $group->input("url") ->label(t("Website (hidden)"))->id("g-url");
+ $group->textarea("text")->label(t("Comment")) ->id("g-text");
$group->hidden("item_id")->value($item->id);
module::event("comment_add_form", $form);
- $group->submit("")->value(t("Add"));
+ $group->submit("")->value(t("Add"))->class("ui-state-default ui-corner-all");
- $active = user::active();
+ $active = identity::active_user();
if (!$active->guest) {
$group->inputs["name"]->value($active->full_name)->disabled("disabled");
$group->email->value($active->email)->disabled("disabled");
@@ -90,12 +90,12 @@ class comment_Core {
static function get_edit_form($comment) {
$form = new Forge("comments/{$comment->id}?_method=put", "", "post",
- array("id" => "gEditCommentForm"));
+ array("id" => "g-edit-comment-form"));
$group = $form->group("edit_comment")->label(t("Edit comment"));
- $group->input("name") ->label(t("Author")) ->id("gAuthor");
- $group->input("email") ->label(t("Email (hidden)")) ->id("gEmail");
- $group->input("url") ->label(t("Website (hidden)"))->id("gUrl");
- $group->textarea("text")->label(t("Comment")) ->id("gText");
+ $group->input("name") ->label(t("Author")) ->id("g-author");
+ $group->input("email") ->label(t("Email (hidden)")) ->id("g-email");
+ $group->input("url") ->label(t("Website (hidden)"))->id("g-url");
+ $group->textarea("text")->label(t("Comment")) ->id("g-text");
$group->submit("")->value(t("Edit"));
$group->text = $comment->text;
diff --git a/modules/comment/helpers/comment_block.php b/modules/comment/helpers/comment_block.php
index 08182905..7cd5d429 100644
--- a/modules/comment/helpers/comment_block.php
+++ b/modules/comment/helpers/comment_block.php
@@ -18,16 +18,16 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class comment_block_Core {
- static function get_list() {
- return array("recent_comments" => t("Recent Comments"));
+ static function get_admin_list() {
+ return array("recent_comments" => t("Recent comments"));
}
static function get($block_id) {
$block = new Block();
switch ($block_id) {
case "recent_comments":
- $block->css_id = "gRecentComments";
- $block->title = t("Recent Comments");
+ $block->css_id = "g-recent-comments";
+ $block->title = t("Recent comments");
$block->content = new View("admin_block_recent_comments.html");
$block->content->comments =
ORM::factory("comment")->orderby("created", "DESC")->limit(5)->find_all();
diff --git a/modules/comment/helpers/comment_event.php b/modules/comment/helpers/comment_event.php
index 0234aea9..a72102b9 100644
--- a/modules/comment/helpers/comment_event.php
+++ b/modules/comment/helpers/comment_event.php
@@ -22,6 +22,28 @@ class comment_event_Core {
Database::instance()->delete("comments", array("item_id" => $item->id));
}
+ static function user_deleted($user) {
+ $guest = identity::guest();
+ Database::instance()->from("comments")
+ ->set(array("author_id" => $guest->id,
+ "guest_email" => null,
+ "guest_name" => "guest",
+ "guest_url" => null))
+ ->where(array("author_id" => $user->id))
+ ->update();
+ }
+
+ static function identity_provider_changed($old_provider, $new_provider) {
+ $guest = identity::guest();
+ Database::instance()->from("comments")
+ ->set(array("author_id" => $guest->id,
+ "guest_email" => null,
+ "guest_name" => "guest",
+ "guest_url" => null))
+ ->where("1 = 1")
+ ->update();
+ }
+
static function admin_menu($menu, $theme) {
$menu->get("content_menu")
->append(Menu::factory("link")
@@ -36,7 +58,7 @@ class comment_event_Core {
->id("comments")
->label(t("View comments on this item"))
->url("#comments")
- ->css_id("gCommentsLink"));
+ ->css_id("g-comments-link"));
}
static function item_index_data($item, $data) {
diff --git a/modules/comment/helpers/comment_installer.php b/modules/comment/helpers/comment_installer.php
index 80594c16..707a98d1 100644
--- a/modules/comment/helpers/comment_installer.php
+++ b/modules/comment/helpers/comment_installer.php
@@ -46,7 +46,6 @@ class comment_installer {
PRIMARY KEY (`id`))
DEFAULT CHARSET=utf8;");
- block_manager::add("dashboard_center", "comment", "recent_comments");
module::set_var("comment", "spam_caught", 0);
module::set_version("comment", 2);
}
diff --git a/modules/comment/helpers/comment_rss.php b/modules/comment/helpers/comment_rss.php
index 4424981d..3692a30d 100644
--- a/modules/comment/helpers/comment_rss.php
+++ b/modules/comment/helpers/comment_rss.php
@@ -61,7 +61,7 @@ class comment_rss_Core {
$feed->max_pages = ceil($comments->count_all() / $limit);
$feed->title = htmlspecialchars(t("Recent Comments"));
$feed->uri = url::abs_site("albums/" . (empty($id) ? "1" : $id));
- $feed->description = t("Recent Comments");
+ $feed->description = t("Recent comments");
return $feed;
}
diff --git a/modules/comment/helpers/comment_theme.php b/modules/comment/helpers/comment_theme.php
index e9b402f6..af0e1ca4 100644
--- a/modules/comment/helpers/comment_theme.php
+++ b/modules/comment/helpers/comment_theme.php
@@ -19,13 +19,19 @@
*/
class comment_theme_Core {
static function head($theme) {
+ $theme->css("comment.css");
$theme->script("comment.js");
return "";
}
+ static function admin_head($theme) {
+ $theme->css("comment.css");
+ return "";
+ }
+
static function photo_bottom($theme) {
$block = new Block;
- $block->css_id = "gComments";
+ $block->css_id = "g-comments";
$block->title = t("Comments");
$block->anchor = "comments";
diff --git a/modules/comment/js/comment.js b/modules/comment/js/comment.js
index bff83770..96370fb1 100644
--- a/modules/comment/js/comment.js
+++ b/modules/comment/js/comment.js
@@ -1,31 +1,43 @@
$("document").ready(function() {
- $("#gAddCommentButton").click(function(event) {
+ $("#g-admin-comment-button").click(function(event) {
event.preventDefault();
- if (!$("#gAddCommentForm").length) {
+ if (!$("#g-comment-form").length) {
$.get($(this).attr("href"),
{},
function(data) {
- $("#gCommentDetail").append(data);
+ $("#g-comment-detail").append(data);
ajaxify_comment_form();
});
}
});
+ $("#g-no-comments").click(function(event) {
+ event.preventDefault();
+ if (!$("#g-comment-form").length) {
+ $.get($(this).attr("href"),
+ {},
+ function(data) {
+ $("#g-comment-detail").append(data);
+ ajaxify_comment_form();
+ });
+ $("#g-no-comments-yet").remove();
+ }
+ });
});
function ajaxify_comment_form() {
- $("#gComments form").ajaxForm({
+ $("#g-comments form").ajaxForm({
dataType: "json",
success: function(data) {
if (data.form) {
- $("#gComments form").replaceWith(data.form);
+ $("#g-comments form").replaceWith(data.form);
ajaxify_comment_form();
}
if (data.result == "success") {
$.get(data.resource, function(data, textStatus) {
- $("#gComments .gBlockContent ul:first").append("<li>"+data+"</li>");
- $("#gComments .gBlockContent ul:first li:last").effect("highlight", {color: "#cfc"}, 8000);
- $("#gAddCommentForm").hide(2000).remove();
- $("#gNoCommentsYet").hide(2000);
+ $("#g-comments .g-block-content ul:first").append("<li>"+data+"</li>");
+ $("#g-comments .g-block-content ul:first li:last").effect("highlight", {color: "#cfc"}, 8000);
+ $("#g-comment-form").hide(2000).remove();
+ $("#g-no-comments-yet").hide(2000);
});
}
}
diff --git a/modules/comment/models/comment.php b/modules/comment/models/comment.php
index de9b0cd6..bb9b8833 100644
--- a/modules/comment/models/comment.php
+++ b/modules/comment/models/comment.php
@@ -23,7 +23,7 @@ class Comment_Model extends ORM {
}
function author() {
- return user::lookup($this->author_id);
+ return identity::lookup_user($this->author_id);
}
function author_name() {
diff --git a/modules/comment/tests/Comment_Event_Test.php b/modules/comment/tests/Comment_Event_Test.php
index c51c65c9..f650cabf 100644
--- a/modules/comment/tests/Comment_Event_Test.php
+++ b/modules/comment/tests/Comment_Event_Test.php
@@ -22,7 +22,7 @@ class Comment_Event_Test extends Unit_Test_Case {
$rand = rand();
$album = album::create(ORM::factory("item", 1), "test_$rand", "test_$rand");
$comment = comment::create(
- $album, user::guest(), "text_$rand", "name_$rand", "email_$rand", "url_$rand");
+ $album, identity::guest(), "text_$rand", "name_$rand", "email_$rand", "url_$rand");
$album->delete();
diff --git a/modules/comment/tests/Comment_Helper_Test.php b/modules/comment/tests/Comment_Helper_Test.php
index f84fe0f9..82b7ebd2 100644
--- a/modules/comment/tests/Comment_Helper_Test.php
+++ b/modules/comment/tests/Comment_Helper_Test.php
@@ -24,6 +24,7 @@ class Comment_Helper_Test extends Unit_Test_Case {
public function setup() {
$this->_ip_address = Input::instance()->ip_address;
$this->_user_agent = Kohana::$user_agent;
+ $this->_save = $_SERVER;
$_SERVER["HTTP_ACCEPT"] = "HTTP_ACCEPT";
$_SERVER["HTTP_ACCEPT_CHARSET"] = "HTTP_ACCEPT_CHARSET";
@@ -42,13 +43,14 @@ class Comment_Helper_Test extends Unit_Test_Case {
public function teardown() {
Input::instance()->ip_address = $this->_ip_address;
Kohana::$user_agent = $this->_user_agent;
+ $_SERVER = $this->_save;
}
public function create_comment_for_guest_test() {
$rand = rand();
$root = ORM::factory("item", 1);
$comment = comment::create(
- $root, user::guest(), "text_$rand", "name_$rand", "email_$rand", "url_$rand");
+ $root, identity::guest(), "text_$rand", "name_$rand", "email_$rand", "url_$rand");
$this->assert_equal("name_$rand", $comment->author_name());
$this->assert_equal("email_$rand", $comment->author_email());
@@ -77,7 +79,7 @@ class Comment_Helper_Test extends Unit_Test_Case {
public function create_comment_for_user_test() {
$rand = rand();
$root = ORM::factory("item", 1);
- $admin = user::lookup(2);
+ $admin = identity::admin_user();
$comment = comment::create(
$root, $admin, "text_$rand", "name_$rand", "email_$rand", "url_$rand");
diff --git a/modules/comment/tests/Comment_Model_Test.php b/modules/comment/tests/Comment_Model_Test.php
index f4c68b15..de19648d 100644
--- a/modules/comment/tests/Comment_Model_Test.php
+++ b/modules/comment/tests/Comment_Model_Test.php
@@ -22,17 +22,17 @@ class Comment_Model_Test extends Unit_Test_Case {
public function cant_view_comments_for_unviewable_items_test() {
$root = ORM::factory("item", 1);
$album = album::create($root, rand(), rand(), rand());
- $comment = comment::create($album, user::guest(), "text", "name", "email", "url");
- user::set_active(user::guest());
+ $comment = comment::create($album, identity::guest(), "text", "name", "email", "url");
+ identity::set_active_user(identity::guest());
// We can see the comment when permissions are granted on the album
- access::allow(group::everybody(), "view", $album);
+ access::allow(identity::everybody(), "view", $album);
$this->assert_equal(
1,
ORM::factory("comment")->viewable()->where("comments.id", $comment->id)->count_all());
// We can't see the comment when permissions are denied on the album
- access::deny(group::everybody(), "view", $album);
+ access::deny(identity::everybody(), "view", $album);
$this->assert_equal(
0,
ORM::factory("comment")->viewable()->where("comments.id", $comment->id)->count_all());
diff --git a/modules/comment/views/admin_block_recent_comments.html.php b/modules/comment/views/admin_block_recent_comments.html.php
index 2afa5bf8..d9776def 100644
--- a/modules/comment/views/admin_block_recent_comments.html.php
+++ b/modules/comment/views/admin_block_recent_comments.html.php
@@ -1,9 +1,9 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<ul>
- <? foreach ($comments as $i => $comment): ?>
- <li class="<?= ($i % 2 == 0) ? "gEvenRow" : "gOddRow" ?>">
+ <? foreach ($comments as $comment): ?>
+ <li class="<?= text::alternate("g-even", "g-odd") ?>">
<img src="<?= $comment->author()->avatar_url(32, $theme->url("images/avatar.jpg", true)) ?>"
- class="gAvatar"
+ class="g-avatar"
alt="<?= html::clean_attribute($comment->author_name()) ?>"
width="32"
height="32" />
diff --git a/modules/comment/views/admin_comments.html.php b/modules/comment/views/admin_comments.html.php
index 455cd714..20236a7a 100644
--- a/modules/comment/views/admin_comments.html.php
+++ b/modules/comment/views/admin_comments.html.php
@@ -6,7 +6,7 @@
$.get(set_state_url.replace("__STATE__", state).replace("__ID__", id),
{},
function() {
- $("#gComment-" + id).slideUp();
+ $("#g-comment-" + id).slideUp();
update_menu();
});
}
@@ -18,7 +18,7 @@
$.get(delete_url.replace("__ID__", id),
{},
function() {
- $("#gComment-" + id).slideUp();
+ $("#g-comment-" + id).slideUp();
update_menu();
});
}
@@ -27,172 +27,175 @@
$.get(<?= html::js_string(url::site("admin/comments/menu_labels")) ?>, {},
function(data) {
for (var i = 0; i < data.length; i++) {
- $("#gAdminCommentsMenu li:eq(" + i + ") a").html(data[i]);
+ $("#g-admin-comments-menu li:eq(" + i + ") a").html(data[i]);
}
},
"json");
}
</script>
-<div id="gAdminComments">
- <h1> <?= t("Manage Comments") ?> </h1>
+<div id="g-admin-comments" class="g-block">
+ <h1> <?= t("Manage comments") ?> </h1>
- <!-- @todo: Highlight active menu option -->
- <div id="gAdminCommentsMenu">
- <?= $menu ?>
- </div>
+ <div class="g-block-content">
+ <!-- @todo: Highlight active menu option -->
+ <div id="g-admin-comments-menu" class="ui-helper-clearfix">
+ <?= $menu->render() ?>
+ </div>
- <!-- @todo: Remove after setting active option? -->
- <h2>
- <? if ($state == "published"): ?>
- <?= t("Approved Comments") ?>
- <? elseif ($state == "unpublished"): ?>
- <?= t("Comments Awaiting Moderation") ?>
- <? elseif ($state == "spam"): ?>
- <?= t("Spam Comments") ?>
- <? elseif ($state == "deleted"): ?>
- <?= t("Recently Deleted Comments") ?>
- <? endif ?>
- </h2>
+ <!-- @todo: Remove after setting active option? -->
+ <h2>
+ <? if ($state == "published"): ?>
+ <?= t("Approved comments") ?>
+ <? elseif ($state == "unpublished"): ?>
+ <?= t("Comments awaiting moderation") ?>
+ <? elseif ($state == "spam"): ?>
+ <?= t("Spam comments") ?>
+ <? elseif ($state == "deleted"): ?>
+ <?= t("Recently deleted comments") ?>
+ <? endif ?>
+ </h2>
- <? if ($state == "spam"): ?>
- <div>
- <? $spam_caught = module::get_var("comment", "spam_caught") ?>
- <? if ($spam_caught > 0): ?>
- <p>
- <?= t2("Gallery has caught %count spam for you since you installed spam filtering.",
- "Gallery has caught %count spam for you since you installed spam filtering.",
- $spam_caught) ?>
- </p>
- <? endif ?>
- <p>
- <? if ($counts->spam): ?>
- <?= t2("There is currently one comment in your spam queue. You can delete it with a single click, but there is no undo operation so you may want to check the message first to make sure that it really is spam.",
- "There are currently %count comments in your spam queue. You can delete them all with a single click, but there is no undo operation so you may want to check the messages first to make sure that they really are spam. All spam messages will be deleted after 7 days automatically.",
- $counts->spam) ?>
- </p>
- <p>
- <a href="<?= url::site("admin/comments/delete_all_spam?csrf=$csrf") ?>">
- <?= t("Delete all spam") ?>
- </a>
- <? else: ?>
- <?= t("Your spam queue is empty!") ?>
+ <? if ($state == "spam"): ?>
+ <div>
+ <? $spam_caught = module::get_var("comment", "spam_caught") ?>
+ <? if ($spam_caught > 0): ?>
+ <p>
+ <?= t2("Gallery has caught %count spam for you since you installed spam filtering.",
+ "Gallery has caught %count spam for you since you installed spam filtering.",
+ $spam_caught) ?>
+ </p>
<? endif ?>
- </p>
- </div>
- <? endif ?>
+ <p>
+ <? if ($counts->spam): ?>
+ <?= t2("There is currently one comment in your spam queue. You can delete it with a single click, but there is no undo operation so you may want to check the message first to make sure that it really is spam.",
+ "There are currently %count comments in your spam queue. You can delete them all with a single click, but there is no undo operation so you may want to check the messages first to make sure that they really are spam. All spam messages will be deleted after 7 days automatically.",
+ $counts->spam) ?>
+ </p>
+ <p>
+ <a href="<?= url::site("admin/comments/delete_all_spam?csrf=$csrf") ?>">
+ <?= t("Delete all spam") ?>
+ </a>
+ <? else: ?>
+ <?= t("Your spam queue is empty!") ?>
+ <? endif ?>
+ </p>
+ </div>
+ <? endif ?>
- <? if ($state == "deleted"): ?>
- <div>
- <p>
- <?= t("These are messages that have been recently deleted. They will be permanently erased automatically after 7 days.") ?>
- </p>
- </div>
- <? endif ?>
+ <? if ($state == "deleted"): ?>
+ <div>
+ <p>
+ <?= t("These are messages that have been recently deleted. They will be permanently erased automatically after 7 days.") ?>
+ </p>
+ </div>
+ <? endif ?>
- <table id="gAdminCommentsList">
- <tr>
- <th>
- <?= t("Author") ?>
- </th>
- <th>
- <?= t("Comment") ?>
- </th>
- <th>
- <?= t("Actions") ?>
- </th>
- </tr>
- <? foreach ($comments as $i => $comment): ?>
- <tr id="gComment-<?= $comment->id ?>" class="<?= ($i % 2 == 0) ? "gOddRow" : "gEvenRow" ?>">
- <td>
- <a href="#">
- <img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>"
- class="gAvatar"
- alt="<?= html::clean_attribute($comment->author_name()) ?>"
- width="40"
- height="40" />
- </a>
- <p><a href="mailto:<?= html::clean_attribute($comment->author_email()) ?>"
- title="<?= html::clean_attribute($comment->author_email()) ?>"> <?= html::clean($comment->author_name()) ?> </a></p>
- </td>
- <td>
- <div class="right">
- <? $item = $comment->item() ?>
- <div class="gItem gPhoto">
- <a href="<?= $item->url() ?>">
- <? if ($item->has_thumb()): ?>
- <img src="<?= $item->thumb_url() ?>"
- alt="<?= html::purify($item->title)->for_html_attr() ?>"
- <?= photo::img_dimensions($item->thumb_width, $item->thumb_height, 75) ?>
- />
- <? else: ?>
- <?= t("No thumbnail") ?>
- <? endif ?>
- </a>
+ <table id="g-admin-comments-list">
+ <tr>
+ <th>
+ <?= t("Author") ?>
+ </th>
+ <th>
+ <?= t("Comment") ?>
+ </th>
+ <th>
+ <?= t("Actions") ?>
+ </th>
+ </tr>
+ <? foreach ($comments as $comment): ?>
+ <tr id="g-comment-<?= $comment->id ?>" class="<?= text::alternate("g-odd", "g-even") ?>">
+ <td>
+ <a href="#">
+ <img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>"
+ class="g-avatar"
+ alt="<?= html::clean_attribute($comment->author_name()) ?>"
+ width="40"
+ height="40" />
+ </a>
+ <p><a href="mailto:<?= html::clean_attribute($comment->author_email()) ?>"
+ title="<?= html::clean_attribute($comment->author_email()) ?>"> <?= html::clean($comment->author_name()) ?> </a></p>
+ </td>
+ <td>
+ <div class="g-right">
+ <? $item = $comment->item() ?>
+ <div class="g-item g-photo">
+ <a href="<?= $item->url() ?>">
+ <? if ($item->has_thumb()): ?>
+ <img src="<?= $item->thumb_url() ?>"
+ alt="<?= html::purify($item->title)->for_html_attr() ?>"
+ <?= photo::img_dimensions($item->thumb_width, $item->thumb_height, 75) ?>
+ />
+ <? else: ?>
+ <?= t("No thumbnail") ?>
+ <? endif ?>
+ </a>
+ </div>
</div>
- </div>
- <p><?= gallery::date($comment->created) ?></p>
- <?= nl2br(html::purify($comment->text)) ?>
- </td>
- <td>
- <ul class="gButtonSetVertical">
- <? if ($comment->state != "unpublished"): ?>
- <li>
- <a href="javascript:set_state('unpublished',<?=$comment->id?>)"
- class="gButtonLink ui-state-default ui-icon-left">
- <span class="ui-icon ui-icon-check"></span>
- <?= t("Unapprove") ?>
- </a>
- </li>
- <? endif ?>
- <? if ($comment->state != "published"): ?>
- <li>
- <a href="javascript:set_state('published',<?=$comment->id?>)"
- class="gButtonLink ui-state-default ui-icon-left">
- <span class="ui-icon ui-icon-check"></span>
- <?= t("Approve") ?>
- </a>
- </li>
- <? endif ?>
- <? if ($comment->state != "spam"): ?>
- <li>
- <a href="javascript:set_state('spam',<?=$comment->id?>)"
- class="gButtonLink ui-state-default ui-icon-left">
- <span class="ui-icon ui-icon-cancel"></span>
- <?= t("Spam") ?>
- </a>
- </li>
- <? endif ?>
- <!--
- <li>
- <a href="javascript:reply(<?=$comment->id?>)"
- class="gButtonLink ui-state-default ui-icon-left">
- <span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>
- <?= t("Reply") ?>
- </a>
- </li>
- <li>
- <a href="javascript:Edit(<?=$comment->id?>)"
- class="gButtonLink ui-state-default ui-icon-left">
- <span class="ui-icon ui-icon-pencil"></span>
- <?= t("Edit") ?>
- </a>
- </li>
- -->
- <li>
- <a href="javascript:set_state('deleted',<?=$comment->id?>)"
- class="gButtonLink ui-state-default ui-icon-left">
- <span class="ui-icon ui-icon-trash"></span>
- <?= t("Delete") ?>
- </a>
- </li>
- </ul>
- </td>
- </tr>
- <? endforeach ?>
- </table>
+ <p><?= gallery::date($comment->created) ?></p>
+ <?= nl2br(html::purify($comment->text)) ?>
+ </td>
+ <td>
+ <ul class="g-buttonset-vertical">
+ <? if ($comment->state != "unpublished"): ?>
+ <li>
+ <a href="javascript:set_state('unpublished',<?=$comment->id?>)"
+ class="g-button ui-state-default ui-icon-left">
+ <span class="ui-icon ui-icon-check"></span>
+ <?= t("Unapprove") ?>
+ </a>
+ </li>
+ <? endif ?>
+ <? if ($comment->state != "published"): ?>
+ <li>
+ <a href="javascript:set_state('published',<?=$comment->id?>)"
+ class="g-button ui-state-default ui-icon-left">
+ <span class="ui-icon ui-icon-check"></span>
+ <?= t("Approve") ?>
+ </a>
+ </li>
+ <? endif ?>
+ <? if ($comment->state != "spam"): ?>
+ <li>
+ <a href="javascript:set_state('spam',<?=$comment->id?>)"
+ class="g-button ui-state-default ui-icon-left">
+ <span class="ui-icon ui-icon-cancel"></span>
+ <?= t("Spam") ?>
+ </a>
+ </li>
+ <? endif ?>
+ <!--
+ <li>
+ <a href="javascript:reply(<?=$comment->id?>)"
+ class="g-button ui-state-default ui-icon-left">
+ <span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>
+ <?= t("Reply") ?>
+ </a>
+ </li>
+ <li>
+ <a href="javascript:Edit(<?=$comment->id?>)"
+ class="g-button ui-state-default ui-icon-left">
+ <span class="ui-icon ui-icon-pencil"></span>
+ <?= t("Edit") ?>
+ </a>
+ </li>
+ -->
+ <li>
+ <a href="javascript:set_state('deleted',<?=$comment->id?>)"
+ class="g-button ui-state-default ui-icon-left">
+ <span class="ui-icon ui-icon-trash"></span>
+ <?= t("Delete") ?>
+ </a>
+ </li>
+ </ul>
+ </td>
+ </tr>
+ <? endforeach ?>
+ </table>
+
+ <div class="g-pager">
+ <?= $pager ?>
+ </div>
- <div class="pager">
- <?= $pager ?>
</div>
</div>
diff --git a/modules/comment/views/comment.html.php b/modules/comment/views/comment.html.php
index ce4e197d..c7957c15 100644
--- a/modules/comment/views/comment.html.php
+++ b/modules/comment/views/comment.html.php
@@ -1,9 +1,9 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
-<li id="gComment-<?= $comment->id; ?>">
- <p class="gAuthor">
+<li id="g-comment-<?= $comment->id; ?>">
+ <p class="g-author">
<a href="#">
<img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>"
- class="gAvatar"
+ class="g-avatar"
alt="<?= html::clean_attribute($comment->author_name()) ?>"
width="40"
height="40" />
diff --git a/modules/comment/views/comments.html.php b/modules/comment/views/comments.html.php
index 7eb34c20..fc54e3d2 100644
--- a/modules/comment/views/comments.html.php
+++ b/modules/comment/views/comments.html.php
@@ -1,23 +1,23 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
- <a href="<?= url::site("form/add/comments/{$item->id})") ?>" id="gAddCommentButton"
- class="gButtonLink ui-corner-all ui-icon-left ui-state-default right">
+ <a href="<?= url::site("form/add/comments/{$item->id}") ?>" id="g-admin-comment-button"
+ class="g-button ui-corner-all ui-icon-left ui-state-default right">
<span class="ui-icon ui-icon-comment"></span>
<?= t("Add a comment") ?>
</a>
-<div id="gCommentDetail">
+<div id="g-comment-detail">
<? if (!$comments->count()): ?>
-<p id="gNoCommentsYet">
+<p id="g-no-comments-yet">
<?= t("No comments yet. Be the first to <a %attrs>comment</a>!",
- array("attrs" => html::mark_clean("href=\"#add_comment_form\" class=\"showCommentForm\""))) ?>
+ array("attrs" => html::mark_clean("id= \"g-no-comments\" href=\"" . url::site("form/add/comments/{$item->id}") . "\" class=\"showCommentForm\""))) ?>
</p>
<? endif ?>
<ul>
<? foreach ($comments as $comment): ?>
- <li id="gComment-<?= $comment->id ?>">
- <p class="gAuthor">
+ <li id="g-comment-<?= $comment->id ?>">
+ <p class="g-author">
<a href="#">
<img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>"
- class="gAvatar"
+ class="g-avatar"
alt="<?= html::clean_attribute($comment->author_name()) ?>"
width="40"
height="40" />