%%document-view-anonymous-html%%
2002-12-22 18:18

%%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= "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;

berror("this->itemOwner== $this->itemOwner / this->itemEditor== $this->itemEditor",1);
// edit tag for document owner
if ($this->itemOwner) {
	if ($this->rank > $sitemember->rank) $this->editTag= "";
	else $this->editTag= "<p align='right'><a href='$this->baseUrl?method=edit$session->cgi'><img src='/bicons/edit.png' alt='edit' title='edit this object' align=absmiddle border=0></a>
			<a href='$this->baseUrl?method=edit$session->cgi'>edit</a>
			| <a href='$folder->baseUrl/document-.html?method=create$session->cgi'>create new</a>
			| <a href='$this->baseUrl?method=duplicate$session->cgi'>duplicate</a> &nbsp;</p>";
	}
if ($this->itemEditor) {
	if ($this->rank > $sitemember->rank) $this->editTag= "";
	else $this->editTag= "<p align='right'><a href='$this->baseUrl?method=edit$session->cgi'><img src='/bicons/edit.png' alt='edit' title='edit this object' align=absmiddle border=0></a>
			<a href='$this->baseUrl?method=edit$session->cgi'>edit</a>
			| <a href='$folder->baseUrl/document-.html?method=create$session->cgi'>create new</a>
			| <a href='$this->baseUrl?method=duplicate$session->cgi'>duplicate</a>
			| <a href='$this->baseUrl?method=toggleRank'><img src='/bicons/bulbsgif/$this->glow.gif' alt='$this->publishStatus' title='folder:$this->id is $this->publishStatus' align=absmiddle border=0></a>
			| <a href='$this->baseUrl?method=pickup'><img src='/bicons/pickup.png' alt='pick up' title='pick up this object' align=absmiddle border=0></a>
			<a href='$this->baseUrl?method=pickup'>pick up</a> &nbsp;</p>";
	}


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

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

// DESCRIPTION FILLER
if ($this->description=="") $this->description= "A $this->flavor in $folder->title.";



%%header%%

%%css%%
.commentTable { padding: 5px; border-color: #999999; border-width: 1px; border-style: solid; }

%%template%%
<table class='siteHeader'>
	<tr>
		<td>
			<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>
			<blockquote class='objDescription'>$this->description<br>&nbsp;</blockquote>
			$this->editTag
		</td>
	</tr>
</table>
<br />
<div class="commentTable">
<table>
	<tr>
		<td colspan=2>
			<a name='comments'> </a>Room Comments:<br />
			<span class='objTitle'>Discussion of $folder->title</span>:
			$this->subscribeTag
		</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td valign=top>&nbsp;</td>
		<td>
		{list:SELECT obj.* FROM comment AS obj WHERE obj.siteid='$site->id' AND obj.parentobjtype='folder' AND obj.parentid='$folder->id' $session->statuswhere $session->publicwhere ORDER BY obj.created ASC;roomlist}
		</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td width='1%'><img src='/bicons/spacer.png' border=0 alt=document width=10 height=1></td>
		<td width='98%'>&nbsp;</td>
		<td width='1%'><img src='/bicons/spacer.png' border=0 alt=document width=10 height=1></td>
	</tr>
</table>
</div>

%%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%%
