more bug fixes
This commit is contained in:
parent
a3e4cf1dd3
commit
7fae1e435d
3 changed files with 15 additions and 16 deletions
|
|
@ -678,7 +678,7 @@ sub processPropertiesFromFormPost {
|
|||
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
my $sth = WebGUI::SQL->read("select storageId from FileAsset where assetId=".quote($self->getId));
|
||||
my $sth = WebGUI::SQL->read("select storageId from Post where assetId=".quote($self->getId));
|
||||
while (my ($storageId) = $sth->array) {
|
||||
WebGUI::Storage->get($storageId)->delete;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,9 +179,8 @@ sub getNextThread {
|
|||
my $self = shift;
|
||||
unless (exists $self->{_next}) {
|
||||
my $sortBy = $self->getParent->getValue("sortBy");
|
||||
$self->{_next} = WebGUI::Asset::Post->newByPropertyHashRef(
|
||||
WebGUI::SQL->quickHashRef("
|
||||
select *
|
||||
my ($id, $class, $version) = WebGUI::SQL->quickHashRef("
|
||||
select asset.assetId,asset.className,assetData.revisionDate
|
||||
from Thread
|
||||
left join asset on asset.assetId=Thread.assetId
|
||||
left join assetData on assetData.assetId=Thread.assetId and assetData.revisionDate=Thread.revisionDate
|
||||
|
|
@ -197,8 +196,8 @@ sub getNextThread {
|
|||
)
|
||||
group by assetData.assetId
|
||||
order by ".$sortBy." asc
|
||||
",WebGUI::SQL->getSlave)
|
||||
);
|
||||
",WebGUI::SQL->getSlave);
|
||||
$self->{_next} = WebGUI::Asset::Post->new($id,$class,$version);
|
||||
delete $self->{_next} unless ($self->{_next}->{_properties}{className} =~ /Thread/);
|
||||
};
|
||||
return $self->{_next};
|
||||
|
|
@ -218,8 +217,8 @@ sub getPreviousThread {
|
|||
my $self = shift;
|
||||
unless (exists $self->{_previous}) {
|
||||
my $sortBy = $self->getParent->getValue("sortBy");
|
||||
$self->{_previous} = WebGUI::Asset::Post->newByPropertyHashRef(
|
||||
WebGUI::SQL->quickHashRef(" select *
|
||||
my ($id, $class, $version) = WebGUI::SQL->quickHashRef("
|
||||
select asset.assetId,asset.className,assetData.revisionDate
|
||||
from Thread
|
||||
left join asset on asset.assetId=Thread.assetId
|
||||
left join assetData on assetData.assetId=Thread.assetId and assetData.revisionDate=Thread.revisionDate
|
||||
|
|
@ -234,8 +233,8 @@ sub getPreviousThread {
|
|||
or (assetData.ownerUserId=".quote($session{user}{userId})." and assetData.ownerUserId<>'1')
|
||||
)
|
||||
group by assetData.assetId
|
||||
order by ".$sortBy." desc ",WebGUI::SQL->getSlave)
|
||||
);
|
||||
order by ".$sortBy." desc ",WebGUI::SQL->getSlave);
|
||||
$self->{_previous} = WebGUI::Asset::Post->new($id,$class,$version);
|
||||
delete $self->{_previous} unless ($self->{_previous}->{_properties}{className} =~ /Thread/);
|
||||
};
|
||||
return $self->{_previous};
|
||||
|
|
@ -626,9 +625,8 @@ sub view {
|
|||
$var->{'unlock.url'} = $self->getUnlockUrl;
|
||||
|
||||
my $p = WebGUI::Paginator->new($self->getUrl,$self->getParent->get("postsPerPage"));
|
||||
my $sql = "select * from asset
|
||||
my $sql = "select asset.assetId, asset.className, assetData.revisionDate from asset
|
||||
left join assetData on assetData.assetId=asset.assetId
|
||||
left join Thread on Thread.assetId=assetData.assetId and assetData.revisionDate=Thread.revisionDate
|
||||
left join Post on Post.assetId=assetData.assetId and assetData.revisionDate=Post.revisionDate
|
||||
where asset.lineage like ".quote($self->get("lineage").'%')
|
||||
." and asset.state='published'
|
||||
|
|
@ -649,7 +647,7 @@ sub view {
|
|||
$currentPageUrl =~ s/^\///;
|
||||
$p->setDataByQuery($sql, undef, undef, undef, "url", $currentPageUrl);
|
||||
foreach my $dataSet (@{$p->getPageData()}) {
|
||||
my $reply = WebGUI::Asset::Post->newByPropertyHashRef($dataSet);
|
||||
my $reply = WebGUI::Asset::Post->new($dataSet->{assetId}, $dataSet->{className}, $dataSet->{revisionDate});
|
||||
$reply->{_thread} = $self; # caching thread for better performance
|
||||
my %replyVars = %{$reply->getTemplateVars};
|
||||
$replyVars{isCurrent} = ($reply->get("url") eq $currentPageUrl);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ sub appendPostListTemplateVars {
|
|||
my $page = $p->getPageData;
|
||||
my $i = 0;
|
||||
foreach my $row (@$page) {
|
||||
my $post = WebGUI::Asset::Wobject::Collaboration->newByPropertyHashRef($row);
|
||||
#my $post = WebGUI::Asset::Wobject::Collaboration->newByPropertyHashRef($row);
|
||||
my $post = WebGUI::Asset::Wobject::Collaboration->new($row->{assetId}, $row->{className}, $row->{revisionDate});
|
||||
$post->{_parent} = $self; # caching parent for efficiency
|
||||
my $controls = deleteIcon('func=delete',$post->get("url"),"Delete").editIcon('func=edit',$post->get("url"));
|
||||
if ($self->get("sortBy") eq "lineage") {
|
||||
|
|
@ -903,7 +904,7 @@ sub view {
|
|||
$constraints .= " or assetData.status='pending'";
|
||||
}
|
||||
$constraints .= ")";
|
||||
my $sql = "select *
|
||||
my $sql = "select asset.assetId,asset.className,assetData.revisionDate
|
||||
from Thread
|
||||
left join asset on Thread.assetId=asset.assetId
|
||||
left join Post on Post.assetId=Thread.assetId and Thread.revisionDate = Post.revisionDate
|
||||
|
|
@ -1030,7 +1031,7 @@ sub www_search {
|
|||
}
|
||||
# please note that the SQL generated here-in is not for the feint of heart, mind, or stomach
|
||||
# this is for trained professionals only and should not be attempted at home
|
||||
my $sql = "select *
|
||||
my $sql = "select asset.assetId, asset.className, assetData.revisionDate
|
||||
from asset
|
||||
left join assetData on assetData.assetId=asset.assetId
|
||||
left join Thread on Thread.assetId=assetData.assetId and assetData.revisionDate = Thread.revisionDate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue