%%document-stage1create-member-scene%%
$Date $

%%preprocess%%
$this->beryliumToForm(); 

//$this->name= date("Ymd").".".substr(uniqid(""),-4);

if ($this->id!="") {
	$this->hiddenvars= "<input type='hidden' name='id' value=\"$this->id\">";
	}

$this->hiddenvars.= "<input type='hidden' name='name' value='$this->name'>
		<input type='hidden' name='status' value='posted'>
		<input type='hidden' name='public' value='1'>
		<input type='hidden' name='rank' value='100'>";

if ($this->flavor=="") $this->flavor= "Character";

$this->imageidTag= "<img src='/bicons/document$this->iconpvt.gif' align='right'>";
$this->realAuthorTag= bparsebml("[sitemember:$sitemember->id]");

// what room is behind this?
if ($_GET['return']) {
	$urlarray= parse_url($_GET['return']);
	$dirname= dirname($urlarray['path']);
	$roomname= substr($dirname, 9);
	berror("Room name seems to be $roomname.",1);

	// look up folder with name=$roomname and see if it's a room, etc.
	$room= new Folder;
	$roomquery= "SELECT obj.* FROM folder AS obj WHERE obj.name='$roomname' $statuswhere $publicwhere ";
	$room->selectObject($roomquery);
	if ($room->p_background) {
		// ROOM SETTINGS
		berror("Getting imagesize on $room->p_background now...",1);
		if ($background= getimagesize($room->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;
			$this->background= $room->p_background;
			}

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

		// INFO POSITION
		$bgcenter= $this->bgnumericwidth / 2;
		$this->infoLeft= ($bgcenter - 230)."px";
		$bgmiddle= $this->bgnumericheight / 2;
		$this->infoTop= ($bgmiddle - 160)."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%%
<img src='/bicons/warning.png' alt='Warning' align=absmiddle> You seem to be in the wrong place. <a href='$session->refreshUrl?method=edit&$session->cgi'>Try this page</a> instead.

%%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($this->background); background-position: center center;'>
</div>
<div id='frameInfo' class='boothTable' style='position: absolute; width: 460px; height: 320px; z-index: 1; left: $this->infoLeft; top: $this->infoTop;' >
	<form method='post' name='createCharacter' enctype='multipart/form-data' action='$this->baseURL?method=stage1save$session->cgi' >
	$this->hiddenvars
	<input type='hidden' name='flavor' value='Character'>
	<!-- <input type="hidden" name="MAX_FILE_SIZE" value="30720"> -->
	<table class='editTable'>
		<tr>
			<td colspan='2'>
				<p class='objTitle'>Create a new Character</p>
				<p>Here you will create a new character to star in the scenes you create on $site->title.</p>
			</td>
		</tr>
		<tr>
			<td align='right' valign='top' width="20%">Chracter Name:</td>
			<td valign='top'><input type='text' name='title' size='42' maxlength='255' value="$sitemember->name"></td>
		</tr>
		<tr>
			<td colspan='2'>
				<p>Your new Character needs a Pose, an image to represent it in scenes. The best Poses are GIF images with transparent backgrounds.</p>
				<p><a href="#" onClick="window.open('http://$site->name/character-images/AAAindex.php','charSelectWindow','scrollbars=yes,width=600,height=400,status=yes');">Choose from one of ours</a>, or upload/import your own using the fields below. Poses should be smaller than 150x150 pixels. Filesize is limited to 30KB.</p>
			</td>
		</tr>
		<tr>
			<td align='right' valign='top'>upload a new image:</td>
			<td valign='top'><input name='imagefile' type='file' size='32'></td>
		</tr>
		<tr>
		<td align='right' valign='top'><b>OR</b> import new image:</td>
		<td valign='top'><input type='text' name='imageurl' size='42' maxlength='255' value='$this->imageurl'><br>
				&nbsp;Public internet URL of image.</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td><input type='submit' name='submit' value='create' class='buttonstyle' title='Create new Character'></td>
		</tr>
	</table>
	</form>
</div>

%%footer%%

%%postprocess%%

%%end of context%%
