From 103969816e7c166778d18ce473f71b718e9f9aee Mon Sep 17 00:00:00 2001
From: JT Smith 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 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.
'.$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|
-UI level: 6.
-
-UI level: 6
-
UI level: 6
@@ -709,14 +695,6 @@ each asset under the tab "Meta" in the asset properties.
-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; -