<!--<?php
include_once PrintEot('left');
if (empty($action)) {print <<<EOT
-->
<div class="nav3 mb10">
    <ul class="cc">
        <li class="current"><a href="$basename">应用列表</a></li>
        <li><a href="$basename&action=add">添加应用</a></li>
    </ul>
</div>
<form method="post" action="$basename&">
<input type="hidden" name="action" value="del" />
<h2 class="h1">应用列表</h2>
<div class="admin_table mb10">
<table width="100%" cellspacing="0" cellpadding="0">
	<tr class="tr2">
		<td width="5%">删?</td>
		<td width="10%">应用ID</td>
		<td width="12%">应用名称</td>
		<td width="20%">应用URL</td>
		<td>通信情况</td>
		<td width="8%">编辑</td>
	</tr>
<!--
EOT;
$s_lang = array(
	'-2' => '<font color="blue">正常</font>',
	'-1' => '<font color="gray">通信失败</font>',
	'1'  => '<font color="red">接口关闭</font>',
	'2'  => '<font color="red">密钥错误</font>',
	'3'  => '<font color="gray">未知错误</font>'
);
foreach ($apps as $key => $value) {print <<<EOT
-->
	<tr class="tr1">
		<td width="5%" class="td2"><input type="checkbox" name="selid[]" value="$value[id]" /></td>
		<td width="10%" class="td2">$value[id]</td>
		<td width="12%" class="td2">
			$value[name]
<!--
EOT;
if ($value['id'] == $uc_appid) {print <<<EOT
-->
			(<font color="blue">本站</font>)
<!--
EOT;
}print <<<EOT
-->
		</td>
		<td width="20%" class="td2">$value[siteurl]</td>
		<td class="td2">{$s_lang[$value[status]]}</td>
		<td width="8%" class="td2"><a href="$basename&action=edit&id=$value[id]">[编辑]</a></td>
	</tr>
<!--
EOT;
}print <<<EOT
-->
</table>
</div>
<div class="tac mb10">
    <span class="bt"><span><button type="button" name="chkall" onclick="CheckAll(this.form)">全 选</button></span></span>
	<span class="btn"><span><button type="submit" name="delete">提 交</button></span></span>
</div>
</form>
<!--
EOT;
} elseif ($action == 'add' || $action == 'edit') {print <<<EOT
-->
<div class="nav3 mb10">
	<ul class="cc">
		<li><a href="$basename">应用列表</a></li>
<!--
EOT;
if ($action == 'add') {print <<<EOT
-->
		<li class="current"><a href="$basename&action=add">添加应用</a></li>
<!--
EOT;
} else {print <<<EOT
-->
		<li><a href="$basename&action=add">添加应用</a></li>
		<li class="current"><a href="$basename&action=edit&id=$id">编辑应用</a></li>
<!--
EOT;
}print <<<EOT
-->
	</ul>
</div>
<form action="$basename" method="post">
<input type="hidden" name="action" value="$action" />
<input type="hidden" name="step" value="3" />
<input type="hidden" name="id" value="$id" />
<h2 class="h1">应用信息</h2>
<div class="admin_table mb10">
<table width="100%" cellspacing="0" cellpadding="0">
	<tr class="tr1">
		<td class="td1">应用名称</td>
		<td class="td2"><input type="text" name="name" value="$app[name]" class="input input_wa" /></td>
	</tr>
	<tr class="tr1">
		<td class="td1">应用的URL</td>
		<td class="td2"><input type="text" name="siteurl" value="$app[siteurl]" class="input input_wa" /></td>
	</tr>
	<tr class="tr1">
		<td class="td1">应用密钥</td>
		<td class="td2">
        	<input type="text" name="secretkey" value="$app[secretkey]" id="secretkey" class="input input_wa mr5" />
            <span class="bt2"><span><button type="button" onclick="randomChar(20)">随机生成密钥</button></span></span>
        </td>
	</tr>
	<tr class="tr1 vt">
		<td class="td1">接口文件</td>
		<td class="td2">
        	<input type="text" name="interface" value="$app[interface]" class="input input_wa mb5" />
            <p>此处留空，将默认调用 pw_api.php 文件</p>
        </td>
	</tr>
</table>
</div>
<div class="tac mb10">
	<span class="btn"><span><button type="submit" name="delete">提 交</button></span></span>
</div>
</form>
<script language="JavaScript">
function randomChar(len) {
	var x = "0123456789qwertyuioplkjhgfdsazxcvbnm";
	var tmp = "";
	for (var i = 0; i < len; i++) {
		tmp += x.charAt(Math.ceil(Math.random() * 100000000) % x.length);
	}
	getObj('secretkey').value = tmp;
}
</script>
<!--
EOT;
}include_once PrintEot('adminbottom');
?>-->