collaboration system posts now work fully with the workflow engine, including the approval denial process

This commit is contained in:
JT Smith 2006-03-30 23:43:32 +00:00
parent 6a035e44b0
commit 19e4da7a92
5 changed files with 24 additions and 8 deletions

View file

@ -956,6 +956,10 @@ sub www_edit {
name=>"func",
value=>"edit"
})
.WebGUI::Form::hidden($self->session, {
name=>"revision",
value=>$self->session->form->param("revision")
})
.WebGUI::Form::hidden($self->session, {
name=>"ownerUserId",
value=>$self->getValue("ownerUserId")

View file

@ -536,6 +536,14 @@ sub setCollateral {
}
#-------------------------------------------------------------------
=head2 www_edit ()
Returns an edit form for this asset.
=cut
sub www_edit {
my $self = shift;
return $self->session->privilege->insufficient() unless $self->canEdit;

View file

@ -926,17 +926,15 @@ sub view {
$var{"search.url"} = $self->getSearchUrl;
$var{"subscribe.url"} = $self->getSubscribeUrl;
$var{"unsubscribe.url"} = $self->getUnsubscribeUrl;
my $constraints = "(assetData.status='approved' or (assetData.ownerUserId=".$self->session->db->quote($self->session->user->userId)." and assetData.ownerUserId<>'1') or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag"));
if ($var{'user.isModerator'}) {
$constraints .= " or assetData.status='pending'";
}
$constraints .= ")";
my $sql = "select asset.assetId,asset.className,assetData.revisionDate as revisionDate
from Thread
left join asset on Thread.assetId=asset.assetId
left join Post on Post.assetId=Thread.assetId and Thread.revisionDate = Post.revisionDate
left join assetData on assetData.assetId=Thread.assetId and Thread.revisionDate = assetData.revisionDate
where asset.parentId=".$self->session->db->quote($self->getId)." and asset.state='published' and asset.className='WebGUI::Asset::Post::Thread' and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId) and $constraints
where asset.parentId=".$self->session->db->quote($self->getId)." and asset.state='published' and
asset.className='WebGUI::Asset::Post::Thread' and assetData.revisionDate=(SELECT max(revisionDate) from assetData
where assetData.assetId=asset.assetId) and (assetData.status='approved'
or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag")).")
group by assetData.assetId order by Thread.isSticky desc, ".$sortBy." ".$sortOrder;
my $p = WebGUI::Paginator->new($self->session,$self->getUrl,$self->get("threadsPerPage"));
$self->appendPostListTemplateVars(\%var, $sql, $p);

View file

@ -142,7 +142,7 @@ Returns a list of asset objects that are part of this version tag.
sub getAssets {
my $self = shift;
my @assets = ();
my $sth = $self->session->db->read("select asset.assetId,asset.className,assetData.revisionDate from assetData left join asset on asset.assetId=assetData.assetId where assetData.tagId=?", [$self->getId]);
my $sth = $self->session->db->read("select asset.assetId,asset.className,assetData.revisionDate from assetData left join asset on asset.assetId=assetData.assetId where assetData.tagId=? order by revisionDate desc", [$self->getId]);
while (my ($id,$class,$version) = $sth->array) {
push(@assets, WebGUI::Asset->new($self->session,$id,$class,$version));
}

View file

@ -89,10 +89,16 @@ sub execute {
my $self = shift;
my $versionTag = shift;
my $inbox = WebGUI::Inbox->new($self->session);
my $urlOfSingleAsset = "";
if ($versionTag->getAssetCount) {
# if there's only one asset in the tag, we might as well give them a direct link to it
my $asset = $versionTag->getAssets->[0];
$urlOfSingleAsset = "\n\n".$self->session->getSiteURL().$asset->getUrl("func=view;revision=".$asset->get("revisionDate"));
}
my $properties = {
status=>"completed",
subject=>$versionTag->get("name"),
message=>$self->get("message")."\n\n".$versionTag->get("comments"),
message=>$self->get("message")."\n\n".$versionTag->get("comments").$urlOfSingleAsset,
};
if ($self->get("who") eq "committer") {
$properties->{userId} = $versionTag->get("committedBy");