<!--{template 'head'}-->
<script LANGUAGE="javascript">
function Check() {
	if (document.myform.username.value==""){
		alert("请输入帐号")
		document.myform.username.focus()
		return false
	}
}
setSubject("管理员管理");
</script>

<!--{if $action=='manage' and $file=='admin'}-->
<table cellpadding="0" cellspacing="0" border="0" align=center class="tableborder" >
	<tr>
		<td class="tablerow"><b>管理选项：</b>
			<a href="system.php?sys=member&file=admin&action=manage"><!--{if $action=='manage'}--><font color=red>管理员管理</font><!--{else}-->管理员管理<!--{/if}--></a> | 
			<a href="system.php?sys=member&file=admin&action=adminadd"><!--{if $action=='adminadd'}--><font color=red>添加管理员</font><!--{else}-->添加管理员<!--{/if}--></a>
		</td>
	</tr>
	<tr>
		<td class="tablerow">
			<b>管理员组：</b>
			<a href="system.php?sys=member&action=manage&file=admin"<!--{if $groupid == 0}-->style="color:red"<!--{/if}-->>所有</a><!--{loop $groups $key $val}-->
				<span style="color:#999;margin:0 6px;font-size:10px;">|</span><a href="system.php?sys=member&action=manage&file=admin&groupid={$key}"<!--{if $groupid == $key}-->style="color:red"<!--{/if}-->>{$val}</a>
			<!--{/loop}-->
		</td>
	</tr>
</table>
<form method="post" name="myform">
<table cellpadding="0" cellspacing="1" class="tableborder border mt5">
	<tr align=center>
		<td width="5%" class="tablerowhighlight">ID</td>
		<td width="10%" class="tablerowhighlight">帐号</td>
		<td width="10%" class="tablerowhighlight">等级</td>
		<td width="15%" class="tablerowhighlight">最后登录时间</td>
		<td width="10%" class="tablerowhighlight">最后登录IP</td>
		<td width="24%" class="tablerowhighlight">管理操作</td>
	</tr>
<!--{if $members}-->
<!--{loop $members $member}-->
<tr height=30 align=center class="item" id="item-{$member[uid]}">
	<td class=tablerow>{$member[uid]}</td>
	<td class=tablerow>{$member[username]}</td>
	<td class=tablerow><a href="system.php?sys=member&file=admin&action=manage&groupid={$member[groupid]}">{$member[groupname]}</a></td>
	<td class=tablerow>{$member[lastlogintime]}</td>
	<td  class=tablerow>{$member[lastloginip]}</td>
	<td class=tablerow align=center>
	<!--{if $member['groupid'] > 1}-->
		<a href='system.php?sys=member&file=admin&action=adminedit&uid={$member[uid]}'>修改权限</a> | 
		<a href='system.php?sys=member&file=admin&action=del&uid={$member[uid]}' onclick="return makeSure();">删除</a>
	<!--{else}-->
		不允许操作
	<!--{/if}-->
	</td>
</tr>
<!--{/loop}-->
<!--{else}-->
<tr height=30 align=center class="item">
	<td colspan=9>
		<p style="padding:25px;">没有找到相关数据</p>
	</td>
</tr>
<!--{/if}-->
</table>
</form>
<!--{/if}-->

<!--{if ($action=='adminadd' || $action=='adminedit') and $file=='admin'}-->
<script type="text/javascript">
function CheckAdmin() {
	if (document.myform.adminname.value==""){
		alert("请输入帐号")
		document.myform.adminname.focus()
		return false
	}
	var obj = document.getElementsByTagName("INPUT");
	for( var i=0; i<obj.length; i++){
		if( obj[i].type.toLowerCase() == 'checkbox' && obj[i].checked == true && obj[i].disabled == false){
			val = obj[i].value;
			arr_t = val.split("-");	
			if( arr_t[1]){
				arr   = arr_t[1].split(",");
				for( var j=1; j<arr.length; j++){
					$('ids_'+arr[j]).disabled = true ;
				}
			}
		}
	}
	$('submit').disabled = true;
}
function changeChannelPurview(channelid, channeldir){
	setTimeout(function(){
		if($('channel_acc_'+channelid).checked == false){
			$('channel_'+channelid).checked = false;
			$('category_'+channelid).checked = false;
			$('pp_'+channeldir).style.display = 'none';
		}
	}, 100);
	return true;
}
</script>
<table cellpadding="2" cellspacing="1" border="0" align=center class="tableborder" >
	<tr>
		<td class="tablerow"><b>管理选项：</b>
			<a href="system.php?sys=member&file=admin&action=manage"><!--{if $action=='manage'}--><font color=red>管理员管理</font><!--{else}-->管理员管理<!--{/if}--></a> | 
			<a href="system.php?sys=member&file=admin&action=adminadd"><!--{if $action=='adminadd'}--><font color=red>添加管理员</font><!--{else}-->添加管理员<!--{/if}--></a>
		</td>
	</tr>
</table>
<form method="post" name="myform" onsubmit="return CheckAdmin();" action="system.php?sys=member&file=admin&action={$action}">
<table cellpadding="2" cellspacing="1" class="tableborder">
	<tr>
		<th colspan=2>添加管理员</th>
	</tr>
	<tr>
		<td class="tablerowl" align="right" width="10%">后台登录帐号</td>
		<td class="tablerow"><input name="adminname" type="text" id="adminname" <!--{if $action == 'adminedit'}-->readonly class="readonly f-text"<!--{else}-->class="f-text"<!--{/if}--> size="20"></td>
	</tr>
	<tr>
		<td class="tablerowl" align="right" width="10%">后台登录密码</td>
		<td class="tablerow">
		<input name="adminpassword" type="text" class="f-text"  id="adminpassword" size="20">&nbsp;
			<!--{if $action == 'adminedit'}--><font color=green>不修改则留空&nbsp;&nbsp;<!--{/if}-->(后台登陆密码,与前台登录无关)</font></td>
	</tr>
	<tr>
		<td class="tablerowl"  align="right">全局权限</td>
		<td class="tablerow" >
			<input name='adminid' type='radio' value='2' onClick="$('purviewdetail').style.display='none'" id="adminid_2" ><label for="adminid_2">普通管理员</label> <font color=green>管理权限请看说明</font><br>
			<input name='adminid' type='radio' value='3' checked onClick="$('purviewdetail').style.display=''" id="adminid_3" ><label for="adminid_3">具体项目管理员</label><br>
		</td>
	</tr>
	<tr id="purviewdetail" style='display:'>
		<td class="tablerowl"  align="right">具体权限</td>
		<td class="tablerow">
		<!--{loop $channellists $channellist}-->
			<fieldset style="margin:10px 0">
				<legend>【<font color='green'>{$channellist[channelname]}频道</font>】管理权限</legend>
				<table width='100%' >
					<tr>
						<td width='90%'>
							<input type='checkbox' onclick="changeChannelPurview({$channellist[channelid]}, '{$channellist[channeldir]}');" name='manage_channelid[]' id="channel_acc_{$channellist[channelid]}" value='{$channellist[channelid]}' />
							<label for="channel_acc_{$channellist[channelid]}"><font color=green>如要在此频道下添加，请点击，否则操作无效(也就是说:要在此频道添加管理员,你必须点它)</font></label>
						</td>
					</tr>
					<tr>
						<td width='90%'>
							<input type='radio' name='purview_{$channellist[channelid]}' value='1' id="channel_{$channellist[channelid]}" onclick="$('pp_{$channellist[channeldir]}').style.display='none';" />
							<label for="channel_{$channellist[channelid]}">频道管理员：拥有此频道下所有栏目的管理权限，并可添加，删除栏目和专题,以及发布本频道公告</label>
						</td>
					</tr>
					<tr>
						<td width='90%'>
							<input type='radio' name='purview_{$channellist[channelid]}' value='2' id="category_{$channellist[channelid]}" onclick="$('pp_{$channellist[channeldir]}').style.display='';" />
							<label for="category_{$channellist[channelid]}">栏目管理员：只拥有本栏目{$channellist[channeltitle]}以及评论管理权限</label>
						</td>
					</tr>
					<tr id='pp_{$channellist[channeldir]}' style='display:none'>
						<td  valign="top">
							<table width='100%' valign="top">
								<tr>
									<td valign=top width="600" class="tablerow" valign="top">
										<!--{eval memebrmanage($channellist[channelid]);}-->
									</td>
									<td>
										<strong><font color='#0000FF'>注意</font></strong> 栏目权限采用继承制度，即在某一栏目拥有某项管理权限，则在此栏目的所有子栏目中都拥有这项管理权限
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</fieldset>
		<!--{/loop}-->
			<fieldset style="margin:10px 0">
				<legend>【<font color='green'>系统扩展</font>】管理权限</legend>
				<table width='100%' >		
					<tr>
						<td class="tablerow" >
						<!--{loop $plugin $val}-->
							<input type="checkbox" name="manage_other[]" value="{$val['name']}" id="plugin_{$val['name']}" /><label for="plugin_{$val['name']}">{$val['data']['name']}</label>
						<!--{/loop}-->
						<input type="checkbox" name="manage_other[]" value="explorer" id="plugin_explorer" /><label for="plugin_explorer">模板</label>
						<input type="checkbox" name="manage_other[]" value="files" id="plugin_files" /><label for="plugin_files">附件</label>
						</td>
					</tr>	
				</table>
			</fieldset>					
		</td>
	</tr>
	<tr>
		<td class="tablerowl" colspan=2>
			<input name="insert" value='1' type="hidden" />
			<input type=hidden name=uid value="{$uid}" />
			<input type="submit" name="submit" value=" 确定 " id='submit' class="f-button" />
		</td>
	</tr>
</table>
</form>
	<!--{if $action == 'adminedit'}-->
		<script type="text/javascript">
		function returnArray( str, pre){
			if( str){
				var arr = new Array();
				arr = str.split(",");
				for( var i=0; i<arr.length; i++){
					$(pre+arr[i]).checked = true;
					try{
						if(typeof $(pre+arr[i]).onclick == 'function') $(pre+arr[i]).onclick();
					}catch(e){};
				}
			}
		}
		var groupid = {$info['groupid']};
		if( groupid < 4 ) selectChecked('adminid_3', groupid);
		selectChecked('adminname', '{$info['username']}');
		if( groupid == 1 || groupid == 2){
			$('purviewdetail').style.display='none';
		}else if( groupid == 3){
			returnArray( "{$info[manage_acc_channel]}", "channel_acc_");
			returnArray( "{$info[manage_acc_channel]}", "category_");
			returnArray( "{$info[manage_channel]}", "channel_");
		}else if( groupid == 4){
			returnArray( "{$info[manage_acc_channel]}", "channel_acc_");
			returnArray( "{$info[manage_acc_channel]}", "category_");
		}
		returnArray( "{$info[manage_category]}", "ids_");
		<!--{loop $info['manage_plugin'] $val}-->
		if($('plugin_{$val}') != null) $('plugin_{$val}').checked = true;
		<!--{/loop}-->
		</script>
	<!--{/if}-->
<!--{/if}-->

<!--{if $action=='password' and $file=='admin'}-->
<table cellpadding="2" cellspacing="1" class="tableborder">
<tr>
<th colspan=2>修改密码</th>
</tr>
<form method="post" name="myform" action="system.php?sys=member&file=admin&action=password">
<tr>
<td class="tablerowl" width="30%">当前密码</td>
<td class="tablerow" ><input name="oldpassword" type="password" class="f-text" id="oldpassword" size="30"></td>
</tr>
<tr>
<td class="tablerowl">新密码</td>
<td class="tablerow" ><input name="password" type="password" class="f-text"  id="password" size="30"></td>
</tr>
<tr>
<td class="tablerowl">确认新密码</td>
<td class="tablerow" ><input name="pwdconfirm" type="password" class="f-text"  id="pwdconfirm" size="30"></td>
</tr>
<tr>
<td class="tablerowl"></td>
<td class="tablerowl" style="text-align:left;"><input type="hidden" name="go" value="1"><input type="submit" class="f-button" name="submit" value=" 确定 "></td>
</tr>
</form>
</table>
<!--{/if}-->
<!--{template 'foot'}-->
