From 299dd5aa091ba92f168658493a9255f4880d47f2 Mon Sep 17 00:00:00 2001
From: JT Smith
Date: Thu, 30 Mar 2006 03:52:18 +0000
Subject: [PATCH] converted cs to use workflow engine for moderation
---
docs/gotcha.txt | 6 +
docs/upgrades/upgrade_6.8.7-6.99.0.pl | 3 +
lib/WebGUI/Asset.pm | 2 +-
lib/WebGUI/Asset/Post.pm | 171 ++++++++----------
lib/WebGUI/Asset/Post/Thread.pm | 32 +---
lib/WebGUI/Asset/Wobject/Collaboration.pm | 49 ++---
lib/WebGUI/AssetExportHtml.pm | 2 +-
lib/WebGUI/Help/Asset_Collaboration.pm | 13 +-
lib/WebGUI/VersionTag.pm | 28 +++
lib/WebGUI/i18n/English/Asset.pm | 4 -
.../i18n/English/Asset_Collaboration.pm | 45 +----
lib/WebGUI/i18n/English/Asset_Post.pm | 10 +-
lib/WebGUI/i18n/English/WebGUI.pm | 10 -
13 files changed, 154 insertions(+), 221 deletions(-)
diff --git a/docs/gotcha.txt b/docs/gotcha.txt
index 63545c51c..bf67b4026 100644
--- a/docs/gotcha.txt
+++ b/docs/gotcha.txt
@@ -64,6 +64,12 @@ save you many hours of grief.
segments of the content in your import node, you'll need
to change it after the upgrade.
+ * Because collaboration system posts are now integrated with
+ the workflow engine, the approve/deny links are no longer
+ needed or used in your templates. In addition if you wish
+ to use an approval process on any of your collaboration
+ systems, you'll need to re-enable it after this upgrade.
+
6.8.4
--------------------------------------------------------------------
diff --git a/docs/upgrades/upgrade_6.8.7-6.99.0.pl b/docs/upgrades/upgrade_6.8.7-6.99.0.pl
index 9b5278715..4ded98533 100644
--- a/docs/upgrades/upgrade_6.8.7-6.99.0.pl
+++ b/docs/upgrades/upgrade_6.8.7-6.99.0.pl
@@ -199,6 +199,9 @@ sub addWorkflow {
message mediumtext,
toGroup varchar(22) binary
)");
+ $session->db->write("alter table Collaboration drop column moderatePosts");
+ $session->db->write("alter table Collaboration drop column moderateGroupId");
+ $session->db->write("alter table Collaboration add column approvalWorkflow varchar(22) binary not null default 'pbworkflow000000000003'");
print "\t\tPurging old workflow info.\n";
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Upgrade to ".$toVersion});
diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm
index 894ab35d5..e803c210c 100644
--- a/lib/WebGUI/Asset.pm
+++ b/lib/WebGUI/Asset.pm
@@ -1801,7 +1801,7 @@ sub www_editSave {
if ($self->session->config("maximumAssets")) {
my ($count) = $self->session->db->quickArray("select count(*) from asset");
my $i18n = WebGUI::International->new($self->session, "Asset");
- $self->session->style->userStyle($i18n->get("over max assets")) if ($self->session->config("maximumAssets") <= $count);
+ return $self->session->style->userStyle($i18n->get("over max assets")) if ($self->session->config("maximumAssets") <= $count);
}
my $object;
if ($self->session->form->process("assetId") eq "new") {
diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm
index 536ed6f08..f002a29af 100644
--- a/lib/WebGUI/Asset/Post.pm
+++ b/lib/WebGUI/Asset/Post.pm
@@ -27,7 +27,7 @@ use WebGUI::SQL;
use WebGUI::Storage::Image;
use WebGUI::User;
use WebGUI::Utility;
-
+use WebGUI::VersionTag;
our @ISA = qw(WebGUI::Asset);
@@ -63,7 +63,7 @@ sub canEdit {
return (($self->session->form->process("func") eq "add" || ($self->session->form->process("assetId") eq "new" && $self->session->form->process("func") eq "editSave" && $self->session->form->process("class") eq "WebGUI::Asset::Post")) && $self->getThread->getParent->canPost) || # account for new posts
($self->isPoster && $self->getThread->getParent->get("editTimeout") > ($self->session->datetime->time() - $self->get("dateUpdated"))) ||
- $self->getThread->getParent->canModerate;
+ $self->getThread->getParent->canEdit;
}
@@ -100,6 +100,14 @@ sub chopTitle {
return substr($self->get("title"),0,30);
}
+#-------------------------------------------------------------------
+
+sub commit {
+ my $self = shift;
+ $self->SUPER::commit;
+ $self->notifySubscribers;
+}
+
#-------------------------------------------------------------------
sub definition {
my $class = shift;
@@ -217,19 +225,6 @@ sub formatContent {
#-------------------------------------------------------------------
-=head2 getApproveUrl ( )
-
-Formats the URL to approve a post.
-
-=cut
-
-sub getApproveUrl {
- my $self = shift;
- return $self->getUrl("revision=".$self->get("revisionDate").";func=approve;mlog=".$self->session->form->process("mlog"));
-}
-
-#-------------------------------------------------------------------
-
=head2 getAvatarUrl ( )
Returns a URL to the owner's avatar.
@@ -407,7 +402,6 @@ sub getTemplateVars {
$var{"delete.url"} = $self->getDeleteUrl;
$var{"edit.url"} = $self->getEditUrl;
$var{"status"} = $self->getStatus;
- $var{"approve.url"} = $self->getApproveUrl;
$var{"reply.url"} = $self->getReplyUrl;
$var{'reply.withquote.url'} = $self->getReplyUrl(1);
$var{'url'} = $self->getUrl.'#id'.$self->getId;
@@ -664,11 +658,12 @@ sub processPropertiesFromFormPost {
isHidden => 1,
);
$data{url} = $self->fixUrl($self->getThread->get("url")."/1") if ($self->isReply);
- if ($self->getThread->getParent->canModerate) {
+ if ($self->getThread->getParent->canEdit) {
$self->getThread->lock if ($self->session->form->process('lock'));
$self->getThread->stick if ($self->session->form->process("stick"));
}
$self->getThread->unarchive if ($self->getThread->get("status") eq "archived");
+ $self->getThread->incrementReplies($self->get("dateUpdated"),$self->getId) if ($self->isReply);
}
$data{groupIdView} =$self->getThread->getParent->get("groupIdView");
$data{groupIdEdit} = $self->getThread->getParent->get("groupIdEdit");
@@ -681,12 +676,7 @@ sub processPropertiesFromFormPost {
}
$self->update(\%data);
$self->getThread->subscribe if ($self->session->form->process("subscribe"));
- if ($self->getThread->getParent->get("moderatePosts")) {
- $self->setStatusPending;
- } else {
- $self->setStatusApproved;
- }
- delete $self->{_storageLocation};
+ delete $self->{_storageLocation};
my $storage = $self->getStorageLocation;
my $filename;
my $attachmentLimit = $self->getThread->getParent->get("attachmentsPerPost");
@@ -702,9 +692,20 @@ sub processPropertiesFromFormPost {
}
}
}
- # clear some cache
- WebGUI::Cache->new($self->session,"wobject_".$self->getThread->getParent->getId."_".$self->session->user->userId)->delete;
- WebGUI::Cache->new($self->session,"cspost_".($self->getParent->getId)."_".$self->session->user->userId."_".$self->session->scratch->get("discussionLayout")."_1")->delete;
+ # allows us to let the cs post use it's own workflow approval process
+ my $currentTag = WebGUI::VersionTag->getWorking($self->session);
+ if ($currentTag->getAssetCount < 2) {
+ $currentTag->set({workflowId=>$self->getThread->getParent->get("approvalWorkflow")});
+ $currentTag->requestCommit;
+ } else {
+ my $newTag = WebGUI::VersionTag->create($self->session, {
+ name=>$self->getTitle." / ".$self->session->user->username,
+ workflowId=>$self->getThread->getParent->get("approvalWorkflow")
+ });
+ $self->session->db->write("update assetData set tagId=? where assetId=? and tagId=?",[$newTag->getId, $self->getId, $currentTag->getId]);
+ $self->purgeCache;
+ $newTag->requestCommit;
+ }
}
@@ -781,68 +782,19 @@ sub setParent {
return $self->SUPER::setParent($newParent);
}
-#-------------------------------------------------------------------
-
-=head2 setStatusApproved ( )
-
-Sets the post to approved and sends any necessary notifications.
-
-=cut
-
-sub setStatusApproved {
- my $self = shift;
- $self->commit;
- $self->getThread->incrementReplies($self->get("dateUpdated"),$self->getId) if ($self->isReply && ($self->session->form->process('assetId') eq
- "new"));
- unless ($self->isPoster) {
- my $i18n = WebGUI::International->new($self->session);
- WebGUI::Inbox->new($self->session)->addMessage({
- userId=>$self->get("ownerUserId"),
- status=>'completed',
- message=>$i18n->get(579)."\n\n".$self->session->url->getSiteURL().'/'.$self->getUrl
- });
- }
- $self->notifySubscribers unless ($self->session->form->process("func") eq 'add');
-}
-
-
#-------------------------------------------------------------------
=head2 setStatusArchived ( )
-Sets the status of this post to archived. This will only happen if the post status is approved.
+Sets the status of this post to archived.
=cut
sub setStatusArchived {
my ($self) = @_;
- $self->update({status=>'archived'}) if ($self->get("status") eq "approved");
-}
-
-
-#-------------------------------------------------------------------
-
-=head2 setStatusPending ( )
-
-Sets the status of this post to pending.
-
-=cut
-
-sub setStatusPending {
- my ($self) = @_;
- if ($self->session->user->isInGroup($self->getThread->getParent->get("moderateGroupId"))) {
- $self->setStatusApproved;
- } else {
- $self->update({status=>'pending'});
- my $i18n = WebGUI::International->new($self->session);
- WebGUI::Inbox->new($self->session)->addMessage({
- status=>'pending',
- message=>$i18n->get("578")."\n\n".$self->session->url->getSiteURL().'/'.$self->getUrl("revision=".$self->get("revisionDate")),
- groupId=>$self->getThread->getParent->get("moderateGroupId")
- });
- }
+ $self->update({status=>'archived'});
}
@@ -927,21 +879,6 @@ sub view {
}
-
-#-------------------------------------------------------------------
-
-=head2 www_approve ( )
-
-The web method to approve a post.
-
-=cut
-
-sub www_approve {
- my $self = shift;
- $self->setStatusApproved if $self->getThread->getParent->canModerate;
- return $self->www_view;
-}
-
#-------------------------------------------------------------------
sub www_deleteFile {
my $self = shift;
@@ -995,9 +932,8 @@ sub www_edit {
});
} elsif ($self->session->form->process("class") eq "WebGUI::Asset::Post::Thread") { # new thread
return $self->session->privilege->insufficient() unless ($self->getThread->getParent->canPost);
- $var{'form.header'} .= WebGUI::Form::hidden($self->session, {name=>"proceed", value=>"redirectToParent"});
$var{isNewThread} = 1;
- if ($self->getThread->getParent->canModerate) {
+ if ($self->getThread->getParent->canEdit) {
$var{'sticky.form'} = WebGUI::Form::yesNo($self->session, {
name=>'stick',
value=>$self->session->form->process("stick")
@@ -1032,6 +968,7 @@ sub www_edit {
$content = $self->getValue("content");
$title = $self->getValue("title");
}
+ $var{'form.header'} .= WebGUI::Form::hidden($self->session, {name=>"proceed", value=>"showConfirmation"});
if ($self->session->form->process("title") || $self->session->form->process("content") || $self->session->form->process("synopsis")) {
$var{'preview.title'} = WebGUI::HTML::filter($self->session->form->process("title"),"all");
($var{'preview.synopsis'}, $var{'preview.content'}) = $self->getSynopsisAndContentFromFormPost;
@@ -1042,7 +979,7 @@ sub www_edit {
}
$var{'form.footer'} = WebGUI::Form::formFooter($self->session,);
$var{usePreview} = $self->getThread->getParent->get("usePreview");
- $var{'user.isModerator'} = $self->getThread->getParent->canModerate;
+ $var{'user.isModerator'} = $self->getThread->getParent->canEdit;
$var{'user.isVisitor'} = ($self->session->user->userId eq '1');
$var{'visitorName.form'} = WebGUI::Form::text($self->session, {
name=>"visitorName",
@@ -1110,6 +1047,41 @@ sub www_edit {
}
+#-------------------------------------------------------------------
+
+=head2 www_editSave ()
+
+We're extending www_editSave() here to deal with editing a post that has been denied by the approval process. Our change will reassign the old working tag of this post to the user so that they can edit it.
+
+=cut
+
+sub www_editSave {
+ my $self = shift;
+ return $self->session->privilege->insufficient() unless $self->canEdit;
+ if ($self->session->config("maximumAssets")) {
+ my ($count) = $self->session->db->quickArray("select count(*) from asset");
+ my $i18n = WebGUI::International->new($self->session, "Asset");
+ return $self->session->style->userStyle($i18n->get("over max assets")) if ($self->session->config("maximumAssets") <= $count);
+ }
+ if ($self->session->form->param("assetId") ne "new" && $self->get("status") eq "pending") {
+ my $currentTag = WebGUI::VersionTag->getWorking($self->session, 1);
+ if (defined $currentTag && $currentTag->getAssetCount > 0) {
+ # play a little working tag switcheroo
+ $self->session->stow("temporaryWorkingTagHolder",$currentTag);
+ }
+ my $tag = WebGUI::VersionTag->new($self->session, $self->get("tagId"));
+ $tag->setWorking if defined $tag;
+ }
+ my $output = $self->SUPER::www_editSave();
+ if ($self->session->stow->get("temporaryWorkingTagHolder")) {
+ # undo switcharoo
+ my $tag = $self->session->stow->get("temporaryWorkingTagHolder");
+ $tag->setWorking if defined $tag;
+ $self->session->stow->delete("temporaryWorkingTagHolder");
+ }
+ return $output;
+}
+
#-------------------------------------------------------------------
=head2 www_ratePost ( )
@@ -1127,15 +1099,16 @@ sub www_rate {
#-------------------------------------------------------------------
-=head2 www_redirectToParent ( )
+=head2 www_showConfirmation ( )
-This is here to stop people from duplicating posts by hitting refresh in their browser.
+Shows a confirmation message letting the user know their post has been submitted.
=cut
-sub www_redirectToParent {
+sub www_showConfirmation {
my $self = shift;
- $self->session->http->setRedirect($self->getParent->getUrl);
+ my $i18n = WebGUI::International->new($self->session, "Asset_Post");
+ return $self->getThread->getParent->processStyle(''.$i18n->get("post received").'
'.$i18n->get("493","WebGUI").'
');
}
diff --git a/lib/WebGUI/Asset/Post/Thread.pm b/lib/WebGUI/Asset/Post/Thread.pm
index db886f35c..3bdcef26b 100644
--- a/lib/WebGUI/Asset/Post/Thread.pm
+++ b/lib/WebGUI/Asset/Post/Thread.pm
@@ -503,7 +503,10 @@ sub processPropertiesFromFormPost {
if ($self->get("subscriptionGroupId") eq "") {
$self->createSubscriptionGroup;
}
- if ($self->getParent->canModerate) {
+ if ($self->session->form->process("assetId") eq "new") {
+ $self->getParent->incrementThreads($self->get("dateUpdated"),$self->getId) unless ($self->isReply);
+ }
+ if ($self->getParent->canEdit) {
my $karmaScale = $self->session->form("karmaScale","integer") || 1;
$self->update({karmaScale=>$karmaScale, karmaRank=>$self->get("karma")/$karmaScale});
}
@@ -590,19 +593,6 @@ sub setParent {
return $self->WebGUI::Asset::setParent($newParent);
}
-#-------------------------------------------------------------------
-
-=head2 setStatusApproved ( )
-
-Sets the post to approved and sends any necessary notifications.
-
-=cut
-
-sub setStatusApproved {
- my $self = shift;
- $self->SUPER::setStatusApproved;
- $self->getParent->incrementThreads($self->get("dateUpdated"),$self->getId) unless ($self->isReply);
-}
#-------------------------------------------------------------------
@@ -629,7 +619,6 @@ Subscribes the user to this thread.
sub subscribe {
my $self = shift;
$self->createSubscriptionGroup;
- WebGUI::Cache->new($self->session,"cspost_".$self->getId."_".$self->session->user->userId."_".$self->session->scratch->get("discussionLayout")."_".$self->session->form->process("pn"))->delete;
my $group = WebGUI::Group->new($self->session,$self->get("subscriptionGroupId"));
$group->addUsers([$self->session->user->userId]);
}
@@ -705,7 +694,6 @@ Negates the subscribe method.
sub unsubscribe {
my $self = shift;
- WebGUI::Cache->new($self->session,"cspost_".$self->getId."_".$self->session->user->userId."_".$self->session->scratch->get("discussionLayout")."_".$self->session->form->process("pn"))->delete;
my $group = WebGUI::Group->new($self->session,$self->get("subscriptionGroupId"));
$group->deleteUsers([$self->session->user->userId]);
}
@@ -721,7 +709,7 @@ sub view {
$self->getParent->appendTemplateLabels($var);
$var->{'user.isVisitor'} = ($self->session->user->userId eq '1');
- $var->{'user.isModerator'} = $self->getParent->canModerate;
+ $var->{'user.isModerator'} = $self->getParent->canEdit;
$var->{'user.canPost'} = $self->getParent->canPost;
$var->{'user.canReply'} = $self->canReply;
$var->{'repliesAllowed'} = $self->getParent->get("allowReplies");
@@ -770,7 +758,7 @@ sub view {
and (
assetData.status in ('approved','archived')
or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag"));
- $sql .= " or assetData.status='pending'" if ($self->getParent->canModerate);
+ $sql .= " or assetData.status='pending'" if ($self->getParent->canEdit);
$sql .= " or (assetData.ownerUserId=".$self->session->db->quote($self->session->user->userId)." and assetData.ownerUserId<>'1')
))
group by assetData.assetId
@@ -838,7 +826,7 @@ The web method to lock a thread.
sub www_lockThread {
my $self = shift;
- $self->lock if $self->getParent->canModerate;
+ $self->lock if $self->getParent->canEdit;
return $self->www_view;
}
@@ -852,7 +840,7 @@ The web method to make a thread sticky.
sub www_stick {
my $self = shift;
- $self->stick if $self->getParent->canModerate;
+ $self->stick if $self->getParent->canEdit;
return $self->www_view;
}
@@ -914,7 +902,7 @@ The web method to unlock a thread.
sub www_unlockThread {
my $self = shift;
- $self->unlock if $self->getParent->canModerate;
+ $self->unlock if $self->getParent->canEdit;
return $self->www_view;
}
@@ -928,7 +916,7 @@ The web method to make a sticky thread normal again.
sub www_unstick {
my $self = shift;
- $self->unstick if $self->getParent->canModerate;
+ $self->unstick if $self->getParent->canEdit;
$self->www_view;
}
diff --git a/lib/WebGUI/Asset/Wobject/Collaboration.pm b/lib/WebGUI/Asset/Wobject/Collaboration.pm
index a18ae2059..b78f49a24 100644
--- a/lib/WebGUI/Asset/Wobject/Collaboration.pm
+++ b/lib/WebGUI/Asset/Wobject/Collaboration.pm
@@ -107,7 +107,6 @@ sub appendTemplateLabels {
$var->{"addquestion.label"} = $i18n->get("addquestion");
$var->{'all.label'} = $i18n->get("all");
$var->{'atleastone.label'} = $i18n->get("atleastone");
- $var->{"approve.label"} = $i18n->get("approve");
$var->{'answer.label'} = $i18n->get("answer");
$var->{'attachment.label'} = $i18n->get("attachment");
$var->{"by.label"} = $i18n->get("by");
@@ -173,16 +172,10 @@ sub canEdit {
$self->SUPER::canEdit());
}
-#-------------------------------------------------------------------
-sub canModerate {
- my $self = shift;
- return $self->session->user->isInGroup($self->get("moderateGroupId"));
-}
-
#-------------------------------------------------------------------
sub canPost {
my $self = shift;
- return $self->session->user->isInGroup($self->get("postGroupId")) || $self->canModerate;
+ return $self->session->user->isInGroup($self->get("postGroupId")) || $self->canEdit;
}
@@ -252,6 +245,10 @@ sub definition {
tableName=>'Collaboration',
className=>'WebGUI::Asset::Wobject::Collaboration',
properties=>{
+ approvalWorkflow =>{
+ fieldType=>"workflow",
+ defaultValue=>"pbworkflow000000000003"
+ },
displayLastReply =>{
fieldType=>"yesNo",
defaultValue=>0
@@ -380,18 +377,10 @@ sub definition {
fieldType => "integer",
defaultValue=> 0
},
- moderatePosts =>{
- fieldType=>"yesNo",
- defaultValue=>0
- },
avatarsEnabled =>{
fieldType=>"yesNo",
defaultValue=>0
},
- moderateGroupId =>{
- fieldType=>"group",
- defaultValue=>'4'
- },
postGroupId =>{
fieldType=>"group",
defaultValue=>'2'
@@ -466,18 +455,18 @@ sub getEditForm {
-label=>$i18n->get('rss template'),
-hoverHelp=>$i18n->get('rss template description'),
);
- $tabform->getTab("security")->group(
- -name=>"moderateGroupId",
- -label=>$i18n->get('who moderates'),
- -hoverHelp=>$i18n->get('who moderates description'),
- -value=>[$self->getValue("moderateGroupId")]
- );
$tabform->getTab("security")->group(
-name=>"postGroupId",
-label=>$i18n->get('who posts'),
-hoverHelp=>$i18n->get('who posts description'),
-value=>[$self->getValue("postGroupId")]
);
+ $tabform->getTab("security")->workflow(
+ -name=>"approvalWorkflow",
+ -label=>$i18n->get('approval workflow'),
+ -hoverHelp=>$i18n->get('approval workflow description'),
+ -value=>[$self->getValue("approvalWorkflow")]
+ );
$tabform->getTab("display")->integer(
-name=>"threadsPerPage",
-label=>$i18n->get('threads/page'),
@@ -625,12 +614,6 @@ sub getEditForm {
-hoverHelp=>$i18n->get('enable avatars description'),
-value=>$self->getValue("avatarsEnabled")
);
- $tabform->getTab("security")->yesNo(
- -name=>"moderatePosts",
- -label=>$i18n->get('moderate'),
- -hoverHelp=>$i18n->get('moderate description'),
- -value=>$self->getValue("moderatePosts")
- );
return $tabform;
}
@@ -807,7 +790,7 @@ sub prepareView {
#-------------------------------------------------------------------
sub processPropertiesFromFormPost {
my $self = shift;
- my $updatePrivs = ($self->session->form->process("groupIdView") ne $self->get("groupIdView") || $self->session->form->process("moderateGroupId") ne $self->get("moderateGroupId"));
+ my $updatePrivs = ($self->session->form->process("groupIdView") ne $self->get("groupIdView") || $self->session->form->process("groupIdEdit") ne $self->get("groupIdEdit"));
$self->SUPER::processPropertiesFromFormPost;
if ($self->get("subscriptionGroupId") eq "") {
$self->createSubscriptionGroup;
@@ -816,7 +799,7 @@ sub processPropertiesFromFormPost {
foreach my $descendant (@{$self->getLineage(["descendants"],{returnObjects=>1})}) {
$descendant->update({
groupIdView=>$self->get("groupIdView"),
- groupIdEdit=>$self->get("moderateGroupId")
+ groupIdEdit=>$self->get("groupIdEdit")
});
}
}
@@ -886,7 +869,6 @@ Subscribes a user to this collaboration system.
sub subscribe {
my $self = shift;
- WebGUI::Cache->new($self->session,"wobject_".$self->getId."_".$self->session->user->userId)->delete;
my $group = WebGUI::Group->new($self->session,$self->get("subscriptionGroupId"));
$group->addUsers([$self->session->user->userId]);
}
@@ -901,7 +883,6 @@ Unsubscribes a user from this collaboration system
sub unsubscribe {
my $self = shift;
- WebGUI::Cache->new($self->session,"wobject_".$self->getId."_".$self->session->user->userId)->delete;
my $group = WebGUI::Group->new($self->session,$self->get("subscriptionGroupId"));
$group->deleteUsers([$self->session->user->userId],[$self->get("subscriptionGroupId")]);
}
@@ -930,7 +911,7 @@ sub view {
$var{'user.canPost'} = $self->canPost;
$var{"add.url"} = $self->getNewThreadUrl;
$var{"rss.url"} = $self->getRssUrl;
- $var{'user.isModerator'} = $self->canModerate;
+ $var{'user.isModerator'} = $self->canEdit;
$var{'user.isVisitor'} = ($self->session->user->userId eq '1');
$var{'user.isSubscribed'} = $self->isSubscribed;
$var{'sortby.title.url'} = $self->getSortByUrl("title");
@@ -1079,7 +1060,7 @@ sub www_search {
and (
assetData.status in ('approved','archived')
or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag"));
- $sql .= " or assetData.status='pending'" if ($self->canModerate);
+ $sql .= " or assetData.status='pending'" if ($self->canEdit);
$sql .= " or (assetData.ownerUserId=".$self->session->db->quote($self->session->user->userId)." and assetData.ownerUserId<>'1')
) ";
$sql .= " and ($all) " if ($all ne "");
diff --git a/lib/WebGUI/AssetExportHtml.pm b/lib/WebGUI/AssetExportHtml.pm
index 34246ebf7..3f130da9b 100644
--- a/lib/WebGUI/AssetExportHtml.pm
+++ b/lib/WebGUI/AssetExportHtml.pm
@@ -251,7 +251,7 @@ sub www_exportGenerate {
$self->session->output->print($i18n->get('done'));
}
$self->session->output->printf($i18n->get('export information'), scalar(@{$assets}), ($self->session->datetime->time()-$startTime));
- $self->session->output->print(''.$i18n->get(493).'');
+ $self->session->output->print(''.$i18n->get(493,'WebGUI').'');
return;
}
diff --git a/lib/WebGUI/Help/Asset_Collaboration.pm b/lib/WebGUI/Help/Asset_Collaboration.pm
index 6fc19cbcc..214beef07 100644
--- a/lib/WebGUI/Help/Asset_Collaboration.pm
+++ b/lib/WebGUI/Help/Asset_Collaboration.pm
@@ -41,13 +41,13 @@ our $HELP = {
namespace => 'Asset_Collaboration',
},
{
- title => 'who moderates',
- description => 'who moderates description',
+ title => 'who posts',
+ description => 'who posts description',
namespace => 'Asset_Collaboration',
},
{
- title => 'who posts',
- description => 'who posts description',
+ title => 'approval workflow',
+ description => 'approval workflow description',
namespace => 'Asset_Collaboration',
},
{
@@ -140,11 +140,6 @@ our $HELP = {
description => 'enable avatars description',
namespace => 'Asset_Collaboration',
},
- {
- title => 'moderate',
- description => 'moderate description',
- namespace => 'Asset_Collaboration',
- },
],
related => [
{
diff --git a/lib/WebGUI/VersionTag.pm b/lib/WebGUI/VersionTag.pm
index 564809b49..1ca46310b 100644
--- a/lib/WebGUI/VersionTag.pm
+++ b/lib/WebGUI/VersionTag.pm
@@ -119,6 +119,20 @@ sub get {
#-------------------------------------------------------------------
+=head2 getAssetCount ( )
+
+Returns the number of assets that are under this tag.
+
+=cut
+
+sub getAssetCount {
+ my $self = shift;
+ my ($count) = $self->session->db->quickArray("select count(distinct(assetId)) from assetData where tagId=?", [$self->getId]);
+ return $count;
+}
+
+#-------------------------------------------------------------------
+
=head2 getAssets ( )
Returns a list of asset objects that are part of this version tag.
@@ -150,6 +164,20 @@ sub getId {
#-------------------------------------------------------------------
+=head2 getRevisionCount ( )
+
+Returns the number of revisions that are under this tag.
+
+=cut
+
+sub getRevisionCount {
+ my $self = shift;
+ my ($count) = $self->session->db->quickArray("select count(assetId) from assetData where tagId=?", [$self->getId]);
+ return $count;
+}
+
+#-------------------------------------------------------------------
+
=head2 getWorkflowInstance ( )
Returns a reference to the workflow instance attached to this version tag if any.
diff --git a/lib/WebGUI/i18n/English/Asset.pm b/lib/WebGUI/i18n/English/Asset.pm
index d0510f6b3..c3ae43f61 100644
--- a/lib/WebGUI/i18n/English/Asset.pm
+++ b/lib/WebGUI/i18n/English/Asset.pm
@@ -703,10 +703,6 @@ each asset under the tab "Meta" in the asset properties.
lastUpdated => 1050438829,
message => q|Open in new window?|
},
- '493' => {
- lastUpdated => 1031514049,
- message => q|Back to site.|
- },
'encrypt page' => {
message => q|Encrypt content?|,
lastUpdated =>1092748557,
diff --git a/lib/WebGUI/i18n/English/Asset_Collaboration.pm b/lib/WebGUI/i18n/English/Asset_Collaboration.pm
index 9fa8f6cc7..fe79494ee 100644
--- a/lib/WebGUI/i18n/English/Asset_Collaboration.pm
+++ b/lib/WebGUI/i18n/English/Asset_Collaboration.pm
@@ -126,11 +126,6 @@ our $I18N = {
lastUpdated => 1109618544,
},
- 'approve' => {
- message => q|Approve|,
- lastUpdated => 1109618544,
- },
-
'answer' => {
message => q|Answer|,
lastUpdated => 1109618544,
@@ -176,11 +171,6 @@ our $I18N = {
lastUpdated => 1109618544,
},
- 'deny' => {
- message => q|Deny|,
- lastUpdated => 1109618544,
- },
-
'edit' => {
message => q|Edit|,
lastUpdated => 1109618544,
@@ -446,11 +436,6 @@ our $I18N = {
lastUpdated => 1109698614,
},
- 'who moderates' => {
- message => q|Who can moderate?|,
- lastUpdated => 1109698614,
- },
-
'who posts' => {
message => q|Who can post?|,
lastUpdated => 1109698614,
@@ -526,11 +511,6 @@ our $I18N = {
lastUpdated => 1109698614,
},
- 'moderate' => {
- message => q|Moderate posts?|,
- lastUpdated => 1109698614,
- },
-
'collaboration template labels title' => {
message => q|Collaboration Template Labels|,
lastUpdated => 1111520746,
@@ -573,10 +553,6 @@ our $I18N = {
^International("phrase","Asset_Collaboration"); "^International("atleastone","Asset_Collaboration");".
-approve.label
-^International("word","Asset_Collaboration"); "^International("approve","Asset_Collaboration");".
-
-
answer.label
^International("word","Asset_Collaboration"); "^International("answer","Asset_Collaboration");".
@@ -617,10 +593,6 @@ our $I18N = {
^International("word","Asset_Collaboration"); "^International("description","Asset_Collaboration");".
-deny.label
-^International("word","Asset_Collaboration"); "^International("deny","Asset_Collaboration");".
-
-
edit.label
^International("word","Asset_Collaboration"); "^International("edit","Asset_Collaboration");".
@@ -863,9 +835,14 @@ properties listed below:
lastUpdated => 1119070429,
},
- 'who moderates description' => {
- message => q|The group that will moderate posts to this Asset, if moderation is enabled.|,
- lastUpdated => 1119070429,
+ 'approval workflow description' => {
+ message => q|Choose a workflow to be executed on each post as it gets submitted.|,
+ lastUpdated => 0,
+ },
+
+ 'approval workflow' => {
+ message => q|Approval Workflow|,
+ lastUpdated => 0,
},
'who posts description' => {
@@ -960,12 +937,6 @@ the preview is displayed, the Post can either be edited or canceled.|,
lastUpdated => 1119070429,
},
- 'moderate description' => {
- message => q|Enable moderation for Posts to the Collaboration Asset.|,
- lastUpdated => 1119070429,
- },
-
-
'collaboration post list template variables title' => {
message => q|Collaboration, Post List Template Variables|,
lastUpdated => 1113673895,
diff --git a/lib/WebGUI/i18n/English/Asset_Post.pm b/lib/WebGUI/i18n/English/Asset_Post.pm
index 8e04ce417..cfa0f89c3 100644
--- a/lib/WebGUI/i18n/English/Asset_Post.pm
+++ b/lib/WebGUI/i18n/English/Asset_Post.pm
@@ -200,10 +200,6 @@ A URL to edit this Post.
The status of this Post: "Approved", "Pending" or "Archived".
-approve.url
-The URL to approve this Post, if it's moderated.
-
-
reply.url
The URL to reply to this Post without quoting it.
@@ -399,6 +395,12 @@ back the data with a simple <tmpl_var userDefined1>.
lastUpdated => 1134670360,
},
+ 'post received' => {
+ message => q|Your post has been received and is pending approval.|,
+ context => q|Displayed after someone posts a new message.|,
+ lastUpdated => 0,
+ },
+
'approved' => {
message => q|Approved|,
lastUpdated => 1031514049,
diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm
index 0edf2304d..4a563b567 100644
--- a/lib/WebGUI/i18n/English/WebGUI.pm
+++ b/lib/WebGUI/i18n/English/WebGUI.pm
@@ -139,11 +139,6 @@ our $I18N = {
lastUpdated => 1065356764
},
- '578' => {
- message => q|You have a pending message to approve.|,
- lastUpdated => 1031514049
- },
-
'978' => {
message => q|User added successfully.|,
lastUpdated => 1053804577
@@ -489,11 +484,6 @@ Be aware that any database links you create here will be available to all conten
lastUpdated => 1043881275
},
- '579' => {
- message => q|Your message has been approved.|,
- lastUpdated => 1031514049
- },
-
'480' => {
message => q|Email Address|,
lastUpdated => 1031514049