Added the new Navigation core component and updated the navigation macros.
This commit is contained in:
parent
afcad66b68
commit
1c3094af19
11 changed files with 240 additions and 190 deletions
|
|
@ -12,19 +12,20 @@ package WebGUI::Macro::M_currentMenuVertical;
|
|||
|
||||
use strict;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Macro::Shared;
|
||||
use WebGUI::Navigation;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _replacement {
|
||||
my ($output, $temp, @param);
|
||||
my ($tree, $temp, @param);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
$temp = '<span class="verticalMenu">';
|
||||
if ($param[0] ne "") {
|
||||
$temp .= traversePageTree($session{page}{pageId},0,$param[0]);
|
||||
$tree = WebGUI::Navigation::tree($session{page}{pageId},$param[0]);
|
||||
} else {
|
||||
$temp .= traversePageTree($session{page}{pageId},0,1);
|
||||
$tree = WebGUI::Navigation::tree($session{page}{pageId},1);
|
||||
}
|
||||
$temp .= WebGUI::Navigation::drawVertical($tree);
|
||||
$temp .= '</span>';
|
||||
return $temp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,19 +12,20 @@ package WebGUI::Macro::P_previousMenuVertical;
|
|||
|
||||
use strict;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Macro::Shared;
|
||||
use WebGUI::Navigation;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _replacement {
|
||||
my ($temp, @param);
|
||||
my ($temp, @param, $tree);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
$temp = '<span class="verticalMenu">';
|
||||
if ($param[0] ne "") {
|
||||
$temp .= traversePageTree($session{page}{parentId},0,$param[0]);
|
||||
$tree = WebGUI::Navigation::tree($session{page}{parentId},$param[0]);
|
||||
} else {
|
||||
$temp .= traversePageTree($session{page}{parentId},0,1);
|
||||
$tree = WebGUI::Navigation::tree($session{page}{parentId},1);
|
||||
}
|
||||
$temp .= WebGUI::Navigation::drawVertical($tree);
|
||||
$temp .= '</span>';
|
||||
return $temp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,24 +12,25 @@ package WebGUI::Macro::S_specificMenuVertical;
|
|||
|
||||
use strict;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Macro::Shared;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Navigation;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _replacement {
|
||||
my ($temp, @param, @data);
|
||||
my ($temp, @param, $pageId, $tree);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
if ($param[1] eq "") {
|
||||
$param[1] = 0;
|
||||
($pageId) = WebGUI::SQL->quickArray("select pageId from page where urlizedTitle='$param[0]'");
|
||||
if (defined $pageId) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
if ($param[1] ne "") {
|
||||
$tree = WebGUI::Navigation::tree($pageId,$param[1]);
|
||||
} else {
|
||||
$tree = WebGUI::Navigation::tree($pageId,1);
|
||||
}
|
||||
$temp .= WebGUI::Navigation::drawVertical($tree);
|
||||
$temp .= '</span>';
|
||||
}
|
||||
@data = WebGUI::SQL->quickArray("select pageId from page where urlizedTitle='$param[0]'");
|
||||
$temp = '<span class="verticalMenu">';
|
||||
if (defined $data[0] && WebGUI::Privilege::canViewPage($data[0])) {
|
||||
$temp .= traversePageTree($data[0],1,$param[1]);
|
||||
}
|
||||
$temp .= '</span>';
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,59 +0,0 @@
|
|||
package WebGUI::Macro::Shared;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2002 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 Exporter;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&traversePageTree);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
return $_[0];
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub traversePageTree {
|
||||
my ($sth, @data, $output, $depth, $i, $toLevel);
|
||||
if ($_[2] > 0) {
|
||||
$toLevel = $_[2];
|
||||
} else {
|
||||
$toLevel = 99;
|
||||
}
|
||||
for ($i=1;$i<=$_[1];$i++) {
|
||||
$depth .= " ";
|
||||
}
|
||||
if ($_[1] < $toLevel) {
|
||||
$sth = WebGUI::SQL->read("select urlizedTitle, menuTitle, pageId from page where parentId='$_[0]' order by sequenceNumber");
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
$output .= $depth.'<a class="verticalMenu" href="'.WebGUI::URL::gateway($data[0]).'">';
|
||||
if ($session{page}{pageId} == $data[2]) {
|
||||
$output .= '<span class="selectedMenuItem">'.$data[1].'</span>';
|
||||
} else {
|
||||
$output .= $data[1];
|
||||
}
|
||||
$output .= '</a><br>';
|
||||
$output .= traversePageTree($data[2],$_[1]+1,$toLevel);
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
|
@ -12,20 +12,21 @@ package WebGUI::Macro::T_topMenuVertical;
|
|||
|
||||
use strict;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Macro::Shared;
|
||||
use WebGUI::Navigation;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _replacement {
|
||||
my ($temp, @param);
|
||||
my ($temp, @param, $tree);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
$temp = '<span class="verticalMenu">';
|
||||
if ($param[0] ne "") {
|
||||
$temp .= traversePageTree(1,0,$param[0]);
|
||||
$tree = WebGUI::Navigation::tree(1,$param[0]);
|
||||
} else {
|
||||
$temp .= traversePageTree(1,0,1);
|
||||
$tree = WebGUI::Navigation::tree(1,1);
|
||||
}
|
||||
$temp .= WebGUI::Navigation::drawVertical($tree);
|
||||
$temp .= '</span>';
|
||||
return $temp;
|
||||
return $temp;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -12,35 +12,16 @@ package WebGUI::Macro::m_currentMenuHorizontal;
|
|||
|
||||
use strict;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Navigation;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _replacement {
|
||||
my ($temp, @data, $sth, $first, @param, $delimeter);
|
||||
my ($temp, @param, $tree);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
if ($param[0] eq "") {
|
||||
$delimeter = " · ";
|
||||
} else {
|
||||
$delimeter = " ".$param[0]." ";
|
||||
}
|
||||
$tree = WebGUI::Navigation::tree($session{page}{pageId},1);
|
||||
$temp = '<span class="horizontalMenu">';
|
||||
$first = 1;
|
||||
$sth = WebGUI::SQL->read("select menuTitle,urlizedTitle,pageId from page where parentId=$session{page}{pageId} order by sequenceNumber");
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
if ($first) {
|
||||
$first = 0;
|
||||
} else {
|
||||
$temp .= $delimeter;
|
||||
}
|
||||
$temp .= '<a class="horizontalMenu" href="'.WebGUI::URL::gateway($data[1]).
|
||||
'">'.$data[0].'</a>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$temp .= WebGUI::Navigation::drawHorizontal($tree,$param[0]);
|
||||
$temp .= '</span>';
|
||||
return $temp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,40 +12,17 @@ package WebGUI::Macro::p_previousMenuHorizontal;
|
|||
|
||||
use strict;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Navigation;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _replacement {
|
||||
my ($temp, @data, $sth, $first, @param, $delimeter);
|
||||
my ($temp, $tree, @param);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
if ($param[0] eq "") {
|
||||
$delimeter = " · ";
|
||||
} else {
|
||||
$delimeter = " ".$param[0]." ";
|
||||
}
|
||||
$tree = WebGUI::Navigation::tree($session{page}{parentId},1);
|
||||
$temp = '<span class="horizontalMenu">';
|
||||
$first = 1;
|
||||
$sth = WebGUI::SQL->read("select menuTitle,urlizedTitle,pageId from page where parentId=$session{page}{parentId} order by sequenceNumber");
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
if ($first) {
|
||||
$first = 0;
|
||||
} else {
|
||||
$temp .= $delimeter;
|
||||
}
|
||||
$temp .= '<a class="horizontalMenu" href="'.WebGUI::URL::gateway($data[1]).'">';
|
||||
if ($session{page}{pageId} == $data[2]) {
|
||||
$temp .= '<span class="selectedMenuItem">'.$data[0].'</span>';
|
||||
} else {
|
||||
$temp .= $data[0];
|
||||
}
|
||||
$temp .= '</a>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$temp .= WebGUI::Navigation::drawHorizontal($tree,$param[0]);
|
||||
$temp .= '</span>';
|
||||
return $temp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ package WebGUI::Macro::rootmenuHorizontal;
|
|||
|
||||
use strict;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Macro::Shared;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
|
|
|||
|
|
@ -12,42 +12,17 @@ package WebGUI::Macro::s_specificMenuHorizontal;
|
|||
|
||||
use strict;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Macro::Shared;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Navigation;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _replacement {
|
||||
my ($temp, @data, $pageTitle, $parentId, $sth, $first, @param, $delimeter);
|
||||
my ($temp, $tree, $parentId, @param);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
if ($param[1] eq "") {
|
||||
$delimeter = " · ";
|
||||
} else {
|
||||
$delimeter = " ".$param[1]." ";
|
||||
}
|
||||
$temp = '<span class="horizontalMenu">';
|
||||
$first = 1;
|
||||
($parentId) = WebGUI::SQL->quickArray("select pageId from page where urlizedTitle='$param[0]'");
|
||||
$sth = WebGUI::SQL->read("select menuTitle,urlizedTitle,pageId from page where parentId='$parentId' order by sequenceNumber");
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
if ($first) {
|
||||
$first = 0;
|
||||
} else {
|
||||
$temp .= $delimeter;
|
||||
}
|
||||
$temp .= '<a class="horizontalMenu" href="'.WebGUI::URL::gateway($data[1]).'">';
|
||||
if ($session{page}{pageId} == $data[2]) {
|
||||
$temp .= '<span class="selectedMenuItem">'.$data[0].'</span>';
|
||||
} else {
|
||||
$temp .= $data[0];
|
||||
}
|
||||
$temp .= '</a>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$tree = WebGUI::Navigation::tree($parentId,1);
|
||||
$temp .= WebGUI::Navigation::drawHorizontal($tree,$param[1]);
|
||||
$temp .= '</span>';
|
||||
return $temp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,39 +12,16 @@ package WebGUI::Macro::t_topMenuHorizontal;
|
|||
|
||||
use strict;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Navigation;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _replacement {
|
||||
my ($temp, @data, $sth, $first, @param, $delimeter);
|
||||
my ($temp, $tree, @param);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
if ($param[0] eq "") {
|
||||
$delimeter = " · ";
|
||||
} else {
|
||||
$delimeter = " ".$param[0]." ";
|
||||
}
|
||||
$tree = WebGUI::Navigation::tree(1,1);
|
||||
$temp = '<span class="horizontalMenu">';
|
||||
$first = 1;
|
||||
$sth = WebGUI::SQL->read("select menuTitle,urlizedTitle,pageId from page where parentId=1 order by sequenceNumber");
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
if ($first) {
|
||||
$first = 0;
|
||||
} else {
|
||||
$temp .= $delimeter;
|
||||
}
|
||||
$temp .= '<a class="horizontalMenu" href="'.WebGUI::URL::gateway($data[1]).'">';
|
||||
if ($session{page}{pageId} == $data[2]) {
|
||||
$temp .= '<span class="selectedMenuItem">'.$data[0].'</span>';
|
||||
} else {
|
||||
$temp .= $data[0];
|
||||
}
|
||||
$temp .= '</a>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$temp .= WebGUI::Navigation::drawHorizontal($tree,$param[0]);
|
||||
$temp .= '</span>';
|
||||
return $temp;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue