<!--<?php
include_once PrintEot('left');
if (!$action) {
print <<<EOT
-->
<div class="admin_info mb10">
    <h3 class="h1"><b>提示信息</b></h3>
    <div class="legend"> <ol><li>可以根據自己站點的定位來選擇合適自己的社區模式</li><li>二級域名設置，如︰bbs.phpwind.net。為了統一登錄，請到 <a href="javascript:;" onclick="parent.PW.Dialog({id:'basic',url:'$admin_file?adminjob=settings&admintype=basic',name:'常規設置'});">全局參數</a> 中配置Cookie作用域</li><li>修改主導航中的模式名及顯示順序請到 <a href="javascript:;" onclick="parent.PW.Dialog({id:'navmain',url:'$admin_file?adminjob=customnav&adminitem=navmain&adminitem=navmain',name:'社區主導航'});">社區主導航</a></li></ol> </div>
</div>
<form action="$basename&" method="post">
  <input type="hidden" name="action" value="set">
  <h2 class="h1">社區模式選擇</h2>
  <div class="admin_table mb10">
  <table width="100%" cellspacing="0" cellpadding="0">
    <tr class="tr2">
      <td width="80">模式名稱</td>
      <td width="170">二級域名</td>
      <td width="60">選擇默認</td>
      <td width="80">開啟</td>
      <td>操作</td>
    </tr>
		<tr class="tr1 vt">
      <td class="td2"><i id="bt_bbs" onclick="cateopen('$key')" class="expand expand_d"></i>論壇模式</td>
      <td class="td2">&nbsp;</td>
      <td class="td2"><input type="radio" name="defaultmode" value=''{$checkArr[bbs]} /></td>
      <td class="td2"><input type="hidden" name="ifopen[]" value="bbs" /></td>
      <td class="td2">&nbsp;</td>
    </tr>
		<tr class="tr1 vt">
      <td class="td2"><i id="bt_o" onclick="dmopen('o')" class="expand expand_d"></i>{$db_modes[o][m_name]}</td>
      <td class="td2"><input type="text" name="domain[o]" value="{$db_modedomain[o]}" class="input input_wa"></td>
      <td class="td2"><input type="radio" name="defaultmode" value="o"{$checkArr[o]} /></td>
      <td class="td2"><input type="hidden" name="ifopen[]" value="o" /></td>
      <td class="td2"><a title="更新緩存" href="$basename&action=fourmtypecache&m=o" class="mr20">[更新]</a></td>
    </tr>
<!--
EOT;
foreach($db_modes as $key => $mode){
if ($key == 'bbs' || $key == 'o') continue;
$ifopen = $mode[ifopen]==1 ? 'checked="checked"' : '';
$tmpstyle = isset($dm_array[$key]) ? 'expand expand_a' : 'expand expand_d';
print <<<EOT
-->
    <tr class="tr1 vt">
      <td class="td2"><i id="bt_$key" onclick="dmopen('$key')" class="$tmpstyle"></i>{$mode[m_name]}</td>
      <td class="td2"><input type="text" name="domain[$key]" value="{$db_modedomain[$key]}" class="input input_wa"></td>
      <td class="td2"><input type="radio" name="defaultmode" value="$key"{$checkArr[$key]} /></td>
      <td class="td2">
<!--
EOT;
if ($key != 'area') {
print <<<EOT
-->
      	<input type="checkbox" name="ifopen[]" value="$key" $ifopen/>
<!--
EOT;
} else {print <<<EOT
-->
		<input type="checkbox" name="ifopen[]" value="1" checked="checked" style="display:none;" readonly="readonly" disabled />
<!--
EOT;
}print <<<EOT
-->
      </td>
      <td class="td2">
      	<a title="更新緩存" href="$basename&action=fourmtypecache&m=$key" class="mr20">[更新]</a>
<!--
EOT;
if ($key != 'area') {
print <<<EOT
-->
      	<a href="$basename&action=uninstall&m=$key" onclick="return confirmdel();">[卸載]</a>
<!--
EOT;
}print <<<EOT
-->
      </td>
    </tr>
<!--
EOT;
}print <<<EOT
-->
  </table>
</div>  
<div class="mb10 tac">
    <span class="btn"><span><button type="submit">提 交</button></span></span>
  </div>
</form>
<!--
EOT;
if ($uninstall) {
print <<<EOT
-->
<h2 class="h1">未安裝模式</h2>
<div class="admin_table mb10">
<table width="100%" cellspacing="0" cellpadding="0">
  <tr class="tr2">
    <td>模式名稱</td>
    <td>模式說明</td>
    <td>模式目錄</td>
    <td>管理選項:</td>
  </tr>
<!--
EOT;
foreach($uninstall as $mode){
print <<<EOT
-->
  <tr class="tr1 vt">
    <td class="td2">$mode[0]</td>
    <td class="td2">$mode[1]</td>
    <td class="td2">$mode[2]</td>
    <td class="td2"><a href="$basename&action=install&mode=$mode[2]">安裝</a></td>
  </tr>
<!--
EOT;
}
print <<<EOT
-->
</table>
</div>
<!--
EOT;
}}print <<<EOT
-->
</div>
<script type="text/javascript">
function showListFid(fid){
	if (getObj('type_'+fid)) {
		var showfid = getObj('type_'+fid);
		if (showfid.style.display == 'none') {
			showfid.style.display = '';
			getObj('cate_'+fid).className = 'expand expand_b';
		} else {
			showfid.style.display = 'none';
			getObj('cate_'+fid).className = 'expand expand_a';
		}
	}
}
function confirmdel(){
	if (!confirm("卸載了之後本模式的數據也會清空，確定要卸載本模式？")){
		return false;
	}
}
var Cookie = {
	set : function(name,value) {
		expires = new Date();
		expires.setTime(expires.getTime()+(86400*365));
		document.cookie=name+"="+escape(value)+"; expires="+expires.toGMTString()+"; path=/";
	},
	get : function(name) {
		var start = document.cookie.indexOf(name);
		var end = document.cookie.indexOf(";",start);
		return start==-1 ? null : unescape(document.cookie.substring(start+name.length+1,(end>start ? end : document.cookie.length)));
	},
	del : function(name) {
		var exp = new Date();
		exp.setTime(exp.getTime() - 1);
		var cval=Cookie.get(name);
		if(cval) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
	}
}
function dmopen(id) {
	var o = getObj('dm_' + id);
	if (o == null) return;
	if (o.style.display == 'none') {
		o.style.display = '';
		getObj('bt_' + id).className = 'expand expand_b';
		Cookie.set('dm_cate', 1);
	} else {
		o.style.display = 'none';
		getObj('bt_' + id).className = 'expand expand_a';
		Cookie.del('dm_cate');
	}
}
if (Cookie.get('dm_cate')) {
	dmopen('area');
}
</script>
<!--
EOT;
include_once PrintEot('adminbottom');
?>-->
