⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modulerole_levelconfig.asp

📁 ASP程序实现的科技期刊系统
💻 ASP
字号:
<!--#include file="../Include/TimeOut.asp"-->
<%modulecode="0104"%>
<!--#include file="../Include/ModuleUserCheck.asp"-->
<!--#include file="../Include/online.asp"-->
<%if session("IPno")="no" then Response.Redirect "../Messagebox/error.asp?info=您无浏览此页的权限!!"%>
<%	
	dim objres         'recordset对象
	dim strsql         'sql语句
	strsql="select * from XT_TC_Role where 有效标志='1'"    '读出所有角色
	set objres=server.CreateObject ("adodb.recordset")
	objres.CursorType =3
	objres.CursorLocation =3
	objres.LockType =2
	objres.Open strsql,strconn
	
		'读出所有一级模块
	dim objres1         'recordset对象
	dim strsql1         'sql语句
	strsql1="select 模块编码 ,模块名称 from XT_TC_Module where 有效标志='1' and len(模块编码)=2"    
	set objres1=server.CreateObject ("adodb.recordset")
	objres1.CursorType =3
	objres1.CursorLocation =3
	objres1.LockType =2
	objres1.Open strsql1,strconn
	
		'读出所有二级模块
	dim objres2         'recordset对象
	dim strsql2         'sql语句
	set objres2=server.CreateObject ("adodb.recordset")
	objres2.CursorType =3
	objres2.CursorLocation =3
	objres2.LockType =2
		
		'读出所有三级模块
	dim objres3        'recordset对象
	dim strsql3         'sql语句
	set objres3=server.CreateObject ("adodb.recordset")
	objres3.CursorType =3
	objres3.CursorLocation =3
	objres3.LockType =2
		
		'读出所有四级模块
	dim objres4        'recordset对象
	dim strsql4         'sql语句
	set objres4=server.CreateObject ("adodb.recordset")
	objres4.CursorType =3
	objres4.CursorLocation =3
	objres4.LockType =2
	
	dim intindex '所有复选框的索引标识
	intindex=0

if request("modulesubmit")="modulesubmit"then    '修改角色的模块
	dim objresdel      'recordset对象
	dim strsqldel       'sql语句
	set objresdel=server.CreateObject ("adodb.recordset")
	objresdel.CursorType =3
	objresdel.CursorLocation =3
	objresdel.LockType =2
	rolecode=request("rolecode")
	strsqldel="delete from XT_TP_ModuleRole where 角色编码='"& rolecode &"'"
	conn.Execute strsqldel
	for each item in Request.Form("checkbox1")
		strsqldel="insert into  XT_TP_ModuleRole (角色编码,模块编码) values('" & rolecode & "','" & item & "')"
		conn.Execute strsqldel,1
	next
end if
	
	

%>
<html>

<head>
<title>系统配置</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../CssLib/Cssbutton.css">
<style>
td{font-size:9pt}
</style>
</head>

<body bgcolor="#FFFFFF" text="#000000"onload="check()">
<%
if Request("rolesubmit")="rolesubmit"  then '角色有变化
	rolecode=request("select")
	if not rolecode="norole"then   '选择了角色
			'读角色的模块
		dim objres10        'recordset对象
		dim strsql10        'sql语句
		set objres10=server.CreateObject ("adodb.recordset")
		objres10.CursorType =3
		objres10.CursorLocation =3
		objres10.LockType =2
		strsql10="select 模块编码 from XT_TP_ModuleRole where 角色编码='"& rolecode &"'"
		objres10.Open strsql10,strconn
		
		
		if objres10.RecordCount >0 then
			Response.Write "<script language='vbscript'>"&chr(13)
			Response.Write "dim rolemodule("& (objres10.RecordCount-1)  &")"& chr(13)
			for i=0 to  objres10.RecordCount -1
				Response.Write "rolemodule(" & i & ")=" & objres10.Fields("模块编码").Value  & chr(13)
				objres10.MoveNext 
			next
			Response.Write "dim biaoshi"&chr(13)
			Response.Write "biaoshi=1"&chr(13) '标示读了角色
			Response.Write "</script>"
		end if

	end if
end if

%>

  <div align="center"> 
    
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <form name="role" method="post" action="Modulerole_LevelConfig.asp?rolesubmit=rolesubmit">
      <tr> 
        <td background="../public/images/config_bg.gif" height="20" width="180"> 
          <div align="center"><font size="3" color="#003399"></font></div>
        </td>
        <td width="250" height="20"> 
          <div align="center"><font size="3" color="#003399"><b>角 色 与 模 块 配 置</b></font></div>
        </td>
        <td background="../public/images/config_bg.gif" height="20" width="170">&nbsp;</td>
      </tr>
      <tr> 
        <td height="20" width="180">&nbsp;</td>
        <td width="250" height="20" align="center">
        <%if request("modulesubmit")="modulesubmit"then   Response.Write "该角色的模块配置已经提交成功!"        %>
        </td>
        <td height="20" width="170">&nbsp;</td>
      </tr>
      <tr> 
        <td colspan="3" height="20"> 
          
        <div align="center"> 
          
            <select name="select"onchange="rolechange()">
			<%if  not Request("rolesubmit")="rolesubmit" then '直接进入 %>
				<option value="norole" selected>    ** 请选择角色 **    </option>
				<%for i=1 to objres.RecordCount %>
				<option value="<%=objres.Fields("角色编码").Value %>" ><%=objres.Fields("角色名称").Value %></option>
				<%objres.MoveNext 
				next	
				else '角色有变化%>
					<option value="norole" >    ** 请选择角色 **    </option>
					<%for i=1 to objres.RecordCount %>
					<option value="<%=objres.Fields("角色编码").Value %>"
					<%if objres.Fields("角色编码").Value=Request("select") then Response.Write "selected" %>>
					<%=objres.Fields("角色名称").Value %></option>
					<%objres.MoveNext 
					next
             end if%>
            </select>
        </div>
        </td>
      </tr>
	  </form>
    </table>
    <%if Request("rolesubmit")="rolesubmit" and not rolecode="norole" then%>
    <form name="module" method="post" action="Modulerole_LevelConfig.asp?modulesubmit=modulesubmit&rolecode=<%=rolecode%>">
    <%else%>
     <form name="module" method="post" action="">
     <%end if%>
    <table width="100%" border="0" cellspacing="1" cellpadding="0" bordercolor="0" bgcolor="#FFFFFF">
      <tr> 
        <td width="200" height="20" bgcolor="#336699"> <font color="#FFFFFF">一级模块:<br>
          模块编码,模块名称</font></td>
        <td bgcolor="#336699"> <font color="#DFF4FD">二级模块:<br>
          模块编码,模块名称</font></td>
      </tr>
      <%for i=0 to objres1.RecordCount -1 '一级模块%>
      <tr> 
        <td valign=top width="200" > 
          <input type="checkbox" name="checkbox1" value="<%=objres1.Fields("模块编码").Value %>"onclick="click1('<%=objres1.Fields("模块编码").Value %>',<%=intindex%>)">
          <%intindex=intindex+1
           Response.Write  objres1.Fields("模块编码").Value
          Response.write objres1.Fields("模块名称").Value %>
        </td>
        <td> 
          <%
				strsql2="select 模块编码 ,模块名称 from XT_TC_Module where 有效标志='1' and len(模块编码)=4 and left(模块编码,2)='"&objres1.Fields("模块编码").Value &"'"    '读出所有二级模块
				objres2.Open strsql2,strconn
				if objres2.RecordCount >0 then    '有二级模块%>
          <table width="100%" border="0" cellspacing="1" cellpadding="0" bordercolor="0" bgcolor="#FFFFFF">
            <% for j=0 to objres2.RecordCount -1%>
            <tr> 
              <td width="200" valign=top > 
                <input type="checkbox" name="checkbox1" value="<%=objres2.Fields("模块编码").Value %>"onclick="click1('<%=objres2.Fields("模块编码").Value %>',<%=intindex%>)">
                <% intindex=intindex+1
								Response.Write  objres2.Fields("模块编码").Value
								Response.write objres2.Fields("模块名称").Value %>
              </td>
              <td colspan="2"> 
                <%
								strsql3="select 模块编码 ,模块名称 from XT_TC_Module where 有效标志='1' and len(模块编码)=6 and left(模块编码,4)='"&objres2.Fields("模块编码").Value &"'"    '读出所有三级模块
								objres3.Open strsql3,strconn	
								if objres3.RecordCount >0 then    '有三级模块%>
                <table width="100%" border="0" cellspacing="1" cellpadding="0" bordercolor="0" bgcolor="#FFFFFF">
                  <% for k=0 to objres3.RecordCount -1%>
                  <tr> 
                    <td width="200" valign=top> 
                      <input type="checkbox" name="checkbox1" value="<%=objres3.Fields("模块编码").Value %>"onclick="click1('<%=objres3.Fields("模块编码").Value %>',<%=intindex%>)">
                      <%intindex=intindex+1
												 Response.Write  objres3.Fields("模块编码").Value
												Response.write objres3.Fields("模块名称").Value %>
                    </td>
                    <td> 
                      <%
												strsql4="select 模块编码 ,模块名称 from XT_TC_Module where 有效标志='1' and len(模块编码)=8 and left(模块编码,6)='"&objres3.Fields("模块编码").Value &"'"    '读出所有三级模块
												objres4.Open strsql4,strconn	
												if objres4.RecordCount >0 then    '有三级模块%>
                      <table width="100%" border="0" cellspacing="1" cellpadding="0" bordercolor="0" bgcolor="#FFFFFF">
                        <% for l=0 to objres4.RecordCount -1%>
                        <tr> 
                          <td width="200" valign=top> 
                            <input type="checkbox" name="checkbox1" value="<%=objres4.Fields("模块编码").Value %>"onclick="click1('<%=objres4.Fields("模块编码").Value %>',<%=intindex%>)">
                            <%intindex=intindex+1
																	 Response.Write  objres4.Fields("模块编码").Value
																	Response.write objres4.Fields("模块名称").Value %>
                          </td>
                        </tr>
                        <%objres4.MoveNext 
														next%>
                      </table>
                      <%end if%>
                    </td>
                  </tr>
                  <%objres4.Close 
									objres3.MoveNext 
									next%>
                </table>
                <%end if%>
              </td>
            </tr>
            <% objres3.Close 
					objres2.MoveNext 
					 next%>
          </table>
          <%end if
				%>
        </td>
      </tr>
      <%
       objres2.Close 
       objres1.MoveNext 
       next
       %>
      <tr> 
        <td colspan="2"> 
          <div align="center"> 
            <%if  not rolecode="" then%>
            <input type="submit" name="Submit" value="提交">
            <%end if%>
          </div>
        </td>
      </tr>
    </table>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
  </form>
  </div>

</body>
</html>

<script language="vbscript">
	function rolechange()   '选择角色
		document.role.submit()
	end function
	function setdown(str1)   '下级设定
		for i=0 to document.module("checkbox1").length -1
			if left(document.module("checkbox1")(i).value,len(trim(str1)))=str1 then document.module("checkbox1")(i).checked=true
		next
	end function
	function unsetdown(str1)   '下级反设定
		for i=0 to document.module("checkbox1").length -1
			if left(document.module("checkbox1")(i).value,len(trim(str1)))=str1 then document.module("checkbox1")(i).checked=false
		next
	end function
	function dealwithup(str1)  '处理上一级事件
				'找到上级对象,将其置为false
		for i=0 to document.module("checkbox1").length -1
			if document.module("checkbox1")(i).value=left(str1,len(trim(str1))-2) then 
				document.module("checkbox1")(i).checked=false
				indexup=i    '记录上级对象
			end if			
		next
				'决定是否置为true
		for i=0 to document.module("checkbox1").length -1
			if len(document.module("checkbox1")(i).value)=len(str1) and left(document.module("checkbox1")(i).value,len(trim(str1))-2) and document.module("checkbox1")(i).checked then
				document.module("checkbox1")(indexup).checked=true
			end if
		next
	end function
	function click1(str1,int1)    '点击事件
		if len(str1)<8 then '有下级
			if document.module("checkbox1")(int1).checked  then setdown(str1) else unsetdown(str1)
		end if
		if len(trim(str1))>2 then
			str2=str1   '避免互相影响,另赋一值
			for i=1 to len(trim(str1))/2-1
				dealwithup(str2)   '处理一级上级
				str2=left(str2,len(trim(str2))-2)
			next
		end if
	end function
	function check()    '已有的模块勾上
		if  biaoshi=1 then
			for i=lbound(rolemodule) to ubound(rolemodule)
				for j=0 to document.module("checkbox1").length -1
					if  clng(document.module("checkbox1")(j).value)=rolemodule(i) then document.module("checkbox1")(j).checked=true 
				next
			next
		end if
	end function
</script>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -