diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt
index 024a6fa24..6e19a65b7 100644
--- a/docs/changelog/6.x.x.txt
+++ b/docs/changelog/6.x.x.txt
@@ -4,6 +4,7 @@
- Converted site maps to navigation assets.
- Converted file managers to layout assets with file and image assets
attached.
+ - Added AssetProxy macro.
- Converted page templates to use CSS-based layouts instead of tables.
- Added a "Position" property to the DataForm Edit Field interface. This makes it easier to move a field to a certain position. (Len Kranendonk).
- Added the variables "record.edit.icon", "record.delete.url" and "record.delete.icon" to the DataForm DataList template. (Len Kranendonk).
@@ -25,7 +26,7 @@
- Sped up Navigation.pm
- bugfix [1041937] List Roots broken
- Navigation template variable rename, added template variables for
- basepage.hasDaughter, page.inRoot.
+ currentPage.hasDaughter, page.inBranchRoot.
- Bugfix [ 1055396 ] Template switching issue (Len Kranendonk)
- WebGUI Operations are now dynamically loaded (Len Kranendonk)
- Added button to Form.pm / HTMLForm.pm (Len Kranendonk)
diff --git a/docs/upgrades/upgrade_6.2.9-6.3.0.pl b/docs/upgrades/upgrade_6.2.9-6.3.0.pl
index aabe3b09a..a66edf21a 100644
--- a/docs/upgrades/upgrade_6.2.9-6.3.0.pl
+++ b/docs/upgrades/upgrade_6.2.9-6.3.0.pl
@@ -157,7 +157,7 @@ my $navRootId = WebGUI::SQL->setRow("asset","assetId",{
parentId=>"PBasset000000000000001",
lineage=>$navRootLineage,
lastUpdated=>time(),
- className=>"WebGUI::Admin::Wobject::Navigation",
+ className=>"WebGUI::Asset::Wobject::Navigation",
state=>"published"
});
WebGUI::SQL->setRow("wobject","assetId",{
@@ -171,7 +171,8 @@ WebGUI::SQL->setRow("Navigation","assetId",{
startType=>"relativeToCurrentUrl",
startPoint=>"0",
endPoint=>"55",
- assetsToInclude=>"descendants"
+ assetsToInclude=>"descendants",
+ showHiddenPages=>1
},undef,$navRootId);
my $sth = WebGUI::SQL->read("select * from tempoldnav");
my $navRankCounter = 1;
@@ -183,7 +184,8 @@ while (my $data = $sth->hashRef) {
$newAsset{isHidden} = 1;
$newAsset{title} = $newAsset{menuTitle} = $data->{identifier};
$newAsset{ownerUserId} = "3";
- $newAsset{groupIdView} = $newAsset{groupIdEdit} = "4";
+ $newAsset{groupIdView} = "7";
+ $newAsset{groupIdEdit} = "4";
$newAsset{className} = 'WebGUI::Asset::Wobject::Navigation';
$newAsset{state} = 'published';
$newAsset{lastUpdated} = time();
@@ -192,6 +194,7 @@ while (my $data = $sth->hashRef) {
$newWobject{templateId} = $data->{templateId};
$newWobject{styleTemplateId}="1";
$newWobject{printableStyleTemplateId}="3";
+ $newWobject{displayTitle} = "0";
$newNav{showSystemPages} = $data->{showSystemPages};
$newNav{showHiddenPages} = $data->{showHiddenPages};
$newNav{showUnprivilegedPages} = $data->{showUnprivilegedPages};
@@ -248,9 +251,9 @@ while (my $data = $sth->hashRef) {
$newNav{startPoint} = $data->{stopAtLevel}+1;
$newNav{assetsToInclude} = "self\ndescendants";
} elsif ($data->{method} eq "pedigree") {
- $newNav{endPoint} += $newNav{startPoint} unless ($newNav{startType} eq "specificUrl");
+ $newNav{endPoint} = 55;
$newNav{startType} = "relativeToRoot";
- $newNav{startPoint} = $data->{stopAtLevel}+1;
+ $newNav{startPoint} = 1;
$newNav{assetsToInclude} = "pedigree";
}
WebGUI::SQL->setRow("asset","assetId",\%newAsset,undef,$newNav{assetId});
@@ -299,7 +302,9 @@ $sth->finish;
print "\tDeleting files which are no longer used.\n" unless ($quiet);
#unlink("../../lib/WebGUI/Page.pm");
#unlink("../../lib/WebGUI/Operation/Page.pm");
+#unlink("../../lib/WebGUI/Operation/Root.pm");
#unlink("../../lib/WebGUI/Navigation.pm");
+#unlink("../../lib/WebGUI/Macro/Navigation.pm");
#unlink("../../lib/WebGUI/Operation/Navigation.pm");
#unlink("../../lib/WebGUI/Attachment.pm");
#unlink("../../lib/WebGUI/Node.pm");
@@ -309,6 +314,38 @@ print "\tDeleting files which are no longer used.\n" unless ($quiet);
#unlink("../../lib/WebGUI/Wobject/USS.pm");
#unlink("../../lib/WebGUI/Wobject/FileManager.pm");
+#--------------------------------------------
+print "\tUpdating config file.\n" unless ($quiet);
+my $pathToConfig = '../../etc/'.$configFile;
+my $conf = Parse::PlainConfig->new('DELIM' => '=', 'FILE' => $pathToConfig);
+my $macros = $conf->get("macros");
+delete $macros->{"\\"};
+$macros->{"\\\\"} = "Backslash_pageUrl";
+$macros->{"AssetProxy"} = "AssetProxy";
+$macros->{"Navigation"} = "AssetProxy";
+my %newMacros;
+foreach my $macro (keys %{$macros}) {
+ unless (
+ $macros->{$macro} eq "m_currentMenuHorizontal"
+ || $macros->{$macro} eq "M_currentMenuVertical"
+ ) {
+ $newMacros{$macro} = $macros->{$macro};
+ }
+}
+$conf->set("macros"=>\%newMacros);
+$conf->set("assets"=>[
+ 'WebGUI::Asset::Wobject::Navigation',
+ 'WebGUI::Asset::Wobject::Layout',
+ 'WebGUI::Asset::Wobject::Article',
+ 'WebGUI::Asset::Wobject::DataForm',
+ 'WebGUI::Asset::Wobject::USS',
+ 'WebGUI::Asset::Wobject::SyndicatedContent',
+ 'WebGUI::Asset::Redirect',
+ 'WebGUI::Asset::FilePile',
+ 'WebGUI::Asset::File',
+ 'WebGUI::Asset::File::Image'
+ ]);
+$conf->write;
WebGUI::Session::close();
diff --git a/lib/WebGUI/AdminConsole.pm b/lib/WebGUI/AdminConsole.pm
index 34ab96a28..7cc39236b 100644
--- a/lib/WebGUI/AdminConsole.pm
+++ b/lib/WebGUI/AdminConsole.pm
@@ -65,15 +65,6 @@ sub getAdminFunction {
op=>"listUsers",
group=>"11"
},
- "navigation"=>{
- title=>{
- id=>"navigation",
- namespace=>"Navigation"
- },
- icon=>"navigation.gif",
- op=>"listNavigation",
- group=>"4"
- },
"clipboard"=>{
title=>{
id=>"948",
diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm
index 56b80f45d..ef568ea6b 100644
--- a/lib/WebGUI/Asset.pm
+++ b/lib/WebGUI/Asset.pm
@@ -227,6 +227,12 @@ sub getAssetAdderLinks {
if ($@) {
WebGUI::ErrorHandler::warn("Couldn't compile ".$class." because ".$@);
} else {
+ my $uiLevel = eval{$class->getUiLevel()};
+ if ($@) {
+ WebGUI::ErrorHandler::warn("Couldn't get UI level of ".$class." because ".$@);
+ } else {
+ next if ($uiLevel > $session{user}{uiLevel});
+ }
my $label = eval{$class->getName()};
if ($@) {
WebGUI::ErrorHandler::warn("Couldn't get the name of ".$class." because ".$@);
@@ -415,19 +421,10 @@ sub getLineage {
my $relatives = shift;
my $rules = shift;
my $lineage = $self->get("lineage");
- # deal with exclusions
- my $whereExclusion = " and state='published'";
- if (exists $rules->{excludeClasses}) {
- my @set;
- foreach my $className (@{$rules->{excludeClasses}}) {
- push(@set,"className <> ".quote($className));
- }
- $whereExclusion .= 'and ('.join(" and ",@set).')';
- }
+ my @whereModifiers;
# let's get those siblings
- my $whereSiblings;
if (isIn("siblings",@{$relatives})) {
- $whereSiblings = "(parentId=".quote($self->get("parentId"))." and assetId<>".quote($self->getId).")";
+ push(@whereModifiers, " (parentId=".quote($self->get("parentId"))." and assetId<>".quote($self->getId).")");
}
# ancestors too
my @specificFamilyMembers = ();
@@ -441,30 +438,44 @@ sub getLineage {
if (isIn("self",@{$relatives})) {
push(@specificFamilyMembers,$self->get("lineage"));
}
- my $whereExact;
if (scalar(@specificFamilyMembers) > 0) {
- if ($whereSiblings ne "") {
- $whereExact = " or ";
- }
- $whereExact .= "lineage in (";
- $whereExact .= quoteAndJoin(\@specificFamilyMembers);
- $whereExact .= ")";
+ push(@whereModifiers,"(lineage in (".quoteAndJoin(\@specificFamilyMembers)."))");
}
# we need to include descendants
- my $whereDescendants;
if (isIn("descendants",@{$relatives})) {
- if ($whereSiblings ne "" || $whereExact ne "") {
- $whereDescendants = " or ";
- }
- $whereDescendants .= "lineage like ".quote($lineage.'%')." and lineage<>".quote($lineage);
+ my $mod = "(lineage like ".quote($lineage.'%')." and lineage<>".quote($lineage);
if (exists $rules->{endingLineageLength}) {
- $whereDescendants .= " and length(lineage) <= ".($rules->{endingLineageLength}*6);
+ $mod .= " and length(lineage) <= ".($rules->{endingLineageLength}*6);
}
+ $mod .= ")";
+ push(@whereModifiers,$mod);
}
+ # now lets add in all of the siblings in every level between ourself and the asset we wish to pedigree
+ if (isIn("pedigree",@{$relatives}) && exists $rules->{assetToPedigree}) {
+ my @mods;
+ my $lineage = $rules->{assetToPedigree}->get("lineage");
+ my $length = $rules->{assetToPedigree}->getLineageLength;
+ for (my $i = $length; $i > 0; $i--) {
+ my $line = substr($lineage,0,$i*6);
+ push(@mods,"( lineage like ".quote($line.'%')." and length(lineage)=".(($i+1)*6).")");
+ last if ($self->getLineageLength == $i);
+ }
+ push(@whereModifiers, "(".join(" or ",@mods).")");
+ }
+ # formulate a where clause
+ my $where = "state='published'";
+ if (exists $rules->{excludeClasses}) { # deal with exclusions
+ my @set;
+ foreach my $className (@{$rules->{excludeClasses}}) {
+ push(@set,"className <> ".quote($className));
+ }
+ $where .= 'and ('.join(" and ",@set).')';
+ }
+ $where .= " and ".join(" or ",@whereModifiers) if (scalar(@whereModifiers));
# based upon all available criteria, let's get some assets
my $columns = "assetId, className, parentId";
$columns = "*" if ($rules->{returnQuickReadObjects});
- my $sql = "select $columns from asset where $whereSiblings $whereExact $whereDescendants $whereExclusion order by lineage";
+ my $sql = "select $columns from asset where $where order by lineage";
my @lineage;
my %relativeCache;
my $sth = WebGUI::SQL->read($sql);
diff --git a/lib/WebGUI/Asset/File/Image.pm b/lib/WebGUI/Asset/File/Image.pm
index 52192c040..d30e48b67 100644
--- a/lib/WebGUI/Asset/File/Image.pm
+++ b/lib/WebGUI/Asset/File/Image.pm
@@ -17,6 +17,7 @@ package WebGUI::Asset::File::Image;
use strict;
use WebGUI::Asset::File;
use WebGUI::HTTP;
+use WebGUI::Icon;
use WebGUI::Session;
use WebGUI::Storage;
use WebGUI::Utility;
diff --git a/lib/WebGUI/Asset/Wobject/Navigation.pm b/lib/WebGUI/Asset/Wobject/Navigation.pm
index 39fe4a56c..0ee382d95 100644
--- a/lib/WebGUI/Asset/Wobject/Navigation.pm
+++ b/lib/WebGUI/Asset/Wobject/Navigation.pm
@@ -198,6 +198,13 @@ sub getEditForm {
return $tabform;
}
+sub getIcon {
+ my $self = shift;
+ my $small = shift;
+ return $session{config}{extrasURL}.'/assets/small/navigation.gif' if ($small);
+ return $session{config}{extrasURL}.'/assets/navigation.gif';
+}
+
sub getName {
return WebGUI::International::get("navigation","Navigation");
}
@@ -208,10 +215,9 @@ sub view {
# we've got to determine what our start point is based upon user conditions
my ($start,$current);
if (!exists $session{asset}) {
- $start = $self;
- $current = $self;
+ $start = $current = $self;
} elsif ($self->get("startType") eq "specificUrl") {
- $start = WebGUI::Asset->getByUrl($self->get("startPoint"));
+ $start = WebGUI::Asset->newByUrl($self->get("startPoint"));
} elsif ($self->get("startType") eq "relativeToRoot") {
unless (($self->get("startPoint")+1) >= $self->getLineageLength) {
$start = WebGUI::Asset->newByLineage(substr($session{asset}->get("lineage"),0, ($self->get("startPoint") + 1) * 6));
@@ -235,7 +241,8 @@ sub view {
my %rules;
$rules{returnQuickReadObjects} = 1;
$rules{endingLineageLength} = $start->getLineageLength+$self->get("endPoint");
- my @assets = $start->getLineage(\@includedRelationships,\%rules);
+ $rules{assetToPedigree} = $current if (isIn("pedigree",@includedRelationships));
+ my $assets = $start->getLineage(\@includedRelationships,\%rules);
my $var = {'page_loop' => []};
my @interestingProperties = ('assetId', 'parentId', 'title', 'ownerUserId', 'synopsis', 'newWindow', 'menuTitle');
foreach my $property (@interestingProperties) {
@@ -247,7 +254,7 @@ sub view {
my $currentLineage = $current->get("lineage");
my @linesToSkip;
my $absoluteDepthOfLastPage;
- foreach my $asset (@assets) {
+ foreach my $asset (@{$assets}) {
# skip pages we shouldn't see
my $skip = 0;
my $pageLineage = $asset->get("lineage");
@@ -311,22 +318,22 @@ sub view {
push(@{$pageData->{"page.depthDiff_loop"}},{}) for(1..$depthDiff);
}
$absoluteDepthOfLastPage = $pageData->{"page.absDepth"};
+ $pageData->{"page.hasChild"} = $asset->hasChildren;
my $parent = $self->getParent;
if (defined $parent) {
foreach my $property (@interestingProperties) {
$pageData->{"page.parent.".$property} = $parent->get($property);
}
$pageData->{"page.parent.url"} = $parent->getUrl;
- }
- $pageData->{"page.hasChild"} = $asset->hasChildren;
- # these next two variables can be very inefficient, consider getting rid of them
- my $parentsFirstChild = $parent->getFirstChild;
- if (defined $parentsFirstChild) {
- $pageData->{"page.isRankedFirst"} = ($asset->getId == $parentsFirstChild->getId);
- }
- my $parentsLastChild = $parent->getLastChild;
- if (defined $parentsLastChild) {
- $pageData->{"page.isRankedLast"} = ($asset->getId == $parentsLastChild->getId);
+ # these next two variables can be very inefficient, consider getting rid of them
+ my $parentsFirstChild = $parent->getFirstChild;
+ if (defined $parentsFirstChild) {
+ $pageData->{"page.isRankedFirst"} = ($asset->getId == $parentsFirstChild->getId);
+ }
+ my $parentsLastChild = $parent->getLastChild;
+ if (defined $parentsLastChild) {
+ $pageData->{"page.isRankedLast"} = ($asset->getId == $parentsLastChild->getId);
+ }
}
push(@{$var->{page_loop}}, $pageData);
}
diff --git a/lib/WebGUI/Macro/Navigation.pm b/lib/WebGUI/Macro/Navigation.pm
deleted file mode 100644
index 722ac1222..000000000
--- a/lib/WebGUI/Macro/Navigation.pm
+++ /dev/null
@@ -1,35 +0,0 @@
-package WebGUI::Macro::Navigation;
-
-#-------------------------------------------------------------------
-# WebGUI is Copyright 2001-2004 Plain Black Corporation.
-#-------------------------------------------------------------------
-# 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::Session;
-#use WebGUI::Navigation;
-
-#-------------------------------------------------------------------
-sub process {
- return "Nav disabled.";
- my @param = WebGUI::Macro::getParams($_[0]);
-
- my $identifier = $param[0];
- if ($identifier eq '') {
- return WebGUI::Macro::negate(WebGUI::International::get(35,'Navigation'));
- } else {
- my $navigation = WebGUI::Navigation->new(identifier=>$identifier);
- return $navigation->view;
- }
-}
-
-
-1;
-
-
diff --git a/lib/WebGUI/Navigation.pm b/lib/WebGUI/Navigation.pm
deleted file mode 100644
index 490577aed..000000000
--- a/lib/WebGUI/Navigation.pm
+++ /dev/null
@@ -1,523 +0,0 @@
-package WebGUI::Navigation;
-
-=head1 LEGAL
-
- -------------------------------------------------------------------
- WebGUI is Copyright 2001-2004 Plain Black Corporation.
- -------------------------------------------------------------------
- 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
- -------------------------------------------------------------------
-
-=cut
-
-
-use strict;
-use warnings;
-use WebGUI::Asset;
-use WebGUI::Icon;
-use WebGUI::International;
-use WebGUI::Session;
-use WebGUI::SQL;
-use WebGUI::Template;
-use WebGUI::URL;
-use WebGUI::Utility;
-
-=head1 NAME
-
-Package WebGUI::Navigation
-
-=head1 DESCRIPTION
-
-A package used to generate navigation.
-
-=head1 SYNOPSIS
-
- use WebGUI::Navigation;
-
- $nav = WebGUI::Navigation->new(identifier=>'FlexMenu');
- $html = $nav->view;
-
- $custom = WebGUI::Navigation->new(
- startAt=>'root',
- 'reverse'=>1,
- method=>'self_and_sisters',
- template=>'
'
- );
- $html = $custom->build;
-
-=head1 METHODS
-
-These methods are available from this package:
-
-=cut
-
-#-------------------------------------------------------------------
-sub _getEditButton {
- my $self = shift;
- return editIcon("op=editNavigation&navigationId=".$self->{_navigationId}."&identifier=".$self->{_identifier})
- .manageIcon("op=listNavigation");
-}
-
-#-------------------------------------------------------------------
-sub _getStartPageObject {
- my $self = shift;
- my $levels = $self->_levels();
- my $p;
- if (isIn($self->{_startAt}, keys %{$self->getLevelNames()})) { # known startAt level
- $p = &{$levels->{$self->{_startAt}}{handler}}; # initiate object.
- } else {
- if($self->{_startAt} !~ /^\d+$/) {
- ($self->{_startAt}) = WebGUI::SQL->quickArray("select pageId from page where urlizedTitle="
- .quote($self->{_startAt}));
- }
- if($self->{_startAt}) {
- $p = WebGUI::Page->getPage($self->{_startAt});
- }
- }
- return $p;
-}
-
-#-------------------------------------------------------------------
-sub _levels {
- tie my (%levels), 'Tie::IxHash'; # Maintain ordering
- #
- # Please note that the WebGUI root (for example /home) and the Tree::DAG_node
- # root are not the same. All WebGUI roots share a fictive parent, the nameless root.
- # If you call $node->root, you will get that nameless root (with has pageId=0).
- #
- # The WebGUI root for a page is the second last element in the $node->ancestors list.
- #
- %levels = ( 'root' => {
- name => WebGUI::International::get(1,'Navigation'),
- handler => sub {
- return WebGUI::Page->getAnonymousRoot;
- },
- },
- 'WebGUIroot' => {
- name => WebGUI::International::get(2,'Navigation'),
- handler => sub {
- return WebGUI::Page->getWebGUIRoot;
- },
- },
- 'top' => {
- name => WebGUI::International::get(3,'Navigation'),
- handler => sub {
- return WebGUI::Page->getTop;
- },
- },
- 'grandmother' => {
- name => WebGUI::International::get(4,'Navigation'),
- handler => sub {
- return WebGUI::Page->getGrandmother;
- },
- },
- 'mother' => {
- name => WebGUI::International::get(5,'Navigation'),
- handler => sub {
- return WebGUI::Page->getMother;
- },
- },
- 'current' => {
- name => WebGUI::International::get(6,'Navigation'),
- handler => sub {
- return WebGUI::Page->getPage;
- },
- },
- 'daughter' => {
- name => WebGUI::International::get(7,'Navigation'),
- handler => sub {
- return WebGUI::Page->getFirstDaughter;
- },
- },
- );
- return \%levels;
-}
-
-#-------------------------------------------------------------------
-sub _methods {
- tie my (%methods), 'Tie::IxHash'; # Maintain ordering
- %methods = ( 'daughters' => {
- name => WebGUI::International::get(8,'Navigation'),
- method => '$p->daughters',
- },
- 'sisters' => {
- name => WebGUI::International::get(9,'Navigation'),
- method => '$p->sisters',
- },
- 'self_and_sisters' => {
- name => WebGUI::International::get(10,'Navigation'),
- method => '$p->self_and_sisters',
- },
- 'descendants' => {
- name => WebGUI::International::get(11,'Navigation'),
- method => '$p->descendants',
- },
- 'self_and_descendants' => {
- name => WebGUI::International::get(12,'Navigation'),
- method => '$p->self_and_descendants',
- },
- 'leaves_under' => {
- name => WebGUI::International::get(13,'Navigation'),
- method => '$p->leaves_under',
- },
- 'generation' => {
- name => WebGUI::International::get(14,'Navigation'),
- method => '$p->generation',
- },
- 'ancestors' => {
- name => WebGUI::International::get(15,'Navigation'),
- method => '$p->ancestors',
- },
- 'self_and_ancestors' => {
- name => WebGUI::International::get(16,'Navigation'),
- method => '$p->self_and_ancestors',
- },
- 'pedigree' => {
- name => WebGUI::International::get(17,'Navigation'),
- method => '$p->pedigree',
- },
- );
- return \%methods;
-}
-
-#-------------------------------------------------------------------
-sub _storeConfigInClass {
- my $self = shift;
- my $config = shift;
- foreach my $key (keys %{$config}) {
- $self->{'_'.$key} = $config->{$key};
- }
-}
-
-#-------------------------------------------------------------------
-sub _toKeyValueHashRef {
- my $hashRef = shift;
- tie my (%keyValues) , 'Tie::IxHash';
- foreach my $key (keys %$hashRef) {
- $keyValues{$key} = $hashRef->{$key}{'name'};
- }
- return \%keyValues;
-}
-
-
-#-------------------------------------------------------------------
-
-=head2 build ( )
-
-This method builds a navigation item based on the parameters stored
-in the class and returns HTML.
-
-=cut
-
-sub build {
- my $self = shift;
- my $config = $self->getConfig;
- my $base = WebGUI::Asset->newByDynamicClass($config->{basePage});
- my (@relatives, %rules);
- foreach my $relative ("ancestors","self","siblings","descendants") {
- push(@relatives,$relative) if ($config->{relative});
- }
- $rules{returnQuickReadObjects} = 1;
- $base->getLineage(\@relatives,\%rules);
-
- my @interestingPageProperties = ('pageId', 'parentId', 'title', 'ownerId', 'urlizedTitle',
- 'synopsis', 'newWindow', 'menuTitle', 'encryptLogin');
- my $var = {'page_loop' => []};
- my $p = $self->_getStartPageObject();
- my $method = $self->_methods()->{$self->{_method}}{method};
-
- my $cache = WebGUI::Cache->new($self->{_identifier}.'-'.$session{page}{pageId}, "Navigation-".$session{config}{configFile});
- my $cacheContent = $cache->get unless $session{var}{adminOn};
- my (@page_loop, $lastPage, %unfolded);
- tie %unfolded, "Tie::IxHash";
-
- # Store current page properties in template var
- my $currentPage = WebGUI::Page->getPage();
- my $currentRoot = $currentPage->getWebGUIRoot();
- foreach my $property (@interestingPageProperties) {
- $var->{'basepage.'.$property} = $currentPage->get($property);
- }
- unless (defined $cacheContent &&
- ! $session{url}{siteURL}) { # Never use cache if an alternate site url is specified.
- # The loop was not cached
- my @pages = eval $method;
- if ($@) {
- WebGUI::ErrorHandler::warn("Error in WebGUI::Navigation::build while trying to execute $method".$@);
- }
- if (@pages) {
- my $startPageDepth = $p->get("depth")+1;
- my $maxDepth = $startPageDepth + $self->{_depth};
- my $minDepth = $startPageDepth - $self->{_depth};
-
- foreach my $page (@pages) {
- my $pageData = {};
- $pageData->{"page.absDepth"} = $page->{'depth'} + 1;
- $pageData->{"page.isSystem"} = $page->{isSystem};
-
- # Check if in depth range
- next if ($pageData->{"page.absDepth"} > $maxDepth || $pageData->{"page.absDepth"} < $minDepth);
-
- # Check stopAtLevel
- next if ($pageData->{"page.absDepth"} < $self->{_stopAtLevel});
-
- # Check showSystemPages
- next if (! $self->{_showSystemPages} && $pageData->{"page.isSystem"});
-
- # Deal with hidden pages, don't ever hide pages if admin mode is on
- next if(($page->{'hideFromNavigation'} && ! $self->{_showHiddenPages}) && (! $session{var}{adminOn}));
-
- # Initial page info
- $pageData->{"page.url"} = WebGUI::URL::gateway($page->{'urlizedTitle'});
- if ($page->{'encryptPage'}) {
- $pageData->{"page.url"} =~ s/http:/https:/;
- }
- $pageData->{"page.relDepth"} = $pageData->{"page.absDepth"} - $startPageDepth;
- $pageData->{"page.isBasepage"} = ($page->{'pageId'} eq $session{page}{pageId});
- $pageData->{"page.isHidden"} = $page->{'hideFromNavigation'};
-
- # indent
- my $indent = 0;
- if ($self->{_method} eq 'pedigree' # reverse traversing
- || $self->{_method} eq 'ancestors' # needs another way to calculate
- || $self->{_method} eq 'self_and_ancestors') { # the indent
- if ($self->{_stopAtLevel} <= $startPageDepth && $self->{_stopAtLevel} > 0) {
- $indent = $pageData->{"page.absDepth"} - ($self->{_stopAtLevel} - 1) - 1;
- } elsif ($self->{_stopAtLevel} > $startPageDepth && $self->{_stopAtLevel} > 0) {
- $indent = 0;
- } else {
- $indent = $pageData->{"page.absDepth"} - 1;
- }
- } else {
- $indent = $pageData->{"page.absDepth"} - $startPageDepth - 1;
- }
- $pageData->{"page.indent_loop"} = [];
- push(@{$pageData->{"page.indent_loop"}},{'indent'=>$_}) for(1..$indent);
- $pageData->{"page.indent"} = " " x $indent;
-
- # Put page properties in $pageData hashref
- foreach my $property (@interestingPageProperties) {
- $pageData->{"page.".$property} = $page->{$property};
- }
- $pageData->{"page.isRoot"} = (! $page->{'parentId'});
- $pageData->{"page.isTop"} = ($pageData->{"page.absDepth"} == 2);
- $pageData->{"page.hasDaughter"} = ($page->{'nestedSetRight'} - $page->{'nestedSetLeft'} > 1);
- $pageData->{"page.isDaughter"} = ($page->{'parentId'} eq $currentPage->get('pageId'));
- $pageData->{"page.isMother"} = ($page->{'pageId'} eq $currentPage->get('parentId'));
-
- $pageData->{"page.isAncestor"}
- = (($page->{'nestedSetLeft'} < $currentPage->get('nestedSetLeft'))
- && ($page->{'nestedSetRight'} > $currentPage->get('nestedSetRight')));
- $pageData->{"page.isDescendent"}
- = (($page->{'nestedSetLeft'} > $currentPage->get('nestedSetLeft'))
- && ($page->{'nestedSetRight'} < $currentPage->get('nestedSetRight')));
-
- $pageData->{"page.inRoot"}
- = (($page->{'nestedSetLeft'} > $currentRoot->get('nestedSetLeft'))
- && ($page->{'nestedSetRight'} < $currentRoot->get('nestedSetRight')));
-
- # Some information about my mother
- my $mother = WebGUI::Page->getPage($page->{parentId});
- if ($page->{parentId} ne "0") {
- foreach (qw(title urlizedTitle parentId pageId)) {
- $pageData->{"page.mother.$_"} = $mother->get($_);
- }
- $pageData->{"page.isSister"}
- = (($mother->get("pageId") eq $currentPage->get("parentId"))
- && !$pageData->{"page.isBasepage"});
- }
-
- $pageData->{"page.inBranch"}
- = ($pageData->{"page.isAncestor"}
- || $pageData->{"page.isDescendent"}
- || $pageData->{"page.isSister"}
- || $pageData->{"page.isBasepage"});
-
- $pageData->{"page.isLeftMost"} = (($page->{'nestedSetLeft'} - 1) == $mother->get('nestedSetLeft'));
- $pageData->{"page.isRightMost"} = (($page->{'nestedSetRight'} + 1) == $mother->get('nestedSetRight'));
- my $depthDiff = ($lastPage) ? ($lastPage->{'page.absDepth'} - $pageData->{'page.absDepth'}) : 0;
- if ($depthDiff > 0) {
- $pageData->{"page.depthDiff"} = $depthDiff if ($depthDiff > 0);
- $pageData->{"page.depthDiffIs".$depthDiff} = 1;
- push(@{$pageData->{"page.depthDiff_loop"}},{}) for(1..$depthDiff);
- }
-
- # Some information about my depth
- $pageData->{"page.depthIs".$pageData->{"page.absDepth"}} = 1;
- $pageData->{"page.relativeDepthIs".$pageData->{"page.relDepth"}} = 1;
-
- # We need a copy of the last page for the depthDiffLoop
- $lastPage = $pageData;
-
- # Store $pageData in page_loop. Mind the order.
- if ($self->{_reverse}) {
- unshift(@page_loop, $pageData);
- } else {
- push(@page_loop, $pageData);
- }
- }
- }
-
- # We had a cache miss, so let's put the data in cache
- $cache->set(\@page_loop, 3600*24) unless $session{var}{adminOn};
- } else {
- # We had a cache hit
- @page_loop = @{$cacheContent};
- }
-
- # Do the user-dependent checks (which cannot be cached globally)
- foreach my $pageData (@page_loop) {
- $pageData->{"page.isViewable"} = WebGUI::Page::canView($pageData->{'page.pageId'});
- # Check privileges
- if ($pageData->{"page.isViewable"} || $self->{_showUnprivilegedPages}) {
- push (@{$var->{page_loop}}, $pageData);
- push (@{$unfolded{$pageData->{"page.parentId"}}}, $pageData);
- }
- }
-
- foreach (values %unfolded) {
- push(@{$var->{unfolded_page_loop}}, @{$_});
- }
-
- # Configure button
- $var->{'config.button'} = $self->_getEditButton();
-
- # Some properties of the page the user's viewing.
- $var->{'basepage.hasDaughter'} = $currentPage->hasDaughter();
- $var->{"basepage.isHome"} = ($currentPage->get('pageId') eq '1');
-
- if ($self->{_template}) {
- return WebGUI::Template::processRaw($self->{_template}, $var);
- } else {
- return WebGUI::Template::process($self->{_templateId}, "Navigation", $var);
- }
-}
-
-#-------------------------------------------------------------------
-
-=head2 getConfig ( [identifier] )
-
-Returns a hash reference containing the configuration in
-key => value pairs for the requested identifier.
-If no identifier is specified, the class identifier will be used.
-
-This routine can be called both as a method or as a function.
-
-=head3 identifier
-
-The configuration to use. Config is stored in the table Navigation
-in the database.
-
-=cut
-
-sub getConfig {
- my $identifier;
- if (ref($_[0]) && ! $_[1]) {
- $identifier = $_[0]->{_identifier};
- } elsif (ref($_[0])) {
- $identifier = $_[1];
- } else {
- $identifier = $_[0];
- }
- return WebGUI::SQL->quickHashRef('select * from Navigation where identifier = '.quote($identifier));
-
-}
-
-#-------------------------------------------------------------------
-
-=head2 getLevelNames ( )
-
-Returns a hash reference with starting levels.
-
-=cut
-
-sub getLevelNames {
- return _toKeyValueHashRef(_levels());
-}
-
-#-------------------------------------------------------------------
-
-=head2 getMethodNames ( )
-
-Returns a hash reference with methods.
-
-=cut
-
-sub getMethodNames {
- return _toKeyValueHashRef(_methods());
-}
-
-#-------------------------------------------------------------------
-
-=head2 new ( identifier => $id, [ %options ] )
-
-Constructor.
-
-=head3 identifier
-
-The configuration to use. Config is stored in the table Navigation
-in the database.
-
-=head3 options
-
-Instead of using an existing configuration, you can also drop
-in your own parameters of the form: option => value.
-
-$custom = WebGUI::Navigation->new(
- startAt=>'root',
- 'reverse'=>1,
- method=>'self_and_sisters',
- template=>'
'
- );
-
-=cut
-
-sub new {
- my $class = shift;
- WebGUI::ErrorHandler::fatalError('WebGUI::Navigation->new() called with odd number of option parameters - should be of the form option => value') unless $#_ % 2;;
- my %var = @_;
- my $self = bless {}, $class;
- my %default = ( identifier => time(),
- depth => 99,
- method => 'descendants',
- startAt => 'current',
- stopAtLevel => -1,
- templateId => 1,
- );
- %var = ( %default, %var);
- $self->_storeConfigInClass(\%var);
- return $self;
-}
-
-#-------------------------------------------------------------------
-
-=head2 view ( )
-
-This is an interface for WebGUI::Macro::Navigation and returns HTML.
-It builds a navigation item based on the identifier. If the identifier
-is not found, a link for initial configuration is returned.
-
-=cut
-
-sub view {
- my $self = shift;
- my $config = $self->getConfig;
- if(defined($config->{identifier})) {
- $self->_storeConfigInClass($config);
- return $self->build;
- } else {
- return ''.
- 'Configure '.$self->{_identifier}.'';
- }
-}
-
-
-
-
-
-1;
-
-
diff --git a/lib/WebGUI/Operation.pm b/lib/WebGUI/Operation.pm
index af0f67d11..55a4b4010 100644
--- a/lib/WebGUI/Operation.pm
+++ b/lib/WebGUI/Operation.pm
@@ -145,13 +145,6 @@ sub getOperations {
'deleteMetaDataField' => 'WebGUI::Operation::MetaData',
'deleteMetaDataFieldConfirm' => 'WebGUI::Operation::MetaData',
'saveMetaDataSettings' => 'WebGUI::Operation::MetaData',
- 'listNavigation' => 'WebGUI::Operation::Navigation',
- 'editNavigation' => 'WebGUI::Operation::Navigation',
- 'editNavigationSave' => 'WebGUI::Operation::Navigation',
- 'copyNavigation' => 'WebGUI::Operation::Navigation',
- 'deleteNavigation' => 'WebGUI::Operation::Navigation',
- 'deleteNavigationConfirm' => 'WebGUI::Operation::Navigation',
- 'previewNavigation' => 'WebGUI::Operation::Navigation',
'deployPackage' => 'WebGUI::Operation::Package',
'managePackages' => 'WebGUI::Operation::Package',
'viewPageTree' => 'WebGUI::Operation::Page',
@@ -190,7 +183,6 @@ sub getOperations {
'editReplacement' => 'WebGUI::Operation::Replacements',
'editReplacementSave' => 'WebGUI::Operation::Replacements',
'listReplacements' => 'WebGUI::Operation::Replacements',
- 'listRoots' => 'WebGUI::Operation::Root',
'setScratch' => 'WebGUI::Operation::Scratch',
'deleteScratch' => 'WebGUI::Operation::Scratch',
'saveSettings' => 'WebGUI::Operation::Settings',
diff --git a/lib/WebGUI/Operation/Navigation.pm b/lib/WebGUI/Operation/Navigation.pm
deleted file mode 100644
index a7eda0a87..000000000
--- a/lib/WebGUI/Operation/Navigation.pm
+++ /dev/null
@@ -1,546 +0,0 @@
-package WebGUI::Operation::Navigation;
-
-#-------------------------------------------------------------------
-# WebGUI is Copyright 2001-2004 Plain Black Corporation.
-#-------------------------------------------------------------------
-# 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::IxHash;
-use Tie::CPHash;
-use WebGUI::AdminConsole;
-use WebGUI::DateTime;
-use WebGUI::ErrorHandler;
-use WebGUI::Grouping;
-use WebGUI::HTMLForm;
-use WebGUI::Icon;
-use WebGUI::Id;
-use WebGUI::International;
-use WebGUI::Macro;
-use WebGUI::Navigation;
-use WebGUI::Paginator;
-use WebGUI::Privilege;
-use WebGUI::Session;
-use WebGUI::SQL;
-use WebGUI::URL;
-use WebGUI::Utility;
-use WebGUI::TabForm;
-use WebGUI::Cache;
-
-#-------------------------------------------------------------------
-sub _submenu {
- my $workarea = shift;
- my $title = shift;
- my $i18n = WebGUI::International->new("Navigation");
- $title = $i18n->get($title) if ($title);
- my $help = shift;
- my $ac = WebGUI::AdminConsole->new("navigation");
- if ($help) {
- $ac->setHelp($help);
- }
- $ac->addSubmenuItem(WebGUI::URL::page('op=editNavigation'),$i18n->get("add new"));
- if (($session{form}{op} eq "editNavigation" && $session{form}{navigationId} ne "new") || $session{form}{op} eq "deleteNavigationConfirm") {
- $ac->addSubmenuItem(WebGUI::URL::page('op=editNavigation&identifier='.$session{form}{identifier}), $i18n->get("18"));
- $ac->addSubmenuItem(WebGUI::URL::page('op=copyNavigation&navigationId='.$session{form}{navigationId}),$i18n->get("19"));
- $ac->addSubmenuItem(WebGUI::URL::page('op=deleteNavigation&navigationId='.$session{form}{navigationId}),$i18n->get("20"));
- }
- $ac->addSubmenuItem(WebGUI::URL::page('op=listNavigation'), $i18n->get("21"));
- return $ac->render($workarea, $title);
-}
-
-
-#-------------------------------------------------------------------
-sub www_copyNavigation {
- return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(3));
- my %navigation = WebGUI::SQL->quickHash("select * from Navigation where identifier = ".
- quote($session{form}{identifier}));
- WebGUI::SQL->write("insert into Navigation (navigationId, identifier, depth, method, startAt, stopAtLevel,
- templateId, showSystemPages, showHiddenPages, showUnprivilegedPages,
- reverse)
- values (".quote(WebGUI::Id::generate()).",
- ".quote($navigation{identifier}.' (copy)').", $navigation{depth}, ".quote($navigation{method}).
- ", ".quote($navigation{startAt}).", $navigation{stopAtLevel}, ".quote($navigation{templateId}).",
- $navigation{showSystemPages}, $navigation{showHiddenPages},$navigation{showUnprivilegedPages},
- $navigation{reverse})");
- return www_listNavigation();
-}
-
-#-------------------------------------------------------------------
-sub www_deleteNavigationConfirm {
- return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(3));
- if ($session{form}{navigationId} < 1000 && $session{form}{navigationId} > 0) {
- return WebGUI::Privilege::vitalComponent();
- }
- WebGUI::SQL->write("delete from Navigation where navigationId = ".quote($session{form}{navigationId}));
-
- # Also delete cache
- WebGUI::Page->recacheNavigation;
- return www_listNavigation();
-}
-
-
-sub www_editNavigation {
- return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(3));
- my $identifier = shift || $session{form}{identifier};
- my $config = WebGUI::Navigation::getConfig($identifier);
- if ($config->{identifier}) {
- # Existing config
- } else {
- $config->{navigationId} = 'new';
- $config->{identifier} = $identifier || 'myIdentifier';
- $config->{assetsToInclude} = "descendants";
- $config->{startType} = "relativeToRoot";
- $config->{startPoint} = 0;
- $config->{baseType} = "relativeToCurrentPage";
- $config->{basePage} = "0";
- $config->{endType} = "relativeToBasePage";
- $config->{endPoint} = "55";
- $config->{templateId} = 1;
- $config->{showSystemPages} = 0;
- $config->{showHiddenPages} = 0;
- $config->{showUnprivilegedPages} = 0;
- }
- my $tabform = WebGUI::TabForm->new;
- $tabform->hidden({
- name=>'op',
- value=>'editNavigationSave'
- });
- $tabform->hidden({
- name=>'navigationId',
- value=>$config->{navigationId}
- });
- $tabform->addTab("properties",WebGUI::International::get(23, 'Navigation'));
- $tabform->getTab("properties")->raw('');
- $tabform->getTab("properties")->readOnly(
- -value=>$config->{navigationId},
- -label=>'navigationId'
- );
- $tabform->getTab("properties")->text(
- -name=>'identifier',
- -value=>$config->{identifier},
- -label=>WebGUI::International::get(24, 'Navigation')
- );
- my ($ancestorsChecked, $descendantsChecked, $selfChecked, $pedigreeChecked, $siblingsChecked);
- my @assetsToInclude = split(",",$config->{assetsToInclude});
- my $afterScript;
- foreach my $item (@assetsToInclude) {
- if ($item eq "self") {
- $selfChecked = 1;
- } elsif ($item eq "descendants") {
- $descendantsChecked = 1;
- $afterScript = "displayNavEndPoint = false;";
- } elsif ($item eq "ancestors") {
- $ancestorsChecked = 1;
- $afterScript = "displayNavStartPoint = false;";
- } elsif ($item eq "siblings") {
- $siblingsChecked = 1;
- } elsif ($item eq "pedigree") {
- $pedigreeChecked = 1;
- }
- }
- $tabform->getTab("properties")->readOnly(
- -label=>"Pages to Include",
- -value=>WebGUI::Form::checkbox({
- checked=>$ancestorsChecked,
- name=>"assetsToInclude",
- value=>"ancestors",
- extras=>'onChange="toggleStartPoint()"'
- }).'Ancestors
'
- .WebGUI::Form::checkbox({
- checked=>$selfChecked,
- name=>"assetsToInclude",
- value=>"self"
- }).'Self
'
- .WebGUI::Form::checkbox({
- checked=>$siblingsChecked,
- name=>"assetsToInclude",
- value=>"siblings"
- }).'Siblings
'
- .WebGUI::Form::checkbox({
- checked=>$descendantsChecked,
- name=>"assetsToInclude",
- value=>"descendants",
- extras=>'onChange="toggleEndPoint()"'
- }).'Descendants
'
- .WebGUI::Form::checkbox({
- checked=>$pedigreeChecked,
- name=>"assetsToInclude",
- value=>"pedigree"
- }).'Pedigree
'
- );
- $tabform->getTab("properties")->raw(
- '
| Start Type | '
- .WebGUI::Form::selectList({
- name=>"startType",
- value=>[$config->{startType}],
- extras=>'id="navStartType" onChange="changeStartPoint()"',
- options=>{
- relativeToRoot=>"Relative To Root",
- relativeToCurrentPage=>"Relative To Current Page"
- }
- })
- .' |
| Start Point | |
'
- );
- $tabform->getTab("properties")->selectList(
- -name=>"baseType",
- -options=>{
- specificUrl=>'Specific URL',
- relativeToCurrentPage=>'Relative To Current Page',
- relativeToRoot=>'Relative To Root'
- },
- -value=>[$config->{baseType}],
- -label=>"Base Type",
- -extras=>'id="navBaseType" onChange="changeBasePage()"'
- );
- $tabform->getTab("properties")->readOnly(
- -label=>"Base Page",
- -value=>''
- );
- my %options;
- tie %options, 'Tie::IxHash';
- %options = (
- '55'=>'Infinity',
- '1'=>'./a/ (+1)',
- '2'=>'./a/b/ (+2)',
- '3'=>'./a/b/c/ (+3)',
- '4'=>'./a/b/c/d/ (+4)',
- '5'=>'./a/b/c/d/e/ (+5)'
- );
- $tabform->getTab("properties")->raw(
- '| End Type | '
- .WebGUI::Form::selectList({
- name=>"endType",
- value=>[$config->{endType}],
- options=>{
- relativeToStartPage=>"Relative To Start Page",
- relativeToBasePage=>"Relative To Base Page"
- }
- })
- .' |
| End Point | '
- .WebGUI::Form::selectList({
- name=>"endPoint",
- value=>[$config->{endPoint}],
- options=>\%options
- })
- .' |
'
- );
- $tabform->addTab("layout",WebGUI::International::get(105));
- $tabform->getTab("layout")->template(
- -name=>'templateId',
- -label=>WebGUI::International::get(913),
- -value=>$session{form}{templateId} || $config->{templateId},
- -namespace=>'Navigation',
- );
- $tabform->getTab("layout")->yesNo(
- -name=>'showSystemPages',
- -label=>WebGUI::International::get(30,'Navigation'),
- -value=>$session{form}{showSystemPages} || $config->{showSystemPages}
- );
- $tabform->getTab("layout")->yesNo(
- -name=>'showHiddenPages',
- -label=>WebGUI::International::get(31,'Navigation'),
- -value=>$session{form}{showHiddenPages} || $config->{showHiddenPages}
- );
- $tabform->getTab("layout")->yesNo(
- -name=>'showUnprivilegedPages',
- -label=>WebGUI::International::get(32,'Navigation'),
- -value=>$session{form}{showUnprivilegedPages} || $config->{showUnprivilegedPages}
- );
- my $script = "";
- return _submenu($tabform->print.$script,'22',"navigation add/edit");
-}
-
-#-------------------------------------------------------------------
-sub www_editNavigationOld {
- return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(3));
- my $identifier = shift || $session{form}{identifier};
- my $config = WebGUI::Navigation::getConfig($identifier);
- if ($config->{identifier}) {
- # Existing config
- } else {
- $config->{navigationId} = 'new';
- $config->{identifier} = $identifier || 'myIdentifier';
- $config->{depth} = 99;
- $config->{method} = 'descendants';
- $config->{startAt} = 'current';
- $config->{stopAtLevel} = -1;
- $config->{templateId} = 1;
- $config->{showSystemPages} = 0;
- $config->{showHiddenPages} = 0;
- $config->{showUnprivilegedPages} = 0;
- $config->{'reverse'} = 0;
- }
- my $output;
- tie my (%tabs) , 'Tie::IxHash';
- %tabs = (
- properties=>{
- label=>WebGUI::International::get(23, 'Navigation'),
- },
- layout=>{
- label=>WebGUI::International::get(105),
- },
- );
-
- my $f = WebGUI::TabForm->new(\%tabs);
- $f->hidden({name=>'op', value=>'editNavigationSave'});
- $f->hidden({name=>'navigationId', value=>$config->{navigationId}});
- $f->getTab("properties")->raw('');
- $f->getTab("properties")->readOnly(
- -value=>$config->{navigationId},
- -label=>'navigationId'
- );
-
- $f->getTab("properties")->text(
- -name=>'identifier',
- -value=>$config->{identifier},
- -label=>WebGUI::International::get(24, 'Navigation')
- );
-
- my $startAt = $session{form}{startAt} || $config->{startAt};
- my $levels = WebGUI::Navigation::getLevelNames();
-
- # If an alternate value for startAt is specified, add that to the options list as well.
- $levels->{$startAt} = $startAt if (not defined $levels->{$startAt});
-
- # The documented interface of HTMLForm::combo didn't work. However the old functional interface does...
- $f->getTab("properties")->combo("startAt",$levels,WebGUI::International::get(25,'Navigation'),[$startAt]);
- $f->getTab("properties")->selectList(
- -name=>'method',
- -label=>WebGUI::International::get(28,'Navigation'),
- -options=>WebGUI::Navigation::getMethodNames(),
- -value=>[$session{form}{method} || $config->{method}]
- );
- tie my %stopAtLevels, 'Tie::IxHash';
- %stopAtLevels = ( '-1' => 'no limit',
- '0' => '0. '.WebGUI::International::get(1,'Navigation'),
- '1' => '1. '.WebGUI::International::get(2,'Navigation'),
- '2' => '2. '.WebGUI::International::get(3,'Navigation'),
- '3' => '3.',
- '4' => '4.',
- '5' => '5.',
- '6' => '6.',
- '7' => '7.',
- '8' => '8.',
- '9' => '9.',
- );
- $f->getTab("properties")->selectList(
- -name=>'stopAtLevel',
- -label=>WebGUI::International::get(26,'Navigation'),
- -options=>\%stopAtLevels,
- -value=>[$session{form}{stopAtLevel} || $config->{stopAtLevel}]
- );
- tie my %depths, 'Tie::IxHash';
- %depths = ( '1' => '1 level',
- '2' => '2 levels',
- '3' => '3 levels',
- '4' => '4 levels',
- '5' => '5 levels',
- '6' => '6 levels',
- '7' => '7 levels',
- '8' => '8 levels',
- '9' => '9 levels',
- '99' => '99 levels',
- );
- $f->getTab("properties")->selectList(
- -name=>'depth',
- -label=>WebGUI::International::get(27,'Navigation'),
- -options=>\%depths,
- -value=>[$session{form}{depth} || $config->{depth}]
- );
- $f->getTab("properties")->yesNo(
- -name=>'showSystemPages',
- -label=>WebGUI::International::get(30,'Navigation'),
- -value=>$session{form}{showSystemPages} || $config->{showSystemPages}
- );
-
- $f->getTab("properties")->yesNo(
- -name=>'showHiddenPages',
- -label=>WebGUI::International::get(31,'Navigation'),
- -value=>$session{form}{showHiddenPages} || $config->{showHiddenPages}
- );
-
- $f->getTab("properties")->yesNo(
- -name=>'showUnprivilegedPages',
- -label=>WebGUI::International::get(32,'Navigation'),
- -value=>$session{form}{showUnprivilegedPages} || $config->{showUnprivilegedPages}
- );
-
- $f->getTab("layout")->template(
- -name=>'templateId',
- -label=>WebGUI::International::get(913),
- -value=>$session{form}{templateId} || $config->{templateId},
- -namespace=>'Navigation',
- );
- $f->getTab("layout")->yesNo(
- -name=>'reverse',
- -label=>WebGUI::International::get(29,'Navigation'),
- -value=>$session{form}{'reverse'} || $config->{'reverse'}
- );
- # window.open('', 'navPreview', 'toolbar=no,width=400,height=300,status=no,location=no,scrollbars=yes,resizable=yes');
- my $previewButton = qq{
- };
- my $saveButton = ' ';
- $f->{_submit} = $previewButton." ".$saveButton;
- $output .= $f->print;
- return _submenu($output,'22',"navigation add/edit");
-}
-
-#-------------------------------------------------------------------
-sub www_editNavigationSave {
- return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(3));
-
- # Check on duplicate identifier
- my ($existingNavigationId, $existingIdentifier) = WebGUI::SQL->quickArray("select navigationId,
- identifier from Navigation where identifier = "
- .quote($session{form}{identifier}));
- if(($existingIdentifier && $session{form}{navigationId} eq "new") ||
- ($existingIdentifier && $existingNavigationId != $session{form}{navigationId})) {
- $session{form}{identifier} = undef;
- return WebGUI::International::get(33,'Navigation').www_editNavigation();
- }
- if ($session{form}{navigationId} eq "new") {
- $session{form}{navigationId} = WebGUI::Id::generate();
- WebGUI::SQL->write("insert into Navigation (navigationId, identifier)
- values (".quote($session{form}{navigationId}).", ".quote($session{form}{identifier}).")");
- }
- $session{form}{startAt} = $session{form}{startAt_new} || $session{form}{startAt}; # Combo field
- WebGUI::SQL->write("update Navigation set depth = $session{form}{depth},
- method = ".quote($session{form}{method}).",
- startAt = ".quote($session{form}{startAt}).",
- stopAtLevel = ".quote($session{form}{stopAtLevel}).",
- templateId = ".quote($session{form}{templateId}).",
- showSystemPages = $session{form}{showSystemPages},
- showHiddenPages = $session{form}{showHiddenPages},
- showUnprivilegedPages = $session{form}{showUnprivilegedPages},
- identifier = ".quote($session{form}{identifier}).",
- reverse = ".quote($session{form}{'reverse'})."
- where navigationId = ".quote($session{form}{navigationId}));
- # Delete from cache
-
- WebGUI::Page->recacheNavigation;
- return "";
-}
-
-#-------------------------------------------------------------------
-sub www_listNavigation {
- return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(3));
- my $output;
- my $sth = WebGUI::SQL->read("select navigationId, identifier from Navigation order by identifier");
- my $i = 0;
- my @row = ();
- while (my %data = $sth->hash) {
- $row[$i].= '| '
- .deleteIcon('op=deleteNavigationConfirm&identifier='.$data{identifier}.'&navigationId='.$data{navigationId},'',WebGUI::International::get(502))
- .editIcon('op=editNavigation&identifier='.$data{identifier}.'&navigationId='.$data{navigationId}."&afterEdit=".WebGUI::URL::escape("op=listNavigation"))
- .copyIcon('op=copyNavigation&identifier='.$data{identifier}.'&navigationId='.$data{navigationId})
- .' | ';
- $row[$i].= ''.$data{identifier}.' | ';
- $i++;
- }
- $sth->finish;
- my $p = WebGUI::Paginator->new(WebGUI::URL::page('op=listNavigation'));
- $p->setDataByArrayRef(\@row);
- $output .= '';
- $output .= $p->getPage($session{form}{pn});
- $output .= '
';
- $output .= $p->getBarTraditional($session{form}{pn});
- return _submenu($output,'34',"navigation manage");
-}
-
-#-------------------------------------------------------------------
-sub www_previewNavigation {
- $session{var}{adminOn} = 0;
- return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(3));
- my $nav = WebGUI::Navigation->new( depth=>$session{form}{depth},
- method=>$session{form}{method},
- startAt=>$session{form}{startAt},
- stopAtLevel=>$session{form}{stopAtLevel},
- templateId=>$session{form}{templateId},
- showSystemPages=>$session{form}{showSystemPages},
- showHiddenPages=>$session{form}{showHiddenPages},
- showUnprivilegedPages=>$session{form}{showUnprivilegedPages},
- 'reverse'=>$session{form}{'reverse'},
- );
- my $output = qq(
-
-
- |
- ) . $nav->build . qq( |
);
-
- # Because of the way the system is set up, the preview is cached. So let's remove it again...
- WebGUI::Cache->new($nav->{_identifier}."$session{page}{pageId}", "Navigation-".$session{config}{configFile})->delete;
-
- return _submenu($output,"preview");
-}
-
-1;
diff --git a/lib/WebGUI/i18n/English/Navigation.pm b/lib/WebGUI/i18n/English/Navigation.pm
index ed3cd0453..a23ae3e9e 100644
--- a/lib/WebGUI/i18n/English/Navigation.pm
+++ b/lib/WebGUI/i18n/English/Navigation.pm
@@ -11,21 +11,11 @@ our $I18N = {
lastUpdated => 1077080766
},
- '25' => {
- message => q|Base page|,
- lastUpdated => 1077080583
- },
-
'31' => {
message => q|Show hidden pages|,
lastUpdated => 1077080799
},
- '22' => {
- message=> q|Edit Navigation|,
- lastUpdated => 1077078969
- },
-
'preview' => {
message => q|Preview Navigation|,
lastUpdated => 1077078456
diff --git a/www/extras/adminConsole/navigation.gif b/www/extras/assets/navigation.gif
similarity index 100%
rename from www/extras/adminConsole/navigation.gif
rename to www/extras/assets/navigation.gif
diff --git a/www/extras/adminConsole/small/navigation.gif b/www/extras/assets/small/navigation.gif
similarity index 100%
rename from www/extras/adminConsole/small/navigation.gif
rename to www/extras/assets/small/navigation.gif