diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-27 14:20:22 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-27 14:20:22 +0000 |
commit | 4c94f8809f1131e2d8e073518195b6b65b26aceb (patch) | |
tree | 461af7e0e4414871c519acdef84ce397fa534325 /mod/profile/views | |
parent | 543e50d2aabfbd3c116cbb670018c66fae535955 (diff) | |
download | elgg-4c94f8809f1131e2d8e073518195b6b65b26aceb.tar.gz elgg-4c94f8809f1131e2d8e073518195b6b65b26aceb.tar.bz2 |
improved menu creation for on demand menus and integrated hover menu items into profile owner block
git-svn-id: http://code.elgg.org/elgg/trunk@7724 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/profile/views')
-rw-r--r-- | mod/profile/views/default/profile/css.php | 100 | ||||
-rwxr-xr-x | mod/profile/views/default/profile/ownerblock.php | 85 |
2 files changed, 70 insertions, 115 deletions
diff --git a/mod/profile/views/default/profile/css.php b/mod/profile/views/default/profile/css.php index 754276c69..1d1f1ccb1 100644 --- a/mod/profile/views/default/profile/css.php +++ b/mod/profile/views/default/profile/css.php @@ -29,98 +29,60 @@ /* *************************************** ownerblock in sidebar *************************************** */ -#profile-sidebar #owner_block { +#profile-owner-block { background-color: #eeeeee; - padding:15px; + padding: 15px; } -#owner_block .owner_block_icon.large { +.owner_block_icon { overflow: hidden; + margin-bottom: 10px; } -#owner_block .profile_actions { - margin-top:10px; -} -#owner_block .profile_actions a.elgg-action-button { - margin-bottom:4px; +#profile-owner-block a.elgg-action-button { + margin-bottom: 4px; display: table; } -/* ownerblock links to owners tools */ -#owner_block .owners_content_links { - border-top:1px dotted #cccccc; - margin-top:4px; - padding-top:2px; -} -#owner_block .owners_content_links ul { - margin:0; - padding:0; -} -#owner_block .owners_content_links ul li { - display:block; - float:left; - width:95px; - font-size: 90%; -} -/* profile pages - ownerblock links to owners tools */ -.owner_block_links { - margin-top:5px; -} -.owner_block_links ul { - margin:0; - padding:0; - list-style: none; -} -.owner_block_links ul li.selected a { - background: #4690D6; - color:white; -} -.owner_block_links ul li a { - display:block; - -webkit-border-radius: 8px; +.profile-content-menu a { + display: block; + -webkit-border-radius: 8px; -moz-border-radius: 8px; - background-color:white; - margin:3px 0 5px 0; - padding:2px 4px 2px 8px; + background-color: white; + margin: 3px 0 5px 0; + padding: 2px 4px 2px 8px; } -.owner_block_links ul li a:hover { - background:#0054A7; - color:white; - text-decoration:none; +.profile-content-menu a:hover { + background: #0054A7; + color: white; + text-decoration: none; } - /* *************************************** admin menu in sidebar *************************************** */ -.owner_block_links .admin_menu_options { +.profile-admin-menu { display: none; } -.owner_block_links ul.admin_menu { - background-color:white; +.profile-admin-menu-wrapper a { + display: block; -webkit-border-radius: 8px; -moz-border-radius: 8px; - cursor:pointer; -} -.owner_block_links ul.admin_menu li a { background-color: white; - color:red; - margin-bottom:0; + margin: 3px 0 5px 0; + padding: 2px 4px 2px 8px; } -.owner_block_links ul.admin_menu li a:hover { - color:black; +.profile-admin-menu-wrapper { + background-color: white; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; } -.owner_block_links ul.admin_menu li ul.admin_menu_options li a { - color:red; - background-color:white; - display:block; - margin:0px; - padding:2px 4px 2px 13px; +.profile-admin-menu-wrapper li a { + background-color: white; + color: red; + margin-bottom: 0; } -.owner_block_links ul.admin_menu li ul.admin_menu_options li a:hover { - color:black; - background:none; - text-decoration: underline; +.profile-admin-menu-wrapper a:hover { + color: black; } - /* *************************************** full profile info panel *************************************** */ diff --git a/mod/profile/views/default/profile/ownerblock.php b/mod/profile/views/default/profile/ownerblock.php index 2197164cb..ac0cb5b54 100755 --- a/mod/profile/views/default/profile/ownerblock.php +++ b/mod/profile/views/default/profile/ownerblock.php @@ -21,69 +21,62 @@ if (!$user) { $more_info = ''; -$location = elgg_view("output/tags",array('value' => $user->location)); +$location = elgg_view("output/tags", array('value' => $user->location)); -$icon = elgg_view("profile/icon",array('entity' => $user, 'size' => 'large', 'override' => 'true')); +$icon = elgg_view("profile/icon", array( + 'entity' => $user, + 'size' => 'large', + 'override' => 'true' +)); $icon_class = "large"; -// @todo pull out into menu -$profile_actions = ""; -if (isloggedin() && (get_loggedin_userid() == elgg_get_page_owner_guid())) { - $profile_actions = "<div class='clearfix profile_actions'>"; - $profile_actions .= "<a href='".elgg_get_site_url()."pg/profile/{$user->username}/edit/details' class='elgg-action-button'>". elgg_echo('profile:edit') ."</a>"; - $profile_actions .= "<a href='".elgg_get_site_url()."pg/avatar/edit/{$user->username}' class='elgg-action-button'>". elgg_echo('avatar:edit') ."</a>"; - $profile_actions .= "</div>"; -} else { - $profile_actions = "<div class='profile_actions'>"; - if (isloggedin()) { - if (get_loggedin_userid() != $user->getGUID()) { - if ($user->isFriend()) { - $url = elgg_get_site_url()."action/friends/remove?friend={$user->getGUID()}"; - $url = elgg_add_action_tokens_to_url($url); - $profile_actions .= "<a href=\"$url\" class='elgg-action-button'>" . elgg_echo('friend:remove') . "</a>"; - } else { - $url = elgg_get_site_url()."action/friends/add?friend={$user->getGUID()}"; - $url = elgg_add_action_tokens_to_url($url); - $profile_actions .= "<a href=\"$url\" class='elgg-action-button'>" . elgg_echo('friend:add') . "</a>"; - } - } - } - if (is_plugin_enabled('messages') && isloggedin()) { - $profile_actions .= "<a href=\"".elgg_get_site_url()."mod/messages/send.php?send_to={$user->guid}\" class='elgg-action-button'>". elgg_echo('messages:send') ."</a>"; +// grab the actions and admin menu items from user hover +$menu = elgg_trigger_plugin_hook('register', "menu:user_hover", array('entity' => $user), array()); +$builder = new ElggMenuBuilder($menu); +$menu = $builder->getMenu(); +$actions = elgg_get_array_value('action', $menu, array()); +$admin = elgg_get_array_value('admin', $menu, array()); + +$profile_actions = ''; +if (isloggedin() && $actions) { + $profile_actions = '<ul class="elgg-menu">'; + foreach ($actions as $action) { + $profile_actions .= '<li>' . $action->getLink(array('class' => 'elgg-action-button')) . '</li>'; } - $profile_actions .= "</div>"; + $profile_actions .= '</ul>'; } - // if admin, display admin links $admin_links = ''; if (isadminloggedin() && get_loggedin_userid() != elgg_get_page_owner_guid()) { - $params = array( - 'user' => elgg_get_page_owner(), - 'toggle' => true, - 'sort_by' => 'order', - ); - $admin_links = elgg_view_menu('user_admin', $params); - $admin_links = "<div class=\"owner_block_links\">$admin_links</div>"; + $admin_links = '<ul class="profile-admin-menu-wrapper">'; + $admin_links .= '<li><a class="elgg-toggle" id="elgg-toggler-admin-menu">Admin options…</a>'; + $admin_links .= '<ul class="profile-admin-menu" id="elgg-togglee-admin-menu">'; + foreach ($admin as $menu_item) { + $admin_links .= elgg_view('navigation/menu/elements/item', array('item' => $menu_item)); + } + $admin_links .= '</ul>'; + $admin_links .= '</li>'; + $admin_links .= '</ul>'; } // content links -$menu = elgg_view_menu('owner_block', array('entity' => elgg_get_page_owner())); +$content_menu = elgg_view_menu('owner_block', array( + 'entity' => elgg_get_page_owner(), + 'class' => 'profile-content-menu', +)); //contruct the display $display = <<<EOT -<div id="owner_block"> - <div class="owner_block_icon {$icon_class}"> - {$icon} - </div> - {$more_info} - {$profile_actions} - <div class="owner_block_links"> - $menu +<div id="profile-owner-block"> + <div class="owner_block_icon $icon_class"> + $icon </div> - <!-- if admin user --> - {$admin_links} + $more_info + $profile_actions + $content_menu + $admin_links </div> EOT; |