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

📄 czqx_edit.asp

📁 OFFICE办公自动化
💻 ASP
字号:
<%
'功能:编辑权限
'作者:展亮
'日期:2003-12-2 12:00
'参数:	request.form("subed")="true"#表单提交; request("id")#要编辑记录的ID;
%>

<!--#include file="../inc/Secure.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/Const.asp"-->

<%
'response.buffer=false
'------------------------------------------------设置参数
LoginID=trim(session("LoginID")) : if LoginID="" then LoginID=0 '当前用户ID
currentpage=request("page") : if currentpage="" then currentpage=1 '当前页码
Search=request("Search") '上次查询条件
pid=request("id") '记录ID
'------------------------------------------------
'------------------------------------------------修改记录
table="tbioaRoleRights" '表名
if request.form("subed")="add" then 
'表单提交后

	'接受录入参数
	input_number=Request.Form("input_number")'编号
	input_title=Request.Form("input_title")'权限名
	input_filename=Request.Form("input_filename")'菜单路径


	'添加时使用的字段
	field1=array("number","title","filename","TypeNumber")
	value1=array(input_number,input_title,input_filename,pid)
	
	for i=0 to ubound(field1)
		value1(i)=replace(value1(i),"'","''")
	next
	sql = "INSERT INTO " & table & " (" & Join(field1, ",") & ") VALUES ('" & Join(value1, "','") & "')"
	oConn.Execute sql
end if

if request.form("subed")="修改" then 
'表单提交后

	'接受录入参数
	input_number=Request.Form("input_number")'编号
	input_title=Request.Form("input_title")'权限名
	input_filename=Request.Form("input_filename")'菜单路径
	input_mod=Request.Form("input_mod")'使用状态


	'添加时使用的字段
	field1=array("title","filename","mod")
	value1=array(input_title,input_filename,input_mod)
	
	sql="UPDATE " & table & " SET "
	for i=0 to ubound(field1)
		sql = sql & field1(i) & "='" & replace(value1(i),"'","''") & "'" 
		if i <> ubound(field1) then sql=sql & ","  else  sql=sql & " where number='" & input_number & "'" 
	next
	oConn.Execute sql
end if

if request.form("subed")="删除" then 
'表单提交后
	'接受录入参数
	input_number=Request.Form("input_number")'编号
	
	oConn.Execute "DELETE FROM " & table & " WHERE number='" & input_number & "'" 
end if

set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from " & table & " where typenumber="&pid
rs.open sql,oConn,1,1

set rs1=Server.CreateObject("ADODB.RecordSet")
sql="select max(SUBSTRING(number, 3, 2)) from " & table & " where typenumber="&pid
rs1.open sql,oConn,1,1
if rs1(0) then nextnumber=cint(rs1(0))+1 else nextnumber=1
nextnumber=pid&String(2-len(cstr(nextnumber)), "0")&cstr(nextnumber)
rs1.close
'------------------------------------------------
%>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/main.css" type=text/css>
<title>编辑权限</title>
<script src="../js/Popup.js"></script>
<script src="../js/front_chec.js"></script>
<script src="../js/user_select.js"></script>
<script language="JavaScript">
<!--
 function require(form){
	return	checnull(form.input_title,"请填写权限名!")&&
	1==1;
 }
-->
</script>
</head>
<body topmargin="10" leftmargin="10">
<br>
<%=SearchScrip(Search)%>
<div align="center">
<table width="600" cellspacing="1" cellpadding="4" class="tab">
  <tr>
    <td width="100%" class="tdBottom" valign="top">
      <table width="100%" cellspacing="1" cellpadding="2" class="tab">
        <tr> 
          <td width="100%" class="tdTop">
	    <table border="0" width="100%" cellspacing="0" cellpadding="0">
	      <tr>
	        <td class="tdTop2">
	          <img border="0" src="../images/icon_title.gif" align="left">编辑 [<%=GetTableValue("tbioaRoleRightsType","Title","Number",pid)%>] 权限
	        </td>
	        <td width="60" class="tdTop2">
	          <img border="0" src="../images/icon_return.gif" align="left">  
	          <a href="czqx_manage.asp" class="linkTop">返回</a>   
	        </td>
	      </tr>
	    </table>
          </td>
        </tr>
        <tr> 
          <td class="td1">
              <table border="0" width="100%" cellspacing="1" cellpadding="2" class="tab">
                <tr class="td1"> 
                <form name="eventfrm" method="POST" action="?id=<%=pid%>" onSubmit="return require(this)">
                <input type=hidden name="subed" value="add">
                <input type=hidden name="input_number" value="<%=nextnumber%>">
                  <td nowrap colspan="6">编号:<%=nextnumber%>                  
                   权限名:<INPUT type=text size=12 name=input_title class=input>
                   菜单路径:<INPUT type=text size=28 name=input_filename class=input>
                   <input type="submit" value="增加" name="B1" class="button0" onmouseout=className="button0" onmouseover=className="button1">
                  </td>
                </form>
                </tr>
                <tr> 
                  <td class="tdtop" width=50 nowrap>编号</td>
                  <td class="tdtop" nowrap>权限名</td>
                  <td class="tdtop" nowrap>菜单路径</td>
                  <td class="tdtop" nowrap>默认状态</td>
                  <td class="tdtop" colspan="2" width=80 nowrap>操作</td>
                </tr>
                <%while not rs.eof%>
	        <tr> 
	        <form name="eventfrm" method="POST" action="?id=<%=pid%>" onSubmit="return require(this)">
                <input type=hidden name="input_number" value="<%=rs("number")%>">
	          <td nowrap class="td2">
	            <%=rs("number")%>
	          </td>
	          <td nowrap class="td2">
	            <input type="text" size=15 value="<%=htmlout(rs("title"))%>" name="input_title" class="button0" onmouseout=className="button0" onmouseover=className="button1">
	          </td>
	          <td nowrap class="td2">
	            <input type="text" size=35 value="<%=htmlout(rs("filename"))%>" name="input_filename" class="button0" onmouseout=className="button0" onmouseover=className="button1">
	          </td>
	          <td nowrap class="td2">
	            <select name="input_mod" size=1 class="input">
			<option value="0" <%=selected(rs("mod"),"0")%> style="background-color: #E7F0FB; color: #D00000">无权限</option>
			<option value="1" <%=selected(rs("mod"),"1")%> style="background-color: #E7F0FB; color: #008000">有权限</option>
			<option value="X" <%=selected(rs("mod"),"X")%> style="background-color: #E7F0FB; color: #808080">禁 用</option>
	            </select>
	          </td>
	          <td nowrap class="td2">
		      <input type="submit" value="修改" name="subed" class="button0" onmouseout=className="button0" onmouseover=className="button1">
		  </td>
		  <td nowrap class="td2">
		      <input type="submit" value="删除" name="subed" class="button0" onmouseout=className="button0" onmouseover=className="button1" onClick="return confirm('确定要删除该权限吗?\n该操作不可恢复!')">
	          </td>
                </form>
	        </tr>
                <%
                  rs.movenext
                wend
                %>
              </table>
          </td>
        </tr>
        <tr> 
          <td width="25%" class="tdBottom"> * 如果未填写菜单路径,该权限将不在操作菜单中出现。</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</div>
</body>

</html>

<%'释放对象变量
rs.close
oConn.close
%> 

⌨️ 快捷键说明

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