diff options
author | pete <pete@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-22 13:31:19 +0000 |
---|---|---|
committer | pete <pete@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-22 13:31:19 +0000 |
commit | a140ef9c53edb2e249eab2eafccc6eb8c0952dab (patch) | |
tree | 84e077e486a56a115a0defb8667f5409456ab470 | |
parent | c8e1a99c0388710806012eaad59e700c0667a4d1 (diff) | |
download | elgg-a140ef9c53edb2e249eab2eafccc6eb8c0952dab.tar.gz elgg-a140ef9c53edb2e249eab2eafccc6eb8c0952dab.tar.bz2 |
Updated avatar menu: Removed links to tools, provided a view to extend menu, added @username to menu, cleaned-up and simplified menu generation.
git-svn-id: http://code.elgg.org/elgg/trunk@5467 36083f99-b078-4883-b0ff-0f9b5a30f544
19 files changed, 110 insertions, 231 deletions
diff --git a/mod/file/start.php b/mod/file/start.php index 745f087f4..e3b5497e6 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -36,9 +36,6 @@ // Extend CSS elgg_extend_view('css', 'file/css'); - // Extend hover-over and profile menu - elgg_extend_view('profile/menu/links','file/menu'); - // extend group main page elgg_extend_view('groups/left_column','file/groupprofile_files'); diff --git a/mod/file/views/default/file/menu.php b/mod/file/views/default/file/menu.php deleted file mode 100644 index 7cde6b91a..000000000 --- a/mod/file/views/default/file/menu.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - - /** - * Elgg hoverover extender for file - * - * @package ElggFile - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - -?> - - <li class="user_menu_file"> - <a href="<?php echo $vars['url']; ?>pg/file/<?php echo $vars['entity']->username; ?>"><?php echo elgg_echo("file"); ?></a> - </li>
\ No newline at end of file diff --git a/mod/messages/start.php b/mod/messages/start.php index b74402ac3..6e130edca 100644 --- a/mod/messages/start.php +++ b/mod/messages/start.php @@ -44,7 +44,7 @@ function messages_init() { // Register a URL handler for shouts posts register_entity_url_handler('messages_url','object','messages'); - // Extend hover-over and profile menu + // Extend avatar user-menu elgg_extend_view('profile/menu/links','messages/menu'); // Register a notification handler for site messages diff --git a/mod/messages/views/default/messages/menu.php b/mod/messages/views/default/messages/menu.php index 150c9a73c..5afb7d409 100644 --- a/mod/messages/views/default/messages/menu.php +++ b/mod/messages/views/default/messages/menu.php @@ -8,14 +8,9 @@ * @copyright Curverider Ltd 2008-2010 * @link http://elgg.com/ */ - - //need to be logged in to send a message - if (isloggedin()) { -?> - <li class="user_menu_messages"> - <a href="<?php echo $vars['url']; ?>mod/messages/send.php?send_to=<?php echo $vars['entity']->guid; ?>"><?php echo elgg_echo("messages:sendmessage"); ?></a> - </li> - -<?php -}
\ No newline at end of file +// login check already performed in profile/icon +?> +<li class="user_menu_profile"> + <a class="send_message" href="<?php echo $vars['url']; ?>mod/messages/send.php?send_to=<?php echo $vars['entity']->guid; ?>"><?php echo elgg_echo("messages:sendmessage"); ?></a> +</li>
\ No newline at end of file diff --git a/mod/pages/start.php b/mod/pages/start.php index a849807e8..fd9d253f7 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -27,9 +27,6 @@ add_menu(elgg_echo('pages'), $CONFIG->wwwroot . "mod/pages/world.php"); } - // Extend hover-over menu - elgg_extend_view('profile/menu/links','pages/menu'); - // Register a page handler, so we can have nice URLs register_page_handler('pages','pages_page_handler'); diff --git a/mod/pages/views/default/pages/menu.php b/mod/pages/views/default/pages/menu.php deleted file mode 100644 index 9c92648ab..000000000 --- a/mod/pages/views/default/pages/menu.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - /** - * Elgg Pages: Add group menu - * - * @package ElggPages - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ -?> -<li class="user_menu_pages"> - <a href="<?php echo $vars['url']; ?>pg/pages/owned/<?php echo $vars['entity']->username; ?>"><?php echo elgg_echo("pages"); ?></a> -</li>
\ No newline at end of file diff --git a/mod/profile/languages/en.php b/mod/profile/languages/en.php index 90f49ca0a..67420836b 100644 --- a/mod/profile/languages/en.php +++ b/mod/profile/languages/en.php @@ -27,16 +27,16 @@ $english = array( 'profile:user' => "%s's profile", 'profile:edit' => "Edit profile", - 'profile:profilepictureinstructions' => "The profile picture is the image that's displayed on your profile page. <br /> You can change it as often as you'd like. (File formats accepted: GIF, JPG or PNG)", - 'profile:icon' => "Profile picture", + 'profile:profilepictureinstructions' => "Your avatar is the image that's displayed on your profile page. <br /> You can change it as often as you'd like. (File formats accepted: GIF, JPG or PNG)", + 'profile:icon' => "Avatar", 'profile:createicon' => "Create your avatar", 'profile:currentavatar' => "Current avatar", 'profile:createicon:header' => "Profile picture", - 'profile:profilepicturecroppingtool' => "Profile picture cropping tool", - 'profile:createicon:instructions' => "Click and drag a square below to match how you want your picture cropped. A preview of your cropped picture will appear in the box on the right. When you are happy with the preview, click 'Create your avatar'. This cropped image will be used throughout the site as your avatar. ", + 'profile:profilepicturecroppingtool' => "Avatar cropping tool", + 'profile:createicon:instructions' => "Click and drag a square below to match how you want your avatar cropped. A preview will appear in the box on the right. When you are happy with the preview, click 'Create your avatar'. This cropped version will be used throughout the site as your avatar. ", - 'profile:editdetails' => "Edit details", - 'profile:editicon' => "Edit profile icon", + 'profile:editdetails' => "Edit profile", + 'profile:editicon' => "Edit avatar", 'profile:aboutme' => "About me", 'profile:description' => "About me", diff --git a/mod/profile/start.php b/mod/profile/start.php index bb2f3d5cc..e66554d08 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -48,15 +48,6 @@ function profile_init() { elgg_extend_view('css', 'profile/css'); elgg_extend_view('js/initialise_elgg', 'profile/javascript'); - if (get_context() == 'profile') { - elgg_extend_view('canvas_header/submenu', 'profile/submenu'); - } - - // Extend context menu with admin links - if (isadminloggedin()){ - elgg_extend_view('profile/menu/links', 'profile/menu/adminwrapper', 10000); - } - // Now override icons register_plugin_hook('entity:icon:url', 'user', 'profile_usericon_hook'); diff --git a/mod/profile/views/default/profile/css.php b/mod/profile/views/default/profile/css.php index ed5b050b3..7a82b2bec 100644 --- a/mod/profile/views/default/profile/css.php +++ b/mod/profile/views/default/profile/css.php @@ -352,8 +352,8 @@ p.visit_twitter a { width:164px; background:#FFFFFF; text-align:left; - -webkit-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.50); /* safari v3+ */ - -moz-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.50); /* FF v3.5+ */ + -webkit-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.50); + -moz-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.50); } div.usericon a.icon img { z-index:10; @@ -367,17 +367,21 @@ div.usericon a.icon img { background:#cccccc; text-decoration:none; } -.usericon .sub_menu h3 { - font-size:1.3em; - line-height: 1.1em; +.usericon .sub_menu h3.displayname { + font-size:1.3em !important; /* make sure nothing overrides our sub menu h3 */ + line-height: 1.1em !important; padding:0 !important; margin:0 !important; - border-bottom:solid 1px #dddddd; - color: #4690d6; + border-bottom:solid 1px #dddddd !important; } -.usericon .sub_menu h3 a { +.usericon .sub_menu h3.displayname a { padding:3px 3px 3px 8px; } +.usericon .sub_menu h3.displayname a .username { + display:block; + font-weight: normal; + font-size: 0.8em; +} .usericon .sub_menu a { padding:2px 3px 2px 8px; } diff --git a/mod/profile/views/default/profile/icon.php b/mod/profile/views/default/profile/icon.php index 83015766a..d5623e0c8 100644 --- a/mod/profile/views/default/profile/icon.php +++ b/mod/profile/views/default/profile/icon.php @@ -43,49 +43,67 @@ if ($vars['entity'] instanceof ElggUser) { // Override if (isset($vars['override']) && $vars['override'] == true) { $override = true; - } else $override = false; - + } else { + $override = false; + } + // profile avatar drop-down menu if (!$override) { - -?> -<div class="usericon <?php echo $vars['size']; ?>"> -<div class="avatar_menu_button"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" border="0" width="15px" height="15px" /></div> - - <div class="sub_menu"> - <h3><a href="<?php echo $vars['entity']->getURL(); ?>"><?php echo $vars['entity']->name; ?></a></h3> - <?php - echo "<ul class='sub_menu_list'>"; - if (isloggedin()) { - $actions = elgg_view('profile/menu/actions',$vars); - if (!empty($actions)) { - echo "<li class='user_menu_addremovefriend'>{$actions}</li>"; - } - if ($vars['entity']->getGUID() == $vars['user']->getGUID()) { - echo elgg_view('profile/menu/linksownpage',$vars); - } else { - echo elgg_view('profile/menu/links',$vars); - } - } else { - echo elgg_view('profile/menu/links',$vars); - } - echo "</ul>"; ?> - </div> - <?php - if ((isadminloggedin()) || (!$vars['entity']->isBanned())) { - ?><a href="<?php echo $vars['entity']->getURL(); ?>" class="icon" ><?php - } + <div class="usericon <?php echo $vars['size']; ?>"> + <div class="avatar_menu_button"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" border="0" width="15px" height="15px" /></div> + <div class="sub_menu"> + <h3 class="displayname"><a href="<?php echo $vars['entity']->getURL(); ?>"><?php echo $vars['entity']->name; ?> + <span class="username"><?php echo "@".$vars['entity']->username; ?></span> + </a></h3> + <?php + echo "<ul class='sub_menu_list'>"; + if (isloggedin()) { + // if not looking at your own avatar menu + if ($vars['entity']->getGUID() != $vars['user']->getGUID()) { + + // Add / Remove friend link + $friendlinks = elgg_view('profile/menu/friendlinks',$vars); + if (!empty($friendlinks)) { + echo "<li class='user_menu_profile'>{$friendlinks}</li>"; + } + // view for plugins to extend + echo elgg_view('profile/menu/links',$vars); + } else { + // if looking at your own avatar menu - provide a couple of handy links + ?> + <li class="user_menu_profile"> + <a class="edit_profile" href="<?php echo $vars['url']?>pg/profile/<?php echo $vars['entity']->username; ?>/edit/details"><?php echo elgg_echo("profile:edit"); ?></a> + </li> + <li class="user_menu_profile"> + <a class="edit_avatar" href="<?php echo $vars['url']?>pg/profile/<?php echo $vars['entity']->username; ?>/edit/icon"><?php echo elgg_echo("profile:editicon"); ?></a> + </li> + <?php + } + + // if Admin is logged in, and not looking at admins own avatar menu + if (isadminloggedin() && ($_SESSION['id']!=$vars['entity']->guid) ){ + $adminlinks = elgg_view('profile/menu/adminlinks', $vars); + if (!empty($adminlinks)) { + echo "<li class='user_menu_admin'>{$adminlinks}</li>"; + } + } + + } + echo "</ul>"; + ?> + </div> + <?php + if ((isadminloggedin()) || (!$vars['entity']->isBanned())) { + ?><a href="<?php echo $vars['entity']->getURL(); ?>" class="icon" ><?php + } } ?><img src="<?php echo $vars['entity']->getIcon($vars['size']); ?>" border="0" <?php echo $align; ?> alt="<?php echo htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8'); ?>" title="<?php echo htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8'); ?>" <?php echo $vars['js']; ?> /><?php - if (!$override) { - - ?></a> -</div> - -<?php - + if (!$override) { + ?> + </a></div> + <?php } }
\ No newline at end of file diff --git a/mod/profile/views/default/profile/menu/actions.php b/mod/profile/views/default/profile/menu/actions.php deleted file mode 100644 index f200ec379..000000000 --- a/mod/profile/views/default/profile/menu/actions.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php -/** - * Elgg profile icon hover over: actions - * - * @package ElggProfile - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. - */ - -if (isloggedin()) { - if ($_SESSION['user']->getGUID() != $vars['entity']->getGUID()) { - $ts = time(); - $token = generate_action_token($ts); - if ($vars['entity']->isFriend()) { - echo elgg_view('output/confirmlink', array( - 'href' => "{$vars['url']}action/friends/remove?friend={$vars['entity']->getGUID()}", - 'text' => elgg_echo('friend:remove'), - 'class' => 'user_menu_removefriend' - )); - } else { - echo elgg_view('output/confirmlink', array( - 'href' => "{$vars['url']}action/friends/add?friend={$vars['entity']->getGUID()}", - 'text' => elgg_echo('friend:add'), - 'class' => 'user_menu_addfriend' - )); - } - } -}
\ No newline at end of file diff --git a/mod/profile/views/default/profile/menu/adminwrapper.php b/mod/profile/views/default/profile/menu/adminwrapper.php deleted file mode 100644 index eec5a6d3f..000000000 --- a/mod/profile/views/default/profile/menu/adminwrapper.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php -/** - * Wraps the admin links - * - * @package ElggProfile - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - */ - -$adminlinks = elgg_view('profile/menu/adminlinks', $vars); - -if (!empty($adminlinks)) { - echo "<li class='user_menu_admin'>{$adminlinks}</li>"; -}
\ No newline at end of file diff --git a/mod/profile/views/default/profile/menu/friendlinks.php b/mod/profile/views/default/profile/menu/friendlinks.php new file mode 100644 index 000000000..f7ca3c2fd --- /dev/null +++ b/mod/profile/views/default/profile/menu/friendlinks.php @@ -0,0 +1,27 @@ +<?php +/** + * Elgg profile icon avatar menu: Add / Remove friend links + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + * + * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. + */ +$ts = time(); +$token = generate_action_token($ts); +if ($vars['entity']->isFriend()) { + echo elgg_view('output/confirmlink', array( + 'href' => "{$vars['url']}action/friends/remove?friend={$vars['entity']->getGUID()}", + 'text' => elgg_echo('friend:remove'), + 'class' => 'remove_friend' + )); +} else { + echo elgg_view('output/confirmlink', array( + 'href' => "{$vars['url']}action/friends/add?friend={$vars['entity']->getGUID()}", + 'text' => elgg_echo('friend:add'), + 'class' => 'add_friend' + )); +}
\ No newline at end of file diff --git a/mod/profile/views/default/profile/menu/links.php b/mod/profile/views/default/profile/menu/links.php index fd04e2e99..de2b28926 100644 --- a/mod/profile/views/default/profile/menu/links.php +++ b/mod/profile/views/default/profile/menu/links.php @@ -1,6 +1,6 @@ <?php /** - * Elgg profile icon hover over: passive links + * Elgg profile icon avatar menu: view for plugins to extend * * @package ElggProfile * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 @@ -11,22 +11,3 @@ * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. */ ?> - -<li class="user_menu_profile"> - <a href="<?php echo $vars['entity']->getURL(); ?>"><?php echo elgg_echo("profile"); ?></a> -</li> -<?php - if ($vars['entity']->canEdit()){ -?> - <li class="user_menu_profile"> - <a href="<?php echo $vars['url']?>pg/profile/<?php echo $vars['entity']->username; ?>/edit/icon"><?php echo elgg_echo("profile:editicon"); ?></a> - </li> -<?php - } -?> -<li class="user_menu_friends"> - <a href="<?php echo $vars['url']; ?>pg/friends/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo("friends"); ?></a> -</li> -<li class="user_menu_friends_of"> - <a href="<?php echo $vars['url']; ?>pg/friendsof/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo("friends:of"); ?></a> -</li> diff --git a/mod/profile/views/default/profile/menu/linksownpage.php b/mod/profile/views/default/profile/menu/linksownpage.php deleted file mode 100644 index 2d41c6c31..000000000 --- a/mod/profile/views/default/profile/menu/linksownpage.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php -/** - * Elgg profile icon / profile links: passive links when looking at your own icon / profile - * - * @package ElggProfile - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. - */ -?> -<?php - if ($vars['entity']->canEdit()){ -?> - <li class="user_menu_profile"> - <a href="<?php echo $vars['url']?>pg/profile/<?php echo $vars['entity']->username; ?>/edit/icon"><?php echo elgg_echo("profile:editicon"); ?></a> - </li> -<?php - } -?> -<li class="user_menu_friends"> - <a href="<?php echo $vars['url']; ?>pg/friends/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo("friends"); ?></a> -</li> -<li class="user_menu_friends_of"> - <a href="<?php echo $vars['url']; ?>pg/friendsof/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo("friends:of"); ?></a> -</li> - diff --git a/mod/profile/views/default/profile/profile_contents/widgets.php b/mod/profile/views/default/profile/profile_contents/widgets.php deleted file mode 100644 index e69de29bb..000000000 --- a/mod/profile/views/default/profile/profile_contents/widgets.php +++ /dev/null diff --git a/mod/profile/views/default/profile/profile_ownerblock.php b/mod/profile/views/default/profile/profile_ownerblock.php index 7f89d3782..4a6622fc8 100755 --- a/mod/profile/views/default/profile/profile_ownerblock.php +++ b/mod/profile/views/default/profile/profile_ownerblock.php @@ -31,8 +31,8 @@ if($section == 'details'){ $profile_actions = ""; if(get_loggedin_user()->getGuid() == page_owner()){ $profile_actions = "<div class='clearfloat profile_actions'>"; - $profile_actions .= "<a href='{$vars['url']}pg/profile/{$user->username}/edit/details' class='action_button'>Edit profile</a>"; - $profile_actions .= "<a href='{$vars['url']}pg/profile/{$user->username}/edit/icon' class='action_button'>Edit profile icon</a>"; + $profile_actions .= "<a href='{$vars['url']}pg/profile/{$user->username}/edit/details' class='action_button'>". elgg_echo('profile:edit') ."</a>"; + $profile_actions .= "<a href='{$vars['url']}pg/profile/{$user->username}/edit/icon' class='action_button'>". elgg_echo('profile:editicon') ."</a>"; $profile_actions .= "</div>"; }else{ $profile_actions = "<div class='profile_actions'>"; diff --git a/mod/profile/views/default/profile/submenu.php b/mod/profile/views/default/profile/submenu.php deleted file mode 100644 index 682b910c2..000000000 --- a/mod/profile/views/default/profile/submenu.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - - /** - * Elgg profile submenu links - * These sit in the submenu when the profile editing is on view - * - * @package Elgg - * @subpackage Core - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - * - */ - -?> - -<ul class="submenu profilelinks"> - <li><a href="<?php echo $CONFIG->wwwroot . "mod/profile/edit.php"; ?>"><?php echo elgg_echo('profile:details'); ?></a></li> - <li><a href="<?php echo $CONFIG->wwwroot."mod/profile/editicon.php"; ?>"><?php echo elgg_echo('profile:editicon'); ?></a></li> - <li><a href="<?php echo $CONFIG->wwwroot."pg/profile/" . $_SESSION['user']->username; ?>"><?php echo elgg_echo('profile:back'); ?></a></li> -</ul>
\ No newline at end of file diff --git a/mod/reportedcontent/views/default/reportedcontent/user_report.php b/mod/reportedcontent/views/default/reportedcontent/user_report.php index e341bb6d3..1b5ff9501 100644 --- a/mod/reportedcontent/views/default/reportedcontent/user_report.php +++ b/mod/reportedcontent/views/default/reportedcontent/user_report.php @@ -1,6 +1,5 @@ - <li class="user_menu_profile"> <?php - echo "<a href=\"javascript:location.href='". $CONFIG->wwwroot . "mod/reportedcontent/add.php?address='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)\">" . elgg_echo('reportedcontent:report') . "</a>"; + echo "<a class='report_this' href=\"javascript:location.href='". $CONFIG->wwwroot . "mod/reportedcontent/add.php?address='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)\">" . elgg_echo('reportedcontent:report') . "</a>"; ?> </li>
\ No newline at end of file |