package WebGUI::Macro::FlexMenu; #------------------------------------------------------------------- # WebGUI is Copyright 2001-2003 Plain Black LLC. #------------------------------------------------------------------- # Please read the legal notices (docs/legal.txt) and the license # (docs/license.txt) that came with this distribution before using # this software. #------------------------------------------------------------------- # http://www.plainblack.com info@plainblack.com #------------------------------------------------------------------- use strict; use WebGUI::Macro; use WebGUI::Privilege; use WebGUI::Session; use WebGUI::URL; #------------------------------------------------------------------- sub process { my ($temp, @param); @param = WebGUI::Macro::getParams($_[0]); $temp = ''; $temp .= _reversePageTree($session{page}{pageId}); $temp .= ''; return $temp; } #------------------------------------------------------------------- sub _reversePageTree { my ($sth, @data, $output, $parentId); ($parentId) = WebGUI::SQL->quickArray("select parentId from page where pageId='$_[0]'"); $sth = WebGUI::SQL->read("select pageId,parentId,menuTitle,urlizedTitle,hideFromNavigation from page where parentId=$_[0] order by sequenceNumber"); while (@data = $sth->array) { if (!($data[4]) && WebGUI::Privilege::canViewPage($data[0])) { $output .= ''; if ($session{page}{pageId} == $data[0]) { $output .= ''.$data[2].''; } else { $output .= $data[2]; } $output .= '
'; if ($_[1] == $data[0] && $_[2] ne "") { $output .= '
   '.$_[2].'
'; } } } $sth->finish; if ($parentId > 0) { $output = _reversePageTree($parentId,$_[0],$output); } return $output; } 1;