]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Moved toolbar dropdown menu to main nav.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 20 Mar 2010 20:21:44 +0000 (20:21 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 20 Mar 2010 20:21:44 +0000 (20:21 +0000)
Added CSS for main nav dropdown.
Emptied navigation/topbar_tools view.

git-svn-id: http://code.elgg.org/elgg/trunk@5455 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/elgglib.php
languages/en.php
views/default/admin/menu_items.php
views/default/css.php
views/default/navigation/site_nav.php
views/default/navigation/topbar_tools.php
views/default/page_elements/elgg_topbar.php

index 0c1bbd83ecb6624ecd4cba4d98ae3b7b1171f587..7691ca5bbbf759afb4ada2172d3e03756d5a16ff 100644 (file)
@@ -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
        );
 }
 
index 810b04e5440465e6e0e6e811d88a5adc3463e9d7..f51940e6e7171a74d881344877b354138c245be1 100644 (file)
@@ -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.',
 
index 68f3688d836a5cfb3cab271b3079d2ac85e351d9..c9bdc5bca91c86650de29c4eb7433e116382feb0 100644 (file)
@@ -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')));
index 4aca7d865b9b3130bda5f8ea337aab350f6eb1d4..2e000d08a145227b637f359405c17ca940b3fbbd 100644 (file)
        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 {
index 965eb7e633015e6160265702a5e71c7f3862b322..15b35a11806b5cbb79e89275f9fca3a961b69ac0 100644 (file)
@@ -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;
+?>
index 2e48a4a85bae86c218d0d9847cbe4e03e80e2d17..044dc6608e1f9b6a8c4175b127b92fb0ced2f647 100644 (file)
@@ -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
index c57020e79a444d4007a2b267d9dd0b723e5a7206..240cd0465383f7c2ab175a66b138ef402cd0674d 100644 (file)
        <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>
        ?>
        <?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