From e3e24b37b094aaf515a99639a0134dd3e7a2ffc5 Mon Sep 17 00:00:00 2001 From: David Delikat Date: Thu, 29 Jan 2009 17:45:52 +0000 Subject: [PATCH] fixed #9596: Articles now use a semi-unique pagination variable based on asset id also restored the 'synopsis = first page' feature in Asset::Post::getSynopsisAndContent --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Post.pm | 2 ++ lib/WebGUI/Asset/Wobject/Article.pm | 16 +++++++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index f144a162c..2d4de1205 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,4 +1,5 @@ 7.6.11 + - fixed #9596: Articles now use a semi-unique pagination variable based on asset id - fixed: Syndicated Content asset doesn't work with feeds that specify their encodings via HTTP headers - fixed #9375: Syndicated Content asset improperly decodes wide XML entities - fixed #9592: DataForm deleteAttachedFiles method can crash diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index 1304dbaf4..fa8669fe2 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -550,6 +550,8 @@ sub getSynopsisAndContent { my $body = shift; unless ($synopsis) { my @content; + if( $body =~ /\^\-\;/ ) { + @content = split(/\^\-\;/, $body ,2); if( $body =~ /

/ ) { @content = WebGUI::HTML::splitTag($body); } else { diff --git a/lib/WebGUI/Asset/Wobject/Article.pm b/lib/WebGUI/Asset/Wobject/Article.pm index fc9988ec2..210e1f2bf 100644 --- a/lib/WebGUI/Asset/Wobject/Article.pm +++ b/lib/WebGUI/Asset/Wobject/Article.pm @@ -332,7 +332,7 @@ sub view { $var{"description.first.2sentences"} =~ s/^((.*?\.){2}).*/$1/s; $var{"description.first.sentence"} = $var{"description.first.2sentences"}; $var{"description.first.sentence"} =~ s/^(.*?\.).*/$1/s; - my $p = WebGUI::Paginator->new($self->session,$self->getUrl,1); + my $p = WebGUI::Paginator->new($self->session,$self->getUrl,1,$self->paginateVar); if ($self->session->form->process("makePrintable") || $var{description} eq "") { $var{description} =~ s/\^\-\;//g; $p->setDataByArrayRef([$var{description}]); @@ -351,6 +351,20 @@ sub view { #------------------------------------------------------------------- +=head2 paginateVar ( ) + +create a semi-unique variable for pagination based on the Asset Id + +=cut + +sub paginateVar { + my $self = shift; + my $id = $self->getId(); + return 'pn' . substr($id,0,2) . substr($id,-2,2) ; +} + +#------------------------------------------------------------------- + =head2 www_deleteFile ( ) Deletes and attached file.