getting close to having a working email to discussion system

This commit is contained in:
JT Smith 2006-04-10 02:02:19 +00:00
parent 2100a3c992
commit 08d0efe060
3 changed files with 50 additions and 0 deletions

View file

@ -191,6 +191,16 @@ sub updateCs {
$session->db->write("alter table Collaboration add column mailPrefix varchar(255)");
$session->db->write("alter table Collaboration add column getMail int not null default 0");
$session->db->write("alter table Collaboration add column getMailInterval int not null default 300");
$session->db->write("alter table Collaboration add column getMailCronId varchar(22) binary");
my $workflow = WebGUI::Workflow->create($session, {
isSerial=>1,
type=>"WebGUI::Asset::Wobject::Collaboration",
enabled=>1,
description=>"Retrieves mail from a POP3 account for the given Collaboration System.",
title=>"Get CS Mail"
}, "csworkflow000000000001");
my $activity = $workflow->addActivity("WebGUI::Workflow::Activity::GetCsMail","csactivity000000000001");
$activity->set("title","Get the mail");
}
#-------------------------------------------------

View file

@ -19,6 +19,7 @@ use WebGUI::International;
use WebGUI::Paginator;
use WebGUI::Utility;
use WebGUI::Asset::Wobject;
use WebGUI::Workflow::Cron;
our @ISA = qw(WebGUI::Asset::Wobject);
@ -195,6 +196,33 @@ sub canView {
return $self->SUPER::canView || $self->canPost;
}
#-------------------------------------------------------------------
sub commit {
my $self = shift;
$self->SUPER::commit;
my $cron = undef;
if ($self->get("getMailCronId")) {
$cron = WebGUI::Workflow::Cron->new($self->session, $self->get("getMailCronId"));
}
my $i18n = WebGUI::International->new($self->session, "Asset_Collaboration");
unless (defined $cron) {
$cron = WebGUI::Workflow::Cron->create($self->session, {
title=>$self->getTitle." ".$i18n->get("mail"),
minuteOfHour=>"*/".($self->get("getMailInterval")/60),
className=>"WebGUI::Asset::Wobject::Collaboration",
methodName=>"new",
parameters=>$self->getId,
workflowId=>"csworkflow000000000001"
});
$self->update({getMailCronId=>$cron->getId});
}
if ($self->get("getMail")) {
$cron->set({enabled=>1,title=>$self->getTitle." ".$i18n->get("mail"), minuteOfHour=>"*/".($self->get("getMailInterval")/60)});
} else {
$cron->set({enabled=>0,title=>$self->getTitle." ".$i18n->get("mail"), minuteOfHour=>"*/".($self->get("getMailInterval")/60)});
}
}
#-------------------------------------------------------------------
sub createSubscriptionGroup {
my $self = shift;
@ -277,6 +305,11 @@ sub definition {
fieldType=>"email",
defaultValue=>undef
},
getMailCronId=>{
fieldType=>"hidden",
defaultValue=>undef,
noFormPost=>1
},
getMail=>{
fieldType=>"yesNo",
defaultValue=>0
@ -895,6 +928,10 @@ sub purge {
my $self = shift;
my $group = WebGUI::Group->new($self->session, $self->get("subscriptionGroupId"));
$group->delete;
if ($self->get("getMailCronId")) {
my $cron = WebGUI::Workflow::Cron->new($self->session, $self->get("getMailCronId"));
$cron->delete if defined $cron;
}
$self->SUPER::purge;
}

View file

@ -18,7 +18,10 @@ package WebGUI::Workflow::Activity::GetCsMail;
use strict;
use base 'WebGUI::Workflow::Activity';
use WebGUI::Mail::Get;
use WebGUI::Mail::Send;
use WebGUI::Asset;
use WebGUI::International;
use WebGUI::User;
=head1 NAME