remove Do Nothing On Delete workflow and allow none to be selected for on delete etc workflow

remove remnants of realtime workflow selection code
This commit is contained in:
Graham Knop 2008-08-22 16:10:00 +00:00
parent 5fc629993a
commit 778a32df19
8 changed files with 44 additions and 32 deletions

View file

@ -1,4 +1,6 @@
7.6.0 7.6.0
- remove Do Nothing On Delete workflow and allow none to be selected for on delete etc workflow
- remove remnants of realtime workflow selection code
7.5.22 7.5.22
- fixed: Layout template now gets prepared correctly - fixed: Layout template now gets prepared correctly

View file

@ -28,11 +28,32 @@ my $quiet; # this line required
my $session = start(); # this line required my $session = start(); # this line required
# upgrade functions go here removeDoNothingOnDelete( $session );
finish($session); # this line required finish($session); # this line required
#----------------------------------------------------------------------------
sub removeDoNothingOnDelete {
my $session = shift;
print "\tRemoving 'Do Nothing On Delete workflow if not customized... " unless $quiet;
my $workflow = WebGUI::Workflow->new($session, 'DPWwf20061030000000001');
if ($workflow) {
my $activities = $workflow->getActivities;
if (@$activities == 0) {
# safe to delete.
for my $setting (qw(trashWorkflow purgeWorkflow changeUrlWorkflow)) {
my $setValue = $session->setting->get($setting);
if ($setValue eq 'DPWwf20061030000000001') {
$session->setting->set($setting, undef);
}
}
$workflow->delete;
}
}
print "Done.\n" unless $quiet;
}
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Describe what our function does # Describe what our function does
#sub exampleFunction { #sub exampleFunction {

View file

@ -1458,7 +1458,6 @@ sub www_editThing {
-type=>"WebGUI::Asset::Wobject::Thingy", -type=>"WebGUI::Asset::Wobject::Thingy",
-label=>$i18n->get('on add workflow label'), -label=>$i18n->get('on add workflow label'),
-none=>1, -none=>1,
-includeRealtime=>1,
-hoverHelp=>$i18n->get('on add workflow description'), -hoverHelp=>$i18n->get('on add workflow description'),
); );
@ -1468,7 +1467,6 @@ sub www_editThing {
-type=>"WebGUI::Asset::Wobject::Thingy", -type=>"WebGUI::Asset::Wobject::Thingy",
-label=>$i18n->get('on edit workflow label'), -label=>$i18n->get('on edit workflow label'),
-none=>1, -none=>1,
-includeRealtime=>1,
-hoverHelp=>$i18n->get('on edit workflow description'), -hoverHelp=>$i18n->get('on edit workflow description'),
); );
@ -1478,7 +1476,6 @@ sub www_editThing {
-type=>"WebGUI::Asset::Wobject::Thingy", -type=>"WebGUI::Asset::Wobject::Thingy",
-label=>$i18n->get('on delete workflow label'), -label=>$i18n->get('on delete workflow label'),
-none=>1, -none=>1,
-includeRealtime=>1,
-hoverHelp=>$i18n->get('on delete workflow description'), -hoverHelp=>$i18n->get('on delete workflow description'),
); );

View file

@ -247,11 +247,18 @@ sub _invokeWorkflowOnExportedFiles {
my $workflowId = shift; my $workflowId = shift;
my $clearExportedAs = shift; my $clearExportedAs = shift;
my ($lastExportedAs) = $self->get("lastExportedAs"); if ($clearExportedAs) {
my $wfInstance = WebGUI::Workflow::Instance->create($self->session, { workflowId => $self->session->setting->get('trashWorkflow') }); $self->session->db->write("UPDATE asset SET lastExportedAs = NULL WHERE assetId = ?", [$self->getId]);
$wfInstance->setScratch(WebGUI::Workflow::Activity::DeleteExportedFiles::DELETE_FILES_SCRATCH(), Storable::freeze([defined($lastExportedAs)? ($lastExportedAs) : ()])); }
$clearExportedAs and $self->session->db->write("UPDATE asset SET lastExportedAs = NULL WHERE assetId = ?", [$self->getId]); if ($workflowId) {
$wfInstance->start(1); my ($lastExportedAs) = $self->get("lastExportedAs");
my $wfInstance = WebGUI::Workflow::Instance->create($self->session, { workflowId => $workflowId });
$wfInstance->setScratch(
WebGUI::Workflow::Activity::DeleteExportedFiles::DELETE_FILES_SCRATCH() =>
Storable::freeze([ defined($lastExportedAs) ? ($lastExportedAs) : () ])
);
$wfInstance->start(1);
}
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -75,11 +75,6 @@ A text label that will be displayed if toHtmlWithWrapper() is called. Defaults t
If set to 1 then a "None" option will appear in the list of workflows, which will store a null value in the field. Defaults to 0. If set to 1 then a "None" option will appear in the list of workflows, which will store a null value in the field. Defaults to 0.
=head4 includeRealtime
Most workflow triggers can't handle realtime workflows, so we leave out realtime workflows unless they should
specifically be included.
=cut =cut
sub definition { sub definition {
@ -103,9 +98,6 @@ sub definition {
noneLabel => { noneLabel => {
defaultValue => $i18n->get("form control none label"), defaultValue => $i18n->get("form control none label"),
}, },
includeRealtime => {
defaultValue => 0
},
}); });
return $class->SUPER::definition($session, $definition); return $class->SUPER::definition($session, $definition);
} }
@ -157,7 +149,7 @@ Renders a template picker control.
sub toHtml { sub toHtml {
my $self = shift; my $self = shift;
my $workflowList = WebGUI::Workflow->getList($self->session, $self->get("type"), $self->get("includeRealtime")); my $workflowList = WebGUI::Workflow->getList($self->session, $self->get("type"));
if ( $self->get("none") ) { if ( $self->get("none") ) {
my $noneLabel = $self->get("noneLabel"); my $noneLabel = $self->get("noneLabel");

View file

@ -79,7 +79,6 @@ sub definition {
type=>"WebGUI::VersionTag", type=>"WebGUI::VersionTag",
label=>$i18n->get("default version tag workflow"), label=>$i18n->get("default version tag workflow"),
hoverHelp=>$i18n->get('default version tag workflow help'), hoverHelp=>$i18n->get('default version tag workflow help'),
includeRealtime=>1,
}); });
push(@fields, { push(@fields, {
tab=>"content", tab=>"content",
@ -104,7 +103,8 @@ sub definition {
defaultValue=>$setting->get("trashWorkflow"), defaultValue=>$setting->get("trashWorkflow"),
type=>"None", type=>"None",
label=>$i18n->get("trash workflow"), label=>$i18n->get("trash workflow"),
hoverHelp=>$i18n->get('trash workflow help') hoverHelp=>$i18n->get('trash workflow help'),
none => 1,
}); });
push(@fields, { push(@fields, {
tab=>"content", tab=>"content",
@ -113,7 +113,8 @@ sub definition {
defaultValue=>$setting->get("purgeWorkflow"), defaultValue=>$setting->get("purgeWorkflow"),
type=>"None", type=>"None",
label=>$i18n->get("purge workflow"), label=>$i18n->get("purge workflow"),
hoverHelp=>$i18n->get('purge workflow help') hoverHelp=>$i18n->get('purge workflow help'),
none => 1,
}); });
push(@fields, { push(@fields, {
tab=>"content", tab=>"content",
@ -122,7 +123,8 @@ sub definition {
defaultValue=>$setting->get("changeUrlWorkflow"), defaultValue=>$setting->get("changeUrlWorkflow"),
type=>"None", type=>"None",
label=>$i18n->get("changeUrl workflow"), label=>$i18n->get("changeUrl workflow"),
hoverHelp=>$i18n->get('changeUrl workflow help') hoverHelp=>$i18n->get('changeUrl workflow help'),
none => 1,
}); });
my %htmlFilter = ( my %htmlFilter = (

View file

@ -235,7 +235,6 @@ sub www_editVersionTag {
$f->workflow( $f->workflow(
value=>$workflowId, value=>$workflowId,
type=>"WebGUI::VersionTag", type=>"WebGUI::VersionTag",
includeRealtime=>1,
); );
$f->group( $f->group(
value=>[$groupId], value=>[$groupId],

View file

@ -282,7 +282,7 @@ sub getId {
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 getList ( session, [ type, includeRealtime ] ) =head2 getList ( session, [ type ] )
Returns a hash reference of workflowId/title pairs of all enabled workflows. This is a class method. Returns a hash reference of workflowId/title pairs of all enabled workflows. This is a class method.
@ -294,26 +294,18 @@ A reference to the current session.
If specified this will limit the list to a certain type of workflow based upon the object type that the workflow is set up to handle. If specified this will limit the list to a certain type of workflow based upon the object type that the workflow is set up to handle.
=head3 includeRealtime
If set to 1 the list returned will include workflows with a mode of "realtime", otherwise it won't.
=cut =cut
sub getList { sub getList {
my $class = shift; my $class = shift;
my $session = shift; my $session = shift;
my $type = shift; my $type = shift;
my $includeRealtime = shift;
my $sql = "select workflowId, title from Workflow where enabled=1"; my $sql = "select workflowId, title from Workflow where enabled=1";
my @params; my @params;
if ($type) { if ($type) {
$sql .= " and type=?"; $sql .= " and type=?";
push(@params, $type); push(@params, $type);
} }
unless ($includeRealtime) {
$sql .= " and mode<>'realtime'";
}
return $session->db->buildHashRef($sql, \@params); return $session->db->buildHashRef($sql, \@params);
} }