<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>APP列表</title>
<link href="/views/css/managerBase.css" rel="stylesheet" type="text/css">

<script type="text/javascript" src="/views/js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="/views/js/groupOpt.js"></script>
<script>
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
function setAppState(aid,key_name){
	if(aid==1){
		alert("内置账户不能更改！");return;
	}
	if(!confirm("你确定要改变ID为 "+aid+" 的管理员账号状态为 "+key_name+" 吗？")){
		return ;
	}
	var kv = {
		'锁定':0,'解除锁定':1
	};
	var url='/adminMgr.php';
	var d = {
		___rnd : Math.random(),
		act : 'set_state',
		state : kv[key_name],
		aid : aid
	};
	// 提交请求
	$.get(url,d,function (v){
		if (v=='OK'){
			alert('状态更改成功!');
			window.location.reload(1);
		}else{
			alert(v);
		}
	});
}
//-----------------------------------------------------------------------
$(function (){
	//搜索框初始化
	var defTip = '请输入...';
	var vS = "#keyw";
	var fS = "#searchForm";
	if ($(vS).val() =='' ){
		$(vS).val(defTip);
	}
	
	$(vS).focus(function (){
		if (this.value == defTip){
			this.value = '';
		}
	});
	
	$(vS).blur(function (){
		if (this.value == ''){
			this.value = defTip;
		}
	});
	$(vS).keydown(function(event){
		if (event.keyCode == 13 ){
			$(fS).submit();
		}
	});
	
	$(fS).submit(function (){
		var v = $.trim($(vS).val());
		if ( v=='' || v == defTip){
			$(vS).val('');
		}else{
			$(vS).val(v);
		}
		return true;
	});
});
//-----------------------------------------------------------------------
</script>
</head>
<body>
<div class="wrapper">
<form name="searchForm" id="searchForm" action="adminMgr.php"  enctype="application/x-www-form-urlencoded" method="get"  class="topForm">
<h3><a href="adminMgr.php?act=add"  >添加管理员</a>管理员列表</h3>
<div class="forSearch">
<input name="keyw" type="text" id="keyw" size="15"  value="<%$smarty.get.keyw%>">
<input type="submit" name="button" id="button" value="查 找">
</div>
</form> 
<table id="dataTb" width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table">
  <tbody>
    <tr class="bg_tr" >
      <td width="90" height="23" align="center" >ID</td>
      <td width="100" align="center" >账号</td>
      <td align="center" >姓名</td>
      <td align="center" >状态</td>
	  <td align="center" >创建日间</td>
      <td align="center" >操作</td>
	  </tr>
	  <%php if () {%>

			<tr>
			  <td height="23" colspan="6" align="left" class="td_bg">没有找到相应的管理员！</td>
			</tr>
	  <%php } else {%>
	  <?php foreach($adminInfo as $k=>$d) {?>
    <tr  id="rowTR_<%$d.id%>">
      <td height="23" align="center" class="td_bg"><?php echo $d.id;?></td>
      <td align="center" class="td_bg"><?php echo $d.name;?></td>
      <td align="center" class="td_bg"><?php echo $d.real_name;?></td>
	  <td align="center" class="td_bg"><?php if ($d.state == 0) {?><font color="#FF0000">被锁定</font><?php } else {?>正常<?php }%></td>
	  <td align="center" class="td_bg"><?php echo date('Y-m-d H:i:s',$d.add_time);?> </td>
      <td align="left" class="td_bg">
      <a href="adminMgr.php?act=edit&id=<%$d.id%>" >编辑</a>&nbsp;&nbsp;&nbsp;
      <%if $d.state==0%>
      <a href="javascript:setAppState(<%$d.id%>,'解除锁定');" style="color:#F00;">解除锁定</a>&nbsp;&nbsp;&nbsp;
      <%else%>
	  <?php if($d.id != 1) {%><a href="javascript:setAppState(<%$d.id%>,'锁定');" style="color:#F00;">锁定</a>&nbsp;&nbsp;&nbsp;<?php } ?>
      <%/if%>
      </td>

      </tr>
	  <?php }?>
	  <?php if ($totalRow > $pageSize) {?>
    <tr>
      <td height="40" colspan="6" align="right" class="td_bg" style="padding-right:30px;">
			  <?php echo $pager;?>
      </td>
   </tr>
   <?php }?>
  </tbody>
</table>
</div>


</body>
</html>
