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 067bd723f..eb867a27b 100644
--- a/docs/upgrades/upgrade_6.8.7-6.99.0.pl
+++ b/docs/upgrades/upgrade_6.8.7-6.99.0.pl
@@ -70,22 +70,13 @@ sub addIndexes {
#-------------------------------------------------
sub addWorkflow {
print "\tAdding workflow.\n";
+ print "\t\tMaking database changes.\n";
$session->db->write("alter table assetData drop column startDate");
$session->db->write("alter table assetData drop column endDate");
$session->db->write("alter table assetVersionTag add column isLocked int not null default 0");
$session->db->write("alter table assetVersionTag add column lockedBy varchar(22) binary not null");
$session->db->write("alter table assetVersionTag add column groupToUse varchar(22) binary not null");
$session->db->write("alter table assetVersionTag add column workflowId varchar(22) binary not null");
- my $group = WebGUI::Group->new($session,"new","pbgroup000000000000015");
- $group->set("groupName", "Workflow Managers");
- $group->set("description", "People who can create, edit, and delete workflows.");
- $group = WebGUI::Group->new($session,"new","pbgroup000000000000016");
- $group->set("groupName", "Version Tag Managers");
- $group->set("description", "People who can create, edit, and delete special version tags.");
- $session->config->set("spectreIp","127.0.0.1");
- $session->config->set("spectrePort",32133);
- $session->config->set("spectreSubnets",["127.0.0.1/32"]);
- $session->config->set("spectreCryptoKey","123qwe");
$session->db->write("create table WorkflowSchedule (
taskId varchar(22) binary not null primary key,
title varchar(255) not null default 'Untitled',
@@ -135,6 +126,28 @@ sub addWorkflow {
value text,
primary key (activityId, name)
)");
+ print "\t\tPurging old workflow info.\n";
+ my $rs = $session->db->read("select assetId from assetData where status='denied'");
+ while (my ($id) = $rs->array) {
+ my $asset = WebGUI::Asset->newByDynamicClass($session, $id);
+ if ($asset->get("status") eq "denied") {
+ $asset->trash;
+ }
+ }
+ $session->db->write("update assetData set status='approved' where status='denied'");
+ print "\t\tUpdating groups.\n";
+ $session->db->write("update groups set showInForms=1 where groupId='12'");
+ my $group = WebGUI::Group->new($session,"new","pbgroup000000000000015");
+ $group->set("groupName", "Workflow Managers");
+ $group->set("description", "People who can create, edit, and delete workflows.");
+ $group = WebGUI::Group->new($session,"new","pbgroup000000000000016");
+ $group->set("groupName", "Version Tag Managers");
+ $group->set("description", "People who can create, edit, and delete special version tags.");
+ print "\t\tUpdating the config file.\n";
+ $session->config->set("spectreIp","127.0.0.1");
+ $session->config->set("spectrePort",32133);
+ $session->config->set("spectreSubnets",["127.0.0.1/32"]);
+ $session->config->set("spectreCryptoKey","123qwe");
$session->config->set("workflowActivities", {
None=>["WebGUI::Workflow::Activity::DecayKarma", "WebGUI::Workflow::Activity::TrashClipboard", "WebGUI::Workflow::Activity::CleanTempStorage",
"WebGUI::Workflow::Activity::CleanFileCache", "WebGUI::Workflow::Activity::CleanLoginHistory", "WebGUI::Workflow::Activity::ArchiveOldThreads",
@@ -145,8 +158,21 @@ sub addWorkflow {
"WebGUI::Workflow::Activity::SyncProfilesToLdap", "WebGUI::Workflow::Activity::SummarizePassiveProfileLog"],
"WebGUI::User"=>["WebGUI::Workflow::Activity::CreateCronJob", "WebGUI::Workflow::Activity::NotifyAboutUser"],
"WebGUI::VersionTag"=>["WebGUI::Workflow::Activity::CommitVersionTag", "WebGUI::Workflow::Activity::RollbackVersionTag",
- "WebGUI::Workflow::Activity::TrashVersionTag", "WebGUI::Workflow::Activity::CreateCronJob"]
+ "WebGUI::Workflow::Activity::TrashVersionTag", "WebGUI::Workflow::Activity::CreateCronJob", "WebGUI::Workflow::Activity::UnlockVersionTag",
+ "WebGUI::Workflow::Activity::RequestApprovalForVersionTag", "WebGUI::Workflow::Activity::NotifyAboutVersionTag"]
});
+ $session->config->delete("SyncProfilesToLDAP_hour");
+ $session->config->delete("fileCacheSizeLimit");
+ $session->config->delete("passiveProfileInterval");
+ $session->config->delete("CleanLoginHistory_ageToDelete");
+ $session->config->delete("DecayKarma_minimumKarma");
+ $session->config->delete("DecayKarma_decayFactor");
+ $session->config->delete("DeleteExpiredClipboard_offset");
+ $session->config->delete("DeleteExpiredEvents_offset");
+ $session->config->delete("TrashExpiredContent_offset");
+ $session->config->delete("DeleteExpiredTrash_offset");
+ $session->config->delete("DeleteExpiredRevisions_offset");
+ print "\t\tAdding default workflows and cron jobs.\n";
my $workflow = WebGUI::Workflow->create($session, {
title=>"Daily Maintenance Tasks",
description=>"This workflow runs daily maintenance tasks such as cleaning up old temporary files and cache.",
@@ -229,18 +255,6 @@ sub addWorkflow {
priority=>3,
workflowId=>$workflow->getId
}, "pbcron0000000000000003");
- $session->db->write("update groups set showInForms=1 where groupId='12'");
- $session->config->delete("SyncProfilesToLDAP_hour");
- $session->config->delete("fileCacheSizeLimit");
- $session->config->delete("passiveProfileInterval");
- $session->config->delete("CleanLoginHistory_ageToDelete");
- $session->config->delete("DecayKarma_minimumKarma");
- $session->config->delete("DecayKarma_decayFactor");
- $session->config->delete("DeleteExpiredClipboard_offset");
- $session->config->delete("DeleteExpiredEvents_offset");
- $session->config->delete("TrashExpiredContent_offset");
- $session->config->delete("DeleteExpiredTrash_offset");
- $session->config->delete("DeleteExpiredRevisions_offset");
$workflow = WebGUI::Workflow->create($session, {
title=>"Commit Without Approval",
description=>"This workflow commits all the assets in this version tag without asking for any approval.",
@@ -248,7 +262,39 @@ sub addWorkflow {
type=>"WebGUI::VersionTag"
}, "pbworkflow000000000003");
$activity = $workflow->addActivity("WebGUI::Workflow::Activity::CommitVersionTag", "pbwfactivity0000000006");
+ $workflow = WebGUI::Workflow->create($session, {
+ title=>"Commit With Approval",
+ description=>"This workflow commits all the assets in this version tag after getting approval from content managers.",
+ enabled=>1,
+ type=>"WebGUI::VersionTag"
+ }, "pbworkflow000000000005");
+ $activity = $workflow->addActivity("WebGUI::Workflow::Activity::RequestApprovalForVersionTag", "pbwfactivity0000000017");
+ $activity->set("title", "Get Approval from Content Managers");
+ $activity->set("groupToApprove", "4");
+ $activity->set("approvalSubject", "Approval Pending");
+ $activity->set("approvalMessage", "A new version tag waits your approval.");
+ $activity->set("doOnDeny", "pbworkflow000000000006");
+ $activity = $workflow->addActivity("WebGUI::Workflow::Activity::CommitVersionTag", "pbwfactivity0000000016");
$activity->set("title", "Commit Assets");
+ $activity = $workflow->addActivity("WebGUI::Workflow::Activity::NotifyAboutVersionTag", "pbwfactivity0000000018");
+ $activity->set("title", "Notify Committer of Approval");
+ $activity->set("subject", "Content Approved");
+ $activity->set("message", "Your version tag was approved.");
+ $activity->set("who", "committer");
+ $workflow = WebGUI::Workflow->create($session, {
+ title=>"Unlock Version Tag and Notify Owner",
+ description=>"This workflow is used when a version tag approval is denied. It unlocks the version tag, making it available for editing, and notifies the tag owner.",
+ enabled=>1,
+ type=>"WebGUI::VersionTag"
+ }, "pbworkflow000000000006");
+ $activity = $workflow->addActivity("WebGUI::Workflow::Activity::UnlockVersionTag", "pbwfactivity0000000019");
+ $activity->set("title", "Unlock Version Tag");
+ $activity = $workflow->addActivity("WebGUI::Workflow::Activity::NotifyAboutVersionTag", "pbwfactivity0000000020");
+ $activity->set("title", "Notify Committer of Denial");
+ $activity->set("subject", "Content Denied");
+ $activity->set("message", "Your version tag was denied. Please take corrective actions and recommit your changes.");
+ $activity->set("who", "committer");
+ print "\t\tUpdating settings.\n";
$session->setting->remove("autoCommit");
$session->setting->remove("alertOnNewUser");
$session->setting->remove("onNewUserAlertGroup");
diff --git a/etc/WebGUI.conf.original b/etc/WebGUI.conf.original
index 40a7e11d4..22f063cf4 100644
--- a/etc/WebGUI.conf.original
+++ b/etc/WebGUI.conf.original
@@ -311,7 +311,9 @@
"WebGUI::Workflow::Activity::SyncProfilesToLdap", "WebGUI::Workflow::Activity::SummarizePassiveProfileLog"],
"WebGUI::User" : ["WebGUI::Workflow::Activity::CreateCronJob", "WebGUI::Workflow::Activity::NotifyAboutUser"],
"WebGUI::VersionTag" : ["WebGUI::Workflow::Activity::CommitVersionTag", "WebGUI::Workflow::Activity::RollbackVersionTag",
- "WebGUI::Workflow::Activity::TrashVersionTag", "WebGUI::Workflow::Activity::CreateCronJob"]
+ "WebGUI::Workflow::Activity::TrashVersionTag", "WebGUI::Workflow::Activity::CreateCronJob",
+ "WebGUI::Workflow::Activity::UnlockVersionTag", "WebGUI::Workflow::Activity::NotifyAboutVersionTag",
+ "WebGUI::Workflow::Activity::RequestApprovalForVersionTag"]
}
}
diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm
index a27b6be78..a7f14c926 100644
--- a/lib/WebGUI/Asset/Post.pm
+++ b/lib/WebGUI/Asset/Post.pm
@@ -79,7 +79,7 @@ sub canView {
my $self = shift;
if (($self->get("status") eq "approved" || $self->get("status") eq "archived") && $self->getThread->getParent->canView) {
return 1;
- } elsif ($self->get("status") eq "denied" && $self->canEdit) {
+ } elsif ($self->canEdit) {
return 1;
} else {
$self->getThread->getParent->canEdit;
@@ -272,19 +272,6 @@ sub getDeleteUrl {
#-------------------------------------------------------------------
-=head2 getDenyUrl ( )
-
-Formats the url to deny a post.
-
-=cut
-
-sub getDenyUrl {
- my $self = shift;
- return $self->getUrl("revision=".$self->get("revisionDate").";func=deny;mlog=".$self->session->form->process("mlog"));
-}
-
-#-------------------------------------------------------------------
-
=head2 getEditUrl ( )
Formats the url to edit a post.
@@ -369,8 +356,6 @@ sub getStatus {
my $i18n = WebGUI::International->new($self->session,"Asset_Post");
if ($status eq "approved") {
return $i18n->get('approved');
- } elsif ($status eq "denied") {
- return $i18n->get('denied');
} elsif ($status eq "pending") {
return $i18n->get('pending');
} elsif ($status eq "archived") {
@@ -423,7 +408,6 @@ sub getTemplateVars {
$var{"edit.url"} = $self->getEditUrl;
$var{"status"} = $self->getStatus;
$var{"approve.url"} = $self->getApproveUrl;
- $var{"deny.url"} = $self->getDenyUrl;
$var{"reply.url"} = $self->getReplyUrl;
$var{'reply.withquote.url'} = $self->getReplyUrl(1);
$var{'url'} = $self->getUrl.'#id'.$self->getId;
@@ -839,20 +823,6 @@ sub setStatusArchived {
}
-#-------------------------------------------------------------------
-
-=head2 setStatusDenied ( )
-
-Sets the status of this post to denied.
-
-=cut
-
-sub setStatusDenied {
- my ($self) = @_;
- $self->update({status=>'denied'});
- WebGUI::MessageLog::addInternationalizedEntry($self->get("ownerUserId"),'',$self->session->url->getSiteURL().'/'.$self->getUrl,580);
-}
-
#-------------------------------------------------------------------
=head2 setStatusPending ( )
@@ -977,20 +947,6 @@ sub www_deleteFile {
}
-#-------------------------------------------------------------------
-
-=head2 www_deny ( )
-
-The web method to deny a post.
-
-=cut
-
-sub www_deny {
- my $self = shift;
- $self->setStatusDenied if $self->getThread->getParent->canModerate;
- return $self->www_view;
-}
-
#-------------------------------------------------------------------
sub www_edit {
my $self = shift;
diff --git a/lib/WebGUI/Asset/Wobject/Collaboration.pm b/lib/WebGUI/Asset/Wobject/Collaboration.pm
index 6ad8dfca6..a18ae2059 100644
--- a/lib/WebGUI/Asset/Wobject/Collaboration.pm
+++ b/lib/WebGUI/Asset/Wobject/Collaboration.pm
@@ -62,7 +62,7 @@ sub appendPostListTemplateVars {
}
}
my $url;
- if ($post->get("status") eq "pending" || $post->get("status") eq "denied") {
+ if ($post->get("status") eq "pending") {
$url = $post->getUrl("revision=".$post->get("revisionDate"))."#".$post->getId;
} else {
$url = $post->getUrl."#".$post->getId;
@@ -118,7 +118,6 @@ sub appendTemplateLabels {
$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->{'exactphrase.label'} = $i18n->get("exactPhrase");
$var->{'image.label'} = $i18n->get("image");
diff --git a/lib/WebGUI/AssetVersioning.pm b/lib/WebGUI/AssetVersioning.pm
index cab4893a1..836a4ef22 100644
--- a/lib/WebGUI/AssetVersioning.pm
+++ b/lib/WebGUI/AssetVersioning.pm
@@ -117,7 +117,7 @@ Returns the number of revisions available for this asset.
=head3 status
-Optionally specify to get the count based upon the status of the revisions. Options are "approved", "archived", "pending", "denied". Defaults to any status.
+Optionally specify to get the count based upon the status of the revisions. Options are "approved", "archived", or "pending". Defaults to any status.
=cut
diff --git a/lib/WebGUI/Inbox.pm b/lib/WebGUI/Inbox.pm
index a8e850b57..2328023a2 100644
--- a/lib/WebGUI/Inbox.pm
+++ b/lib/WebGUI/Inbox.pm
@@ -37,13 +37,19 @@ These methods are available from this class:
#-------------------------------------------------------------------
-=head2 addMessage ( )
+=head2 addMessage ( properties )
+
+Adds a new message to the inbox.
+
+=head3 properties
+
+See WebGUI::Inbox::Message::create() for details.
=cut
sub addMessage {
my $self = shift;
- return WebGUI::Inbox::Message->create($self);
+ return WebGUI::Inbox::Message->create($self->session, @_);
}
#-------------------------------------------------------------------
diff --git a/lib/WebGUI/Operation/VersionTag.pm b/lib/WebGUI/Operation/VersionTag.pm
index a121337a1..c2edbf192 100644
--- a/lib/WebGUI/Operation/VersionTag.pm
+++ b/lib/WebGUI/Operation/VersionTag.pm
@@ -280,7 +280,44 @@ sub www_manageRevisionsInTag {
$ac->addSubmenuItem($session->url->page('op=editVersionTag'), $i18n->get("add a version tag"));
$ac->addSubmenuItem($session->url->page('op=manageCommittedVersions'), $i18n->get("manage committed versions")) if ($session->user->isInGroup(3));
$ac->addSubmenuItem($session->url->page('op=manageVersions'), $i18n->get("manage versions"));
- my $output = '
+ my $output = "";
+ if ($session->form->param("workflowInstanceId")) {
+ my $instance = WebGUI::Workflow::Instance->new($session, $session->form->param("workflowInstanceId"));
+ if (defined $instance) {
+ my $form = WebGUI::HTMLForm->new($session);
+ $form->hidden(
+ name=>"tagId",
+ value=>$tagId
+ );
+ $form->hidden(
+ name=>"op",
+ value=>"approveVersionTag"
+ );
+ $form->selectBox(
+ name=>"status",
+ defaultValue=>"approve",
+ label=>$i18n->get("approve/deny"),
+ hoverHelp=>$i18n->get("approve/deny help"),
+ options=>{
+ approve=>$i18n->get("approve"),
+ deny=>$i18n->get("deny")
+ },
+ );
+ $form->textarea(
+ name=>"comments",
+ label=>$i18n->get("comments"),
+ hoverHelp=>$i18n->get("comments help")
+ );
+ $form->submit;
+ $output .= $form->print;
+ }
+ }
+ if ($tag->get("comments")) {
+ my $comments = $tag->get("comments");
+ $comments =~ s/\n/
/g;
+ $output .= ''.$comments.'
';
+ }
+ $output .= '
| '.$i18n->get(99,"Asset").' | '.$i18n->get("type","Asset").' | '.$i18n->get("revision date","Asset").' | '.$i18n->get("revised by","Asset").' |
';
my $p = WebGUI::Paginator->new($session,$session->url->page("op=manageRevisionsInTag;tagId=".$tag->getId));
$p->setDataByQuery("select assetData.revisionDate, users.username, asset.assetId, asset.className from assetData
diff --git a/lib/WebGUI/Workflow/Activity.pm b/lib/WebGUI/Workflow/Activity.pm
index 9937357bf..028683655 100644
--- a/lib/WebGUI/Workflow/Activity.pm
+++ b/lib/WebGUI/Workflow/Activity.pm
@@ -151,19 +151,25 @@ sub DESTROY {
#-------------------------------------------------------------------
-=head2 execute ( object )
+=head2 execute ( object, instance )
-This method will be called during workflow operation. It needs to be overridden by the base classes.
+This method will be called during workflow operation. It needs to be mutated by the sub classes.
=head2 object
A reference to some object that will be passed in to this activity for an action to be taken on it.
+=head2 instance
+
+A reference to the workflow instance object.
+
=cut
sub execute {
my $self = shift;
my $object = shift;
+ my $instance = shift;
+ return 1;
}
diff --git a/lib/WebGUI/Workflow/Activity/NotifyAboutVersionTag.pm b/lib/WebGUI/Workflow/Activity/NotifyAboutVersionTag.pm
new file mode 100644
index 000000000..b49ed0ceb
--- /dev/null
+++ b/lib/WebGUI/Workflow/Activity/NotifyAboutVersionTag.pm
@@ -0,0 +1,119 @@
+package WebGUI::Workflow::Activity::NotifyAboutVersionTag;
+
+
+=head1 LEGAL
+
+ -------------------------------------------------------------------
+ WebGUI is Copyright 2001-2006 Plain Black Corporation.
+ -------------------------------------------------------------------
+ Please read the legal notices (docs/legal.txt) and the license
+ (docs/license.txt) that came with this distribution before using
+ this software.
+ -------------------------------------------------------------------
+ http://www.plainblack.com info@plainblack.com
+ -------------------------------------------------------------------
+
+=cut
+
+use strict;
+use base 'WebGUI::Workflow::Activity';
+use WebGUI::VersionTag;
+use WebGUI::Inbox;
+
+=head1 NAME
+
+Package WebGUI::Workflow::Activity::NotifyAboutVersionTag
+
+=head1 DESCRIPTION
+
+Ask someone for approval of a version tag. If they approve then the workflow continues. If not, it is cancelled.
+
+=head1 SYNOPSIS
+
+See WebGUI::Workflow::Activity for details on how to use any activity.
+
+=head1 METHODS
+
+These methods are available from this class:
+
+=cut
+
+#-------------------------------------------------------------------
+
+=head2 definition ( session, definition )
+
+See WebGUI::Workflow::Activity::defintion() for details.
+
+=cut
+
+sub definition {
+ my $class = shift;
+ my $session = shift;
+ my $definition = shift;
+ my $i18n = WebGUI::International->new($session, "VersionTag");
+ push(@{$definition}, {
+ name=>$i18n->get("notify about version tag"),
+ properties=> {
+ who => {
+ fieldType=>"selectBox",
+ defaultValue=>"committer",
+ options => {
+ "committer" => $i18n->get("tag committer"),
+ "creator" => $i18n->get("tag creator"),
+ "groupToUse" => $i18n->get("group to use")
+ },
+ label=>$i18n->get("who to notify"),
+ hoverHelp=>$i18n->get("who to notify help")
+ },
+ subject => {
+ fieldType=>"text",
+ defaultValue=>"",
+ label=>$i18n->get("notify subject"),
+ hoverHelp => $i18n->get("notify subject help")
+ },
+ message => {
+ fieldType=>"textarea",
+ defaultValue => "",
+ label=> $i18n->get("notify message"),
+ hoverHelp => $i18n->get("notify message help")
+ },
+ }
+ });
+ return $class->SUPER::definition($session,$definition);
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 execute ( )
+
+See WebGUI::Workflow::Activity::execute() for details.
+
+=cut
+
+sub execute {
+ my $self = shift;
+ my $versionTag = shift;
+ my $inbox = WebGUI::Inbox->new($self->session);
+ my $properties = {
+ status=>"completed",
+ subject=>$self->get("subject"),
+ message=>$self->get("message")."\n\n".$versionTag->get("name")."\n\n".$versionTag->get("comments"),
+ };
+ if ($self->get("who") eq "committer") {
+ $properties->{userId} = $versionTag->get("committedBy");
+ } elsif ($self->get("who") eq "creator") {
+ $properties->{userId} = $versionTag->get("createdBy");
+ } else {
+ $properties->{groupId} = $versionTag->get("groupToUse");
+ }
+ $inbox->addMessage($properties);
+ return 1;
+}
+
+
+
+
+1;
+
+
diff --git a/lib/WebGUI/Workflow/Activity/RequestApprovalForVersionTag.pm b/lib/WebGUI/Workflow/Activity/RequestApprovalForVersionTag.pm
new file mode 100644
index 000000000..87b940009
--- /dev/null
+++ b/lib/WebGUI/Workflow/Activity/RequestApprovalForVersionTag.pm
@@ -0,0 +1,133 @@
+package WebGUI::Workflow::Activity::RequestApprovalForVersionTag;
+
+
+=head1 LEGAL
+
+ -------------------------------------------------------------------
+ WebGUI is Copyright 2001-2006 Plain Black Corporation.
+ -------------------------------------------------------------------
+ Please read the legal notices (docs/legal.txt) and the license
+ (docs/license.txt) that came with this distribution before using
+ this software.
+ -------------------------------------------------------------------
+ http://www.plainblack.com info@plainblack.com
+ -------------------------------------------------------------------
+
+=cut
+
+use strict;
+use base 'WebGUI::Workflow::Activity';
+use WebGUI::VersionTag;
+use WebGUI::Inbox;
+
+=head1 NAME
+
+Package WebGUI::Workflow::Activity::RequestApprovalForVersionTag
+
+=head1 DESCRIPTION
+
+Ask someone for approval of a version tag. If they approve then the workflow continues. If not, it is cancelled.
+
+=head1 SYNOPSIS
+
+See WebGUI::Workflow::Activity for details on how to use any activity.
+
+=head1 METHODS
+
+These methods are available from this class:
+
+=cut
+
+#-------------------------------------------------------------------
+
+=head2 definition ( session, definition )
+
+See WebGUI::Workflow::Activity::defintion() for details.
+
+=cut
+
+sub definition {
+ my $class = shift;
+ my $session = shift;
+ my $definition = shift;
+ my $i18n = WebGUI::International->new($session, "VersionTag");
+ push(@{$definition}, {
+ name=>$i18n->get("request approval for version tag"),
+ properties=> {
+ groupToApprove => {
+ fieldType=>"group",
+ defaultValue=>["4"],
+ label=>$i18n->get("group to approve"),
+ hoverHelp=>$i18n->get("group to approve help")
+ },
+ subject => {
+ fieldType=>"text",
+ defaultValue=>"",
+ label=>$i18n->get("approval subject"),
+ hoverHelp => $i18n->get("approval subject help")
+ },
+ message => {
+ fieldType=>"textarea",
+ defaultValue => "",
+ label=> $i18n->get("approval message"),
+ hoverHelp => $i18n->get("approval message help")
+ },
+ doOnDeny => {
+ fieldType=>"workflow",
+ defaultValue=>"pbwf",
+ label=>$i18n->get("do on deny"),
+ hoverHelp => $i18n->get("do on deny help")
+ }
+ }
+ });
+ return $class->SUPER::definition($session,$definition);
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 execute ( )
+
+See WebGUI::Workflow::Activity::execute() for details.
+
+=cut
+
+sub execute {
+ my $self = shift;
+ my $versionTag = shift;
+ my $instance = shift;
+ my $inbox = WebGUI::Inbox->new($self->session);
+ if ($instance->getScratch("status") eq "") {
+ my $message = $inbox->addMessage({
+ subject=>$self->get("subject"),
+ message=>join("\n\n",$self->get("message"),
+ $self->session->url->page("op=manageRevisionsInTag;workflowInstanceId=".$instance->getId.";tagId=".$versionTag->getId),
+ $versionTag->get('name'), $versionTag->get("comments")),
+ groupId=>$self->get("groupToApprove")
+ });
+ $instance->setScratch("messageId",$message->getId);
+ $instance->setScratch("status","notified");
+ } elsif ($instance->getScratch("status") eq "denied") {
+ my $newInstance = WebGUI::Workflow::Instance->create($self->session, {
+ workflowId=>$self->get("doOnDeny"),
+ methodName=>$instance->get("methodName"),
+ className=>$instance->get("className"),
+ parameters=>$instance->get("parameters"),
+ priority=>$instance->get("priority")
+ });
+ $instance->delete;
+ } elsif ($instance->getScratch("status") eq "approved") {
+ my $message = $inbox->getMessage($instance->getScratch("messageId"));
+ $message->setCompleted;
+ $instance->deleteScratch("messageId");
+ $instance->deleteScratch("status");
+ return 1;
+ }
+}
+
+
+
+
+1;
+
+
diff --git a/lib/WebGUI/Workflow/Activity/UnlockVersionTag.pm b/lib/WebGUI/Workflow/Activity/UnlockVersionTag.pm
new file mode 100644
index 000000000..5f475417e
--- /dev/null
+++ b/lib/WebGUI/Workflow/Activity/UnlockVersionTag.pm
@@ -0,0 +1,81 @@
+package WebGUI::Workflow::Activity::UnlockVersionTag;
+
+
+=head1 LEGAL
+
+ -------------------------------------------------------------------
+ WebGUI is Copyright 2001-2006 Plain Black Corporation.
+ -------------------------------------------------------------------
+ Please read the legal notices (docs/legal.txt) and the license
+ (docs/license.txt) that came with this distribution before using
+ this software.
+ -------------------------------------------------------------------
+ http://www.plainblack.com info@plainblack.com
+ -------------------------------------------------------------------
+
+=cut
+
+use strict;
+use base 'WebGUI::Workflow::Activity';
+use WebGUI::VersionTag;
+
+
+=head1 NAME
+
+Package WebGUI::Workflow::Activity::UnlockVersionTag
+
+=head1 DESCRIPTION
+
+This activity commits an open version tag.
+
+=head1 SYNOPSIS
+
+See WebGUI::Workflow::Activity for details on how to use any activity.
+
+=head1 METHODS
+
+These methods are available from this class:
+
+=cut
+
+#-------------------------------------------------------------------
+
+=head2 definition ( session, definition )
+
+See WebGUI::Workflow::Activity::defintion() for details.
+
+=cut
+
+sub definition {
+ my $class = shift;
+ my $session = shift;
+ my $definition = shift;
+ my $i18n = WebGUI::International->new($session, "VersionTag");
+ push(@{$definition}, {
+ name=>$i18n->get("unlock version tag"),
+ properties=> { }
+ });
+ return $class->SUPER::definition($session,$definition);
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 execute ( )
+
+See WebGUI::Workflow::Activity::execute() for details.
+
+=cut
+
+sub execute {
+ my $self = shift;
+ my $versionTag = shift;
+ $versionTag->unlock;
+}
+
+
+
+
+1;
+
+
diff --git a/lib/WebGUI/Workflow/Instance.pm b/lib/WebGUI/Workflow/Instance.pm
index b35a5d93a..1ba55ab3a 100644
--- a/lib/WebGUI/Workflow/Instance.pm
+++ b/lib/WebGUI/Workflow/Instance.pm
@@ -81,6 +81,7 @@ Removes this instance.
sub delete {
my $self = shift;
+ $self->session->db->write("delete from WorkflowInstanceScratch where instanceId=?",[$self->getId]);
$self->session->db->deleteRow("WorkflowInstance","instanceId",$self->getId);
WebGUI::Workflow::Spectre->new($self->session)->notify("workflow/deleteJob",$self->getId);
undef $self;
@@ -88,6 +89,25 @@ sub delete {
#-------------------------------------------------------------------
+=head2 deleteScratch ( name )
+
+Removes a scratch variable that's assigned to this instance.
+
+=head3 name
+
+The name of the variable to remove.
+
+=cut
+
+sub deleteScratch {
+ my $self = shift;
+ my $name = shift;
+ delete $self->{_scratch}{$name};
+ $self->session->db->write("delete from WorkflowInstanceScratch where instanceId=?", [$self->getId]);
+}
+
+#-------------------------------------------------------------------
+
=head2 DESTROY ( )
Deconstructor.
@@ -116,6 +136,23 @@ sub get {
#-------------------------------------------------------------------
+=head2 getScratch ( name )
+
+Returns the value for a given scratch variable.
+
+=cut
+
+sub get {
+ my $self = shift;
+ my $name = shift;
+ unless (exists $self->{_scratch}) {
+ $self->{_scratch} = $self->session->db->buildHashRef("select name,value from WorkflowInstanceScratch where instanceId=?", [ $self->getId ]);
+ }
+ return $self->{_scratch}{$name};
+}
+
+#-------------------------------------------------------------------
+
=head2 getId ( )
Returns the ID of this instance.
@@ -188,7 +225,7 @@ sub run {
return "error";
}
}
- $activity->execute($object);
+ $activity->execute($object, $self);
}
@@ -257,6 +294,30 @@ sub set {
$spectre->notify("workflow/addJob",$self->session->config->getFilename, $self->{_data});
}
+#-------------------------------------------------------------------
+
+=head2 setScratch (name, value)
+
+Attaches a scratch variable to this workflow instance.
+
+=head3 name
+
+A scalar representing the name of the variable.
+
+=head3 value
+
+A scalar value to assign to the variable.
+
+=cut
+
+sub setScratch {
+ my $self = shift;
+ my $name = shift;
+ my $value = shift;
+ delete $self->{_scratch};
+ $self->session->write("replace into WorkflowInstanceScratch (instanceId, name, value) values (?,?,?)", [$self->getId, $name, $value]);
+}
+
1;
diff --git a/lib/WebGUI/i18n/English/Asset_Post.pm b/lib/WebGUI/i18n/English/Asset_Post.pm
index 9a8559989..8e04ce417 100644
--- a/lib/WebGUI/i18n/English/Asset_Post.pm
+++ b/lib/WebGUI/i18n/English/Asset_Post.pm
@@ -152,7 +152,7 @@ Defaults to mixed.
'post template variables body' => {
message => q|The following variables are available in all Post templates. Internationalized labels
- for the action URLs (reply, delete, deny, etc.) are provided in the set of Collaboration Template labels.
+ for the action URLs (reply, delete, etc.) are provided in the set of Collaboration Template labels.
userId
@@ -197,17 +197,13 @@ A URL to edit this Post.
status
-The status of this Post, typically "Approved", "Denied", "Pending" or "Archived".
+The status of this Post: "Approved", "Pending" or "Archived".
approve.url
The URL to approve this Post, if it's moderated.
-deny.url
-The URL to deny this Post, if it's moderated.
-
-
reply.url
The URL to reply to this Post without quoting it.
@@ -408,11 +404,6 @@ back the data with a simple <tmpl_var userDefined1>.
lastUpdated => 1031514049,
},
- 'denied' => {
- message => q|Denied|,
- lastUpdated => 1031514049
- },
-
'pending' => {
message => q|Pending|,
lastUpdated => 1031514049
diff --git a/lib/WebGUI/i18n/English/VersionTag.pm b/lib/WebGUI/i18n/English/VersionTag.pm
index b2f431233..96165f4ec 100644
--- a/lib/WebGUI/i18n/English/VersionTag.pm
+++ b/lib/WebGUI/i18n/English/VersionTag.pm
@@ -1,6 +1,156 @@
package WebGUI::i18n::English::VersionTag;
our $I18N = {
+ 'comments' => {
+ message => q|Comments|,
+ lastUpdated => 0,
+ context => q|label on the manage revisions in tag page during the approval process|
+ },
+
+ 'comments help' => {
+ message => q|Attach any comments or feedback to this tag that you wish. They will be available to anyone looking at this tag throughout the publish and approval process, as well as in the future as reference.|,
+ lastUpdated => 0,
+ context => q|hover help for the comments field|
+ },
+
+ 'deny' => {
+ message => q|Deny|,
+ lastUpdated => 0,
+ context => q|label on the manage revisions in tag page during the approval process|
+ },
+
+ 'approve' => {
+ message => q|Approve|,
+ lastUpdated => 0,
+ context => q|label on the manage revisions in tag page during the approval process|
+ },
+
+ 'approve/deny' => {
+ message => q|Approve/Deny|,
+ lastUpdated => 0,
+ context => q|label on the manage revisions in tag page during the approval process|
+ },
+
+ 'approve/deny help' => {
+ message => q|Do you wish to approve or deny this tag?|,
+ lastUpdated => 0,
+ context => q|hover help for the approve/deny field|
+ },
+
+ 'tag committer' => {
+ message => q|Tag Committer|,
+ lastUpdated => 0,
+ context => q|label in the notify about version tag activity|
+ },
+
+ 'tag creator' => {
+ message => q|Tag Creator|,
+ lastUpdated => 0,
+ context => q|label in the notify about version tag activity|
+ },
+
+ 'who to notify' => {
+ message => q|Notify whom?|,
+ lastUpdated => 0,
+ context => q|label in the notify about version tag activity|
+ },
+
+ 'who to notify help' => {
+ message => q|Notify the person that created the tag, the person that committed the tag, or the people who were allowed to work on the tag.|,
+ lastUpdated => 0,
+ context => q|hover help for the who to notify field|
+ },
+
+ 'notify message' => {
+ message => q|Notification Message|,
+ lastUpdated => 0,
+ context => q|label in the notify about version tag activity|
+ },
+
+ 'notify message help' => {
+ message => q|Type a message that will be sent along with the tag data.|,
+ lastUpdated => 0,
+ context => q|hover help for the notify message field|
+ },
+
+ 'notify subject' => {
+ message => q|Notification Subject|,
+ lastUpdated => 0,
+ context => q|label in the notify about version tag activity|
+ },
+
+ 'notify subject help' => {
+ message => q|Enter the subject line of the approval message.|,
+ lastUpdated => 0,
+ context => q|hover help for the notify subject field|
+ },
+
+ 'notify about version tag' => {
+ message => q|Notify About Version Tag|,
+ lastUpdated => 0,
+ context => q|the name of the activity|
+ },
+
+ 'approval subject' => {
+ message => q|Approval Subject|,
+ lastUpdated => 0,
+ context => q|label in the request approval for version tag activity|
+ },
+
+ 'approval subject help' => {
+ message => q|Enter the subject line of the approval message.|,
+ lastUpdated => 0,
+ context => q|hover help for the approval subject field|
+ },
+
+ 'approval message' => {
+ message => q|Approval Message|,
+ lastUpdated => 0,
+ context => q|label in the request approval for version tag activity|
+ },
+
+ 'approval message help' => {
+ message => q|Type a message that will be sent to the approver's along with the approval link and the tag data.|,
+ lastUpdated => 0,
+ context => q|hover help for the approval message field|
+ },
+
+ 'do on deny' => {
+ message => q|Do On Deny|,
+ lastUpdated => 0,
+ context => q|label in the request approval for version tag activity|
+ },
+
+ 'do on deny help' => {
+ message => q|What workflow should we run if the tag is denied approval?|,
+ lastUpdated => 0,
+ context => q|hover help for the do on deny field|
+ },
+
+ 'group to approve' => {
+ message => q|Group To Approve|,
+ lastUpdated => 0,
+ context => q|label in the request approval for version tag activity|
+ },
+
+ 'group to approve help' => {
+ message => q|Which group should be notified and allowed to approve or deny this tag?|,
+ lastUpdated => 0,
+ context => q|hover help for the group to approve field|
+ },
+
+ 'request approval for version tag' => {
+ message => q|Request Approval For Version Tag|,
+ lastUpdated => 0,
+ context => q|the name of the activity|
+ },
+
+ 'unlock version tag' => {
+ message => q|Unlock Version Tag|,
+ lastUpdated => 0,
+ context => q|the name of the activity|
+ },
+
'current tag is called' => {
message => q|You are currently working under a tag called|,
lastUpdated => 0,