From 86371bffa2f6a204149f554534f8f0635735d87c Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 5 Aug 2008 10:18:50 +0000 Subject: Moved group links to the sidebar git-svn-id: https://code.elgg.org/elgg/trunk@1697 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/groups/edit.php | 3 +- mod/groups/index.php | 5 ++- mod/groups/invite.php | 8 +++-- mod/groups/languages/en.php | 2 +- mod/groups/start.php | 37 +++++++++++++++++----- mod/groups/views/default/groups/grouplinks.php | 29 ----------------- mod/groups/views/default/groups/groupprofile.php | 3 -- mod/groups/views/default/groups/menu/actions.php | 35 -------------------- .../views/default/groups/menu/adminlinks.php | 3 -- mod/groups/views/default/groups/menu/links.php | 3 -- .../views/default/groups/menu/ownerlinks.php | 20 ------------ 11 files changed, 39 insertions(+), 109 deletions(-) delete mode 100644 mod/groups/views/default/groups/grouplinks.php delete mode 100644 mod/groups/views/default/groups/menu/actions.php delete mode 100644 mod/groups/views/default/groups/menu/adminlinks.php delete mode 100644 mod/groups/views/default/groups/menu/links.php delete mode 100644 mod/groups/views/default/groups/menu/ownerlinks.php diff --git a/mod/groups/edit.php b/mod/groups/edit.php index 04cfdc35d..49ab302ab 100644 --- a/mod/groups/edit.php +++ b/mod/groups/edit.php @@ -14,7 +14,8 @@ $group_guid = get_input('group_guid'); $group = get_entity($group_guid); - + set_page_owner($group_guid); + $title = elgg_echo("groups:new"); $body = elgg_view_title($title); diff --git a/mod/groups/index.php b/mod/groups/index.php index c0464dfdf..319de038a 100644 --- a/mod/groups/index.php +++ b/mod/groups/index.php @@ -17,13 +17,12 @@ $title = sprintf(elgg_echo("groups:yours"),page_owner_entity()->name); // Get objects - $context = get_context(); + $area2 = elgg_view_title($title); set_context('search'); $objects = list_entities("group", "", page_owner(), $limit, false); - set_context($context); + set_context('groups'); - $area2 = elgg_view_title($title); $area2 .= $objects; $body = elgg_view_layout('two_column_left_sidebar',$area1, $area2); diff --git a/mod/groups/invite.php b/mod/groups/invite.php index ee6c028ad..adab0f408 100644 --- a/mod/groups/invite.php +++ b/mod/groups/invite.php @@ -10,10 +10,12 @@ */ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - gatekeeper(); + gatekeeper(); + + $group_guid = (int) get_input('group_guid'); + $group = get_entity($group_guid); + set_page_owner($group_guid); - $group_guid = get_input('group_guid'); - $group = get_entity($group_guid); $title = elgg_echo("groups:invite"); $area2 = elgg_view_title($title); diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index 4337af5ae..de738573f 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -20,7 +20,7 @@ 'groups:user' => "%s's groups", 'groups:all' => "All groups", 'groups:new' => "Create a new group", - 'groups:edit' => "Edit a group", + 'groups:edit' => "Edit group", 'groups:icon' => 'Group icon (leave blank to leave unchanged)', 'groups:name' => 'Group name', diff --git a/mod/groups/start.php b/mod/groups/start.php index d5dfc76f8..57773378a 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -87,11 +87,34 @@ global $CONFIG; + // Get the page owner entity + $page_owner = page_owner_entity(); + + // Submenu items for all group pages + if ($page_owner instanceof ElggGroup) { + if ($page_owner->canEdit()) { + add_submenu_item(elgg_echo('groups:edit'),$CONFIG->wwwroot . "mod/groups/edit.php?group_guid=" . $page_owner->getGUID()); + 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()); + } else { + if ($vars['entity']->isPublicMembership()) + { + add_submenu_item(elgg_echo('groups:join'),$CONFIG->wwwroot . "action/groups/join?group_guid={$page_owner->getGUID()}"); + } + else + { + add_submenu_item(elgg_echo('groups:joinrequest'),$CONFIG->wwwroot . "action/groups/joinrequest?group_guid={$page_owner->getGUID()}"); + } + } + } + // Add submenu options if (get_context() == "groups") { if ((page_owner() == $_SESSION['guid'] || !page_owner()) && isloggedin()) { - add_submenu_item(sprintf(elgg_echo('groups:new'), $CONFIG->wwwroot."pg/groups/new/")); - add_submenu_item(sprintf(elgg_echo('groups:yours'), $CONFIG->wwwroot . "pg/groups/owned/" . $_SESSION['user']->username)); + add_submenu_item(elgg_echo('groups:new'), $CONFIG->wwwroot."pg/groups/new/"); + add_submenu_item(elgg_echo('groups:yours'), $CONFIG->wwwroot . "pg/groups/owned/" . $_SESSION['user']->username); add_submenu_item(elgg_echo('groups:all'), $CONFIG->wwwroot . "pg/groups/world/"); } else if (page_owner()) { $page_owner = page_owner_entity(); @@ -219,15 +242,13 @@ */ function groups_write_acl_plugin_hook($hook, $entity_type, $returnvalue, $params) { - $group_guid = get_input('group_guid'); + $page_owner = page_owner_entity(); - if ($group_guid) + if ($page_owner instanceof ElggGroup) { - $group = get_entity($group_guid); - - if (($group) && ($group->can_write_to_container($_SESSION['user']->guid))) + if (can_write_to_container()) { - $returnvalue[$group->group_acl] = elgg_echo('groups:group') . ": " . $group->name; + $returnvalue[$page_owner->group_acl] = elgg_echo('groups:group') . ": " . $page_owner->name; return $returnvalue; } diff --git a/mod/groups/views/default/groups/grouplinks.php b/mod/groups/views/default/groups/grouplinks.php deleted file mode 100644 index f5f071eb0..000000000 --- a/mod/groups/views/default/groups/grouplinks.php +++ /dev/null @@ -1,29 +0,0 @@ -guid == $vars['entity']->owner_guid){ - - echo "
"; //start the wrapper div - echo elgg_view("groups/menu/actions",$vars); - echo elgg_view("groups/menu/links",$vars); - echo "
"; //close wrapper div - - } else { - - echo "
"; //start the wrapper div - echo elgg_view("groups/menu/actions",$vars); //grab action links such as make friend - echo elgg_view("groups/menu/links",$vars); //passive links to items such as user blog etc - echo "
"; //close wrapper div - - } - -?> \ No newline at end of file diff --git a/mod/groups/views/default/groups/groupprofile.php b/mod/groups/views/default/groups/groupprofile.php index c8e48ebed..772f644a2 100644 --- a/mod/groups/views/default/groups/groupprofile.php +++ b/mod/groups/views/default/groups/groupprofile.php @@ -32,9 +32,6 @@ 'size' => $iconsize, ) ); - - // display relevant links - echo elgg_view("groups/grouplinks", array("entity" => $vars['entity'])); ?> diff --git a/mod/groups/views/default/groups/menu/actions.php b/mod/groups/views/default/groups/menu/actions.php deleted file mode 100644 index 4c27fea9b..000000000 --- a/mod/groups/views/default/groups/menu/actions.php +++ /dev/null @@ -1,35 +0,0 @@ -isMember($_SESSION['user'])) - { - ?>

isPublicMembership()) - { - ?>

canEdit()) - { - ?>

\ No newline at end of file diff --git a/mod/groups/views/default/groups/menu/adminlinks.php b/mod/groups/views/default/groups/menu/adminlinks.php deleted file mode 100644 index 15c5adc7f..000000000 --- a/mod/groups/views/default/groups/menu/adminlinks.php +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/mod/groups/views/default/groups/menu/links.php b/mod/groups/views/default/groups/menu/links.php deleted file mode 100644 index 15c5adc7f..000000000 --- a/mod/groups/views/default/groups/menu/links.php +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/mod/groups/views/default/groups/menu/ownerlinks.php b/mod/groups/views/default/groups/menu/ownerlinks.php deleted file mode 100644 index aaa575bec..000000000 --- a/mod/groups/views/default/groups/menu/ownerlinks.php +++ /dev/null @@ -1,20 +0,0 @@ -getGUID() == $vars['entity']->owner_guid) && ($vars['full'])) - { - ?> -

- \ No newline at end of file -- cgit v1.2.3