<!--{template 'head'}-->
<script type="text/javascript">
function userPoint(ac, uid){
	qmeCms.dialogView.get("操作", "system.php?sys=user&action=view&ac="+ac+"&uid="+uid, {type:'abs'});
}
function searchForm(){
	var obj = $('search-form');
	var h = obj.offsetHeight;
	var timer;
	clearInterval(timer);
	var b=parseInt(obj.parentNode.style.height), c = b < 10 ? h-b : 0 - b;
	var d = 10,t=0,ttl=30;
	(function (me){
		clearInterval(timer);
		timer=setInterval(function (){
			var m = Math.ceil(Tweener.easeOutCubic(t,b,c,d)) ;
			obj.parentNode.style.height = m + 'px';
			if(t<d) t++; 
			else{
				clearInterval(timer);
				obj.parentNode.style.height = (c+b) + 'px';
			}
		},ttl)
	})(this);
};
setSubject("用户管理");
</script>
<table cellpadding="0" cellspacing="0" border="0" align=center class="tableborder" >
	<tr>
		<td class="tablerow"><b>管理选项：</b> <a href="system.php?sys=user&action=manage">用户管理</a> | <a href="###" onclick="searchForm();">高级搜索</a>  </td>
	</tr>
</table>
<!--{if $action=='manage' || $action=='search'}-->
<form method="get" action="system.php" style="height:0;overflow:hidden;">
<input type="hidden" name="sys" value="user" />
<input type="hidden" name="action" value="search" />
<table cellpadding="0" cellspacing="1" border="0" align="center" class="tableborder border" id="search-form">
	<tr>
		<td class="tablerowr" width="40%">用户名</td>
		<td class="tablerow"><input type="text" class="f-text" name="username" value="{$username}" /></td>
	</tr>
	<tr>
		<td class="tablerowr">Email</td>
		<td class="tablerow"><input type="text" class="f-text" name="email" value="{$email}" /></td>
	</tr>
	<tr>
		<td class="tablerowr">注册IP</td>
		<td class="tablerow"><input type="text" class="f-text" name="regip" value="{$regip}" /> <font color="blue"></font></td>
	</tr>
	<tr>
		<td class="tablerowr">点数</td>
		<td class="tablerow"><select name="point_type"><option value="0"<!--{if $point_type == 0}--> selected<!--{/if}-->>大于</option><option value="1"<!--{if $point_type == 1}--> selected<!--{/if}-->>等于</option><option value="2" <!--{if $point_type == 2}--> selected<!--{/if}-->>小于</option></select><input type="text" class="f-text" name="point" value="{$point}" /></td>
	</tr>
	<tr>
		<td class="tablerowr"><label for="for-unallowed">被禁止登录</label></td>
		<td class="tablerow"><input type="checkbox" id="for-unallowed" name="unallowed" value="1" <!--{if $unallowed}--> checked<!--{/if}--> /></td>
	</tr>
	<tr>
		<td class="tablerowr">选择用户组</td>
		<td class="tablerow">
			<select name="gid">
				<option value="0">选择用户组</option>
				<!--{loop $usergroup $val}--><option value="{$val['gid']}"<!--{if $val['gid'] == $gid}--> selected<!--{/if}-->>{$val['gname']}</option><!--{/loop}-->
			</select>
		</td>
	</tr>
	<tr>
		<td class="tablerowr"></td>
		<td class="tablerow">
			<input type="submit" class="f-button" value=" 搜索会员 " />
		</td>
	</tr>
</table>
</form>
<form method="post" name="myform">
<table cellpadding="0" cellspacing="0" class="tableborder mt5" id="mytable">
	<tr>
		<th colspan=8>用户管理</th>
	</tr>
	<tr align=center>
		<td width="30" class="tablerowhighlight"></td>
		<td width="80" class="tablerowhighlight">UID</td>
		<td class="tablerowhighlight">用户名</td>
		<td width="120" class="tablerowhighlight">用户组</td>
		<td width="80" class="tablerowhighlight">可用点数</td>
		<td width="250" class="tablerowhighlight">邮箱</td>
		<td width="60" class="tablerowhighlight">状态</td>
		<td width="160" class="tablerowhighlight">最后登录</td>
	</tr>
	<!--{if $data}-->
		<!--{loop $data $list}-->
		<tr class="item" id="item-{$list['uid']}">
			<td class="tablerowl"><input name='ids[]' type='checkbox' id='ids_{$list[uid]}' value='{$list[uid]}' onclick="try{event.cancelBubble=true;}catch(e){event.stopPropagation();}"/></td>
			<td align="center">{$list['uid']}</td>
			<td style="padding-left:15px;">{$list['username']}</td>
			<td style="text-align:center;cursor:pointer" onclick="userPoint('group', {$list['uid']});">{$usergroup[$list['gid']]['gname']}</td>
			<td style="text-align:center;cursor:pointer" onclick="userPoint('point', {$list['uid']});">{$list['point']}点</td>
			<td style="padding-left:5px;">{$list['email']} <!--{if $list['email_verify']}--><font color="blue">已验证</font><!--{else}-->未验证<!--{/if}--></td>
			<td style="text-align:center;cursor:pointer" onclick="userPoint('unallowed', {$list['uid']});"><!--{if $list['unallowed']}--><font color="blue">被禁止</font><!--{else}-->正常<!--{/if}--></td>
			<td style="text-align:center"><!--{echo qbase::formatTime('Y-m-d', $list['logintime'])}--> / <!--{echo long2ip($list['loginip'])}--></td>
		</tr>
		<!--{/loop}-->
	<!--{else}-->
	<tr>
		<td colspan=8 class="tablerow"><p style="text-align:center;padding:15px;">没有找到相关会员</p></td>
	</tr>
	<!--{/if}-->
	<tr>
		<td class="tablerowl" style="height:30px;">
			<input name='chkall' type='checkbox' id='chkall' onclick='checkall(this.form)' value='checkbox'>
		</td>
		<td colspan=7 class="tablerow">
			<input type="submit" class="f-button" value="禁止登录" onClick="if(makeSure()){document.myform.action='system.php?sys=user&action=update&ac=unallowed&pageno={$pageno}'}else {return false}" />
			<input type="submit" class="f-button" value="解除禁止" onClick="if(makeSure()){document.myform.action='system.php?sys=user&action=update&ac=allowed&pageno={$pageno}'}else {return false}" />
			<input type="submit" class="f-button" value="删除用户" onClick="if(makeSure()){document.myform.action='system.php?sys=user&action=update&ac=delete&pageno={$pageno}' }else {return false}" />
			<input type="submit" class="f-button" value="转移到&gt;&gt;" onClick="if(makeSure()){document.myform.action='system.php?sys=user&action=update&ac=move&pageno={$pageno}' }else {return false}" />
			<select name="to_gid">
			<option value="0">选择用户组</option>
			<!--{loop $usergroup $val}--><option value="{$val['gid']}">{$val['gname']}</option><!--{/loop}-->
			</select>
		</td>
	</tr>
	<tr>
		<td class="tablerowl" style="height:30px;"></td>
		<td colspan=8 class="tablerow" align="right">
			<!--{eval new Pager($total,$limit);}-->
		</td>
	</tr>
</table>
</form>

<script type="text/javascript">
function userModify(ac, uid){
	if(!makeSure()) return false;
	AJAX.request( 'system.php?sys=user&action=update&ac='+ac,{
		method	: 'post',
		parameters 	: 'ids='+uid,
		onComplete	: function(resp){
			rm.Close();
			var json = evaljson(resp);
			if(json.status == 200){
				alert("操作成功");
			}else{
				alert(json.message);
			}
			window.location.replace(window.location.href);
		}
	});
}
function userPoint(ac, uid){
	qmeCms.dialogView.get("操作", "system.php?sys=user&action=view&ac="+ac+"&uid="+uid, {type:'abs'});
}
var rm = new qmeCms.rightMenu('mytable');
rm.AddItem("禁止登录","userModify('unallowed', rm.id);");
rm.AddItem("解除禁止","userModify('allowed', rm.id);");
rm.AddLine();
rm.AddItem("删除用户","userModify('delete', rm.id);");
rm.AddLine();
rm.AddItem("修改点数","userPoint('point', rm.id);");
rm.AddItem("更换用户组","userPoint('group', rm.id);");
domReady(function(){
	rm.Setup();
});
<!--{if $action == 'search'}-->searchForm();<!--{/if}-->
</script>
<!--{/if}-->
<!--{template 'foot'}-->