%%document-view-anonymous-html%%
2002-12-23 23:40

%%preprocess%%
 // format the object for display
$this->beryliumToHtml(); 
$this->getRuntimeVars();
$this->applyPolicy();

if ($this->id=="") {
	header("HTTP/1.0 404 Not Found");
	}

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

// 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;

// edit tag for document owner
if ($this->itemOwner || $this->itemEditor) {
	if ($this->rank > $sitemember->rank) $this->editTag= "";
	else $this->editTag= "| <a href='$this->baseUrl?method=edit$session->cgi'><img src='/bicons/edit.gif' alt='edit' title='edit this object' align=absmiddle border=0></a>
			<a href='$this->baseUrl?method=edit$session->cgi'>edit</a> &nbsp;";
	}

// only show body if body is there!
if (trim($this->body)) {
	//$this->body= bparsebml($this->body);
	$this->bodyContent= "
<table border=0>
	<tr>
		<td width='1%'><img src='/bicons/spacer.gif' border=0 alt=document width=20 height=1></td>
		<td width='98%'>&nbsp;</td>
		<td width='1%'><img src='/bicons/spacer.gif' border=0 alt=document width=20 height=1></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td class='objBody'>$this->body</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td width='1%'>&nbsp;</td>
		<td width='98%'>&nbsp;</td>
		<td width='1%'>&nbsp;</td>
	</tr>
</table>
<table cellspacing=5 cellpadding=5>
	<tr>
		<td align='right' class='info'>
				<a href='document-$this->name.txt'><img src='/bicons/print.gif' border=0 alt='text version' title='text version' align=absmiddle></a>
				<a href='document-$this->name.txt'>text</a> |
				<a href='$folder->baseUrl'><img src='/bicons/folder-open.gif' border=0 alt='parent folder' title='parent folder' align=middle></a>
				<a href='$folder->baseUrl'>$folder->title</a> |
				<a href='#top'>jump to top</a>&nbsp;
				$this->editTag
				<br>&nbsp;
		</td>
	</tr>
</table>";
	}

// subscriptionTag
if (0 && $sitemember->role!="anonymous" && $sitemember->role!="member") {
	if ($sitemember->id>0 && $this->p_subscriptionList!="") {
		// if sitemember is on subscription list, say so and link to unsubscribe
		$subscriptionArray= explode(",",$this->p_subscriptionList);
		$found= 0;
		foreach ($subscriptionArray AS $key=>$value) {
			if ($value==$sitemember->id) {
			$found= 1;
			berror("document-view: found sitemember->id in subscriptionList array at $key.",1);
			}
			}

		if ($found) {
			$this->subscribeTag= "<p>You will receive a record of all new Poses at $member->email.
				<a href='$this->baseUrl?method=toggleSubscribed$session->cgi'>Click to unsubscribe.</a>
				To find out who else is subscribed, <a href='$this->baseUrl?method=viewSubscriptionList'>click here</a>.</p>";
			}
		else {
			// else, link to subscribe
			$this->subscribeTag= "<p><a href='$this->baseUrl?method=toggleSubscribed$session->cgi'>Subscribe to this Character</a> via email.
			To find out who is subscribed, <a href='$this->baseUrl?method=viewSubscriptionList'>click here</a>.</p>";
			}
		}
	elseif ($sitemember->id>0) {
		// link to subscribe
		$this->subscribeTag= "<p><a href='$this->baseUrl?method=toggleSubscribed$session->cgi'>Subscribe to this Character</a> via email.</p>";
		}
	}

// how many poses?
$firstpose= new Image;
$query= "SELECT obj.* FROM image AS obj WHERE obj.parentobjtype='$this->objtype' AND obj.parentid='$this->id' AND obj.flavor='Pose' $session->statuswhere $session->publicwhere ORDER BY obj.rank DESC, obj.created ASC";
$firstpose->selectObject($query);
$this->commentTotal= $firstpose->listsize;
$this->iconTag= bparsebml("[icon:$firstpose->id]");


// RETURN to ADD CHARACTER
if ($_GET['return']!="") {
	$this->returnTag= "<a href='$_GET[return]?method=addCharacter&newdocumentid=$this->id'>Add this Character to the Scene you were working on.</a>";
	}

%%header%%

%%css%%


%%template%%
<table class='objTable' cellspacing=5 cellpadding=5>
	<tr>
		<td>
			<table class='objHeader'>
				<tr>
					<td valign='top'>
						<span class='objFlavor'>$this->flavor:<br></span>
						<span class='objTitle'><a href="$this->baseUrl">$this->title</a></span>
						<span class='objByline'> <br> 
							By $this->authorTag on $this->dateTag.</span>
					</td>
					<td width='1' valign='top'>$this->iconTag</td>
				</tr>
			</table>
			<blockquote class='objDescription'>$this->description<br>&nbsp;</blockquote>
			$this->returnTag
			<p align="right" class='info'>$this->moreTag
				<a href='#comments'>$this->commentTotal poses</a> |
				<a href='document-$this->name.txt'><img src='/bicons/print.gif' border=0 alt='text version' title='text version' align=absmiddle></a>
				<a href='document-$this->name.txt'>text</a><!-- |
				 <a href='$folder->baseUrl'><img src='/bicons/folder-open.gif' border=0 alt='parent folder' title='parent folder' align=middle></a>
				<a href='$folder->baseUrl'>$folder->title</a> -->&nbsp;
				$this->editTag
			</p>
		</td>
	</tr>
</table>
$this->bodyContent
<table class="commentTable">
	<tr>
		<td valign=top><a name='comments'>&nbsp;</a></td>
		<td><span class='objTitle'>$this->title's Poses:</span>
			$this->subscribeTag
			{list:SELECT obj.* FROM image AS obj WHERE obj.siteid='$site->id' AND obj.parentobjtype='document' AND obj.parentid='$this->id' AND obj.flavor='Pose' $session->statuswhere $session->publicwhere ORDER BY obj.rank DESC, obj.created ASC;poseList}</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td width='1%'><img src='/bicons/spacer.gif' border=0 alt=document width=10 height=1></td>
		<td width='98%'>&nbsp;</td>
		<td width='1%'><img src='/bicons/spacer.gif' border=0 alt=document width=10 height=1></td>
	</tr>
</table>

%%listrow%%

%%nullobject%%
<p><img src='/bicons/warning.png' alt='Warning' align=left><br>
	<b>The document you requested was not found.</b></p>
<p><a href='$session->scriptname$folder->name/document-.html?method=listall$session->cgi'>Here is a list</a> of all the documents in this folder.</p> 

%%footer%%

%%postprocess%%

%%end of context%%
