<!--<?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>應用ID</td>
		<td width="12%">應用名稱</td>
		<td width="20%">應用URL</td>
		<td width="8%">通信情況</td>
		<td width="8%">操作</td>
	</tr>
<!--
EOT;
$s_lang = array(
	'-2' => '<span class="s3">正常</span>',
	'-1' => '<span class="s1">通信失敗</span>',
	'1'  => '<span class="gray">接口關閉</span>',
	'2'  => '<span class="s1">密鑰錯誤</span>',
	'3'  => '<span class="s2">未知錯誤</span>'
);
foreach ($apps as $key => $value) {print <<<EOT
-->
	<tr class="tr1">
		<td class="td2"><input type="checkbox" name="selid[]" value="$value[id]" /></td>
		<td class="td2">$value[id]</td>
		<td class="td2">
			$value[name]
<!--
EOT;
if ($value['id'] == $uc_appid) {print <<<EOT
-->
			(<span class="s1">本站</span>)
<!--
EOT;
}print <<<EOT
-->
		</td>
		<td class="td2">$value[siteurl]</td>
		<td class="td2">{$s_lang[$value[status]]}</td>
		<td 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 type="text/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');
?>-->