aboutsummaryrefslogtreecommitdiff
path: root/mod/groups
diff options
context:
space:
mode:
Diffstat (limited to 'mod/groups')
-rw-r--r--mod/groups/actions/forums/addpost.php57
-rw-r--r--mod/groups/actions/forums/addtopic.php78
-rw-r--r--mod/groups/actions/forums/deletetopic.php45
-rw-r--r--mod/groups/actions/forums/edittopic.php83
-rw-r--r--mod/groups/addtopic.php27
-rw-r--r--mod/groups/edittopic.php34
-rw-r--r--mod/groups/forum.php29
-rw-r--r--mod/groups/languages/en.php23
-rw-r--r--mod/groups/start.php25
-rw-r--r--mod/groups/topicposts.php30
-rw-r--r--mod/groups/views/default/forms/forums/addpost.php36
-rw-r--r--mod/groups/views/default/forms/forums/addtopic.php98
-rw-r--r--mod/groups/views/default/forms/forums/edittopic.php107
-rw-r--r--mod/groups/views/default/forum/topicposts.php65
-rw-r--r--mod/groups/views/default/forum/topics.php128
-rw-r--r--mod/groups/views/default/forum/viewposts.php44
-rw-r--r--mod/groups/views/default/groups/forum_latest.php14
-rw-r--r--mod/groups/views/default/groups/profileitems.php1
18 files changed, 918 insertions, 6 deletions
diff --git a/mod/groups/actions/forums/addpost.php b/mod/groups/actions/forums/addpost.php
new file mode 100644
index 000000000..0c2f1b210
--- /dev/null
+++ b/mod/groups/actions/forums/addpost.php
@@ -0,0 +1,57 @@
+<?php
+
+ /**
+ * Elgg groups: add topic post 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
+ * @link http://elgg.org/
+ */
+
+ // Make sure we're logged in; forward 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();
+
+ // Get input
+ $topic_guid = (int) get_input('topic_guid');
+ $group_guid = (int) get_input('group_guid');
+ $post = get_input('topic_post');
+ $access = get_input('access');
+
+ // Let's see if we can get an entity with the specified GUID, and that it's a group forum topic
+ if ($topic = get_entity($topic_guid)) {
+ if ($topic->getSubtype() == "groupforumtopic") {
+
+ //check the user posted a message
+ if($post){
+ // If posting the comment was successful, say so
+ if ($topic->annotate('group_topic_post',$post,$access, $_SESSION['guid'])) {
+
+ system_message(elgg_echo("groupspost:success"));
+
+ } else {
+ system_message(elgg_echo("groupspost:failure"));
+ }
+ }else{
+ system_message(elgg_echo("groupspost:nopost"));
+ }
+
+ }
+
+ } else {
+
+ system_message(elgg_echo("groupstopic:notfound"));
+
+ }
+
+ // 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/addtopic.php b/mod/groups/actions/forums/addtopic.php
new file mode 100644
index 000000000..3159d639f
--- /dev/null
+++ b/mod/groups/actions/forums/addtopic.php
@@ -0,0 +1,78 @@
+<?php
+
+ /**
+ * Elgg groups plugin add 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
+ * @link http://elgg.com/
+ */
+
+ // Make sure we're logged in; forward 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();
+
+ // Get input data
+ $title = get_input('topictitle');
+ $message = get_input('topicmessage');
+ $tags = get_input('topictags');
+ $access = get_input('access_id');
+ $group_guid = (int) 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);
+
+ // Make sure the title / message aren't blank
+ if (empty($title) || empty($message)) {
+ register_error(elgg_echo("grouptopic:blank"));
+ forward("pg/groups/forum/{$group_guid}/");
+
+ // Otherwise, save the topic
+ } else {
+
+ // Initialise a new ElggObject
+ $grouptopic = new ElggObject();
+ // Tell the system it's a group forum topic
+ $grouptopic->subtype = "groupforumtopic";
+ // Set its owner to the current user
+ $grouptopic->owner_guid = $user;
+ // Set the group it belongs to
+ $grouptopic->container_guid = $group_guid;
+ // For now, set its access to public (we'll add an access dropdown shortly)
+ $grouptopic->access_id = $access;
+ // Set its title and description appropriately
+ $grouptopic->title = $title;
+ // Before we can set metadata, we need to save the topic
+ if (!$grouptopic->save()) {
+ register_error(elgg_echo("grouptopic:error"));
+ forward("pg/groups/forum/{$group_guid}/");
+ }
+ // Now let's add tags. We can pass an array directly to the object property! Easy.
+ if (is_array($tagarray)) {
+ $grouptopic->tags = $tagarray;
+ }
+ // 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);
+
+ // Success message
+ system_message(elgg_echo("grouptopic:created"));
+
+ // Forward to the group forum page
+ global $CONFIG;
+ $url = $CONFIG->wwwroot . "pg/groups/forum/{$group_guid}/";
+ forward($url);
+
+ }
+
+?>
+
diff --git a/mod/groups/actions/forums/deletetopic.php b/mod/groups/actions/forums/deletetopic.php
new file mode 100644
index 000000000..3882e698b
--- /dev/null
+++ b/mod/groups/actions/forums/deletetopic.php
@@ -0,0 +1,45 @@
+<?php
+
+ /**
+ * Elgg Groups: delete topic 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
+ * @link http://elgg.org/
+ */
+
+ // Make sure we're logged in; forward to the front page if not
+ if (!isloggedin()) forward();
+
+ // Check the user is a group member
+ $group_entity = get_entity(get_input('group'));
+ if (!$group_entity->isMember($vars['user'])) forward();
+
+ // Get input data
+ $topic_guid = (int) get_input('topic');
+ $group_guid = (int) get_input('group');
+
+ // Make sure we actually have permission to edit
+ $topic = get_entity($topic_guid);
+ if ($topic->getSubtype() == "groupforumtopic") {
+
+ // Get owning user
+ // $owner = get_entity($topic->getOwner());
+ // Delete it!
+ $rowsaffected = $topic->delete();
+ if ($rowsaffected > 0) {
+ // Success message
+ system_message(elgg_echo("groupstopic:deleted"));
+ } else {
+ system_message(elgg_echo("groupstopic:notdeleted"));
+ }
+ // Forward to the group forum page
+ global $CONFIG;
+ $url = $CONFIG->wwwroot . "pg/groups/forum/{$group_guid}/";
+ forward($url);
+
+ }
+
+?> \ No newline at end of file
diff --git a/mod/groups/actions/forums/edittopic.php b/mod/groups/actions/forums/edittopic.php
new file mode 100644
index 000000000..865af2173
--- /dev/null
+++ b/mod/groups/actions/forums/edittopic.php
@@ -0,0 +1,83 @@
+<?php
+
+ /**
+ * 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
+ * @link http://elgg.com/
+ */
+
+ // 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();
+
+
+ // Get input data
+ $title = 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);
+
+ // Make sure we actually have permission to edit
+ $topic = get_entity($topic_guid);
+
+ if ($topic->getSubtype() == "groupforumtopic") {
+
+ // 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"));
+
+ // Otherwise, save the forum
+ } else {
+
+ $topic->access_id = $access;
+
+ // Set its title
+ $topic->title = $title;
+
+ // if no tags are present, clear existing ones
+ 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);
+
+ // save the changes
+ if (!$topic->save()) {
+ // register_error(elgg_echo("forumtopic:error"));
+ }
+
+ // Success message
+ system_message(elgg_echo("forumtopic:edited"));
+
+ }
+ }
+
+ // Forward to the group forum page
+ global $CONFIG;
+ $url = $CONFIG->wwwroot . "pg/groups/forum/{$group_guid}/";
+ forward($url);
+
+?>
+
diff --git a/mod/groups/addtopic.php b/mod/groups/addtopic.php
new file mode 100644
index 000000000..167dcbf32
--- /dev/null
+++ b/mod/groups/addtopic.php
@@ -0,0 +1,27 @@
+<?php
+
+ /**
+ * 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
+ * @link http://elgg.com/
+ */
+
+ // Load Elgg engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ $page_owner = set_page_owner((int)get_input('group_guid'));
+
+ if (!(page_owner_entity() instanceof ElggGroup)) forward();
+
+ // sort the display
+ $area2 = elgg_view("forms/forums/addtopic");
+ $body = elgg_view_layout('two_column_left_sidebar',$area1, $area2);
+
+ // Display page
+ page_draw(elgg_echo('groups:addtopic'),$body);
+
+?> \ No newline at end of file
diff --git a/mod/groups/edittopic.php b/mod/groups/edittopic.php
new file mode 100644
index 000000000..d6e8559fd
--- /dev/null
+++ b/mod/groups/edittopic.php
@@ -0,0 +1,34 @@
+<?php
+
+ /**
+ * 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
+ * @link http://elgg.com/
+ */
+
+ // Load Elgg engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ 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();
+
+ 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('two_column_left_sidebar', '', $area2);
+
+ // Display page
+ page_draw(elgg_echo('groups:addtopic'),$body);
+
+?> \ No newline at end of file
diff --git a/mod/groups/forum.php b/mod/groups/forum.php
new file mode 100644
index 000000000..8387bdacd
--- /dev/null
+++ b/mod/groups/forum.php
@@ -0,0 +1,29 @@
+<?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
+ * @link http://elgg.com/
+ */
+
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ set_page_owner((int)get_input('group_guid'));
+ if (!(page_owner_entity() instanceof ElggGroup)) forward();
+
+ //get any forum topics
+ $topics = get_entities("object", "groupforumtopic", 0, "", 50, 0, false, 0, get_input('group_guid'));
+
+ $area2 = elgg_view("forum/topics", array('entity' => $topics));
+
+ $body = elgg_view_layout('two_column_left_sidebar',$area1, $area2);
+
+ // Finally draw the page
+ page_draw($title, $body);
+
+
+
+?> \ No newline at end of file
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php
index de738573f..05ee07965 100644
--- a/mod/groups/languages/en.php
+++ b/mod/groups/languages/en.php
@@ -46,6 +46,29 @@
'groups:nofriends' => "You have no friends left who have not been invited to this group.",
'groups:group' => "Group",
+
+ /*
+ Group forum strings
+ */
+
+ 'groups:forum' => 'Group forum',
+ 'groups:addtopic' => 'Add a topic',
+ 'groups:edittopic' => 'Edit topic',
+ 'groups:topicmessage' => 'Topic message',
+ 'groups:topicstatus' => 'Topic status',
+ 'groups:reply' => 'Post a comment',
+ 'groups:topic' => 'Topic',
+ 'groups:posts' => 'Posts',
+ 'groups:lastperson' => 'Last person',
+ 'groups:when' => 'When',
+ 'grouptopic:notcreated' => 'No topics have been created',
+ 'groups:topicopen' => 'Open',
+ 'groups:topicclosed' => 'Closed',
+ 'groups:topicresolved' => 'Resolved',
+ 'groups:topicsticky' => 'Sticky',
+ 'groups:topicisclosed' => 'This topic is closed',
+ 'groups:topiccloseddesc' => 'This topic has now been closed and is not accepting new comments',
+
'groups:privategroup' => 'This group is private, requesting membership.',
'groups:notitle' => 'Groups must have a title',
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 3a1a912d2..d2061db3e 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -21,11 +21,7 @@
// Set up the menu for logged in users
if (isloggedin())
{
- add_menu(elgg_echo('groups'), $CONFIG->wwwroot . "pg/groups/owned/" . $_SESSION['user']->username,array(
- //menu_item(elgg_echo('groups:new'), $CONFIG->wwwroot."pg/groups/new/"),
- //menu_item(elgg_echo('groups:yours'), $CONFIG->wwwroot . "pg/groups/owned/" . $_SESSION['user']->username),
- //menu_item(elgg_echo('groups:all'), $CONFIG->wwwroot . "pg/groups/world/"),
- ),'groups');
+ add_menu(elgg_echo('groups'), $CONFIG->wwwroot . "pg/groups/owned/" . $_SESSION['user']->username,'groups');
}
else
{
@@ -61,7 +57,9 @@
add_widget_type('group_members_widget',elgg_echo('groups:widgets:members:title'), elgg_echo('groups:widgets:members:description'), 'groups');
add_widget_type('group_entities_widget',elgg_echo('groups:widgets:entities:title'), elgg_echo('groups:widgets:entities:description'), 'groups');
+ //extend some views
extend_view('profile/icon','groups/icon');
+ extend_view('css','groups/css');
// Write access permissions
register_plugin_hook('access:collections:write', 'all', 'groups_write_acl_plugin_hook');
@@ -100,7 +98,7 @@
add_submenu_item(elgg_echo('groups:invite'),$CONFIG->wwwroot . "mod/groups/invite.php?group_guid={$page_owner->getGUID()}");
}
if ($page_owner->isMember($_SESSION['user'])) {
- add_submenu_item(elgg_echo('groups:leave'), $CONFIG->wwwroot . "action/groups/leave?groups_guid=" . $page_owner->getGUID());
+ add_submenu_item(elgg_echo('groups:leave'), $CONFIG->wwwroot . "action/groups/leave?group_guid=" . $page_owner->getGUID());
} else {
if ($page_owner->isPublicMembership())
{
@@ -111,6 +109,9 @@
add_submenu_item(elgg_echo('groups:joinrequest'),$CONFIG->wwwroot . "action/groups/joinrequest?group_guid={$page_owner->getGUID()}");
}
}
+
+ add_submenu_item(elgg_echo('groups:forum'),$CONFIG->wwwroot . "pg/groups/forum/{$page_owner->getGUID()}/");
+
}
// Add submenu options
@@ -168,6 +169,10 @@
case "world":
include($CONFIG->pluginspath . "groups/all.php");
break;
+ case "forum":
+ set_input('group_guid', $page[1]);
+ include($CONFIG->pluginspath . "groups/forum.php");
+ break;
case "owned" :
// Owned by a user
if (isset($page[1]))
@@ -311,4 +316,12 @@
register_elgg_event_handler('join','group','groups_user_join_event_listener');
register_elgg_event_handler('leave','group','groups_user_leave_event_listener');
register_elgg_event_handler('pagesetup','system','groups_submenus');
+
+ // Register actions
+ global $CONFIG;
+ register_action("groups/addtopic",false,$CONFIG->pluginspath . "groups/actions/forums/addtopic.php",true);
+ register_action("groups/deletetopic",false,$CONFIG->pluginspath . "groups/actions/forums/deletetopic.php",true);
+ register_action("groups/addpost",false,$CONFIG->pluginspath . "groups/actions/forums/addpost.php",true);
+ register_action("groups/edittopic",false,$CONFIG->pluginspath . "groups/actions/forums/edittopic.php",true);
+
?> \ No newline at end of file
diff --git a/mod/groups/topicposts.php b/mod/groups/topicposts.php
new file mode 100644
index 000000000..c68c9a48e
--- /dev/null
+++ b/mod/groups/topicposts.php
@@ -0,0 +1,30 @@
+<?php
+
+ /**
+ * Elgg Groups topic posts page
+ *
+ * @package ElggGroups
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Dave Tosh <dave@elgg.com>
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ // Load Elgg engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ //get_input('group_guid');
+ set_page_owner((int)get_input('group_guid'));
+ if (!(page_owner_entity() instanceof ElggGroup)) forward();
+
+ // get the entity from id
+ $topic = get_entity(get_input('topic'));
+
+ // Display them
+ $area2 = elgg_view("forum/viewposts", array('entity' => $topic));
+ $body = elgg_view_layout("two_column_left_sidebar", $area1, $area2);
+
+ // Display page
+ page_draw(sprintf(elgg_echo('topics:user')),$body);
+
+?> \ No newline at end of file
diff --git a/mod/groups/views/default/forms/forums/addpost.php b/mod/groups/views/default/forms/forums/addpost.php
new file mode 100644
index 000000000..be34d04fd
--- /dev/null
+++ b/mod/groups/views/default/forms/forums/addpost.php
@@ -0,0 +1,36 @@
+<?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
+ * @link http://elgg.com/
+ *
+ * @uses $vars['entity'] Optionally, the post to edit
+ */
+
+?>
+ <form action="<?php echo $vars['url']; ?>action/groups/addpost" method="post">
+ <p>
+ <label><?php echo elgg_echo("groups:reply"); ?><br />
+ <?php
+
+ echo elgg_view("input/longtext",array(
+ "internalname" => "topic_post",
+ "value" => $body,
+ ));
+ ?>
+ </label>
+ </p>
+ <p>
+ <!-- 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; ?>" />
+ <!-- display the save button -->
+ <input type="submit" class="submit_button" value="<?php echo elgg_echo('save'); ?>" />
+ </p>
+
+ </form> \ No newline at end of file
diff --git a/mod/groups/views/default/forms/forums/addtopic.php b/mod/groups/views/default/forms/forums/addtopic.php
new file mode 100644
index 000000000..17ef1cab9
--- /dev/null
+++ b/mod/groups/views/default/forms/forums/addtopic.php
@@ -0,0 +1,98 @@
+<?php
+
+ /**
+ * Elgg Groups topic 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
+ * @link http://elgg.com/
+ *
+ * @uses $vars['object'] Optionally, the topic to edit
+ */
+
+ // Set title, form destination
+ $title = elgg_echo("groups:addtopic");
+ $action = "groups/addtopic";
+ $tags = "";
+ $title = "";
+ $message = "";
+ $message_id = "";
+ $status = "";
+
+ // get the group guid
+ $group_guid = (int) get_input('group_guid');
+
+ // set the title
+ echo elgg_view_title(elgg_echo("groups:addtopic"));
+
+?>
+ <!-- display the input form -->
+ <form action="<?php echo $vars['url']; ?>action/<?php echo $action; ?>" method="post">
+
+ <p>
+ <label><?php echo elgg_echo("title"); ?><br />
+ <?php
+ //display the topic title input
+ echo elgg_view("input/text", array(
+ "internalname" => "topictitle",
+ "value" => $title,
+ ));
+ ?>
+ </label>
+ </p>
+
+ <!-- display the tag input -->
+ <p>
+ <label><?php echo elgg_echo("tags"); ?><br />
+ <?php
+
+ echo elgg_view("input/tags", array(
+ "internalname" => "topictags",
+ "value" => $tags,
+ ));
+
+ ?>
+ </p>
+
+ <!-- topic message input -->
+ <p>
+ <label><?php echo elgg_echo("groups:topicmessage"); ?><br />
+ <?php
+
+ echo elgg_view("input/longtext",array(
+ "internalname" => "topicmessage",
+ "value" => $message,
+ ));
+ ?>
+ </label>
+ </p>
+
+ <!-- set the topic status -->
+ <p>
+ <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>
+ </p>
+
+ <!-- access -->
+ <p>
+ <label>
+ <?php echo elgg_echo('access'); ?><br />
+ <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $access_id)); ?>
+ </label>
+ </p>
+
+ <!-- required hidden info and submit button -->
+ <p>
+ <input type="hidden" name="group_guid" value="<?php echo $group_guid; ?>" />
+ <input type="submit" class="submit_button" value="<?php echo elgg_echo('save'); ?>" />
+ </p>
+
+ </form> \ No newline at end of file
diff --git a/mod/groups/views/default/forms/forums/edittopic.php b/mod/groups/views/default/forms/forums/edittopic.php
new file mode 100644
index 000000000..dc5891280
--- /dev/null
+++ b/mod/groups/views/default/forms/forums/edittopic.php
@@ -0,0 +1,107 @@
+<?php
+
+ /**
+ * Elgg Groups topic 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
+ * @link http://elgg.com/
+ *
+ * @uses $vars['entity'] Optionally, the topic to edit
+ */
+
+ //users can edit the access and status for now
+ $access_id = $vars['entity']->access_id;
+ $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;
+ }
+
+ // get the group GUID
+ $group_guid = get_input("group");
+
+ // topic guid
+ $topic_guid = $vars['entity']->guid;
+
+ // set the title
+ echo elgg_view_title(elgg_echo("groups:edittopic"));
+
+?>
+
+<!-- display the input form -->
+ <form action="<?php echo $vars['url']; ?>action/groups/edittopic" method="post">
+
+ <p>
+ <label><?php echo elgg_echo("title"); ?><br />
+ <?php
+ //display the topic title input
+ echo elgg_view("input/text", array(
+ "internalname" => "topictitle",
+ "value" => $title,
+ ));
+ ?>
+ </label>
+ </p>
+
+ <!-- display the tag input -->
+ <p>
+ <label><?php echo elgg_echo("tags"); ?><br />
+ <?php
+
+ echo elgg_view("input/tags", array(
+ "internalname" => "topictags",
+ "value" => $tags,
+ ));
+
+ ?>
+ </p>
+
+ <!-- topic message input -->
+ <p>
+ <label><?php echo elgg_echo("groups:topicmessage"); ?><br />
+ <?php
+
+ echo elgg_view("input/longtext",array(
+ "internalname" => "topicmessage",
+ "value" => $messsage_content,
+ ));
+ ?>
+ </label>
+ </p>
+
+ <!-- set the topic status -->
+ <p>
+ <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>
+ </p>
+
+ <!-- access -->
+ <p>
+ <label>
+ <?php echo elgg_echo('access'); ?><br />
+ <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $access_id)); ?>
+ </label>
+ </p>
+
+ <!-- required hidden info and submit button -->
+ <p>
+ <input type="hidden" name="group_guid" value="<?php echo $group_guid; ?>" />
+ <input type="hidden" name="topic" value="<?php echo $topic_guid; ?>" />
+ <input type="hidden" name="message_id" value="<?php echo $message_id; ?>" />
+ <input type="submit" class="submit_button" value="<?php echo elgg_echo('save'); ?>" />
+ </p>
+
+ </form> \ No newline at end of file
diff --git a/mod/groups/views/default/forum/topicposts.php b/mod/groups/views/default/forum/topicposts.php
new file mode 100644
index 000000000..53c45a6d0
--- /dev/null
+++ b/mod/groups/views/default/forum/topicposts.php
@@ -0,0 +1,65 @@
+<?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 Dave Tosh <ben@curverider.co.uk>
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ *
+ * @uses $vars['entity'] The posted comment to view
+ */
+
+?>
+
+ <div class="topic_post"><!-- start the topic_post -->
+
+ <table width="100%">
+ <tr>
+ <td>
+ <?php
+ //get infomation about the owner of the comment
+ $post_owner = get_user($vars['entity']->owner_guid);
+
+ //display the user icon
+ echo "<div class=\"post_icon\">" . elgg_view("profile/icon",array('entity' => $post_owner, 'size' => 'small')) . "</div>";
+
+ //display the user name
+ echo "<p><b>" . $post_owner->name . "</b><br />";
+
+ //display the date of the comment
+ echo "<small>" . friendly_time($vars['entity']->time_created) . "</small></p>";
+ ?>
+ </td>
+ <td width="70%">
+ <?php
+ //display the actual message posted
+ echo "<p>" . parse_urls(elgg_view("output/longtext",array("value" => $vars['entity']->value))) . "</p>";
+ ?>
+ </td>
+ </tr>
+ </table>
+ <?php
+
+ //if the comment owner is looking at it, they can edit
+ if ($vars['entity']->canEdit()) {
+ ?>
+ <p class="topic-post-menu">
+ <?php
+
+ echo elgg_view("output/confirmlink",array(
+ 'href' => $vars['url'] . "action/groups/forums/deletetopic?topic=" . $vars['entity']->entity_guid . "&group=" . (int)get_input('group_guid'),
+ 'text' => elgg_echo('delete'),
+ 'confirm' => elgg_echo('deleteconfirm'),
+ ));
+
+ ?>
+ </p>
+
+ <?php
+ }
+ ?>
+
+ </div><!-- end the topic_post --> \ No newline at end of file
diff --git a/mod/groups/views/default/forum/topics.php b/mod/groups/views/default/forum/topics.php
new file mode 100644
index 000000000..9fa80db79
--- /dev/null
+++ b/mod/groups/views/default/forum/topics.php
@@ -0,0 +1,128 @@
+<?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
+ * @link http://elgg.com/
+ */
+
+?>
+
+<h2><?php echo elgg_echo("groups:forum"); ?></h2>
+ <div id="forum_topics"><!-- start of the forum_topics div -->
+
+<?php
+ //only show the add link if the user is a member
+ if(page_owner_entity()->isMember($vars['user'])){
+
+?>
+ <!-- display the add a topic link -->
+ <p>[<a href="<?php echo $vars['url']; ?>mod/groups/addtopic.php?group_guid=<?php echo get_input('group_guid'); ?>"><?php echo elgg_echo("groups:addtopic"); ?></a>]</p>
+
+<?php
+ }
+?>
+ <!-- display the forum title -->
+ <h2><?php echo get_entity(get_input("forum"))->title; ?></h2>
+
+ <!-- display the column heading for a forum's topics -->
+ <table width="100%" border="0" id="topic_titles">
+ <tr>
+ <td><b><?php echo elgg_echo("groups:topic"); ?></b></td>
+ <td width="70px"><b><?php echo elgg_echo("groups:posts"); ?></b></td>
+ <td width="130px"><b><?php echo elgg_echo("groups:lastperson"); ?></b></td>
+ <td width="100px"><b><?php echo elgg_echo("groups:when"); ?></b></td>
+ </tr>
+ </table>
+
+
+<?php
+ // If there are any topics to view, view them
+ if (is_array($vars['entity']) && sizeof($vars['entity']) > 0) {
+
+ foreach($vars['entity'] as $topic) {
+
+ //This function controls the alternating background on table cells for topics
+ $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even';
+ //get the last reply annotation posted and the user who posted it
+ //this is used to display the time and person who made the last post
+ $last_post = $topic->getAnnotations("group_topic_post", 1, 0, "desc");
+ //get the time and user
+ foreach($last_post as $last){
+ $last_time = $last->time_created;
+ $last_user = $last->owner_guid;
+ }
+
+ //display the divs
+ echo "<div class=\"forum_topics\"><div class=\"{$even_odd}\">";
+?>
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td>
+ <a href="<?php echo $vars['url']; ?>mod/groups/topicposts.php?topic=<?php echo $topic->guid; ?>&group_guid=<?php echo $topic->container_guid; ?>"><?php echo $topic->title; ?></a>
+ <!-- display edit and delete links if the user has privileges -->
+ <?php
+
+ // check to see if the current user can edit
+ if ($topic->canEdit()) {
+
+ ?>
+ <a href="<?php echo $vars['url']; ?>mod/groups/edittopic.php?topic=<?php echo $topic->guid; ?>&group=<?php echo $topic->container_guid; ?>"><?php echo elgg_echo("edit"); ?></a>
+ <?php
+
+ // display the delete link to those allowed to delete
+ echo elgg_view("output/confirmlink", array(
+ 'href' => $vars['url'] . "action/groups/deletetopic?topic=" . $topic->getGUID() . "&group=" . $topic->container_guid,
+ 'text' => elgg_echo('delete'),
+ 'confirm' => elgg_echo('deleteconfirm'),
+ ));
+
+ ?>
+ <?php
+ }
+
+ ?>
+ </td>
+ <td width="70px" valign="top">
+ <p><?php
+ echo ($topic->countAnnotations("group_topic_post"));
+ ?></p>
+ </td>
+ <td width="130px" valign="top">
+ <p>
+ <?php
+ //display the last user to post
+ echo get_user($last_user)->name;
+ ?>
+ </p>
+ </td>
+ <td width="100px" valign="top">
+ <p><small>
+ <?php
+ //display the time of the last post
+ echo friendly_time($last_time);
+ ?>
+ </small></p>
+ </td>
+ </tr>
+ </table>
+
+ <!-- close the two display divs -->
+ </div></div>
+
+<?php
+ }
+
+ } else {
+
+ // if there are no topics, display a message saying so
+ echo "<p>". elgg_echo("grouptopic:notcreated") . "</p>";
+
+ }
+
+?>
+
+ </div><!-- close the forum_topics div --> \ No newline at end of file
diff --git a/mod/groups/views/default/forum/viewposts.php b/mod/groups/views/default/forum/viewposts.php
new file mode 100644
index 000000000..20f56ec8d
--- /dev/null
+++ b/mod/groups/views/default/forum/viewposts.php
@@ -0,0 +1,44 @@
+<?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
+ * @link http://elgg.com/
+ */
+
+?>
+
+<div id="topic_posts"><!-- open the topic_posts div -->
+ <p><a href="<?php echo $vars['url']; ?>pg/groups/forum/<?php echo $vars['entity']->container_guid; ?>/"><?php echo elgg_echo("groups:forum"); ?></a> &raquo; <?php echo $vars['entity']->title; ?></a></p>
+ <!-- grab the topic title -->
+ <h2><?php echo $vars['entity']->title; ?></h2>
+
+<?php
+ //display follow up comments
+ foreach($vars['entity']->getAnnotations('group_topic_post', 50, 0, "asc") as $post) {
+
+ echo elgg_view("forum/topicposts",array('entity' => $post));
+
+ }
+
+ // 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") {
+
+ //this topic has been closed by the owner
+ echo "<h2>" . elgg_echo("groups:topicisclosed") . "</h2>";
+ echo "<p>" . elgg_echo("groups:topiccloseddesc") . "</p>";
+
+ } else {
+ }
+
+?>
+</div> \ No newline at end of file
diff --git a/mod/groups/views/default/groups/forum_latest.php b/mod/groups/views/default/groups/forum_latest.php
new file mode 100644
index 000000000..f0a62a14f
--- /dev/null
+++ b/mod/groups/views/default/groups/forum_latest.php
@@ -0,0 +1,14 @@
+<h2>Forum latest</h2>
+<?php
+
+//get the latest from the group files
+// Display them
+ // list_entities_from_annotations($entity_type = "", $entity_subtype = "", $name = "", $value = "", $limit = 10, $owner_guid = 0, $group_guid = 0, $asc = false, $fullview = true) {
+
+ set_context('search');
+ // $forum_topics = list_entities_from_annotations("object", "groupforumtopic", "group_topic_post", "", 5, 0, 3, false, true);
+ set_context('forums');
+
+ echo $forum_topics;
+
+?> \ No newline at end of file
diff --git a/mod/groups/views/default/groups/profileitems.php b/mod/groups/views/default/groups/profileitems.php
index d7635979f..b935f6936 100644
--- a/mod/groups/views/default/groups/profileitems.php
+++ b/mod/groups/views/default/groups/profileitems.php
@@ -12,6 +12,7 @@
//right column
echo "<div class=\"right_column\">";
+ echo elgg_view("groups/forum_latest",array('entity' => $vars['entity']));
echo elgg_view("groups/right_column",array('entity' => $vars['entity']));
echo "</div>";