aboutsummaryrefslogtreecommitdiff
path: root/mod/groups
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2011-08-25 10:00:38 -0700
committerBrett Profitt <brett.profitt@gmail.com>2011-08-25 10:00:38 -0700
commitdccc333c765bb28da55b4a55d9c916acdb88413a (patch)
treebdd26a0b4cd85241a19b7fcb2c0770f0ac3eb9f0 /mod/groups
parentec7b94a64aef23b85866ecdac8e8acc712d29bb6 (diff)
parent003cb81c7888f4d2fd763e5814027c6f8d71186f (diff)
downloadelgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.gz
elgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.bz2
Merge branch 'master' of github.com:brettp/Elgg
Diffstat (limited to 'mod/groups')
-rw-r--r--mod/groups/actions/discussion/reply/save.php35
-rw-r--r--mod/groups/actions/groups/membership/remove.php31
-rw-r--r--mod/groups/languages/en.php11
-rw-r--r--mod/groups/lib/discussion.php11
-rw-r--r--mod/groups/lib/groups.php68
-rw-r--r--mod/groups/start.php96
-rw-r--r--mod/groups/views/default/annotation/group_topic_post.php17
-rw-r--r--mod/groups/views/default/discussion/group_module.php22
-rw-r--r--mod/groups/views/default/forms/discussion/reply/save.php46
-rw-r--r--mod/groups/views/default/forms/discussion/save.php2
-rw-r--r--mod/groups/views/default/forms/groups/edit.php2
-rw-r--r--mod/groups/views/default/forms/groups/invite.php2
-rw-r--r--mod/groups/views/default/group/default.php1
-rw-r--r--mod/groups/views/default/groups/css.php11
-rw-r--r--mod/groups/views/default/groups/edit.php5
-rw-r--r--mod/groups/views/default/groups/js.php3
-rw-r--r--mod/groups/views/default/groups/profile/activity_module.php11
-rw-r--r--mod/groups/views/default/groups/profile/buttons.php57
-rw-r--r--mod/groups/views/default/groups/profile/module.php25
-rw-r--r--mod/groups/views/default/groups/profile/widgets.php13
-rw-r--r--mod/groups/views/default/groups/sidebar/featured.php2
-rw-r--r--mod/groups/views/default/groups/sidebar/members.php3
-rw-r--r--mod/groups/views/default/object/groupforumtopic.php2
-rw-r--r--mod/groups/views/default/river/annotation/group_topic_post/reply.php25
-rw-r--r--mod/groups/views/default/river/group/create.php20
-rw-r--r--mod/groups/views/default/river/object/groupforumtopic/create.php38
-rw-r--r--mod/groups/views/default/river/relationship/member/create.php14
27 files changed, 361 insertions, 212 deletions
diff --git a/mod/groups/actions/discussion/reply/save.php b/mod/groups/actions/discussion/reply/save.php
index 109938dbb..a1ed036b6 100644
--- a/mod/groups/actions/discussion/reply/save.php
+++ b/mod/groups/actions/discussion/reply/save.php
@@ -9,6 +9,7 @@ gatekeeper();
// Get input
$entity_guid = (int) get_input('entity_guid');
$text = get_input('group_topic_post');
+$annotation_id = (int) get_input('annotation_id');
// reply cannot be empty
if (empty($text)) {
@@ -30,16 +31,30 @@ if (!$group->canWriteToContainer($user)) {
forward(REFERER);
}
-
-// add the reply to the forum topic
-$reply_id = $topic->annotate('group_topic_post', $text, $topic->access_id, $user->guid);
-if ($reply_id == false) {
- system_message(elgg_echo('groupspost:failure'));
- forward(REFERER);
+// if editing a reply, make sure it's valid
+if ($annotation_id) {
+ $annotation = elgg_get_annotation_from_id($annotation_id);
+ if (!$annotation->canEdit()) {
+ register_error(elgg_echo('groups:notowner'));
+ forward(REFERER);
+ }
+
+ $annotation->value = $text;
+ if (!$annotation->save()) {
+ system_message(elgg_echo('groups:forumpost:error'));
+ forward(REFERER);
+ }
+ system_message(elgg_echo('groups:forumpost:edited'));
+} else {
+ // add the reply to the forum topic
+ $reply_id = $topic->annotate('group_topic_post', $text, $topic->access_id, $user->guid);
+ if ($reply_id == false) {
+ system_message(elgg_echo('groupspost:failure'));
+ forward(REFERER);
+ }
+
+ add_to_river('river/annotation/group_topic_post/reply', 'reply', $user->guid, $topic->guid, "", 0, $reply_id);
+ system_message(elgg_echo('groupspost:success'));
}
-add_to_river('river/annotation/group_topic_post/reply', 'reply', $user->guid, $topic->guid, "", 0, $reply_id);
-
-system_message(elgg_echo('groupspost:success'));
-
forward(REFERER);
diff --git a/mod/groups/actions/groups/membership/remove.php b/mod/groups/actions/groups/membership/remove.php
new file mode 100644
index 000000000..650d35286
--- /dev/null
+++ b/mod/groups/actions/groups/membership/remove.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Remove a user from a group
+ *
+ * @package ElggGroups
+ */
+
+$user_guid = get_input('user_guid');
+$group_guid = get_input('group_guid');
+
+$user = get_entity($user_guid);
+$group = get_entity($group_guid);
+
+elgg_set_page_owner_guid($group->guid);
+
+if (($user instanceof ElggUser) && ($group instanceof ElggGroup) && $group->canEdit()) {
+ // Don't allow removing group owner
+ if ($group->getOwnerGUID() != $user->getGUID()) {
+ if ($group->leave($user)) {
+ system_message(elgg_echo("groups:removed", array($user->name)));
+ } else {
+ register_error(elgg_echo("groups:cantremove"));
+ }
+ } else {
+ register_error(elgg_echo("groups:cantremove"));
+ }
+} else {
+ register_error(elgg_echo("groups:cantremove"));
+}
+
+forward(REFERER);
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php
index 63a6df3a9..9f8bed9a4 100644
--- a/mod/groups/languages/en.php
+++ b/mod/groups/languages/en.php
@@ -166,6 +166,9 @@ $english = array(
'groups:notitle' => 'Groups must have a title',
'groups:cantjoin' => 'Can not join group',
'groups:cantleave' => 'Could not leave group',
+ 'groups:removeuser' => 'Remove from group',
+ 'groups:cantremove' => 'Cannot remove user from group',
+ 'groups:removed' => 'Successfully removed %s from group',
'groups:addedtogroup' => 'Successfully added the user to the group',
'groups:joinrequestnotmade' => 'Could not request to join group',
'groups:joinrequestmade' => 'Requested to join group',
@@ -210,10 +213,10 @@ or click below to view the group's join requests:
Forum river items
*/
- 'groups:river:create' => 'created the group',
- 'groups:river:join' => 'joined the group',
- 'forumtopic:river:create' => 'added a new discussion topic',
- 'groups:river:reply' => 'replied on the discussion topic',
+ 'river:create:group:default' => '%s created the group %s',
+ 'river:join:group:default' => '%s joined the group %s',
+ 'river:create:object:groupforumtopic' => '%s added a new discussion topic %s',
+ 'river:reply:object:groupforumtopic' => '%s replied on the discussion topic %s',
'groups:nowidgets' => 'No widgets have been defined for this group.',
diff --git a/mod/groups/lib/discussion.php b/mod/groups/lib/discussion.php
index 94d212ef6..e129e0f9d 100644
--- a/mod/groups/lib/discussion.php
+++ b/mod/groups/lib/discussion.php
@@ -23,7 +23,6 @@ function discussion_handle_all_page() {
'content' => $content,
'title' => elgg_echo('discussion:latest'),
'filter' => '',
- 'buttons' => '',
);
$body = elgg_view_layout('content', $params);
@@ -46,6 +45,8 @@ function discussion_handle_list_page($guid) {
}
elgg_push_breadcrumb($group->name);
+ elgg_register_title_button();
+
group_gatekeeper();
$title = elgg_echo('item:object:groupforumtopic');
@@ -67,10 +68,6 @@ function discussion_handle_list_page($guid) {
'filter' => '',
);
- if (!$group->canWriteToContainer()) {
- $params['buttons'] = '';
- }
-
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
@@ -131,7 +128,6 @@ function discussion_handle_edit_page($type, $guid) {
'content' => $content,
'title' => $title,
'filter' => '',
- 'buttons' => '',
);
$body = elgg_view_layout('content', $params);
@@ -167,7 +163,7 @@ function discussion_handle_view_page($guid) {
elgg_push_breadcrumb($group->name, "discussion/owner/$group->guid");
elgg_push_breadcrumb($topic->title);
- $content = elgg_view_entity($topic, true);
+ $content = elgg_view_entity($topic, array('full_view' => true));
if ($topic->status == 'closed') {
$content .= elgg_view('discussion/replies', array(
'entity' => $topic,
@@ -190,7 +186,6 @@ function discussion_handle_view_page($guid) {
'content' => $content,
'title' => $topic->title,
'filter' => '',
- 'buttons' => '',
);
$body = elgg_view_layout('content', $params);
diff --git a/mod/groups/lib/groups.php b/mod/groups/lib/groups.php
index 279c5f238..12a22deb4 100644
--- a/mod/groups/lib/groups.php
+++ b/mod/groups/lib/groups.php
@@ -12,6 +12,8 @@ function groups_handle_all_page() {
elgg_pop_breadcrumb();
elgg_push_breadcrumb(elgg_echo('groups'));
+ elgg_register_title_button();
+
$selected_tab = get_input('filter', 'newest');
switch ($selected_tab) {
@@ -81,7 +83,6 @@ function groups_search_page() {
'content' => $content,
'sidebar' => $sidebar,
'filter' => false,
- 'buttons' => false,
'title' => $title,
);
$body = elgg_view_layout('content', $params);
@@ -99,6 +100,8 @@ function groups_handle_owned_page() {
$title = elgg_echo('groups:owned');
elgg_push_breadcrumb($title);
+ elgg_register_title_button();
+
$content = elgg_list_entities(array(
'type' => 'group',
'owner_guid' => elgg_get_page_owner_guid(),
@@ -125,6 +128,8 @@ function groups_handle_mine_page() {
$title = elgg_echo('groups:yours');
elgg_push_breadcrumb($title);
+ elgg_register_title_button();
+
$content = elgg_list_entities_from_relationship_count(array(
'type' => 'group',
'relationship' => 'member',
@@ -175,7 +180,6 @@ function groups_handle_edit_page($page, $guid = 0) {
'content' => $content,
'title' => $title,
'filter' => '',
- 'buttons' => '',
);
$body = elgg_view_layout('content', $params);
@@ -201,7 +205,6 @@ function groups_handle_invitations_page() {
'content' => $content,
'title' => $title,
'filter' => '',
- 'buttons' => '',
);
$body = elgg_view_layout('content', $params);
@@ -234,11 +237,12 @@ function groups_handle_profile_page($guid) {
$sidebar = '';
}
+ groups_register_profile_buttons($group);
+
$params = array(
'content' => $content,
'sidebar' => $sidebar,
'title' => $group->name,
- 'buttons' => elgg_view('groups/profile/buttons', array('entity' => $group)),
'filter' => '',
);
$body = elgg_view_layout('content', $params);
@@ -280,7 +284,6 @@ function groups_handle_activity_page($guid) {
$params = array(
'content' => $content,
'title' => $title,
- 'buttons' => '',
'filter' => '',
);
$body = elgg_view_layout('content', $params);
@@ -307,7 +310,7 @@ function groups_handle_members_page($guid) {
$title = elgg_echo('groups:members:title', array($group->name));
elgg_push_breadcrumb($group->name, $group->getURL());
- elgg_push_breadcrumb(elgg_echo('groups:members:'));
+ elgg_push_breadcrumb(elgg_echo('groups:members'));
$content = elgg_list_entities_from_relationship(array(
'relationship' => 'member',
@@ -320,7 +323,6 @@ function groups_handle_members_page($guid) {
$params = array(
'content' => $content,
'title' => $title,
- 'buttons' => '',
'filter' => '',
);
$body = elgg_view_layout('content', $params);
@@ -348,7 +350,7 @@ function groups_handle_invite_page($guid) {
if ($group && $group->canEdit()) {
$content = elgg_view_form('groups/invite', array(
'id' => 'invite_to_group',
- 'class' => 'mtm',
+ 'class' => 'elgg-form-alt mtm',
), array(
'entity' => $group,
));
@@ -359,7 +361,6 @@ function groups_handle_invite_page($guid) {
$params = array(
'content' => $content,
'title' => $title,
- 'buttons' => '',
'filter' => '',
);
$body = elgg_view_layout('content', $params);
@@ -403,10 +404,57 @@ function groups_handle_requests_page($guid) {
$params = array(
'content' => $content,
'title' => $title,
- 'buttons' => '',
'filter' => '',
);
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
}
+
+/**
+ * Registers the buttons for title area of the group profile page
+ *
+ * @param ElggGroup $group
+ */
+function groups_register_profile_buttons($group) {
+
+ $actions = array();
+
+ // group owners
+ if ($group->canEdit()) {
+ // edit and invite
+ $url = elgg_get_site_url() . "groups/edit/{$group->getGUID()}";
+ $actions[$url] = 'groups:edit';
+ $url = elgg_get_site_url() . "groups/invite/{$group->getGUID()}";
+ $actions[$url] = 'groups:invite';
+ }
+
+ // group members
+ if ($group->isMember($user)) {
+ // leave
+ $url = elgg_get_site_url() . "action/groups/leave?group_guid={$group->getGUID()}";
+ $url = elgg_add_action_tokens_to_url($url);
+ $actions[$url] = 'groups:leave';
+ } else {
+ // join - admins can always join.
+ $url = elgg_get_site_url() . "action/groups/join?group_guid={$group->getGUID()}";
+ $url = elgg_add_action_tokens_to_url($url);
+ if ($group->isPublicMembership() || $group->canEdit()) {
+ $actions[$url] = 'groups:join';
+ } else {
+ // request membership
+ $actions[$url] = 'groups:joinrequest';
+ }
+ }
+
+ if ($actions) {
+ foreach ($actions as $url => $text) {
+ elgg_register_menu_item('title', array(
+ 'name' => $text,
+ 'href' => $url,
+ 'text' => elgg_echo($text),
+ 'link_class' => 'elgg-button elgg-button-action',
+ ));
+ }
+ }
+}
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 73bdd08a9..9e4694457 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -44,6 +44,7 @@ function groups_init() {
elgg_register_action("groups/invite", "$action_base/invite.php");
elgg_register_action("groups/join", "$action_base/join.php");
elgg_register_action("groups/leave", "$action_base/leave.php");
+ elgg_register_action("groups/remove", "$action_base/remove.php");
elgg_register_action("groups/killrequest", "$action_base/delete_request.php");
elgg_register_action("groups/killinvitation", "$action_base/delete_invite.php");
elgg_register_action("groups/addtogroup", "$action_base/add.php");
@@ -60,6 +61,12 @@ function groups_init() {
// group entity menu
elgg_register_plugin_hook_handler('register', 'menu:entity', 'groups_entity_menu_setup');
+
+ // group user hover menu
+ elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'groups_user_entity_menu_setup');
+
+ // delete and edit annotations for topic replies
+ elgg_register_plugin_hook_handler('register', 'menu:annotation', 'groups_annotation_menu_setup');
//extend some views
elgg_extend_view('css/elgg', 'groups/css');
@@ -367,6 +374,89 @@ function groups_entity_menu_setup($hook, $type, $return, $params) {
}
/**
+ * Add a remove user link to user hover menu when the page owner is a group
+ */
+function groups_user_entity_menu_setup($hook, $type, $return, $params) {
+ if (elgg_is_logged_in()) {
+ $group = elgg_get_page_owner_entity();
+
+ // Check for valid group
+ if (!elgg_instanceof($group, 'group')) {
+ return $return;
+ }
+
+ $entity = $params['entity'];
+
+ // Make sure we have a user and that user is a member of the group
+ if (!elgg_instanceof($entity, 'user') || !$group->isMember($entity)) {
+ return $return;
+ }
+
+ // Add remove link if we can edit the group, and if we're not trying to remove the group owner
+ if ($group->canEdit() && $group->getOwnerGUID() != $entity->guid) {
+ $remove = elgg_view('output/confirmlink', array(
+ 'href' => "action/groups/remove?user_guid={$entity->guid}&group_guid={$group->guid}",
+ 'text' => elgg_echo('groups:removeuser'),
+ ));
+
+ $options = array(
+ 'name' => 'removeuser',
+ 'text' => $remove,
+ 'priority' => 999,
+ );
+ $return[] = ElggMenuItem::factory($options);
+ }
+ }
+
+ return $return;
+}
+
+/**
+ * Add edit and delete links for forum replies
+ */
+function groups_annotation_menu_setup($hook, $type, $return, $params) {
+ if (elgg_in_context('widgets')) {
+ return $return;
+ }
+
+ $annotation = $params['annotation'];
+
+ if ($annotation->name != 'group_topic_post') {
+ return $return;
+ }
+
+ if ($annotation->canEdit()) {
+ $url = elgg_http_add_url_query_elements('action/discussion/reply/delete', array(
+ 'annotation_id' => $annotation->id,
+ ));
+
+ $options = array(
+ 'name' => 'delete',
+ 'href' => $url,
+ 'text' => "<span class=\"elgg-icon elgg-icon-delete\"></span>",
+ 'confirm' => elgg_echo('deleteconfirm'),
+ 'text_encode' => false
+ );
+ $return[] = ElggMenuItem::factory($options);
+
+ $url = elgg_http_add_url_query_elements('discussion', array(
+ 'annotation_id' => $annotation->id,
+ ));
+
+ $options = array(
+ 'name' => 'edit',
+ 'href' => "#edit-annotation-$annotation->id",
+ 'text' => elgg_echo('edit'),
+ 'text_encode' => false,
+ 'rel' => 'toggle',
+ );
+ $return[] = ElggMenuItem::factory($options);
+ }
+
+ return $return;
+}
+
+/**
* Groups created so create an access list for it
*/
function groups_create_event_listener($event, $object_type, $object) {
@@ -621,7 +711,7 @@ function discussion_init() {
// commenting not allowed on discussion topics (use a different annotation)
elgg_register_plugin_hook_handler('permissions_check:comment', 'object', 'discussion_comment_override');
-
+
$action_base = elgg_get_plugins_path() . 'groups/actions/discussion';
elgg_register_action('discussion/save', "$action_base/save.php");
elgg_register_action('discussion/delete', "$action_base/delete.php");
@@ -722,7 +812,7 @@ function discussion_owner_block_menu($hook, $type, $return, $params) {
* Add the reply button for the river
*/
function discussion_add_to_river_menu($hook, $type, $return, $params) {
- if (elgg_is_logged_in()) {
+ if (elgg_is_logged_in() && !elgg_in_context('widgets')) {
$item = $params['item'];
$object = $item->getObjectEntity();
if (elgg_instanceof($object, 'object', 'groupforumtopic')) {
@@ -734,7 +824,7 @@ function discussion_add_to_river_menu($hook, $type, $return, $params) {
'href' => "#groups-reply-$object->guid",
'text' => elgg_view_icon('speech-bubble'),
'title' => elgg_echo('reply:this'),
- 'link_class' => "elgg-toggler",
+ 'rel' => 'toggle',
'priority' => 50,
);
$return[] = ElggMenuItem::factory($options);
diff --git a/mod/groups/views/default/annotation/group_topic_post.php b/mod/groups/views/default/annotation/group_topic_post.php
index d2303aba8..f38d2a77a 100644
--- a/mod/groups/views/default/annotation/group_topic_post.php
+++ b/mod/groups/views/default/annotation/group_topic_post.php
@@ -1,8 +1,19 @@
<?php
-/**
- * Discussion reply
+/*
+ * Embeds an edit link for the annotation
*/
-$vars['delete_action'] = 'action/discussion/reply/delete';
+$annotation = elgg_extract('annotation', $vars);
echo elgg_view('annotation/default', $vars);
+
+if ($annotation->canEdit()) {
+ $form = elgg_view_form('discussion/reply/save', array(), array_merge(array(
+ 'entity' => get_entity($annotation->entity_guid),
+ 'annotation' => $annotation
+ ), $vars)
+ );
+
+ echo "<div class=\"hidden mbm\" id=\"edit-annotation-$annotation->id\">$form</div>";
+}
+
diff --git a/mod/groups/views/default/discussion/group_module.php b/mod/groups/views/default/discussion/group_module.php
index 165d9b1be..3a46e336e 100644
--- a/mod/groups/views/default/discussion/group_module.php
+++ b/mod/groups/views/default/discussion/group_module.php
@@ -17,10 +17,6 @@ $all_link = elgg_view('output/url', array(
'text' => elgg_echo('link:view:all'),
));
-$header = "<span class=\"groups-widget-viewall\">$all_link</span>";
-$header .= '<h3>' . elgg_echo('discussion:group') . '</h3>';
-
-
elgg_push_context('widgets');
$options = array(
'type' => 'object',
@@ -37,12 +33,14 @@ if (!$content) {
$content = '<p>' . elgg_echo('grouptopic:notcreated') . '</p>';
}
-if ($group->canWriteToContainer()) {
- $new_link = elgg_view('output/url', array(
- 'href' => "discussion/add/" . $group->getGUID(),
- 'text' => elgg_echo('groups:addtopic'),
- ));
- $content .= "<span class='elgg-widget-more'>$new_link</span>";
-}
+$new_link = elgg_view('output/url', array(
+ 'href' => "discussion/add/" . $group->getGUID(),
+ 'text' => elgg_echo('groups:addtopic'),
+));
-echo elgg_view_module('info', '', $content, array('header' => $header));
+echo elgg_view('groups/profile/module', array(
+ 'title' => elgg_echo('discussion:group'),
+ 'content' => $content,
+ 'all_link' => $all_link,
+ 'add_link' => $new_link,
+)); \ No newline at end of file
diff --git a/mod/groups/views/default/forms/discussion/reply/save.php b/mod/groups/views/default/forms/discussion/reply/save.php
index be258b8fe..083fefb78 100644
--- a/mod/groups/views/default/forms/discussion/reply/save.php
+++ b/mod/groups/views/default/forms/discussion/reply/save.php
@@ -1,29 +1,57 @@
<?php
/**
- * Discussion topic reply form bofy
+ * Discussion topic reply form body
*
* @uses $vars['entity'] A discussion topic object
* @uses $vars['inline'] Display a shortened form?
*/
-
if (isset($vars['entity']) && elgg_is_logged_in()) {
+ echo elgg_view('input/hidden', array(
+ 'name' => 'entity_guid',
+ 'value' => $vars['entity']->getGUID(),
+ ));
+
$inline = elgg_extract('inline', $vars, false);
+ $annotation = elgg_extract('annotation', $vars);
+
+ $value = '';
+
+ if ($annotation) {
+ $value = $annotation->value;
+ echo elgg_view('input/hidden', array(
+ 'name' => 'annotation_id',
+ 'value' => $annotation->id
+ ));
+ }
+
if ($inline) {
- echo elgg_view('input/text', array('name' => 'group_topic_post'));
+ echo elgg_view('input/text', array('name' => 'group_topic_post', 'value' => $value));
echo elgg_view('input/submit', array('value' => elgg_echo('reply')));
} else {
?>
<div>
- <label><?php echo elgg_echo("reply"); ?></label>
- <?php echo elgg_view('input/longtext', array('name' => 'group_topic_post')); ?>
+ <label>
+ <?php
+ if ($annotation) {
+ echo elgg_echo('edit');
+ } else {
+ echo elgg_echo("reply");
+ }
+ ?>
+ </label>
+ <?php echo elgg_view('input/longtext', array('name' => 'group_topic_post', 'value' => $value)); ?>
</div>
+ <div class="elgg-foot">
<?php
+ if ($annotation) {
+ echo elgg_view('input/submit', array('value' => elgg_echo('save')));
+ } else {
echo elgg_view('input/submit', array('value' => elgg_echo('reply')));
}
- echo elgg_view('input/hidden', array(
- 'name' => 'entity_guid',
- 'value' => $vars['entity']->getGUID(),
- ));
+?>
+ </div>
+<?php
+ }
}
diff --git a/mod/groups/views/default/forms/discussion/save.php b/mod/groups/views/default/forms/discussion/save.php
index 5d50d5c91..a6582ede7 100644
--- a/mod/groups/views/default/forms/discussion/save.php
+++ b/mod/groups/views/default/forms/discussion/save.php
@@ -42,7 +42,7 @@ $guid = elgg_extract('guid', $vars, null);
<label><?php echo elgg_echo('access'); ?></label><br />
<?php echo elgg_view('input/access', array('name' => 'access_id', 'value' => $access_id)); ?>
</div>
-<div>
+<div class="elgg-foot">
<?php
echo elgg_view('input/hidden', array('name' => 'container_guid', 'value' => $container_guid));
diff --git a/mod/groups/views/default/forms/groups/edit.php b/mod/groups/views/default/forms/groups/edit.php
index b67134c63..26436ef01 100644
--- a/mod/groups/views/default/forms/groups/edit.php
+++ b/mod/groups/views/default/forms/groups/edit.php
@@ -126,7 +126,7 @@ if ($tools) {
}
}
?>
-<div class="elgg-form-footer-alt">
+<div class="elgg-foot">
<?php
if (isset($vars['entity'])) {
diff --git a/mod/groups/views/default/forms/groups/invite.php b/mod/groups/views/default/forms/groups/invite.php
index 83139c2ee..ef3131782 100644
--- a/mod/groups/views/default/forms/groups/invite.php
+++ b/mod/groups/views/default/forms/groups/invite.php
@@ -12,7 +12,7 @@ $friends = elgg_get_logged_in_user_entity()->getFriends('', 0);
if ($friends) {
echo elgg_view('input/friendspicker', array('entities' => $friends, 'name' => 'user_guid', 'highlight' => 'all'));
- echo '<div class="elgg-form-footer">';
+ echo '<div class="elgg-foot">';
echo elgg_view('input/hidden', array('name' => 'forward_url', 'value' => $forward_url));
echo elgg_view('input/hidden', array('name' => 'group_guid', 'value' => $group->guid));
echo elgg_view('input/submit', array('value' => elgg_echo('invite')));
diff --git a/mod/groups/views/default/group/default.php b/mod/groups/views/default/group/default.php
index 2aa377813..fc91f90d0 100644
--- a/mod/groups/views/default/group/default.php
+++ b/mod/groups/views/default/group/default.php
@@ -31,6 +31,7 @@ if ($vars['full_view']) {
'metadata' => $metadata,
'subtitle' => $group->briefdescription,
);
+ $params = $params + $vars;
$list_body = elgg_view('group/elements/summary', $params);
echo elgg_view_image_block($icon, $list_body);
diff --git a/mod/groups/views/default/groups/css.php b/mod/groups/views/default/groups/css.php
index 37fc5dc10..9c65d1602 100644
--- a/mod/groups/views/default/groups/css.php
+++ b/mod/groups/views/default/groups/css.php
@@ -36,15 +36,14 @@
margin: 0;
}
-#groups-tools > .elgg-module {
- float: left;
- margin-bottom: 40px;
+#groups-tools > li {
+ width: 48%;
min-height: 200px;
- width: 350px;
+ margin-bottom: 40px;
}
-#groups-tools > .elgg-module:nth-child(odd) {
- margin-right: 30px;
+#groups-tools > li:nth-child(odd) {
+ margin-right: 4%;
}
.groups-widget-viewall {
diff --git a/mod/groups/views/default/groups/edit.php b/mod/groups/views/default/groups/edit.php
index 5076cc49a..24a1c3f1e 100644
--- a/mod/groups/views/default/groups/edit.php
+++ b/mod/groups/views/default/groups/edit.php
@@ -7,6 +7,9 @@
$entity = elgg_extract('entity', $vars, null);
-$form_vars = array('enctype' => 'multipart/form-data');
+$form_vars = array(
+ 'enctype' => 'multipart/form-data',
+ 'class' => 'elgg-form-alt',
+);
$body_vars = array('entity' => $entity);
echo elgg_view_form('groups/edit', $form_vars, $body_vars);
diff --git a/mod/groups/views/default/groups/js.php b/mod/groups/views/default/groups/js.php
index dec31cf54..ad742445b 100644
--- a/mod/groups/views/default/groups/js.php
+++ b/mod/groups/views/default/groups/js.php
@@ -1,4 +1,5 @@
$(function() {
- $('#groups-tools').find('.elgg-module:odd').addClass('odd');
+ // jQuery uses 0-based indexing
+ $('#groups-tools').children('li:even').addClass('odd');
});
diff --git a/mod/groups/views/default/groups/profile/activity_module.php b/mod/groups/views/default/groups/profile/activity_module.php
index 4ea97cad6..5e557b443 100644
--- a/mod/groups/views/default/groups/profile/activity_module.php
+++ b/mod/groups/views/default/groups/profile/activity_module.php
@@ -21,16 +21,13 @@ $all_link = elgg_view('output/url', array(
'text' => elgg_echo('link:view:all'),
));
-$header = "<span class=\"groups-widget-viewall\">$all_link</span>";
-$header .= '<h3>' . elgg_echo('groups:activity') . '</h3>';
-
elgg_push_context('widgets');
$db_prefix = elgg_get_config('dbprefix');
$content = elgg_list_river(array(
'limit' => 4,
'pagination' => false,
- 'joins' => array("join {$db_prefix}entities e1 on e1.guid = rv.object_guid"),
+ 'joins' => array("JOIN {$db_prefix}entities e1 ON e1.guid = rv.object_guid"),
'wheres' => array("(e1.container_guid = $group->guid)"),
));
elgg_pop_context();
@@ -39,4 +36,8 @@ if (!$content) {
$content = '<p>' . elgg_echo('groups:activity:none') . '</p>';
}
-echo elgg_view_module('info', '', $content, array('header' => $header));
+echo elgg_view('groups/profile/module', array(
+ 'title' => elgg_echo('groups:activity'),
+ 'content' => $content,
+ 'all_link' => $all_link,
+));
diff --git a/mod/groups/views/default/groups/profile/buttons.php b/mod/groups/views/default/groups/profile/buttons.php
deleted file mode 100644
index 55e99f59c..000000000
--- a/mod/groups/views/default/groups/profile/buttons.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-/**
- * Content header action buttons
- *
- * @uses $vars['entity']
- *
- * @todo This should be done by registering menu items with the page actions menu
- */
-
-if (!elgg_is_logged_in()) {
- return true;
-}
-
-
-$actions = array();
-
-// group owners
-if ($vars['entity']->canEdit()) {
- // edit and invite
- $url = elgg_get_site_url() . "groups/edit/{$vars['entity']->getGUID()}";
- $actions[$url] = elgg_echo('groups:edit');
- $url = elgg_get_site_url() . "groups/invite/{$vars['entity']->getGUID()}";
- $actions[$url] = elgg_echo('groups:invite');
-}
-
-// group members
-if ($vars['entity']->isMember($user)) {
- // leave
- $url = elgg_get_site_url() . "action/groups/leave?group_guid={$vars['entity']->getGUID()}";
- $url = elgg_add_action_tokens_to_url($url);
- $actions[$url] = elgg_echo('groups:leave');
-} else {
- // join - admins can always join.
- $url = elgg_get_site_url() . "action/groups/join?group_guid={$vars['entity']->getGUID()}";
- $url = elgg_add_action_tokens_to_url($url);
- if ($vars['entity']->isPublicMembership() || $vars['entity']->canEdit()) {
- $actions[$url] = elgg_echo('groups:join');
- } else {
- // request membership
- $actions[$url] = elgg_echo('groups:joinrequest');
- }
-}
-
-// display action buttons
-if ($actions) {
- echo '<ul class="elgg-menu elgg-menu-title elgg-menu-hz">';
- foreach ($actions as $url => $action) {
- echo '<li>';
- echo elgg_view('output/url', array(
- 'text' => $action,
- 'href' => $url,
- 'class' => 'elgg-button elgg-button-action',
- ));
- echo '</li>';
- }
- echo '</ul>';
-}
diff --git a/mod/groups/views/default/groups/profile/module.php b/mod/groups/views/default/groups/profile/module.php
new file mode 100644
index 000000000..9d0b18266
--- /dev/null
+++ b/mod/groups/views/default/groups/profile/module.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Group module (also called a group widget)
+ *
+ * @uses $vars['title'] The title of the module
+ * @uses $vars['content'] The module content
+ * @uses $vars['all_link'] A link to list content
+ * @uses $vars['add_link'] A link to create content
+ */
+
+$group = elgg_get_page_owner_entity();
+
+$header = "<span class=\"groups-widget-viewall\">{$vars['all_link']}</span>";
+$header .= '<h3>' . $vars['title'] . '</h3>';
+
+if ($group->canWriteToContainer() && isset($vars['add_link'])) {
+ $vars['content'] .= "<span class='elgg-widget-more'>{$vars['add_link']}</span>";
+}
+
+echo '<li>';
+echo elgg_view_module('info', '', $vars['content'], array(
+ 'header' => $header,
+ 'class' => 'elgg-module-group',
+));
+echo '</li>';
diff --git a/mod/groups/views/default/groups/profile/widgets.php b/mod/groups/views/default/groups/profile/widgets.php
index 28e43fdc4..caf019a3a 100644
--- a/mod/groups/views/default/groups/profile/widgets.php
+++ b/mod/groups/views/default/groups/profile/widgets.php
@@ -6,10 +6,19 @@
*/
// tools widget area
-echo '<div id="groups-tools" class="mtl clearfix">';
+echo '<div id="groups-tools" class="elgg-gallery elgg-gallery-fluid mtl clearfix">';
// enable tools to extend this area
-echo elgg_view("groups/tool_latest", array('entity' => $vars['entity']));
+echo elgg_view("groups/tool_latest", $vars);
+
+// backward compatibility
+$right = elgg_view('groups/right_column', $vars);
+$left = elgg_view('groups/left_column', $vars);
+if ($right || $left) {
+ elgg_deprecated_notice('The views groups/right_column and groups/left_column have been replaced by groups/tool_latest', 1.8);
+ echo $left;
+ echo $right;
+}
echo "</div>";
diff --git a/mod/groups/views/default/groups/sidebar/featured.php b/mod/groups/views/default/groups/sidebar/featured.php
index 695782783..8bd51ab5c 100644
--- a/mod/groups/views/default/groups/sidebar/featured.php
+++ b/mod/groups/views/default/groups/sidebar/featured.php
@@ -17,7 +17,7 @@ if ($featured_groups) {
elgg_push_context('widgets');
$body = '';
foreach ($featured_groups as $group) {
- $body .= elgg_view_entity($group, false);
+ $body .= elgg_view_entity($group, array('full_view' => false));
}
elgg_pop_context();
diff --git a/mod/groups/views/default/groups/sidebar/members.php b/mod/groups/views/default/groups/sidebar/members.php
index 28111554f..7249ffbf4 100644
--- a/mod/groups/views/default/groups/sidebar/members.php
+++ b/mod/groups/views/default/groups/sidebar/members.php
@@ -21,7 +21,8 @@ $body = elgg_list_entities_from_relationship(array(
'inverse_relationship' => true,
'types' => 'user',
'limit' => $limit,
- 'gallery' => true,
+ 'list_type' => 'gallery',
+ 'gallery_class' => 'elgg-gallery-users',
));
$body .= "<div class='center mts'>$all_link</div>";
diff --git a/mod/groups/views/default/object/groupforumtopic.php b/mod/groups/views/default/object/groupforumtopic.php
index 3a4decbe4..22589b84d 100644
--- a/mod/groups/views/default/object/groupforumtopic.php
+++ b/mod/groups/views/default/object/groupforumtopic.php
@@ -67,6 +67,7 @@ if ($full) {
'subtitle' => $subtitle,
'tags' => $tags,
);
+ $params = $params + $vars;
$list_body = elgg_view('object/elements/summary', $params);
$info = elgg_view_image_block($poster_icon, $list_body);
@@ -90,6 +91,7 @@ HTML;
'tags' => $tags,
'content' => $excerpt,
);
+ $params = $params + $vars;
$list_body = elgg_view('object/elements/summary', $params);
echo elgg_view_image_block($poster_icon, $list_body);
diff --git a/mod/groups/views/default/river/annotation/group_topic_post/reply.php b/mod/groups/views/default/river/annotation/group_topic_post/reply.php
index 1999c8dd9..cc94fbd43 100644
--- a/mod/groups/views/default/river/annotation/group_topic_post/reply.php
+++ b/mod/groups/views/default/river/annotation/group_topic_post/reply.php
@@ -4,24 +4,9 @@
*/
$object = $vars['item']->getObjectEntity();
$reply = $vars['item']->getAnnotation();
+$excerpt = elgg_get_excerpt($reply->value);
-$url = $object->getURL();
-$title = $object->title;
-$params = array(
- 'href' => $object->getURL(),
- 'text' => $title,
-);
-$object_link = elgg_view('output/url', $params);
-
-$type = $object->getType();
-$subtype = $object->getSubtype();
-
-echo elgg_echo('groups:river:reply') . ' ';
-echo $object_link;
-
-if ($reply) {
- $excerpt = elgg_get_excerpt($reply->value);
- echo '<div class="elgg-river-content">';
- echo $excerpt;
- echo '</div>';
-}
+echo elgg_view('river/item', array(
+ 'item' => $vars['item'],
+ 'message' => $excerpt,
+)); \ No newline at end of file
diff --git a/mod/groups/views/default/river/group/create.php b/mod/groups/views/default/river/group/create.php
index a70f8b51d..cacb5ad3f 100644
--- a/mod/groups/views/default/river/group/create.php
+++ b/mod/groups/views/default/river/group/create.php
@@ -7,19 +7,7 @@ $object = $vars['item']->getObjectEntity();
$excerpt = strip_tags($object->description);
$excerpt = elgg_get_excerpt($excerpt);
-$params = array(
- 'href' => $object->getURL(),
- 'text' => $object->name,
-);
-$link = elgg_view('output/url', $params);
-
-
-echo elgg_echo('groups:river:create');
-
-echo " $link";
-
-if ($excerpt) {
- echo '<div class="elgg-river-content">';
- echo $excerpt;
- echo '</div>';
-}
+echo elgg_view('river/item', array(
+ 'item' => $vars['item'],
+ 'message' => $excerpt,
+)); \ No newline at end of file
diff --git a/mod/groups/views/default/river/object/groupforumtopic/create.php b/mod/groups/views/default/river/object/groupforumtopic/create.php
index 466196921..80e7b09aa 100644
--- a/mod/groups/views/default/river/object/groupforumtopic/create.php
+++ b/mod/groups/views/default/river/object/groupforumtopic/create.php
@@ -7,36 +7,16 @@ $object = $vars['item']->getObjectEntity();
$excerpt = strip_tags($object->description);
$excerpt = elgg_get_excerpt($excerpt);
-$params = array(
- 'href' => $object->getURL(),
- 'text' => $object->title,
-);
-$link = elgg_view('output/url', $params);
-
-$group_string = '';
-$container = $object->getContainerEntity();
-if ($container instanceof ElggGroup) {
- $params = array(
- 'href' => $container->getURL(),
- 'text' => $container->name,
- );
- $group_link = elgg_view('output/url', $params);
- $group_string = elgg_echo('river:ingroup', array($group_link));
-}
-
-echo elgg_echo('forumtopic:river:create');
-
-echo " $link $group_string";
-
-if ($excerpt) {
- echo '<div class="elgg-river-content">';
- echo $excerpt;
- echo '</div>';
-}
-
-if (elgg_is_logged_in() && $container->canWriteToContainer()) {
+$responses = '';
+if (elgg_is_logged_in() && $object->canAnnotate(0, 'group_topic_post')) {
// inline comment form
$form_vars = array('id' => "groups-reply-{$object->getGUID()}", 'class' => 'hidden');
$body_vars = array('entity' => $object, 'inline' => true);
- echo elgg_view_form('discussion/reply/save', $form_vars, $body_vars);
+ $responses = elgg_view_form('discussion/reply/save', $form_vars, $body_vars);
}
+
+echo elgg_view('river/item', array(
+ 'item' => $vars['item'],
+ 'message' => $excerpt,
+ 'responses' => $responses,
+));
diff --git a/mod/groups/views/default/river/relationship/member/create.php b/mod/groups/views/default/river/relationship/member/create.php
index 060826649..d1c4c3ed3 100644
--- a/mod/groups/views/default/river/relationship/member/create.php
+++ b/mod/groups/views/default/river/relationship/member/create.php
@@ -3,14 +3,6 @@
* Group join river view.
*/
-$object = $vars['item']->getObjectEntity();
-
-$params = array(
- 'href' => $object->getURL(),
- 'text' => $object->name,
-);
-$link = elgg_view('output/url', $params);
-
-echo elgg_echo('groups:river:join');
-
-echo " $link";
+echo elgg_view('river/item', array(
+ 'item' => $vars['item'],
+));