roottab allows a root starting point

This commit is contained in:
JT Smith 2003-07-01 01:12:10 +00:00
parent 0f32644b87
commit 79a10f5b87

View file

@ -11,6 +11,7 @@ package WebGUI::Macro::RootTab;
#-------------------------------------------------------------------
use strict;
use WebGUI::Macro;
use WebGUI::Navigation;
use WebGUI::Session;
use WebGUI::SQL;
@ -39,7 +40,7 @@ sub _draw {
#-------------------------------------------------------------------
sub _findRoot {
my ($pageId,$parentId) = WebGUI::SQL->quickArray("select pageId,parentId from page where pageId=$_[0]");
if ($parentId == 0) {
if ($parentId == $_[1]) {
return $pageId;
} else {
return _findRoot($parentId);
@ -49,8 +50,9 @@ sub _findRoot {
#-------------------------------------------------------------------
sub process {
my $root = _findRoot($session{page}{pageId});
my $tree = WebGUI::Navigation::tree(0,1);
my @param = WebGUI::Macro::getParams($_[0]);
my $root = _findRoot($session{page}{pageId},$param[0]);
my $tree = WebGUI::Navigation::tree($param[0],1);
return _draw($tree,$root);
}