From 223c4cec0a7a8aad8a24064997501ab53d800380 Mon Sep 17 00:00:00 2001 From: Len Kranendonk Date: Mon, 15 Dec 2003 16:07:54 +0000 Subject: [PATCH] ^t; start in current root rather then in site root. --- docs/changelog/6.x.x.txt | 2 +- lib/WebGUI/Macro/t_topMenuHorizontal.pm | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 35ab94910..a632538f3 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -23,5 +23,5 @@ - Updated the Form subsystem to use the new calendar for date and time fields. - Bugfix 859816 : DataForm - security issues. Tnx Gabor for reporting. - + - ^t; now starts in current root rather then in site root. diff --git a/lib/WebGUI/Macro/t_topMenuHorizontal.pm b/lib/WebGUI/Macro/t_topMenuHorizontal.pm index ae2c6b0b5..cf640487d 100644 --- a/lib/WebGUI/Macro/t_topMenuHorizontal.pm +++ b/lib/WebGUI/Macro/t_topMenuHorizontal.pm @@ -19,13 +19,23 @@ use WebGUI::Session; sub process { my ($temp, $tree, @param); @param = WebGUI::Macro::getParams($_[0]); - $tree = WebGUI::Navigation::tree(1,1); + my $root = _findRoot($session{page}{pageId}); + $tree = WebGUI::Navigation::tree($root,1); $temp = ''; $temp .= WebGUI::Navigation::drawHorizontal($tree,$param[0]); $temp .= ''; return $temp; } +sub _findRoot { + my ($pageId,$parentId) = WebGUI::SQL->quickArray("select pageId,parentId from page where pageId=$_[0]"); + if ($parentId == $_[1]) { + return $pageId; + } else { + return _findRoot($parentId); + } +} + 1;