Fixed a bug where pages where not proper duplicated.
This commit is contained in:
parent
4e11f97b20
commit
6f518aba4e
1 changed files with 21 additions and 21 deletions
|
|
@ -7,7 +7,7 @@ package WebGUI::Operation::Package;
|
||||||
# (docs/license.txt) that came with this distribution before using
|
# (docs/license.txt) that came with this distribution before using
|
||||||
# this software.
|
# this software.
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
# http://www.plainblack.com info@plainblack.com
|
# http://www.plainblack.com info@plainblack.com
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
use Exporter;
|
use Exporter;
|
||||||
|
|
@ -25,41 +25,41 @@ our @EXPORT = qw(&www_deployPackage &www_selectPackageToDeploy);
|
||||||
sub _duplicateWobjects {
|
sub _duplicateWobjects {
|
||||||
my ($sth, $wobject, $cmd, %hash, $extra, $w);
|
my ($sth, $wobject, $cmd, %hash, $extra, $w);
|
||||||
$sth = WebGUI::SQL->read("select * from wobject where pageId=$_[0]");
|
$sth = WebGUI::SQL->read("select * from wobject where pageId=$_[0]");
|
||||||
while ($wobject = $sth->hashRef) {
|
while ($wobject = $sth->hashRef) {
|
||||||
$extra = WebGUI::SQL->quickHashRef("select * from ${$wobject}{namespace} where wobjectId=${$wobject}{wobjectId}");
|
$extra = WebGUI::SQL->quickHashRef("select * from ${$wobject}{namespace} where wobjectId=${$wobject}{wobjectId}");
|
||||||
tie %hash, 'Tie::CPHash';
|
tie %hash, 'Tie::CPHash';
|
||||||
%hash = (%{$wobject},%{$extra});
|
%hash = (%{$wobject},%{$extra});
|
||||||
$wobject = \%hash;
|
$wobject = \%hash;
|
||||||
$cmd = "WebGUI::Wobject::".${$wobject}{namespace};
|
$cmd = "WebGUI::Wobject::".${$wobject}{namespace};
|
||||||
$w = $cmd->new($wobject);
|
$w = $cmd->new($wobject);
|
||||||
$w->duplicate($_[1]);
|
$w->duplicate($_[1]);
|
||||||
}
|
}
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub _recursePageTree {
|
sub _recursePageTree {
|
||||||
my ($a, %package, %newParent, $newPageId, $urlizedTitle);
|
my ($a, %package, %newParent, $newPageId, $urlizedTitle);
|
||||||
tie %newParent, 'Tie::CPHash';
|
tie %newParent, 'Tie::CPHash';
|
||||||
tie %package, 'Tie::CPHash';
|
tie %package, 'Tie::CPHash';
|
||||||
%newParent = WebGUI::SQL->quickHash("select * from page where pageId=$_[1]");
|
%newParent = WebGUI::SQL->quickHash("select * from page where pageId=$_[1]");
|
||||||
_duplicateWobjects($_[0],$_[1]);
|
_duplicateWobjects($_[0],$_[1]);
|
||||||
$a = WebGUI::SQL->read("select * from page where parentId=$_[0]");
|
$a = WebGUI::SQL->read("select * from page where parentId=$_[0]");
|
||||||
while (%package = $a->hash) {
|
while (%package = $a->hash) {
|
||||||
$newPageId = getNextId("pageId");
|
$newPageId = getNextId("pageId");
|
||||||
$urlizedTitle = WebGUI::URL::makeUnique($package{urlizedTitle});
|
$urlizedTitle = WebGUI::URL::makeUnique($package{urlizedTitle});
|
||||||
WebGUI::SQL->write("insert into page values ($newPageId,$_[1],".quote($package{title}).",$newParent{styleId},$session{user}{userId},$newParent{ownerView},$newParent{ownerEdit},$newParent{groupId},$newParent{groupView},$newParent{groupEdit},$newParent{worldView},$newParent{worldEdit},$package{sequenceNumber},".quote($package{metaTags}).",".quote($urlizedTitle).",$package{defaultMetaTags},".quote($package{template}).",".quote($package{menuTitle}).",".quote($package{synopsis}).")");
|
WebGUI::SQL->write("insert into page values ($newPageId,$_[1],".quote($package{title}).",$newParent{styleId},$session{user}{userId},$newParent{ownerView},$newParent{ownerEdit},$newParent{groupId},$newParent{groupView},$newParent{groupEdit},$newParent{worldView},$newParent{worldEdit},$package{sequenceNumber},".quote($package{metaTags}).",".quote($urlizedTitle).",".$package{defaultMetaTags}.",".quote($package{menuTitle}).",".quote($package{synopsis}).",".quote($package{templateId}).")");
|
||||||
_recursePageTree($package{pageId},$newPageId);
|
_recursePageTree($package{pageId},$newPageId);
|
||||||
}
|
}
|
||||||
$a->finish;
|
$a->finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub www_selectPackageToDeploy {
|
sub www_selectPackageToDeploy {
|
||||||
my ($output, %data, $sth, $flag);
|
my ($output, %data, $sth, $flag);
|
||||||
if (WebGUI::Privilege::canEditPage()) {
|
if (WebGUI::Privilege::canEditPage()) {
|
||||||
tie %data,'Tie::CPHash';
|
tie %data,'Tie::CPHash';
|
||||||
$output = helpIcon(30);
|
$output = helpIcon(30);
|
||||||
$output .= '<h1>'.WebGUI::International::get(375).'</h1>';
|
$output .= '<h1>'.WebGUI::International::get(375).'</h1>';
|
||||||
$output .= '<ul>';
|
$output .= '<ul>';
|
||||||
$sth = WebGUI::SQL->read("select * from page where parentId=5");
|
$sth = WebGUI::SQL->read("select * from page where parentId=5");
|
||||||
|
|
@ -71,15 +71,15 @@ sub www_selectPackageToDeploy {
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
$output .= WebGUI::International::get(377) unless $flag;
|
$output .= WebGUI::International::get(377) unless $flag;
|
||||||
$output .= '</ul>';
|
$output .= '</ul>';
|
||||||
return $output;
|
return $output;
|
||||||
} else {
|
} else {
|
||||||
return WebGUI::Privilege::insufficient();
|
return WebGUI::Privilege::insufficient();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub www_deployPackage {
|
sub www_deployPackage {
|
||||||
if (WebGUI::Privilege::canEditPage()) {
|
if (WebGUI::Privilege::canEditPage()) {
|
||||||
_recursePageTree($session{form}{pid},$session{page}{pageId});
|
_recursePageTree($session{form}{pid},$session{page}{pageId});
|
||||||
return "";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue