%%folder-view-anonymous-html%%
2002-07-21 14:40

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

// folder only-- force http for anonymous
if ($sitemember->role=="anonymous" && $session->request->connection!="http" && $session->request->method!="login" && $session->request->method!="createmember" && $session->request->method!="logout") {
	 $newlocation= "http://$site->name$session->refreshURL";
	 berror("Anonymous connects via HTTP. Trying to redirect to $newlocation.",1);
	 header("Location: $newlocation");
	 exit;
	 }
 
// format the object for display
$this->beryliumToHtml(); 
$this->getRuntimeVars();

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

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



//
// Object Access Bar (folders, documents, etc)
// show berylium icon at top
if ($this->imageid=="0" && ($sitemember->role=="editor" || $sitemember->role=="admin")) {
    $this->topIconTag= "<img src='/bicons/blogo-label-48x48.png' border=0 alt='berylium' title='A berylium site. See http://berylium.org for info.'>";
    }
else $this->topIconTag= $this->iconTag;

// contexts are for admins only:
if ($sitemember->role=="admin") {
	$this->adminAccess= " | <a href='$folder->baseURL/context-.html?method=view'>contexts</a>"; 
	}


//
// Session Control Bar (Cancel, debug, etc...)
// cancel button
    if ($session->request->method!="view" && $session->request->method!="listall") {
	    $this->cancelTag= "<a href='$object->baseUrl'><img src='/bicons/cancel.png' border=0 alt='' title='cancel' align=middle></a>&nbsp;<a href='$object->baseUrl'>cancel</a>";
	    }
    elseif ($object->objtype!="folder" || $session->request->method=="listall") {
	    $this->cancelTag= "<a href='$this->baseUrl'><img src='/bicons/folder-open.png' border=0 alt='' title='parent folder' align=middle></a>&nbsp;<a href='$this->baseUrl'>$this->title</a>";
	    }
    elseif ($containers[1]->baseUrl!="") {
	    $this->cancelTag= "<a href='".$containers[1]->baseUrl."'><img src='/bicons/folder-open.png' border=0 alt='' title='parent folder' align=middle></a>&nbsp;<a href='".$containers[1]->baseUrl."'>".$containers[1]->title."</a>";
	    }
    else {
	    $this->cancelTag= "<a href='http://$site->name/'><img src='/bicons/folder-open.png' border=0 alt='' title='parent site' align=middle></a>&nbsp;<a href='http://$site->name/'>$site->name</a>";
	    }
// debug switch
    if ($session->p_debug) {
	$this->debugTag= "<a href='$session->refreshURL&debug=off'>no debug</a> |";
	}
    elseif ($sitemember->role=="admin") {
	$this->debugTag= "<a href='$session->refreshURL&debug=1'>debug</a> |";
	}
// standardContext switch
    if ($session->p_standardContext) {
	$this->contextTag= "<a href='$session->refreshURL&standardContext=0'>site look</a> |";
	}
    elseif ($sitemember->role=="writer" || $sitemember->role=="editor" || $sitemember->role=="admin") {
	$this->contextTag= "<a href='$session->refreshURL&standardContext=1'>berylium look</a> |";
	}
// showDeleted switch
    if ($session->p_showDeleted) {
	$this->showDelTag= "<a href='$session->refreshURL&showDeleted=0'>hide deleted</a> |";
	}
    elseif ($sitemember->role=="editor" || $sitemember->role=="admin") {
	$this->showDelTag= "<a href='$session->refreshURL&showDeleted=1'>show deleted</a> |";
	}

//
// User Control Bar
$rrole= "r$sitemember->role";
$this->{$rrole}= "selected";
switch ($sitemember->truerole) {
    case "admin":
        $roleoptions= "<option value='admin' $this->radmin>admin</option>
              <option value='editor' $this->reditor>editor</option>
              <option value='writer' $this->rwriter>writer</option>
              <option value='member' $this->rmember>member</option>
              <option value='anonymous' $this->ranonymous>anonymous</option>";
        break;
        
    case "editor":
        $roleoptions= "<option value='editor' $this->reditor>editor</option>
              <option value='writer' $this->rwriter>writer</option>
              <option value='member' $this->rmember>member</option>
              <option value='anonymous' $this->ranonymous>anonymous</option>";
        break;
        
    case "writer":
        $roleoptions= "<option value='writer' $this->rwriter>writer</option>
              <option value='member' $this->rmember>member</option>
              <option value='anonymous' $this->ranonymous>anonymous</option>";
        break;
        
    case "member":
        $this->loginheader= "Prepared for $sitemember->truerole <a href='$sitemember->idUrl'>$sitemember->name</a>.<br>
            <a href='$sitemember->idUrl?method=edit'>preferences</a> | <a href='$refreshURL?method=logout'>logout</a>";
        $this->loginfooter= "Prepared for $sitemember->truerole <a href='$sitemember->idUrl'>$sitemember->name</a>.<br>
            <a href='$sitemember->idUrl?method=edit'>preferences</a> | <a href='$refreshURL?method=logout'>logout</a>&nbsp;";
        break;
        
    default:
        $this->loginheader= "<form action='$object->baseSSLUrl?method=login' name='userLogin' method='POST'>
                You are being anonymous.&nbsp;&nbsp;&nbsp;<br>
                <input type='text' name='email' value='email' onFocus=\"document.userLogin.email.value=''\" size='10' class='permaform'>
                <input type='password' name='password' value='***' onFocus=\"document.userLogin.password.value=''\" size='6' class='permaform'>
		<input type='submit' name='login' value='login' class='permaformbutton'><br><br>
                <a href='$object->baseUrl?method=login'>Login</a> above or
                <a href='$object->baseURL?method=createmember'>register here</a>.
            </form>";
        $this->loginfooter= "You are being anonymous. Please <a href='$object->baseUrl?method=login'>login or register here</a>.";
        break;
    }
if ($sitemember->truerole!="anonymous" && $sitemember->truerole!="member") {
    $this->loginheader= "
        <form action='$session->refreshUrl' name='userControl' method='GET'>
            Prepared for $sitemember->truerole <a href='$sitemember->idUrl'>$sitemember->name</a>.<br>
            <a href='$sitemember->idUrl?method=edit'>preferences</a> | <a href='$refreshURL?method=logout'>logout</a>
            <br>
            <img src='/bicons/spacer.gif' width='1' height='24'>
            View as 
            <select name='role' onChange='document.userControl.submit()' align='absmiddle'>
              $roleoptions
            </select>
            <input type='submit' name='go' value='&raquo;' class='buttonstyle'>
        </form>";
    $this->loginfooter= "Prepared for $sitemember->truerole <a href='$sitemember->idUrl'>$sitemember->name</a>.<br>
        <a href='$sitemember->idUrl?method=edit'>preferences</a> | <a href='$refreshURL?method=logout'>logout</a>&nbsp;";
    }

if ($sitemember->truerole!=$sitemember->role) {
    $this->loginfooter= "Rendered as if you were an $sitemember->role. (<a href='$session->refreshUrl?role=0'>off</a>)<br>".$this->loginfooter;
    }

    

// XOBOT SPECIFIC:
if ($sitemember->p_xobot==1) {
	$this->xobotactivetag= "<font color='red'>-on-</font>";
	}
else {
	$this->xobotactivetag= "<b>off</b>";
	}
if (trim($sitemember->p_xobotmessage)!="") {
	$this->xobotmessage= bHtml($sitemember->p_xobotmessage);
	}
else {
	$this->xobotmessage= "You have not created a message yet.";
	if ($sitemember->p_xobot==1) {
		$this->xobotmessage= "This is an automatic reply from $sitemember->name. Thank-you for emailing me. (default message)";
		}
	}

// kludge so cbml knows sitememberid
$this->xobotmemberid= $sitemember->id;

// show only to logged-in members
if ($sitemember->role=="anonymous") $this->showNull=1;


%%header%%
<table class='siteHeader'>
    <tr>
	<td width="5%" align=center valign=middle>
	    <a href="/berylium">$this->topIconTag</a>
	</td>
	<td width="60%" valign='middle'>
	    <span class='objTitle'><a href='$folder->baseUrl'>$folder->title</a> @ <a href='$site->baseUrl'>$site->title</a></span>
	    <span class='objDescription'><br>$folder->description</span>
	</td>
	<td width="35%" class="info" align='right' rowspan="2">
            $this->loginheader
        </td>
    </tr>
    <tr>
	<td colspan="2" class="info">
			<form name='search' action='$site->baseUrl/document-.html?method=listall' method='post'>
			<input type='hidden' name='listrank' value='50'>
			<!-- <img src="/bicons/spacer.gif" width=1 height=20> -->
			<!-- session controls
			<img src="/bicons/spacer.gif" width=1 height=20>
			<a href='$session->refreshURL'><img src='/bicons/refresh.png' border=0 alt='' title='refresh page' align=middle></a>&nbsp;<a href='$session->refreshURL'>refresh</a> |
			$this->cancelTag |
			$this->debugTag
			$this->contextTag  -->
			$this->showDelTag
			<a href='#bottom'>bottom of page</a> | keyword:
			<input type='text' name='keyword' value='$session->keyword' size=12 class='permaform'>
			<input type='submit' name='submit' value='search' class='permaformbutton'>
			</form>
	</td>
    </tr>
</table>
</td>
</tr>
</table>
<br>
<table class='bodytable'>
<tr>
<td align='center' valign='top'>
<table>
	<tr>
		<td valign='top' width='22%' class='navigationcell'>
			{list:SELECT obj.* FROM folder AS obj, folder WHERE obj.rank>=100 AND obj.siteid='$site->id' AND obj.status='posted' AND folder.id=obj.folderid AND obj.name!='/'  AND obj.folderid='$site->folderid' $session->publicwhere ORDER BY obj.rank DESC, obj.title ASC;navbar}
			$this->inventoryList
		</td>
		<td valign='top' width='78%' class='contentcell'>
<!-- begin object content -->



%%css%%


%%template%%
<div class='objBody'>$this->body</div>
<p class='objHeadline'><img src='/bicons/spacer.gif' width='1' height='20' border=0>$this->headline for $sitemember->name</p>
<p>Your responder is turned $this->xobotactivetag. Your current message is:
<blockquote>$this->xobotmessage</blockquote></p>
<p><a href="$this->baseUrl/sitemember-$sitemember->id.html?method=edit">Edit your auto-response settings.</a></p>
<hr>
<p class='objHeadline'>Replied-to list:</p>
{list:SELECT obj.* FROM event AS obj WHERE obj.parentobjtype='sitemember' AND obj.parentid='$this->xobotmemberid' AND obj.flavor='xobotsend' $session->statuswhere;list}
<p>&nbsp;</p>

%%listrow%%


%%nullobject%%
<div class='objBody'>$this->body</div>
<p><b>You must be <a href='$this->baseUrl?method=login'>logged-in</a> to access the Xobot.</b></p>


%%footer%%
<!-- end object content -->
		</td>
	</tr>
</table>
<a name='bottom'></a>
</td>
</tr>
</table>
<br>
<table class='bodytable'>
<tr>
<td align='center' valign='top'>
<table class='siteHeader'>
	<tr>
		<td width='20%'><img src='/bicons/spacer.gif' border=0 alt='controls:' title=''></td>
		<td width='80%' class='info' align='right'>
			<form name='search' action='$site->baseUrl/document-.html?method=listall' method='post'>
			<input type='hidden' name='listrank' value='50'>
			<!-- session controls
			<img src="/bicons/spacer.gif" width=1 height=20>
			<a href='$session->refreshURL'><img src='/bicons/refresh.png' border=0 alt='' title='refresh page' align=middle></a>&nbsp;<a href='$session->refreshURL'>refresh</a> |
			$this->cancelTag | -->
			$this->debugTag
			$this->contextTag
			$this->showDelTag
			<a href='#top'>top of page</a> | keyword:
			<input type='text' name='keyword' value='$session->keyword' size=12 class='permaform'>
			<input type='submit' name='submit' value='search' class='permaformbutton'>
			<br><br>$this->loginfooter
			</form>
		</td>
	</tr>
</table>


%%postprocess%%


%%end of context%%
