several bug fixes

This commit is contained in:
JT Smith 2005-03-03 17:27:32 +00:00
parent c29c81be23
commit 1efa40e257
5 changed files with 122 additions and 76 deletions

View file

@ -10,6 +10,10 @@
- Fixed a password timeout bug caused by the change in the interval method.
- Removed the depricated fileSize property from the File asset.
- Fixed a user profile editing bug.
- bugfix [ 1151462 ] missing slash in form URL
- bugfix [ 1155826 ] Forum After update has doble posts
- bugfix [ 1154990 ] lost "get" in code (Collaboration)
- bugfix [ 1154269 ] empty trash doesn't work
6.3.0

View file

@ -2411,7 +2411,7 @@ sub migrateForum {
# we're going to give up hierarchy during the upgrade for the sake of simplicity
print "\t\t\t\t\t\t Migrating posts for thread ".$thread->{forumThreadId}."\n";
my %oldestThreadPost;
my $posts = WebGUI::SQL->read("select * from forumPost where forumThreadId=".quote($thread->{forumThreadId})." and parentId<>'' and forumPost.status<>'deleted'");
my $posts = WebGUI::SQL->read("select * from forumPost where forumThreadId=".quote($thread->{forumThreadId})." and parentId<>0 and forumPost.status<>'deleted'");
my $postRank = 1;
if ($posts->errorCode>0) {
print "\t\t\t\tWARNING: There was a problem migrating the posts for ".$thread->{forumThreadId}."\n";

View file

@ -259,7 +259,7 @@ sub cascadeLineage {
my $oldLineage = shift || $self->get("lineage");
WebGUI::Cache->new($self->getId)->deleteByRegex(/^asset_/);
WebGUI::Cache->new($self->getId)->deleteByRegex(/^lineage_$oldLineage/);
WebGUI::SQL->write("update asset set lineage=concat(".quote($newLineage).", substring(lineage from ".(length($oldLineage)+1)."))
WebGUI::SQL->write("update asset set lineage=concat(".quote($newLineage).", lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=".time().", substring(lineage from ".(length($oldLineage)+1)."))
where lineage like ".quote($oldLineage.'%'));
}
@ -304,8 +304,8 @@ Removes asset from lineage, places it in clipboard state. The "gap" in the linea
sub cut {
my $self = shift;
WebGUI::SQL->beginTransaction;
WebGUI::SQL->write("update asset set state='limbo' where lineage like ".quote($self->get("lineage").'%'));
WebGUI::SQL->write("update asset set state='clipboard' where assetId=".quote($self->getId));
WebGUI::SQL->write("update asset set state='limbo', lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=".time()." where lineage like ".quote($self->get("lineage").'%'));
WebGUI::SQL->write("update asset set state='clipboard', lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=".time()." where assetId=".quote($self->getId));
WebGUI::SQL->commit;
$self->updateHistory("cut");
$self->{_properties}{state} = "clipboard";
@ -809,7 +809,7 @@ sub getAssetsInClipboard {
my $userId = shift || $session{user}{userId};
my @assets;
my $limit;
unless ($limitToUser) {
if ($limitToUser) {
$limit = "and lastUpdatedBy=".quote($userId);
}
my $sth = WebGUI::SQL->read("select assetId, title, className from asset where state='clipboard' $limit order by lastUpdated desc");
@ -846,7 +846,7 @@ sub getAssetsInTrash {
my $userId = shift || $session{user}{userId};
my @assets;
my $limit;
unless ($limitToUser) {
if ($limitToUser) {
$limit = "and lastUpdatedBy=".quote($userId);
}
my $sth = WebGUI::SQL->read("select assetId, title, className from asset where state='trash' $limit order by lastUpdated desc");
@ -1137,7 +1137,47 @@ An array reference of relatives to retrieve. Valid parameters are "siblings", "c
=head3 rules
A hash reference comprising limits to relative listing. Variables to rules include endingLineageLength, assetToPedigree, excludeClasses, returnQuickReadObjects, returnObjects, invertTree, includeOnlyClasses, joinClass, and whereClause. There is no real reason to use a joinClass without a whereClause, but it's trivial to use a whereClause if you don't use a joinClass. You will only be able to filter on the asset table, however.
A hash reference comprising modifiers to relative listing. Rules include:
=head4 statesToInclude
An array reference containing a list of states that should be returned. Defaults to 'published'. Options include 'published', 'trash', 'cliboard', and 'limbo'.
=head4 endingLineageLength
An integer limiting the length of the lineages of the assets to be returned. This can help limit levels of depth in the asset tree.
=head4 assetToPedigree
An asset object reference to draw a pedigree from. A pedigree includes ancestors, siblings, descendants and other information. It's specifically used in flexing navigations.
=head4 excludeClasses
An array reference containing a list of asset classes to remove from the result set. The opposite of the includOnlyClasses rule.
=head4 returnQuickReadObjects
A boolean indicating that we should return objects that contain only base asset information rather than asset ids. This is mainly useful for navigation, clipboard, trash, and other system level functions.
=head4 returnObjects
A boolean indicating that we should return objects rather than asset ids.
=head4 invertTree
A boolean indicating whether the resulting asset tree should be returned in reverse order.
=head4 includeOnlyClasses
An array reference containing a list of asset classes to include in the result. If this is specified then no other classes except these will be returned. The opposite of the excludeClasses rule.
=head4 joinClass
An array reference containing asset classes to join in. There is no real reason to use a joinClass without a whereClause, but it's trivial to use a whereClause if you don't use a joinClass. You will only be able to filter on the asset table, however.
=head4 whereClause
A string containing extra where clause information for the query.
=cut
@ -1193,6 +1233,7 @@ sub getLineage {
}
# formulate a where clause
my $where = "state='published'";
$where = "state in (".quoteAndJoin($rules->{statesToInclude}).")" if (exists $rules->{statesToInclude});
if (exists $rules->{excludeClasses}) { # deal with exclusions
my @set;
foreach my $className (@{$rules->{excludeClasses}}) {
@ -1754,7 +1795,7 @@ Sets Asset properties state to published.
sub republish {
my $self = shift;
WebGUI::SQL->write("update asset set state='published' where lineage like ".quote($self->get("lineage").'%'));
WebGUI::SQL->write("update asset set state='published', lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=".time()." where lineage like ".quote($self->get("lineage").'%'));
$self->{_properties}{state} = "published";
}
@ -1921,7 +1962,7 @@ Returns 1. Purges self and all descendants.
sub purgeTree {
my $self = shift;
my $descendants = $self->getLineage(["self","descendants"],{returnObjects=>1, invertTree=>1});
my $descendants = $self->getLineage(["self","descendants"],{returnObjects=>1, invertTree=>1, statesToInclude=>['trash','limbo']});
foreach my $descendant (@{$descendants}) {
$descendant->purge;
}
@ -1951,7 +1992,7 @@ sub setParent {
my $lineage = $parent->get("lineage").$parent->getNextChildRank;
return 0 if ($lineage =~ m/^$oldLineage/); # can't move it to its own child
WebGUI::SQL->beginTransaction;
WebGUI::SQL->write("update asset set parentId=".quote($parent->getId)." where assetId=".quote($self->getId));
WebGUI::SQL->write("update asset set parentId=".quote($parent->getId).", lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=".time()." where assetId=".quote($self->getId));
$self->cascadeLineage($lineage);
WebGUI::SQL->commit;
$self->updateHistory("moved to parent ".$parent->getId);
@ -2019,7 +2060,7 @@ sub setSize {
foreach my $key (keys %{$self->get}) {
$sizetest .= $self->get($key);
}
WebGUI::SQL->write("update asset set assetSize=".(length($sizetest)+$extra)." where assetId=".quote($self->getId));
WebGUI::SQL->write("update asset set assetSize=".(length($sizetest)+$extra).", lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=".time()." where assetId=".quote($self->getId));
}
#-------------------------------------------------------------------
@ -2059,8 +2100,8 @@ Removes asset from lineage, places it in trash state. The "gap" in the lineage i
sub trash {
my $self = shift;
WebGUI::SQL->beginTransaction;
WebGUI::SQL->write("update asset set state='limbo' where lineage like ".quote($self->get("lineage").'%'));
WebGUI::SQL->write("update asset set state='trash' where assetId=".quote($self->getId));
WebGUI::SQL->write("update asset set state='limbo', lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=".time()." where lineage like ".quote($self->get("lineage").'%'));
WebGUI::SQL->write("update asset set state='trash', lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=".time()." where assetId=".quote($self->getId));
WebGUI::SQL->commit;
$self->{_properties}{state} = "trash";
$self->updateHistory("trashed");
@ -2104,6 +2145,7 @@ sub update {
my @setPairs;
if ($definition->{tableName} eq "asset") {
push(@setPairs,"lastUpdated=".time());
push(@setPairs,"lastUpdatedBy=".quote($session{user}{userId}));
}
foreach my $property (keys %{$definition->{properties}}) {
next unless (exists $properties->{$property});
@ -2748,7 +2790,7 @@ sub www_emptyClipboard {
my $self = shift;
my $ac = WebGUI::AdminConsole->new("clipboard");
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(4));
foreach my $assetData (@{$self->getAssetsInClipboard($session{form}{systemClipboard} && WebGUI::Grouping::isInGroup(3))}) {
foreach my $assetData (@{$self->getAssetsInClipboard(!($session{form}{systemClipboard} && WebGUI::Grouping::isInGroup(3)))}) {
my $asset = WebGUI::Asset->newByDynamicClass($assetData->{assetId},$assetData->{className});
$asset->trash;
}
@ -2767,7 +2809,7 @@ sub www_emptyTrash {
my $self = shift;
my $ac = WebGUI::AdminConsole->new("trash");
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(4));
foreach my $assetData (@{$self->getAssetsInTrash($session{form}{systemTrash} && WebGUI::Grouping::isInGroup(3))}) {
foreach my $assetData (@{$self->getAssetsInTrash(!($session{form}{systemTrash} && WebGUI::Grouping::isInGroup(3)))}) {
my $asset = WebGUI::Asset->newByDynamicClass($assetData->{assetId},$assetData->{className});
$asset->purgeTree;
}

View file

@ -100,60 +100,60 @@ sub appendTemplateLabels {
$var->{"addquestion.label"} = $i18n->get("addquestion");
$var->{'all.label'} = $i18n->get("all");
$var->{'atleastone.label'} = $i18n->get("atleastone");
$var->{"approve.label"} = $i18n->("approve");
$var->{'answer.label'} = $i18n->("answer");
$var->{'attachment.label'} = $i18n->("attachment");
$var->{"by.label"} = $i18n->("by");
$var->{'body.label'} = $i18n->("body");
$var->{"back.label"} = $i18n->("back");
$var->{'contentType.label'} = $i18n->("contentType");
$var->{"date.label"} = $i18n->("date");
$var->{"delete.label"} = $i18n->("delete");
$var->{'description.label'} = $i18n->("description");
$var->{"deny.label"} = $i18n->("deny");
$var->{"edit.label"} = $i18n->("edit");
$var->{'endDate.label'} = $i18n->("endDate");
$var->{'exactphrase.label'} = $i18n->("exactPhrase");
$var->{"layout.flat.label"} = $i18n->("flatLayout");
$var->{'image.label'} = $i18n->("image");
$var->{'link.header.label'} = $i18n->("edit link");
$var->{"lastReply.label"} = $i18n->("lastReply");
$var->{"lock.label"} = $i18n->("lock");
$var->{"layout.label"} = $i18n->("layout");
$var->{'message.header.label'} = $i18n->("edit message");
$var->{'message.label'} = $i18n->("message");
$var->{"next.label"} = $i18n->("next");
$var->{'newWindow.label'} = $i18n->("new window");
$var->{"layout.nested.label"} = $i18n->("nested");
$var->{"previous.label"} = $i18n->("previous");
$var->{"post.label"} = $i18n->("post");
$var->{'question.label'} = $i18n->("question");
$var->{'question.header.label'} = $i18n->("edit question");
$var->{"rating.label"} = $i18n->("rating");
$var->{"rate.label"} = $i18n->("rate");
$var->{"reply.label"} = $i18n->("reply");
$var->{"replies.label"} = $i18n->("replies");
$var->{"readmore.label"} = $i18n->("read more");
$var->{"responses.label"} = $i18n->("responses");
$var->{'results.label'} = $i18n->("results");
$var->{"search.label"} = $i18n->("search");
$var->{'subject.label'} = $i18n->("subject");
$var->{"subscribe.label"} = $i18n->("subscribe");
$var->{'submission.header.label'} = $i18n->("edit submission");
$var->{'startDate.label'} = $i18n->("start date");
$var->{"stick.label"} = $i18n->("sticky");
$var->{"status.label"} = $i18n->("status");
$var->{"thumbnail.label"} = $i18n->("thumbnail");
$var->{"title.label"} = $i18n->("title");
$var->{"layout.threaded.label"} = $i18n->("threaded");
$var->{"unlock.label"} = $i18n->("unlock");
$var->{"unstick.label"} = $i18n->("unstick");
$var->{"unsubscribe.label"} = $i18n->("unsubscribe");
$var->{'url.label'} = $i18n->("url");
$var->{"user.label"} = $i18n->("user");
$var->{"views.label"} = $i18n->("views");
$var->{'visitorName.label'} = $i18n->("visitor");
$var->{'without.label'} = $i18n->("without");
$var->{"approve.label"} = $i18n->get("approve");
$var->{'answer.label'} = $i18n->get("answer");
$var->{'attachment.label'} = $i18n->get("attachment");
$var->{"by.label"} = $i18n->get("by");
$var->{'body.label'} = $i18n->get("body");
$var->{"back.label"} = $i18n->get("back");
$var->{'contentType.label'} = $i18n->get("contentType");
$var->{"date.label"} = $i18n->get("date");
$var->{"delete.label"} = $i18n->get("delete");
$var->{'description.label'} = $i18n->get("description");
$var->{"deny.label"} = $i18n->get("deny");
$var->{"edit.label"} = $i18n->get("edit");
$var->{'endDate.label'} = $i18n->get("endDate");
$var->{'exactphrase.label'} = $i18n->get("exactPhrase");
$var->{"layout.flat.label"} = $i18n->get("flatLayout");
$var->{'image.label'} = $i18n->get("image");
$var->{'link.header.label'} = $i18n->get("edit link");
$var->{"lastReply.label"} = $i18n->get("lastReply");
$var->{"lock.label"} = $i18n->get("lock");
$var->{"layout.label"} = $i18n->get("layout");
$var->{'message.header.label'} = $i18n->get("edit message");
$var->{'message.label'} = $i18n->get("message");
$var->{"next.label"} = $i18n->get("next");
$var->{'newWindow.label'} = $i18n->get("new window");
$var->{"layout.nested.label"} = $i18n->get("nested");
$var->{"previous.label"} = $i18n->get("previous");
$var->{"post.label"} = $i18n->get("post");
$var->{'question.label'} = $i18n->get("question");
$var->{'question.header.label'} = $i18n->get("edit question");
$var->{"rating.label"} = $i18n->get("rating");
$var->{"rate.label"} = $i18n->get("rate");
$var->{"reply.label"} = $i18n->get("reply");
$var->{"replies.label"} = $i18n->get("replies");
$var->{"readmore.label"} = $i18n->get("read more");
$var->{"responses.label"} = $i18n->get("responses");
$var->{'results.label'} = $i18n->get("results");
$var->{"search.label"} = $i18n->get("search");
$var->{'subject.label'} = $i18n->get("subject");
$var->{"subscribe.label"} = $i18n->get("subscribe");
$var->{'submission.header.label'} = $i18n->get("edit submission");
$var->{'startDate.label'} = $i18n->get("start date");
$var->{"stick.label"} = $i18n->get("sticky");
$var->{"status.label"} = $i18n->get("status");
$var->{"thumbnail.label"} = $i18n->get("thumbnail");
$var->{"title.label"} = $i18n->get("title");
$var->{"layout.threaded.label"} = $i18n->get("threaded");
$var->{"unlock.label"} = $i18n->get("unlock");
$var->{"unstick.label"} = $i18n->get("unstick");
$var->{"unsubscribe.label"} = $i18n->get("unsubscribe");
$var->{'url.label'} = $i18n->get("url");
$var->{"user.label"} = $i18n->get("user");
$var->{"views.label"} = $i18n->get("views");
$var->{'visitorName.label'} = $i18n->get("visitor");
$var->{'without.label'} = $i18n->get("without");
}
#-------------------------------------------------------------------

View file

@ -190,37 +190,37 @@ A conditional indicating whether there is more than one forum.
'76' => {
message => q|Are you certain you wish to delete this forum and all the posts it contains?|,
lastUpdated => 1066055963
}
},
'title' => {
message => q|Title|,
lastUpdated => 1109806115,
}
},
'views' => {
message => q|Views|,
lastUpdated => 1109806115,
}
},
'rating' => {
message => q|Rating|,
lastUpdated => 1109806115,
}
},
'threads' => {
message => q|Threads|,
lastUpdated => 1109806115,
}
},
'replies' => {
message => q|Replies|,
lastUpdated => 1109806115,
}
},
'lastpost' => {
message => q|Last Post|,
lastUpdated => 1109806115,
}
},
};