recover lost work from git

This commit is contained in:
daviddelikat 2009-11-06 11:05:59 -06:00
parent 1e18313c81
commit 707215cf3f
17 changed files with 1475 additions and 0 deletions

114
lib/WebGUI/Form/Div.pm Normal file
View file

@ -0,0 +1,114 @@
package WebGUI::Form::Div;
=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 strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
=head1 NAME
Package WebGUI::Form::Div
=head1 DESCRIPTION
dreates a HTML div element with contents provided by caller
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 usage
$form->div({
contentCallback => sub { $self->getDivContents(shift); }
});
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 contentCallback
A code enclosure which returns the html text to insert into the div element. The divId is passed as parameter 0 when it is called. This function MUST return good html text, it is NOT processed here at all.
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
push(@{$definition}, {
contentCallback=>{
defaultValue=> sub { return '' },
},
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
=head2 getName ( session )
Returns the name of the form control.
=cut
sub getName {
my ($class, $session) = @_;
return WebGUI::International->new($session, "Form_Div")->get("topicName");
}
#-------------------------------------------------------------------
=head2 getValue ( [ value ] )
Does some special processing.
=cut
sub getValue {
my $self = shift;
return $self->get('contentCallback')->($self->get('id'));
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders an input tag of type text.
=cut
sub toHtml {
my $self = shift;
return '<div id="'.$self->get('id').'" name="'.$self->get("name").'" '.$self->get("extras").'>' . $self->getValue . '</div>' ;
}
1;
#vim:ft=perl

View file

@ -0,0 +1 @@
/data/helpdesk/lib/WebGUI/Workflow/Activity/CloseResolvedTickets.pm

View file

@ -0,0 +1,123 @@
package WebGUI::Workflow::Activity::ProcessEMSApprovals;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2008 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 strict;
use base 'WebGUI::Workflow::Activity';
use WebGUI::Asset;
use WebGUI::International;
use WebGUI::VersionTag;
=head1 NAME
Package WebGUI::Workflow::Activity::ProcessEMSApprovals
=head1 DESCRIPTION
Uses the settings in the help desk to determine whether the resolved tickets should be closed or not.
=head1 SYNOPSIS
See WebGUI::Workflow::Activity for details on how to use any activity.
=head1 METHODS
These methods are available from this class:
=cut
#-------------------------------------------------------------------
=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, "Asset_EMSSubmissionForm" );
push(@{$definition}, {
name => $i18n->get("activity title approve submissions"),
properties => {}
});
return $class->SUPER::definition($session,$definition);
}
#-------------------------------------------------------------------
=head2 execute ( )
See WebGUI::Workflow::Activity::execute() for details.
=cut
sub execute {
my $self = shift;
my $session = $self->session;
my $root = WebGUI::Asset->getRoot($session);
# keep track of how much time it's taking
my $start = time;
my $limit = 2_500;
my $timeLimit = 60;
my $list = $root->getLineage( ['descendants'], { returnObjects => 1,
includeOnlyClasses => ['WebGUI::Asset::EMSSubmissionForm'],
} );
for my $emsForm ( @$list ) {
my $whereClause = q{ submissionStatus='approved' };
my $res = $emsForm->getLineage(['children'],{ returnObjects => 1,
joinClass => 'WebGUI::Asset::EMSSubmission',
includeOnlyClasses => ['WebGUI::Asset::EMSSubmission'],
whereClause => $whereClause,
} );
for my $submission ( @$res ) {
my $properties = { className => 'WebGUI::Asset::Sku::EMSTicket' };
for my $name ( qw{title description seatsAvailable price vendorId
synopsis location duration startDate sku relatedRibbons
relatedBadgeGroups eventMetaData shipsSeparately} ) {
$properties->{$name} = $submission->get($name);
}
$properties->{eventNumber} = $self->session->db->quickScalar(
"select max(eventNumber)+1
from EMSTicket left join asset using (assetId)
where parentId=?",[$emsForm->ems->getId]) || 0;
my $newAsset = $emsForm->ems->addChild( $properties );
if( $newAsset ) {
# TODO this should be addRevision
$submission->update({ ticketId => $newAsset->getId, submissionStatus => 'created' });
WebGUI::VersionTag->autoCommitWorkingIfEnabled($session, { override => 1, allowComments => 0 });
} else {
$submission->addComment($@) if $@;
$submission->update({ submissionStatus => 'failed' });
}
$limit--;
last if ! $limit or time > $start + $timeLimit;
}
}
return $self->WAITING(1) if ! $limit or time > $start + $timeLimit;
return $self->COMPLETE;
}
1;

View file

@ -0,0 +1 @@
/data/helpdesk/lib/WebGUI/i18n/English/Asset_HelpDesk.pm

View file

@ -0,0 +1 @@
/data/helpdesk/lib/WebGUI/i18n/English/Asset_Ticket.pm

View file

@ -0,0 +1,15 @@
package WebGUI::i18n::English::Form_Div;
use strict; ##Required for all good Perl::Critic compliant code
our $I18N = {
'topicName' => {
message => q|Form Control Div Element|,
lastUpdated => 1131394070, #seconds from the epoch
context => q|Name of the form control that generates HTML Div elements|
},
};
1;
#vim:ft=perl