<? if(!defined('UC_ROOT')) exit('Access Denied');?>
<? include $this->gettpl('header_client');?>
<? include $this->gettpl('pm_nav');?>

<div class="ucinfo">
	<h1><?=$pms[0][subject]?><span>
	<? if($pms[0][msgfromid] && $pms[0][msgtoid]) { ?>
		<button onclick="location.href='index.php?m=pm_client&a=delete&pmid=<?=$pmid?>&folder=<?=$folder?>&<?=$extra?>'">删除</button>
		<button onclick="location.href='index.php?m=pm_client&a=send&pmid=<?=$pmid?>&do=forward&<?=$extra?>'">转发</button>
	<? } ?>
	<? if($from == 'newbox') { ?>
		<button onclick="location.href='index.php?m=pm_client&a=ls&folder=newbox&<?=$extraret?>'">返回</button>
	<? } else { ?>
		<button onclick="location.href='index.php?m=pm_client&a=ls&folder=<?=$folder?>&filter=<?=$filter?>&<?=$extraret?>'">返回</button>
	<? } ?>
	</span></h1>

	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="newpm">
	<? foreach((array)$pms as $pm) {?>
		<tbody>
			<tr<? if($pm['new']) { ?> class="onset"<? } ?>>
				<td class="sel"></td>
				<td class="ava"><? if($filter != 'announcepm') { ?><img src="avatar.php?uid=<?=$pm['msgfromid']?>&size=small" /><? } ?></td>
				<td class="pef">
				<? if($pm['msgfromid']) { ?><?=$pm['msgfrom']?><? } else { ?>系统消息<? } ?>
				<p><?=$pm['dateline']?></p>
				</td>
				<td class="title"><?=$pm['message']?></td>
			</tr>
		</tbody>
	<? } ?>

	<? if($pms[0][msgfromid] && $pms[0][msgtoid]) { ?>
		<form method="post" id="postpmform" name="postpmform" action="index.php?m=pm_client&a=send&pmid=<?=$pmid?>&<?=$extra?>">
		<input type="hidden" name="formhash" value="<?=FORMHASH?>">
		<input type="hidden" name="saveoutbox" value="0" />
		<input type="hidden" name="folder" value="<? if($from) { ?><?=$from?><? } else { ?><?=$folder?><? } ?>" />
		<input type="hidden" name="related" value="<?=$pmid?>" />
		<input type="hidden" name="msgto" value="<?=$msgto?>" />

		<tfoot>
		<tr>
			<td class="sel"></td>
			<td class="ava"></td>
			<td class="pef"></td>
			<td class="title">
				<strong>回复</strong>:
				<? include $this->gettpl('pm_editorbar');?>
				<textarea class="listarea" id="pm_textarea" rows="6" cols="10" name="message" onKeyDown="ctlent(event)"></textarea>
				<p class="pages_btns"><button name="pmsubmit" class="pmsubmit" type="submit">发送</button></p>
			</td>
		</tr>
		</tfoot>
		</form>
	<? } ?>
</div>

<? if($scroll == 'bottom') { ?>
	<script type="text/javascript">
	window.onload = function() {
		window.scroll(0, document.body.scrollHeight);
		document.postpmform.message.focus();
	}
	</script>
<? } ?>

<? include $this->gettpl('footer_client');?>