<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<HTML>
<HEAD>
<TITLE>添加角色</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<style>
body,td,input,textarea {font-size:9pt}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
</style>

</HEAD>
<BODY>
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p0000")
'''''''''''''''''''''''''''''''''''''''''''''''
%>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>
<%
dim id,act,adminname,PassWord,UserType,roleArr
act=request.QueryString("act")
id=Cint(request("id"))
if(act="mod") then	
	rolename=trim(request.Form("rolename"))
	privilege=request.Form("privilege")
	'添加到库
	set rs=server.createobject("adodb.recordset")
	rs.open "select * from role where rolename='"&rolename&"' and id<>"&id,conn,3,1
	if not rs.eof then
		response.Write("<script>alert(""该角色已存在!"");history.back();</script>")
		response.End()
	end if
	rs.close
	sql="select top 1 * from role where id="&id&" order by id desc "
	rs.open sql,conn,3,3	
	rs("rolename")=rolename
	rs("privilege")=privilege
	rs("moditime")=now	
	rs.update
	rs.close
	set rs=nothing
	response.Write("修改角色成功~!<p>")
	response.Write("<br><p><center><a href=role_manage.asp>返回</a></center>")
else
	set rs=server.createobject("adodb.recordset")
	sql="select top 1 rolename,privilege from role where id="&id&" order by id desc "
	rs.open sql,conn,3,1	
	if rs.eof or rs.bof then
		response.Write("没有找到ID为"&id&"的记录！")
		response.End()
	else
		roleArr=rs.GetRows()
	end if
	rs.close
	set rs=nothing
%>
<FORM method="POST" name="form1" action="role_mod.asp?act=mod" style="margin:0 0 0 0;">
  <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#666666">
<TR bgcolor="#FF9900">
  <TD height="24" colspan="2"><div align="center" class="style1">添加角色</div></TD>
  </TR>
<TR bgcolor="#F5F5F5">
  <TD width="14%"><div align="center">角色名称：</div></TD>
  <TD width="86%"><input name="rolename" type="text" id="rolename" size="30" value="<%=roleArr(0,0)%>"></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD><div align="center">角色权限：</div></TD>
  <TD><div align="left">
    <p>
     <input name="privilege" type="checkbox" id="privilege" value="p01" <%if instr(1,roleArr(1,0),"p01",1)<>0 then response.Write("checked") %>>
   类别管理   </p>
    <p>
    <input name="privilege" type="checkbox" id="privilege2" value="p02" <%if instr(1,roleArr(1,0),"p02",1)<>0 then response.Write("checked") %>>
 新闻管理</p>
    <p>
    <input name="privilege" type="checkbox" id="privilege3" value="p03" <%if instr(1,roleArr(1,0),"p03",1)<>0 then response.Write("checked") %>>
 模板管理</p>
    <p>
    <input name="privilege" type="checkbox" id="privilege4" value="p04" <%if instr(1,roleArr(1,0),"p04",1)<>0 then response.Write("checked") %>>
 标签管理</p>
    <p>
    <input name="privilege" type="checkbox" id="privilege5" value="p05" <%if instr(1,roleArr(1,0),"p05",1)<>0 then response.Write("checked") %>>
 发布站点</p>
    <p>
    <input name="privilege" type="checkbox" id="privilege6" value="p06" <%if instr(1,roleArr(1,0),"p06",1)<>0 then response.Write("checked") %>>
 管理员管理</p>
    <p>
    <input name="privilege" type="checkbox" id="privilege7" value="p07" <%if instr(1,roleArr(1,0),"p07",1)<>0 then response.Write("checked") %>>
 评论管理</p>
    <p>
    <input name="privilege" type="checkbox" id="privilege8" value="p08" <%if instr(1,roleArr(1,0),"p08",1)<>0 then response.Write("checked") %>>
 友情链接</p>
    <p>
      <input name="privilege" type="checkbox" id="privilege72" value="p09" <%if instr(1,roleArr(1,0),"p09",1)<>0 then response.Write("checked") %>>
 信息采集</p>
    <p>
      <input name="privilege" type="checkbox" id="privilege73" value="p10" <%if instr(1,roleArr(1,0),"p10",1)<>0 then response.Write("checked") %>>
 数据库管理</p>
    <p>
      <input name="privilege" type="checkbox" id="privilege74" value="p11" <%if instr(1,roleArr(1,0),"p11",1)<>0 then response.Write("checked") %>>
系统配置管理</p>
    <p>
      <input name="privilege" type="checkbox" id="privilege75" value="p12" <%if instr(1,roleArr(1,0),"p12",1)<>0 then response.Write("checked") %>>
日志管理</p>
    <p>
      <input name="privilege" type="checkbox" id="privilege9" value="p13" <%if instr(1,roleArr(1,0),"p13",1)<>0 then response.Write("checked") %>>
      投票管理
</p>
    <p>
      <input name="privilege" type="checkbox" id="privilege22" value="p14" <%if instr(1,roleArr(1,0),"p14",1)<>0 then response.Write("checked") %>>
      广告管理
</p>
    <p>
      <input name="privilege" type="checkbox" id="privilege222" value="p15" <%if instr(1,roleArr(1,0),"p15",1)<>0 then response.Write("checked") %>>
任务计划</p>
    <p>
      <input name="privilege" type="checkbox" id="privilege2222" value="p16" <%if instr(1,roleArr(1,0),"p16",1)<>0 then response.Write("checked") %>>
资源管理</p>
<p>
      <input name="privilege" type="checkbox" id="privilege21" value="p21" <%if instr(1,roleArr(1,0),"p21",1)<>0 then response.Write("checked") %>>
分类信息管理</p>
  </div></TD>
</TR>
<TR bgcolor="#F5F5F5">
	<TD align=right>&nbsp;	  </TD>
    <TD align=right><div align="left"> 
	<input type="hidden" name="id" value="<%=id%>">
        <input type=submit name=b1 value="提 交">&nbsp;&nbsp;
        <input type=reset name=b2 value="重 填">       
    </div></TD>
</TR>
</TABLE>
</FORM>
<%
end if
%>
</BODY>
</HTML>
<%
call connclose()
%>