diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt
index 8f6da3c95..8ee2fdabd 100644
--- a/docs/changelog/6.x.x.txt
+++ b/docs/changelog/6.x.x.txt
@@ -1,4 +1,5 @@
6.99.0
+ - Removed start/end dates from assets in favor of the workflow system.
- Readded the purge option to the trash manager.
- Added archive/unarchive options to CS threads.
- Added a database cache option as an alternative to memcached.
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 4b21a6ff2..2429e5530 100644
--- a/docs/upgrades/upgrade_6.8.7-6.99.0.pl
+++ b/docs/upgrades/upgrade_6.8.7-6.99.0.pl
@@ -109,7 +109,7 @@ sub addWorkflow {
description text,
enabled int not null default 0,
isSerial int not null default 0,
- type varchar(255) not null default 'none'
+ type varchar(255) not null default 'None'
)");
$session->db->write("create table WorkflowActivity (
activityId varchar(22) binary not null primary key,
@@ -129,7 +129,7 @@ sub addWorkflow {
title=>"Daily Maintenance Tasks",
description=>"This workflow runs daily maintenance tasks such as cleaning up old temporary files and cache.",
enabled=>1,
- type=>"none"
+ type=>"None"
}, "pbworkflow000000000001");
my $activity = $workflow->addActivity("WebGUI::Workflow::Activity::CleanTempStorage", "pbwfactivity0000000001");
$activity->set("title","Delete temp files older than 24 hours");
@@ -147,16 +147,19 @@ sub addWorkflow {
workflowId=>$workflow->getId
}, "pbcron0000000000000001");
$session->config->set("workflowActivities", {
- none=>["WebGUI::Workflow::Activity::DecayKarma", "WebGUI::Workflow::Activity::TrashClipboard", "WebGUI::Workflow::Activity::CleanTempStorage",
+ 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"],
- user=>[],
- versiontag=>["WebGUI::Workflow::Activity::CommitVersionTag", "WebGUI::Workflow::Activity::RollbackVersionTag"]
+ User=>[],
+ VersionTag=>["WebGUI::Workflow::Activity::CommitVersionTag", "WebGUI::Workflow::Activity::RollbackVersionTag",
+ "WebGUI::Workflow::Activity::TrashVersionTag"]
});
+ $session->db->write("alter table assetData drop column startDate");
+ $session->db->write("alter table assetData drop column endDate");
$workflow = WebGUI::Workflow->create($session, {
title=>"Weekly Maintenance Tasks",
description=>"This workflow runs once per week to perform maintenance tasks like cleaning up log files.",
enabled=>1,
- type=>"none"
+ type=>"None"
}, "pbworkflow000000000002");
$activity = $workflow->addActivity("WebGUI::Workflow::Activity::CleanLoginHistory", "pbwfactivity0000000003");
$activity->set("title", "Delete login entries older than 90 days");
@@ -183,6 +186,14 @@ sub addWorkflow {
$session->config->delete("DecayKarma_minimumKarma");
$session->config->delete("DecayKarma_decayFactor");
$session->config->delete("DeleteExpiredClipboard_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.",
+ enabled=>1,
+ type=>"VersionTag"
+ }, "pbworkflow000000000003");
+ $activity = $workflow->addActivity("WebGUI::Workflow::Activity::CommitVersionTag", "pbwfactivity0000000006");
+ $activity->set("title", "Commit Assets");
}
#-------------------------------------------------
@@ -465,6 +476,9 @@ sub removeFiles {
unlink '../../lib/WebGUI/i18n/Asset_IndexedSearch.pm';
unlink '../../sbin/Hourly/IndexedSearch_buildIndex.pm';
rmtree('../../lib/WebGUI/Asset/Wobject/IndexedSearch');
+ # uncomment this after they've all been converted
+ #rmtree('../../sbin/Hourly');
+ #unlink('../../sbin/runHourly.pl');
}
#-------------------------------------------------
diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm
index f0f8c657e..29e07cb20 100644
--- a/lib/WebGUI/Asset.pm
+++ b/lib/WebGUI/Asset.pm
@@ -130,9 +130,7 @@ sub canView {
return 0 unless ($self->get("state") eq "published");
if ($userId eq $self->get("ownerUserId")) {
return 1;
- } elsif ( $self->get("startDate") <$self->session->datetime->time() &&
- $self->get("endDate") >$self->session->datetime->time() &&
- $self->session->user->isInGroup($self->get("groupIdView"),$userId)) {
+ } elsif ($self->session->user->isInGroup($self->get("groupIdView"),$userId)) {
return 1;
}
return $self->canEdit($userId);
@@ -195,14 +193,6 @@ sub definition {
fieldType=>'selectBox',
defaultValue=>'3'
},
- startDate=>{
- fieldType=>'dateTime',
- defaultValue=>997995720
- },
- endDate=>{
- fieldType=>'dateTime',
- defaultValue=>4294967294
- },
status=>{
noFormPost=>1,
fieldType=>'hidden',
@@ -316,7 +306,7 @@ Returns a reference to a list of properties (or specified property) of an Asset.
=head3 propertyName
-Any of the values associated with the properties of an Asset. Default choices are "title", "menutTitle", "synopsis", "url", "groupIdEdit", "groupIdView", "ownerUserId", "startDate", "endDate", and "assetSize".
+Any of the values associated with the properties of an Asset. Default choices are "title", "menutTitle", "synopsis", "url", "groupIdEdit", "groupIdView", "ownerUserId", and "assetSize".
=cut
@@ -560,20 +550,6 @@ sub getEditForm {
-hoverHelp=>$i18n->get('encrypt page description'),
-uiLevel=>6
);
- $tabform->getTab("security")->dateTime(
- -name=>"startDate",
- -label=>$i18n->get(497),
- -hoverHelp=>$i18n->get('497 description'),
- -value=>$self->get("startDate"),
- -uiLevel=>6
- );
- $tabform->getTab("security")->dateTime(
- -name=>"endDate",
- -label=>$i18n->get(498),
- -hoverHelp=>$i18n->get('498 description'),
- -value=>$self->get("endDate"),
- -uiLevel=>6
- );
my $subtext;
if ($self->session->user->isInGroup(3)) {
$subtext = $self->session->icon->manage('op=listUsers');
@@ -1706,8 +1682,6 @@ sub www_add {
styleTemplateId => $self->get("styleTemplateId"),
printableStyleTemplateId => $self->get("printableStyleTemplateId"),
isHidden => $self->get("isHidden"),
- startDate => $self->get("startDate"),
- endDate => $self->get("endDate"),
className=>$class,
assetId=>"new"
);
diff --git a/lib/WebGUI/Asset/FilePile.pm b/lib/WebGUI/Asset/FilePile.pm
index b8690cca9..ac300afb2 100644
--- a/lib/WebGUI/Asset/FilePile.pm
+++ b/lib/WebGUI/Asset/FilePile.pm
@@ -84,20 +84,6 @@ sub edit {
-uiLevel=>6
);
$tabform->addTab("security",$i18n->get(107,"Asset"),6);
- $tabform->getTab("security")->dateTime(
- -name=>"startDate",
- -label=>$i18n->get(497),
- -hoverHelp=>$i18n->get('497 description'),
- -value=>$self->get("startDate"),
- -uiLevel=>6
- );
- $tabform->getTab("security")->dateTime(
- -name=>"endDate",
- -label=>$i18n->get(498),
- -hoverHelp=>$i18n->get('498 description'),
- -value=>$self->get("endDate"),
- -uiLevel=>6
- );
my $subtext;
if ($self->session->user->isInGroup(3)) {
$subtext = $self->session->icon->manage('op=listUsers');
diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm
index 0b12c66fa..a27b6be78 100644
--- a/lib/WebGUI/Asset/Post.pm
+++ b/lib/WebGUI/Asset/Post.pm
@@ -693,8 +693,6 @@ sub processPropertiesFromFormPost {
}
$data{groupIdView} =$self->getThread->getParent->get("groupIdView");
$data{groupIdEdit} = $self->getThread->getParent->get("groupIdEdit");
- $data{startDate} = $self->getThread->getParent->get("startDate") unless ($self->session->form->process("startDate"));
- $data{endDate} = $self->getThread->getParent->get("endDate") unless ($self->session->form->process("endDate"));
($data{synopsis}, $data{content}) = $self->getSynopsisAndContentFromFormPost;
if ($self->getThread->getParent->get("addEditStampToPosts")) {
$data{content} .= "\n\n --- (".$i18n->get('Edited_on','Asset_Post')." ".$self->session->datetime->epochToHuman(undef,"%z %Z [GMT%O]").$i18n->get('By','Asset_Post').$self->session->user->profileField("alias").") --- \n";
@@ -1147,18 +1145,6 @@ sub www_edit {
name=>'contentType',
value=>$self->getValue("contentType") || "mixed"
});
- my $startDate = $self->get("startDate");
- $startDate = $self->session->datetime->setToEpoch($self->session->form->process("startDate")) if ($self->session->form->process("startDate"));
- $var{'startDate.form'} = WebGUI::Form::dateTime($self->session, {
- name => 'startDate',
- value => $startDate
- });
- my $endDate = $self->get("endDate");
- $endDate = $self->session->datetime->setToEpoch($self->session->form->process("endDate")) if ($self->session->form->process("endDate"));
- $var{'endDate.form'} = WebGUI::Form::dateTime($self->session, {
- name => 'endDate',
- value => $endDate
- });
$self->getThread->getParent->appendTemplateLabels(\%var);
return $self->getThread->getParent->processStyle($self->processTemplate(\%var,$self->getThread->getParent->get("postFormTemplateId")));
}
diff --git a/lib/WebGUI/Asset/Wobject/Collaboration.pm b/lib/WebGUI/Asset/Wobject/Collaboration.pm
index 532e9a6b9..6ad8dfca6 100644
--- a/lib/WebGUI/Asset/Wobject/Collaboration.pm
+++ b/lib/WebGUI/Asset/Wobject/Collaboration.pm
@@ -42,12 +42,6 @@ sub appendPostListTemplateVars {
$controls .= $self->session->icon->moveUp('func=promote',$post->get("url")).$self->session->icon->moveDown('func=demote',$post->get("url"));
}
}
- my $inDateRange;
- if ($post->get("startDate") < $self->session->datetime->time() && $post->get("endDate") > $self->session->datetime->time()) {
- $inDateRange = 1;
- } else {
- $inDateRange = 0;
- }
my @rating_loop;
for (my $i=0;$i<=$post->get("rating");$i++) {
push(@rating_loop,{'rating_loop.count'=>$i});
@@ -90,7 +84,6 @@ sub appendPostListTemplateVars {
"user.isVisitor"=>$post->get("ownerUserId") eq "1",
"edit.url"=>$post->getEditUrl,
'controls'=>$controls,
- 'inDateRange'=>$inDateRange,
"isSecond"=>(($i+1)%2==0),
"isThird"=>(($i+1)%3==0),
"isFourth"=>(($i+1)%4==0),
@@ -127,7 +120,6 @@ sub appendTemplateLabels {
$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->{'image.label'} = $i18n->get("image");
$var->{"job.header.label"} = $i18n->get("edit job");
@@ -160,7 +152,6 @@ sub appendTemplateLabels {
$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->{"synopsis.label"} = $i18n->get("synopsis");
diff --git a/lib/WebGUI/Asset/Wobject/Matrix.pm b/lib/WebGUI/Asset/Wobject/Matrix.pm
index c4bf0f735..2489acb40 100644
--- a/lib/WebGUI/Asset/Wobject/Matrix.pm
+++ b/lib/WebGUI/Asset/Wobject/Matrix.pm
@@ -613,8 +613,6 @@ sub www_editListingSave {
url=>$self->session->form->process("productName"),
groupIdView=>7,
groupIdEdit=>3,
- startDate=>$self->session->datetime->time(),
- endDate=>$self->session->datetime->time()+60*60*24*365*15,
displayLastReply => 0,
allowReplies => 1,
threadsPerPage => 30,
diff --git a/lib/WebGUI/AssetBranch.pm b/lib/WebGUI/AssetBranch.pm
index e570e7c2b..5d4fd4e31 100644
--- a/lib/WebGUI/AssetBranch.pm
+++ b/lib/WebGUI/AssetBranch.pm
@@ -183,22 +183,6 @@ sub www_editBranch {
-uiLevel=>6,
-subtext=>'
'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_encryptPage"})
);
- $tabform->getTab("security")->dateTime(
- -name=>"startDate",
- -label=>$i18n->get(497),
- -hoverHelp=>$i18n->get('497 description',"Asset"),
- -value=>$self->get("startDate"),
- -uiLevel=>6,
- -subtext=>'
'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_startDate"})
- );
- $tabform->getTab("security")->dateTime(
- -name=>"endDate",
- -label=>$i18n->get(498),
- -hoverHelp=>$i18n->get('498 description',"Asset"),
- -value=>$self->get("endDate"),
- -uiLevel=>6,
- -subtext=>'
'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_endDate"})
- );
my $subtext;
if ($self->session->user->isInGroup(3)) {
$subtext = $self->session->icon->manage('op=listUsers');
@@ -296,8 +280,6 @@ sub www_editBranchSave {
$data{cacheTimeout} = $self->session->form->interval("cacheTimeout") if ($self->session->form->yesNo("change_cacheTimeout"));
$data{cacheTimeoutVisitor} = $self->session->form->interval("cacheTimeoutVisitor") if ($self->session->form->yesNo("change_cacheTimeoutVisitor"));
$data{encryptPage} = $self->session->form->yesNo("encryptPage") if ($self->session->form->yesNo("change_encryptPage"));
- $data{startDate} = $self->session->form->dateTime("startDate") if ($self->session->form->yesNo("change_startDate"));
- $data{endDate} = $self->session->form->dateTime("endDate") if ($self->session->form->yesNo("change_endDate"));
$data{ownerUserId} = $self->session->form->selectBox("ownerUserId") if ($self->session->form->yesNo("change_ownerUserId"));
$data{groupIdView} = $self->session->form->group("groupIdView") if ($self->session->form->yesNo("change_groupIdView"));
$data{groupIdEdit} = $self->session->form->group("groupIdEdit") if ($self->session->form->yesNo("change_groupIdEdit"));
diff --git a/lib/WebGUI/AssetClipboard.pm b/lib/WebGUI/AssetClipboard.pm
index eba14c999..11fcbc518 100644
--- a/lib/WebGUI/AssetClipboard.pm
+++ b/lib/WebGUI/AssetClipboard.pm
@@ -220,8 +220,6 @@ sub www_createShortcut () {
menuTitle=>$self->getMenuTitle,
isHidden=>$self->get("isHidden"),
newWindow=>$self->get("newWindow"),
- startDate=>$self->get("startDate"),
- endDate=>$self->get("endDate"),
ownerUserId=>$self->get("ownerUserId"),
groupIdEdit=>$self->get("groupIdEdit"),
groupIdView=>$self->get("groupIdView"),
diff --git a/lib/WebGUI/AssetVersioning.pm b/lib/WebGUI/AssetVersioning.pm
index 833e938bd..b1fdd24ff 100644
--- a/lib/WebGUI/AssetVersioning.pm
+++ b/lib/WebGUI/AssetVersioning.pm
@@ -58,9 +58,9 @@ sub addRevision {
my $now = shift ||$self->session->datetime->time();
my $versionTag = $self->session->scratch->get("versionTag") || 'pbversion0000000000002';
my $status = $self->session->setting->get("autoCommit") ? 'approved' : 'pending';
- $self->session->db->write("insert into assetData (assetId, revisionDate, revisedBy, tagId, status, url, startDate, endDate,
+ $self->session->db->write("insert into assetData (assetId, revisionDate, revisedBy, tagId, status, url,
ownerUserId, groupIdEdit, groupIdView) values (".$self->session->db->quote($self->getId).",".$now.", ".$self->session->db->quote($self->session->user->userId).",
- ".$self->session->db->quote($versionTag).", ".$self->session->db->quote($status).", ".$self->session->db->quote($self->getId).", 997995720, 32472169200,'3','3','7')");
+ ".$self->session->db->quote($versionTag).", ".$self->session->db->quote($status).", ".$self->session->db->quote($self->getId).", '3','3','7')");
foreach my $definition (@{$self->definition($self->session)}) {
unless ($definition->{tableName} eq "assetData") {
$self->session->db->write("insert into ".$definition->{tableName}." (assetId,revisionDate) values (".$self->session->db->quote($self->getId).",".$now.")");
diff --git a/lib/WebGUI/Operation/Cron.pm b/lib/WebGUI/Operation/Cron.pm
index 93a0224fd..4d0297cda 100644
--- a/lib/WebGUI/Operation/Cron.pm
+++ b/lib/WebGUI/Operation/Cron.pm
@@ -95,9 +95,11 @@ sub www_editCronJob {
hoverHelp=>$i18n->get("run once help")
);
my $value = $cron->get("workflowId") if defined $cron;
+ my $type = "None" unless defined $cron;
$f->workflow(
name=>"workflowId",
value=>$value,
+ type=>$type,
label=>$i18n->get("workflow"),
hoverHelp=>$i18n->get("workflow help")
);
diff --git a/lib/WebGUI/Operation/Workflow.pm b/lib/WebGUI/Operation/Workflow.pm
index 4019f1285..a6b0bf476 100644
--- a/lib/WebGUI/Operation/Workflow.pm
+++ b/lib/WebGUI/Operation/Workflow.pm
@@ -45,15 +45,15 @@ sub www_addWorkflow {
name=>"op",
value=>"addWorkflowSave"
);
+ my %options = ();
+ foreach my $object (keys %{$session->config->get("workflowActivities")}) {
+ $options{$object} = $object;
+ }
$f->selectBox(
name=>"type",
label=>$i18n->get("object type"),
- options=>{
- none=>$i18n->get("none"),
- versiontag=>$i18n->get("versiontag"),
- user=>$i18n->get("user")
- },
- value=>"none",
+ options=>\%options,
+ value=>"None",
hoverHelp=>$i18n->get("object type help")
);
$f->submit;
@@ -154,7 +154,7 @@ sub www_editWorkflow {
);
$f->readOnly(
label=>$i18n->get("object type"),
- value=>$workflow->getTypeName
+ value=>$workflow->get("type")
);
$f->text(
name=>"title",
diff --git a/lib/WebGUI/VersionTag.pm b/lib/WebGUI/VersionTag.pm
index 40337c793..21e99a318 100644
--- a/lib/WebGUI/VersionTag.pm
+++ b/lib/WebGUI/VersionTag.pm
@@ -89,10 +89,8 @@ Commits all assets edited under a version tag, and then sets the version tag to
sub commit {
my $self = shift;
- my $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=?", [$tagId]);
- while (my ($id,$class,$version) = $sth->array) {
- WebGUI::Asset->new($self->session,$id,$class,$version)->commit;
+ foreach my $asset (@{$self->getAssets}) {
+ $asset->commit;
}
$self->{_data}{isCommited} = 1;
$self->{_data}{commitedBy} = $self->session->user->userId;
@@ -118,6 +116,24 @@ sub get {
#-------------------------------------------------------------------
+=head2 getAssets ( )
+
+Returns a list of asset objects that are part of this version tag.
+
+=cut
+
+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]);
+ while (my ($id,$class,$version) = $sth->array) {
+ push(@assets, WebGUI::Asset->new($self->session,$id,$class,$version));
+ }
+ return \@assets;
+}
+
+#-------------------------------------------------------------------
+
=head2 getId ( )
Returns the ID of this version tag.
diff --git a/lib/WebGUI/Workflow.pm b/lib/WebGUI/Workflow.pm
index 5e044fd71..8377aedb8 100644
--- a/lib/WebGUI/Workflow.pm
+++ b/lib/WebGUI/Workflow.pm
@@ -268,25 +268,6 @@ sub getNextActivity {
}
-#-------------------------------------------------------------------
-
-=head2 getTypeName ( [ type ] )
-
-Returns a human readable name for the object type this workflow supports.
-
-=head3 type
-
-Optionally override the type by specifying it here.
-
-=cut
-
-sub getTypeName {
- my $self = shift;
- my $type = shift || $self->get("type");
- my $i18n = WebGUI::International->new($self->session,"Workflow");
- return $i18n->get($type);
-}
-
#-------------------------------------------------------------------
=head2 new ( session, workflowId )
@@ -349,7 +330,7 @@ A boolean indicating whether this workflow may be executed right now.
=head4 type
-A string indicating the type of object this workflow will be operating on. Valid values are "none", "versiontag" and "user".
+A string indicating the type of object this workflow will be operating on. Valid values are "None", "VersionTag" and "User".
=head4 isSerial
@@ -372,7 +353,7 @@ sub set {
}
$self->{_data}{title} = $properties->{title} || $self->{_data}{title} || "Untitled";
$self->{_data}{description} = (exists $properties->{description}) ? $properties->{description} : $self->{_data}{description};
- $self->{_data}{type} = $properties->{type} || $self->{_data}{type} || "none";
+ $self->{_data}{type} = $properties->{type} || $self->{_data}{type} || "None";
$self->session->db->setRow("Workflow","workflowId",$self->{_data});
}
diff --git a/lib/WebGUI/Workflow/Activity/CommitVersionTag.pm b/lib/WebGUI/Workflow/Activity/CommitVersionTag.pm
index 71bfcf229..4122b2420 100644
--- a/lib/WebGUI/Workflow/Activity/CommitVersionTag.pm
+++ b/lib/WebGUI/Workflow/Activity/CommitVersionTag.pm
@@ -26,7 +26,7 @@ Package WebGUI::Workflow::Activity::CommitVersionTag
=head1 DESCRIPTION
-This activity commmits an open version tag.
+This activity commits an open version tag.
=head1 SYNOPSIS
diff --git a/lib/WebGUI/Workflow/Activity/CreateCronJob.pm b/lib/WebGUI/Workflow/Activity/CreateCronJob.pm
new file mode 100644
index 000000000..b2d0b5978
--- /dev/null
+++ b/lib/WebGUI/Workflow/Activity/CreateCronJob.pm
@@ -0,0 +1,155 @@
+package WebGUI::Workflow::Activity::CreateCronJob;
+
+
+=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::Workflow::Cron;
+
+
+=head1 NAME
+
+Package WebGUI::Workflow::Activity::CreateCronJob
+
+=head1 DESCRIPTION
+
+Creates a new cron job passing the object that is current running to the new workflow instance created by the cron job.
+
+=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, "Workflow_Cron");
+ my %priorities = ();
+ tie %priorities, 'Tie::IxHash';
+ %priorities = (1=>$i18n->get("high"), 2=>$i18n->get("medium"), 3=>$i18n->get("low"));
+ push(@{$definition}, {
+ name=>$i18n->get("create cron job"),
+ properties=> {
+ enabled=>{
+ fieldType=>"yesNo",
+ defaultValue=>0,
+ label=>$i18n->get("is enabled"),
+ hoverHelp=>$i18n->get("is enabled help")
+ },
+ runOnce=>{
+ fieldType=>"yesNo",
+ defaultValue=>1,
+ label=>$i18n->get("run once"),
+ hoverHelp=>$i18n->get("run once help")
+ },
+ workflowId=>{
+ fieldType=>"workflow",
+ defaultValue=>undef,
+ label=>$i18n->get("workflow"),
+ hoverHelp=>$i18n->get("workflow help")
+ },
+ priority=>{
+ fieldType=>"radioList",
+ vertical=>1,
+ defaultValue=>2,
+ options=>\%priorities,
+ label=>$i18n->get("priority"),
+ hoverHelp=>$i18n->get("priority help")
+ },
+ minuteOfHour=>{
+ fieldType=>"text",
+ defaultValue=>0,
+ label=>$i18n->get("minute of hour"),
+ hoverHelp=>$i18n->get("minute of hour help")
+ },
+ hourOfDay=>{
+ fieldType=>"text",
+ defaultValue=>"*",
+ label=>$i18n->get("hour of day"),
+ hoverHelp=>$i18n->get("hour of day help")
+ },
+ dayOfMonth=>{
+ fieldType=>"text",
+ defaultValue=>"*",
+ label=>$i18n->get("day of month"),
+ hoverHelp=>$i18n->get("day of month help")
+ },
+ monthOfYear=>{
+ fieldType=>"text",
+ defaultValue=>"*",
+ label=>$i18n->get("month of year"),
+ hoverHelp=>$i18n->get("month of year")
+ },
+ dayOfWeek=>{
+ fieldType=>"text",
+ defaultValue=>"*",
+ label=>$i18n->get("day of week"),
+ hoverHelp=>$i18n->get("day of week help")
+ }
+ }
+ });
+ return $class->SUPER::definition($session,$definition);
+}
+
+#-------------------------------------------------------------------
+
+=head2 execute ( )
+
+See WebGUI::Workflow::Activity::execute() for details.
+
+=cut
+
+sub execute {
+ my $self = shift;
+ my $object = shift;
+ my $cron = WebGUI::Workflow::Cron->create($self->session, {
+ title=>"Generated by workflow ".$self->getId." (".$self->get("title").")",
+ enabled=>$self->get("enabled"),
+ runOnce=>$self->get("runOnce"),
+ workflowId=>$self->get("workflowId"),
+ priority=>$self->get("priority"),
+ minuteOfHour=>$self->get("minuteOfHour"),
+ hourOfDay=>$self->get("hourOfDay"),
+ dayOfMonth=>$self->get("dayOfMonth"),
+ monthOfYear=>$self->get("monthOfYear"),
+ dayOfWeek=>$self->get("dayOfWeek"),
+ className=>$self->get("className"),
+ methodName=>$self->get("methodName"),
+ parameters=>$self->get("parameters")
+ });
+ return defined $cron ? 1 : 0;
+}
+
+
+
+
+1;
+
+
diff --git a/lib/WebGUI/Workflow/Activity/TrashVersionTag.pm b/lib/WebGUI/Workflow/Activity/TrashVersionTag.pm
new file mode 100644
index 000000000..de693c948
--- /dev/null
+++ b/lib/WebGUI/Workflow/Activity/TrashVersionTag.pm
@@ -0,0 +1,85 @@
+package WebGUI::Workflow::Activity::TrashVersionTag;
+
+
+=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::TrashVersionTag
+
+=head1 DESCRIPTION
+
+This activity trashes all content attached to a 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, "Workflow_Activity_TrashVersionTag");
+ push(@{$definition}, {
+ name=>$i18n->get("topicName"),
+ 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;
+ foreach my $asset (@{$versionTag->getAssets}) {
+ $asset->trash;
+ }
+ $versionTag->lock;
+ $versionTag->clearWorking;
+}
+
+
+
+
+1;
+
+
diff --git a/lib/WebGUI/i18n/English/Asset.pm b/lib/WebGUI/i18n/English/Asset.pm
index 6b4339bb6..3bea231d1 100644
--- a/lib/WebGUI/i18n/English/Asset.pm
+++ b/lib/WebGUI/i18n/English/Asset.pm
@@ -309,20 +309,6 @@ a URL will be made from the parent's URL and the Menu Title.
lastUpdated => 1127426194,
},
- '497 description' => {
- message => q|
The date when users may begin viewing this asset. Before this date only Content Managers with the rights to edit this asset will see it
-UI level: 6.
-
The date when users will stop viewing this asset. After this date only Content Managers with the rights to edit this asset will see it.
-UI level: 6
-
-endDate.label
-^International("phrase","Asset_Collaboration"); "^International("endDate","Asset_Collaboration");".
-
-
exactphrase.label
^International("phrase","Asset_Collaboration"); "^International("exactPhrase","Asset_Collaboration");".
@@ -767,10 +753,6 @@ our $I18N = { ^International("phrase","Asset_Collaboration"); "^International("edit submission","Asset_Collaboration");".
-startDate.label
-^International("phrase","Asset_Collaboration"); "^International("start date","Asset_Collaboration");".
-
-
stick.label
^International("phrase","Asset_Collaboration"); "^International("sticky","Asset_Collaboration");".
@@ -1070,11 +1052,6 @@ The URL to edit this Post.
controls
A set of editing icons to delete or re-order this Post.
-
-inDateRange
-A conditional indicating that the current time is greater than the start date and less than
-the end date.
-
isSecond
A conditional indicating that is true if this Post is the second in this Collaboration Asset.
diff --git a/lib/WebGUI/i18n/English/Asset_Post.pm b/lib/WebGUI/i18n/English/Asset_Post.pm
index 9d5baa223..9a8559989 100644
--- a/lib/WebGUI/i18n/English/Asset_Post.pm
+++ b/lib/WebGUI/i18n/English/Asset_Post.pm
@@ -141,14 +141,6 @@ A form field that will describe how the content of the post is formatted, HTML,
Defaults to mixed.
-startDate.form
-A form that will set when the post starts to be available.
-
-
-endDate.form
-A form that will set when the post stops being available.
-
- |, lastUpdated => 1134670945, }, @@ -365,14 +357,6 @@ The ID of the group with permission to view this Post. An alias for userId.
-startDate
-The date when the Post is first available, in epoch format.
-
-
-endDate
-The date when the Post is stops being available, in epoch format.
-
-
assetSize
The formatted size of this Post.
diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm index 631b20643..99bc1c8f8 100644 --- a/lib/WebGUI/i18n/English/WebGUI.pm +++ b/lib/WebGUI/i18n/English/WebGUI.pm @@ -998,11 +998,6 @@ removed from the system after a set period of time. That period of time is set lastUpdated => 1127337912, }, - '498' => { - message => q|End Date|, - lastUpdated => 1031514049 - }, - '483' => { message => q|Yes or No|, lastUpdated => 1031514049 @@ -2543,11 +2538,6 @@ The headings of columns on things like message boards and user contributions. lastUpdated => 1058092984 }, - '497' => { - message => q|Start Date|, - lastUpdated => 1031514049 - }, - '518' => { message => q|Inbox Notifications|, lastUpdated => 1031514049 diff --git a/lib/WebGUI/i18n/English/Workflow.pm b/lib/WebGUI/i18n/English/Workflow.pm index 99112af8d..734944a5e 100644 --- a/lib/WebGUI/i18n/English/Workflow.pm +++ b/lib/WebGUI/i18n/English/Workflow.pm @@ -13,24 +13,6 @@ our $I18N = { lastUpdated => 0, }, - 'none' => { - message => q|None|, - context => q|Workflow doesn't work on objects.|, - lastUpdated => 0, - }, - - 'versiontag' => { - message => q|Version Tag|, - context => q|Workflow can work on version tag objects.|, - lastUpdated => 0, - }, - - 'user' => { - message => q|User|, - context => q|Workflow can work on user objects.|, - lastUpdated => 0, - }, - 'object type help' => { message => q|What type of objects do you want this workflow to be able to handle?|, context => q|the hover help for the object type field|, diff --git a/lib/WebGUI/i18n/English/Workflow_Activity_TrashVersionTag.pm b/lib/WebGUI/i18n/English/Workflow_Activity_TrashVersionTag.pm new file mode 100644 index 000000000..e75fd172b --- /dev/null +++ b/lib/WebGUI/i18n/English/Workflow_Activity_TrashVersionTag.pm @@ -0,0 +1,13 @@ +package WebGUI::i18n::English::Workflow_Activity_TrashVersionTag; + +our $I18N = { + + 'topicName' => { + message => q|Trash Version Tag|, + context => q|The name of this workflow activity.|, + lastUpdated => 0, + }, + +}; + +1; diff --git a/lib/WebGUI/i18n/English/Workflow_Cron.pm b/lib/WebGUI/i18n/English/Workflow_Cron.pm index 0266a445f..f0708882d 100644 --- a/lib/WebGUI/i18n/English/Workflow_Cron.pm +++ b/lib/WebGUI/i18n/English/Workflow_Cron.pm @@ -169,6 +169,12 @@ our $I18N = { lastUpdated => 0, }, + 'create cron job' => { + message => q|Create a Scheduled Event|, + context => q|the title of the CreateCronJob workflow activity|, + lastUpdated => 0, + }, + 'topicName' => { message => q|Scheduler|, context => q|The title of the cron/scheduler interface.|, diff --git a/sbin/Hourly/TrashExpiredContent.pm b/sbin/Hourly/TrashExpiredContent.pm deleted file mode 100644 index a970ea5ef..000000000 --- a/sbin/Hourly/TrashExpiredContent.pm +++ /dev/null @@ -1,34 +0,0 @@ -package Hourly::TrashExpiredContent; - -#------------------------------------------------------------------- -# 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 -#------------------------------------------------------------------- - -use strict; -use WebGUI::Asset; -use WebGUI::Session; -use WebGUI::SQL; - -#----------------------------------------- -sub process { - my $offset = $session{config}{TrashExpiredContent_offset}; - if ($offset ne "") { - my $now = time(); - $offset = 86400*$offset; - my $sth = WebGUI::SQL->read("select asset.assetId, asset.className from assetData left join asset on assetData.assetId=asset.assetId where asset.state='published' and assetData.endDate + $offset < $now"); - while (my ($assetId,$class) = $sth->array) { - my $asset = WebGUI::Asset->new($assetId,$class); - $asset->trash if ($asset->get("endDate")+$offset < $now); # verify end date of most recent revision - } - $sth->finish; - } -} - -1; -