couple of last minute bug fixes

This commit is contained in:
JT Smith 2005-03-19 22:47:29 +00:00
parent dac3c8f402
commit d0181c10ba
4 changed files with 26 additions and 24 deletions

View file

@ -30,4 +30,6 @@ update template set template='<a name=\"<tmpl_var assetId>\"></a> \r\n<tmpl_if s
update template set template='<a name=\"<tmpl_var assetId>\"></a> \r\n<tmpl_if session.var.adminOn> \r\n <p><tmpl_var controls></p> \r\n</tmpl_if>\r\n\r\n<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <tmpl_var description>\r\n</tmpl_if>\r\n\r\n\r\n<p>\r\n <tmpl_if user.canPost>\r\n <a href=\"<tmpl_var add.url>\"><tmpl_var add.label></a>\r\n &bull;\r\n </tmpl_if>\r\n <tmpl_unless user.isVisitor>\r\n <tmpl_if user.isSubscribed>\r\n <a href=\"<tmpl_var unsubscribe.url>\"><tmpl_var unsubscribe.label></a>\r\n <tmpl_else>\r\n <a href=\"<tmpl_var subscribe.url>\"><tmpl_var subscribe.label></a>\r\n </tmpl_if>\r\n &bull;\r\n </tmpl_unless>\r\n <a href=\"<tmpl_var search.url>\"><tmpl_var search.label></a>\r\n</p>\r\n\r\n<style type=\"text/css\">\r\n.weblogTitleBar {\r\n font-weight: bold;\r\n font-size: 14px;\r\n}\r\n.weblogLegend {\r\n font-size: 9px;\r\n color: #999999;\r\n}\r\n.weblogReadMore {\r\n text-align: right;\r\n font-size: 9px;\r\n width: 100%;\r\n}\r\n.weblogSynopsis {\r\n border: 1px solid #bbbbbb;\r\n font-size: 13px;\r\n padding: 5px;\r\n -moz-border-radius: 6px;\r\n}\r\n</style>\r\n\r\n<p />\r\n\r\n<tmpl_loop post_loop>\r\n <div class=\"weblogTitleBar\">\r\n <tmpl_var title> \r\n </div>\r\n <fieldset class=\"weblogSynopsis\">\r\n <legend class=\"weblogLegend\" align=\"left\">\r\n <tmpl_var by.label> <a href=\"<tmpl_var userProfile.url>\"><tmpl_var username></a> \r\n - \r\n <tmpl_var dateSubmitted.human>\r\n <tmpl_if replies>\r\n - <tmpl_var replies> <tmpl_var replies.label>\r\n </tmpl_if>\r\n <tmpl_if user.isPoster>\r\n - <tmpl_var status>\r\n <tmpl_else>\r\n <tmpl_if user.isModerator>\r\n - <tmpl_var status>\r\n </tmpl_if>\r\n </tmpl_if>\r\n </legend>\r\n <tmpl_if thumbnail>\r\n <a href=\"<tmpl_var url>\"><img src=\"<tmpl_var thumbnail>\" border=\"0\" alt=\"<tmpl_var title>\" align=\"right\" /></a>\r\n </tmpl_if>\r\n <tmpl_var synopsis>\r\n <div class=\"weblogReadMore\">\r\n <a href=\"<tmpl_var url>\"><tmpl_var readmore.label></a>\r\n </div>\r\n </fieldset>\r\n <p />\r\n</tmpl_loop> \r\n\r\n \r\n\r\n<tmpl_if pagination.pageCount.isMultiple>\r\n <div class=\"pagination\">\r\n <tmpl_var pagination.previousPage> &middot; <tmpl_var pagination.pageList.upTo10> &middot; <tmpl_var pagination.nextPage>\r\n </div>\r\n</tmpl_if>\r\n\r\n ' where assetId='PBtmpl0000000000000112'; update template set template='<a name=\"<tmpl_var assetId>\"></a> \r\n<tmpl_if session.var.adminOn> \r\n <p><tmpl_var controls></p> \r\n</tmpl_if>\r\n\r\n<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <tmpl_var description>\r\n</tmpl_if>\r\n\r\n\r\n<p>\r\n <tmpl_if user.canPost>\r\n <a href=\"<tmpl_var add.url>\"><tmpl_var add.label></a>\r\n &bull;\r\n </tmpl_if>\r\n <tmpl_unless user.isVisitor>\r\n <tmpl_if user.isSubscribed>\r\n <a href=\"<tmpl_var unsubscribe.url>\"><tmpl_var unsubscribe.label></a>\r\n <tmpl_else>\r\n <a href=\"<tmpl_var subscribe.url>\"><tmpl_var subscribe.label></a>\r\n </tmpl_if>\r\n &bull;\r\n </tmpl_unless>\r\n <a href=\"<tmpl_var search.url>\"><tmpl_var search.label></a>\r\n</p>\r\n\r\n<style type=\"text/css\">\r\n.weblogTitleBar {\r\n font-weight: bold;\r\n font-size: 14px;\r\n}\r\n.weblogLegend {\r\n font-size: 9px;\r\n color: #999999;\r\n}\r\n.weblogReadMore {\r\n text-align: right;\r\n font-size: 9px;\r\n width: 100%;\r\n}\r\n.weblogSynopsis {\r\n border: 1px solid #bbbbbb;\r\n font-size: 13px;\r\n padding: 5px;\r\n -moz-border-radius: 6px;\r\n}\r\n</style>\r\n\r\n<p />\r\n\r\n<tmpl_loop post_loop>\r\n <div class=\"weblogTitleBar\">\r\n <tmpl_var title> \r\n </div>\r\n <fieldset class=\"weblogSynopsis\">\r\n <legend class=\"weblogLegend\" align=\"left\">\r\n <tmpl_var by.label> <a href=\"<tmpl_var userProfile.url>\"><tmpl_var username></a> \r\n - \r\n <tmpl_var dateSubmitted.human>\r\n <tmpl_if replies>\r\n - <tmpl_var replies> <tmpl_var replies.label>\r\n </tmpl_if>\r\n <tmpl_if user.isPoster>\r\n - <tmpl_var status>\r\n <tmpl_else>\r\n <tmpl_if user.isModerator>\r\n - <tmpl_var status>\r\n </tmpl_if>\r\n </tmpl_if>\r\n </legend>\r\n <tmpl_if thumbnail>\r\n <a href=\"<tmpl_var url>\"><img src=\"<tmpl_var thumbnail>\" border=\"0\" alt=\"<tmpl_var title>\" align=\"right\" /></a>\r\n </tmpl_if>\r\n <tmpl_var synopsis>\r\n <div class=\"weblogReadMore\">\r\n <a href=\"<tmpl_var url>\"><tmpl_var readmore.label></a>\r\n </div>\r\n </fieldset>\r\n <p />\r\n</tmpl_loop> \r\n\r\n \r\n\r\n<tmpl_if pagination.pageCount.isMultiple>\r\n <div class=\"pagination\">\r\n <tmpl_var pagination.previousPage> &middot; <tmpl_var pagination.pageList.upTo10> &middot; <tmpl_var pagination.nextPage>\r\n </div>\r\n</tmpl_if>\r\n\r\n ' where assetId='PBtmpl0000000000000112';
alter table FileAsset add column templateId varchar(22) not null; alter table FileAsset add column templateId varchar(22) not null;
alter table snippet add column processAsTemplate int not null default 0; alter table snippet add column processAsTemplate int not null default 0;
update Collaboration set sortBy='dateUpdated' where sortBy='';
update Collaboration set sortOrder='desc' where sortOrder='';

View file

@ -1428,7 +1428,7 @@ sub getNextChildRank {
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head getPackageList ( ) =head2 getPackageList ( )
Returns an array of hashes containing title, assetId, and className for all assets defined as packages. Returns an array of hashes containing title, assetId, and className for all assets defined as packages.
@ -1716,7 +1716,7 @@ sub new {
Returns a new Asset object based upon the className. Returns a "notFoundPage" Asset if className is not specified and can't be looked up. Returns a new Asset object based upon the className. Returns a "notFoundPage" Asset if className is not specified and can't be looked up.
=assetId =head3 assetId
Must be a valid assetId Must be a valid assetId

View file

@ -188,6 +188,7 @@ Returns a thread object for the next (newer) thread in the same forum.
sub getNextThread { sub getNextThread {
my $self = shift; my $self = shift;
unless (exists $self->{_next}) { unless (exists $self->{_next}) {
my $sortBy = $self->getParent->getValue("sortBy");
$self->{_next} = WebGUI::Asset::Post->newByPropertyHashRef( $self->{_next} = WebGUI::Asset::Post->newByPropertyHashRef(
WebGUI::SQL->quickHashRef(" WebGUI::SQL->quickHashRef("
select * select *
@ -197,12 +198,12 @@ sub getNextThread {
where asset.parentId=".quote($self->get("parentId"))." where asset.parentId=".quote($self->get("parentId"))."
and asset.state='published' and asset.state='published'
and asset.className='WebGUI::Asset::Post::Thread' and asset.className='WebGUI::Asset::Post::Thread'
and ".$self->getParent->getValue("sortBy").">".quote($self->get($self->getParent->getValue("sortBy")))." and ".$sortBy.">".quote($self->get($sortBy))."
and ( and (
Post.status in ('approved','archived') Post.status in ('approved','archived')
or (asset.ownerUserId=".quote($session{user}{userId})." and asset.ownerUserId<>'1') or (asset.ownerUserId=".quote($session{user}{userId})." and asset.ownerUserId<>'1')
) )
order by ".$self->getParent->getValue("sortBy")." asc order by ".$sortBy." asc
",WebGUI::SQL->getSlave) ",WebGUI::SQL->getSlave)
); );
delete $self->{_next} unless ($self->{_next}->{_properties}{className} =~ /Thread/); delete $self->{_next} unless ($self->{_next}->{_properties}{className} =~ /Thread/);
@ -223,6 +224,7 @@ Returns a thread object for the previous (older) thread in the same forum.
sub getPreviousThread { sub getPreviousThread {
my $self = shift; my $self = shift;
unless (exists $self->{_previous}) { unless (exists $self->{_previous}) {
my $sortBy = $self->getParent->getValue("sortBy");
$self->{_previous} = WebGUI::Asset::Post->newByPropertyHashRef( $self->{_previous} = WebGUI::Asset::Post->newByPropertyHashRef(
WebGUI::SQL->quickHashRef(" select * WebGUI::SQL->quickHashRef(" select *
from Thread from Thread
@ -231,12 +233,12 @@ sub getPreviousThread {
where asset.parentId=".quote($self->get("parentId"))." where asset.parentId=".quote($self->get("parentId"))."
and asset.state='published' and asset.state='published'
and asset.className='WebGUI::Asset::Post::Thread' and asset.className='WebGUI::Asset::Post::Thread'
and ".$self->getParent->getValue("sortBy")."<".quote($self->get($self->getParent->getValue("sortBy")))." and ".$sortBy."<".quote($self->get($sortBy))."
and ( and (
Post.status in ('approved','archived') Post.status in ('approved','archived')
or (asset.ownerUserId=".quote($session{user}{userId})." and asset.ownerUserId<>'1') or (asset.ownerUserId=".quote($session{user}{userId})." and asset.ownerUserId<>'1')
) )
order by ".$self->getParent->getValue("sortBy")." desc ",WebGUI::SQL->getSlave) order by ".$sortBy." desc ",WebGUI::SQL->getSlave)
); );
delete $self->{_previous} unless ($self->{_previous}->{_properties}{className} =~ /Thread/); delete $self->{_previous} unless ($self->{_previous}->{_properties}{className} =~ /Thread/);
}; };

View file

@ -811,19 +811,21 @@ sub unsubscribe {
sub view { sub view {
my $self = shift; my $self = shift;
my $scratchSortBy = $self->getId."_sortBy"; my $scratchSortBy = $self->getId."_sortBy";
my $scratchSortDir = $self->getId."_sortDir"; my $scratchSortOrder = $self->getId."_sortDir";
if($session{scratch}{$scratchSortBy} ne $session{form}{sortBy}){ my $sortBy = $session{form}{sortBy} || $session{scratch}{$scratchSortBy} || $self->get("sortBy");
WebGUI::Session::setScratch($scratchSortBy,$session{form}{sortBy}); my $sortOrder = $session{scratch}{$scratchSortOrder} || $self->get("sortOrder");
WebGUI::Session::setScratch($scratchSortDir, "desc"); if ($sortBy ne $session{scratch}{$scratchSortBy}) {
}else{ WebGUI::Session::setScratch($scratchSortBy,$session{form}{sortBy});
my $sortDir; } elsif ($session{form}{sortBy}) {
if($session{scratch}{$scratchSortDir} eq "asc"){ if ($sortOrder eq "asc") {
$sortDir = "desc"; $sortOrder = "desc";
}else{ } else {
$sortDir = "asc"; $sortOrder = "asc";
} }
WebGUI::Session::setScratch($scratchSortDir, $sortDir); WebGUI::Session::setScratch($scratchSortOrder, $sortOrder);
} }
$sortBy ||= "dateUpdated";
$sortOrder ||= "desc";
my %var; my %var;
$var{'user.canPost'} = $self->canPost; $var{'user.canPost'} = $self->canPost;
$var{"add.url"} = $self->getNewThreadUrl; $var{"add.url"} = $self->getNewThreadUrl;
@ -834,7 +836,7 @@ sub view {
$var{'sortby.title.url'} = $self->getSortByUrl("title"); $var{'sortby.title.url'} = $self->getSortByUrl("title");
$var{'sortby.username.url'} = $self->getSortByUrl("username"); $var{'sortby.username.url'} = $self->getSortByUrl("username");
$var{'sortby.date.url'} = $self->getSortByUrl("dateSubmitted"); $var{'sortby.date.url'} = $self->getSortByUrl("dateSubmitted");
$var{'sortby.lastreply.url'} = $self->getSortByUrl("lastreply"); $var{'sortby.lastreply.url'} = $self->getSortByUrl("dateUpdated");
$var{'sortby.views.url'} = $self->getSortByUrl("views"); $var{'sortby.views.url'} = $self->getSortByUrl("views");
$var{'sortby.replies.url'} = $self->getSortByUrl("replies"); $var{'sortby.replies.url'} = $self->getSortByUrl("replies");
$var{'sortby.rating.url'} = $self->getSortByUrl("rating"); $var{'sortby.rating.url'} = $self->getSortByUrl("rating");
@ -847,16 +849,12 @@ sub view {
$constraints .= " or Post.status='pending'"; $constraints .= " or Post.status='pending'";
} }
$constraints .= ")"; $constraints .= ")";
my $sortBy = $self->getValue("sortBy");
if ($sortBy eq "lastreply") {
$sortBy = "Thread.lastPostDate";
}
my $sql = "select * my $sql = "select *
from Thread from Thread
left join asset on Thread.assetId=asset.assetId left join asset on Thread.assetId=asset.assetId
left join Post on Post.assetId=asset.assetId left join Post on Post.assetId=asset.assetId
where asset.parentId=".quote($self->getId)." and asset.state='published' and asset.className='WebGUI::Asset::Post::Thread' and $constraints where asset.parentId=".quote($self->getId)." and asset.state='published' and asset.className='WebGUI::Asset::Post::Thread' and $constraints
order by ".$sortBy." ".$self->getValue("sortOrder"); order by ".$sortBy." ".$sortOrder;
my $p = WebGUI::Paginator->new($self->getUrl,$self->get("threadsPerPage")); my $p = WebGUI::Paginator->new($self->getUrl,$self->get("threadsPerPage"));
$self->appendPostListTemplateVars(\%var, $sql, $p); $self->appendPostListTemplateVars(\%var, $sql, $p);
$self->appendTemplateLabels(\%var); $self->appendTemplateLabels(\%var);