Handle linking to posts not on the first page on a thread view. Fixes bug #11318.

This commit is contained in:
Colin Kuskie 2010-01-05 20:52:27 -08:00
parent 7281a3dd8e
commit 173bec1574
3 changed files with 31 additions and 11 deletions

View file

@ -495,6 +495,33 @@ sub getDeleteUrl {
return $self->getUrl("func=delete;revision=".$self->get("revisionDate"));
}
#-------------------------------------------------------------------
=head2 getDirectLinkUrl ( )
Returns the URL for this Post, which links directly to its anchor and page.
=cut
sub getDirectLinkUrl {
my $self = shift;
my $url;
my $page_size = $self->getThread->getParent->get('postsPerPage');
my $place = $self->getRank+1;
my $page = int($place/$page_size) + 1;
my $page_frag = 'pn='.$page;
if ($self->get("status") eq "pending") {
$url = $self->getUrl($page_frag.";revision=".$self->get("revisionDate"));
}
else {
$url = $self->getUrl($page_frag);
}
$url .= "#id".$self->getId;
return $url;
}
#-------------------------------------------------------------------
=head2 getEditUrl ( )