Skip to content

Commit

Permalink
Fixed dropdown spt expressions, menu structure when include in naviga…
Browse files Browse the repository at this point in the history
…tion is off with section index on
  • Loading branch information
Semias committed Jan 31, 2012
1 parent 7c071ad commit 45bb8b7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
14 changes: 7 additions & 7 deletions inc/app/sitellite/html/nav/dropdown/menu.spt
Expand Up @@ -20,18 +20,18 @@
<div id="menu">
<ul class="dropdown menu">
{loop obj[list]}
<li class="leaf{if not empty (loop.last)} last{end if}{if not empty (loop.active)} current{end if}">
<li class="leaf{if not empty (loop[last])} last{end if}{if not empty (loop[active])} current{end if}">
<a class="parent" href="{site/prefix}/index/{loop.id}" ><span>{loop.title}</span></a>
{if not empty (loop.submenu)}
{if not empty (loop[submenu])}
<ul>
{loop loop[submenu]}
<li class="{if not empty (loop.last)}last{end if}{if not empty (loop.active)} current{end if}">
<a {if not empty (loop.submenu)}class="parent"{end if} href="{site/prefix}/index/{loop.id}"{active|none}><span>{loop.title}</span></a>
{if not empty (loop.submenu)}
<li class="{if not empty (loop[last])}last{end if}{if not empty (loop[active])}current{end if}">
<a {if not empty (loop[submenu])}class="parent"{end if} href="{site/prefix}/index/{loop.id}"{active|none}><span>{loop.title}</span></a>
{if not empty (loop[submenu])}
<ul>
{loop loop[submenu]}
<li class="{if not empty (loop.last)}last{end if}{if not empty (loop.active)} current{end if}">
<a {if not empty (loop.submenu)}class="parent"{end if} href="{site/prefix}/index/{loop.id}"{active|none}><span>{loop.title}</span></a>
<li class="{if not empty (loop[last])}last{end if}{if not empty (loop[active])}current{end if}">
<a {if not empty (loop[submenu])}class="parent"{end if} href="{site/prefix}/index/{loop.id}"{active|none}><span>{loop.title}</span></a>
</li>
{end loop}
</ul>
Expand Down
6 changes: 4 additions & 2 deletions inc/app/sitellite/lib/nav/Dropdown.php
Expand Up @@ -12,11 +12,13 @@ function create_menu($list, $page, $submenu_disabled) {
// Check if the submenu is enabled
if (!$submenu_disabled) {
foreach ($list as $item) {
$menu[] = create_menu_item($item, $page);
if($item->include != 'no')
$menu[] = create_menu_item($item, $page);
}
} else {
foreach ($list as $item) {
$menu[] = create_menu_item_nosubitems($item, $page);
if($item->include != 'no')
$menu[] = create_menu_item_nosubitems($item, $page);
}
}

Expand Down
19 changes: 14 additions & 5 deletions saf/lib/GUI/Menu.php
Expand Up @@ -403,7 +403,7 @@ function initTree ($tree) {
foreach ($tree as $k => $v) {
if ($v->{$this->listcolumn} == 'no') {

// Set menu parent
/* Set menu parent */
$this->addParent (
$v->{$this->idcolumn},
$v->{$this->showcolumn},
Expand Down Expand Up @@ -492,12 +492,13 @@ function &addParent ($id, $title, $ref = '', $sect = '', $template = '') {
if (empty ($ref)) {
$this->tree[] =& $this->{'items_' . $id};
} else {
//$this->{'items_' . $ref}->children[] =& $this->{'items_' . $id};
$this->{'items_' . $ref}->children[] =& $this->{'items_' . $id};
$this->{'items_' . $id}->parent =& $this->{'items_' . $ref};
}

$this->{'items_' . $id}->include = 'no';
$this->{'items_' . $id}->colours = $this->colours;
//$this->{'items_' . $id}->is_section = ($sect == 'yes') ? true : false;
$this->{'items_' . $id}->is_section = ($sect == 'yes') ? true : false;
if (! empty ($template)) {
$this->{'items_' . $id}->template = $template;
}
Expand Down Expand Up @@ -879,12 +880,20 @@ function getSections ($item = false) {
$sections = array ();
foreach ($this->getChildren ($item) as $child) {
if ($child->is_section == 'yes') {
$sections[$child->id] = $child->title;
if($child->title != '') {
$sections[$child->id] = $child->title;
} else {
$sections[$child->id] = $child->id;
}
}
$add = $this->getSections ($child->id);
if (count ($add) > 0) {
foreach ($add as $id => $title) {
$sections[$id] = $title;
if($title != '') {
$sections[$id] = $title;
} else {
$sections[$id] = $id;
}
}
}
}
Expand Down

0 comments on commit 45bb8b7

Please sign in to comment.