%%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 && $sitemember->role!="anonymous") {
    // 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.";

// SCENE CONTROL
// get info on number of scenes here (sceneTotal)
$notcurrent= " AND obj.id!='$this->id' ";
$this->sceneQuery= "SELECT obj.* FROM document AS obj WHERE obj.folderid='$folder->id' AND obj.flavor='Scene'  AND obj.rank>=100 $notcurrent $session->statuswhere $session->publicwhere ORDER BY rank DESC, created ASC ";



%%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 />
<a name="scenes"> </a>
	<span class='objTitle'>
		<img src='/bicons/spacer.gif' width='1' height='20' border=0>
		Other scenes in <a href='$folder->baseUrl'>$folder->title</a>:
	</span> ( <a href="#top">Back to current scene</a> | <a href="$folder->baseUrl#comments">Add/View Comments</a> )
	{list:$this->sceneQuery;index}
<br />

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