fix: Next/Previous links on thread not sorted same as collab
This commit is contained in:
parent
7042946bdf
commit
749f68a0ee
3 changed files with 42 additions and 6 deletions
|
|
@ -73,6 +73,8 @@
|
|||
http://www.webgui.org/bugs/tracker/editing-a-template-sometimes-fails
|
||||
- fix: CSS dragTrigger: multiple identical ID's on every page
|
||||
http://www.webgui.org/bugs/tracker/css-dragtrigger-multiple-identical-ids-on-every-page
|
||||
- fix: Next/Previous links on thread not sorted same as collab
|
||||
http://www.webgui.org/bugs/tracker/next/previous-not-sorted-same-as-collab
|
||||
|
||||
7.3.19
|
||||
- Fixed a formatting problem in the workflow editor screen.
|
||||
|
|
|
|||
|
|
@ -237,7 +237,9 @@ Returns a thread object for the next (newer) thread in the same forum.
|
|||
sub getNextThread {
|
||||
my $self = shift;
|
||||
unless (defined $self->{_next}) {
|
||||
my $sortBy = $self->getParent->getValue("sortBy");
|
||||
my $parent = $self->getParent;
|
||||
my $sortBy = $parent->getSortBy;
|
||||
my $sortOrder = $parent->getSortOrder;
|
||||
my ($id, $class, $version) = $self->session->dbSlave->quickArray("
|
||||
select asset.assetId,asset.className,max(assetData.revisionDate)
|
||||
from Thread
|
||||
|
|
@ -247,14 +249,14 @@ sub getNextThread {
|
|||
where asset.parentId=".$self->session->db->quote($self->get("parentId"))."
|
||||
and asset.state='published'
|
||||
and asset.className='WebGUI::Asset::Post::Thread'
|
||||
and ".$sortBy.">".$self->session->db->quote($self->get($sortBy))."
|
||||
and ".$sortBy.($sortOrder eq 'asc' ? '>' : '<').$self->session->db->quote($self->get($sortBy))."
|
||||
and (
|
||||
assetData.status in ('approved','archived')
|
||||
or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag"))."
|
||||
or (assetData.ownerUserId=".$self->session->db->quote($self->session->user->userId)." and assetData.ownerUserId<>'1')
|
||||
)
|
||||
group by assetData.assetId
|
||||
order by ".$sortBy." asc
|
||||
order by ".$sortBy." ".$sortOrder."
|
||||
");
|
||||
$self->{_next} = WebGUI::Asset->new($self->session, $id,$class,$version);
|
||||
# delete $self->{_next} unless ($self->{_next}->{_properties}{className} =~ /Thread/);
|
||||
|
|
@ -288,7 +290,9 @@ Returns a thread object for the previous (older) thread in the same forum.
|
|||
sub getPreviousThread {
|
||||
my $self = shift;
|
||||
unless (defined $self->{_previous}) {
|
||||
my $sortBy = $self->getParent->getValue("sortBy");
|
||||
my $parent = $self->getParent;
|
||||
my $sortBy = $parent->getSortBy;
|
||||
my $sortOrder = lc($parent->getSortOrder) eq 'asc' ? 'desc' : 'asc';
|
||||
my ($id, $class, $version) = $self->session->dbSlave->quickArray("
|
||||
select asset.assetId,asset.className,max(assetData.revisionDate)
|
||||
from Thread
|
||||
|
|
@ -298,14 +302,14 @@ sub getPreviousThread {
|
|||
where asset.parentId=".$self->session->db->quote($self->get("parentId"))."
|
||||
and asset.state='published'
|
||||
and asset.className='WebGUI::Asset::Post::Thread'
|
||||
and ".$sortBy."<".$self->session->db->quote($self->get($sortBy))."
|
||||
and ".$sortBy.($sortOrder eq 'asc' ? '>' : '<').$self->session->db->quote($self->get($sortBy))."
|
||||
and (
|
||||
assetData.status in ('approved','archived')
|
||||
or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag"))."
|
||||
or (assetData.ownerUserId=".$self->session->db->quote($self->session->user->userId)." and assetData.ownerUserId<>'1')
|
||||
)
|
||||
group by assetData.assetId
|
||||
order by ".$sortBy." desc, assetData.revisionDate desc ");
|
||||
order by ".$sortBy." ".$sortOrder.", assetData.revisionDate desc ");
|
||||
$self->{_previous} = WebGUI::Asset::Post::Thread->new($self->session, $id,$class,$version);
|
||||
# delete $self->{_previous} unless ($self->{_previous}->{_properties}{className} =~ /Thread/);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -828,6 +828,36 @@ sub getSortByUrl {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getSortBy
|
||||
|
||||
Retrieves the field to sort by
|
||||
|
||||
=cut
|
||||
|
||||
sub getSortBy {
|
||||
my $self = shift;
|
||||
my $scratchSortBy = $self->getId."_sortBy";
|
||||
my $sortBy = $self->session->scratch->get($scratchSortBy) || $self->getValue("sortBy");
|
||||
return $sortBy;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getSortOrder
|
||||
|
||||
Retrieves the direction to sort in
|
||||
|
||||
=cut
|
||||
|
||||
sub getSortOrder {
|
||||
my $self = shift;
|
||||
my $scratchSortOrder = $self->getId."_sortDir";
|
||||
my $sortOrder = $self->session->scratch->get($scratchSortOrder) || $self->getValue("sortOrder");
|
||||
return $sortOrder;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getSubscribeUrl ( )
|
||||
|
||||
Formats the url to subscribe to the forum.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue