]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
There was no point in group discussions having their own comment annotations, better...
authordave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 19 Jun 2010 16:31:35 +0000 (16:31 +0000)
committerdave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 19 Jun 2010 16:31:35 +0000 (16:31 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@6526 36083f99-b078-4883-b0ff-0f9b5a30f544

23 files changed:
mod/groups/actions/forums/addpost.php [deleted file]
mod/groups/actions/forums/addtopic.php
mod/groups/actions/forums/deletepost.php [deleted file]
mod/groups/actions/forums/editpost.php [deleted file]
mod/groups/actions/forums/edittopic.php
mod/groups/activity.php [new file with mode: 0644]
mod/groups/addtopic.php
mod/groups/all.php
mod/groups/discussions.php [deleted file]
mod/groups/edit.php
mod/groups/edittopic.php
mod/groups/forum.php
mod/groups/languages/en.php
mod/groups/start.php
mod/groups/views/default/forms/forums/addpost.php [deleted file]
mod/groups/views/default/forms/forums/edittopic.php
mod/groups/views/default/forum/maintopic.php [moved from mod/groups/views/default/forum/topicposts.php with 53% similarity]
mod/groups/views/default/forum/topics.php
mod/groups/views/default/forum/viewposts.php
mod/groups/views/default/groups/css.php
mod/groups/views/default/groups/forum_latest.php
mod/groups/views/default/object/groupforumtopic.php
mod/groups/views/default/river/forum/topic/create.php

diff --git a/mod/groups/actions/forums/addpost.php b/mod/groups/actions/forums/addpost.php
deleted file mode 100644 (file)
index c277b79..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-/**
- * Elgg groups: add post to a topic 
- *
- * @package ElggGroups
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider <info@elgg.com>
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.org/
- */
-
-// Make sure we're logged in and have a CSRF token
-gatekeeper();
-
-// Get input
-$topic_guid = (int) get_input('topic_guid');
-$group_guid = (int) get_input('group_guid');
-$post = get_input('topic_post');
-
-
-// make sure we have text in the post
-if (!$post) {
-       register_error(elgg_echo("grouppost:nopost"));
-       forward($_SERVER['HTTP_REFERER']);
-}
-
-
-// Check that user is a group member
-$group = get_entity($group_guid);
-$user = get_loggedin_user();
-if (!$group->isMember($user)) {
-       register_error(elgg_echo("groups:notmember"));
-       forward($_SERVER['HTTP_REFERER']);
-}
-
-
-// Let's see if we can get an form topic with the specified GUID, and that it's a group forum topic
-$topic = get_entity($topic_guid);
-if (!$topic || $topic->getSubtype() != "groupforumtopic") {
-       register_error(elgg_echo("grouptopic:notfound"));
-       forward($_SERVER['HTTP_REFERER']);
-}
-
-
-// add the post to the forum topic
-$post_id = $topic->annotate('group_topic_post', $post, $topic->access_id, $user->guid);
-if ($post_id == false) {
-       system_message(elgg_echo("groupspost:failure"));
-       forward($_SERVER['HTTP_REFERER']);
-}
-
-// add to river
-add_to_river('river/forum/create', 'create', $user->guid, $topic_guid, "", 0, $post_id);
-
-system_message(elgg_echo("groupspost:success"));
-
-forward($_SERVER['HTTP_REFERER']);
index 085e2196ef6c10d044cf8b5cb63ee71c67b5427b..1bb4c0588deafc873dd37afa681daf71895436ca 100644 (file)
@@ -49,6 +49,8 @@
                        $grouptopic->access_id = $access;
        // Set its title and description appropriately
                        $grouptopic->title = $title;
+       // Set its title and description appropriately
+                       $grouptopic->description = $message;
        // Before we can set metadata, we need to save the topic
                        if (!$grouptopic->save()) {
                                register_error(elgg_echo("grouptopic:error"));
                        }
        // add metadata
                $grouptopic->status = $status; // the current status i.e sticky, closed, resolved, open
-                  
-    // now add the topic message as an annotation
-               $grouptopic->annotate('group_topic_post',$message,$access, $user);   
-               
+                       
     // add to river
                add_to_river('river/forum/topic/create','create',$_SESSION['user']->guid,$grouptopic->guid);
                
diff --git a/mod/groups/actions/forums/deletepost.php b/mod/groups/actions/forums/deletepost.php
deleted file mode 100644 (file)
index 14336c1..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-       /**
-        * Elgg Groups: delete topic comment action
-        * 
-        * @package ElggGroups
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.org/
-        */
-
-       // Ensure we're logged in
-               if (!isloggedin()) forward();
-               
-  
-       // Make sure we can get the comment in question
-               $post_id = (int) get_input('post');
-               $group_guid = (int) get_input('group');
-               $topic_guid = (int) get_input('topic');
-               
-               if ($post = get_annotation($post_id)) {
-                       
-                       //check that the user can edit as well as admin
-                       if ($post->canEdit() || ($post->owner_guid == $_SESSION['user']->guid)) {
-                       
-                       //delete forum comment
-                               $post->delete();
-                               
-                               // remove river entry if it exists
-                               remove_from_river_by_annotation($post_id);
-
-                               //display confirmation message
-                               system_message(elgg_echo("grouppost:deleted"));
-                       }
-                       
-               } else {
-                       $url = "";
-                       system_message(elgg_echo("grouppost:notdeleted"));
-               }
-               
-    // Forward to the group forum page
-    global $CONFIG;
-       $url = $CONFIG->wwwroot . "mod/groups/topicposts.php?topic={$topic_guid}&group_guid={$group_guid}";
-       forward($url);
-
-?>
\ No newline at end of file
diff --git a/mod/groups/actions/forums/editpost.php b/mod/groups/actions/forums/editpost.php
deleted file mode 100644 (file)
index 5ce1fac..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-    /**
-        * Elgg groups plugin edit post action.
-        * 
-        * @package ElggGroups
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-
-               
-               $group_guid = get_input('group');
-           $group_entity =  get_entity($group_guid);
-           
-       //get the required variables
-               $post = get_input("post");
-               $field_num = get_input("field_num");
-               $post_comment = get_input("postComment{$field_num}");
-               $annotation = get_annotation($post);
-               $commentOwner = $annotation->owner_guid;
-               $access_id = $annotation->access_id;
-               $topic = get_input("topic");
-               
-               if ($annotation) {
-                       
-                       //can edit? Either the comment owner or admin can
-                       if (groups_can_edit_discussion($annotation, page_owner_entity()->owner_guid)) {
-                               
-                               update_annotation($post, "group_topic_post", $post_comment, "",$commentOwner, $access_id);
-                           system_message(elgg_echo("groups:forumpost:edited"));
-                                  
-                       } else {
-                               system_message(elgg_echo("groups:forumpost:error"));
-                       }
-                       
-               } else {
-                       
-                               system_message(elgg_echo("groups:forumpost:error"));
-               }
-               
-               // Forward to the group forum page
-           $url = $CONFIG->wwwroot . "mod/groups/topicposts.php?topic={$topic}&group_guid={$group_guid}/";
-               forward($url);
-  
-               
-?>
\ No newline at end of file
index 10b54ed61bbe79ba04b66a47aebe5f304eda6d0e..b677a713c7248c0a73e8d65e07b1ef7dbdeeb52c 100644 (file)
@@ -1,87 +1,66 @@
 <?php
+/**
+* Elgg groups plugin edit topic action.
+ */
 
-    /**
-        * Elgg groups plugin edit topic action.
-        * 
-        * @package ElggGroups
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-
-    // Make sure we're logged in (send us to the front page if not)
-               if (!isloggedin()) forward();
+// Make sure we're logged in (send us to the front page if not)
+if (!isloggedin()) forward();
                
-       // Check the user is a group member
-           $group_entity =  get_entity(get_input('group_guid'));
-           if (!$group_entity->isMember($vars['user'])) forward();
+// Check the user is a group member
+$group_entity =  get_entity(get_input('group_guid'));
+if (!$group_entity->isMember($vars['user'])) forward();
      
-
-       // Get input data
-           $title = strip_tags(get_input('topictitle'));
-               $message = get_input('topicmessage');
-               $message_id = get_input('message_id');
-               $tags = get_input('topictags');
-               $topic_guid = get_input('topic');
-               $access = get_input('access_id');
-               $group_guid = get_input('group_guid');
-               //$user = $_SESSION['user']->getGUID(); // you need to be logged in to comment on a group forum
-               $status = get_input('status'); // sticky, resolved, closed
-               
-       // Convert string of tags into a preformatted array
-                $tagarray = string_to_tag_array($tags);
+// Get input data
+$title = strip_tags(get_input('topictitle'));
+$message = get_input('topicmessage');
+$message_id = get_input('message_id');
+$tags = get_input('topictags');
+$topic_guid = get_input('topic');
+$access = get_input('access_id');
+$group_guid = get_input('group_guid');
+$status = get_input('status'); // open, closed
                
-       // Make sure we actually have permission to edit
-               $topic = get_entity($topic_guid);
-               if ($topic)
-               {
+// Convert string of tags into a preformatted array
+$tagarray = string_to_tag_array($tags);
                
-                       $user = $topic->getOwner(); 
-                       
-                       if ($topic->getSubtype() == "groupforumtopic") {
+// Make sure we actually have permission to edit
+$topic = get_entity($topic_guid);
+if ($topic){
+       $user = $topic->getOwner(); 
+       if ($topic->getSubtype() == "groupforumtopic") {
                
-                       // Convert string of tags into a preformatted array
-                               $tagarray = string_to_tag_array($tags);
+               // Convert string of tags into a preformatted array
+               $tagarray = string_to_tag_array($tags);
+                                       
+               // Make sure the title isn't blank
+               if (empty($title) || empty($message)) {
+                       register_error(elgg_echo("groupstopic:blank"));
                                
-                       // Make sure the title isn't blank
-                               if (empty($title) || empty($message)) {
-                                       register_error(elgg_echo("groupstopic:blank"));
-                       
                        // Otherwise, save the forum
-                               } else {
-                                       
-                               $topic->access_id = $access;
-                                       
+               } else {
+                       $topic->access_id = $access;
                        // Set its title
-                                       $topic->title = $title;
-                                       
+                       $topic->title = $title;
+                       // Set the message
+                       $topic->description = $message;
                        // if no tags are present, clear existing ones
-                                       if (is_array($tagarray)) {
-                                               $topic->tags = $tagarray;
-                                       } else $topic->clearMetadata('tags');
-                                       
+                       if (is_array($tagarray)) {
+                               $topic->tags = $tagarray;
+                       } else $topic->clearMetadata('tags');
                        // edit metadata
-                              $topic->status = $status; // the current status i.e sticky, closed, resolved
-                              
-               // now let's edit the message annotation
-                                  update_annotation($message_id, "group_topic_post", $message, "",$user, $access);
-                              
+              $topic->status = $status; // the current status i.e sticky, closed, resolved
+                                              
                        // save the changes
-                   if (!$topic->save()) {
+                       if (!$topic->save()) {
                                //              register_error(elgg_echo("forumtopic:error"));
-                               }
-                               
-                  // Success message
-                                       system_message(elgg_echo("groups:forumtopic:edited"));
-                                       
-                           }
-               }
+                       }
+                       // Success message
+                       system_message(elgg_echo("groups:forumtopic:edited"));
                }
-               // Forward to the group forum page
-               global $CONFIG;
-               $url = $CONFIG->wwwroot . "pg/groups/forum/{$group_guid}/";
-                       forward($url);
-               
-?>
+       }
+}
+// Forward to the group forum page
+global $CONFIG;
+$url = $CONFIG->wwwroot . "pg/groups/forum/{$group_guid}/";
+forward($url);
 
diff --git a/mod/groups/activity.php b/mod/groups/activity.php
new file mode 100644 (file)
index 0000000..18a9726
--- /dev/null
@@ -0,0 +1,55 @@
+<?php\r
+/**\r
+ * Elgg group activity\r
+ */\r
+\r
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");\r
+\r
+$group_guid = (int)get_input('group');\r
+set_page_owner($group_guid);\r
+if (!(page_owner_entity() instanceof ElggGroup)) {\r
+       forward();\r
+}\r
+group_gatekeeper();\r
+\r
+global $CONFIG;\r
+\r
+// set up breadcrumbs\r
+$group = get_entity($group_guid);\r
+elgg_push_breadcrumb(elgg_echo('groups'), $CONFIG->wwwroot."pg/groups/world/");\r
+elgg_push_breadcrumb($group->name, $group->getURL());\r
+elgg_push_breadcrumb(elgg_echo('groups:activity'));\r
+\r
+$area1 = elgg_view('navigation/breadcrumbs');\r
+\r
+$limit = get_input("limit", 20);\r
+$offset = get_input("offset", 0);\r
+$group_guid = get_input("group", 7);\r
+// Sanitise variables -- future proof in case they get sourced elsewhere\r
+$limit = (int) $limit;\r
+$offset = (int) $offset;\r
+$group_guid = (int) $group_guid;\r
+\r
+$entities = elgg_get_entities(array(\r
+       'container_guids' => $group_guid,\r
+       'group_by' => 'e.guid'\r
+));\r
+\r
+$entity_guids = array();\r
+foreach ($entities as $entity) {\r
+       $entity_guids[] = $entity->getGUID();\r
+}\r
+\r
+if (count($entity_guids) > 0) {\r
+       $river_items = elgg_view_river_items('', $entity_guids, '', '', '', '', $limit);\r
+} else {\r
+       $river_items .= elgg_echo('groups:no_activity');\r
+}\r
+\r
+$area1 .= elgg_view_title(elgg_echo('groups:activity'));\r
+$area1 .= "<div class='group_listings hide_comments'>".$river_items."</div>";\r
+$title = sprintf(elgg_echo("groups:activity"), page_owner_entity()->name);\r
+$body = elgg_view_layout('one_column_with_sidebar', $area1);\r
+\r
+// Finally draw the page\r
+page_draw($title, $body);
\ No newline at end of file
index ed9343fefd63569f0061e533c209d37e58744b43..cc02fa4eb3f599facd8a9beba371a46354f4aac2 100644 (file)
@@ -1,29 +1,20 @@
 <?php
+/**
+ * Elgg Groups add a forum topic page
+ */
 
-       /**
-        * Elgg Groups add a forum topic page
-        * 
-        * @package ElggGroups
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-
-       // Load Elgg engine
-               require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-               
-               gatekeeper();
+// Load Elgg engine
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
                
-               $page_owner = set_page_owner((int) get_input('group_guid'));
+group_gatekeeper();
                
-               if (!(page_owner_entity() instanceof ElggGroup)) forward();
+$page_owner = set_page_owner((int) get_input('group_guid'));
                
-       // sort the display
-           $area2 = elgg_view("forms/forums/addtopic");
-           $body = elgg_view_layout('one_column_with_sidebar', $area1.$area2);
+if (!(page_owner_entity() instanceof ElggGroup)) forward();
                
-       // Display page
-               page_draw(elgg_echo('groups:addtopic'),$body);
+// sort the display
+$area2 = elgg_view("forms/forums/addtopic");
+$body = elgg_view_layout('one_column_with_sidebar', $area1.$area2);
                
-?>
\ No newline at end of file
+// Display page
+page_draw(elgg_echo('groups:addtopic'),$body);
\ No newline at end of file
index 9e19fce09b346abd41ab6bfb031427aee4593b99..6f0c16add05f1d5e836858158a091c612c5fed46 100644 (file)
                        $options = array(
                                'type' => 'object',
                                'subtype' => 'groupforumtopic',
-                               'annotation_name' => 'group_topic_post',
+                               'annotation_name' => 'generic_comment',
+                               'order_by' => 'e.last_action desc',
                                'limit' => 40,
                                'fullview' => TRUE
                        );
-                       $objects = elgg_list_entities_from_annotations($options);
+                       $objects = elgg_list_entities($options);
                        break;
        }
 
diff --git a/mod/groups/discussions.php b/mod/groups/discussions.php
deleted file mode 100644 (file)
index 44bc5e6..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-       /**
-        * Elgg all group forum discussions page
-        * This page will show all topic dicussions ordered by last comment, regardless of which group
-        * they are part of
-        *
-        * @package ElggGroups
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-
-       // Load Elgg engine
-               require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
-       // access check for closed groups
-       group_gatekeeper();
-
-       // Display them
-               $area1 = elgg_view_title(elgg_echo("groups:latestdiscussion"));
-               set_context('search');
-               $area1 .= list_entities_from_annotations("object", "groupforumtopic", "group_topic_post", "", 40, 0, 0, false, true);
-               set_context('groups');
-
-               $body = elgg_view_layout("one_column_with_sidebar", $area1);
-
-       // Display page
-               page_draw(elgg_echo('groups:latestdiscussion'),$body);
-
-
-?>
\ No newline at end of file
index 94160891a3c452cadae9267be28867b0935b428e..cbb181ef34c775b9aeeba82b4e9b52a145b53a75 100644 (file)
@@ -10,7 +10,7 @@
         */
 
        require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-       gatekeeper();
+       group_gatekeeper();
 
        $group_guid = get_input('group_guid');
        $group = get_entity($group_guid);
index 6c4b97a25cfc48ff2355cffb737b872e4987fa32..b09efacbec98ffefec02b60908b5a05187a02b82 100644 (file)
@@ -1,36 +1,25 @@
 <?php
+/**
+ * Elgg Groups edit a forum topic page
+ */
 
-       /**
-        * Elgg Groups edit a forum topic page
-        * 
-        * @package ElggGroups
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-
-       // Load Elgg engine
-               require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+// Load Elgg engine
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
                
-               gatekeeper();
+gatekeeper();
                
-       get_input('group');
-       $page_owner = set_page_owner((int)get_input('group'));
-       
-       // check the user is a member of the group
-       //if (!$page_owner->isMember($_SESSION['user'])) forward();
+get_input('group');
+$page_owner = set_page_owner((int)get_input('group'));
        
-       if (!(page_owner_entity() instanceof ElggGroup)) forward();
+// check the user is a member of the group
+if (!(page_owner_entity() instanceof ElggGroup)) forward();
        
-       //get the topic
-       $topic = get_entity((int) get_input('topic'));
-               
-       // sort the display
-           $area2 = elgg_view("forms/forums/edittopic", array('entity' => $topic));
-           $body = elgg_view_layout('one_column_with_sidebar', $area2);
+//get the topic
+$topic = get_entity((int) get_input('topic'));
                
-       // Display page
-               page_draw(elgg_echo('groups:edittopic'),$body);
+// sort the display
+$area2 = elgg_view("forms/forums/edittopic", array('entity' => $topic));
+$body = elgg_view_layout('one_column_with_sidebar', $area2);
                
-?>
\ No newline at end of file
+// Display page
+page_draw(elgg_echo('groups:edittopic'),$body);
\ No newline at end of file
index 32ffea2dae100e7e69642c1642aa8b10007c46f4..c06bb2ebbbb32a8f82e5a44f088e0034bc4bf054 100644 (file)
@@ -1,54 +1,45 @@
 <?php
-       /**
-        * Elgg groups forum
-        *
-        * @package ElggGroups
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
+/**
+ * Elgg groups forum
+ */
 
-       require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
 
-       $group_guid = (int)get_input('group_guid');
-       set_page_owner($group_guid);
-       if (!(page_owner_entity() instanceof ElggGroup)) {
-               forward();
-       }
+$group_guid = (int)get_input('group_guid');
+set_page_owner($group_guid);
+if (!(page_owner_entity() instanceof ElggGroup)) {
+       forward();
+}
 
-       group_gatekeeper();
+group_gatekeeper();
 
-       //get any forum topics
-       $options = array(
-               'type' => 'object',
-               'subtype' => 'groupforumtopic',
-               'annotation_name' => 'group_topic_post',
-               'limit' => 20,
-               'container_guid' => $group_guid,
-               'fullview' => FALSE
-       );
+//get any forum topics
+$options = array(
+       'type' => 'object',
+       'subtype' => 'groupforumtopic',
+       'limit' => 20,
+       'order_by' => 'e.last_action desc',
+       'container_guid' => $group_guid,
+       'fullview' => FALSE
+);
 
-       $topics = elgg_list_entities_from_annotations($options);
+//$topics = elgg_list_entities_from_annotations($options);
+$topics = elgg_list_entities($options);
 
-       // set up breadcrumbs
-       $group = get_entity($group_guid);
-       elgg_push_breadcrumb(elgg_echo('groups'), $CONFIG->wwwroot."pg/groups/world/");
-       elgg_push_breadcrumb($group->name, $group->getURL());
-       elgg_push_breadcrumb(elgg_echo('item:object:groupforumtopic'));
+// set up breadcrumbs
+$group = get_entity($group_guid);
+elgg_push_breadcrumb(elgg_echo('groups'), $CONFIG->wwwroot."pg/groups/world/");
+elgg_push_breadcrumb($group->name, $group->getURL());
+elgg_push_breadcrumb(elgg_echo('item:object:groupforumtopic'));
 
-       $area1 = elgg_view('navigation/breadcrumbs');
+$area1 = elgg_view('navigation/breadcrumbs');
 
-       $area1 .= elgg_view("forum/topics", array('topics' => $topics, 'group_guid' => $group_guid));
-       set_context('groups');
+$area1 .= elgg_view("forum/topics", array('topics' => $topics, 'group_guid' => $group_guid));
+set_context('groups');
 
-       $body = elgg_view_layout('one_column_with_sidebar', $area1);
+$body = elgg_view_layout('one_column_with_sidebar', $area1);
 
-       $title = elgg_echo('item:object:groupforumtopic');
+$title = elgg_echo('item:object:groupforumtopic');
 
-       // Finally draw the page
-       page_draw($title, $body);
-
-
-
-?>
\ No newline at end of file
+// Finally draw the page
+page_draw($title, $body);
\ No newline at end of file
index 5a17fbb26565e611b8289846d2733deb0f30af11..0bd0cbd39e35fe0e17e24b83c85b5fd4fd678db5 100644 (file)
@@ -58,7 +58,8 @@ $english = array(
        'groups:viagroups' => "via groups",
        'groups:group' => "Group",
        'groups:search:tags' => "tag",
-
+       'groups:activity' => "Group activity",
+       'groups:no_activity' => "There is no group activity yet",
        'groups:notfound' => "Group not found",
        'groups:notfound:details' => "The requested group either does not exist or you do not have access to it",
 
@@ -93,8 +94,6 @@ $english = array(
        'groups:enablefiles' => 'Enable group files',
        'groups:yes' => 'yes',
        'groups:no' => 'no',
-
-       'group:created' => 'Created %s with %d posts',
        'groups:lastupdated' => 'Last updated %s by %s',
        'groups:pages' => 'Group pages',
        'groups:files' => 'Group files',
@@ -104,6 +103,8 @@ $english = array(
        */
 
        'group:replies' => 'Replies',
+       'groups:forum:created' => 'Created %s with %d comments',
+       'groups:forum:created:single' => 'Created %s with %d reply',
        'groups:forum' => 'Discussion',
        'groups:addtopic' => 'Add a topic',
        'groups:forumlatest' => 'Latest discussion',
@@ -127,8 +128,8 @@ $english = array(
        'grouptopic:created' => 'Your topic was created.',
        'groupstopic:deleted' => 'The topic has been deleted.',
        'groups:topicsticky' => 'Sticky',
-       'groups:topicisclosed' => 'This topic is closed.',
-       'groups:topiccloseddesc' => 'This topic has now been closed and is not accepting new comments.',
+       'groups:topicisclosed' => 'This discussion is closed.',
+       'groups:topiccloseddesc' => 'This discussion has now been closed and is not accepting new comments.',
        'grouptopic:error' => 'Your group topic could not be created. Please try again or contact a system administrator.',
        'groups:forumpost:edited' => "You have successfully edited the forum post.",
        'groups:forumpost:error' => "There was a problem editing the forum post.",
@@ -186,8 +187,9 @@ or click below to view the group's join requests:
        'groupforum:river:update' => 'this discussion topic',
        'groupforum:river:created' => '%s has created',
        'groupforum:river:create' => 'a new discussion topic titled',
-       'groupforum:river:posted' => '%s has posted a new comment',
+       'groupforum:river:posted' => '%s has posted a comment',
        'groupforum:river:annotate:create' => 'on this discussion topic',
+       'groupforumtopic:river:annotate' => 'a new comment on this discussion topic',
        'groupforum:river:postedtopic' => '%s has started a new discussion topic titled',
        'groups:river:member' => '%s is now a member of',
        'groups:river:togroup' => 'to the group',
index e3f4d019a490d142b50fa5928fc98d872f42c831..7b11def20737ca2b1b5c606a04a1c7605fb8e891 100644 (file)
@@ -75,6 +75,7 @@
 
                // Register profile menu hook
                register_plugin_hook('profile_menu', 'profile', 'forum_profile_menu');
+               register_plugin_hook('profile_menu', 'profile', 'activity_profile_menu');
 
                // allow ecml in discussion
                register_plugin_hook('get_views', 'ecml', 'groups_ecml_views_hook');
                                        set_input('group_guid', $page[1]);
                                        include($CONFIG->pluginspath . "groups/forum.php");
                                break;
+                               case "edittopic":
+                                       set_input('group', $page[1]);
+                                       set_input('topic', $page[2]);
+                                       include($CONFIG->pluginspath . "groups/edittopic.php");
+                               break;
+                               case "activity":
+                                       set_input('group', $page[1]);
+                                       include($CONFIG->pluginspath . "groups/activity.php");
+                               break;
                                case "owned" :
                                        // Owned by a user
                                        if (isset($page[1]))
                }
                return $return_value;
        }
+       
+       function activity_profile_menu($hook, $entity_type, $return_value, $params) {
+               global $CONFIG;
+
+               if ($params['owner'] instanceof ElggGroup) {
+                       $return_value[] = array(
+                               'text' => elgg_echo('Activity'),
+                               'href' => "{$CONFIG->url}pg/groups/activity/{$params['owner']->getGUID()}"
+                       );
+               }
+               return $return_value;
+       }
 
        /**
         * Parse ECML on group discussion views
diff --git a/mod/groups/views/default/forms/forums/addpost.php b/mod/groups/views/default/forms/forums/addpost.php
deleted file mode 100644 (file)
index c5236c5..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-       /**
-        * Elgg group forum post edit/add page
-        * 
-        * @package ElggGroups
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        * 
-        * @uses $vars['entity'] Optionally, the post to edit
-        */
-           
-?>
-<form action="<?php echo $vars['url']; ?>action/groups/addpost" method="post" class="margin_top">
-       <label><?php echo elgg_echo("groups:reply"); ?></label>
-       <?php
-       
-       echo elgg_view("input/longtext",array(
-                                               "internalname" => "topic_post",
-                                               "value" => $body,
-                                                                               ));
-       ?>
-       
-               
-    <!-- pass across the topic guid -->
-       <input type="hidden" name="topic_guid" value="<?php echo $vars['entity']->guid; ?>" />
-       <input type="hidden" name="group_guid" value="<?php echo $vars['entity']->container_guid; ?>" />
-                       
-       <?php echo elgg_view('input/securitytoken'); ?>
-       <!-- display the post button -->
-       <input type="submit" class="submit_button" value="<?php echo elgg_echo('post'); ?>" />
-</form>
index 89c8c441b4c1d7592738c9d6d32d8b0ddc8fb770..cfaae5dd9c9ad9948b0e6639d6e505764f66f198 100644 (file)
            $status = $vars['entity']->status;
            $tags = $vars['entity']->tags;
            $title = $vars['entity']->title;
-           $message = $vars['entity']->getAnnotations('group_topic_post', 1, 0, "asc");
-           
-           foreach($message as $mes){
-                       $messsage_content = $mes->value;
-                   $message_id = $mes->id;
-           }               
+           $message = $vars['entity']->description;                
                    
         // get the group GUID
            $group_guid = get_input("group");
@@ -72,7 +67,7 @@
 
                                echo elgg_view("input/longtext",array(
                                                                        "internalname" => "topicmessage",
-                                                                       "value" => $messsage_content,
+                                                                       "value" => html_entity_decode($message, ENT_COMPAT, 'UTF-8')
                                                                                                        ));
                        ?>
                </p>
@@ -82,8 +77,6 @@
                    <label><?php echo elgg_echo("groups:topicstatus"); ?><br />
                    <select name="status">
                        <option value="open" <?php if($status == "") echo "SELECTED";?>><?php echo elgg_echo('groups:topicopen'); ?></option>
-                       <option value="sticky" <?php if($status == "sticky") echo "SELECTED";?>><?php echo elgg_echo('groups:topicsticky'); ?></option>
-                       <option value="resolved" <?php if($status == "resolved") echo "SELECTED";?>><?php echo elgg_echo('groups:topicresolved'); ?></option>
                        <option value="closed" <?php if($status == "closed") echo "SELECTED";?>><?php echo elgg_echo('groups:topicclosed'); ?></option>
                    </select>
                    </label>
similarity index 53%
rename from mod/groups/views/default/forum/topicposts.php
rename to mod/groups/views/default/forum/maintopic.php
index 7fb32e4277400da7e181e17028ed359bd264e6f0..7a4a86da7d87efec40fcdc3547719a6f0f09208c 100644 (file)
@@ -1,81 +1,56 @@
-<?php
-
-       /**
-        * Elgg Topic individual post view. This is all the follow up posts on a particular topic
-        * 
-        * @package ElggGroups
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        * 
-        * @uses $vars['entity'] The posted comment to view
-        */
-        
-       
-?>
-
-<div class="entity_listing topic clearfloat">
-<a class="anchor_link" name="<?php echo $vars['entity']->id; ?>"></a>
-       <?php
-       // get infomation about the owner of the comment
-       if ($post_owner = get_user($vars['entity']->owner_guid)) {
-           // display the user icon
-           echo "<div class='entity_listing_icon'>" . elgg_view("profile/icon",array('entity' => $post_owner, 'size' => 'tiny')) . "</div>";
-           // display the user name
-           echo "<div class='entity_listing_info'>";
-           // if comment owner, group owner, or site admin - display edit and delete options
-           if (groups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) {
-                       echo "<div class='entity_metadata'>";
-               echo "<span class='delete_button'>".elgg_view("output/confirmlink",array(
-                               'href' => $vars['url'] . "action/groups/deletepost?post=" . $vars['entity']->id . "&topic=" . get_input('topic') . "&group=" . get_input('group_guid'),
-                               'text' => elgg_echo('delete'),
-                               'confirm' => elgg_echo('deleteconfirm')
-                               ))."</span>";
-                       echo "<span class='entity_edit'><a class='link' onclick=\"elgg_slide_toggle(this,'.topic','.edit_comment');\">".elgg_echo('edit')."</a></span>";
-                       echo "</div>";
-
-               }           
-           
-           echo "<p class='entity_title'>" . $post_owner->name . "</p>";
-       } else {
-               echo "<div class='entity_listing_icon'><img src=\"" . elgg_view('icon/user/default/tiny') . "\" /></div>";
-               echo "<div class='entity_listing_info'><p class='entity_title'>" . elgg_echo('profile:deleteduser') . "</p>";
-       }
-       
-       //display the date of the comment
-       echo "<p class='entity_subtext'>" . friendly_time($vars['entity']->time_created) . "</p>";
-
-       //display the actual message posted
-       echo parse_urls(elgg_view("output/longtext",array("value" => $vars['entity']->value)));
-
-    // if comment owner, group owner, or site admin - display edit-form
-    if (groups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) {
-               //get the edit form and details
-               $submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('save')));
-               $text_textarea = elgg_view('input/longtext', array('internalname' => 'postComment'.$vars['entity']->id, 'value' => $vars['entity']->value));
-       $post = elgg_view('input/hidden', array('internalname' => 'post', 'value' => $vars['entity']->id));
-               $field = elgg_view('input/hidden', array('internalname' => 'field_num', 'value' => $vars['entity']->id));
-       $topic = elgg_view('input/hidden', array('internalname' => 'topic', 'value' => get_input('topic')));
-               $group = elgg_view('input/hidden', array('internalname' => 'group', 'value' => get_input('group_guid')));
-               $edittopic_title = elgg_echo('groups:edittopic');
-                       
-               $form_body = <<<EOT
-               
-               <p class='longtext_inputarea'>
-               <label>$edittopic_title</label>
-               $text_textarea</p>
-               $post
-               $topic
-               $group
-               $field
-               $submit_input
-EOT;
-               echo "<div class='edit_comment margin_top hidden'>";
-               echo elgg_view('input/form', array('action' => "{$vars['url']}action/groups/editpost", 'body' => $form_body, 'internalid' => 'editforumpostForm'));
-               echo "</div>";
-    }
-       echo "</div>"; // close entity_listing_info
-?>
-               
+<?php\r
+\r
+       /**\r
+        * Elgg Topic individual post view.\r
+        * \r
+        * @package ElggGroups\r
+        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
+        * @author Curverider Ltd <info@elgg.com>\r
+        * @copyright Curverider Ltd 2008-2010\r
+        * @link http://elgg.com/\r
+        * \r
+        * @uses $vars['entity'] The post\r
+        */\r
+        \r
+        $topic = get_input('topic');\r
+        $group_guid = get_input('group_guid');\r
+       \r
+?>\r
+\r
+<div class="entity_listing topic clearfloat">\r
+<a class="anchor_link" name="<?php echo $vars['entity']->id; ?>"></a>\r
+       <?php\r
+       // get infomation about the owner of the comment\r
+       if ($post_owner = get_user($vars['entity']->owner_guid)) {\r
+           // display the user icon\r
+           echo "<div class='entity_listing_icon'>" . elgg_view("profile/icon",array('entity' => $post_owner, 'size' => 'tiny')) . "</div>";\r
+           // display the user name\r
+           echo "<div class='entity_listing_info'>";\r
+           // if comment owner, group owner, or site admin - display edit and delete options\r
+           if (groups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) {\r
+                       echo "<div class='entity_metadata'>";\r
+               echo "<span class='delete_button'>".elgg_view("output/confirmlink",array(\r
+                               'href' => $vars['url'] . "action/groups/deletepost?post=" . $vars['entity']->id . "&topic=" . get_input('topic') . "&group=" . get_input('group_guid'),\r
+                               'text' => elgg_echo('delete'),\r
+                               'confirm' => elgg_echo('deleteconfirm')\r
+                               ))."</span>";\r
+                       echo "<span class='entity_edit'><a class='link' href=\"{$vars['url']}pg/groups/edittopic/{$group_guid}/{$topic}/\">".elgg_echo('edit')."</a></span>";\r
+                       echo "</div>";\r
+\r
+               }           \r
+           \r
+           echo "<p class='entity_title'>" . $post_owner->name . "</p>";\r
+       } else {\r
+               echo "<div class='entity_listing_icon'><img src=\"" . elgg_view('icon/user/default/tiny') . "\" /></div>";\r
+               echo "<div class='entity_listing_info'><p class='entity_title'>" . elgg_echo('profile:deleteduser') . "</p>";\r
+       }\r
+       \r
+       //display the date of the comment\r
+       echo "<p class='entity_subtext'>" . friendly_time($vars['entity']->time_created) . "</p>";\r
+\r
+       //display the actual message posted\r
+       echo parse_urls(elgg_view("output/longtext",array("value" => $vars['entity']->description)));\r
+       echo "</div>"; // close entity_listing_info\r
+?>\r
+               \r
 </div>
\ No newline at end of file
index c0f5ff2d1450fbeb17a55fa795967122b85959af..91834aa08c2b3f924f04454fc69a4d3d1bd3a2a1 100644 (file)
@@ -1,13 +1,7 @@
 <?php
-       /**
-        * Elgg groups plugin
-        *
-        * @package ElggGroups
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
+/**
+ * Elgg groups plugin
+ */
 ?>
 
 <div id="content_header" class="clearfloat">
@@ -25,9 +19,7 @@
        ?>
 </div>
 <?php
-       if($vars['topics'])
-               echo $vars['topics'];
-       else
-               echo "<p class='margin_top'>". elgg_echo("grouptopic:notcreated") . "</p>";
-
-?>
\ No newline at end of file
+if($vars['topics'])
+       echo $vars['topics'];
+else
+       echo "<p class='margin_top'>". elgg_echo("grouptopic:notcreated") . "</p>";
\ No newline at end of file
index 0ff70a38a7f3c04e1fc78d4bdb47bc37718ff7d5..aa8b334f25ec789ce194226b886c06ea36777f7c 100644 (file)
@@ -1,61 +1,48 @@
 <?php
-
-       /**
-        * Elgg groups plugin display topic posts
-        *
-        * @package ElggGroups
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-
-       // set up breadcrumbs
-       $group_guid = get_input('group_guid');
-       $group = get_entity($group_guid);
-       elgg_push_breadcrumb(elgg_echo('groups'), $CONFIG->wwwroot."pg/groups/world/");
-       elgg_push_breadcrumb($group->name, $group->getURL());
-       elgg_push_breadcrumb(elgg_echo('item:object:groupforumtopic'), $CONFIG->wwwroot."pg/groups/forum/{$vars['entity']->container_guid}");
-       elgg_push_breadcrumb($vars['entity']->title);
-
-       echo elgg_view('navigation/breadcrumbs');
-
-       //display follow up comments
-       $count = $vars['entity']->countAnnotations('group_topic_post');
-       $offset = (int) get_input('offset',0);
-
-       $baseurl = $vars['url'] . "mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$vars['entity']->container_guid}";
-       echo elgg_view('navigation/pagination',array(
-                                                                                                       'limit' => 50,
-                                                                                                       'offset' => $offset,
-                                                                                                       'baseurl' => $baseurl,
-                                                                                                       'count' => $count,
-                                                                                               ));
+/**
+ * Elgg groups plugin display topic posts
+ */
+
+// set up breadcrumbs
+$group_guid = get_input('group_guid');
+$group = get_entity($group_guid);
+elgg_push_breadcrumb(elgg_echo('groups'), $CONFIG->wwwroot."pg/groups/world/");
+elgg_push_breadcrumb($group->name, $group->getURL());
+elgg_push_breadcrumb(elgg_echo('item:object:groupforumtopic'), $CONFIG->wwwroot."pg/groups/forum/{$vars['entity']->container_guid}");
+elgg_push_breadcrumb($vars['entity']->title);
+
+echo elgg_view('navigation/breadcrumbs');
+
+//display follow up comments
+$count = $vars['entity']->countAnnotations('group_topic_post');
+$offset = (int) get_input('offset',0);
+
+$baseurl = $vars['url'] . "mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$vars['entity']->container_guid}";
+echo elgg_view('navigation/pagination',array(
+                                                                                               'limit' => 50,
+                                                                                               'offset' => $offset,
+                                                                                               'baseurl' => $baseurl,
+                                                                                               'count' => $count,
+                                                                                       ));
 
 ?>
 <!-- grab the topic title -->
 <h2><?php echo $vars['entity']->title; ?></h2>
 <?php
-
-       foreach($vars['entity']->getAnnotations('group_topic_post', 50, $offset, "asc") as $post) {
-
-               echo elgg_view("forum/topicposts",array('entity' => $post));
-
-       }
+       //display the topic
+       echo elgg_view("forum/maintopic",array('entity' => $vars['entity']));
 
        // check to find out the status of the topic and act
-       if($vars['entity']->status != "closed" && page_owner_entity()->isMember($vars['user'])){
-
-               //display the add comment form, this will appear after all the existing comments
-               echo elgg_view("forms/forums/addpost", array('entity' => $vars['entity']));
-
-       } elseif($vars['entity']->status == "closed") {
-
+       if($vars['entity']->status == "closed") {
+               echo elgg_view_comments($vars['entity'], false);
                //this topic has been closed by the owner
-               echo "<h2>" . elgg_echo("groups:topicisclosed") . "</h2>";
+               echo "<h3>" . elgg_echo("groups:topicisclosed") . "</h3>";
                echo "<p>" . elgg_echo("groups:topiccloseddesc") . "</p>";
 
-       } else {
+       }elseif(page_owner_entity()->isMember($vars['user'])){
+               //comments are on and the user viewing is a member
+               echo elgg_view_comments($vars['entity']);
+       }else{
+               //the user is not a member so cannot post a comment
+               echo elgg_view_comments($vars['entity'], false);
        }
-
-?>
index fc160453a008a37ad28215bbf72f2c7d94a7f71c..d435b1f7c722fc098c003cbc2d3401dd86487537 100644 (file)
    - force tinyMCE to correct width */
 .edit_comment .defaultSkin table.mceLayout {
        width: 694px !important;
-}
-
+}
\ No newline at end of file
index 3c6ce6ccfb403442783c2b2bd48ad235dde46ae0..865b04ca2d3717e4ba3c80f2a38a2b5e0b62c54f 100644 (file)
@@ -8,23 +8,26 @@ if($vars['entity']->forum_enable != 'no'){
 <h3><?php echo elgg_echo('groups:latestdiscussion'); ?></h3>
 <?php
        
-    $forum = elgg_get_entities_from_annotations(array('types' => 'object', 'subtypes' => 'groupforumtopic', 'annotation_names' => 'group_topic_post', 'container_guid' => $vars['entity']->guid, 'limit' => 6, 'order_by' => 'maxtime desc'));
+    $forum = elgg_get_entities(array('types' => 'object', 'subtypes' => 'groupforumtopic', 'container_guid' => $vars['entity']->guid, 'limit' => 6));
        
     if($forum){
         foreach($forum as $f){
                    
-                $count_annotations = $f->countAnnotations("group_topic_post");
+                $count_annotations = $f->countAnnotations("generic_comment");
                  
                    echo "<div class='entity_listing clearfloat'>";
                    echo "<div class='entity_listing_icon'>" . elgg_view('profile/icon',array('entity' => $f->getOwnerEntity(), 'size' => 'tiny')) . "</div>";
                echo "<div class='entity_listing_info'><p class='entity_title'><a href=\"{$vars['url']}mod/groups/topicposts.php?topic={$f->guid}&group_guid={$vars['entity']->guid}\">" . $f->title . "</a></p>";
-               echo "<p class='entity_subtext'>".elgg_echo('groups:posts').": " . $count_annotations . "</p></div>";
+               echo "<p class='entity_subtext'>".elgg_echo('comments').": " . $count_annotations . "</p></div>";
                echo "</div>";
         }
     } else {
-               $create_discussion = $vars['url'] . "mod/groups/addtopic.php?group_guid=" . page_owner();
-               echo "<p class='margin_top'><a href=\"{$create_discussion}\">".elgg_echo("groups:addtopic")."</a></p>";
+           if(page_owner_entity()->isMember($vars['user'])){
+                       $create_discussion = $vars['url'] . "mod/groups/addtopic.php?group_guid=" . page_owner();
+                       echo "<p class='margin_top'><a href=\"{$create_discussion}\">".elgg_echo("groups:addtopic")."</a></p>";
+               }else{
+                       echo "<p class='margin_top'>". elgg_echo("grouptopic:notcreated") . "</p>";
+               }
     }
 
-}//end of forum active check
-?>
\ No newline at end of file
+}//end of forum active check
\ No newline at end of file
index 8d5d655c0bebd9cce3c391505b7b701868ee4127..e32f83cd4817091799dc49f395413360d07d4e04 100644 (file)
@@ -1,71 +1,71 @@
 <?php
-
-       /**
-        * Elgg Groups latest discussion listing
-        * 
-        * @package ElggGroups
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
+/**
+ * Elgg Groups latest discussion listing
+ * 
+ * @package ElggGroups
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+*/
         
-    //get the required variables
-    $title = htmlentities($vars['entity']->title, ENT_QUOTES, 'UTF-8');
-    //$description = get_entity($vars['entity']->description);
-    $topic_owner = get_user($vars['entity']->owner_guid);
-    $group = get_entity($vars['entity']->container_guid);
-    $forum_created = friendly_time($vars['entity']->time_created);
-    $counter = $vars['entity']->countAnnotations("group_topic_post");
-       $last_post = $vars['entity']->getAnnotations("group_topic_post", 1, 0, "desc");
-    //get the time and user
-    if ($last_post) {
-               foreach($last_post as $last) {
-                       $last_time = $last->time_created;
-                       $last_user = $last->owner_guid;
-               }
+//get the required variables
+$title = htmlentities($vars['entity']->title, ENT_QUOTES, 'UTF-8');
+//$description = get_entity($vars['entity']->description);
+$topic_owner = get_user($vars['entity']->owner_guid);
+$group = get_entity($vars['entity']->container_guid);
+$forum_created = friendly_time($vars['entity']->time_created);
+$counter = $vars['entity']->countAnnotations("generic_comment");
+$last_post = $vars['entity']->getAnnotations("generic_comment", 1, 0, "desc");
+//get the time and user
+if ($last_post) {
+       foreach($last_post as $last) {
+               $last_time = $last->time_created;
+               $last_user = $last->owner_guid;
        }
+}
 
-       $u = get_user($last_user);
+$u = get_user($last_user);
 
-       //select the correct output depending on where you are
-       if(get_context() == "search"){
-       
-           $info = "<p class='entity_subtext groups'>" . sprintf(elgg_echo('group:created'), $forum_created, $counter) .  "<br />";
-           if (($last_time) && ($u)) $info.= sprintf(elgg_echo('groups:lastupdated'), friendly_time($last_time), " <a href=\"" . $u->getURL() . "\">" . $u->name . "</a>");
-           $info .= '</p>';
-               //get the group avatar
-               $icon = elgg_view("profile/icon",array('entity' => $u, 'size' => 'tiny'));
-           //get the group and topic title
-           $info .= "<p class='entity_subtext'><b>" . elgg_echo('Topic') . ":</b> <a href=\"{$vars['url']}mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$group->guid}\">{$title}</a></p>";
-           if ($group instanceof ElggGroup) {
-               $info .= "<p class='entity_title'><b>" . elgg_echo('group') . ":</b> <a href=\"{$group->getURL()}\">".htmlentities($group->name, ENT_QUOTES, 'UTF-8') ."</a></p>";
-           }
-               
+//select the correct output depending on where you are
+if(get_context() == "search"){
+       var_export($counter);
+       if($counter == 1){
+       $info = "<p class='entity_subtext groups'>" . sprintf(elgg_echo('groups:forum:created:single'), $forum_created, $counter) .  "<br />";
        }else{
+               $info = "<p class='entity_subtext groups'>" . sprintf(elgg_echo('groups:forum:created'), $forum_created, $counter) .  "<br />";
+       }
+    if (($last_time) && ($u)) $info.= sprintf(elgg_echo('groups:lastupdated'), friendly_time($last_time), " <a href=\"" . $u->getURL() . "\">" . $u->name . "</a>");
+    $info .= '</p>';
+       //get the group avatar
+       $icon = elgg_view("profile/icon",array('entity' => $u, 'size' => 'tiny'));
+    //get the group and topic title
+    $info .= "<p class='entity_subtext'><b>" . elgg_echo('Topic') . ":</b> <a href=\"{$vars['url']}mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$group->guid}\">{$title}</a></p>";
+    if ($group instanceof ElggGroup) {
+       $info .= "<p class='entity_title'><b>" . elgg_echo('group') . ":</b> <a href=\"{$group->getURL()}\">".htmlentities($group->name, ENT_QUOTES, 'UTF-8') ."</a></p>";
+    }
                
-               $info = "<p class='entity_subtext groups'>" . sprintf(elgg_echo('group:created'), $forum_created, $counter) . "</p>";
-           $info .= "<p class='entity_title'>" . elgg_echo('groups:started') . " " . $topic_owner->name . ": <a href=\"{$vars['url']}mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$group->guid}\">{$title}</a></p>";
+}else{
+       if($counter == 1){
+               $info = "<p class='entity_subtext groups'>" . sprintf(elgg_echo('groups:forum:created:single'), $forum_created, $counter) . "</p>";
+       }else{
+               $info = "<p class='entity_subtext groups'>" . sprintf(elgg_echo('groups:forum:created'), $forum_created, $counter) . "</p>";
+       }
+    $info .= "<p class='entity_title'>" . elgg_echo('groups:started') . " " . $topic_owner->name . ": <a href=\"{$vars['url']}mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$group->guid}\">{$title}</a></p>";
 
-           if (groups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) {
-                       // display the delete link to those allowed to delete
-                       $info .= "<div class='delete_button'>" . elgg_view("output/confirmlink", array(
-                                                                                                                                               'href' => $vars['url'] . "action/groups/deletetopic?topic=" . $vars['entity']->guid . "&group=" . $vars['entity']->container_guid,
-                                                                                                                                               'text' => " ",
-                                                                                                                                               'confirm' => elgg_echo('deleteconfirm'),
-                                                                                                                                       )) . "</div>";
+    if (groups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) {
+               // display the delete link to those allowed to delete
+               $info .= "<div class='delete_button'>" . elgg_view("output/confirmlink", array(
+                                                                                                                                               'href' => $vars['url'] . "action/groups/deletetopic?topic=" . $vars['entity']->guid . "&group=" . $vars['entity']->container_guid,
+                                                                                                                                               'text' => " ",
+                                                                                                                                               'confirm' => elgg_echo('deleteconfirm'),
+                                                                                                                                       )) . "</div>";
                                                
-           }           
+   }           
 
-               if (($last_time) && ($u)) {
-                       $info.= "<p class='entity_subtext'>" . elgg_echo('groups:updated') . " " . friendly_time($last_time) . " by <a href=\"" . $u->getURL() . "\">" . $u->name . "</a></p>";         
-               }
-           //get the user avatar
-               $icon = elgg_view("profile/icon",array('entity' => $topic_owner, 'size' => 'tiny'));            
+       if (($last_time) && ($u)) {
+               $info.= "<p class='entity_subtext'>" . elgg_echo('groups:updated') . " " . friendly_time($last_time) . " by <a href=\"" . $u->getURL() . "\">" . $u->name . "</a></p>";         
        }
+    //get the user avatar
+       $icon = elgg_view("profile/icon",array('entity' => $topic_owner, 'size' => 'tiny'));            
+}
                
-               //display
-               echo elgg_view_listing($icon, $info);
-               
-?>
\ No newline at end of file
+//display
+echo elgg_view_listing($icon, $info);
\ No newline at end of file
index 0b65f79b6a33a2a1f66e63fd98ce5f4a60049b3b..fb2a3556d303888751a2da42a7ea131fb40d37ce 100644 (file)
@@ -7,19 +7,20 @@
        $group_guid = $object->container_guid;
        $group = get_entity($group_guid);
        $url = $vars['url'] . "mod/groups/topicposts.php?topic=" . $forumtopic . "&group_guid=" . $group_guid;
-       $comment = $object->getAnnotations("group_topic_post", 1, 0, "asc"); 
-       foreach($comment as $c){
-               $contents = $c->value;
-       }
+       //$comment = $object->getAnnotations("group_topic_post", 1, 0, "asc"); 
+       //foreach($comment as $c){
+       $contents = $object->description;
+       //}
        $contents = strip_tags($contents);//this is so we don't get large images etc in the activity river
        $url_user = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
        $string = sprintf(elgg_echo("groupforum:river:postedtopic"),$url_user) . ": ";
        $string .= "<a href=\"" . $url . "\">" . $object->title . "</a>";
-       if(get_context() != 'groups'){
-               $string .= " " . elgg_echo('groups:ingroup') . " <a href=\"{$group->getURL()}\">" . $group->name . "</a>";
+       $string .= " " . elgg_echo('groups:ingroup') . " <a href=\"{$group->getURL()}\">" . $group->name . "</a>";
+       $string .= " <span class='entity_subtext'>". friendly_time($object->time_created) ."</span>";
+       if (isloggedin() && $object->status != "closed") {
+               $string .= '<a class="river_comment_form_button link">' . elgg_echo('generic_comments:text') . '</a>';
+               $string .= elgg_view('likes/forms/link', array('entity' => $object));
        }
-       $string .= " <span class='entity_subtext'>". friendly_time($object->time_created) ."</span> <a class='river_comment_form_button link' href=\"{$object_url}\">Visit discussion</a>";
-       $string .= elgg_view('likes/forms/link', array('entity' => $object));
        $string .= "<div class=\"river_content_display\">";
        $string .= elgg_make_excerpt($contents, 200);
        $string .= "</div>";