%%document-view-anonymous-scene%%
hiphopclown.org 
2002-12-21 23:41

%%preprocess%%
// SCENE CONTROLLER
// get info on number of scenes here (sceneTotal)
$this->sceneQuery= "SELECT obj.* FROM document AS obj WHERE obj.folderid='$this->folderid' AND obj.flavor='Scene' $session->statuswhere $session->publicwhere ORDER BY rank DESC, created ASC ";
$firstscene= new Document;
berror("SceneControl: <b>looking up scene list here</b>",1);
$sceneArray= $firstscene->selectObject($this->sceneQuery);
berror("SceneControl: <b>found $firstscene->listsize scenes</b>.",1);
$this->total= $firstscene->listsize;

// which scene is being displayed? (sceneOffset)
$this->sceneArrayKey= -1;
foreach ($sceneArray AS $key=>$myScene) {
	berror("SceneControl looking at sceneArray[$key], named $myScene[name]. ($object->name)",1);
	if ($myScene['id']==$this->id) {
		berror("SceneControl <b>MATCH</b> on $key.",1);
		$this->sceneArrayKey= "$key";
		break;
		}
	}

// find last, first, previous and next scene names
$this->offset= $this->sceneArrayKey + 1;

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

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




// SCENE CONTROL PART II
// first is 0
$previous= $this->sceneArrayKey - 1;
$next= $this->sceneArrayKey + 1;
$last= $this->total - 1;

// prevtag / nexttag logic
if ($this->offset!=1) {
	$this->prevtag= "<a href='".$folder->baseUrl."document-".$sceneArray[$previous]['name'].".html' target='_top'>&laquo; Prev</a>&nbsp;&nbsp;";
	}
if ($this->offset==1) {
	// not showing jump-to-last
	//$this->prevtag= "<a href='".$folder->baseUrl."document-".$sceneArray[$last]['name'].".html' target='_top'>Last &raquo</a>&nbsp;&nbsp;";
	$this->prevtag= "";
	}
if ($this->offset<$this->total) {
	$this->nexttag= "&nbsp;&nbsp;<a href='".$folder->baseUrl."document-".$sceneArray[$next]['name'].".html' target='_top'>Next &raquo;</a>";
	}
if ($this->offset==$this->total) {
	$this->nexttag= "&nbsp;&nbsp;<a href='".$folder->baseUrl."document-".$sceneArray[0]['name'].".html' target='_top'>&laquo; Restart &raquo;</a>";
	}

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

%%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: #ffffff; 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;' onDblClick="window.location='#controls';">
</div>
{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;list}
<br />

%%listrow%%


%%nullobject%%
<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;' $this->dblClickControls $this->singleClickAdvance>
	<div id='sceneInfo' class='sceneInfo' style='position: absolute; width: 180px; z-index: 1; left: $this->infoLeft; bottom: $this->infoBottom; border: 1px; padding: 0px; border-style: none;' >
		$this->notFound
		$this->prevtag $this->offset of $this->total $this->nexttag
	</div>
</div>
$this->objects
<br /><a name="controls">&nbsp;</a>
<br />
<table class="boothtable"  cellpadding="8">
	<tr>
		<td valign='top'>
			<span class='objTitle'>Players/Props Controls:</span> ( <a href="$folder->baseUrl/document-$this->name.html?method=edit" target="_top">Edit this Scene</a> ) ( <a href="$folder->baseUrl/document-$this->name.html?method=duplicate" target="_top">Duplicate this Scene</a> )
			<p class='objInfo'><a href="#top">Return to the scene.</a> You can also double-click to switch between scene and controls.</p>
			{list:SELECT obj.* FROM document AS obj WHERE obj.flavor='Character';characterSelect}
			<form name="objectControls" action="$this->baseUrl?method=save$session->cgi" method="POST" onDblClick="window.location='#top';">
			<input type="hidden" name="id" value="$this->id">
			<table class="edittable">
			$this->objectControls
			</table>
			</form>
			<p class='info'>End of Controls. <a href="#controls">Top of Controls</a> or <a href="#top">Return to the scene.</a></p>
			<img src="/bicons/spacer.gif" width=430 height=1>
		</td>
	</tr>
</table>
<br />
<br />&nbsp;

%%footer%%


%%postprocess%%


%%end of context%%
