%%document-mailtosend-anonymous-scene%%
$Date: 2003/01/31 20:42:04 $

%%preprocess%%
// REQUEST VARS
$this->sendername= $_POST['sendername'];
$this->senderemail= $_POST['senderemail'];
$this->recipientemail= $_POST['recipientemail'];
$this->sendermessage= $_POST['sendermessage'];
$this->sendtext= $_POST['sendtext'];

// OBJECT FORMATTING
// format the object for display
$cleanbody= $this->body;
$this->beryliumToHtml();
$this->getRuntimeVars();

// convert generic flavor to objtype:
if ($this->flavor=="Generic") $this->flavor= "Scene";

// headline fix if only title, and vice-versa
if ($this->title=="" && $this->headline=="") $this->title= "Untitled ($this->name)";
elseif ($this->title=="") $this->title= $this->headline;
elseif ($this->headline=="") $this->headline= $this->title;

// ROOM SETTINGS
berror("Getting imagesize on $folder->p_background now...",1);
if ($background= getimagesize($folder->p_background)) {
	berror("Got it.",1);
	$width= $background[0];
	$height= $background[1];

	$targetwidth= 630;
	$targetheight= 430;

	if ($width>$targetwidth) {
		//$height= $height * ($targetwidth/$width);
		$width= $targetwidth;
		}
	if ($height>$targetheight) {
		//$width= $width * ($targetheight/$height);
		$height= $targetheight;
		}

	$this->backgroundwidth= $width."px";
	$this->bgnumericwidth= $width;
	$this->backgroundheight= $height."px";
	$this->bgnumericheight= $height;
	}

if ($this->sendtext=="") {
	// SCENEINFO COLOR
	if ($folder->p_infoColor!="") $this->infoColor= $folder->p_infoColor;
	else $this->infoColor= "white";

	// INFO POSITION
	$bgcenter= $this->bgnumericwidth / 2;
	$this->infoLeft= ($bgcenter - 90)."px";
	$this->infoBottom= "5px";

	berror("<b>Scene Render: FINISHED</b>.",1);
	//if ($this->itemEditor || $this->itemOwner) $this->showNull= 1;

	// prepare the frame
	$this->context->commentRender= "{list:SELECT obj.* FROM comment AS obj WHERE obj.flavor='Frame' AND obj.parentobjtype='document' AND obj.parentid='$this->id' $session->statuswhere $session->publicwhere ORDER BY obj.rank DESC, obj.created ASC LIMIT 1 ;email}";
	$this->parseCBML("commentRender");
	$this->commentRender= $this->context->commentRender;


	// now create the output
	$this->output= "
	<html>
	<head>
	<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
	<title>$this->title at $site->title</title>
	<style type='text/css'>
	<!--
	/* Content Container and Basic Styles */
	/* version 2002-12-24 -- when we gonna hardcode this? */
	BODY	{ background-color: #ffffff; }
	B	{ color: #002266; font-weight: bold; }
	PRE	{ font-family: Courier, fixed; font-size: 12px; line-height: 6px; }
	A:link		{ 0color: #53322e; text-decoration: none; }
	A:visited	{ 0color: #53322e; text-decoration: none; }
	A:hover		{ 0color: #53322e; text-decoration: underline; }
	HR 	{ height: 1px; background-color: #ff9900; border-style: none; }
	TABLE	{ width: 100%; font-size: 12px; }

	.bodytable	{ background-color: #f9f9fb;
				border: 3px; border-color: #0e47b2; border-style: solid;
				color: #223344;
				font-family: Tahoma, Geneva, sans-serif; font-size: 12px; line-height: 18px;
				width: 640px; }
	.bodytable A { color: #135b9f; }

	.objTitle { font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: 18px;
		font-weight: bold; color: #135b9f; }

	.editTable TD { padding: 5px; }

	/* SPECIAL FOR SCENE */
	.dialog { font-family: Verdana, Geneva, sans-serif; color: #ee7200; font-size: 12px; line-height: 16px; }
	.folderBody { font-family: Times New Roman, Times, serif; color: #ee7200; font-size: 12pt; line-height: 15pt; }
	.objControls TD { border-style: none; }
	.dialogTextArea { width: 172px; background-color: #ffffff; text-align: center;
			font-family: Verdana, Geneva, sans-serif; color: #ee7200; font-size: 12px; line-height: 16px;
			border: 1px; border-style: solid; border-color: #006699; padding: 2px;}


	.boothtable	{ background-color: #f9f9fb;
				border: 3px; border-color: #0e47b2; border-style: solid;
				color: #223344;
				font-family: Tahoma, Geneva, sans-serif; font-size: 12px; line-height: 18px;
				width: $this->backgroundwidth;
				}
	.boothtable A { color: #135b9f; }
	.frameInfo { font-family: Arial, Helvetica, sans-serif; font-size: 10px; line-height: 14px; color: $this->infoColor; text-align: center; }
	.frameInfo A { color: $this->infoColor; font-weight: bold; }
	-->
	</style>
	</head>
	<body marginwidth='0' marginheight='0'>
	<a name='top'> </a>
	<img src='/bicons/spacer.gif' width='$this->bgnumericwidth' height='$this->bgnumericheight' border=0>
	<div id='background' style='position: absolute; left: 0px; top: 0px; width: $this->backgroundwidth; height: $this->backgroundheight; z-index:1; background-color: #333333; background-image: url($folder->p_background); background-position: center center;'>
	</div>
	$this->commentRender
	<div id='frameInfo' class='boothTable' style='position: absolute; width: 420px; z-index: 1; left: 10px; top: 10px;' >
			<table class='editTable'>
				<tr>
					<td colspan=2 class='dialog'>
						$this->sendermessage<br/>
						&nbsp; &nbsp; -- $this->sendername / <a href='mailto:$this->senderemail'>$this->senderemail</a>
						<p align=right>( <a href='$this->htmlUrl'>Play It</a> at $site->name )</p>
					</td>
				</tr>
			</table>
	</div>
	<br />
	$this->sendername has sent you this Scene from $site->title called \"$this->title\":<br/>
	$this->htmlUrl<br/>
	<br/>
	They attached the following message:
	<blockquote>
	$this->sendermessage
	<br/>&nbsp; &nbsp; -- $this->sendername / $this->senderemail
	</blockquote>
	<p>&nbsp;</p>
	<p>If this message has reached you in error, or you don't know the sender, please accept our apologies.<br/>You may report email abuse to abuse@$site->name. Please include this entire message ($session->id).</p>
	</body>
	</html>";
	}
else {
	$this->output= "$this->sendername has sent you a Scene from $site->title called \"$this->title\":
  $this->htmlUrl

They attached the following message:
\"$this->sendermessage\" 
     -- $this->sendername ($this->senderemail)

If this message has reached you in error, or you don't know the sender, please accept our apologies. 
You may report email abuse to abuse@$site->name. Please include this entire message ($session->id).";
	}

// format a message and mail it out!
// email to:
$to= "$this->recipientemail";
$subject= "$this->title at $site->name";

// construct the other email headers
$newline= "\r\n";
$this->headers = "From: $this->sendername <$this->senderemail>$newline";
$this->headers .= "X-Mailer: berylium/php$newline";
$this->headers .= "MIME-Version: 1.0$newline";
if ($this->sendtext) $this->headers .= "Content-type: text/plain; charset=iso-8859-1$newline";
else $this->headers .= "Content-type: text/html; charset=iso-8859-1$newline";

// send it
berror("to: $to<br>subject: $subject<br>".nl2br($this->headers),1);
mail($to, $subject, $this->output, $this->headers);


// NEW INFO POSITION
$bgcenter= $this->bgnumericwidth / 2;
$this->infoLeft= ($bgcenter - 230)."px";
$bgmiddle= $this->bgnumericheight / 2;
$this->infoTop= ($bgmiddle - 75)."px";

%%header%%


%%css%%
.boothtable	{ background-color: #f9f9fb;
			border: 3px; border-color: #0e47b2; border-style: solid;
			color: #223344;
			font-family: Tahoma, Geneva, sans-serif; font-size: 12px; line-height: 18px;
			width: $this->backgroundwidth;
			}
.boothtable A { color: #135b9f; }
.frameInfo { font-family: Arial, Helvetica, sans-serif; font-size: 10px; line-height: 14px; color: $this->infoColor; text-align: center; }
.frameInfo A { color: $this->infoColor; font-weight: bold; }

%%template%%
<a name="top"> </a>
<img src="/bicons/spacer.gif" width="$this->bgnumericwidth" height="$this->bgnumericheight" border=0>
<div id='background' style='position: absolute; left: 0px; top: 0px; width: $this->backgroundwidth; height: $this->backgroundheight; z-index:1; background-color: #333333; background-image: url($folder->p_background); background-position: center center;'>
</div>
<div id='frameInfo' class='boothTable' style='position: absolute; width: 460px; height: 150px; z-index: 1; left: $this->infoLeft; top: $this->infoTop;' >
		<form name='mailtoform' action='$this->baseUrl?method=mailto' method='POST'>
		<input type='hidden' name='senderemail' value='$this->senderemail'>
		<input type='hidden' name='sendername' value='$this->sendername'>
		<input type='hidden' name='sendermessage' value='$this->sendermessage'>
		<table class='editTable'>
			<tr>
				<td colspan=2 class='objTitle'>Message sent to $this->recipientemail.</td>
			</tr>
			<tr>
				<td colspan=2 align='center'><p>&nbsp;</p>
				<p><input type='submit' name='submit' value='Click here' class='buttonstyle'> if you would like to send this scene to another person.</p>
				<p>Or <a href="$this->baseUrl">return to the scene</a>.</p></td>
			</tr>
		</table>
		</form>
</div>

%%listrow%%

%%nullobject%%

%%footer%%

%%postprocess%%

%%end of context%%
