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

📄 moduleuser_levelconfig.asp

📁 ASP程序实现的科技期刊系统
💻 ASP
字号:
<%if session("IPno")="no" then Response.Redirect "../Messagebox/error.asp?info=您无浏览此页的权限!!"%>

<!--#include file="../include/adoconn.asp"-->
<!--#include file="../Include/online.asp"-->
<%	
	dim objres         'recordset对象
	dim strsql         'sql语句
	
		'读出所有一级模块
	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
	UserCode=request("UserCode")
	strsqldel="delete from XT_TP_ModuleUser where 用户编码='"& UserCode &"'"
	conn.Execute strsqldel
	
	for each item in Request.Form("checkbox1")
		strsqldel="insert into  XT_TP_ModuleUser (用户编码,模块编码) values('" & UserCode & "','" & item & "')"
		conn.Execute strsqldel,1
	next
end if

%>

<%
if Request("Usersubmit")="Usersubmit"  then '用户有变化
	UserCode=request("usercodetext")
'判断是否有此用户
		dim objres11        'recordset对象
		dim strsql11        'sql语句
		dim error
		error=""
		set objres11=server.CreateObject ("adodb.recordset")
		objres11.CursorType =3
		objres11.CursorLocation =3
		objres11.LockType =2
		strsql11="select 用户编码 from XT_TC_User where 用户编码='"& UserCode &"'"
		objres11.Open strsql11,strconn
		if objres11.eof then 
		error="无此用户编码,请重新输入!"
		Response.Redirect "ModuleUser_LevelConfig.asp?error="&error
		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()">
  <div align="center"> 

<%

		
		
	if not UserCode=""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_ModuleUser where 用户编码='"& UserCode &"'"
		objres10.Open strsql10,strconn
		
		
		if objres10.RecordCount >0 then
			Response.Write "<script language='vbscript'>"&chr(13)
			Response.Write "dim Usermodule("& (objres10.RecordCount-1)  &")"& chr(13)
			for i=0 to  objres10.RecordCount -1
				Response.Write "Usermodule(" & 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

%>
    
  <table style="font-size:9pt" width="100%" border="0" cellspacing="0" cellpadding="0">
    <form name="User" method="post" action="ModuleUser_LevelConfig.asp?Usersubmit=Usersubmit" >
      <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"><font color=red>
         <%Response.Write Request.QueryString("error")%>
        <%if request("modulesubmit")="modulesubmit"then   Response.Write "该用户的模块配置已经提交成功!"        %>
        </font>
        </td> 
        <td height="20" width="170">&nbsp;</td>
      </tr>
      <tr> 
        <td colspan="3" height="20"> 
          
          <div align="center">请输入用户编码
            <input type="text" name="UserCodeText" maxlength="6" size="6" value=<%=request("usercodetext")%>  >
			<input type="submit" name="SubmitUserCode" value="提交" onclick="return checkfun()" class="button">
          </div>
        </td>
      </tr>
	  </form>
    </table>
    
  <%if Request("Usersubmit")="Usersubmit" and not UserCode="" then%><form name="module" method="post" action="ModuleUser_LevelConfig.asp?modulesubmit=modulesubmit&UserCode=<%=UserCode%>"> 
  <%else%>
  <form name="module" method="post" action="">
     <%end if%>
    <table style="font-size:9pt" 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 width="200" bgcolor="#336699"> <font color="#DFF4FD">二级模块:<br>
          模块编码,模块名称</font></td>
        <td width="200" bgcolor="#336699"> <font color="#BFD3F4">三级模块:<br>
          模块编码,模块名称</font></td>
        <td width="200" bgcolor="#336699"> <font color="#BFD3F4">四级模块:<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 colspan="3"> 
          <%
				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 style="font-size:9pt"width="600" 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 style="font-size:9pt" width="400" 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 style="font-size:9pt" width="200" 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="4"> 
          <div align="center"> 
            <input type="submit" name="Submit" value="提交设置" class="button">
            <input type="reset" name="Submit2" value="重置" class="button">
          </div>
        </td>
      </tr>
    </table>
  </form>
  </div>

</body>
</html>

<script language="vbscript">
	function Userchange()   '选择用户
		document.User.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(Usermodule) to ubound(Usermodule)
				for j=0 to document.module("checkbox1").length -1
					if clng( document.module("checkbox1")(j).value)=Usermodule(i) then document.module("checkbox1")(j).checked=true 
				next
			next
		end if
   	end function

	function checkfun()   '校验表单
		checkfun=true
		if User.usercodetext.value ="" then 
			checkfun=false
			window.alert "输入有误,请输入需配置的用户编码!"
			exit function
		end if

	end function
</script>

⌨️ 快捷键说明

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