diff options
Diffstat (limited to 'views/default/navigation')
| -rw-r--r-- | views/default/navigation/breadcrumbs.php | 48 | ||||
| -rw-r--r-- | views/default/navigation/menu/default.php | 31 | ||||
| -rw-r--r-- | views/default/navigation/menu/elements/item.php | 43 | ||||
| -rw-r--r-- | views/default/navigation/menu/elements/section.php | 30 | ||||
| -rw-r--r-- | views/default/navigation/menu/page.php | 36 | ||||
| -rw-r--r-- | views/default/navigation/menu/site.php | 30 | ||||
| -rw-r--r-- | views/default/navigation/menu/user_hover.php | 60 | ||||
| -rw-r--r-- | views/default/navigation/pagination.php | 182 | ||||
| -rw-r--r-- | views/default/navigation/sidebar_menu.php | 13 | ||||
| -rw-r--r-- | views/default/navigation/site_nav.php | 85 | ||||
| -rw-r--r-- | views/default/navigation/submenu_group.php | 40 | ||||
| -rw-r--r-- | views/default/navigation/submenu_item.php | 46 | ||||
| -rw-r--r-- | views/default/navigation/submenu_js.php | 29 | ||||
| -rw-r--r-- | views/default/navigation/tabs.php | 100 | ||||
| -rw-r--r-- | views/default/navigation/topbar_tools.php | 3 | ||||
| -rw-r--r-- | views/default/navigation/viewtype.php | 23 |
16 files changed, 420 insertions, 379 deletions
diff --git a/views/default/navigation/breadcrumbs.php b/views/default/navigation/breadcrumbs.php index 7bb709be9..88577a8ff 100644 --- a/views/default/navigation/breadcrumbs.php +++ b/views/default/navigation/breadcrumbs.php @@ -1,11 +1,13 @@ <?php /** - * Displays registered breadcrumbs. + * Displays breadcrumbs. * * @package Elgg * @subpackage Core * - * @uses optional $vars['breadcrumbs'] = array('title' => 'The title', 'link' => 'url') + * @uses $vars['breadcrumbs'] (Optional) Array of arrays with keys 'title' and 'link' + * @uses $vars['class'] + * * @see elgg_push_breadcrumb */ @@ -15,29 +17,25 @@ if (isset($vars['breadcrumbs'])) { $breadcrumbs = elgg_get_breadcrumbs(); } -$formatted_breadcrumbs = array(); - -foreach ($breadcrumbs as $breadcrumb) { - $link = $breadcrumb['link']; - $title = $breadcrumb['title']; +$class = 'elgg-menu elgg-breadcrumbs'; +$additional_class = elgg_extract('class', $vars, ''); +if ($additional_class) { + $class = "$class $additional_class"; +} - if (!empty($link)) { - $formatted_breadcrumbs[] = elgg_view('output/url', array( - 'href' => $link, - 'text' => $title - )); - } else { - $formatted_breadcrumbs[] = $title; +if (is_array($breadcrumbs) && count($breadcrumbs) > 0) { + echo "<ul class=\"$class\">"; + foreach ($breadcrumbs as $breadcrumb) { + if (!empty($breadcrumb['link'])) { + $crumb = elgg_view('output/url', array( + 'href' => $breadcrumb['link'], + 'text' => $breadcrumb['title'], + 'is_trusted' => true, + )); + } else { + $crumb = $breadcrumb['title']; + } + echo "<li>$crumb</li>"; } + echo '</ul>'; } - -$breadcrumbs_html = implode(' > ', $formatted_breadcrumbs); - -echo <<<___END - -<div class="breadcrumbs"> - $breadcrumbs_html -</div> - -___END; -?>
\ No newline at end of file diff --git a/views/default/navigation/menu/default.php b/views/default/navigation/menu/default.php new file mode 100644 index 000000000..006deb3ea --- /dev/null +++ b/views/default/navigation/menu/default.php @@ -0,0 +1,31 @@ +<?php +/** + * Default menu + * + * @uses $vars['name'] Name of the menu + * @uses $vars['menu'] Array of menu items + * @uses $vars['class'] Additional CSS class for the menu + * @uses $vars['item_class'] Additional CSS class for each menu item + * @uses $vars['show_section_headers'] Do we show headers for each section? + */ + +// we want css classes to use dashes +$vars['name'] = preg_replace('/[^a-z0-9\-]/i', '-', $vars['name']); +$headers = elgg_extract('show_section_headers', $vars, false); +$item_class = elgg_extract('item_class', $vars, ''); + +$class = "elgg-menu elgg-menu-{$vars['name']}"; +if (isset($vars['class'])) { + $class .= " {$vars['class']}"; +} + +foreach ($vars['menu'] as $section => $menu_items) { + echo elgg_view('navigation/menu/elements/section', array( + 'items' => $menu_items, + 'class' => "$class elgg-menu-{$vars['name']}-$section", + 'section' => $section, + 'name' => $vars['name'], + 'show_section_headers' => $headers, + 'item_class' => $item_class, + )); +} diff --git a/views/default/navigation/menu/elements/item.php b/views/default/navigation/menu/elements/item.php new file mode 100644 index 000000000..fd9738826 --- /dev/null +++ b/views/default/navigation/menu/elements/item.php @@ -0,0 +1,43 @@ +<?php +/** + * A single element of a menu. + * + * @package Elgg.Core + * @subpackage Navigation + * + * @uses $vars['item'] ElggMenuItem + * @uses $vars['item_class'] Additional CSS class for the menu item + */ + +$item = $vars['item']; + +$link_class = 'elgg-menu-closed'; +if ($item->getSelected()) { + // @todo switch to addItemClass when that is implemented + //$item->setItemClass('elgg-state-selected'); + $link_class = 'elgg-menu-opened'; +} + +$children = $item->getChildren(); +if ($children) { + $item->addLinkClass($link_class); + $item->addLinkClass('elgg-menu-parent'); +} + +$item_class = $item->getItemClass(); +if ($item->getSelected()) { + $item_class = "$item_class elgg-state-selected"; +} +if (isset($vars['item_class']) && $vars['item_class']) { + $item_class .= ' ' . $vars['item_class']; +} + +echo "<li class=\"$item_class\">"; +echo $item->getContent(); +if ($children) { + echo elgg_view('navigation/menu/elements/section', array( + 'items' => $children, + 'class' => 'elgg-menu elgg-child-menu', + )); +} +echo '</li>'; diff --git a/views/default/navigation/menu/elements/section.php b/views/default/navigation/menu/elements/section.php new file mode 100644 index 000000000..c0e9ba750 --- /dev/null +++ b/views/default/navigation/menu/elements/section.php @@ -0,0 +1,30 @@ +<?php +/** + * Menu group + * + * @uses $vars['items'] Array of menu items + * @uses $vars['class'] Additional CSS class for the section + * @uses $vars['name'] Name of the menu + * @uses $vars['section'] The section name + * @uses $vars['item_class'] Additional CSS class for each menu item + * @uses $vars['show_section_headers'] Do we show headers for each section + */ + +$headers = elgg_extract('show_section_headers', $vars, false); +$class = elgg_extract('class', $vars, ''); +$item_class = elgg_extract('item_class', $vars, ''); + +if ($headers) { + $name = elgg_extract('name', $vars); + $section = elgg_extract('section', $vars); + echo '<h2>' . elgg_echo("menu:$name:header:$section") . '</h2>'; +} + +echo "<ul class=\"$class\">"; +foreach ($vars['items'] as $menu_item) { + echo elgg_view('navigation/menu/elements/item', array( + 'item' => $menu_item, + 'item_class' => $item_class, + )); +} +echo '</ul>'; diff --git a/views/default/navigation/menu/page.php b/views/default/navigation/menu/page.php new file mode 100644 index 000000000..56a288234 --- /dev/null +++ b/views/default/navigation/menu/page.php @@ -0,0 +1,36 @@ +<?php +/** + * Page menu + * + * @uses $vars['menu'] + * @uses $vars['selected_item'] + * @uses $vars['class'] + * @uses $vars['name'] + * @uses $vars['show_section_headers'] + */ + +$headers = elgg_extract('show_section_headers', $vars, false); + +$class = 'elgg-menu elgg-menu-page'; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} + +if (isset($vars['selected_item'])) { + $parent = $vars['selected_item']->getParent(); + + while ($parent) { + $parent->setSelected(); + $parent = $parent->getParent(); + } +} + +foreach ($vars['menu'] as $section => $menu_items) { + echo elgg_view('navigation/menu/elements/section', array( + 'items' => $menu_items, + 'class' => "$class elgg-menu-page-$section", + 'section' => $section, + 'name' => $vars['name'], + 'show_section_headers' => $headers + )); +} diff --git a/views/default/navigation/menu/site.php b/views/default/navigation/menu/site.php new file mode 100644 index 000000000..24c21dd57 --- /dev/null +++ b/views/default/navigation/menu/site.php @@ -0,0 +1,30 @@ +<?php +/** + * Site navigation menu + * + * @uses $vars['menu']['default'] + * @uses $vars['menu']['more'] + */ + +$default_items = elgg_extract('default', $vars['menu'], array()); +$more_items = elgg_extract('more', $vars['menu'], array()); + +echo '<ul class="elgg-menu elgg-menu-site elgg-menu-site-default clearfix">'; +foreach ($default_items as $menu_item) { + echo elgg_view('navigation/menu/elements/item', array('item' => $menu_item)); +} + +if ($more_items) { + echo '<li class="elgg-more">'; + + $more = elgg_echo('more'); + echo "<a href=\"#\">$more</a>"; + + echo elgg_view('navigation/menu/elements/section', array( + 'class' => 'elgg-menu elgg-menu-site elgg-menu-site-more', + 'items' => $more_items, + )); + + echo '</li>'; +} +echo '</ul>'; diff --git a/views/default/navigation/menu/user_hover.php b/views/default/navigation/menu/user_hover.php new file mode 100644 index 000000000..5c89e585c --- /dev/null +++ b/views/default/navigation/menu/user_hover.php @@ -0,0 +1,60 @@ +<?php +/** + * User hover menu + * + * Register for the 'register', 'menu:user_hover' plugin hook to add to the user + * hover menu. There are three sections: action, default, and admin. + * + * @uses $vars['menu'] Menu array provided by elgg_view_menu() + */ + +$user = $vars['entity']; +$actions = elgg_extract('action', $vars['menu'], null); +$main = elgg_extract('default', $vars['menu'], null); +$admin = elgg_extract('admin', $vars['menu'], null); + +echo '<ul class="elgg-menu elgg-menu-hover">'; + +// name and username +$name_link = elgg_view('output/url', array( + 'href' => $user->getURL(), + 'text' => "<span class=\"elgg-heading-basic\">$user->name</span>@$user->username", + 'is_trusted' => true, +)); +echo "<li>$name_link</li>"; + +// actions +if (elgg_is_logged_in() && $actions) { + echo '<li>'; + echo elgg_view('navigation/menu/elements/section', array( + 'class' => "elgg-menu elgg-menu-hover-actions", + 'items' => $actions, + )); + echo '</li>'; +} + +// main +if ($main) { + echo '<li>'; + + echo elgg_view('navigation/menu/elements/section', array( + 'class' => 'elgg-menu elgg-menu-hover-default', + 'items' => $main, + )); + + echo '</li>'; +} + +// admin +if (elgg_is_admin_logged_in() && $admin) { + echo '<li>'; + + echo elgg_view('navigation/menu/elements/section', array( + 'class' => 'elgg-menu elgg-menu-hover-admin', + 'items' => $admin, + )); + + echo '</li>'; +} + +echo '</ul>'; diff --git a/views/default/navigation/pagination.php b/views/default/navigation/pagination.php index 846598d1b..04044c51c 100644 --- a/views/default/navigation/pagination.php +++ b/views/default/navigation/pagination.php @@ -5,106 +5,128 @@ * @package Elgg * @subpackage Core * - * @uses int $vars['offset'] - * @uses int $vars['limit'] - * @uses int $vars['count'] Number of entities. - * @uses string $vars['word'] Word to use in GET params for the offset - * @uses string $vars['baseurl'] Base URL to use in links + * @uses int $vars['offset'] The offset in the list + * @uses int $vars['limit'] Number of items per page + * @uses int $vars['count'] Number of items in list + * @uses string $vars['base_url'] Base URL to use in links + * @uses string $vars['offset_key'] The string to use for offet in the URL */ -$offset = (int) elgg_get_array_value('offset', $vars, 0); +if (elgg_in_context('widget')) { + // widgets do not show pagination + return true; +} + +$offset = abs((int) elgg_extract('offset', $vars, 0)); // because you can say $vars['limit'] = 0 -if (!$limit = (int) elgg_get_array_value('limit', $vars, 10)) { +if (!$limit = (int) elgg_extract('limit', $vars, 10)) { $limit = 10; } -$count = (int) elgg_get_array_value('count', $vars, 0); -$word = elgg_get_array_value('word', $vars, 'offset'); -$baseurl = elgg_get_array_value('baseurl', $vars, current_page_url()); -$totalpages = ceil($count / $limit); -$currentpage = ceil($offset / $limit) + 1; +$count = (int) elgg_extract('count', $vars, 0); +$offset_key = elgg_extract('offset_key', $vars, 'offset'); +// some views pass an empty string for base_url +if (isset($vars['base_url']) && $vars['base_url']) { + $base_url = $vars['base_url']; +} else if (isset($vars['baseurl']) && $vars['baseurl']) { + elgg_deprecated_notice("Use 'base_url' instead of 'baseurl' for the navigation/pagination view", 1.8); + $base_url = $vars['baseurl']; +} else { + $base_url = current_page_url(); +} + +$num_pages = elgg_extract('num_pages', $vars, 10); +$delta = ceil($num_pages / 2); + +if ($count <= $limit && $offset == 0) { + // no need for pagination + return true; +} + +$total_pages = ceil($count / $limit); +$current_page = ceil($offset / $limit) + 1; + +$pages = new stdClass(); +$pages->prev = array( + 'text' => '« ' . elgg_echo('previous'), + 'href' => '', + 'is_trusted' => true, +); +$pages->next = array( + 'text' => elgg_echo('next') . ' »', + 'href' => '', + 'is_trusted' => true, +); +$pages->items = array(); + +// Add pages before the current page +if ($current_page > 1) { + $prev_offset = $offset - $limit; + if ($prev_offset < 0) { + $prev_offset = 0; + } -//only display if there is content to paginate through or if we already have an offset -if (($count > $limit || $offset > 0) && elgg_get_context() != 'widget') { + $pages->prev['href'] = elgg_http_add_url_query_elements($base_url, array($offset_key => $prev_offset)); - ?> + $first_page = $current_page - $delta; + if ($first_page < 1) { + $first_page = 1; + } - <div class="pagination clearfloat"> - <?php + $pages->items = range($first_page, $current_page - 1); +} - if ($offset > 0) { - $prevoffset = $offset - $limit; - if ($prevoffset < 0) { - $prevoffset = 0; - } +$pages->items[] = $current_page; - $prevurl = elgg_http_add_url_query_elements($baseurl, array($word => $prevoffset)); - echo "<a href=\"{$prevurl}\" class='pagination_previous'>« ". elgg_echo("previous") ."</a> "; +// add pages after the current one +if ($current_page < $total_pages) { + $next_offset = $offset + $limit; + if ($next_offset >= $count) { + $next_offset--; } - if ($offset > 0 || $offset < ($count - $limit)) { - - $currentpage = round($offset / $limit) + 1; - $allpages = ceil($count / $limit); - - $i = 1; - $pagesarray = array(); - while ($i <= $allpages && $i <= 4) { - $pagesarray[] = $i; - $i++; - } - $i = $currentpage - 2; - while ($i <= $allpages && $i <= ($currentpage + 2)) { - if ($i > 0 && !in_array($i,$pagesarray)) { - $pagesarray[] = $i; - } - $i++; - } - $i = $allpages - 3; - while ($i <= $allpages) { - if ($i > 0 && !in_array($i,$pagesarray)) { - $pagesarray[] = $i; - } - $i++; - } - - sort($pagesarray); - - $prev = 0; - foreach($pagesarray as $i) { - if (($i - $prev) > 1) { - echo "<span class='pagination_more'>...</span>"; - } - - $curoffset = (($i - 1) * $limit); - $counturl = elgg_http_add_url_query_elements($baseurl, array($word => $curoffset)); - - if ($curoffset != $offset) { - echo " <a href=\"{$counturl}\" class='pagination_number'>{$i}</a> "; - } else { - echo "<span class='pagination_currentpage'>{$i}</span>"; - } - $prev = $i; - - } + $pages->next['href'] = elgg_http_add_url_query_elements($base_url, array($offset_key => $next_offset)); + + $last_page = $current_page + $delta; + if ($last_page > $total_pages) { + $last_page = $total_pages; } - if ($offset < ($count - $limit)) { + $pages->items = array_merge($pages->items, range($current_page + 1, $last_page)); +} - $nextoffset = $offset + $limit; - if ($nextoffset >= $count) { - $nextoffset--; - } - $nexturl = elgg_http_add_url_query_elements($baseurl, array($word => $nextoffset)); +echo '<ul class="elgg-pagination">'; - echo " <a href=\"{$nexturl}\" class='pagination_next'>" . elgg_echo("next") . " »</a>"; +if ($pages->prev['href']) { + $link = elgg_view('output/url', $pages->prev); + echo "<li>$link</li>"; +} else { + echo "<li class=\"elgg-state-disabled\"><span>{$pages->prev['text']}</span></li>"; +} +foreach ($pages->items as $page) { + if ($page == $current_page) { + echo "<li class=\"elgg-state-selected\"><span>$page</span></li>"; + } else { + $page_offset = (($page - 1) * $limit); + $url = elgg_http_add_url_query_elements($base_url, array($offset_key => $page_offset)); + $link = elgg_view('output/url', array( + 'href' => $url, + 'text' => $page, + 'is_trusted' => true, + )); + echo "<li>$link</li>"; } +} + +if ($pages->next['href']) { + $link = elgg_view('output/url', $pages->next); + echo "<li>$link</li>"; +} else { + echo "<li class=\"elgg-state-disabled\"><span>{$pages->next['text']}</span></li>"; +} - ?> - </div> - <?php -} // end of pagination check if statement +echo '</ul>'; diff --git a/views/default/navigation/sidebar_menu.php b/views/default/navigation/sidebar_menu.php deleted file mode 100644 index 75fe7c743..000000000 --- a/views/default/navigation/sidebar_menu.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php -/** - * Elgg sidebar menu - * - * @package Elgg - * @subpackage Core - * - */ - -// Plugins can add to the sidebar menu by calling elgg_add_submenu_item() -$submenu = elgg_get_submenu(); - -echo $submenu; diff --git a/views/default/navigation/site_nav.php b/views/default/navigation/site_nav.php deleted file mode 100644 index a7f31c5f9..000000000 --- a/views/default/navigation/site_nav.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php -/** - * Main site-wide navigation - * - **/ - -$nav_items = elgg_get_nav_items(); -$featured = $nav_items['featured']; -$more = $nav_items['more']; - -$nav_html = ''; -$more_nav_html = ''; -$context = elgg_get_context(); - -// 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) { - $selected = ($info->value->context == $context) ? 'class="selected"' : ''; - $title = htmlentities($info->name, ENT_QUOTES, 'UTF-8'); - $url = htmlentities($info->value->url, ENT_QUOTES, 'UTF-8'); - - $nav_html .= "<li $selected><a href=\"$url\" title=\"$title\"><span>$title</span></a></li>"; - } -} elseif ($more) { - for ($i=0; $i<6; $i++) { - if (!array_key_exists($i, $more)) { - break; - } - $info = $more[$i]; - - $selected = ($info->value->context == $context) ? 'class="selected"' : ''; - $title = htmlentities($info->name, ENT_QUOTES, 'UTF-8'); - $url = htmlentities($info->value->url, ENT_QUOTES, 'UTF-8'); - - $nav_html .= "<li $selected><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; - } - $selected = ($info->value->context == $context) ? 'class="selected"' : ''; - $title = htmlentities($info->name, ENT_QUOTES, 'UTF-8'); - $url = htmlentities($info->value->url, ENT_QUOTES, 'UTF-8'); - - $more_nav_html .= "<li $selected><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 class='subnav' title=\"$more\"><span>$more</span></a> - <ul> - $more_nav_html - </ul> - </li>"; -} - -// only display, if there are nav items to display -if ($nav_html) { - echo <<<___END - <div id="elgg_main_nav" class="clearfloat"> - <ul class="navigation"> - $nav_html - </ul> - </div> -___END; -} -?> diff --git a/views/default/navigation/submenu_group.php b/views/default/navigation/submenu_group.php deleted file mode 100644 index df750aff7..000000000 --- a/views/default/navigation/submenu_group.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/** - * Elgg submenu group. Writes the <ul> for a submenu and passes items one by one - * to navigation/submenu_item - * - * @uses $vars['group_name'] - * @uses $vars['items'] - * @package Elgg - * @subpackage Core - */ - -$group = (isset($vars['group'])) ? $vars['group'] : 'default'; -$items = (isset($vars['items'])) ? $vars['items'] : array(); -$hidden = (isset($vars['hidden']) && $vars['hidden']) ? 'hidden' : ''; -$child = (isset($vars['child']) && $vars['child']) ? 'child' : ''; - -echo "<ul class='submenu $group $hidden $child'>\n"; - -foreach ($items as $item) { - $item_vars = array('item' => $item, 'group' => $group); - if (isset($item->vars) && is_array($item->vars)) { - $item_vars = array_merge($item->vars, $item_vars); - } - - if (isset($item->children)) { - $child_vars = array( - 'group' => $group, - 'items' => $item->children, - // if this menu item is selected, make sure to display the full tree - // ie, don't hide it. - 'hidden' => !$item->selected, - 'child' => TRUE - ); - $item_vars['children_html'] = elgg_view('navigation/submenu_group', $child_vars); - } - - echo elgg_view('navigation/submenu_item', $item_vars); -} - -echo "</ul>\n";
\ No newline at end of file diff --git a/views/default/navigation/submenu_item.php b/views/default/navigation/submenu_item.php deleted file mode 100644 index 09aa24a8e..000000000 --- a/views/default/navigation/submenu_item.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * Elgg submenu item. Displays the <li> part of a submenu. - * - * @uses $vars['group'] - * @uses $vars['item'] - * @uses $vars['children_html'] - * @package Elgg - * @subpackage Core - */ - -$group = (isset($vars['group'])) ? $vars['group'] : 'default'; -$item = (isset($vars['item'])) ? $vars['item'] : FALSE; -$children_html = (isset($vars['children_html'])) ? $vars['children_html'] : ''; - -if ($item) { - $has_children = (isset($item->children) && $item->children) ? TRUE : FALSE; - $selected = (isset($item->selected) && $item->selected == TRUE) ? 'class="selected"' : ''; - $js = (isset($vars['js'])) ? $vars['js'] : ''; - - $child_indicator = ''; - if ($has_children) { - if ($selected) { - $child_indicator = '<span class="close_child">-</span>'; - $child_indicator .= '<span class="hidden open_child">+</span>'; - } else { - $child_indicator = '<span class="hidden close_child">-</span>'; - $child_indicator .= '<span class="open_child">+</span>'; - } - - $child_indicator = "<span class=\"child_indicator\">$child_indicator </span>"; - } - - $url = htmlentities($item->href); - $text = $child_indicator . htmlentities($item->text); - - $link_vars = array_merge($vars, array( - 'href' => $item->href, - 'text' => $text, - 'encode_text' => FALSE - )); - - $link = elgg_view('output/url', $link_vars); -} - -echo "<li $selected>$link$children_html</li>"; diff --git a/views/default/navigation/submenu_js.php b/views/default/navigation/submenu_js.php deleted file mode 100644 index 1ed710b2b..000000000 --- a/views/default/navigation/submenu_js.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php -/** - * Javascript to expand submenu items. - * - * @package Elgg - * @subpackage Core - */ -?> - -<script type="text/javascript"> -$(document).ready(function() { - $('.submenu span.child_indicator').click(function() { - var submenu = $(this).parent().parent().find('ul.submenu.child:first'); - var closeChild = $($(this).find('.close_child')); - var openChild = $($(this).find('.open_child')); - - if (submenu.is(':visible')) { - closeChild.addClass('hidden'); - openChild.removeClass('hidden'); - } else { - closeChild.removeClass('hidden'); - openChild.addClass('hidden'); - } - - submenu.slideToggle(); - return false; - }); -}); -</script>
\ No newline at end of file diff --git a/views/default/navigation/tabs.php b/views/default/navigation/tabs.php index fd6d8b8fe..95e3f2669 100644 --- a/views/default/navigation/tabs.php +++ b/views/default/navigation/tabs.php @@ -2,60 +2,80 @@ /** * Tab navigation * - * @uses string $vars['type'] horizontal || vertical - Defaults to horizontal (vertical TBI) + * @uses string $vars['type'] horizontal || vertical - Defaults to horizontal + * @uses string $vars['class'] Additional class to add to ul * @uses array $vars['tabs'] A multi-dimensional array of tab entries in the format array( - * 'title' => string, // Title of link - * 'url' => string, // URL for the link - * 'url_js' => string, // JS to pass to the link - * 'url_class' => string, // Class to pass to the link - * 'class' => string // Class of the li element. - * 'selected' => bool // if this link is currently selected + * 'text' => string, // The string between the <a></a> tags + * 'href' => string, // URL for the link + * 'class' => string // Class of the li element + * 'id' => string, // ID of the li element + * 'selected' => bool // if this tab is currently selected (applied to li element) + * 'link_class' => string, // Class to pass to the link + * 'link_id' => string, // ID to pass to the link * ) - **/ + */ +$options = elgg_clean_vars($vars); + +$type = elgg_extract('type', $vars, 'horizontal'); -$type = (isset($vars['type'])) ? $vars['type'] : 'horizontal'; if ($type == 'horizontal') { - $type_class = "elgg_horizontal_tabbed_nav margin_top"; + $options['class'] = "elgg-tabs elgg-htabs"; } else { - $type_class = "elgg_vertical_tabbed_nav"; + $options['class'] = "elgg-tabs elgg-vtabs"; +} +if (isset($vars['class'])) { + $options['class'] = "{$options['class']} {$vars['class']}"; } +unset($options['tabs']); +unset($options['type']); + +$attributes = elgg_format_attributes($options); + if (isset($vars['tabs']) && is_array($vars['tabs']) && !empty($vars['tabs'])) { ?> - <div class="<?php echo $type_class; ?>"> - <ul> - <?php - foreach ($vars['tabs'] as $info) { - $class = (isset($info['class'])) ? $info['class'] : ''; + <ul <?php echo $attributes; ?>> + <?php + foreach ($vars['tabs'] as $info) { + $class = elgg_extract('class', $info, ''); + $id = elgg_extract('id', $info, ''); - if (isset($info['selected']) && $info['selected'] == TRUE) { - $class .= ' selected'; - } + $selected = elgg_extract('selected', $info, FALSE); + if ($selected) { + $class .= ' elgg-state-selected'; + } - $class_str = ($class) ? "class=\"$class\"" : ''; - $title = htmlentities($info['title'], ENT_QUOTES, 'UTF-8'); - $url = htmlentities($info['url'], ENT_QUOTES, 'UTF-8'); + $class_str = ($class) ? "class=\"$class\"" : ''; + $id_str = ($id) ? "id=\"$id\"" : ''; - $options = array( - 'href' => $url, - 'title' => $title, - 'text' => $title - ); + $options = $info; + unset($options['class']); + unset($options['id']); + unset($options['selected']); - if (isset($info['url_js'])) { - $options['js'] = $info['url_js']; - } + if (!isset($info['href']) && isset($info['url'])) { + $options['href'] = $info['url']; + unset($options['url']); + } + if (!isset($info['text']) && isset($info['title'])) { + $options['text'] = $options['title']; + unset($options['title']); + } + if (isset($info['link_class'])) { + $options['class'] = $options['link_class']; + unset($options['link_class']); + } - if (isset($info['url_class'])) { - $options['class'] = $info['url_class']; - } + if (isset($info['link_id'])) { + $options['id'] = $options['link_id']; + unset($options['link_id']); + } - $link = elgg_view('output/url', $options); + $link = elgg_view('output/url', $options); - echo "<li $class_str $js>$link</li>"; - } - ?> - </ul> - </div> + echo "<li $id_str $class_str>$link</li>"; + } + ?> + </ul> <?php -}
\ No newline at end of file +} diff --git a/views/default/navigation/topbar_tools.php b/views/default/navigation/topbar_tools.php index 44cf4a63d..307f03fc6 100644 --- a/views/default/navigation/topbar_tools.php +++ b/views/default/navigation/topbar_tools.php @@ -4,5 +4,6 @@ * * @package Elgg * @subpackage Core - * + * + * @deprecated 1.8 Extend the topbar menus or the page/elements/topbar view directly */ diff --git a/views/default/navigation/viewtype.php b/views/default/navigation/viewtype.php index 8b2a64978..6dfa4ebc7 100644 --- a/views/default/navigation/viewtype.php +++ b/views/default/navigation/viewtype.php @@ -4,25 +4,8 @@ * * @package Elgg * @subpackage Core + * + * @deprecated 1.8 See how file plugin adds a toggle in function file_register_toggle() */ -$baseurl = elgg_http_remove_url_query_element($vars['baseurl'], 'search_viewtype'); - -if ($vars['viewtype'] == "list") { - $viewtype = "gallery"; -} else { - $viewtype = "list"; -} - -if (substr_count($baseurl,'?')) { - $baseurl .= "&search_viewtype=" . $viewtype; -} else { - $baseurl .= "?search_viewtype=" . $viewtype; -} - -?> - -<p class="margin_top"> - <?php echo elgg_echo("viewtype:change") ?>: - <a href="<?php echo $baseurl; ?>"><?php echo elgg_echo("viewtype:{$viewtype}"); ?></a> -</p>
\ No newline at end of file +elgg_deprecated_notice('navigation/viewtype was deprecated', 1.8); |
