diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index ddeb19bc5..fc65a063e 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -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. diff --git a/docs/gotcha.txt b/docs/gotcha.txt index e4cb5a15b..1ebf53e5c 100644 --- a/docs/gotcha.txt +++ b/docs/gotcha.txt @@ -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 diff --git a/docs/migration.txt b/docs/migration.txt index 46de2dd84..b9864a0d4 100644 --- a/docs/migration.txt +++ b/docs/migration.txt @@ -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. diff --git a/docs/upgrades/upgrade_5.9.9-6.0.0.pl b/docs/upgrades/upgrade_5.9.9-6.0.0.pl index ac8f1887a..440856e92 100644 --- a/docs/upgrades/upgrade_5.9.9-6.0.0.pl +++ b/docs/upgrades/upgrade_5.9.9-6.0.0.pl @@ -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"); diff --git a/etc/WebGUI.conf.original b/etc/WebGUI.conf.original index 7658dabf4..344c2e5c6 100644 --- a/etc/WebGUI.conf.original +++ b/etc/WebGUI.conf.original @@ -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 diff --git a/lib/WebGUI/Macro/C_crumbTrail.pm b/lib/WebGUI/Macro/C_crumbTrail.pm deleted file mode 100644 index 19f754220..000000000 --- a/lib/WebGUI/Macro/C_crumbTrail.pm +++ /dev/null @@ -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 .= ''.$data{menuTitle}.''.$_[1]; - } - return $output; -} - -#------------------------------------------------------------------- -sub process { - my (@param, $temp, $delimeter); - @param = WebGUI::Macro::getParams($_[0]); - if ($param[0] eq "") { - $delimeter = " > "; - } else { - $delimeter = " ".$param[0]." "; - } - $temp = ''._recurseCrumbTrail($session{page}{parentId},$delimeter). - ''.$session{page}{menuTitle}.''; - return $temp; -} - - -1; - diff --git a/lib/WebGUI/Macro/FlexMenu.pm b/lib/WebGUI/Macro/FlexMenu.pm deleted file mode 100644 index 995550fa0..000000000 --- a/lib/WebGUI/Macro/FlexMenu.pm +++ /dev/null @@ -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 = ''; - $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,newWindow 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; - diff --git a/lib/WebGUI/Macro/M_currentMenuVertical.pm b/lib/WebGUI/Macro/M_currentMenuVertical.pm deleted file mode 100644 index 550557cca..000000000 --- a/lib/WebGUI/Macro/M_currentMenuVertical.pm +++ /dev/null @@ -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 = '
'; - 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 .= '
'; - return $temp; -} - - -1; - diff --git a/lib/WebGUI/Macro/P_previousMenuVertical.pm b/lib/WebGUI/Macro/P_previousMenuVertical.pm deleted file mode 100644 index a3606f0be..000000000 --- a/lib/WebGUI/Macro/P_previousMenuVertical.pm +++ /dev/null @@ -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 = ''; - 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 .= ''; - return $temp; -} - - -1; - diff --git a/lib/WebGUI/Macro/PreviousDropMenu.pm b/lib/WebGUI/Macro/PreviousDropMenu.pm deleted file mode 100644 index 943058ef9..000000000 --- a/lib/WebGUI/Macro/PreviousDropMenu.pm +++ /dev/null @@ -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 .= ''; - $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 = ''; - $temp .= '
'; - return $temp; -} - - -1; - - diff --git a/lib/WebGUI/Macro/RootTab.pm b/lib/WebGUI/Macro/RootTab.pm deleted file mode 100644 index 0e3b638c5..000000000 --- a/lib/WebGUI/Macro/RootTab.pm +++ /dev/null @@ -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;# = ''; - my $output;# = '
'; - foreach my $key (keys %{$tree}) { - $output .= ' {$key}{url}.'">'.$tree->{$key}{title}.''; - $output .= ' '; - } - #$output .= '
'; - #$output .= '
'; - 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; - diff --git a/lib/WebGUI/Macro/S_specificMenuVertical.pm b/lib/WebGUI/Macro/S_specificMenuVertical.pm deleted file mode 100644 index cb33e148c..000000000 --- a/lib/WebGUI/Macro/S_specificMenuVertical.pm +++ /dev/null @@ -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 = ''; - if ($param[1] ne "") { - $tree = WebGUI::Navigation::tree($pageId,$param[1]); - } else { - $tree = WebGUI::Navigation::tree($pageId,1); - } - $temp .= WebGUI::Navigation::drawVertical($tree); - $temp .= ''; - } - return $temp; -} - - -1; - diff --git a/lib/WebGUI/Macro/SpecificDropMenu.pm b/lib/WebGUI/Macro/SpecificDropMenu.pm deleted file mode 100644 index da5f5cfe8..000000000 --- a/lib/WebGUI/Macro/SpecificDropMenu.pm +++ /dev/null @@ -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 .= ''; - $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 = ''; - $temp .= '
'; - } else { - $temp = "No page specified."; - } - return $temp; -} - - -1; - - diff --git a/lib/WebGUI/Macro/Synopsis.pm b/lib/WebGUI/Macro/Synopsis.pm deleted file mode 100644 index a7d2df2a1..000000000 --- a/lib/WebGUI/Macro/Synopsis.pm +++ /dev/null @@ -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{ -
-
- $menutitle -
-
- $synopsis -
-
- $subsynopsis -
-
- }; - } - $sth->finish; - return $output; -} - - -#------------------------------------------------------------------- -sub process { - if ($_[0]) { - return traversePageTreeSynopsis($session{page}{pageId},0,$_[0]); - } else { - return $session{page}{synopsis}; - } -} - -1; - - diff --git a/lib/WebGUI/Macro/T_topMenuVertical.pm b/lib/WebGUI/Macro/T_topMenuVertical.pm deleted file mode 100644 index 5020c8721..000000000 --- a/lib/WebGUI/Macro/T_topMenuVertical.pm +++ /dev/null @@ -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 = ''; - if ($param[0] ne "") { - $tree = WebGUI::Navigation::tree(1,$param[0]); - } else { - $tree = WebGUI::Navigation::tree(1,1); - } - $temp .= WebGUI::Navigation::drawVertical($tree); - $temp .= ''; - return $temp; -} - - -1; - diff --git a/lib/WebGUI/Macro/TopDropMenu.pm b/lib/WebGUI/Macro/TopDropMenu.pm deleted file mode 100644 index 44c45b104..000000000 --- a/lib/WebGUI/Macro/TopDropMenu.pm +++ /dev/null @@ -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 = ''; - $temp .= '
'; - return $temp; -} - - -1; - - diff --git a/lib/WebGUI/Macro/m_currentMenuHorizontal.pm b/lib/WebGUI/Macro/m_currentMenuHorizontal.pm deleted file mode 100644 index 15089c3fa..000000000 --- a/lib/WebGUI/Macro/m_currentMenuHorizontal.pm +++ /dev/null @@ -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 = ''; - $temp .= WebGUI::Navigation::drawHorizontal($tree,$param[0]); - $temp .= ''; - return $temp; -} - - -1; - diff --git a/lib/WebGUI/Macro/p_previousMenuHorizontal.pm b/lib/WebGUI/Macro/p_previousMenuHorizontal.pm deleted file mode 100644 index 1a67e4e21..000000000 --- a/lib/WebGUI/Macro/p_previousMenuHorizontal.pm +++ /dev/null @@ -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 = ''; - $temp .= WebGUI::Navigation::drawHorizontal($tree,$param[0]); - $temp .= ''; - return $temp; -} - - -1; - diff --git a/lib/WebGUI/Macro/rootmenuHorizontal.pm b/lib/WebGUI/Macro/rootmenuHorizontal.pm deleted file mode 100644 index 2cbc67d3d..000000000 --- a/lib/WebGUI/Macro/rootmenuHorizontal.pm +++ /dev/null @@ -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 = ''; - $temp .= WebGUI::Navigation::drawHorizontal($tree,$param[0]); - $temp .= ''; - return $temp; -} - - -1; - diff --git a/lib/WebGUI/Macro/s_specificMenuHorizontal.pm b/lib/WebGUI/Macro/s_specificMenuHorizontal.pm deleted file mode 100644 index b16ab9826..000000000 --- a/lib/WebGUI/Macro/s_specificMenuHorizontal.pm +++ /dev/null @@ -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 = ''; - ($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 .= ''; - return $temp; -} - - -1; - diff --git a/lib/WebGUI/Macro/t_topMenuHorizontal.pm b/lib/WebGUI/Macro/t_topMenuHorizontal.pm deleted file mode 100644 index cf640487d..000000000 --- a/lib/WebGUI/Macro/t_topMenuHorizontal.pm +++ /dev/null @@ -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 = ''; - $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; - diff --git a/lib/WebGUI/Navigation.pm b/lib/WebGUI/Navigation.pm index 3e940a88b..e493e64f1 100644 --- a/lib/WebGUI/Navigation.pm +++ b/lib/WebGUI/Navigation.pm @@ -51,15 +51,6 @@ A package used to generate navigation. template=>'
' ); $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 .= '{$pageId}{newWindow}); - $output .= ' href="'.$tree->{$pageId}{url}.'">'; - if ($pageId == $session{page}{pageId}) { - $output .= ''.$tree->{$pageId}{title}.''; - } else { - $output .= $tree->{$pageId}{title}; - } - $output .= ''; - } - 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 .= "
"; - } - foreach $pageId (keys %{$tree}) { - $output .= $padding.$bullet.'{$pageId}{newWindow}); - $output .= ' href="'.$tree->{$pageId}{url}.'">'; - if ($pageId == $session{page}{pageId}) { - $output .= ''.$tree->{$pageId}{title}.''; - } else { - $output .= $tree->{$pageId}{title}; - } - $output .= ''.$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; -}