From 6c6d36c981ad791c62baac6b55d56a37825b5f45 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Sun, 9 Apr 2006 16:12:32 +0000 Subject: [PATCH] readding mail footer to email messages removed some old settings that don't apply any longer --- lib/WebGUI/Asset/Wobject/DataForm.pm | 4 ++- lib/WebGUI/Asset/Wobject/Matrix.pm | 1 + lib/WebGUI/Auth/WebGUI.pm | 2 ++ lib/WebGUI/Inbox/Message.pm | 1 + lib/WebGUI/Mail/Send.pm | 12 ++++++++ lib/WebGUI/Operation/Group.pm | 1 + lib/WebGUI/Operation/Settings.pm | 12 -------- lib/WebGUI/User.pm | 29 ++++++++++++++++++- .../Workflow/Activity/NotifyAboutUser.pm | 1 + .../Activity/ProcessRecurringPayments.pm | 1 + lib/WebGUI/i18n/English/WebGUI.pm | 19 ------------ 11 files changed, 50 insertions(+), 33 deletions(-) diff --git a/lib/WebGUI/Asset/Wobject/DataForm.pm b/lib/WebGUI/Asset/Wobject/DataForm.pm index 6db9d4345..c2938cac7 100644 --- a/lib/WebGUI/Asset/Wobject/DataForm.pm +++ b/lib/WebGUI/Asset/Wobject/DataForm.pm @@ -650,6 +650,7 @@ sub sendEmail { if ($to =~ /\@/) { my $mail = WebGUI::Mail::Send->create($self->session,{to=>$to, subject=>$subject, cc=>$cc, from=>$from, bcc=>$bcc}); $mail->addText($message); + $mail->addFooter; $mail->queue; } else { my ($userId) = $self->session->db->quickArray("select userId from users where username=".$self->session->db->quote($to)); @@ -670,13 +671,14 @@ sub sendEmail { }); my $mail = WebGUI::Mail::Send->create($self->session,{to=>$cc, subject=>$subject, from=>$from}); if ($cc) { - $mail->addText($message); + $mail->addFooter; $mail->queue; } if ($bcc) { WebGUI::Mail::Send->create($self->session, {to=>$bcc, subject=>$subject, from=>$from}); $mail->addText($message); + $mail->addFooter; $mail->queue; } } diff --git a/lib/WebGUI/Asset/Wobject/Matrix.pm b/lib/WebGUI/Asset/Wobject/Matrix.pm index 9b7f6706c..bb8eefe90 100644 --- a/lib/WebGUI/Asset/Wobject/Matrix.pm +++ b/lib/WebGUI/Asset/Wobject/Matrix.pm @@ -1058,6 +1058,7 @@ sub www_viewDetail { my $u = WebGUI::User->new($self->session, $listing->{maintainerId}); my $mail = WebGUI::Mail::Send->create($self->session, {to=>$u->profileField("email"),subject=>$listing->{productName}." - ".$self->session->form->process("subject"),from=>$self->session->form->process("from")}); $mail->addText($self->session->form->process("body")); + $mail->addFooter; $mail->queue; } $var{'email.wasSent'} = 1; diff --git a/lib/WebGUI/Auth/WebGUI.pm b/lib/WebGUI/Auth/WebGUI.pm index 9946ebd7c..f16e6b126 100644 --- a/lib/WebGUI/Auth/WebGUI.pm +++ b/lib/WebGUI/Auth/WebGUI.pm @@ -239,6 +239,7 @@ sub createAccountSave { subject=>$i18n->get('email address validation email subject','AuthWebGUI') }); $mail->addText($i18n->get('email address validation email body','AuthWebGUI')."\n\n".$self->session->url->getSiteURL().$self->session->url->page("op=auth;method=validateEmail;key=".$key)); + $mail->addFooter; $mail->send; $self->user->status("Deactivated"); $self->session->var->end($self->session->var->get("sessionId")); @@ -569,6 +570,7 @@ sub recoverPasswordFinish { $message .= $i18n->get(51).": ".$password."\n"; my $mail = WebGUI::Mail::Send->new($self->session, {to=>$self->session->form->process("email"),subject=>$i18n->get(74)}); $mail->addText($message); + $mail->addFooter; $mail->send; $flag++; } diff --git a/lib/WebGUI/Inbox/Message.pm b/lib/WebGUI/Inbox/Message.pm index a3170c788..2d8707f7c 100644 --- a/lib/WebGUI/Inbox/Message.pm +++ b/lib/WebGUI/Inbox/Message.pm @@ -104,6 +104,7 @@ sub create { } else { $mail->addText($self->{_properties}{message}); } + $mail->addFooter; $mail->queue; } $self->{_session} = $session; diff --git a/lib/WebGUI/Mail/Send.pm b/lib/WebGUI/Mail/Send.pm index b7b5875b9..6ffd47a6b 100644 --- a/lib/WebGUI/Mail/Send.pm +++ b/lib/WebGUI/Mail/Send.pm @@ -78,6 +78,18 @@ sub addAttachment { ); } +#------------------------------------------------------------------- + +=head2 addFooter ( ) + +Adds the mail footer as set by the site admin to the end of this message. + +=cut + +sub addFooter { + my $self = shift; + $self->addText($self->session->setting->get("mailFooter")); +} #------------------------------------------------------------------- diff --git a/lib/WebGUI/Operation/Group.pm b/lib/WebGUI/Operation/Group.pm index d07316ee8..7e02f08df 100644 --- a/lib/WebGUI/Operation/Group.pm +++ b/lib/WebGUI/Operation/Group.pm @@ -538,6 +538,7 @@ sub www_emailGroupSend { if ($email ne "") { my $mail = WebGUI::Mail::Send->create($session, {to=>$email,subject=>$session->form->process("subject"),from=>$session->form->process("from")}); $mail->addHtml($session->form->process("message","HTMLArea")); + $mail->addFooter; $mail->queue; } } diff --git a/lib/WebGUI/Operation/Settings.pm b/lib/WebGUI/Operation/Settings.pm index d3e619f89..cd18ac513 100644 --- a/lib/WebGUI/Operation/Settings.pm +++ b/lib/WebGUI/Operation/Settings.pm @@ -180,18 +180,6 @@ sub www_editSettings { -hoverHelp=>$i18n->get('824 description'), -value=>$session->setting->get("mailFooter") ); - $tabform->getTab("messaging")->yesNo( - -name=>"alertOnNewUser", - -label=>$i18n->get(534), - -hoverHelp=>$i18n->get('534 description'), - -value=>$session->setting->get("alertOnNewUser") - ); - $tabform->getTab("messaging")->group( - -name=>"onNewUserAlertGroup", - -label=>$i18n->get(535), - -hoverHelp=>$i18n->get('535 description'), - -value=>[$session->setting->get("onNewUserAlertGroup")] - ); $tabform->getTab("misc")->yesNo( -name=>"preventProxyCache", -label=>$i18n->get(400), diff --git a/lib/WebGUI/User.pm b/lib/WebGUI/User.pm index 0231b9284..cfb9b341b 100644 --- a/lib/WebGUI/User.pm +++ b/lib/WebGUI/User.pm @@ -30,7 +30,7 @@ This package provides an object-oriented way of managing WebGUI users as well as =head1 SYNOPSIS use WebGUI::User; - $u = WebGUI::User->new($session,3); or $f = WebGUI::User->new($session,"new"); + $u = WebGUI::User->new($session,3); or $u = WebGUI::User->new($session,"new"); or $u = WebGUI::User->newByEmail($session, $email); $authMethod = $u->authMethod("WebGUI"); $dateCreated = $u->dateCreated; @@ -469,6 +469,33 @@ sub new { bless $userData, $class; } +#------------------------------------------------------------------- + +=head2 newByEmail ( session, email ) + +Instanciates a user by email address. Returns undef if the email address could not be found. + +=head3 session + +A reference to the current session. + +=head3 email + +The email address to search for. + +=cut + +sub newByEmail { + my $class = shift; + my $session = shift; + my $email = shift; + my ($id) = $session->dbSlave->quickArray("select userId from userProfileData where fieldName='mail' and fieldData=?",[$email]); + my $user = $class->new($session, $id); + return undef unless $user->username; + return $user; +} + + #------------------------------------------------------------------- =head2 profileField ( fieldName [ value ] ) diff --git a/lib/WebGUI/Workflow/Activity/NotifyAboutUser.pm b/lib/WebGUI/Workflow/Activity/NotifyAboutUser.pm index f75570b50..3600ba89a 100644 --- a/lib/WebGUI/Workflow/Activity/NotifyAboutUser.pm +++ b/lib/WebGUI/Workflow/Activity/NotifyAboutUser.pm @@ -99,6 +99,7 @@ sub execute { subject=>$self->get("subject") }); $mail->addText($message); + $mail->addFooter; return $mail->send ? $self->COMPLETE : $self->ERROR; } diff --git a/lib/WebGUI/Workflow/Activity/ProcessRecurringPayments.pm b/lib/WebGUI/Workflow/Activity/ProcessRecurringPayments.pm index b86bf997d..834fb4646 100644 --- a/lib/WebGUI/Workflow/Activity/ProcessRecurringPayments.pm +++ b/lib/WebGUI/Workflow/Activity/ProcessRecurringPayments.pm @@ -130,6 +130,7 @@ sub execute { subject=>'Daily recurring payments report' }); $mail->addText($message); + $mail->addFooter; return $mail->send ? $self->COMPLETE : $self->ERROR; } diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm index 89d28db5d..56fefd6d7 100644 --- a/lib/WebGUI/i18n/English/WebGUI.pm +++ b/lib/WebGUI/i18n/English/WebGUI.pm @@ -3854,25 +3854,6 @@ Message Boards hold forums for users. There are many different Wobjects in WebG lastUpdated => 1141963573, }, - '534' => { - message => q|Alert on new user?|, - lastUpdated => 1031514049 - }, - - '535' => { - message => q|Group To Alert On New User|, - lastUpdated => 1031514049 - }, - - '534 description' => { - message => q|Should someone be alerted when a new user registers anonymously?|, - lastUpdated => 1120239343, - }, - - '535 description' => { - message => q|What group should be alerted when a new user registers?|, - lastUpdated => 1120239343, - }, };