diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index da0219944..3fcf5e873 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -18,6 +18,7 @@ - fix [ 1265771 ] assets that were formerly packages are still on packageList - fix [ 1177447 ] deployPackage does not retain content pos. (mwilson) - fix [ 1256718 ] Assets disappear after changing page layout (mwilson) + - fix [ 1267326 ] LastPost varibale not updating correctly in Msg Board - fix [ 1262002 ] no "next Thread" or "previous Thread" links (mwilson) - fix [ 1252626 ] navigation relative to current url broken (mwilson) - fix [ 1261994 ] getLineageLength (mwilson) diff --git a/docs/upgrades/upgrade_6.7.1-6.7.2.pl b/docs/upgrades/upgrade_6.7.1-6.7.2.pl index fb96501df..9b3f413b3 100644 --- a/docs/upgrades/upgrade_6.7.1-6.7.2.pl +++ b/docs/upgrades/upgrade_6.7.1-6.7.2.pl @@ -1,55 +1,143 @@ -my $toVersion = "6.7.2"; - -$|=1; #disable output buffering - use lib "../../lib"; -use Getopt::Long; use strict; +use Getopt::Long; use WebGUI::Session; use WebGUI::SQL; use WebGUI::Asset; +my $toVersion = "6.7.2"; my $configFile; my $quiet; -GetOptions( - 'configFile=s'=>\$configFile, - 'quiet'=>\$quiet -); +start(); -WebGUI::Session::open("../..",$configFile); -WebGUI::Session::refreshUserInfo(3); - -WebGUI::SQL->write("insert into webguiVersion values (".quote($toVersion).",'upgrade',".time().")"); -WebGUI::SQL->write("update DataForm_field set type=".quote('TimeField')." where type=".quote('time')); -WebGUI::SQL->write("update userProfileField set dataType=".quote('TimeField')." where dataType=".quote('time')); +fixTimeFields(); fixSpelling(); fixCSTemplate(); +speedUpAdminConsole(); -WebGUI::Session::close(); +finish(); + + +#------------------------------------------------- +sub speedUpAdminConsole { + print "\tMaking admin console load faster.\n" unless ($quiet); + my $template = < + + +
+ +
+
+ +
+
+
+   +
+ + +
+ <tmpl_var title>
+ +
+
+
+
+   +
+
+
+
+
+
+
+
+
+
+
+
+ + >
+
+
+
+
+ ^AdminToggle;
+ ^LoginToggle;
+
+
+
+ + ? + +
+
+ <tmpl_var application.title> +
+
+* +
+
+ <tmpl_var console.title> +
+ + +END + my $asset = WebGUI::Asset->new("PBtmpl0000000000000001","WebGUI::Asset::Template"); + $asset->addRevision({template=>$template})->commit; +} + + +#------------------------------------------------- +sub fixTimeFields { + print "\tFixing time fields.\n" unless ($quiet); + WebGUI::SQL->write("update DataForm_field set type=".quote('TimeField')." where type=".quote('time')); + WebGUI::SQL->write("update userProfileField set dataType=".quote('TimeField')." where dataType=".quote('time')); +} #------------------------------------------------- sub fixCSTemplate { print "\tFixing CS Search template.\n" unless ($quiet); - my $asset = WebGUI::Asset->newByDynamicClass("PBtmpl0000000000000031"); + my $asset = WebGUI::Asset->new("PBtmpl0000000000000031","WebGUI::Asset::Template"); my $template = $asset->get("template"); $template =~ s///ixsg; $template =~ s///ixsg; - $asset->update({template=>$template}); - $asset->commit; + $asset->addRevision({template=>$template})->commit; } #------------------------------------------------- sub fixSpelling { print "\tFixing a few spelling problems.\n" unless ($quiet); - my $asset = WebGUI::Asset->newByDynamicClass("PBtmplCP00000000000001"); - $asset->update({url=>"default_product_template"}); - $asset->commit; - $asset = WebGUI::Asset->newByDynamicClass("PBtmpl0000000000000134"); + my $asset = WebGUI::Asset->new("PBtmplCP00000000000001","WebGUI::Asset::Template"); + $asset->addRevision({url=>"default_product_template"})->commit; + $asset = WebGUI::Asset->new("PBtmpl0000000000000134","WebGUI::Asset::Template"); my $template = $asset->get("template"); $template =~ s/spesify/specify/ixsg; - $asset->update({template=>$template}); - $asset->commit; + $asset->addRevision({template=>$template})->commit; +} + +#------------------------------------------------- +sub start { + $|=1; #disable output buffering + GetOptions( + 'configFile=s'=>\$configFile, + 'quiet'=>\$quiet + ); + WebGUI::Session::open("../..",$configFile); + WebGUI::Session::refreshUserInfo(3); + WebGUI::SQL->write("insert into webguiVersion values (".quote($toVersion).",'upgrade',".time().")"); +} + +#------------------------------------------------- +sub finish { + WebGUI::Session::close(); } diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index ca0978526..294d8e2e4 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -726,30 +726,6 @@ sub rate { } } -#------------------------------------------------------------------- - -=head2 setLastPost ( id, date ) - -Sets the last reply of this thread. - -=head3 id - -The assetId of the most recent post. - -=head3 date - -The date of the most recent post. - -=cut - -sub setLastPost { - my $self = shift; - my $id = shift; - my $date = shift; - $self->update(lastPostId=>$id, lastPostDate=>$date); - $self->getParent->setLastPost($id,$date); -} - #------------------------------------------------------------------- @@ -853,7 +829,7 @@ sub trash { $self->getThread->decrementReplies if ($self->isReply); if ($self->getThread->get("lastPostId") eq $self->getId) { my $threadLineage = $self->getThread->get("lineage"); - my ($id, $date) = WebGUI::SQL->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".quote($threadLineage.'%')." and Post.assetId<>".quote($self->getId)." and asset.assetId=Post.assetId order by Post.dateSubmitted desc"); + my ($id, $date) = WebGUI::SQL->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".quote($threadLineage.'%')." and Post.assetId<>".quote($self->getId)." and asset.assetId=Post.assetId and asset.state='published' order by Post.dateSubmitted desc"); $self->getThread->setLastPost($id,$date); } } diff --git a/lib/WebGUI/Asset/Post/Thread.pm b/lib/WebGUI/Asset/Post/Thread.pm index 18f7be660..16ae9eaf8 100644 --- a/lib/WebGUI/Asset/Post/Thread.pm +++ b/lib/WebGUI/Asset/Post/Thread.pm @@ -465,6 +465,31 @@ sub rate { } +#------------------------------------------------------------------- + +=head2 setLastPost ( id, date ) + +Sets the last reply of this thread. + +=head3 id + +The assetId of the most recent post. + +=head3 date + +The date of the most recent post. + +=cut + +sub setLastPost { + my $self = shift; + my $id = shift; + my $date = shift; + $self->update({lastPostId=>$id, lastPostDate=>$date}); + $self->getParent->setLastPost($id,$date); +} + + #------------------------------------------------------------------- =head setParent ( newParent ) @@ -542,7 +567,7 @@ sub trash { $self->getParent->decrementThreads; if ($self->getParent->get("lastPostId") eq $self->getId) { my $parentLineage = $self->getThread->get("lineage"); - my ($id, $date) = WebGUI::SQL->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".quote($parentLineage.'%')." and Post.assetId<>".quote($self->getId)." and Post.assetId=asset.assetId order by Post.dateSubmitted desc"); + my ($id, $date) = WebGUI::SQL->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".quote($parentLineage.'%')." and Post.assetId<>".quote($self->getId)." and Post.assetId=asset.assetId and asset.state='published' order by Post.dateSubmitted desc"); $self->getParent->setLastPost('','') ? $self->getParent->setLastPost($id,$date) : $id; } }