summaryrefslogtreecommitdiff
path: root/modules/comment/views
diff options
context:
space:
mode:
authorTristan Zur <tzur@webserver.ccwn.org>2015-06-10 20:55:53 +0200
committerTristan Zur <tzur@webserver.ccwn.org>2015-06-10 20:55:53 +0200
commit406abd7c4df1ace2cd3e4e17159e8941a2e8c0c4 (patch)
treea324be16021f44f2fd6d55e609f47024e945b1db /modules/comment/views
Initial import
Diffstat (limited to 'modules/comment/views')
-rw-r--r--modules/comment/views/admin_block_recent_comments.html.php23
-rw-r--r--modules/comment/views/admin_comments.html.php7
-rw-r--r--modules/comment/views/admin_manage_comments.html.php46
-rw-r--r--modules/comment/views/admin_manage_comments_queue.html.php157
-rw-r--r--modules/comment/views/comment.html.php25
-rw-r--r--modules/comment/views/comment.mrss.php43
-rw-r--r--modules/comment/views/comments.html.php56
-rw-r--r--modules/comment/views/user_profile_comments.html.php20
8 files changed, 377 insertions, 0 deletions
diff --git a/modules/comment/views/admin_block_recent_comments.html.php b/modules/comment/views/admin_block_recent_comments.html.php
new file mode 100644
index 0000000..4017e4f
--- /dev/null
+++ b/modules/comment/views/admin_block_recent_comments.html.php
@@ -0,0 +1,23 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<ul>
+ <? 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="g-avatar"
+ alt="<?= html::clean_attribute($comment->author_name()) ?>"
+ width="32"
+ height="32" />
+ <?= gallery::date_time($comment->created) ?>
+ <? if ($comment->author()->guest): ?>
+ <?= t('%author_name said <em>%comment_text</em>',
+ array("author_name" => html::clean($comment->author_name()),
+ "comment_text" => text::limit_words(nl2br(html::purify($comment->text)), 50))); ?>
+ <? else: ?>
+ <?= t('<a href="%url">%author_name</a> said <em>%comment_text</em>',
+ array("author_name" => html::clean($comment->author_name()),
+ "url" => user_profile::url($comment->author_id),
+ "comment_text" => text::limit_words(nl2br(html::purify($comment->text)), 50))); ?>
+ <? endif ?>
+ </li>
+ <? endforeach ?>
+</ul>
diff --git a/modules/comment/views/admin_comments.html.php b/modules/comment/views/admin_comments.html.php
new file mode 100644
index 0000000..dc6985b
--- /dev/null
+++ b/modules/comment/views/admin_comments.html.php
@@ -0,0 +1,7 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div class="g-block">
+ <h1> <?= t("Comment settings") ?> </h1>
+ <div class="g-block-content">
+ <?= $form ?>
+ </div>
+</div>
diff --git a/modules/comment/views/admin_manage_comments.html.php b/modules/comment/views/admin_manage_comments.html.php
new file mode 100644
index 0000000..e3c8546
--- /dev/null
+++ b/modules/comment/views/admin_manage_comments.html.php
@@ -0,0 +1,46 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<script type="text/javascript">
+ var set_state_url =
+ <?= html::js_string(url::site("admin/manage_comments/set_state/__ID__/__STATE__?csrf=$csrf")) ?>;
+ var set_state = function(state, id) {
+ $("#g-comment-" + id).fadeOut("fast", function() {
+ $.get(set_state_url.replace("__STATE__", state).replace("__ID__", id),
+ {},
+ update_menu);
+ });
+ }
+
+ var update_menu = function() {
+ $.get(<?= html::js_string(url::site("admin/manage_comments/menu_labels")) ?>, {},
+ function(data) {
+ for (var i = 0; i < data.length; i++) {
+ $("#g-admin-comments ul li:eq(" + i + ") a").html(data[i]);
+ }
+ },
+ "json");
+ }
+
+ // Paginator clicks load their href in the active tab panel
+ var fix_links = function() {
+ $(".g-paginator a, a#g-delete-all-spam").click(function(event) {
+ event.stopPropagation();
+ $.scrollTo(0, 800, { easing: "swing" });
+ $(this).parents(".ui-tabs-panel").load(
+ $(this).attr("href"),
+ function() {
+ fix_links();
+ });
+ return false;
+ });
+ }
+
+ $(document).ready(function() {
+ $("#g-admin-comments").tabs({
+ show: fix_links,
+ });
+ });
+</script>
+
+<div id="g-admin-comments" class="g-block">
+ <?= $menu->render() ?>
+</div>
diff --git a/modules/comment/views/admin_manage_comments_queue.html.php b/modules/comment/views/admin_manage_comments_queue.html.php
new file mode 100644
index 0000000..d847d72
--- /dev/null
+++ b/modules/comment/views/admin_manage_comments_queue.html.php
@@ -0,0 +1,157 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div class="g-block-content">
+ <? 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 id="g-delete-all-spam"
+ href="<?= url::site("admin/manage_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 ?>
+
+ <div class="g-paginator">
+ <?= $theme->paginator() ?>
+ </div>
+ <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, $fallback_avatar_url) ?>"
+ 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>
+ <p><?= gallery::date($comment->created) ?></p>
+ <?= nl2br(html::purify($comment->text)) ?>
+ </td>
+ <td>
+ <ul class="g-buttonset-vertical">
+ <? if ($comment->state != "unpublished" && $comment->state != "deleted"): ?>
+ <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>
+ <? if ($state == "deleted"): ?>
+ <?= t("Undelete") ?>
+ <? else: ?>
+ <?= t("Approve") ?>
+ <? endif ?>
+ </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>
+ -->
+ <? if ($comment->state != "deleted"): ?>
+ <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>
+ <? endif ?>
+ </ul>
+ </td>
+ </tr>
+ <? endforeach ?>
+ </table>
+
+ <div class="g-paginator">
+ <?= $theme->paginator() ?>
+ </div>
+</div>
diff --git a/modules/comment/views/comment.html.php b/modules/comment/views/comment.html.php
new file mode 100644
index 0000000..263e5f9
--- /dev/null
+++ b/modules/comment/views/comment.html.php
@@ -0,0 +1,25 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<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="g-avatar"
+ alt="<?= html::clean_attribute($comment->author_name()) ?>"
+ width="40"
+ height="40" />
+ </a>
+ <? if ($comment->author()->guest): ?>
+ <?= t("on %date_time, %name said",
+ array("date_time" => gallery::date_time($comment->created),
+ "name" => html::clean($comment->author_name()))) ?>
+ <? else: ?>
+ <?= t("on %date_time, <a href=\"%url\">%name</a> said",
+ array("date_time" => gallery::date_time($comment->created),
+ "url" => user_profile::url($comment->author_id),
+ "name" => html::clean($comment->author_name()))) ?>
+ <? endif ?>
+ </p>
+ <div>
+ <?= nl2br(html::purify($comment->text)) ?>
+ </div>
+</li>
diff --git a/modules/comment/views/comment.mrss.php b/modules/comment/views/comment.mrss.php
new file mode 100644
index 0000000..809e789
--- /dev/null
+++ b/modules/comment/views/comment.mrss.php
@@ -0,0 +1,43 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<? echo "<?xml version=\"1.0\" ?>" ?>
+<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"
+ xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:content="http://purl.org/rss/1.0/modules/content/"
+ xmlns:fh="http://purl.org/syndication/history/1.0">
+ <channel>
+ <generator>Gallery 3</generator>
+ <title><?= html::clean($feed->title) ?></title>
+ <link><?= $feed->uri ?></link>
+ <description><?= html::clean($feed->description) ?></description>
+ <language>en-us</language>
+ <atom:link rel="self" href="<?= $feed->uri ?>" type="application/rss+xml" />
+ <fh:complete/>
+ <? if (!empty($feed->previous_page_uri)): ?>
+ <atom:link rel="previous" href="<?= $feed->previous_page_uri ?>" type="application/rss+xml" />
+ <? endif ?>
+ <? if (!empty($feed->next_page_uri)): ?>
+ <atom:link rel="next" href="<?= $feed->next_page_uri ?>" type="application/rss+xml" />
+ <? endif ?>
+ <pubDate><?= $pub_date ?></pubDate>
+ <lastBuildDate><?= $pub_date ?></lastBuildDate>
+ <? foreach ($feed->comments as $comment): ?>
+ <item>
+ <title><?= html::purify($comment->title) ?></title>
+ <link><?= html::clean($comment->item_uri) ?></link>
+ <author><?= html::clean($comment->author) ?></author>
+ <guid isPermaLink="true"><?= $comment->item_uri ?></guid>
+ <pubDate><?= $comment->pub_date ?></pubDate>
+ <content:encoded>
+ <![CDATA[
+ <p><?= nl2br(html::purify($comment->text)) ?></p>
+ <p>
+ <img alt="" src="<?= $comment->thumb_url ?>"
+ height="<?= $comment->thumb_height ?>" width="<?= $comment->thumb_width ?>" />
+ <br />
+ </p>
+ ]]>
+ </content:encoded>
+ </item>
+ <? endforeach ?>
+ </channel>
+</rss>
diff --git a/modules/comment/views/comments.html.php b/modules/comment/views/comments.html.php
new file mode 100644
index 0000000..b524f5d
--- /dev/null
+++ b/modules/comment/views/comments.html.php
@@ -0,0 +1,56 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<? if (comment::can_comment()): ?>
+<a href="<?= url::site("form/add/comments/{$item->id}") ?>#comment-form" id="g-add-comment"
+ class="g-button ui-corner-all ui-icon-left ui-state-default">
+ <span class="ui-icon ui-icon-comment"></span>
+ <?= t("Add a comment") ?>
+</a>
+<? endif ?>
+
+<div id="g-comment-detail">
+ <? if (!$comments->count()): ?>
+ <p class="g-no-comments">
+ <? if (comment::can_comment()): ?>
+ <?= t("No comments yet. Be the first to <a %attrs>comment</a>!",
+ array("attrs" => html::mark_clean("href=\"" . url::site("form/add/comments/{$item->id}") . "\" class=\"showCommentForm\""))) ?>
+ <? else: ?>
+ <?= t("No comments yet.") ?>
+ <? endif ?>
+ </p>
+ <ul>
+ <li class="g-no-comments">&nbsp;</li>
+ </ul>
+ <? endif ?>
+
+ <? if ($comments->count()): ?>
+ <ul>
+ <? foreach ($comments as $comment): ?>
+ <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="g-avatar"
+ alt="<?= html::clean_attribute($comment->author_name()) ?>"
+ width="40"
+ height="40" />
+ </a>
+ <? if ($comment->author()->guest): ?>
+ <?= t('on %date %name said',
+ array("date" => gallery::date_time($comment->created),
+ "name" => html::clean($comment->author_name()))); ?>
+ <? else: ?>
+ <?= t('on %date <a href="%url">%name</a> said',
+ array("date" => gallery::date_time($comment->created),
+ "url" => user_profile::url($comment->author_id),
+ "name" => html::clean($comment->author_name()))); ?>
+ <? endif ?>
+ </p>
+ <div>
+ <?= nl2br(html::purify($comment->text)) ?>
+ </div>
+ </li>
+ <? endforeach ?>
+ </ul>
+ <? endif ?>
+ <a name="comment-form" id="g-comment-form-anchor"></a>
+</div>
diff --git a/modules/comment/views/user_profile_comments.html.php b/modules/comment/views/user_profile_comments.html.php
new file mode 100644
index 0000000..377b2d9
--- /dev/null
+++ b/modules/comment/views/user_profile_comments.html.php
@@ -0,0 +1,20 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div id="g-comment-detail">
+<ul>
+ <? foreach ($comments as $comment): ?>
+ <li id="g-comment-<?= $comment->id ?>">
+ <p class="g-author">
+ <?= t("on %date for %title ",
+ array("date" => gallery::date_time($comment->created),
+ "title" => $comment->item()->title)); ?>
+ <a href="<?= $comment->item()->url() ?>">
+ <?= $comment->item()->thumb_img(array(), 50) ?>
+ </a>
+ </p>
+ <div>
+ <?= nl2br(html::purify($comment->text)) ?>
+ </div>
+ </li>
+ <? endforeach ?>
+</ul>
+</div>