X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fmoremenu.php;h=fa335b3c7b7dda1b712af7c8d615290ad6fe6040;hb=8884a5255fb90fda67b63fa0d4252d77176337e5;hp=a8ab1325551432ea67852d8db25d656fc8adcbf8;hpb=feb53619cfbc9fdb7d9dd0ad232b3aa81e9bc0e2;p=quix0rs-gnu-social.git diff --git a/lib/moremenu.php b/lib/moremenu.php index a8ab132555..fa335b3c7b 100644 --- a/lib/moremenu.php +++ b/lib/moremenu.php @@ -4,7 +4,7 @@ * Copyright (C) 2011, StatusNet, Inc. * * A menu with a More... button to show more elements - * + * * PHP version 5 * * This program is free software: you can redistribute it and/or modify @@ -44,12 +44,11 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ - class MoreMenu extends Menu { const SOFT_MAX = 5; const HARD_MAX = 15; - + /** * Show a menu with a limited number of elements * @@ -57,7 +56,6 @@ class MoreMenu extends Menu * * @return */ - function show() { $items = $this->getItems(); @@ -72,7 +70,6 @@ class MoreMenu extends Menu } if (Event::handle('StartNav', array($this, &$tag, &$items))) { - $this->out->elementStart('ul', $attrs); $total = count($items); @@ -89,10 +86,10 @@ class MoreMenu extends Menu } if ($total > self::SOFT_MAX + 1) { - $this->out->elementStart('li', array('class' => 'more_link')); $this->out->element('a', array('href' => '#', 'onclick' => 'SN.U.showMoreMenuItems("'.$menuID.'"); return false;'), + // TRANS: Link description to show more items in a list. _('More ▼')); $this->out->elementEnd('li'); @@ -103,14 +100,16 @@ class MoreMenu extends Menu $this->item($actionName, $args, $label, $description, $id, 'extended_menu'); } - $seeAll = $this->seeAllItem(); + if ($total > self::HARD_MAX) { + $seeAll = $this->seeAllItem(); - if (!empty($seeAll)) { - list($actionName, $args, $label, $description, $id) = $seeAll; - $this->item($actionName, $args, $label, $description, $id, 'extended_menu see_all'); + if (!empty($seeAll)) { + list($actionName, $args, $label, $description, $id) = $seeAll; + $this->item($actionName, $args, $label, $description, $id, 'extended_menu see_all'); + } } } - + $this->out->elementEnd('ul'); Event::handle('EndNav', array($this, $tag, $items)); @@ -121,5 +120,4 @@ class MoreMenu extends Menu { return null; } - }