getting activity forms into a working condition
This commit is contained in:
parent
6ee05b85af
commit
5be7a021d8
7 changed files with 159 additions and 65 deletions
|
|
@ -113,7 +113,11 @@ sub addWorkflow {
|
||||||
priority=>3,
|
priority=>3,
|
||||||
workflowId=>$workflow->getId
|
workflowId=>$workflow->getId
|
||||||
}, "pbcron0000000000000001");
|
}, "pbcron0000000000000001");
|
||||||
|
$session->config->set("workflowActivities", {
|
||||||
|
none=>["WebGUI::Workflow::Activity::CleanTempStorage"],
|
||||||
|
user=>[],
|
||||||
|
versiontag=>[]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -344,5 +344,14 @@
|
||||||
|
|
||||||
"spectreCryptoKey" : "123qwe"
|
"spectreCryptoKey" : "123qwe"
|
||||||
|
|
||||||
|
# Define the workflow activities that are available in the editing
|
||||||
|
# process and what object types they support.
|
||||||
|
|
||||||
|
"workflowActivities" : {
|
||||||
|
"none": [ "WebGUI::Workflow::Activity::CleanTempStorage" ],
|
||||||
|
"user" : [ ],
|
||||||
|
"revisiontag" : [ ]
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,8 @@ These methods are available from this class:
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
=head2 definition ( [definition] )
|
|
||||||
|
=head2 definition ( session, [definition] )
|
||||||
|
|
||||||
Returns an array reference of definitions. Adds tableName, className, properties to array definition.
|
Returns an array reference of definitions. Adds tableName, className, properties to array definition.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,45 @@ sub create {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 definition ( session, definition )
|
||||||
|
|
||||||
|
Sets up the parameters of the activity for use in forms in the workflow editor. This is a class method.
|
||||||
|
|
||||||
|
=head3 session
|
||||||
|
|
||||||
|
A reference to the current session.
|
||||||
|
|
||||||
|
=head3 definition
|
||||||
|
|
||||||
|
An array reference containing a list of hash hreferences of properties.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub definition {
|
||||||
|
my $class = shift;
|
||||||
|
my $session = shift;
|
||||||
|
my $definition = shift;
|
||||||
|
my $i18n = WebGUI::International->new($session, "Workflow_Activity");
|
||||||
|
push (@{$definition}, {
|
||||||
|
name=>$i18n->get("topicName"),
|
||||||
|
properties=>{
|
||||||
|
title=>{
|
||||||
|
defaultValue=>"Untitled",
|
||||||
|
label=>$i18n->get("title"),
|
||||||
|
hoverHelp=>$i18n->get("title help")
|
||||||
|
},
|
||||||
|
description=>{
|
||||||
|
defaultValue=>undef,
|
||||||
|
label=>$i18n->get("description"),
|
||||||
|
hoverHelp=>$i18n->get("description help")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return $definition;
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 delete ( )
|
=head2 delete ( )
|
||||||
|
|
||||||
Removes this activity from its workflow.
|
Removes this activity from its workflow.
|
||||||
|
|
@ -180,20 +219,10 @@ A reference to the current session.
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub getName {
|
sub getName {
|
||||||
|
my $class = shift;
|
||||||
my $session = shift;
|
my $session = shift;
|
||||||
return "Unnamed";
|
my $definition = $class->definition($session);
|
||||||
}
|
return $definition->[0]{name};
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 getType ( )
|
|
||||||
|
|
||||||
Returns the type of workflow that this activity may be used in. Unless this method is overriden, the type is "none". This is a class method.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub getType {
|
|
||||||
return "none";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,47 @@ sub checkFileAge {
|
||||||
return $flag;
|
return $flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=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_CleanTempStorage");
|
||||||
|
push(@{$definition}, {
|
||||||
|
name=>$i18n->get("topicName"),
|
||||||
|
properties=> {
|
||||||
|
storageTimeout => {
|
||||||
|
label=>$i18n->get("storage timeout"),
|
||||||
|
defaultValue=>6*60*60,
|
||||||
|
hoverHelp=>$i18n->get("storage timeout help")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return $class->SUPER::definition($session,$definition);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 execute ( )
|
||||||
|
|
||||||
|
See WebGUI::Workflow::Activity::execute() for details.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub execute {
|
||||||
|
my $self = shift;
|
||||||
|
$self->recurseFileSystem($self->session->config->get("uploadsPath")."/temp");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 recurseFileSystem ( path )
|
=head2 recurseFileSystem ( path )
|
||||||
|
|
@ -95,56 +136,6 @@ sub recurseFileSystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 execute ( )
|
|
||||||
|
|
||||||
See WebGUI::Workflow::Activity::execute() for details.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub execute {
|
|
||||||
my $self = shift;
|
|
||||||
$self->recurseFileSystem($self->session->config->get("uploadsPath")."/temp");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 getEditForm ( )
|
|
||||||
|
|
||||||
See WebGUI::Workflow::Activity::getEditForm() for details.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub getEditForm {
|
|
||||||
my $self = shift;
|
|
||||||
my $form = $self->SUPER::getEditForm();
|
|
||||||
$form->interval(
|
|
||||||
-name=>"storageTimeout",
|
|
||||||
-label=>"Storage Timeout",
|
|
||||||
-defaultValue=>6*60*60,
|
|
||||||
-value=>$self->get("storageTimeout")
|
|
||||||
);
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 getName ( session )
|
|
||||||
|
|
||||||
See WebGUI::Workflow::Activity::getName() for details.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub getName {
|
|
||||||
my $session = shift;
|
|
||||||
return "Clean Temp Storage";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
36
lib/WebGUI/i18n/English/Workflow_Activity.pm
Normal file
36
lib/WebGUI/i18n/English/Workflow_Activity.pm
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
package WebGUI::i18n::English::Workflow_Activity;
|
||||||
|
|
||||||
|
our $I18N = {
|
||||||
|
'description help' => {
|
||||||
|
message => q|Put a long explaination here of what this activity is doing.|,
|
||||||
|
context => q|the hover help for the description field|,
|
||||||
|
lastUpdated => 0,
|
||||||
|
},
|
||||||
|
|
||||||
|
'description' => {
|
||||||
|
message => q|Description|,
|
||||||
|
context => q|a label for the human readable description|,
|
||||||
|
lastUpdated => 0,
|
||||||
|
},
|
||||||
|
|
||||||
|
'title help' => {
|
||||||
|
message => q|Put a name here that identifies what this activity is doing.|,
|
||||||
|
context => q|the hover help for the title field|,
|
||||||
|
lastUpdated => 0,
|
||||||
|
},
|
||||||
|
|
||||||
|
'title' => {
|
||||||
|
message => q|Title|,
|
||||||
|
context => q|a label for the human readable title|,
|
||||||
|
lastUpdated => 0,
|
||||||
|
},
|
||||||
|
|
||||||
|
'topicName' => {
|
||||||
|
message => q|Unnamed|,
|
||||||
|
context => q|The name of this workflow activity.|,
|
||||||
|
lastUpdated => 0,
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package WebGUI::i18n::English::Workflow_Activity_CleanTempStorage;
|
||||||
|
|
||||||
|
our $I18N = {
|
||||||
|
'storage timeout help' => {
|
||||||
|
message => q|How old should temp files be before we delete them?|,
|
||||||
|
context => q|the hover help for the storage timeout field|,
|
||||||
|
lastUpdated => 0,
|
||||||
|
},
|
||||||
|
|
||||||
|
'storage timeout' => {
|
||||||
|
message => q|Storage Timeout|,
|
||||||
|
context => q|a label indicating how old temp files should be before we delete them|,
|
||||||
|
lastUpdated => 0,
|
||||||
|
},
|
||||||
|
|
||||||
|
'topicName' => {
|
||||||
|
message => q|Clean Temp Storage|,
|
||||||
|
context => q|The name of this workflow activity.|,
|
||||||
|
lastUpdated => 0,
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
1;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue