From 73df1c157ceb66c231a119bf3703cc6119e232af Mon Sep 17 00:00:00 2001 From: Neil Blakey-Milner Date: Mon, 6 Jun 2005 22:21:47 +0000 Subject: [PATCH] Allow email addresses to be added free-form to the list of people to send the document link/attachment to. --- presentation/lookAndFeel/knowledgeTree/documentmanagement/emailBL.php | 24 +++++++++++++++++++++--- presentation/lookAndFeel/knowledgeTree/documentmanagement/emailUI.inc | 5 +++-- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailBL.php index b156bd4..a62f692 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailBL.php +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailBL.php @@ -27,7 +27,7 @@ require_once("../../../../config/dmsDefaults.php"); -KTUtil::extractGPC('fAttachDocument', 'fComment', 'fDocumentID', 'fSendEmail', 'groupNewRight', 'userNewRight'); +KTUtil::extractGPC('fAttachDocument', 'fComment', 'fDocumentID', 'fEmailAddresses', 'fSendEmail', 'groupNewRight', 'userNewRight'); require_once("$default->fileSystemRoot/lib/security/Permission.inc"); require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); @@ -103,6 +103,21 @@ function sendUserEmails($aUserIDs, $oDocument, $sComment = "", $bAttachDocument) } /** + * Sends emails to the manually entered email addresses + */ +function sendManualEmails($aEmailAddresses, $oDocument, $sComment = "", $bAttachDocument) { + global $default; + + // loop through users + foreach ($aEmailAddresses as $sEmailAddress) { + $default->log->info("sendingEmail to address " . $sEmailAddress); + if (validateEmailAddress($sEmailAddress)) { + sendEmail($sEmailAddress, $sEmailAddress, $oDocument->getID(), $oDocument->getName(), $sComment, $bAttachDocument); + } + } +} + +/** * Constructs the email message text and sends the message */ function sendEmail($sDestEmailAddress, $sDestUserName, $iDocumentID, $sDocumentName, $sComment, $bAttachDocument = false) { @@ -206,14 +221,17 @@ if (checkSession()) { // explode group and user ids $aGroupIDs = explode(",", $groupNewRight); $aUserIDs = explode(",", $userNewRight); - $default->log->info("Sending email to groups=$groupNewRight; users=$userNewRight"); + $aEmailAddresses = explode(" ", $fEmailAddresses); + $default->log->info("Sending email to groups=$groupNewRight; users=$userNewRight; manual=$fEmailAddresses"); //if we're going to send a mail, first make there is someone to send it to - if ((count($aGroupIDs) > 1) || (count($aUserIDs) > 1)) { + if ((count($aGroupIDs) > 1) || (count($aUserIDs) > 1) || (count($aEmailAddresses) != 0)) { // send group emails sendGroupEmails($aGroupIDs, $oDocument, $fComment, (boolean)$fAttachDocument); // send user emails sendUserEmails($aUserIDs, $oDocument, $fComment, (boolean)$fAttachDocument); + // send manual email addresses + sendManualEmails($aEmailAddresses, $oDocument, $fComment, (boolean)$fAttachDocument); if (count($emailerrors)) { $_SESSION['errorMessage'] = join("
\n", $emailerrors); diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailUI.inc b/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailUI.inc index 412bc05..d44d5fd 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailUI.inc +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailUI.inc @@ -92,6 +92,7 @@ function getDocumentEmailPage($oDocument) { $sToRender .= ""; $sToRender .= "\n"; $sToRender .= "";//\n"; + $sToRender .= "";//\n"; $sToRender .= "";//\n"; $sToRender .= "\n"; $sToRender .= "
" . _("Attach Document") . "
" . _("Email Addresses") . "
" . _("Comment") . "
rootUrl/control.php?action=viewDocument&fDocumentID=" . $oDocument->getID() . "\">
\n"; @@ -111,8 +112,8 @@ function getDocumentEmailPage($oDocument) { $sToRender .= "\n"; return $sToRender; -- libgit2 0.21.4