added redirect and migrated site map to article
This commit is contained in:
parent
0ffe4c87ce
commit
8a3e872238
8 changed files with 203 additions and 24 deletions
|
|
@ -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
|
||||
--------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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}.'<p>^Navigation('.$navident.');</p>';
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
134
lib/WebGUI/Asset/Redirect.pm
Normal file
134
lib/WebGUI/Asset/Redirect.pm
Normal file
|
|
@ -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;
|
||||
|
||||
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.2 KiB |
Loading…
Add table
Add a link
Reference in a new issue