diff --git a/docs/gotcha.txt b/docs/gotcha.txt index 20b656c2d..4755976b1 100644 --- a/docs/gotcha.txt +++ b/docs/gotcha.txt @@ -22,6 +22,12 @@ save you many hours of grief. need to download and upgrade to 5.5.x before you can upgrade to 6.3 or higher. + * All Site Map wobjects will be migrated to Navigation macros in + Articles during the upgrade. All the site map templates will + be lost. If you want them, save them before the upgrade. Also + check your site after the upgrade for all site maps to make + sure that they look the way you want them to look. + 6.2.8 -------------------------------------------------------------------- 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 ecceb8c43..c12dd97db 100644 --- a/docs/upgrades/upgrade_6.2.9-6.3.0.pl +++ b/docs/upgrades/upgrade_6.2.9-6.3.0.pl @@ -70,7 +70,7 @@ sub walkTree { while (my $page = $a->hashRef) { my $pageId = WebGUI::Id::generate(); my $pageLineage = $parentLineage.sprintf("%06d",$myRank); - my $pageUrl = $page->{urlizedTitle}; + my $pageUrl = fixUrl($page->{urlizedTitle}); my $className = 'WebGUI::Asset::Layout'; if ($page->{redirectURL} ne "") { $className = 'WebGUI::Asset::Redirect'; @@ -95,7 +95,7 @@ sub walkTree { my ($namespace) = WebGUI::SQL->quickHashRef("select * from ".$wobject->{namespace}." where wobjectId=".quote($wobject->{wobjectId})); my $wobjectId = WebGUI::Id::generate(); my $wobjectLineage = $pageLineage.sprintf("%06d",$rank); - my $wobjectUrl = $pageUrl."/".$wobject->{title}; + my $wobjectUrl = fixUrl($pageUrl."/".$wobject->{title}); my $groupIdView = $page->{groupIdView}; my $groupIdEdit = $page->{groupIdEdit}; my $ownerId = $page->{ownerId}; @@ -117,7 +117,16 @@ sub walkTree { # migrate image to image asset # migrate forums } elsif ($namespace eq "SiteMap") { - # we're dumping sitemaps so do that here + my $navident = 'SiteMap_'.$namespace->{wobjectId}; + my ($starturl) = WebGUI::SQL->quickArray("select urlizedTitle from page + where pageId=".quote($namespace->{startAtThisLevel})); + WebGUI::SQL->write("insert into Navigation (navigationId, identifier, depth, startAt, + templateId) values (".quote(WebGUI::Id::generate()).", ".quote($navident).", + ".quote($namespace->{depth}).", ".quote($starturl).", '1')"); + my $navmacro = $wobject->{description}.'

^Navigation('.$navident.');

'; + WebGUI::SQL->write("update wobject set className='WebGUI::Asset::Wobject::Article', description=".quote($navmacro)." + where assetId=".quote($wobjectId)); + WebGUI::SQL->write("insert into Article (assetId) values (".quote($wobjectId).")"); } elsif ($namespace eq "FileManager") { # we're dumping file manager's so do that here } elsif ($namespace eq "Product") { @@ -135,6 +144,7 @@ sub walkTree { } $b->finish; walkTree($page->{pageId},$pageId,$pageLineage,$rank+1); + $myRank++; } $a->finish; my $sth = WebGUI::SQL->read("select distinct(namespace) from wobject"); @@ -172,9 +182,25 @@ sub walkTree { WebGUI::SQL->write("drop table page"); WebGUI::SQL->write("alter table Article drop column image"); WebGUI::SQL->write("alter table Article drop column attachment"); + WebGUI::SQL->write("delete from template where namespace in ('SiteMap')"); } - +sub fixUrl { + my $id = shift; + my $url = WebGUI::URL::urlize(shift); + my ($test) = WebGUI::SQL->quickArray("select url from asset where assetId<>".quote($id)." and url=".quote($url)); + if ($test) { + my @parts = split(/\./,$url); + if ($parts[0] =~ /(.*)(\d+$)/) { + $parts[0] = $1.($2+1); + } elsif ($test ne "") { + $parts[0] .= "2"; + } + $url = join(".",@parts); + $url = fixUrl($url); + } + return $url; +} diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 988c9aad3..dfddfb4d3 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -161,7 +161,7 @@ sub fixUrl { $parts[0] .= "2"; } $url = join(".",@parts); - $url = $self->setUrl($url); + $url = $self->fixUrl($url); } return $url; } @@ -328,6 +328,11 @@ sub getIndexerParams { return {}; } + +sub getName { + return WebGUI::International::get('asset','Asset'); +} + sub getNextChildRank { my $self = shift; my ($lineage) = WebGUI::SQL->quickArray("select max(lineage) from asset where parentId=".quote($self->getId)); diff --git a/lib/WebGUI/Asset/Redirect.pm b/lib/WebGUI/Asset/Redirect.pm new file mode 100644 index 000000000..13ee871d6 --- /dev/null +++ b/lib/WebGUI/Asset/Redirect.pm @@ -0,0 +1,134 @@ +package WebGUI::Asset::Redirect; + +=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 WebGUI::Session; + + +=head1 NAME + +Package WebGUI::Asset::Redirect + +=head1 DESCRIPTION + +Provides a mechanism to redirect pages from the WebGUI site to external sites. + +=head1 SYNOPSIS + +use WebGUI::Asset::Redirect; + + +=head1 METHODS + +These methods are available from this class: + +=cut + + + +#------------------------------------------------------------------- + +=head2 definition ( definition ) + +Defines the properties of this asset. + +=head3 definition + +A hash reference passed in from a subclass definition. + +=cut + +sub definition { + my $class = shift; + my $definition = shift; + push(@{$definition}, { + tableName=>'redirect', + className=>'WebGUI::Asset::Redirect', + properties=>{ + redirectUrl=>{ + fieldType=>'url', + defaultValue=>undef + } + } + }); + return $class->SUPER::definition($definition); +} + + + +#------------------------------------------------------------------- + +=head2 getEditForm () + +Returns the TabForm object that will be used in generating the edit page for this asset. + +=cut + +sub getEditForm { + my $self = shift; + my $tabform = $self->SUPER::getEditForm(); + $tabform->getTab("properties")->url( + -name=>"redirectUrl", + -label=>"Redirect URL", + -value=>$self->getValue("redirectUrl") + ); +} + + +#------------------------------------------------------------------- + +=head2 getUiLevel () + +Returns the UI level of this asset. + +=cut + +sub getUiLevel { + return 9; +} + +#------------------------------------------------------------------- + +=head2 name + +Returns the displayable name of this asset. + +=cut + +sub getName { + return "Redirect"; +} + + +#------------------------------------------------------------------- + +=head2 www_view + +A web executable method that redirects the user to the specified page, or displays the edit interface when admin mode is enabled. + +=cut + +sub www_view { + my $self = shift; + if ($session{var}{adminOn}) { + return $self->www_edit; + } else { + + } +} + + +1; + diff --git a/lib/WebGUI/Asset/Wobject.pm b/lib/WebGUI/Asset/Wobject.pm index 8f4143832..ed8d26ef1 100644 --- a/lib/WebGUI/Asset/Wobject.pm +++ b/lib/WebGUI/Asset/Wobject.pm @@ -192,6 +192,21 @@ sub getEditForm { +#------------------------------------------------------------------- + +=head2 getName ( ) + +This method should be overridden by all wobjects and should return an internationalized human friendly name for the wobject. This method only exists in the super class for reverse compatibility and will try to look up the name based on the old name definition. + +=cut + +sub getName { + my $self = shift; + return $self->get("className"); +} + + + #------------------------------------------------------------------- =head2 logView ( ) @@ -206,21 +221,6 @@ sub logView { } -#------------------------------------------------------------------- - -=head2 name ( ) - -This method should be overridden by all wobjects and should return an internationalized human friendly name for the wobject. This method only exists in the super class for reverse compatibility and will try to look up the name based on the old name definition. - -=cut - -sub name { - my $self = shift; - return $self->get("className"); -} - - - #------------------------------------------------------------------- =head2 processMacros ( output ) diff --git a/lib/WebGUI/Asset/Wobject/Article.pm b/lib/WebGUI/Asset/Wobject/Article.pm index e156c27f4..e27f2076b 100644 --- a/lib/WebGUI/Asset/Wobject/Article.pm +++ b/lib/WebGUI/Asset/Wobject/Article.pm @@ -54,10 +54,6 @@ sub definition { } -#------------------------------------------------------------------- -sub name { - return WebGUI::International::get(1,"Article"); -} #------------------------------------------------------------------- sub getEditForm { @@ -87,6 +83,12 @@ sub getEditForm { } +#------------------------------------------------------------------- +sub getName { + return WebGUI::International::get(1,"Article"); +} + + #------------------------------------------------------------------- sub www_edit { my $self = shift; diff --git a/lib/WebGUI/i18n/English/Asset.pm b/lib/WebGUI/i18n/English/Asset.pm index 5e01de661..72d0f1c43 100644 --- a/lib/WebGUI/i18n/English/Asset.pm +++ b/lib/WebGUI/i18n/English/Asset.pm @@ -76,6 +76,12 @@ A short description of an asset. It is used in default meta tags, site maps and lastUpdated => 1100463645, }, + 'asset' => { + message => q|Asset|, + lastUpdated => 1100463645, + context => 'The default name of all assets.' + } + }; 1; diff --git a/www/extras/adminConsole/groups.gif b/www/extras/adminConsole/groups.gif index 7adee80e7..5143c35bc 100644 Binary files a/www/extras/adminConsole/groups.gif and b/www/extras/adminConsole/groups.gif differ