Merge branch 'WebGUI8' of github.com:plainblack/webgui into WebGUI8

This commit is contained in:
JT Smith 2010-08-27 13:41:36 -05:00
commit 1753ce64b3
156 changed files with 1044 additions and 940 deletions

View file

@ -261,6 +261,44 @@ sub getTreePaginator {
}
#----------------------------------------------------------------------
=head2 www_findUser ( )
Find a user based on a partial name, username, alias, or e-mail address
=cut
sub www_findUser {
my ( $self ) = @_;
my $session = $self->session;
my ( $form, $db, $url ) = $session->quick(qw( form db url ));
my $query = '%' . $form->get('query') . '%';
my @places; # Places to look
for my $col ( 'username', 'alias', 'firstName', 'lastName', 'CONCAT(firstName," ",lastName)' ) {
push @places, $col . " LIKE ?";
}
my $sql = 'SELECT userId, CONCAT(firstName,lastName) AS name, username, alias, avatar
FROM users JOIN userProfileData USING (userId) WHERE ' . join( ' || ', @places );
my $params = [ ( $query ) x scalar @places ];
$session->log->warn( 'SQL: ' . $sql );
$session->log->warn( 'PARAM: ' . join ", ", @$params );
my $sth = $db->read( $sql, $params );
my @results;
while ( my $result = $sth->hashRef ) {
$result->{avatar} ||= $url->extras('icon/user.png');
push @results, $result;
}
my $output = JSON->new->encode( { results => \@results } );
$session->log->warn( $output );
return $output;
}
#----------------------------------------------------------------------
=head2 www_getClipboard ( )
@ -485,6 +523,7 @@ sub www_view {
$style->setLink( $url->extras('yui/build/paginator/assets/skins/sam/paginator.css'), {rel=>'stylesheet', type=>'text/css'});
$style->setLink( $url->extras('yui/build/datatable/assets/skins/sam/datatable.css'), {rel=>'stylesheet', type=>'text/css'});
$style->setLink( $url->extras('yui/build/container/assets/skins/sam/container.css'), {rel=>'stylesheet', type=>'text/css'});
$style->setLink( $url->extras('yui/build/autocomplete/assets/skins/sam/autocomplete.css'), {rel=>'stylesheet', type=>'text/css'});
$style->setLink( $url->extras('yui/build/menu/assets/skins/sam/menu.css'), {rel=>'stylesheet', type=>'text/css'});
#$style->setLink( $url->extras('yui-webgui/build/assetManager/assetManager.css' ), { rel => "stylesheet", type => 'text/css' } );
$style->setLink( $url->extras('admin/admin.css'), { type=>'text/css', rel=>'stylesheet'} );
@ -501,6 +540,7 @@ sub www_view {
$style->setScript($url->extras('yui/build/tabview/tabview-min.js'));
$style->setScript($url->extras('yui/build/menu/menu-min.js'));
$style->setScript($url->extras('yui/build/button/button-min.js'));
$style->setScript($url->extras('yui/build/autocomplete/autocomplete-min.js'));
$style->setScript( $url->extras( 'yui/build/json/json-min.js' ) );
$style->setScript( $url->extras( 'yui-webgui/build/i18n/i18n.js' ) );
$style->setScript($url->extras('admin/admin.js'));
@ -602,7 +642,7 @@ __DATA__
<input type="button" id="backButton" value="&lt;" /><input type="button" id="forwardButton" value="&gt;" />
</span>
<div id="location">
<input type="text" id="locationUrl" value="" />
<input type="text" id="locationInput" value="" />
<span id="locationTitle"></span>
</div>
<span id="right">

View file

@ -957,7 +957,7 @@ sub getEditForm {
name => 'approved',
id => 'approveCheckbox',
value => 'approved',
label => 'Approved',
label => $i18n->get('560', 'WebGUI'),
checked => ( $session->setting->get( 'versionTagMode' ) eq 'autoCommit' ? 1 : 0 ),
} );
@ -2590,7 +2590,7 @@ sub www_add {
isHidden => $self->get("isHidden"),
className=>$class,
assetId=>"new",
url=>$self->session->form->param("url")
url=>scalar($self->session->form->param("url")),
);
$properties{isHidden} = 1 unless $self->session->config->get("assets/".$class."/isContainer");
my $newAsset = WebGUI::Asset->newByPropertyHashRef($self->session,\%properties);

View file

@ -1352,10 +1352,14 @@ override processEditForm => sub {
WebGUI::VersionTag->new($session, $self->tagId)->setWorking;
}
### Form is verified
# Events are always hidden from navigation
### Form is verified, fix properties
if (!$session->form->hasParam('groupIdView')) {
$self->update({
groupIdView => $self->getParent->get('groupIdView'),
});
}
if (!$self->get("groupIdEdit")) {
if (!$session->form->hasParam('groupIdEdit')) {
my $groupIdEdit = $self->getParent->groupIdEventEdit
|| $self->getParent->groupIdEdit
;

View file

@ -278,8 +278,14 @@ sub getResolutions {
my $self = shift;
my $storage = $self->getStorageLocation;
##Filter out the web view image and thumbnail files.
my @resolutions = grep { $_ ne $self->get("filename") } @{ $storage->getFiles };
# Return a list not including the web view image.
return [ sort { $a cmp $b } grep { $_ ne $self->filename } @{ $storage->getFiles } ];
@resolutions = map { $_->[1] }
sort { $a->[0] <=> $b->[0] }
map { my $number = $_; $number =~ s/\.\w+$//; [ $number, $_ ] } @resolutions;
return \@resolutions;
}
#----------------------------------------------------------------------------

View file

@ -135,7 +135,8 @@ sub fixFilenames {
my $extension = $storage->getFileExtension($file);
next FILE unless isIn($extension, qw/pl perl pm cgi php asp sh/);
my $newFile = $file;
$newFile =~ s/\.$extension/_$extension.txt/;
#$newFile =~ s/\.$extension$/_$extension.txt/;
$newFile =~ s/\.$extension$/_$extension.txt/;
$storage->renameFile($file, $newFile);
}
}

View file

@ -750,11 +750,11 @@ sub getTemplateVars {
$gotAttachment = 1;
}
push(@{$var{"attachment_loop"}}, {
url =>$fileUrl,
icon =>$var{"attachment.icon"},
filename =>$filename,
thumbnail =>$var{"image.thumbnail"},
isImage =>$isImage
url => $fileUrl,
icon => $storage->getFileIconUrl($filename),
filename => $filename,
thumbnail => $isImage ? $storage->getThumbnailUrl($filename) : '',
isImage => $isImage,
});
}
}

View file

@ -686,9 +686,7 @@ Return the asset that this Shortcut points to.
sub getShortcutDefault {
my $self = shift;
use Carp; $self->get('shortcutToAssetId') or Carp::confess('no ShortcutToAssetId; our getId says: ' . $self->getId);
warn "getShortcutDefault has a shortcutToAssetId of: " . $self->get('shortcutToAssetId');
return WebGUI::Asset->newById($self->session, $self->get("shortcutToAssetId")); # XXX "newById must get an assetId"
return WebGUI::Asset->newById($self->session, $self->get("shortcutToAssetId"));
}
#-------------------------------------------------------------------

View file

@ -22,6 +22,7 @@ use WebGUI::Asset::Wobject;
use WebGUI::Image::Graph;
use WebGUI::Storage;
use JSON;
use Try::Tiny;
use Moose;
use WebGUI::Definition::Asset;
@ -376,8 +377,15 @@ override processEditForm => sub {
}
if (WebGUI::Image::Graph->getPluginList($self->session)) {
my $graph = WebGUI::Image::Graph->processConfigurationForm($self->session);
$self->setGraphConfig( $graph->getConfiguration );
my $graph;
try {
$graph = WebGUI::Image::Graph->processConfigurationForm($self->session);
} catch {
$self->session->log->error( "Graph plugin not available or not functional: Error: ``$_''" );
};
if( $graph ) {
$self->setGraphConfig( $graph->getConfiguration );
}
}
$self->update($property);

View file

@ -162,12 +162,8 @@ sub generateFeed {
}
}, $self->cacheTimeout );
# if the content can be downgraded, it is either valid latin1 or didn't have
# an HTTP Content-Encoding header. In the second case, XML::FeedPP will take
# care of any encoding specified in the XML prolog
utf8::downgrade($value, 1);
eval {
my $singleFeed = XML::FeedPP->new($value, utf8_flag => 1, -type => 'string', %opt);
my $singleFeed = XML::FeedPP->new($value, utf8_flag => 1, -type => 'string', xml_deref => 1, %opt);
$feed->merge_channel($singleFeed);
$feed->merge_item($singleFeed);
};
@ -176,7 +172,6 @@ sub generateFeed {
}
}
# build a new feed that matches the term the user is interested in
if ($self->hasTerms ne '') {
my @terms = split /,\s*/, $self->hasTerms; # get the list of terms

View file

@ -2587,9 +2587,10 @@ sub www_editThingDataSaveViaAjax {
}
my $thingProperties = $self->getThing($thingId);
use Data::Dumper;
warn $thingId;
warn Dumper $thingProperties;
if ($thingProperties->{thingId}){
my ($privilegedGroup,$workflowId);
return $session->privilege->insufficient() unless $self->canEditThingData($thingId, $thingDataId
,$thingProperties);
@ -2600,12 +2601,15 @@ sub www_editThingDataSaveViaAjax {
my ($newThingDataId,$errors) = $self->editThingDataSave($thingId,$thingDataId);
if ($errors){
if (@{ $errors }) {
$session->http->setStatus(400);
return JSON->new->encode($errors);
}
$session->http->setStatus("200");
return '{}';
}
else {
warn "thingId not found in thingProperties\n";
$session->http->setStatus(404);
return JSON->new->encode({message => "The thingId you requested can not be found."});
}

View file

@ -19,7 +19,6 @@ use LWP::MediaTypes qw(guess_media_type);
use Time::HiRes;
use WebGUI::Asset;
use WebGUI::PassiveAnalytics::Logging;
use URI;
=head1 NAME
@ -143,9 +142,7 @@ sub getUrlPermutations {
push @permutations, $url;
$url =~ s/\.\w+$//;
}
my $uri = URI->new($url);
my @fragments = $uri->path_segments();
use Data::Dumper;
my @fragments = split /\//, $url;
FRAG: while (@fragments) {
last FRAG if $fragments[-1] eq '';
push @permutations, join "/", @fragments;

View file

@ -53,7 +53,7 @@ sub alignmentSeparator {
return "<br />\n";
}
else {
return " &nbsp; &nbsp;\n";
return "&nbsp;&nbsp;";
}
}

View file

@ -141,13 +141,14 @@ sub toHtml {
$checked = 1;
}
$output .= WebGUI::Form::Radio->new($self->session, {
name=>$self->get('name'),
value=>$key,
extras=>$self->get('extras'),
checked=>$checked,
id=>$self->get('name').$i
name => $self->get('name'),
value => $key,
extras => $self->get('extras'),
checked => $checked,
id => $self->get('name').$i,
label => $options->{$key},
})->toHtml;
$output .= '<label for="'.$self->get('name').$i.'">'.$options->{$key}."</label>" . $alignment;
$output .= $alignment;
}
$output .= "</fieldset>";
return $output;

View file

@ -15,8 +15,7 @@ package WebGUI::Form::YesNo;
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::Form::Radio;
use base 'WebGUI::Form::RadioList';
use WebGUI::International;
=head1 NAME
@ -39,6 +38,18 @@ The following methods are specifically available from this class. Check the supe
#-------------------------------------------------------------------
=head2 areOptionsSettable ( )
Options are predefined for a Yes/No.
=cut
sub areOptionsSettable {
return 0;
}
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
@ -92,6 +103,24 @@ sub getName {
#-------------------------------------------------------------------
=head2 getOptions
Return the options, set to defaults for the Yes/No. These options are not overridable.
=cut
sub getOptions {
my $self = shift;
my $i18n = WebGUI::International->new($self->session);
$self->set('options',{
1 => $i18n->get(138),
0 => $i18n->get(139),
});
return $self->SUPER::getOptions;
}
#-------------------------------------------------------------------
=head2 getValue ( [ value ] )
If value is present, we will process it, otherwise the superclass will handle the request.
@ -137,44 +166,5 @@ sub isDynamicCompatible {
return 1;
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a yes/no question field.
=cut
sub toHtml {
my $self = shift;
my $i18n = WebGUI::International->new($self->session);
my ($checkYes, $checkNo);
if ($self->getOriginalValue) {
$checkYes = 1;
} else {
$checkNo = 1;
}
my $output = '<fieldset style="border:none;margin:0;padding:0">'
. WebGUI::Form::Radio->new($self->session,
checked => $checkYes,
name => $self->get("name"),
value => 1,
extras => $self->get("extras"),
label => $i18n->get(138),
)->toHtml
. '&nbsp;&nbsp;&nbsp;'
. WebGUI::Form::Radio->new($self->session,
checked => $checkNo,
name => $self->get("name"),
value => 0,
extras => $self->get("extras"),
label => $i18n->get(139),
)->toHtml
. '</fieldset>'
;
return $output;
}
1;

View file

@ -1,5 +1,20 @@
package WebGUI::FormBuilder::Role::HasObjects;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2009 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 Moose::Role;
has 'objects' => (
@ -10,6 +25,34 @@ has 'objects' => (
# Objects combines "fields", "fieldsets", and "tabsets"
=head1 NAME
Package WebGUI::FormBuilder::Role::HasObjects
=head1 DESCRIPTION
Role that provides an attribute for holding a set of objects.
=head1 SYNOPSIS
This method is used by several FormBuilder packages that need to nest objects. For example, a FormBuilder object
can have multiple tabs, each of which can contain multiple form fields. The role provides an objects attribute,
and an addObject method for pushing an object onto the list of objects.
with 'WebGUI::FormBuilder::Role::HasObjects';
=head1 METHODS
=head2 addObject ($object)
Adds $object to the list of objects for the consumer.
=head3 $object
Some variable, or data. It really can be anything.
=cut
sub addObject {
my ( $self, $object ) = @_;
push @{$self->objects}, $object;

View file

@ -257,6 +257,16 @@ sub _transformMacro {
});
}
=head2 quote ($text)
Escape backslashes and single quotes, and then return the text wrapped in single quotes.
=head3 $text
Text to quote.
=cut
sub quote {
my $text = shift;
$text =~ s/([\\'])/\\$1/g;

View file

@ -18,6 +18,17 @@ use Try::Tiny;
use Scalar::Util 'blessed';
use HTTP::Status ();
=head2 transform_error ($env)
Transforms exceptions of the class WebGUI::Error::Fatal into HTTP 500 error messages, displaying
the contents of the exception to the user.
=head3 $env
A Plack environment hash
=cut
sub transform_error {
my $self = shift;
my ($e, $env) = @_;
@ -33,4 +44,4 @@ sub transform_error {
}
}
1;
1;

View file

@ -38,9 +38,15 @@ These subroutines are available from this package:
#-------------------------------------------------------------------
=head2 handler ( session )
=head2 call ( $env )
The content handler for this package.
Interface method for this middleware. It checks the settings for the special entry, upgradeState.
If this is set, then it returns an HTTP 503. It will also clear the maintenance state when the
upgrade is complete.
=head3 $env
A Plack environment hash. This is used to access the WebGUI Session object.
=cut

View file

@ -24,6 +24,14 @@ and not worry about closing it.
It also sets C<webgui.debug> as appropriate.
=head2 call ($env)
Interface method for this Middleware class.
=head3 $env
A plack environment hash
=cut
sub call {
@ -77,6 +85,17 @@ sub call {
);
}
=head2 canShowDebug ($env)
Checks to see whether or not the owner of this session can see debug output. It checks
WebGUI settings showDebug and ipDebug for this.
=head3 $env
A Plack environment hash.
=cut
sub canShowDebug {
my $self = shift;
my $env = shift;

View file

@ -16,6 +16,14 @@ L<WebGUI::URL::Snoop> described itself as "A URL handler that should never be ca
You might find this middleware useful as a template for creating other simple classes.
=head2 call ($env)
Interface method for Plack to call, for this class.
=head3 $env
A Plack environment hash
=cut
sub call {
@ -31,4 +39,4 @@ sub call {
}
}
1;
1;

View file

@ -17,6 +17,14 @@ awareness.
This middleware should really only be used in development, for production you want
to be serving static files with something a lot faster.
=head2 call ($env)
Interface subroutine to implement the privilege checks inside the WGaccess files.
=head3 $env
A Plack environment hash
=cut
sub call {

View file

@ -18,12 +18,20 @@ is created.
=cut
=head2 stream
=cut
sub stream {
my $self = shift;
$self->streamer(shift);
$self->streaming(1);
}
=head2 stream_write
=cut
sub stream_write {
my $self = shift;
if (!$self->streaming) {
@ -33,4 +41,4 @@ sub stream_write {
$self->writer->write(@_);
}
1;
1;

View file

@ -541,7 +541,7 @@ sub new {
Accessor for the driver properties. This returns a hashref
any driver specific properties. To set the properties, use
the C<set> method.
the C<update> method.
=cut
@ -783,5 +783,20 @@ sub www_editSave {
return undef;
}
=head2 CHANGES ( )
=head3 7.9.4
In 7.9.4, the base PayDriver class was changed to accomodate the new Cart. The Cart is now in
charge of gathering billing information. The PayDriver's job is to summarize all the payment
information for the user to review (www_getCredentials) and provide the user a button to complete
the checkout process (getButton), and then to complete the checkout. PayDrivers can
do additional things beyond those steps, like the PayPal driver.
PayDrivers also now have a defult template for displaying that screen, the summaryTemplate.
While each core driver has its own template, custom drivers can use any existing one that
meets its needs.
=cut
1;

View file

@ -36,9 +36,53 @@ These subroutines are available from this package:
use strict;
use Class::InsideOut qw{ :std };
use Moose;
use WebGUI::Definition;
use Scalar::Util qw/blessed/;
has session => (
is => 'ro',
required => 1,
);
has messages => (
is => 'rw',
default => sub { [] },
);
use JSON qw{ from_json to_json };
#-------------------------------------------------------------------
=head2 new ( $session )
Constructor
=head3 session
Instanciated WebGUI::Session object.
=cut
around BUILDARGS => sub {
my $orig = shift;
my $class = shift;
my $session = shift;
if (! (blessed $session && $session->isa('WebGUI::Session'))) {
WebGUI::Error::InvalidObject->throw(expected=>"WebGUI::Session", got=>(ref $session), error=>"Need a session.");
}
my $optionsJSON = $session->db->quickScalar( 'select options from taxDriver where className=?', [
$class,
] );
my $options = $optionsJSON ? from_json( $optionsJSON ) : {};
$options->{session} = $session;
return $class->$orig($options);
};
=head1 NAME
Package WebGUI::Shop::TaxDriver
@ -59,11 +103,6 @@ These subroutines are available from this package:
=cut
readonly session => my %session;
readonly messages => my %messages;
private options => my %options;
=head2 appendCartItemVars ( var, cartItem )
Adds tax driver specific template variables for the given cart item to the supplied hashref.
@ -121,47 +160,20 @@ sub canManage {
=head2 className {
Returns the class name of your plugin. You must overload this method in you own plugin.
Returns the class name of your plugin.
=cut
sub className {
my $self = shift;
$self->session->log->fatal( "Tax plugin (".$self->className.") is required to overload the className method" );
my $className = ref $self;
$self->session->log->fatal( "Tax plugin (".$self->className.") is required to overload the className method" )
if $className eq 'WebGUI::Shop::TaxDriver';
return 'WebGUI::Shop::TaxDriver';
return $className;
}
#-----------------------------------------------------------
=head2 get ( [ property ] )
Returns the value of the requested configuration property. Returns a hash ref of all property/value pairs when no
specific property is passed.
=head3 property
The property whose value should be returned.
=cut
sub get {
my $self = shift;
my $key = shift;
my $options = $options{ id $self };
# Return safe copy of options hash if no key is passed.
return { %{ $options } } unless $key;
# Return option if key is passed.
return $options->{ $key } if exists $options->{ $key };
# Key does not exist.
$self->session->log->warn( "Non-existant option [$key] was queried by tax plugin $self" );
return undef;
}
#-----------------------------------------------------------
@ -252,42 +264,6 @@ sub skuFormDefinition {
#-------------------------------------------------------------------
=head2 new ( $session )
Constructor
=head3 session
Instanciated WebGUI::Session object.
=cut
sub new {
my $class = shift;
my $session = shift;
WebGUI::Error::InvalidObject->throw( expected => "WebGUI::Session", got => (ref $session), error => "Need a session." )
unless $session && $session->isa( 'WebGUI::Session' );
my $self = {};
bless $self, $class;
register $self;
my $id = id $self;
$session{ $id } = $session;
$messages{ $id } = [];
# Load plugin configuration
my $optionsJSON = $session->db->quickScalar( 'select options from taxDriver where className=?', [
$self->className,
] );
$options{ $id } = $optionsJSON ? from_json( $optionsJSON ) : {};
return $self;
}
#-------------------------------------------------------------------
=head2 processSkuFormPost ( )
Processes the form parameters defined in the skuFormDefinition method and returns a hash ref containing the result.
@ -312,28 +288,21 @@ sub processSkuFormPost {
#-----------------------------------------------------------
=head2 update ( properties )
=head2 write ( )
Updates the properties of the tax driver according to those passed.
=head3 properties
Hash ref containing the properties to set.
Store the properties of this object to the database, as a JSON blob.
=cut
sub update {
sub write {
my $self = shift;
my $update = shift;
my $db = $self->session->db;
# update local options hash
$options{ id $self } = { %{ $options{ id $self } }, %{ $update } };
my $options = $self->get();
# Persist to db
$db->write( 'replace into taxDriver (className, options) values (?,?)', [
$self->session->db->write( 'replace into taxDriver (className, options) values (?,?)', [
$self->className,
to_json( $options{ id $self } ),
to_json( $options ),
] );
}

View file

@ -26,6 +26,45 @@ use JSON qw{ to_json };
use Tie::IxHash;
use base qw{ WebGUI::Shop::TaxDriver };
use Moose;
use WebGUI::Definition;
extends 'WebGUI::Shop::TaxDriver';
property taxGroups => (
fieldType => 'text',
noFormPost => 1,
default => sub { [] },
);
property shopCountry => (
fieldType => 'text',
noFormPost => 1,
default => '',
);
property userTemplateId => (
fieldType => 'text',
noFormPost => 1,
default => '',
);
property automaticViesApproval => (
fieldType => 'text',
noFormPost => 1,
default => '',
);
property acceptOnViesUnavailable => (
fieldType => 'text',
noFormPost => 1,
default => '',
);
property defaultGroup => (
fieldType => 'text',
noFormPost => 1,
default => '',
);
=head1 NAME
@ -200,18 +239,6 @@ sub appendCartItemVars {
#-------------------------------------------------------------------
=head2 className
Returns the name of this class.
=cut
sub className {
return 'WebGUI::Shop::TaxDriver::EU';
}
#-------------------------------------------------------------------
=head2 deleteGroup ( groupId )
Deletes a tax group.

View file

@ -8,7 +8,9 @@ use WebGUI::Exception::Shop;
use List::Util qw{ sum };
use Tie::IxHash;
use base qw{ WebGUI::Shop::TaxDriver };
use Moose;
use WebGUI::Definition;
extends 'WebGUI::Shop::TaxDriver';
=head1 NAME
@ -142,18 +144,6 @@ sub getTaxRate {
#-------------------------------------------------------------------
=head2 className
Returns the name of this class.
=cut
sub className {
return 'WebGUI::Shop::TaxDriver::Generic';
}
#-------------------------------------------------------------------
=head2 delete ( [$params] )
Deletes data from the tax table by taxId.
@ -469,7 +459,8 @@ sub www_getTaxesAsJson {
my ($db, $form) = $session->quick(qw(db form));
my $startIndex = $form->get('startIndex') || 0;
my $numberOfResults = $form->get('results') || 25;
my %goodKeys = qw/country 1 state 1 city 1 code 1 'tax rate' 1/;
my %goodKeys = qw/country 1 state 1 city 1 code 1/;
$goodKeys{'tax rate'} = 1;
my $sortKey = $form->get('sortKey');
$sortKey = $goodKeys{$sortKey} == 1 ? $sortKey : 'country';
my $sortDir = $form->get('sortDir');

View file

@ -106,6 +106,10 @@ sub delete {
$self->session->db->write("delete from WorkflowInstanceScratch where instanceId=?",[$self->getId]);
$self->session->db->deleteRow("WorkflowInstance","instanceId",$self->getId);
WebGUI::Workflow::Spectre->new($self->session)->notify("workflow/deleteInstance",$self->getId) unless ($skipNotify);
# We will need to remember that we were deleted if we get realtime-run
# during start().
$self->{deleted} = 1;
}
#-------------------------------------------------------------------
@ -643,7 +647,8 @@ sub start {
my $start = time();
my $status = "complete";
$log->info('Trying to execute workflow instance '.$self->getId.' in realtime.');
while ($status eq "complete" && ($start > time() -10)) { # how much can we run in 10 seconds
# If we got deleted in the middle, we need to stop. This is a hack.
while (!$self->{deleted} && $status eq "complete" && ($start > time() -10)) { # how much can we run in 10 seconds
$status = $self->run;
$log->info('Completed activity for workflow instance '.$self->getId.' in realtime with return status of '.$status.'.');
}