From 5be7a021d8e1f0335e216e231c2c2ebb3150c45a Mon Sep 17 00:00:00 2001 From: JT Smith Date: Thu, 16 Feb 2006 15:27:48 +0000 Subject: [PATCH] getting activity forms into a working condition --- docs/upgrades/upgrade_6.8.6-6.9.0.pl | 6 +- etc/WebGUI.conf.original | 9 ++ lib/WebGUI/Asset/Wobject.pm | 3 +- lib/WebGUI/Workflow/Activity.pm | 55 ++++++++--- .../Workflow/Activity/CleanTempStorage.pm | 91 +++++++++---------- lib/WebGUI/i18n/English/Workflow_Activity.pm | 36 ++++++++ .../Workflow_Activity_CleanTempStorage.pm | 24 +++++ 7 files changed, 159 insertions(+), 65 deletions(-) create mode 100644 lib/WebGUI/i18n/English/Workflow_Activity.pm create mode 100644 lib/WebGUI/i18n/English/Workflow_Activity_CleanTempStorage.pm diff --git a/docs/upgrades/upgrade_6.8.6-6.9.0.pl b/docs/upgrades/upgrade_6.8.6-6.9.0.pl index 2a0cfc5d2..ddc819e35 100644 --- a/docs/upgrades/upgrade_6.8.6-6.9.0.pl +++ b/docs/upgrades/upgrade_6.8.6-6.9.0.pl @@ -113,7 +113,11 @@ sub addWorkflow { priority=>3, workflowId=>$workflow->getId }, "pbcron0000000000000001"); - + $session->config->set("workflowActivities", { + none=>["WebGUI::Workflow::Activity::CleanTempStorage"], + user=>[], + versiontag=>[] + }); } #------------------------------------------------- diff --git a/etc/WebGUI.conf.original b/etc/WebGUI.conf.original index 832c8561e..e900a41b1 100644 --- a/etc/WebGUI.conf.original +++ b/etc/WebGUI.conf.original @@ -344,5 +344,14 @@ "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" : [ ] + }, + } diff --git a/lib/WebGUI/Asset/Wobject.pm b/lib/WebGUI/Asset/Wobject.pm index bcfc652ee..332226629 100644 --- a/lib/WebGUI/Asset/Wobject.pm +++ b/lib/WebGUI/Asset/Wobject.pm @@ -48,7 +48,8 @@ These methods are available from this class: =cut #------------------------------------------------------------------- -=head2 definition ( [definition] ) + +=head2 definition ( session, [definition] ) Returns an array reference of definitions. Adds tableName, className, properties to array definition. diff --git a/lib/WebGUI/Workflow/Activity.pm b/lib/WebGUI/Workflow/Activity.pm index a4b0e164b..09a23e7f3 100644 --- a/lib/WebGUI/Workflow/Activity.pm +++ b/lib/WebGUI/Workflow/Activity.pm @@ -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 ( ) Removes this activity from its workflow. @@ -180,20 +219,10 @@ A reference to the current session. =cut sub getName { + my $class = shift; my $session = shift; - return "Unnamed"; -} - -#------------------------------------------------------------------- - -=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"; + my $definition = $class->definition($session); + return $definition->[0]{name}; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Workflow/Activity/CleanTempStorage.pm b/lib/WebGUI/Workflow/Activity/CleanTempStorage.pm index f678e5767..0812316e5 100644 --- a/lib/WebGUI/Workflow/Activity/CleanTempStorage.pm +++ b/lib/WebGUI/Workflow/Activity/CleanTempStorage.pm @@ -64,6 +64,47 @@ sub checkFileAge { 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 ) @@ -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; diff --git a/lib/WebGUI/i18n/English/Workflow_Activity.pm b/lib/WebGUI/i18n/English/Workflow_Activity.pm new file mode 100644 index 000000000..8a891e789 --- /dev/null +++ b/lib/WebGUI/i18n/English/Workflow_Activity.pm @@ -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; diff --git a/lib/WebGUI/i18n/English/Workflow_Activity_CleanTempStorage.pm b/lib/WebGUI/i18n/English/Workflow_Activity_CleanTempStorage.pm new file mode 100644 index 000000000..6a6efa40c --- /dev/null +++ b/lib/WebGUI/i18n/English/Workflow_Activity_CleanTempStorage.pm @@ -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;