diff options
-rw-r--r-- | engine/lib/elgglib.php | 22 | ||||
-rw-r--r-- | languages/en.php | 2 | ||||
-rw-r--r-- | views/default/admin/menu_items.php | 13 | ||||
-rw-r--r-- | views/default/css.php | 136 | ||||
-rw-r--r-- | views/default/navigation/site_nav.php | 71 | ||||
-rw-r--r-- | views/default/navigation/topbar_tools.php | 34 | ||||
-rw-r--r-- | views/default/page_elements/elgg_topbar.php | 15 |
7 files changed, 162 insertions, 131 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 0c1bbd83e..7691ca5bb 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -2919,18 +2919,14 @@ function elgg_api_test($hook, $type, $value, $params) { } /** - * Sorts out the topbar menu and the featured URLs - * and saves them to $CONFIG->menu_items = array ('featured_urls' and 'toolbar') - * + * Sorts out the featured URLs and the "more" dropdown + * @return array ('featured_urls' and 'more') */ -function ui_page_setup() { - global $CONFIG; - - $hide_toolbar_dupes = get_config('menu_items_hide_toolbar_entries') == 'yes' ? TRUE : FALSE; +function elgg_get_nav_items() { $menu_items = get_register('menu'); $featured_urls_info = get_config('menu_items_featured_urls'); - $toolbar = array(); + $more = array(); $featured_urls = array(); $featured_urls_sanitised = array(); @@ -2952,14 +2948,14 @@ function ui_page_setup() { // add toolbar entries if not hiding dupes. foreach ($menu_items as $name => $info) { - if (!($hide_toolbar_dupes && in_array($info->value->url, $featured_urls))) { - $toolbar[] = $info; + if (!in_array($info->value->url, $featured_urls)) { + $more[] = $info; } } - $CONFIG->menu_items = array( - 'featured_urls' => $featured_urls_sanitised, - 'toolbar' => $toolbar + return array( + 'featured' => $featured_urls_sanitised, + 'more' => $more ); } diff --git a/languages/en.php b/languages/en.php index 810b04e54..f51940e6e 100644 --- a/languages/en.php +++ b/languages/en.php @@ -511,7 +511,7 @@ To remove a widget drag it back to the <b>Widget gallery</b>.", 'admin:user:removeadmin:no' => "We could not remove administrator privileges from this user.", 'admin:menu_items' => 'Menu Items', - 'admin:menu_items:description' => 'Select which menu items you want to show as featured links. You can optionally remove these items from the dropdown menu.', + 'admin:menu_items:description' => 'Select which menu items you want to show as featured links. Unused items will be added as "More" at the end of the list.', 'admin:menu_items:hide_toolbar_entries' => 'Remove links from tool bar menu?', 'admin:menu_items:saved' => 'Menu items saved.', diff --git a/views/default/admin/menu_items.php b/views/default/admin/menu_items.php index 68f3688d8..c9bdc5bca 100644 --- a/views/default/admin/menu_items.php +++ b/views/default/admin/menu_items.php @@ -27,7 +27,7 @@ echo elgg_view('output/longtext', array('value' => elgg_echo("admin:menu_items:d $form_body = ''; // @todo Could probably make this number configurable -for ($i=0; $i<7; $i++) { +for ($i=0; $i<6; $i++) { if (array_key_exists($i, $featured_urls)) { $current_value = $featured_urls[$i]->value->url; } else { @@ -40,17 +40,6 @@ for ($i=0; $i<7; $i++) { 'value' => $current_value )); } -$form_body .= '<br /><br />'; -$form_body .= '<label for="menu_items_hide_toolbar_entries">' - . elgg_echo('admin:menu_items:hide_toolbar_entries') . '</label>'; -$form_body .= elgg_view('input/pulldown', array( - 'internalname' => 'menu_items_hide_toolbar_entries', - 'internalid' => 'menu_items_hide_toolbar_entries', - 'value' => get_config('menu_items_hide_toolbar_entries'), - 'options_values' => array( - 'yes' => elgg_echo('option:yes'), - 'no' => elgg_echo('option:no') -))); $form_body .= '<br /><br />'; $form_body .= elgg_view('input/submit', array('value' => elgg_echo('save'))); diff --git a/views/default/css.php b/views/default/css.php index 4aca7d865..2e000d08a 100644 --- a/views/default/css.php +++ b/views/default/css.php @@ -27,10 +27,10 @@ GENERAL FORM ELEMENTS default styles for all elgg input/form elements FRIENDS PICKER ADMIN AREA - + */ -/* Colors: +/* Colors: #4690D6 - elgg light blue #0054A7 - elgg dark blue @@ -153,7 +153,7 @@ pre, code { font-size:12px; background:#EBF5FF; overflow:auto; - + overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not needed in Firefox 3 */ white-space: pre-wrap; /* css-3 */ white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ @@ -175,24 +175,24 @@ blockquote { line-height:1.3em; background:#EBF5FF; border:none; - -webkit-border-radius: 4px; + -webkit-border-radius: 4px; -moz-border-radius: 4px; } /* *************************************** - GENERIC SELECTORS +GENERIC SELECTORS *************************************** */ h2 { border-bottom:1px solid #CCCCCC; padding-bottom:5px; } .clearfloat:after { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; } .link { cursor:pointer; @@ -207,7 +207,7 @@ h2 { display:none; } .radius8 { - -webkit-border-radius: 8px; + -webkit-border-radius: 8px; -moz-border-radius: 8px; } .margin_none { @@ -256,7 +256,7 @@ h2 { } /* *************************************** - PAGE LAYOUT - MAIN BLOCKS POSITIONING +PAGE LAYOUT - MAIN BLOCKS POSITIONING *************************************** */ #elgg_topbar { background:#333333 url(<?php echo $vars['url']; ?>_graphics/toptoolbar_background.gif) repeat-x top left; @@ -269,7 +269,7 @@ h2 { z-index: 9000; } #elgg_header { - overflow: hidden; + x-overflow: hidden; position: relative; width: 100%; height:90px; @@ -293,10 +293,10 @@ h2 { #elgg_main_nav { z-index: 7000; position: absolute; - height:23px; - bottom:0; - left:0; - width:auto; + height:23px; + bottom:0; + left:0; + width:auto; } #elgg_content { /* wraps sidebar and page contents */ width:990px; @@ -341,7 +341,7 @@ h2 { /* *************************************** - ELGG TOPBAR +ELGG TOPBAR *************************************** */ #elgg_topbar_contents { float:left; @@ -362,7 +362,7 @@ h2 { } #elgg_topbar_contents a:hover { color:#71cbff; - text-decoration: none; + text-decoration: none; } #elgg_topbar_contents a img.user_mini_avatar { border:1px solid #eeeeee; @@ -375,16 +375,16 @@ h2 { margin-top: -1px; } #elgg_topbar_contents .log_out { - float:right; + float:right; } #elgg_topbar_contents .log_out a { display: inline; text-align: right; margin-right:10px; - color:#999999; + color:#999999; } #elgg_topbar_contents .log_out a:hover { - color:#71cbff; + color:#71cbff; } #elgg_topbar_contents a.settings { background:transparent url(<?php echo $vars['url']; ?>_graphics/topbar_icons.png) no-repeat left -41px; @@ -438,7 +438,7 @@ h2 { background:transparent url(<?php echo $vars['url']; ?>_graphics/topbar_icons.png) no-repeat 3px 1px; padding-left:24px !important; } -#elgg_topbar_contents ul.tools_menu li { +#elgg_topbar_contents ul.tools_menu li { display: block; list-style: none; margin: 0; @@ -458,7 +458,7 @@ h2 { } #elgg_topbar_contents ul.tools_menu ul li { float: none; -} +} /* elgg toolbar drop-down menu style */ #elgg_topbar_contents ul.tools_menu ul { width: 150px; @@ -500,7 +500,7 @@ h2 { /* *************************************** - HEADER CONTENTS +HEADER CONTENTS *************************************** */ #elgg_header_contents h1 a { font-size: 2em; @@ -513,7 +513,7 @@ h2 { text-shadow:1px 2px 4px #333333; } #elgg_header_contents #elgg_search input.search_input { - -webkit-border-radius: 10px; + -webkit-border-radius: 10px; -moz-border-radius: 10px; background-color:transparent; border:1px solid #71b9f7; @@ -540,7 +540,7 @@ h2 { background-position: 3px -37px; } #elgg_header_contents #elgg_search input.search_submit_button { - display:none; + display:none; } @@ -597,7 +597,31 @@ h2 { -webkit-border-top-right-radius:4px; margin-top:2px; } +.navigation_more { + overflow:hidden; +} + +.navigation_more:hover{ + overflow:visible; +} +li.navigation_more ul { + z-index: 1; + border: 1px solid #999; + border-top: 0; + -moz-border-radius-bottomleft:4px; + -moz-border-radius-bottomright:4px; + -webkit-border-bottom-left-radius:4px; + -webkit-border-bottom-right-radius:4px; +} +li.navigation_more ul li { + float:none; + background-color:#4690D6; +} +li.navigation_more ul li:hover { + background:white; + color:#43575e; +} /* *************************************** FOOTER CONTENTS @@ -605,7 +629,7 @@ h2 { #elgg_footer_contents, #elgg_footer_contents a, #elgg_footer_contents p { - color:#999999; + color:#999999; } #elgg_footer_contents a:hover { color:#666666; @@ -619,15 +643,15 @@ h2 { /* *************************************** - SYSTEM MESSAGES +SYSTEM MESSAGES *************************************** */ #elgg_system_message { - background-color:black; - color:white; - font-weight: bold; + background-color:black; + color:white; + font-weight: bold; display:block; padding:3px 10px; - z-index: 9600; + z-index: 9600; position:fixed; right:20px; margin-top:10px; @@ -638,7 +662,7 @@ h2 { -moz-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45); /* FF v3.5+ */ } #elgg_system_message.error { - background-color:red; + background-color:red; } #elgg_system_message p { margin:0; @@ -681,7 +705,7 @@ h2 { } .submenu li a { display:block; - -webkit-border-radius: 8px; + -webkit-border-radius: 8px; -moz-border-radius: 8px; background-color:white; margin:0 0 3px 0; @@ -714,7 +738,7 @@ h2 { margin:0 6px 0 0; padding:0px 4px; cursor: pointer; - -webkit-border-radius: 4px; + -webkit-border-radius: 4px; -moz-border-radius: 4px; } .pagination .pagination_number:hover { @@ -733,7 +757,7 @@ h2 { font-weight: normal; margin:0 6px 0 0; padding:0px 4px; - -webkit-border-radius: 4px; + -webkit-border-radius: 4px; -moz-border-radius: 4px; } .pagination .pagination_previous, @@ -748,7 +772,7 @@ h2 { margin:0 6px 0 0; padding:0px 4px; cursor: pointer; - -webkit-border-radius: 4px; + -webkit-border-radius: 4px; -moz-border-radius: 4px; } .pagination .pagination_previous:hover, @@ -770,7 +794,7 @@ h2 { margin:0 6px 0 0; padding:0px 4px; cursor: pointer; - -webkit-border-radius: 4px; + -webkit-border-radius: 4px; -moz-border-radius: 4px; } @@ -873,11 +897,11 @@ h2 { border-bottom:1px solid #CCCCCC; } #content_header:after { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; } .content_header_title { float:left; @@ -1032,7 +1056,7 @@ h2 { } /* *************************************** - USER SETTINGS & ADMIN AREA + USER SETTINGS & ADMIN AREA @todo - pull admin css into stand-alone css *************************************** */ /* GENERAL STYLES */ @@ -1117,7 +1141,7 @@ input { padding: 5px; border: 1px solid #cccccc; color:#666666; - -webkit-border-radius: 5px; + -webkit-border-radius: 5px; -moz-border-radius: 5px; } textarea { @@ -1125,7 +1149,7 @@ textarea { border: solid 1px #cccccc; padding: 5px; color:#666666; - -webkit-border-radius: 5px; + -webkit-border-radius: 5px; -moz-border-radius: 5px; } textarea:focus, @@ -1145,7 +1169,7 @@ input[type="text"]:focus { background-image: url(<?php echo $vars['url']; ?>_graphics/button_graduation.png); background-repeat: repeat-x; background-position: left 10px; - -webkit-border-radius: 5px; + -webkit-border-radius: 5px; -moz-border-radius: 5px; width: auto; padding: 2px 4px; @@ -1179,16 +1203,16 @@ input[type="submit"] { background-image: url(<?php echo $vars['url']; ?>_graphics/button_graduation.png); background-repeat: repeat-x; background-position: left 10px; - -webkit-border-radius: 5px; + -webkit-border-radius: 5px; -moz-border-radius: 5px; width: auto; padding: 2px 4px; margin:10px 0 10px 0; cursor: pointer; -moz-outline-style: none; - outline: none; + outline: none; -webkit-box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.40); /* safari v3+ */ - -moz-box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.40); /* FF v3.5+ */ + -moz-box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.40); /* FF v3.5+ */ } input[type="submit"]:hover { border-color: #0054a7; @@ -1208,7 +1232,7 @@ input[type="submit"]:hover { background-repeat: repeat-x; background-position: left 10px; border: 1px solid #999999; - -webkit-border-radius: 5px; + -webkit-border-radius: 5px; -moz-border-radius: 5px; width: auto; padding: 2px 4px; @@ -1223,7 +1247,7 @@ input[type="submit"]:hover { } input.action_button, a.action_button { - -webkit-border-radius: 5px; + -webkit-border-radius: 5px; -moz-border-radius: 5px; background-color:#cccccc; background-image: url(<?php echo $vars['url']; ?>_graphics/button_background.gif); @@ -1242,7 +1266,7 @@ a.action_button { -moz-box-shadow: none; } input.action_button:hover, -a.action_button:hover, +a.action_button:hover, input.action_button:focus, a.action_button:focus { background-position:0 -15px; @@ -1285,7 +1309,7 @@ a.action_button:focus { color:white; } .action_button.small { - -webkit-border-radius: 3px; + -webkit-border-radius: 3px; -moz-border-radius: 3px; width: auto; height:8px; @@ -1404,7 +1428,7 @@ a.action_button:focus { -moz-border-radius: 4px; } .tabHasContent { - background: white; + background: white; color:#333333 !important; } .friends_picker_navigation li a:hover { diff --git a/views/default/navigation/site_nav.php b/views/default/navigation/site_nav.php index 965eb7e63..15b35a118 100644 --- a/views/default/navigation/site_nav.php +++ b/views/default/navigation/site_nav.php @@ -1,22 +1,75 @@ <?php /** * Main site-wide navigation + * **/ -$featured = $vars['config']->menu_items['featured_urls']; -$current_context = get_context(); +$nav_items = elgg_get_nav_items(); +$featured = $nav_items['featured']; +$more = $nav_items['more']; -echo '<div id="elgg_main_nav" class="clearfloat"> - <ul class="navigation">'; +$nav_html = ''; +$more_nav_html = ''; -foreach ($featured as $info) { - $selected = ($info->value->context == $current_context) ? 'class="selected"' : ''; +// sort more links alphabetically +$more_sorted = array(); +foreach ($more as $info) { + $more_sorted[] = $info->name; +} + +// required because array multisort is case sensitive +$more_sorted_lower = array_map('elgg_strtolower', $more_sorted); +array_multisort($more_sorted_lower, $more); + +$item_count = 0; + +// if there are no featured items, display the standard tools in alphabetical order +if ($featured) { + foreach ($featured as $info) { + $title = htmlentities($info->name, ENT_QUOTES, 'UTF-8'); + $url = htmlentities($info->value->url, ENT_QUOTES, 'UTF-8'); + + $nav_html .= "<li><a href=\"$url\" title=\"$title\"><span>$title</span></a></li>"; + } +} elseif ($more) { + for ($i=0; $i<6; $i++) { + $info = $more[$i]; + + $title = htmlentities($info->name, ENT_QUOTES, 'UTF-8'); + $url = htmlentities($info->value->url, ENT_QUOTES, 'UTF-8'); + + $nav_html .= "<li><a href=\"$url\" title=\"$title\"><span>$title</span></a></li>"; + $more[$i]->used = TRUE; + $item_count++; + } +} + +// display the rest. +foreach ($more as $info) { + if ($info->used) { + continue; + } $title = htmlentities($info->name, ENT_QUOTES, 'UTF-8'); $url = htmlentities($info->value->url, ENT_QUOTES, 'UTF-8'); - echo "<li $selected><a href=\"$url\" title=\"$title\"><span>$title</span></a></li>"; + $more_nav_html .= "<li><a href=\"$url\" title=\"$title\"><span>$title</span></a></li>\n"; + $item_count++; +} + +if ($more_nav_html) { + $more = elgg_echo('more'); + $nav_html .= "<li class=\"navigation_more\"><a title=\"$more\"><span>$more</span></a> + <ul> + $more_nav_html + </ul> + </li>"; } -echo ' +echo <<<___END +<div id="elgg_main_nav" class="clearfloat"> + <ul class="navigation"> + $nav_html </ul> -</div>';
\ No newline at end of file +</div> +___END; +?> diff --git a/views/default/navigation/topbar_tools.php b/views/default/navigation/topbar_tools.php index 2e48a4a85..044dc6608 100644 --- a/views/default/navigation/topbar_tools.php +++ b/views/default/navigation/topbar_tools.php @@ -1,7 +1,6 @@ <?php /** - * Elgg standard tools drop down - * This will be populated depending on the plugins active - only plugin navigation will appear here + * Empty view for backward compatibility. * * @package Elgg * @subpackage Core @@ -9,34 +8,3 @@ * @link http://elgg.org/ * */ -$menu = $vars['config']->menu_items['toolbar']; - -if (is_array($menu) && sizeof($menu) > 0) { - $alphamenu = array(); - foreach($menu as $item) { - $alphamenu[$item->name] = $item; - } - ksort($alphamenu); - -?> - -<ul class="tools_menu"> - <li class="menu"><a href="#" class="tools"><?php echo(elgg_echo('tools')); ?></a> - <ul> - <?php - foreach($alphamenu as $item) { - echo "<li><a href=\"{$item->value->url}\">" . $item->name . "</a></li>"; - } - ?> - </ul> - </li> -</ul> - -<script type="text/javascript"> -$(function() { - $('ul.tools_menu').elgg_dropdownmenu(); -}); -</script> - -<?php -}
\ No newline at end of file diff --git a/views/default/page_elements/elgg_topbar.php b/views/default/page_elements/elgg_topbar.php index c57020e79..240cd0465 100644 --- a/views/default/page_elements/elgg_topbar.php +++ b/views/default/page_elements/elgg_topbar.php @@ -14,14 +14,15 @@ <a href="http://www.elgg.org" target="_blank"><img class="site_logo" src="<?php echo $vars['url']; ?>_graphics/elgg_toolbar_logo.gif" alt="Elgg logo" /></a> <a href="<?php echo $_SESSION['user']->getURL(); ?>"><img class="user_mini_avatar" src="<?php echo $_SESSION['user']->getIcon('topbar'); ?>" alt="User avatar" /></a> - <?php - // elgg tools menu - echo elgg_view("navigation/topbar_tools"); + <?php + // elgg tools menu + // need to echo this empty view for backward compatibility. + echo elgg_view("navigation/topbar_tools"); // enable elgg topbar extending echo elgg_view('elgg_topbar/extend', $vars); ?> - + <div class="log_out"> <?php echo elgg_view('output/url', array('href' => "{$vars['url']}action/logout", 'text' => elgg_echo('logout'), 'is_action' => TRUE)); ?> </div> @@ -43,10 +44,10 @@ ?> <?php // The administration link is for admin or site admin users only - if ($vars['user']->admin || $vars['user']->siteadmin) { + if ($vars['user']->admin || $vars['user']->siteadmin) { ?> <a href="<?php echo $vars['url']; ?>pg/admin/" class="admin"><?php echo elgg_echo("admin"); ?></a> - + <?php } ?> @@ -55,5 +56,5 @@ </div> <?php - } + } ?>
\ No newline at end of file |