From d8fb520e40b034db0b77ed8b809bfdd3a49135be Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 20 Dec 2016 11:31:45 -0800 Subject: [PATCH] Bootstrap navigation now support sub-links of sublinks. --- e107_core/templates/navigation_template.php | 14 +++++--- e107_handlers/sitelinks_class.php | 40 +++++++++++++++------ e107_themes/bootstrap3/style.css | 10 ++++-- news.php | 4 +++ 4 files changed, 51 insertions(+), 17 deletions(-) diff --git a/e107_core/templates/navigation_template.php b/e107_core/templates/navigation_template.php index 79d80cc48..ab0520b51 100644 --- a/e107_core/templates/navigation_template.php +++ b/e107_core/templates/navigation_template.php @@ -54,7 +54,7 @@ $NAVIGATION_TEMPLATE['main']['end'] = ''; // Sub menu $NAVIGATION_TEMPLATE['main']['submenu_start'] = ' - '; // TEMPLATE FOR {NAVIGATION=side} diff --git a/e107_handlers/sitelinks_class.php b/e107_handlers/sitelinks_class.php index a13922d71..b31bc03ab 100644 --- a/e107_handlers/sitelinks_class.php +++ b/e107_handlers/sitelinks_class.php @@ -1468,10 +1468,10 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } foreach ($data as $_data) { $active = ($this->isActive($_data, $this->activeMainFound)) ? "_active" : ""; - + $sc->setDepth(0); $sc->setVars($_data); // isActive is allowed to alter data $itemTmpl = count($_data['link_sub']) > 0 ? $template['item_submenu'.$active] : $template['item'.$active]; - $ret .= e107::getParser()->parseTemplate($itemTmpl, TRUE, $sc); + $ret .= e107::getParser()->parseTemplate($itemTmpl, true, $sc); $sc->active = ($active) ? true : false; if($sc->active) { @@ -1498,7 +1498,9 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } $data = $sql->retrieve($query,true); - return $this->compile($data, $outArray); + $ret = $this->compile($data, $outArray); + + return $ret; } @@ -1510,8 +1512,8 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } if(!is_array($inArray) || !is_array($outArray)){ return null; } $frm = e107::getForm(); - - foreach($inArray as $key => $val) + + foreach($inArray as $key => $val) { if($val['link_parent'] == $pid) { @@ -1556,8 +1558,10 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } if(include_once(e_PLUGIN.$path."/e_sitelink.php")) { $class = $path."_sitelink"; - if($sublinkArray = e107::callMethod($class,$method,$parm)) //TODO Cache it. + if($sublinkArray = e107::callMethod($class,$method,$parm,$row)) //TODO Cache it. { + + return $sublinkArray; } } @@ -1665,6 +1669,7 @@ class navigation_shortcodes extends e_shortcode public $template; public $counter; public $active; + public $depth = 0; /** @@ -1693,7 +1698,18 @@ class navigation_shortcodes extends e_shortcode return intval($this->var['link_id']); } - + function sc_link_depth($parm='') + { + return $this->depth; + } + + + function setDepth($val) + { + $this->depth = intval($val); + } + + /** * Return the name of the current link * @return string @@ -1864,9 +1880,13 @@ class navigation_shortcodes extends e_shortcode return $this->var['link_sub']; } + $this->depth++; // Assume it's an array. - - $text = e107::getParser()->parseTemplate(str_replace('{LINK_SUB}', '', $this->template['submenu_start']), true, $this); + + $startTemplate = !empty($this->var['link_sub'][0]['link_sub']) && isset($this->template['submenu_lowerstart']) ? $this->template['submenu_lowerstart'] : $this->template['submenu_start']; + $endTemplate = !empty($this->var['link_sub'][0]['link_sub']) && isset($this->template['submenu_lowerstart']) ? $this->template['submenu_lowerend'] : $this->template['submenu_end']; + + $text = e107::getParser()->parseTemplate(str_replace('{LINK_SUB}', '', $startTemplate), true, $this); foreach($this->var['link_sub'] as $val) { @@ -1877,7 +1897,7 @@ class navigation_shortcodes extends e_shortcode if($active) $this->activeSubFound = true; } - $text .= e107::getParser()->parseTemplate(str_replace('{LINK_SUB}', '', $this->template['submenu_end']), true, $this); + $text .= e107::getParser()->parseTemplate(str_replace('{LINK_SUB}', '', $endTemplate), true, $this); return $text; } diff --git a/e107_themes/bootstrap3/style.css b/e107_themes/bootstrap3/style.css index 1ab931824..343a07f52 100644 --- a/e107_themes/bootstrap3/style.css +++ b/e107_themes/bootstrap3/style.css @@ -146,8 +146,14 @@ table label.checkbox { li.dropdown-avatar > a.dropdown-toggle { padding:9px 15px 10px 0; } - - +/* Navigation sub-sub menu - Mega Menu */ +ul.submenu-start.lower { list-style:none; width:500px; margin-left:-200px;} /* Adjust to one's needs */ +ul.submenu-start.lower li.dropdown-submenu { display:inline-block; } +li.dropdown-submenu.lower ul.submenu-start { list-style-type:initial; list-style-position:inside; border:0; position:relative; display:block; width:auto; padding:0; box-shadow:none; -webkit-box-shadow:none; } +li.dropdown-submenu.lower ul.submenu-start li { padding-left:20px; margin-left:0; text-indent:0} +li.dropdown-submenu.lower ul.submenu-start li a { display:inline-block; padding-left:0; margin-left:0} +li.dropdown-submenu.lower ul.submenu-start li a:hover { background:none} +li.dropdown-submenu.lower ul.submenu-start li:hover { background-color:#f5f5f5; } diff --git a/news.php b/news.php index c0539a709..11d2ef83e 100644 --- a/news.php +++ b/news.php @@ -27,6 +27,10 @@ if(!deftrue('e_LEGACY_NEWS')) // subject to removal at any time. exit; } + +// --------------------- everything below this point will be removed in future -------------------------- + + include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE); require_once(e_HANDLER."news_class.php");