<!--<?php
include_once PrintEot('left');
if(!$action){
print <<<EOT
-->
<h3><b>提示信息</b></h3>
<div class="tr5">
1、可以根據自己的需求來定義各頁面各個元素所要調用的模塊<br />
2、也可通過導入導出功能和別的站長分享自己的各頁面配置
</div>
<h2>各頁面管理</h2>
<table cellspacing="0" cellpadding="0" width="100%" id="ftable">
	<tr class="tr3 s3">
		<td>名稱</td>
		<td>SCR</td>
		<td>模板文件</td>
		<td>設置</td>
	</tr>
<!--
EOT;
foreach ($db_modepages as $key=>$value) {
print <<<EOT
-->
	<tr class="tr3">
		<td>$value[name]</td>
		<td>$key</td>
		<td>{$value[template]}.htm</td>
		<td><a href="$basename&action=setpage&template=$value[template]" class="fourm-two" title="設置"><span class="edit"></span></a></td>
	</tr>
<!--
EOT;
}
print <<<EOT
-->
	<tr class="tr3">
		<td class="xia2">導入設置</td>
		<td>
			<form action="$basename" method="post" enctype="multipart/form-data">
			<input name="modeconfig" type="file" class="input" id="modeconfig" size="30" />
			<input name="action" type="hidden" id="action" value="import" />
			<input type="submit" name="Submit5" class="btn" value="導入" />
			</form>
		</td>
		<td><a href="$basename&action=export" style="color:#ff0000">導出配置信息</a></td>
		<td><a href="$basename&action=default" style="color:#ff0000">恢復默認</a></td>
	</tr>
</table>
<!--
EOT;
}elseif($action=='setpage'){print <<<EOT
-->
<h3><b>提示信息</b></h3>
<div class="tr5">
1、可以設置每個元素的名稱及調用模塊<br />
</div>
<h2><b>$thispage[name]頁面管理</b></h2>
<form action="$basename" method="post">
	<table cellspacing="0" cellpadding="0" width="100%" id="ftable">
		<tr class="tr3 s3">
			<td>名稱</td>
			<td>所屬分類</td>
			<td>ID</td>
			<td>調用模塊</td>
			<td>自定義</td>
<!--
EOT;
if($scr=='index'){
print <<<EOT
-->
			<td>更新</td>
<!--
EOT;
}
print <<<EOT
-->
		</tr>
<!--
EOT;
foreach ($pageconfig as $key=>$value) {
print <<<EOT
-->
		<tr class="tr3">
			<td>
				<input type="text" class="input" name="names[$key]" value="$value[name]">
			</td>
			<td>$value[stamp]</td>
			<td>$value[id]</td>
			<td>
				<select name="blocks[$key]">
<!--
EOT;
foreach ($value[block] as $k=>$val) {
$add = $val[bid] == $value[bid] ? 'selected="selected"':'';
print <<<EOT
-->
					<option value="$val[bid]" $add>$val[name]</option>
<!--
EOT;
}
print <<<EOT
-->
				</select>
			</td>
			<td><a href="$basename&action=setelement&id=$value[id]&scr=$scr&template=$template" class="fourm-two" title="設置"><span class="edit"></span></a></td>
<!--
EOT;
if($scr=='index'){
print <<<EOT
-->
			<td><a href="$basename&action=updatelement&id=$value[id]&scr=$scr&template=$template" class="fourm-two" title="更新"><span class="update"></span></a></td>
<!--
EOT;
}
print <<<EOT
-->
		</tr>
<!--
EOT;
}
print <<<EOT
-->
	</table><br />
	<input type="hidden" name="template" value="$template">
	<input type="hidden" name="step" value="2">
	<input type="hidden" name="action" value="setpage">
	<center><input type="submit" value="提 交" class="btn"></center><br />
</form>
<!--
EOT;
}elseif($action=='setelement'){
$paramname = array('postdate'=>'時間','url'=>'鏈接地址','image'=>'圖片地址','title'=>'標題','costs'=>'費用','location'=>'活動地點','num'=>'人數','authorid'=>'作者uid','author'=>'作者','replies'=>'回復數','hits'=>'點擊數','fid'=>'版塊fid');
if ($thisconfig[$id]['stamp']=='forum') {
$paramname['title'] = '版塊名稱';
}elseif($thisconfig[$id]['stamp']=='user'){
$paramname['title'] = '用戶名';
}elseif($thisconfig[$id]['stamp']=='tag'){
$paramname['title'] = '標簽名稱';
}else{
$paramname['title'] = '標題';
}
print <<<EOT
-->
<h3><b>提示信息</b></h3>
<div class="tr5">
1、自定義設置信息，自定義的部分將在排在前面<br />
2、一條信息中，如果輸入不全，將不會錄入
</div>
<h2><b>{$thisconfig[$id][name]} 自定義設置</b></h2>
<form action="$basename" method="post">
	<table cellspacing="0" cellpadding="0" width="100%" id="ftable">
		<tr  class="tr3 s3">
<!--
EOT;
foreach ($params as $key=>$value) {
if(array_key_exists($value,$paramname)){
$value=$paramname[$value];
}else{
$value.='屬性';
}
print <<<EOT
-->
			<td>{$value}</td>
<!--
EOT;
}
print <<<EOT
-->
		</tr>
<!--
EOT;
$i = 0;
foreach ($custom as $key=>$value) {
$i++;
print <<<EOT
-->
		<tr class="tr3">
<!--
EOT;
foreach ($params as $val) {
print <<<EOT
-->
			<td><input type="text" class="input" name="custom[$key][$val]" value="$value[$val]"></td>
<!--
EOT;
}
print <<<EOT
-->
		</tr>
<!--
EOT;
}
print <<<EOT
-->

<!--
EOT;
for ($j=$i;$j<$numlimit;$j++) {
print <<<EOT
-->
		<tr class="tr3">
<!--
EOT;
foreach ($params as $val) {
print <<<EOT
-->
			<td><input type="text" class="input" name="custom[$j][$val]" value=""></td>
<!--
EOT;
}
print <<<EOT
-->			
		</tr>
<!--
EOT;
}
print <<<EOT
-->
	</table>
	<input type="hidden" name="template" value="$template">
	<input type="hidden" name="id" value="$id">
	<input type="hidden" name="scr" value="$scr">
	<input type="hidden" name="step" value="2">
	<input type="hidden" name="action" value="setelement">
	<br /><center><input type="submit" value="提 交" class="btn"><a style="padding-left:2em" href="javascript:;" onclick="cancelCustom();">清空自定義</a></center><br />
</form>
<script language="JavaScript">
function cancelCustom(){
	var e =  document.getElementsByTagName("input");
	for (var i=0;i<e.length;i++) {
		if (e[i].type == 'text') {
			e[i].value = '';
		}
	}
}
</script>
<!--
EOT;
}include_once PrintEot('adminbottom');
?>-->