%%document-announce-member-email%%
roots.encielo.org : / (context:11)
2002-08-11 21:29:08

%%preprocess%%
// has this been announced already??
if (trim($this->p_announced)!="") {
    $this->showNull= 1;
    return 0;
    }

// send a plain-text header so the email will show up properly on screen
header("Content-type: text/plain");

// set the announced property so that the announcement can only be sent once
$this->p_announced= date("F j, Y \a\\t g:ia");
$this->updateObject();
berror("document-announce-member-email: set p_announced= $this->p_announced",1);


// format the object for display
$this->beryliumToHtml(); 
$this->timeFormat("F j, Y \a\\t g:ia");
$this->getBaseUrl();


// correct this->baseUrl 
$this->realUrl= "http://$site->name".$this->uri;

// show sitemember if no author defined, show sitename if no sitemember found...
if (trim($this->author)== "") $this->author= bparsebml("[sitemember:$this->sitememberid]");
if (trim($this->author)== "") $this->author= $site->title;


// determine dateTag
if ($this->p_originaldate) {
	$origdate= mysql_timestamp($this->p_originaldate);
	$this->originaldate= date("l, F j, Y", $origdate);
	$this->dateTag= $this->originaldate;
	}
else $this->dateTag= $this->created;


// determine recipientlist query
$recipientarray= explode(" ",$this->p_recipientlist);
$this->recipientQuery= "0 ";

foreach ($recipientarray AS $key=>$value) {
    $this->recipientQuery.= " OR obj.id='$value' ";
    }


// email to:
$to= "roots-members@encielo.org";
$subject= "New Campaign: $this->title";

// construct the mailing list from current sitemembership
$query= "SELECT member.email FROM sitemember, member WHERE sitemember.siteid='$site->id' AND sitemember.status='posted' AND member.id=sitemember.memberid ";
if ($result= mysql_query($query)) {
    while ($thismember= mysql_fetch_array($result)) {
	if ($bcc=="") $bcc= "Bcc: ";
	else $bcc.= ", ";
	$bcc.= $thismember[email];
	}
    berror("document-announce-member-email: bcc looks like $bcc.",1);
    }
else berror("document-announce-member-email: member lookup failed on query: $query.",1);

// construct the other email headers
$newline= "\r\n";
$this->headers = "From: roots.encielo.org <roots@encielo.org>$newline";
$this->headers .= "Reply-To: Chris Snyder <chris@psydeshow.org>$newline";
$this->headers .= $bcc.$newline;
$this->headers .= "X-Mailer: berylium/php$newline";
$this->headers .= "MIME-Version: 1.0$newline";
$this->headers .= "Content-type: text/html; charset=iso-8859-1$newline";

// construct the email
$this->emailbody= "
<html>
<body text='#333333' bgcolor='#ffffff' link='#000099' vlink='#006600' alink='#006600' background='http://roots.encielo.org/berylium/about/image-background.gif'>
<tt>
<a href='http://galactron/berylium/'><img src='http://roots.encielo.org/berylium/about/image-rootslogo.gif' alt='roots.encielo.org' width='155' height='30' align='middle' border='0'></a>
<font size='+2'><b>New campaign announcement</b></font><br>
<br>
<br>
Dear roots.encielo.org member,
<br>
<br>
$this->author has created a new campaign (<b>&quot;$this->title&quot;</b>), which you will find here:
<br>
<br>
<b><a href='$this->realUrl'>$this->realUrl</a></b>
<br>
<br>
<hr>
A summary follows:
<br>
<br>
<b>$this->title:</b>
<blockquote>$this->description</blockquote>
<a href='$this->realUrl'>$this->realUrl</a>
<hr>
<br>
<br>
<br>
If you have received this email in error or multiple times or something else nasty has happened to you because of it, we apologize. Please hit reply and let us know what's up. Thanks.
</body>
</html>
";

// send the bloddy thing, already
berror("document-announce-member-email: email looks like this: <br>$this->emailbody",2);
mail($to, $subject, $this->emailbody, $this->headers);


%%header%%


%%css%%


%%template%%
ANNOUNCEMENT SENT AS:

To: roots-members@encielo.org
Subject: $this->title
$this->headers

$this->emailbody


%%listrow%%
 

%%nullobject%%
Either that document cannot be found (how likely is that?) or it was announced already on $this->p_announced. 
<br>
<br>
Contact Chris or Rebecca to have the announcement status reset for this campaign.


%%footer%%


%%postprocess%%


%%end of context%%

 
