diff options
author | cvs2git <cvs2git> | 2002-08-12 06:17:10 +0000 |
---|---|---|
committer | cvs2git <cvs2git> | 2002-08-12 06:17:10 +0000 |
commit | 160be29a0dc62e79a4fb95d2ab8c0c7e5996760e (patch) | |
tree | 94ebadb17321b138fd7bfd9a5c379eec97c5d328 /rt/lib/RT/Action | |
parent | 3ef62a0570055da710328937e7f65dbb2c027c62 (diff) |
This commit was manufactured by cvs2svn to create branch 'BESTPRACTICAL'.
Diffstat (limited to 'rt/lib/RT/Action')
-rw-r--r-- | rt/lib/RT/Action/OpenDependent.pm | 55 | ||||
-rwxr-xr-x | rt/lib/RT/Action/SendPasswordEmail.pm | 170 | ||||
-rw-r--r-- | rt/lib/RT/Action/StallDependent.pm | 68 |
3 files changed, 0 insertions, 293 deletions
diff --git a/rt/lib/RT/Action/OpenDependent.pm b/rt/lib/RT/Action/OpenDependent.pm deleted file mode 100644 index b271e4709..000000000 --- a/rt/lib/RT/Action/OpenDependent.pm +++ /dev/null @@ -1,55 +0,0 @@ -# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Action/Attic/OpenDependent.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $ -# This Action will open the BASE if a dependent is resolved. - -package RT::Action::OpenDependent; -require RT::Action::Generic; -require RT::Links; -@ISA=qw(RT::Action::Generic); - -#Do what we need to do and send it out. - -#What does this type of Action does - -# {{{ sub Describe -sub Describe { - my $self = shift; - return (ref $self . " will stall a [local] BASE if it's open and a dependency link is created."); -} -# }}} - - -# {{{ sub Prepare -sub Prepare { - # nothing to prepare - return 1; -} -# }}} - -sub Commit { - my $self = shift; - - my $Links=RT::Links->new($RT::SystemUser); - $Links->Limit(FIELD => 'Type', VALUE => 'DependsOn'); - $Links->Limit(FIELD => 'Target', VALUE => $self->TicketObj->id); - - while (my $Link=$Links->Next()) { - next unless $Link->BaseIsLocal; - my $base=RT::Ticket->new($self->TicketObj->CurrentUser); - # Todo: Only work if Base is a plain ticket num: - $base->Load($Link->Base); - $base->Open if $base->Status eq 'stalled'; - } -} - - -# Applicability checked in Commit. - -# {{{ sub IsApplicable -sub IsApplicable { - my $self = shift; - 1; - return 1; -} -# }}} - -1; diff --git a/rt/lib/RT/Action/SendPasswordEmail.pm b/rt/lib/RT/Action/SendPasswordEmail.pm deleted file mode 100755 index 91bb3c1cb..000000000 --- a/rt/lib/RT/Action/SendPasswordEmail.pm +++ /dev/null @@ -1,170 +0,0 @@ -# $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Action/Attic/SendPasswordEmail.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $ -# Copyright 2001 Jesse Vincent <jesse@fsck.com> -# Released under the terms of the GNU Public License - -package RT::Action::SendPasswordEmail; -require RT::Action::Generic; - -@ISA = qw(RT::Action::Generic); - - -=head1 NAME - - RT::Action::SendGenericEmail - An Action which users can use to send mail - or can subclassed for more specialized mail sending behavior. - - - -=head1 SYNOPSIS - - require RT::Action::SendPasswordEmail; - - -=head1 DESCRIPTION - -Basically, you create another module RT::Action::YourAction which ISA -RT::Action::SendEmail. - -If you want to set the recipients of the mail to something other than -the addresses mentioned in the To, Cc, Bcc and headers in -the template, you should subclass RT::Action::SendEmail and override -either the SetRecipients method or the SetTo, SetCc, etc methods (see -the comments for the SetRecipients sub). - - -=begin testing - -ok (require RT::TestHarness); -ok (require RT::Action::SendPasswordEmail); - -=end testing - - -=head1 AUTHOR - -Jesse Vincent <jesse@bestpractical.com> - -=head1 SEE ALSO - -perl(1). - -=cut - -# {{{ Scrip methods (_Init, Commit, Prepare, IsApplicable) - -# {{{ sub Commit - -#Do what we need to do and send it out. - -sub Commit { - my $self = shift; - #send the email - - - - - - my $MIMEObj = $self->TemplateObj->MIMEObj; - - - $MIMEObj->make_singlepart; - - #If we don\'t have any recipients to send to, don\'t send a message; - unless ($MIMEObj->head->get('To')) { - $RT::Logger->debug("$self: No recipients found. Not sending.\n"); - return(1); - } - - if ($RT::MailCommand eq 'sendmailpipe') { - open (MAIL, "|$RT::SendmailPath $RT::SendmailArguments") || return(0); - print MAIL $MIMEObj->as_string; - close(MAIL); - } - else { - unless ($MIMEObj->send($RT::MailCommand, $RT::MailParams)) { - $RT::Logger->crit("$self: Could not send mail for ". - $self->TransactionObj . "\n"); - return(0); - } - } - - return (1); - -} -# }}} - -# {{{ sub Prepare - -sub Prepare { - my $self = shift; - - # This actually populates the MIME::Entity fields in the Template Object - - unless ($self->TemplateObj) { - $RT::Logger->warning("No template object handed to $self\n"); - } - - - unless ($self->TemplateObj->MIMEObj->head->get('Reply-To')) { - $self->SetHeader('Reply-To',$RT::CorrespondAddress ); - } - - - $self->SetHeader('Precedence', "bulk"); - $self->SetHeader('X-RT-Loop-Prevention', $RT::rtname); - $self->SetHeader - ('Managed-by',"Request Tracker $RT::VERSION (http://www.fsck.com/projects/rt/)"); - - $self->TemplateObj->Parse(Argument => $self->Argument); - - - return 1; -} - -# }}} - -# }}} - - -# {{{ sub SetTo - -=head2 SetTo EMAIL - -Sets this message's "To" field to EMAIL - -=cut - -sub SetTo { - my $self = shift; - my $to = shift; - $self->SetHeader('To',$to); -} - -# }}} - -# {{{ sub SetHeader - -sub SetHeader { - my $self = shift; - my $field = shift; - my $val = shift; - - chomp $val; - chomp $field; - $self->TemplateObj->MIMEObj->head->fold_length($field,10000); - $self->TemplateObj->MIMEObj->head->add($field, $val); - return $self->TemplateObj->MIMEObj->head->get($field); -} - -# }}} - - - -__END__ - -# {{{ POD - -# }}} - -1; - diff --git a/rt/lib/RT/Action/StallDependent.pm b/rt/lib/RT/Action/StallDependent.pm deleted file mode 100644 index 09d3448a8..000000000 --- a/rt/lib/RT/Action/StallDependent.pm +++ /dev/null @@ -1,68 +0,0 @@ -# This Action will stall the BASE if a dependency or membership link -# (according to argument) is created and if BASE is open. - -# TODO: Rename this .pm - -package RT::Action::StallDependent; -require RT::Action::Generic; -@ISA=qw|RT::Action::Generic|; - -# {{{ sub Describe -sub Describe { - my $self = shift; - return (ref $self . " will stall a [local] BASE if it's dependent [or member] of a linked up request."); -} -# }}} - - -# {{{ sub Prepare -sub Prepare { - # nothing to prepare - return 1; -} -# }}} - -sub Commit { - my $self = shift; - # Find all Dependent - my $arg=$self->Argument || "DependsOn"; - unless ($self->TransactionObj->Data =~ /^([^ ]+) $arg /) { - warn; return 0; - } - my $base_id=$1; - my $base; - if ($1 eq "THIS") { - $base=$self->TicketObj; - } else { - $base_id=&RT::Link::_IsLocal(undef, $base_id) || return 0; - $base=RT::Ticket->new($self->TicketObj->CurrentUser); - $base->Load($base_id); - } - $base->Stall if $base->Status eq 'open'; - return 0; -} - - -# {{{ sub IsApplicable - -# Only applicable if: -# 1. the link action is a dependency -# 2. BASE is a local ticket - -sub IsApplicable { - my $self = shift; - - my $arg=$self->Argument || "DependsOn"; - - # 1: - $self->TransactionObj->Data =~ /^([^ ]*) $arg / || return 0; - - # 2: - # (dirty!) - &RT::Link::_IsLocal(undef,$1) || return 0; - - return 1; -} -# }}} - -1; |