diff options
author | Sem <sembrestels@riseup.net> | 2012-07-08 19:31:39 +0200 |
---|---|---|
committer | Steve Clay <steve@mrclay.org> | 2012-11-19 08:01:01 -0500 |
commit | 8183d5bbc2c18b6825da8ebfc15581231e23de04 (patch) | |
tree | 103ba017a78bad5df11e9d88b29291677be4746c /mod/groups/views/default | |
parent | d857c68fd91b1bcf586a30d86108b1898c2bb2d3 (diff) | |
download | elgg-8183d5bbc2c18b6825da8ebfc15581231e23de04.tar.gz elgg-8183d5bbc2c18b6825da8ebfc15581231e23de04.tar.bz2 |
Fixes #1854. Group owners can delegate the ownership to another group member.
Diffstat (limited to 'mod/groups/views/default')
-rw-r--r-- | mod/groups/views/default/forms/groups/edit.php | 31 | ||||
-rw-r--r-- | mod/groups/views/default/groups/js.php | 25 |
2 files changed, 56 insertions, 0 deletions
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') { <?php } +if (isset($vars['entity'])) { + $entity = $vars['entity']; + $owner_guid = $vars['entity']->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)"; + } +?> + +<div> + <label> + <?php echo elgg_echo('groups:owner'); ?><br /> + <?php echo elgg_view('input/dropdown', array( + 'name' => 'owner_guid', + 'value' => $owner_guid, + 'options_values' => $members, + 'class' => 'groups-owner-input', + )); + ?> + </label> +</div> + +<?php +} + $tools = elgg_get_config('group_tool_options'); if ($tools) { usort($tools, create_function('$a,$b', 'return strcmp($a->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 @@ +<?php +/** + * Javascript for Groups forms + * + * @package ElggGroups + */ +?> // 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($( + '<?php + echo elgg_view('output/url', array( + 'text' => elgg_echo('groups:handover'), + 'rel' => 'toggle', + 'class' => 'elgg-button elgg-button-delete', + )); + ?>' + ).click(function(){ + $(this).hide() + .prev().show(); + })); + }); +}); |