aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/views/default
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-03 01:41:18 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-03 01:41:18 +0000
commit608647dcf59c60e55d86a69e39e2626e6f1eb6bc (patch)
tree0902b73d513ac13a3a57d69c73d7d55477d7471b /mod/groups/views/default
parent8f484535ba505b12d2d4ccdaf30686c375035108 (diff)
downloadelgg-608647dcf59c60e55d86a69e39e2626e6f1eb6bc.tar.gz
elgg-608647dcf59c60e55d86a69e39e2626e6f1eb6bc.tar.bz2
Refs #2679 - returning to a separate annotation for discussion forum replies. For those using the latest out of svn you can update with this script: https://gist.github.com/852092
git-svn-id: http://code.elgg.org/elgg/trunk@8570 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/groups/views/default')
-rw-r--r--mod/groups/views/default/annotation/group_topic_post.php8
-rw-r--r--mod/groups/views/default/discussion/replies.php28
-rw-r--r--mod/groups/views/default/forms/discussion/reply/save.php22
-rw-r--r--mod/groups/views/default/groups/css.php2
-rw-r--r--mod/groups/views/default/object/groupforumtopic.php30
-rw-r--r--mod/groups/views/default/river/annotation/group_topic_post/reply.php28
6 files changed, 104 insertions, 14 deletions
diff --git a/mod/groups/views/default/annotation/group_topic_post.php b/mod/groups/views/default/annotation/group_topic_post.php
new file mode 100644
index 000000000..d2303aba8
--- /dev/null
+++ b/mod/groups/views/default/annotation/group_topic_post.php
@@ -0,0 +1,8 @@
+<?php
+/**
+ * Discussion reply
+ */
+
+$vars['delete_action'] = 'action/discussion/reply/delete';
+
+echo elgg_view('annotation/default', $vars);
diff --git a/mod/groups/views/default/discussion/replies.php b/mod/groups/views/default/discussion/replies.php
new file mode 100644
index 000000000..2bfb6f0cd
--- /dev/null
+++ b/mod/groups/views/default/discussion/replies.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * List replies with optional add form
+ *
+ * @uses $vars['entity'] ElggEntity
+ * @uses $vars['show_add_form'] Display add form or not
+ */
+
+$show_add_form = elgg_extract('show_add_form', $vars, true);
+
+echo '<div id="group-replies" class="mtl">';
+
+$options = array(
+ 'guid' => $vars['entity']->getGUID(),
+ 'annotation_name' => 'group_topic_post',
+);
+$html = elgg_list_annotations($options);
+if ($html) {
+ echo '<h3>' . elgg_echo('group:replies') . '</h3>';
+ echo $html;
+}
+
+if ($show_add_form) {
+ $form_vars = array('class' => 'mtm');
+ echo elgg_view_form('discussion/reply/save', $form_vars, $vars);
+}
+
+echo '</div>';
diff --git a/mod/groups/views/default/forms/discussion/reply/save.php b/mod/groups/views/default/forms/discussion/reply/save.php
new file mode 100644
index 000000000..6281e941c
--- /dev/null
+++ b/mod/groups/views/default/forms/discussion/reply/save.php
@@ -0,0 +1,22 @@
+<?php
+/**
+ * Discussion topic reply form bofy
+ *
+ * @uses $vars['entity']
+ */
+
+
+if (isset($vars['entity']) && elgg_is_logged_in()) {
+?>
+ <div>
+ <label><?php echo elgg_echo("reply"); ?></label>
+ <?php echo elgg_view('input/longtext', array('name' => 'group_topic_post')); ?>
+ </div>
+<?php
+ echo elgg_view('input/submit', array('value' => elgg_echo('reply')));
+
+ echo elgg_view('input/hidden', array(
+ 'name' => 'entity_guid',
+ 'value' => $vars['entity']->getGUID()
+ ));
+}
diff --git a/mod/groups/views/default/groups/css.php b/mod/groups/views/default/groups/css.php
index 5276e2bfa..545f9c9b3 100644
--- a/mod/groups/views/default/groups/css.php
+++ b/mod/groups/views/default/groups/css.php
@@ -22,7 +22,7 @@
font-size: 85%;
}
-.groups-latest-comment {
+.groups-latest-reply {
float: right;
}
diff --git a/mod/groups/views/default/object/groupforumtopic.php b/mod/groups/views/default/object/groupforumtopic.php
index 8a1daece8..b5efa0e6c 100644
--- a/mod/groups/views/default/object/groupforumtopic.php
+++ b/mod/groups/views/default/object/groupforumtopic.php
@@ -26,18 +26,22 @@ $poster_text = elgg_echo('groups:started', array($poster->name));
$tags = elgg_view('output/tags', array('tags' => $topic->tags));
$date = elgg_view_friendly_time($topic->time_created);
-$comments_link = '';
-$comments_text = '';
-$num_comments = $topic->countComments();
-if ($num_comments != 0) {
- $last_comment = $topic->getAnnotations("generic_comment", 1, 0, "desc");
- $commenter = $last_comment[0]->getOwnerEntity();
- $comment_time = elgg_view_friendly_time($last_comment[0]->time_created);
- $comments_text = elgg_echo('groups:updated', array($commenter->name, $comment_time));
+$replies_link = '';
+$replies_text = '';
+$num_replies = elgg_get_annotations(array(
+ 'annotation_name' => 'group_topic_post',
+ 'guid' => $topic->getGUID(),
+ 'count' => true,
+));
+if ($num_replies != 0) {
+ $last_reply = $topic->getAnnotations('group_topic_post', 1, 0, 'desc');
+ $poster = $last_reply[0]->getOwnerEntity();
+ $reply_time = elgg_view_friendly_time($last_reply[0]->time_created);
+ $reply_text = elgg_echo('groups:updated', array($poster->name, $reply_time));
- $comments_link = elgg_view('output/url', array(
- 'href' => $topic->getURL() . '#topic-comments',
- 'text' => elgg_echo("comments") . " ($num_comments)",
+ $replies_link = elgg_view('output/url', array(
+ 'href' => $topic->getURL() . '#group-replies',
+ 'text' => elgg_echo('group:replies') . " ($num_replies)",
));
}
@@ -52,7 +56,7 @@ if (elgg_in_context('widgets')) {
}
if ($full) {
- $subtitle = "$poster_text $date $comments_link";
+ $subtitle = "$poster_text $date $replies_link";
$params = array(
'entity' => $topic,
@@ -75,7 +79,7 @@ HTML;
} else {
// brief view
- $subtitle = "$poster_text $date $comments_link <span class=\"groups-latest-comment\">$comments_text</span>";
+ $subtitle = "$poster_text $date $replies_link <span class=\"groups-latest-reply\">$reply_text</span>";
$params = array(
'entity' => $topic,
diff --git a/mod/groups/views/default/river/annotation/group_topic_post/reply.php b/mod/groups/views/default/river/annotation/group_topic_post/reply.php
new file mode 100644
index 000000000..f0b7d03b8
--- /dev/null
+++ b/mod/groups/views/default/river/annotation/group_topic_post/reply.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Reply river view
+ */
+$object = $vars['item']->getObjectEntity();
+$reply = $vars['item']->getAnnotation();
+
+$url = $object->getURL();
+$title = $object->title;
+$params = array(
+ 'href' => $object->getURL(),
+ 'text' => $title,
+);
+$object_link = elgg_view('output/url', $params);
+
+$type = $object->getType();
+$subtype = $object->getSubtype();
+
+echo elgg_echo('groups:river:reply') . ' ';
+echo $object_link;
+
+if ($reply) {
+ $excerpt = elgg_get_excerpt($reply->value);
+ echo '<div class="elgg-river-content">';
+ echo $excerpt;
+ echo '</div>';
+}
+