removed all the old nav macros
This commit is contained in:
parent
2b82d714ea
commit
314d8daacb
22 changed files with 63 additions and 913 deletions
|
|
@ -83,5 +83,6 @@ webgui.
|
|||
- Added an override in the user profile for toolbar icon set.
|
||||
- Migrated the navigation items (Thanks to Leendert Bottelberghs, Len
|
||||
Kranendonk).
|
||||
- Removed all old navigation macros. See gotcha's for details.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,18 @@ save you many hours of grief.
|
|||
so that you can migrate them manually to the new template
|
||||
variables.
|
||||
|
||||
* The Synopsis macro no longer exists. If you were using it to
|
||||
retrieve the current page's synopsis, then please use the
|
||||
^Page("synopsis"); macro. If you were using it to build a
|
||||
synopsis style navigation please use the new ^Navigation();
|
||||
macro.
|
||||
|
||||
* The old navigation system has been entirely replaced. If you've
|
||||
built or are using any navigation components that did not
|
||||
come with WebGUI then you'll need to remove them and use
|
||||
the new configurable navigation system. See migration.txt
|
||||
for additional details.
|
||||
|
||||
|
||||
|
||||
5.5.0
|
||||
|
|
|
|||
|
|
@ -26,9 +26,17 @@ There have currently been no changes to the Wobject API.
|
|||
2. Macro Migration
|
||||
-------------------
|
||||
|
||||
2.1 Nothing Yet
|
||||
2.1 Navigation Macros
|
||||
|
||||
There have currently been no changes to the macro API.
|
||||
As of WebGUI 6.0 there is no longer a need to develop custom navigation macros. WebGUI
|
||||
has an entirely new navigation system that is 100% configurable and templated. The
|
||||
legacy navigation system has been removed. Any nav macros that you've written
|
||||
will need to be removed from the system. Then just create a navigation
|
||||
configuration to do what your old nav once did.
|
||||
|
||||
If you absolutely must write a navigation macro for some reason that our nav
|
||||
system does not accomodate you, then please check out the new API in
|
||||
WebGUI::Navigation.
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -491,7 +491,30 @@ my $macros = $conf->get("macros");
|
|||
delete $macros->{"\\"};
|
||||
$macros->{"\\\\"} = "Backslash_pageUrl";
|
||||
$macros->{"Navigation"} = "Navigation";
|
||||
$conf->set("macros"=>$macros);
|
||||
my %newMacros;
|
||||
foreach my $macro (keys %{$macros}) {
|
||||
unless (
|
||||
$macros->{$macro} eq "m_currentMenuHorizontal"
|
||||
|| $macros->{$macro} eq "M_currentMenuVertical"
|
||||
|| $macros->{$macro} eq "s_specificMenuHorizontal"
|
||||
|| $macros->{$macro} eq "S_specificMenuVertical"
|
||||
|| $macros->{$macro} eq "t_topMenuHorizontal"
|
||||
|| $macros->{$macro} eq "T_topMenuVertical"
|
||||
|| $macros->{$macro} eq "p_previousMenuHorizontal"
|
||||
|| $macros->{$macro} eq "P_previousMenuVertical"
|
||||
|| $macros->{$macro} eq "C_crumbTrail"
|
||||
|| $macros->{$macro} eq "FlexMenu"
|
||||
|| $macros->{$macro} eq "PreviousDropMenu"
|
||||
|| $macros->{$macro} eq "rootmenuHorizontal"
|
||||
|| $macros->{$macro} eq "RootTab"
|
||||
|| $macros->{$macro} eq "SpecificDropMenu"
|
||||
|| $macros->{$macro} eq "TopDropMenu"
|
||||
|| $macros->{$macro} eq "Synopsis"
|
||||
) {
|
||||
$newMacros{$macro} = $macros->{$macro};
|
||||
}
|
||||
}
|
||||
$conf->set("macros"=>\%newMacros);
|
||||
my $wobjects = $conf->get("wobjects");
|
||||
my @newWobjects;
|
||||
foreach my $wobject (@{$wobjects}) {
|
||||
|
|
@ -531,6 +554,22 @@ unlink("../../lib/WebGUI/Wobject/FAQ.pm");
|
|||
unlink("../../lib/WebGUI/Wobject/ExtraColumn.pm");
|
||||
unlink("../../lib/WebGUI/Authentication.pm");
|
||||
unlink("../../lib/WebGUI/Operation/Account.pm");
|
||||
unlink("../../lib/WebGUI/Macro/m_currentMenuHorizontal.pm");
|
||||
unlink("../../lib/WebGUI/Macro/M_currentMenuVertical.pm");
|
||||
unlink("../../lib/WebGUI/Macro/s_specificMenuHorizontal.pm");
|
||||
unlink("../../lib/WebGUI/Macro/S_specificMenuVertical.pm");
|
||||
unlink("../../lib/WebGUI/Macro/t_topMenuHorizontal.pm");
|
||||
unlink("../../lib/WebGUI/Macro/T_topMenuVertical.pm");
|
||||
unlink("../../lib/WebGUI/Macro/p_previousMenuHorizontal.pm");
|
||||
unlink("../../lib/WebGUI/Macro/P_previousMenuVertical.pm");
|
||||
unlink("../../lib/WebGUI/Macro/C_crumbTrail.pm");
|
||||
unlink("../../lib/WebGUI/Macro/FlexMenu.pm");
|
||||
unlink("../../lib/WebGUI/Macro/PreviousDropMenu.pm");
|
||||
unlink("../../lib/WebGUI/Macro/Synopsis.pm");
|
||||
unlink("../../lib/WebGUI/Macro/rootmenuHorizontal.pm");
|
||||
unlink("../../lib/WebGUI/Macro/RootTab.pm");
|
||||
unlink("../../lib/WebGUI/Macro/SpecificDropMenu.pm");
|
||||
unlink("../../lib/WebGUI/Macro/TopDropMenu.pm");
|
||||
rmtree("../../lib/WebGUI/Authentication");
|
||||
rmtree("../../www/extras/toolbar/default");
|
||||
|
||||
|
|
|
|||
|
|
@ -31,14 +31,12 @@ macros = a => a_account, \
|
|||
@ => At_username, \
|
||||
\\ => Backslash_pageUrl, \
|
||||
c => c_companyName, \
|
||||
C => C_crumbTrail, \
|
||||
CanEditText => CanEditText, \
|
||||
D => D_date, \
|
||||
e => e_companyEmail, \
|
||||
EditableToggle => EditableToggle, \
|
||||
Extras => Extras, \
|
||||
File => File, \
|
||||
FlexMenu => FlexMenu, \
|
||||
GroupAdd => GroupAdd, \
|
||||
GroupDelete => GroupDelete, \
|
||||
GroupText => GroupText, \
|
||||
|
|
@ -49,32 +47,18 @@ macros = a => a_account, \
|
|||
L => L_loginBox, \
|
||||
LastModified => LastModified, \
|
||||
LoginToggle => LoginToggle, \
|
||||
m => m_currentMenuHorizontal, \
|
||||
M => M_currentMenuVertical, \
|
||||
Navigation => Navigation, \
|
||||
PageTitle => PageTitle, \
|
||||
PreviousDropMenu => PreviousDropMenu, \
|
||||
p => p_previousMenuHorizontal, \
|
||||
P => P_previousMenuVertical, \
|
||||
? => Question_search, \
|
||||
rootmenu => rootmenuHorizontal, \
|
||||
RandomImage => RandomImage, \
|
||||
RandomSnippet => RandomSnippet, \
|
||||
RootTab => RootTab, \
|
||||
RootTitle => RootTitle, \
|
||||
r => r_printable, \
|
||||
/ => Slash_gatewayUrl, \
|
||||
Snippet => Snippet, \
|
||||
s => s_specificMenuHorizontal, \
|
||||
S => S_specificMenuVertical, \
|
||||
Spacer => Spacer, \
|
||||
SpecificDropMenu => SpecificDropMenu, \
|
||||
SI => SI_scaledImage, \
|
||||
Synopsis => Synopsis, \
|
||||
ThumbnailLinker => ThumbnailLinker, \
|
||||
Thumbnail => Thumbnail, \
|
||||
TopDropMenu => TopDropMenu, \
|
||||
t => t_topMenuHorizontal, \
|
||||
T => T_topMenuVertical, \
|
||||
u => u_companyUrl
|
||||
|
||||
|
|
|
|||
|
|
@ -1,51 +0,0 @@
|
|||
package WebGUI::Macro::C_crumbTrail;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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 Tie::CPHash;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _recurseCrumbTrail {
|
||||
my ($sth, %data, $output);
|
||||
tie %data, 'Tie::CPHash';
|
||||
%data = WebGUI::SQL->quickHash("select pageId,parentId,menuTitle,urlizedTitle from page where pageId=$_[0]");
|
||||
if ($data{pageId} > 1) {
|
||||
$output .= _recurseCrumbTrail($data{parentId},$_[1]);
|
||||
}
|
||||
if ($data{menuTitle} ne "") {
|
||||
$output .= '<a class="crumbTrail" href="'.WebGUI::URL::gateway($data{urlizedTitle})
|
||||
.'">'.$data{menuTitle}.'</a>'.$_[1];
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my (@param, $temp, $delimeter);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
if ($param[0] eq "") {
|
||||
$delimeter = " > ";
|
||||
} else {
|
||||
$delimeter = " ".$param[0]." ";
|
||||
}
|
||||
$temp = '<span class="crumbTrail">'._recurseCrumbTrail($session{page}{parentId},$delimeter).
|
||||
'<a class="crumbTrail" href="'.WebGUI::URL::page().'">'.$session{page}{menuTitle}.'</a></span>';
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
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 = '<span class="verticalMenu">';
|
||||
$temp .= _reversePageTree($session{page}{pageId});
|
||||
$temp .= '</span>';
|
||||
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,newWindow from page where parentId=$_[0] order by sequenceNumber");
|
||||
while (@data = $sth->array) {
|
||||
if (!($data[4]) && WebGUI::Privilege::canViewPage($data[0])) {
|
||||
$output .= '<a class="verticalMenu" ';
|
||||
$output .= ' target="_blank"' if ($data[5]);
|
||||
$output .= 'href="'.WebGUI::URL::gateway($data[3]).'">';
|
||||
if ($session{page}{pageId} == $data[0]) {
|
||||
$output .= '<span class="selectedMenuItem">'.$data[2].'</span>';
|
||||
} else {
|
||||
$output .= $data[2];
|
||||
}
|
||||
$output .= '</a><br>';
|
||||
if ($_[1] == $data[0] && $_[2] ne "") {
|
||||
$output .= '<table cellpadding=0 cellspacing=0 border=0 class="verticalMenu"><tr><td class="verticalMenu"> </td><td class="verticalMenu">'.$_[2].'</td></tr></table>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
if ($parentId > 0) {
|
||||
$output = _reversePageTree($parentId,$_[0],$output);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
package WebGUI::Macro::M_currentMenuVertical;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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::Navigation;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($tree, $temp, @param);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
$temp = '<div class="verticalMenu">';
|
||||
if ($param[0] ne "") {
|
||||
$tree = WebGUI::Navigation::tree($session{page}{pageId},$param[0]);
|
||||
} else {
|
||||
$tree = WebGUI::Navigation::tree($session{page}{pageId},1);
|
||||
}
|
||||
$temp .= WebGUI::Navigation::drawVertical($tree);
|
||||
$temp .= '</div>';
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
package WebGUI::Macro::P_previousMenuVertical;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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::Navigation;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($temp, @param, $tree);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
$temp = '<span class="verticalMenu">';
|
||||
if ($param[0] ne "") {
|
||||
$tree = WebGUI::Navigation::tree($session{page}{parentId},$param[0]);
|
||||
} else {
|
||||
$tree = WebGUI::Navigation::tree($session{page}{parentId},1);
|
||||
}
|
||||
$temp .= WebGUI::Navigation::drawVertical($tree);
|
||||
$temp .= '</span>';
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
package WebGUI::Macro::PreviousDropMenu;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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::Navigation;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _draw {
|
||||
my ($output, $i, $padding, $pageId);
|
||||
my ($tree, $indent, $maxDepth, $currentDepth) = @_;
|
||||
unless ($currentDepth >= $maxDepth) {
|
||||
for ($i=1;$i<=$indent;$i++) {
|
||||
$padding .= " ";
|
||||
}
|
||||
foreach $pageId (keys %{$tree}) {
|
||||
$output .= '<option value="'.$tree->{$pageId}{url}.'">';
|
||||
$output .= $padding."- ".$tree->{$pageId}{title};
|
||||
$output .= '</option>';
|
||||
$output .= _draw($tree->{$pageId}{sub}, ($indent+1), $maxDepth, ($currentDepth+1));
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($temp, @param, $tree);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
$param[1] = 99 unless ($param[1]);
|
||||
if ($param[0] ne "") {
|
||||
$tree = WebGUI::Navigation::tree($session{page}{parentId},$param[0]);
|
||||
} else {
|
||||
$tree = WebGUI::Navigation::tree($session{page}{parentId},1);
|
||||
}
|
||||
$temp = '<script language="JavaScript" type="text/javascript">
|
||||
function go(formObj){
|
||||
if (formObj.chooser.options[formObj.chooser.selectedIndex].value != "none") {
|
||||
location = formObj.chooser.options[formObj.chooser.selectedIndex].value
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
$temp .= '<form><select name="chooser" size=1 onChange="go(this.form)">';
|
||||
$temp .= '<option value=none>Where do you want to go?';
|
||||
$temp .= _draw($tree,0,$param[1]);
|
||||
$temp .= '</select></form>';
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
package WebGUI::Macro::RootTab;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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 strict;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Navigation;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _draw {
|
||||
my ($tree, $root) = @_;
|
||||
#my $output;# = '<table class="rootTab"><tr>';
|
||||
my $output;# = '<div class="rootTabs">';
|
||||
foreach my $key (keys %{$tree}) {
|
||||
$output .= ' <span class="';
|
||||
if ($root == $key) {
|
||||
$output .= "rootTabOn";
|
||||
} else {
|
||||
$output .= "rootTabOff";
|
||||
}
|
||||
$output .= '">';
|
||||
$output .= '<a href="'.$tree->{$key}{url}.'">'.$tree->{$key}{title}.'</a>';
|
||||
$output .= '</span> ';
|
||||
}
|
||||
#$output .= '</div>';
|
||||
#$output .= '</tr></table>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
package WebGUI::Macro::S_specificMenuVertical;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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::Navigation;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($temp, @param, $pageId, $tree);
|
||||
@param = WebGUI::Macro::getParams($_[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>';
|
||||
}
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
package WebGUI::Macro::SpecificDropMenu;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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::Navigation;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _draw {
|
||||
my ($output, $i, $padding, $pageId);
|
||||
my ($tree, $indent, $maxDepth, $currentDepth) = @_;
|
||||
unless ($currentDepth >= $maxDepth) {
|
||||
for ($i=1;$i<=$indent;$i++) {
|
||||
$padding .= " ";
|
||||
}
|
||||
foreach $pageId (keys %{$tree}) {
|
||||
$output .= '<option value="'.$tree->{$pageId}{url}.'">';
|
||||
$output .= $padding."- ".$tree->{$pageId}{title};
|
||||
$output .= '</option>';
|
||||
$output .= _draw($tree->{$pageId}{sub}, ($indent+1), $maxDepth, ($currentDepth+1));
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($temp, @param, $pageId, $tree);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
($pageId) = WebGUI::SQL->quickArray("select pageId from page where urlizedTitle='$param[0]'");
|
||||
if (defined $pageId) {
|
||||
$param[2] = 99 unless ($param[2]);
|
||||
if ($param[1] ne "") {
|
||||
$tree = WebGUI::Navigation::tree($pageId,$param[1]);
|
||||
} else {
|
||||
$tree = WebGUI::Navigation::tree($pageId,1);
|
||||
}
|
||||
$temp = '<script language="JavaScript" type="text/javascript">
|
||||
function go(formObj){
|
||||
if (formObj.chooser.options[formObj.chooser.selectedIndex].value != "none") {
|
||||
location = formObj.chooser.options[formObj.chooser.selectedIndex].value
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
$temp .= '<form><select name="chooser" size=1 onChange="go(this.form)">';
|
||||
$temp .= '<option value=none>Where do you want to go?';
|
||||
$temp .= _draw($tree,0,$param[2]);
|
||||
$temp .= '</select></form>';
|
||||
} else {
|
||||
$temp = "No page specified.";
|
||||
}
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
package WebGUI::Macro::Synopsis;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub traversePageTreeSynopsis {
|
||||
my ($sth, $output, $parent_id, $current_level, $max_level);
|
||||
($parent_id, $current_level, $max_level) = @_;
|
||||
$max_level = 99 unless ($max_level);
|
||||
if ($max_level && ($current_level >= $max_level)) {
|
||||
return;
|
||||
}
|
||||
$sth = WebGUI::SQL->read("select urlizedTitle, menuTitle, pageId, synopsis from page where parentId='$parent_id' order by sequenceNumber");
|
||||
while (my ($urltitle, $menutitle, $pageid, $synopsis) = $sth->array) {
|
||||
if (!WebGUI::Privilege::canViewPage($pageid)) {
|
||||
next;
|
||||
}
|
||||
$urltitle = WebGUI::URL::gateway($urltitle);
|
||||
my $subsynopsis = traversePageTreeSynopsis($pageid,$current_level+1,$max_level);
|
||||
$output .= qq{
|
||||
<div class="synopsis">
|
||||
<div class="synopsis_title">
|
||||
<a href="$urltitle">$menutitle</a>
|
||||
</div>
|
||||
<div class="synopsis_summary">
|
||||
$synopsis
|
||||
</div>
|
||||
<div class="synopsis_sub">
|
||||
$subsynopsis
|
||||
</div>
|
||||
</div>
|
||||
};
|
||||
}
|
||||
$sth->finish;
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
if ($_[0]) {
|
||||
return traversePageTreeSynopsis($session{page}{pageId},0,$_[0]);
|
||||
} else {
|
||||
return $session{page}{synopsis};
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
package WebGUI::Macro::T_topMenuVertical;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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::Navigation;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($temp, @param, $tree);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
$temp = '<span class="verticalMenu">';
|
||||
if ($param[0] ne "") {
|
||||
$tree = WebGUI::Navigation::tree(1,$param[0]);
|
||||
} else {
|
||||
$tree = WebGUI::Navigation::tree(1,1);
|
||||
}
|
||||
$temp .= WebGUI::Navigation::drawVertical($tree);
|
||||
$temp .= '</span>';
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
package WebGUI::Macro::TopDropMenu;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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::Navigation;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($temp, $tree, $pageId);
|
||||
$tree = WebGUI::Navigation::tree(1,1);
|
||||
$temp = '<script language="JavaScript" type="text/javascript">
|
||||
function go(formObj){
|
||||
if (formObj.chooser.options[formObj.chooser.selectedIndex].value != "none") {
|
||||
location = formObj.chooser.options[formObj.chooser.selectedIndex].value
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
$temp .= '<form><select name="chooser" size=1 onChange="go(this.form)">';
|
||||
$temp .= '<option value=none>Where do you want to go?';
|
||||
foreach $pageId (keys %{$tree}) {
|
||||
$temp .= '<option value="'.$tree->{$pageId}{url}.'">'.$tree->{$pageId}{title};
|
||||
}
|
||||
$temp .= '</select></form>';
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
package WebGUI::Macro::m_currentMenuHorizontal;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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::Navigation;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($temp, @param, $tree);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
$tree = WebGUI::Navigation::tree($session{page}{pageId},1);
|
||||
$temp = '<span class="horizontalMenu">';
|
||||
$temp .= WebGUI::Navigation::drawHorizontal($tree,$param[0]);
|
||||
$temp .= '</span>';
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
package WebGUI::Macro::p_previousMenuHorizontal;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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::Navigation;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($temp, $tree, @param);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
$tree = WebGUI::Navigation::tree($session{page}{parentId},1);
|
||||
$temp = '<span class="horizontalMenu">';
|
||||
$temp .= WebGUI::Navigation::drawHorizontal($tree,$param[0]);
|
||||
$temp .= '</span>';
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
package WebGUI::Macro::rootmenuHorizontal;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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::Navigation;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my @param = WebGUI::Macro::getParams($_[0]);
|
||||
my $tree = WebGUI::Navigation::tree(0,1);
|
||||
my $temp = '<span class="horizontalMenu">';
|
||||
$temp .= WebGUI::Navigation::drawHorizontal($tree,$param[0]);
|
||||
$temp .= '</span>';
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
package WebGUI::Macro::s_specificMenuHorizontal;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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::Navigation;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($temp, $tree, $parentId, @param);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
$temp = '<span class="horizontalMenu">';
|
||||
($parentId) = WebGUI::SQL->quickArray("select pageId from page where urlizedTitle='$param[0]'");
|
||||
$tree = WebGUI::Navigation::tree($parentId,1);
|
||||
$temp .= WebGUI::Navigation::drawHorizontal($tree,$param[1]);
|
||||
$temp .= '</span>';
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
package WebGUI::Macro::t_topMenuHorizontal;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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::Navigation;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($temp, $tree, @param);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
my $root = _findRoot($session{page}{pageId});
|
||||
$tree = WebGUI::Navigation::tree($root,1);
|
||||
$temp = '<span class="horizontalMenu">';
|
||||
$temp .= WebGUI::Navigation::drawHorizontal($tree,$param[0]);
|
||||
$temp .= '</span>';
|
||||
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;
|
||||
|
||||
|
|
@ -51,15 +51,6 @@ A package used to generate navigation.
|
|||
template=>'<tmpl_loop page_loop><tmpl_var page.title><br></tmpl_loop>'
|
||||
);
|
||||
$html = $custom->build;
|
||||
|
||||
=head1 OBSOLETE FUNCTIONS
|
||||
|
||||
use WebGUI::Navigation;
|
||||
|
||||
$pageTree = WebGUI::Navigation::tree($pageParentId,$depthToTraverse);
|
||||
|
||||
$html = WebGUI::Navigation::drawHorizontal($tree);
|
||||
$html = WebGUI::Navigation::drawVertical($tree);
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
|
|
@ -234,112 +225,6 @@ sub _toKeyValueHashRef {
|
|||
return \%keyValues;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 drawHorizontal ( tree [ , seperator, class ] )
|
||||
|
||||
Draws a horizontal navigation system. Returns HTML.
|
||||
|
||||
=over
|
||||
|
||||
=item tree
|
||||
|
||||
The hash reference created by the tree method in this package.
|
||||
|
||||
=item seperator
|
||||
|
||||
A string containing HTML to seperate each navigation item. Defaults to "·".
|
||||
|
||||
=item class
|
||||
|
||||
A stylesheet class for each link in the navigation. Defaults to "horizontalMenu".
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub drawHorizontal {
|
||||
my ($output, $i, $pageId, $first);
|
||||
my ($tree, $seperator, $class) = @_;
|
||||
$class = "horizontalMenu" unless ($class);
|
||||
$seperator = $seperator || '·';
|
||||
$first = 1;
|
||||
foreach $pageId (keys %{$tree}) {
|
||||
if ($first) {
|
||||
$first = 0;
|
||||
} else {
|
||||
$output .= ' '.$seperator.' ';
|
||||
}
|
||||
$output .= '<a class="'.$class.'"';
|
||||
$output .= ' target="_blank"' if ($tree->{$pageId}{newWindow});
|
||||
$output .= ' href="'.$tree->{$pageId}{url}.'">';
|
||||
if ($pageId == $session{page}{pageId}) {
|
||||
$output .= '<span class="selectedMenuItem">'.$tree->{$pageId}{title}.'</span>';
|
||||
} else {
|
||||
$output .= $tree->{$pageId}{title};
|
||||
}
|
||||
$output .= '</a>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 drawVertical ( tree [, bullet, class, spacing, indent ] )
|
||||
|
||||
Draws a vertical navigation system. Returns HTML.
|
||||
|
||||
=over
|
||||
|
||||
=item tree
|
||||
|
||||
The hash reference created by the tree method in this package.
|
||||
|
||||
=item bullet
|
||||
|
||||
A string containing HTML to generate a bullet that will be placed in front of each tree item. Defaults to none.
|
||||
|
||||
=item class
|
||||
|
||||
A stylesheet class for each link in the navigation. Defaults to "verticalMenu".
|
||||
|
||||
=item spacing
|
||||
|
||||
An integer with the linespacing for the navigation. Defaults to 1.
|
||||
|
||||
=item indent
|
||||
|
||||
An integer with the about of indenting to start with. Defaults to 0.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub drawVertical {
|
||||
my ($output, $i, $padding, $leading, $pageId);
|
||||
my ($tree, $bullet, $class, $spacing, $indent) = @_;
|
||||
$class = "verticalMenu" unless ($class);
|
||||
$spacing = 1 unless ($spacing);
|
||||
for ($i=1;$i<=$indent;$i++) {
|
||||
$padding .= " ";
|
||||
}
|
||||
for ($i=1;$i<=$spacing;$i++) {
|
||||
$leading .= "<br />";
|
||||
}
|
||||
foreach $pageId (keys %{$tree}) {
|
||||
$output .= $padding.$bullet.'<a class="'.$class.'"';
|
||||
$output .= ' target="_blank"' if ($tree->{$pageId}{newWindow});
|
||||
$output .= ' href="'.$tree->{$pageId}{url}.'">';
|
||||
if ($pageId == $session{page}{pageId}) {
|
||||
$output .= '<span class="selectedMenuItem">'.$tree->{$pageId}{title}.'</span>';
|
||||
} else {
|
||||
$output .= $tree->{$pageId}{title};
|
||||
}
|
||||
$output .= '</a>'.$leading;
|
||||
$output .= drawVertical($tree->{$pageId}{sub}, $bullet, $class, $spacing, ($indent+1));
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -582,68 +467,6 @@ sub view {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 tree ( parentId [, toLevel ] )
|
||||
|
||||
Generates and returns a hash reference containing a page tree with keys of "url", "title", "fullTitle", "synopsis", "newWindow" and "sub" with orignating keys of page ids. The tree looks like this:
|
||||
|
||||
root
|
||||
|-pageId
|
||||
| |-url
|
||||
| |-title
|
||||
| |-fullTitle
|
||||
| |-synopsis
|
||||
| |-newWindow
|
||||
| `-sub (pageId)
|
||||
| |-url
|
||||
| |-title
|
||||
| |-fullTitle
|
||||
| |-synopsis
|
||||
| |-newWindow
|
||||
| `-sub (pageId)
|
||||
| `-etc
|
||||
`-pageId
|
||||
`-etc
|
||||
|
||||
=over
|
||||
|
||||
=item parentId
|
||||
|
||||
The page id of where you'd like to start the tree.
|
||||
|
||||
=item toLevel
|
||||
|
||||
The depth the tree should be traversed. Defaults to "0". If set to "0" the entire tree will be traversed.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub tree {
|
||||
my ($sth, %data, %tree);
|
||||
my ($parentId, $toLevel, $depth) = @_;
|
||||
$toLevel = 99 if ($toLevel > 100 || $toLevel < 1);
|
||||
tie %tree, 'Tie::IxHash';
|
||||
tie %data, 'Tie::CPHash';
|
||||
if ($depth < $toLevel) {
|
||||
$sth = WebGUI::SQL->read("select urlizedTitle, menuTitle, pageId, synopsis, hideFromNavigation,
|
||||
newWindow, title from page
|
||||
where parentId='$parentId' order by sequenceNumber");
|
||||
while (%data = $sth->hash) {
|
||||
if (!($data{hideFromNavigation}) && WebGUI::Privilege::canViewPage($data{pageId})) {
|
||||
$tree{$data{pageId}}{url} = WebGUI::URL::gateway($data{urlizedTitle});
|
||||
$tree{$data{pageId}}{title} = $data{menuTitle};
|
||||
$tree{$data{pageId}}{synopsis} = $data{synopsis};
|
||||
$tree{$data{pageId}}{fullTitle} = $data{title};
|
||||
$tree{$data{pageId}}{newWindow} = $data{newWindow};
|
||||
$tree{$data{pageId}}{sub} = tree($data{pageId},$toLevel,($depth+1));
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
return \%tree;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue