From 8183d5bbc2c18b6825da8ebfc15581231e23de04 Mon Sep 17 00:00:00 2001 From: Sem Date: Sun, 8 Jul 2012 19:31:39 +0200 Subject: Fixes #1854. Group owners can delegate the ownership to another group member. --- mod/groups/views/default/forms/groups/edit.php | 31 ++++++++++++++++++++++++++ mod/groups/views/default/groups/js.php | 25 +++++++++++++++++++++ 2 files changed, 56 insertions(+) (limited to 'mod/groups/views') diff --git a/mod/groups/views/default/forms/groups/edit.php b/mod/groups/views/default/forms/groups/edit.php index 532e89c35..52900d2d9 100644 --- a/mod/groups/views/default/forms/groups/edit.php +++ b/mod/groups/views/default/forms/groups/edit.php @@ -83,6 +83,37 @@ if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') { owner_guid; +} else { + $entity = false; +} + +if ($entity && ($owner_guid == elgg_get_logged_in_user_guid() || elgg_is_admin_logged_in())) { + $owner_guid = $vars['entity']->owner_guid; + $members = array(); + foreach ($vars['entity']->getMembers(0) as $member) { + $members[$member->guid] = "$member->name (@$member->username)"; + } +?> + +
+ +
+ +label,$b->label);')); diff --git a/mod/groups/views/default/groups/js.php b/mod/groups/views/default/groups/js.php index 1b4d33f32..c3698aadc 100644 --- a/mod/groups/views/default/groups/js.php +++ b/mod/groups/views/default/groups/js.php @@ -1,6 +1,31 @@ + // this adds a class to support IE8 and older elgg.register_hook_handler('init', 'system', function() { // jQuery uses 0-based indexing $('#groups-tools').children('li:even').addClass('odd'); }); + +// Hide group owner dropdown +elgg.register_hook_handler('init', 'system', function() { + $('.groups-owner-input').hide().each(function(){ + $(this).after($( + ' elgg_echo('groups:handover'), + 'rel' => 'toggle', + 'class' => 'elgg-button elgg-button-delete', + )); + ?>' + ).click(function(){ + $(this).hide() + .prev().show(); + })); + }); +}); -- cgit v1.2.3 From 004c2fbbb557ba2de60c2f05853d0f892383df45 Mon Sep 17 00:00:00 2001 From: Sem Date: Tue, 17 Jul 2012 18:18:28 +0200 Subject: Refs #1854. Using text to warn of the handover, instead the toggle with javascript. --- mod/groups/languages/en.php | 2 +- mod/groups/views/default/forms/groups/edit.php | 5 +++++ mod/groups/views/default/groups/js.php | 18 ------------------ 3 files changed, 6 insertions(+), 19 deletions(-) (limited to 'mod/groups/views') diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index 67b0bbb89..0d57f1680 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -19,7 +19,6 @@ $english = array( 'groups:add' => "Create a new group", 'groups:edit' => "Edit group", 'groups:delete' => 'Delete group', - 'groups:handover' => 'Hand over', 'groups:membershiprequests' => 'Manage join requests', 'groups:invitations' => 'Group invitations', @@ -36,6 +35,7 @@ $english = array( 'groups:membership' => "Group membership permissions", 'groups:access' => "Access permissions", 'groups:owner' => "Owner", + 'groups:owner:warning' => "Warning: if you change this value, you will no longer be the owner of this group.", 'groups:widget:num_display' => 'Number of groups to display', 'groups:widget:membership' => 'Group membership', 'groups:widgets:description' => 'Display the groups you are a member of on your profile', diff --git a/mod/groups/views/default/forms/groups/edit.php b/mod/groups/views/default/forms/groups/edit.php index 52900d2d9..7a740b878 100644 --- a/mod/groups/views/default/forms/groups/edit.php +++ b/mod/groups/views/default/forms/groups/edit.php @@ -109,6 +109,11 @@ if ($entity && ($owner_guid == elgg_get_logged_in_user_guid() || elgg_is_admin_l )); ?> + ' . elgg_echo('groups:owner:warning') . ''; + } + ?> elgg_echo('groups:handover'), - 'rel' => 'toggle', - 'class' => 'elgg-button elgg-button-delete', - )); - ?>' - ).click(function(){ - $(this).hide() - .prev().show(); - })); - }); -}); -- cgit v1.2.3