diff options
-rw-r--r-- | mod/blog/start.php | 19 | ||||
-rw-r--r-- | mod/blog/views/default/blog/group_module.php | 4 | ||||
-rw-r--r-- | mod/bookmarks/languages/en.php | 2 | ||||
-rw-r--r-- | mod/bookmarks/start.php | 19 | ||||
-rw-r--r-- | mod/file/start.php | 36 | ||||
-rw-r--r-- | mod/groups/views/default/group/default.php | 60 | ||||
-rw-r--r-- | mod/pages/start.php | 36 | ||||
-rwxr-xr-x | mod/profile/views/default/profile/ownerblock.php | 2 | ||||
-rw-r--r-- | views/default/css/elements/navigation.php | 11 | ||||
-rw-r--r-- | views/default/css/elements/skin.php | 3 | ||||
-rw-r--r-- | views/default/layout/elements/owner_block.php | 79 | ||||
-rw-r--r-- | views/default/layout/elements/sidebar.php | 21 | ||||
-rw-r--r-- | views/default/layout/objects/list/body.php | 7 | ||||
-rw-r--r-- | views/default/navigation/menu/default.php | 15 | ||||
-rw-r--r-- | views/default/user/default.php | 47 |
15 files changed, 226 insertions, 135 deletions
diff --git a/mod/blog/start.php b/mod/blog/start.php index 8dc3737f8..f3cd31770 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -38,7 +38,7 @@ function blog_init() { register_notification_object('object', 'blog', elgg_echo('blog:newpost')); elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'blog_notify_message'); - elgg_register_plugin_hook_handler('register', 'menu:user_ownerblock', 'blog_user_ownerblock_menu'); + elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'blog_owner_block_menu'); // pingbacks //elgg_register_event_handler('create', 'object', 'blog_incoming_ping'); @@ -223,11 +223,20 @@ function blog_url_handler($entity) { } /** - * Add a menu item to the user ownerblock + * Add a menu item to an ownerblock */ -function blog_user_ownerblock_menu($hook, $type, $return, $params) { - $item = new ElggMenuItem('blog', elgg_echo('blog'), "pg/blog/owner/{$params['user']->username}"); - elgg_register_menu_item('user_ownerblock', $item); +function blog_owner_block_menu($hook, $type, $return, $params) { + if (elgg_instanceof($params['entity'], 'user')) { + $url = "pg/blog/owner/{$params['entity']->username}"; + $item = new ElggMenuItem('blog', elgg_echo('blog'), $url); + elgg_register_menu_item('owner_block', $item); + } else { + if ($params['entity']->blog_enable != "no") { + $url = "pg/blog/group/{$params['entity']->guid}/owner"; + $item = new ElggMenuItem('blog', elgg_echo('blog:group'), $url); + elgg_register_menu_item('owner_block', $item); + } + } } /** diff --git a/mod/blog/views/default/blog/group_module.php b/mod/blog/views/default/blog/group_module.php index 6e75966af..b2b98f1f5 100644 --- a/mod/blog/views/default/blog/group_module.php +++ b/mod/blog/views/default/blog/group_module.php @@ -5,6 +5,10 @@ $group = elgg_get_page_owner(); +if ($group->blog_enable == "no") { + return true; +} + $all_link = elgg_view('output/url', array( 'href' => "pg/blog/group/$group->guid/owner", 'text' => elgg_echo('link:view:all'), diff --git a/mod/bookmarks/languages/en.php b/mod/bookmarks/languages/en.php index 24a77a645..6e0ebc8f1 100644 --- a/mod/bookmarks/languages/en.php +++ b/mod/bookmarks/languages/en.php @@ -12,7 +12,7 @@ $english = array( 'bookmarks:friends' => "Friends' bookmarks", 'bookmarks:all' => "All site bookmarks", 'bookmarks:user' => "%s's bookmarks", - 'bookmarks:group' => "Bookmarks", + 'bookmarks:group' => "Group bookmarks", 'bookmarks:this' => "Bookmark this", 'bookmarks:ingroup' => "in the group", 'bookmarks:this:group' => "Bookmark in %s", diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php index ee9d4be2d..062193517 100644 --- a/mod/bookmarks/start.php +++ b/mod/bookmarks/start.php @@ -40,7 +40,7 @@ function bookmarks_init() { // Add group menu option add_group_tool_option('bookmarks',elgg_echo('bookmarks:enablebookmarks'),true); - elgg_register_plugin_hook_handler('register', 'menu:user_ownerblock', 'bookmarks_user_ownerblock_menu'); + elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'bookmarks_owner_block_menu'); // Extend Groups profile page elgg_extend_view('groups/tool_latest','bookmarks/group_bookmarks'); @@ -315,11 +315,20 @@ function bookmark_url($entity) { } /** - * Add a menu item to the user ownerblock + * Add a menu item to an ownerblock */ -function bookmarks_user_ownerblock_menu($hook, $type, $return, $params) { - $item = new ElggMenuItem('bookmarks', elgg_echo('bookmarks'), "pg/bookmarks/owner/{$params['user']->username}"); - elgg_register_menu_item('user_ownerblock', $item); +function bookmarks_owner_block_menu($hook, $type, $return, $params) { + if (elgg_instanceof($params['entity'], 'user')) { + $url = "pg/bookmarks/owner/{$params['user']->username}"; + $item = new ElggMenuItem('bookmarks', elgg_echo('bookmarks'), $url); + elgg_register_menu_item('owner_block', $item); + } else { + if ($params['entity']->bookmarks_enable != "no") { + $url = "pg/bookmarks/owner/{$params['entity']->username}"; + $item = new ElggMenuItem('bookmarks', elgg_echo('bookmarks:group'), $url); + elgg_register_menu_item('owner_block', $item); + } + } } /** diff --git a/mod/file/start.php b/mod/file/start.php index 31362308c..bb291680e 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -60,7 +60,7 @@ // Register entity type register_entity_type('object','file'); - elgg_register_plugin_hook_handler('register', 'menu:user_ownerblock', 'file_user_ownerblock_menu'); + elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'file_owner_block_menu'); // embed support elgg_register_plugin_hook_handler('embed_get_sections', 'all', 'file_embed_get_sections'); @@ -70,24 +70,6 @@ } /** - * Sets up submenus for the file system. Triggered on pagesetup. - * - */ - function file_submenus() { - - global $CONFIG; - - $page_owner = elgg_get_page_owner(); - - // Group submenu option - if ($page_owner instanceof ElggGroup && elgg_get_context() == "groups") { - if($page_owner->file_enable != "no"){ - add_submenu_item(elgg_echo("file:group",array($page_owner->name)), $CONFIG->wwwroot . "pg/file/" . $page_owner->username); - } - } - } - - /** * File page handler * * @param array $page Array of page elements, forwarded by the page handling mechanism @@ -161,9 +143,18 @@ /** * Add a menu item to the user ownerblock */ -function file_user_ownerblock_menu($hook, $type, $return, $params) { - $item = new ElggMenuItem('file', elgg_echo('file'), "pg/file/owner/{$params['user']->username}"); - elgg_register_menu_item('user_ownerblock', $item); +function file_owner_block_menu($hook, $type, $return, $params) { + if (elgg_instanceof($params['entity'], 'user')) { + $url = "pg/file/owner/{$params['entity']->username}"; + $item = new ElggMenuItem('file', elgg_echo('file'), $url); + elgg_register_menu_item('owner_block', $item); + } else { + if ($params['entity']->file_enable != "no") { + $url = "pg/file/owner/{$params['entity']->username}"; + $item = new ElggMenuItem('file', elgg_echo('file:group'), $url); + elgg_register_menu_item('owner_block', $item); + } + } } /** @@ -317,7 +308,6 @@ function file_user_ownerblock_menu($hook, $type, $return, $params) { // Make sure test_init is called on initialisation elgg_register_event_handler('init','system','file_init'); - elgg_register_event_handler('pagesetup','system','file_submenus'); // Register actions elgg_register_action("file/upload", $CONFIG->pluginspath . "file/actions/upload.php"); diff --git a/mod/groups/views/default/group/default.php b/mod/groups/views/default/group/default.php index 25e07602b..3ba482d63 100644 --- a/mod/groups/views/default/group/default.php +++ b/mod/groups/views/default/group/default.php @@ -5,9 +5,65 @@ * @package ElggGroups */ +$group = $vars['entity']; + +$icon = elgg_view("groups/icon", array( + 'entity' => $group, + 'size' => 'tiny', +)); + +//get the membership type +$membership = $group->membership; +if ($membership == ACCESS_PUBLIC) { + $mem = elgg_echo("groups:open"); +} else { + $mem = elgg_echo("groups:closed"); +} + +// number of members +$num_members = '17 ' . elgg_echo('groups:member'); + +$metadata = "<ul class=\"elgg-list-metadata\"><li>$mem</li>"; +$metadata .= "<li>$num_members</li>"; +//. " / <b>" . get_group_members($vars['entity']->guid, 10, 0, 0, true) ."</b> " . elgg_echo("groups:member"); + +// feature link +if (isadminloggedin()) { + if ($group->featured_group == "yes") { + $url = "action/groups/featured?group_guid={$group->guid}&action_type=unfeature"; + $wording = elgg_echo("groups:makeunfeatured"); + } else { + $url = "action/groups/featured?group_guid={$group->guid}&action_type=feature"; + $wording = elgg_echo("groups:makefeatured"); + } + $feature_link = elgg_view('output/url', array( + 'href' => $url, + 'text' => $wording, + 'is_action' => true, + )); + $metadata .= "<li>$feature_link</li>"; +} + +$metadata .= elgg_view("entity/metadata", array('entity' => $group)); + +$metadata .= "</ul>"; + +if (elgg_in_context('owner_block') || elgg_in_context('widgets')) { + $metadata = ''; +} + + if ($vars['full']) { echo elgg_view("groups/groupprofile",$vars); } else { - echo elgg_view("groups/grouplisting",$vars); + // brief view + + $params = array( + 'entity' => $group, + 'metadata' => $metadata, + 'subtitle' => $group->briefdescription, + ); + $list_body = elgg_view('layout/objects/list/body', $params); + + echo elgg_view_image_block($icon, $list_body); } -?>
\ No newline at end of file diff --git a/mod/pages/start.php b/mod/pages/start.php index 83c765ccd..ebf102be0 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -64,7 +64,7 @@ function pages_init() { 'write_access_id' => 'access', ); - elgg_register_plugin_hook_handler('register', 'menu:user_ownerblock', 'pages_user_ownerblock_menu'); + elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'pages_owner_block_menu'); // register ecml views to parse elgg_register_plugin_hook_handler('get_views', 'ecml', 'pages_ecml_views_hook'); @@ -77,29 +77,20 @@ function pages_url($entity) { } /** - * Sets up submenus for the pages system. Triggered on pagesetup. - * - */ -function pages_submenus() { - - global $CONFIG; - - $page_owner = elgg_get_page_owner(); - - // Group submenu option - if ($page_owner instanceof ElggGroup && elgg_get_context() == 'groups') { - if($page_owner->pages_enable != "no"){ - add_submenu_item(elgg_echo("pages:group", array($page_owner->name)), "pg/pages/owned/" . $page_owner->username); - } - } -} - -/** * Add a menu item to the user ownerblock */ -function pages_user_ownerblock_menu($hook, $type, $return, $params) { - $item = new ElggMenuItem('pages', elgg_echo('pages'), "pg/pages/owner/{$params['user']->username}"); - elgg_register_menu_item('user_ownerblock', $item); +function pages_owner_block_menu($hook, $type, $return, $params) { + if (elgg_instanceof($params['entity'], 'user')) { + $url = "pg/pages/owner/{$params['entity']->username}"; + $item = new ElggMenuItem('pages', elgg_echo('pages'), $url); + elgg_register_menu_item('owner_block', $item); + } else { + if ($params['entity']->pages_enable != "no") { + $url = "pg/pages/owned/group:{$vars['entity']->guid}"; + $item = new ElggMenuItem('pages', elgg_echo('pages:group'), $url); + elgg_register_menu_item('owner_block', $item); + } + } } /** @@ -361,4 +352,3 @@ elgg_register_plugin_hook_handler('container_permissions_check', 'object', 'page // Make sure the pages initialisation function is called on initialisation elgg_register_event_handler('init','system','pages_init'); -elgg_register_event_handler('pagesetup','system','pages_submenus');
\ No newline at end of file diff --git a/mod/profile/views/default/profile/ownerblock.php b/mod/profile/views/default/profile/ownerblock.php index 7670f5699..2197164cb 100755 --- a/mod/profile/views/default/profile/ownerblock.php +++ b/mod/profile/views/default/profile/ownerblock.php @@ -68,7 +68,7 @@ if (isadminloggedin() && get_loggedin_userid() != elgg_get_page_owner_guid()) { } // content links -$menu = elgg_view_menu('user_ownerblock', array('user' => elgg_get_page_owner())); +$menu = elgg_view_menu('owner_block', array('entity' => elgg_get_page_owner())); //contruct the display $display = <<<EOT diff --git a/views/default/css/elements/navigation.php b/views/default/css/elements/navigation.php index f9488c64d..e1a3c6866 100644 --- a/views/default/css/elements/navigation.php +++ b/views/default/css/elements/navigation.php @@ -210,7 +210,7 @@ /* *************************************** PAGE MENU *************************************** */ -.elgg-sidebar .elgg-menu a { +.elgg-page-menu a { display: block; -webkit-border-radius: 8px; -moz-border-radius: 8px; @@ -218,12 +218,12 @@ margin: 0 0 3px 0; padding: 2px 4px 2px 8px; } -.elgg-sidebar .elgg-menu a:hover { +.elgg-page-menu a:hover { background-color: #0054A7; color: white; text-decoration: none; } -.elgg-sidebar .elgg-menu .selected a { +.elgg-page-menu .selected a { background-color: #4690D6; color: white; } @@ -268,3 +268,8 @@ text-decoration:none; } +.elgg-owner-block-menu li { + float: left; + width: 50%; + font-size: 90%; +}
\ No newline at end of file diff --git a/views/default/css/elements/skin.php b/views/default/css/elements/skin.php index 5d9af8e63..91a61dacb 100644 --- a/views/default/css/elements/skin.php +++ b/views/default/css/elements/skin.php @@ -89,6 +89,9 @@ a.selected { /***** PAGE BODY ******/ +.elgg-page-body > .elgg-inner { + min-height: 360px; +} .elgg-classic .elgg-page-body > .elgg-inner { width: 990px; margin: 0 auto; diff --git a/views/default/layout/elements/owner_block.php b/views/default/layout/elements/owner_block.php index 66fc180dd..862b0b5a6 100644 --- a/views/default/layout/elements/owner_block.php +++ b/views/default/layout/elements/owner_block.php @@ -8,70 +8,27 @@ * */ -$contents = ""; +elgg_push_context('owner_block'); -// Are there feeds to display? -global $autofeed; -if (isset($autofeed) && $autofeed == true) { - $url = full_url(); - if (substr_count($url,'?')) { - $url .= "&view=rss"; - } else { - $url .= "?view=rss"; - } - $url = elgg_format_url($url); - $label = elgg_echo('feed:rss'); - $contents .= <<<END - <div class="rss-link clearfix"><a href="{$url}" rel="nofollow" title="{$label}">{$label}</a></div> -END; -} - -if(is_plugin_enabled('profile')) { - // Is there a page owner? - $owner = elgg_get_page_owner(); - if ($owner instanceof ElggGroup || - ($owner instanceof ElggUser && $owner->getGUID() != get_loggedin_userid()) - ) { - $icon = elgg_view('profile/icon', array('entity' => $owner, 'size' => 'tiny')); - $owner_url = $owner->getURL(); - $display = "<div class='owner_block_icon'>$icon</div>"; - $display .= '<div class="owner_block_contents clearfix">'; - $display .= "<h3><a href=\"$owner_url\">{$owner->name}</a></h3>"; +// groups and other users get owner block +$owner = elgg_get_page_owner(); +if ($owner instanceof ElggGroup || + ($owner instanceof ElggUser && $owner->getGUID() != get_loggedin_userid())) { - if ($owner->briefdescription) { - $display .= "<p class=\"profile_info briefdescription\">{$owner->briefdescription}</p>"; - } - - $location = elgg_view('output/tags', array('value' => $owner->location)); - $display .= "<p class=\"profile_info location\">$location</p>"; - - $display .= '</div>'; - - // Trigger owner block menu - $params = array('owner' => $owner); - $links = elgg_trigger_plugin_hook('profile_menu', 'profile', $params, array()); - if (is_array($links) && !empty($links)) { - // sort the links by name - usort($links, create_function( - '$a, $b', - 'return strnatcasecmp($a[\'text\'], $b[\'text\']);' - )); - - $display .= '<div class="owners_content_links"><ul>'; - foreach ($links as $link) { - $display .= "<li><a href=\"{$link['href']}\">{$link['text']}</a></li>"; - } - $display .= '</ul></div>'; - } - - // Allow plugins to extend the owner block contents - $display .= elgg_view('owner_block/profile_extend'); + $header = elgg_view_entity($owner, false); - $contents .= "<div id='owner_block' class='clearfix'>$display</div>"; - } -} + $body = elgg_view_menu('owner_block', array( + 'entity' => $owner, + 'class' => 'elgg-owner-block-menu', + )); -$contents .= elgg_view('owner_block/extend'); + $body .= elgg_view('layout/elements/owner_block/extend', $vars); + echo elgg_view('layout/objects/module', array( + 'header' => $header, + 'body' => $body, + 'class' => 'elgg-owner-block', + )); +} -echo $contents; +elgg_pop_context();
\ No newline at end of file diff --git a/views/default/layout/elements/sidebar.php b/views/default/layout/elements/sidebar.php index 7605c4e70..c03700c8a 100644 --- a/views/default/layout/elements/sidebar.php +++ b/views/default/layout/elements/sidebar.php @@ -5,10 +5,29 @@ * @uses $vars['sidebar'] Optional content that is displayed at the bottom of sidebar */ +// Are there feeds to display? +global $autofeed; +if (isset($autofeed) && $autofeed == true) { + $url = full_url(); + if (substr_count($url,'?')) { + $url .= "&view=rss"; + } else { + $url .= "?view=rss"; + } + $url = elgg_format_url($url); + $label = elgg_echo('feed:rss'); + echo <<<END + <div class="rss-link clearfix"><a href="{$url}" rel="nofollow" title="{$label}">{$label}</a></div> +END; +} + echo elgg_view('layout/elements/owner_block'); echo elgg_view('navigation/sidebar_menu'); -echo elgg_view_menu('page', array('sort_by' => 'name')); +echo elgg_view_menu('page', array( + 'sort_by' => 'name', + 'class' => 'elgg-page-menu', +)); // optional 'sidebar' parameter if (isset($vars['sidebar'])) { diff --git a/views/default/layout/objects/list/body.php b/views/default/layout/objects/list/body.php index 8a59cd364..97331c1d1 100644 --- a/views/default/layout/objects/list/body.php +++ b/views/default/layout/objects/list/body.php @@ -21,8 +21,13 @@ $entity = $vars['entity']; $title_link = elgg_get_array_value('title', $vars, ''); if ($title_link === '') { + if (isset($entity->title)) { + $text = $entity->title; + } else { + $text = $entity->name; + } $params = array( - 'text' => $entity->title, + 'text' => $text, 'href' => $entity->getURL(), ); $title_link = elgg_view('output/url', $params); diff --git a/views/default/navigation/menu/default.php b/views/default/navigation/menu/default.php index a63a26771..d849fb80e 100644 --- a/views/default/navigation/menu/default.php +++ b/views/default/navigation/menu/default.php @@ -1,9 +1,20 @@ <?php +/** + * Default menu + * + * @uses $vars['menu'] + * @uses $vars['class'] + */ + +$class = 'elgg-menu'; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} foreach ($vars['menu'] as $section => $menu_items) { - echo '<ul class="elgg-menu">'; + echo "<ul class=\"$class\">"; foreach ($menu_items as $menu_item) { echo elgg_view('navigation/menu/elements/item', array('item' => $menu_item)); } echo '</ul>'; -}
\ No newline at end of file +} diff --git a/views/default/user/default.php b/views/default/user/default.php index 744a54595..3e2b9f433 100644 --- a/views/default/user/default.php +++ b/views/default/user/default.php @@ -6,12 +6,45 @@ * @subpackage Core */ -if ($vars['full']) { - echo elgg_view("profile/userdetails",$vars); +$user = $vars['entity']; + +$icon = elgg_view('profile/icon', array('entity' => $user, 'size' => 'tiny')); + +// Simple XFN +$rel = ''; +if (get_loggedin_userid() == $user->guid) { + $rel = 'rel="me"'; +} elseif (check_entity_relationship(get_loggedin_userid(), 'friend', $user->guid)) { + $rel = 'rel="friend"'; +} + +$title = "<a href=\"" . $user->getUrl() . "\" $rel>" . $user->name . "</a>"; + + +$metadata = "<ul class=\"elgg-list-metadata\"><li>$user->location</li>"; +$metadata .= elgg_view("entity/metadata", array('entity' => $user)); +$metadata .= "</ul>"; + +if (elgg_in_context('owner_block') || elgg_in_context('widgets')) { + $metadata = ''; +} + +if ($user->isBanned()) { + $params = array( + 'entity' => $user, + 'title' => $title, + 'metadata' => '<ul class="elgg-list-metadata"><li>banned</li></ul>', + ); } else { - if (get_input('listtype') == "gallery") { - echo elgg_view('profile/gallery',$vars); - } else { - echo elgg_view("profile/listing",$vars); - } + $params = array( + 'entity' => $user, + 'title' => $title, + 'metadata' => $metadata, + 'subtitle' => $user->briefdescription, + 'content' => elgg_view('user/status', array('entity' => $user)), + ); } + +$list_body = elgg_view('layout/objects/list/body', $params); + +echo elgg_view_image_block($icon, $list_body); |