mostly working workflow

This commit is contained in:
JT Smith 2006-03-17 23:13:27 +00:00
parent 46c8e25e3a
commit 11cc18a5c3
8 changed files with 31 additions and 66 deletions

View file

@ -88,6 +88,7 @@ sub getOperations {
'setWorkingVersionTag' => 'WebGUI::Operation::VersionTag',
'addWorkflow' => 'WebGUI::Operation::Workflow',
'deleteWorkflow' => 'WebGUI::Operation::Workflow',
'runWorkflow' => 'WebGUI::Operation::Workflow',
'editWorkflowActivity' => 'WebGUI::Operation::Workflow',
'editWorkflowActivitySave' => 'WebGUI::Operation::Workflow',
'deleteWorkflowActivity' => 'WebGUI::Operation::Workflow',
@ -99,7 +100,6 @@ sub getOperations {
'editCronJob' => 'WebGUI::Operation::Cron',
'editCronJobSave' => 'WebGUI::Operation::Cron',
'deleteCronJob' => 'WebGUI::Operation::Cron',
'spectre' => 'WebGUI::Operation::Spectre',
'adminConsole' => 'WebGUI::Operation::Admin',
'switchOffAdmin' => 'WebGUI::Operation::Admin',
'switchOnAdmin' => 'WebGUI::Operation::Admin',

View file

@ -1,50 +0,0 @@
package WebGUI::Operation::Spectre;
#-------------------------------------------------------------------
# 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 Crypt::Blowfish;
use JSON;
use WebGUI::Utility;
=head1 NAME
Package WebGUI::Operation::Spectre
=head1 DESCRIPTION
Operation handler for Spectre functions.
=cut
#-------------------------------------------------------------------
=head2 www_spectre ( )
Checks to ensure the requestor is who we think it is, and then executes a spectre function, and returns a data packet.
=cut
sub www_spectre {
my $session = shift;
return $session->privilege->insufficient unless (isInSubnet($session->env->get("REMOTE_ADDR"), $session->config->get("spectreSubnets")));
my $cipher = Crypt::Blowfish->new($session->config->get("spectreCryptoKey"));
my $payload = jsonToObj($cipher->decrypt($session->form->get("payload")));
my $out = {};
if ($payload->{do} eq "runWorkflow") {
# do workflow stuff
}
return $cipher->encrypt(objToJson($out));
}
1;

View file

@ -208,6 +208,7 @@ sub www_commitVersionTagConfirm {
if (defined $tag && $session->user->isInGroup($tag->get("groupToUse"))) {
$tag->set({comments=>$session->form->process("comments", "textarea")});
$tag->commit;
#$tag->requestCommit;
my $i18n = WebGUI::International->new($session, "VersionTag");
my $ac = WebGUI::AdminConsole->new($session,"versions");
return $ac->render(

View file

@ -17,6 +17,8 @@ use WebGUI::HTMLForm;
use WebGUI::International;
use WebGUI::Workflow;
use WebGUI::Workflow::Activity;
use WebGUI::Workflow::Instance;
use WebGUI::Utility;
=head1 NAME
@ -297,4 +299,26 @@ sub www_manageWorkflows {
return $ac->render($output);
}
#-------------------------------------------------------------------
=head2 www_runWorkflow ( )
Checks to ensure the requestor is who we think it is, and then executes a workflow and returns the results.
=cut
sub www_runWorkflow {
my $session = shift;
$session->http->setMimeType("text/plain");
return "error" unless (isInSubnet($session->env->get("REMOTE_ADDR"), $session->config->get("spectreSubnets")));
my $instanceId = $session->form->param("instanceId");
if ($instanceId) {
my $instance = WebGUI::Workflow::Instance->new($session, $instanceId);
if (defined $instance) {
return $instance->run;
}
}
return "error";
}
1;

View file

@ -239,7 +239,7 @@ Locks the version tag and then kicks off the approval/commit workflow for it.
sub requestCommit {
my $self = shift;
$self->lock;
my $instance = WebGUI::Workflow::Instance->new($self->session, {
my $instance = WebGUI::Workflow::Instance->create($self->session, {
workflowId=>$self->get("workflowId"),
className=>"WebGUI::VersionTag",
method=>"new",