aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-21 17:55:00 +0000
committerdave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-21 17:55:00 +0000
commit37658c5be7fa91fefeb7f49591692b91efc89298 (patch)
tree8205d4e2964c9faf2ef8f769a0a87e0356ea9d70
parentd7d2da2c7c4a6f24b6ef4389e4878d475ade6220 (diff)
downloadelgg-37658c5be7fa91fefeb7f49591692b91efc89298.tar.gz
elgg-37658c5be7fa91fefeb7f49591692b91efc89298.tar.bz2
the beginnings of a mechanism to comment on river objects
git-svn-id: http://code.elgg.org/elgg/trunk@5463 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--actions/comments/add.php4
-rw-r--r--actions/comments/delete.php2
-rw-r--r--mod/riverdashboard/start.php16
-rw-r--r--mod/riverdashboard/views/default/river/item/wrapper.php13
-rw-r--r--mod/riverdashboard/views/default/riverdashboard/rivercomment.php12
5 files changed, 41 insertions, 6 deletions
diff --git a/actions/comments/add.php b/actions/comments/add.php
index 67429f033..bce464fdb 100644
--- a/actions/comments/add.php
+++ b/actions/comments/add.php
@@ -64,5 +64,5 @@ system_message(elgg_echo("generic_comment:posted"));
//add to river
add_to_river('annotation/annotate','comment',$user->guid,$entity->guid, "", 0, $annotation);
-// Forward to the entity page
-forward($entity->getURL());
+// Forward to the page the action occurred on
+forward($_SERVER['HTTP_REFERER']);
diff --git a/actions/comments/delete.php b/actions/comments/delete.php
index 03e575b66..fd8156dc3 100644
--- a/actions/comments/delete.php
+++ b/actions/comments/delete.php
@@ -29,4 +29,4 @@ if ($comment = get_annotation($annotation_id)) {
}
register_error(elgg_echo("generic_comment:notdeleted"));
-forward($entity->getURL()); \ No newline at end of file
+forward($_SERVER['HTTP_REFERER']); \ No newline at end of file
diff --git a/mod/riverdashboard/start.php b/mod/riverdashboard/start.php
index c093f5ecb..6badd8393 100644
--- a/mod/riverdashboard/start.php
+++ b/mod/riverdashboard/start.php
@@ -32,4 +32,20 @@ function riverdashboard_dashboard() {
include(dirname(__FILE__) . '/index.php');
}
+/**
+ * For users to make a comment on a river item
+ *
+ * @param ElggEntity $entity The entity to comment on
+ * @return string|false The HTML (etc) for the comment form, or false on failure
+ */
+function elgg_make_river_comment($entity){
+ if (!($entity instanceof ElggEntity)) {
+ return false;
+ } else {
+ //display the comment form
+ $comments = elgg_view('riverdashboard/rivercomment',array('entity' => $entity));
+ return $comments;
+ }
+}
+
register_elgg_event_handler('init','system','riverdashboard_init');
diff --git a/mod/riverdashboard/views/default/river/item/wrapper.php b/mod/riverdashboard/views/default/river/item/wrapper.php
index ab0f7a9a2..0dba70e5c 100644
--- a/mod/riverdashboard/views/default/river/item/wrapper.php
+++ b/mod/riverdashboard/views/default/river/item/wrapper.php
@@ -105,9 +105,16 @@ else
}
//display the comment link
if($vars['item']->type != 'user'){
- //for now don't display the comment link on bookmarks and wire messages
- if($vars['item']->subtype != 'thewire' && $vars['item']->subtype != 'conversations' && $vars['item']->subtype != 'bookmarks' && $vars['item']->subtype != '')
- echo "<a class='comment_link' href=\"{$object_url}\">Comment</a>";
+ //for now don't display the comment link on wire and conversations for now
+ if($vars['item']->subtype != 'thewire' && $vars['item']->subtype != 'conversations' && $vars['item']->subtype != '')
+ //don't display the comment option on group discussions atm
+ if($vars['item']->subtype == 'groupforumtopic'){
+ echo "<a class='comment_link' href=\"{$object_url}\">Visit discussion</a>";
+ }else{
+ echo "<div class='river_post_comment'>";
+ echo elgg_make_river_comment($object);
+ echo "</div>";
+ }
}
?>
</div> \ No newline at end of file
diff --git a/mod/riverdashboard/views/default/riverdashboard/rivercomment.php b/mod/riverdashboard/views/default/riverdashboard/rivercomment.php
new file mode 100644
index 000000000..b0e76148a
--- /dev/null
+++ b/mod/riverdashboard/views/default/riverdashboard/rivercomment.php
@@ -0,0 +1,12 @@
+<?php
+/**
+ * Elgg comments add on river form
+ * @uses $vars['entity']
+ */
+
+if (isset($vars['entity']) && isloggedin()) {
+ $form_body = elgg_view('input/text',array('internalname' => 'generic_comment', 'value' => 'Add a comment...'));
+ $form_body .= elgg_view('input/hidden', array('internalname' => 'entity_guid', 'value' => $vars['entity']->getGUID()));
+ $form_body .= elgg_view('input/submit', array('value' => elgg_echo("post")));
+ echo elgg_view('input/form', array('body' => $form_body, 'action' => "{$vars['url']}action/comments/add"));
+} \ No newline at end of file