diff options
Diffstat (limited to 'modules/comment/helpers')
-rw-r--r-- | modules/comment/helpers/comment.php | 24 | ||||
-rw-r--r-- | modules/comment/helpers/comment_block.php | 8 | ||||
-rw-r--r-- | modules/comment/helpers/comment_event.php | 24 | ||||
-rw-r--r-- | modules/comment/helpers/comment_installer.php | 1 | ||||
-rw-r--r-- | modules/comment/helpers/comment_rss.php | 2 | ||||
-rw-r--r-- | modules/comment/helpers/comment_theme.php | 8 |
6 files changed, 47 insertions, 20 deletions
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"; |