📄 selectqx.asp
字号:
<%
'功能:批量选择权限
'作者:展亮
'2003-12-10 13:32
%>
<!--#include file="../inc/Secure.asp"-->
<!--#include file="../inc/Conn.asp"-->
<!--#include file="../inc/Const.asp"-->
<%
Response.Expires=-1
Response.Buffer=true
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/main.css">
<title>选择权限</title>
<%
dim rs
set rs=server.CreateObject("adodb.recordset")
dim ary()
redim ary(3,0)
dim cxqxsz,cxqx
cxqxsz = Request.QueryString("cxqxsz")
cxqx = Request.QueryString("cxqx")
%>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function window_onload() {
var cxqxsz ='<%=cxqxsz%>';
if(cxqxsz!='0' && cxqxsz!=''){
trsel.style.display='block';
window.dialogWidth='510px';
window.dialogHeight='280px';
}
window.returnValue = '';
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE=javascript FOR=window EVENT=onload>
<!--
window_onload()
//-->
</SCRIPT>
</head>
<body class="tdbottom">
<table align="center" width="490" class="InputFrameMain" style="margin-left:7px"><tr><td>
<table width="100%" border=0 align=center cellpadding=2 cellspacing=1 class="tab">
<form method=post name=frmxx id=frmxx>
<tr>
<td width=100% class='tdtop2' nowrap align=left colspan=2>
<div align=left>
<img border="0" src="../images/icon_title.gif" align="left">
选择权限
<span onclick="vbscript:usery"><input type="radio" value="V1" name="R1" hidefocus=true <%if cxqxsz = "" or cxqxsz="0" then%>Checked <%end if%>>全部人员</span>
<span onclick="vbscript:usebm"><input type="radio" value="V1" name="R1" hidefocus=true <%if cxqxsz = "1" then%>Checked <%end if%>>按部门选择</span>
<span onclick="vbscript:usezw"><input type="radio" value="V1" name="R1" hidefocus=true <%if cxqxsz = "2" then%>Checked <%end if%>>按职位选择</span>
</div>
</td>
</tr>
<tr class=tdbottom id=trsel name=trsel <% if cxqxsz <> "" and cxqxsz<>"0" then%>style="display:block"<%else%> style="display:none"<%end if%>>
<td colspan=2 class=inputareacell width=100%>
<table width=100% class=tableframe>
<tr align=center class=listtitle>
<td class=listcelltitle>可选</td>
<td class=listcelltitle> </td>
<td class=listcelltitle>已选</td>
</tr>
<tr align=center>
<td>
<select id=dxbm name=dxbm <%if cxqxsz = "1" then%>style="display:inline" <%else%>style="display:none"<% end if%> style="width:100%" rows=9 size=9 ondblclick="vbscript:doselone">
<%Call pOptions("tbioaDepartment","Name",0,"","")%>
</select>
<select id=dxzw name=dxzw <%if cxqxsz = "2" then%>style="display:inline" <%else%>style="display:none"<% end if%> style="width:100%" rows=9 size=9 ondblclick="vbscript:doselone">
<%
ssql="select a.*,b.name from tbioaRole a,tbioaDepartment b where a.department=b.id order by b.id"
rs.Open ssql,oConn,1,1
do while not rs.EOF
sFlag = false
if cxqxsz = "2" then
datastrbuf =cxqx&","
fg=","
do while instr(1,datastrbuf,fg)>0
str1=mid(datastrbuf,1,instr(1,datastrbuf,fg)-1)
datastrbuf=mid(datastrbuf,instr(1,datastrbuf,fg)+1,len(datastrbuf)-instr(1,datastrbuf,fg))
if trim(str1)<>"" then
sqlstr="select * from tbioaRole where id=" & str1 & " order by id"
'Response.Write sqlstr
'Response.End
set rs_temp=oConn.execute(sqlstr)
if not rs_temp.eof then
if rs_temp("id") = rs("id") then sFlag = true
end if
rs_temp.close
set rs_temp = nothing
end if
Loop
end if
if sFlag = false then
%>
<option value="<%=rs("id")%>" <%if cstr(sdata)=cstr(rs("id")) then Response.Write "selected"%>><%=server.HTMLEncode(rs("name") & "/" & rs("rolename") & "")%></option>
<%
end if
rs.MoveNext
loop
rs.Close
%>
</select>
</td>
<td valign=center width=40>
<span valign=center>
<input type="button" value=">>" onclick="vbscript:dosall" name="B0" style="font-weight: bold; width: 32" class="button0" onmouseout=className="button0" onmouseover=className="button1"><hr>
<input type="button" value=">" onclick="vbscript:doselone" name="B1" style="font-weight: bold; width: 32" class="button0" onmouseout=className="button0" onmouseover=className="button1"><hr>
<input type="button" value="<" onclick="vbscript:dodselone" name="B2" style="font-weight: bold; width: 32" class="button0" onmouseout=className="button0" onmouseover=className="button1"><hr>
<input type="button" value="<<" onclick="vbscript:dosnone" name="B3" style="font-weight: bold; width: 32" class="button0" onmouseout=className="button0" onmouseover=className="button1">
</span>
</td>
<td class=row>
<select id=yxbm name=yxbm <%if cxqxsz = "1" then%>style="display:inline" <%else%>style="display:none"<% end if%> style="width:100%" rows=9 size=9 ondblclick="vbscript:dodselone">
<%
if cxqxsz="1" then
datastrbuf =cxqx&","
fg=","
do while instr(1,datastrbuf,fg)>0
str1=mid(datastrbuf,1,instr(1,datastrbuf,fg)-1)
datastrbuf=mid(datastrbuf,instr(1,datastrbuf,fg)+1,len(datastrbuf)-instr(1,datastrbuf,fg))
if trim(str1)<>"" then
sqlstr="select * from tbioaDepartment where id='" & str1&"'"
set rs_temp=oConn.execute(sqlstr)
if not rs_temp.eof then%>
<option value="<%=rs_temp("id")%>"><%=rs_temp("name")%></option>
<% end if
rs_temp.close
end if
Loop
end if
%>
</select>
<select id=yxzw name=yxzw <%if cxqxsz = "2" then%>style="display:inline" <%else%>style="display:none"<% end if%> style="width:100%" rows=9 size=9 ondblclick="vbscript:dodselone">
<%
if cxqxsz="2" then
datastrbuf =cxqx&","
fg=","
do while instr(1,datastrbuf,fg)>0
str1=mid(datastrbuf,1,instr(1,datastrbuf,fg)-1)
datastrbuf=mid(datastrbuf,instr(1,datastrbuf,fg)+1,len(datastrbuf)-instr(1,datastrbuf,fg))
if trim(str1)<>"" then
'sqlstr="select * from tbioaRole where id='" & str1&"'"
sqlstr="select a.*,b.name from tbioaRole a,tbioaDepartment b where a.department=b.id and a.id='" & str1&"'"
set rs_temp=oConn.execute(sqlstr)
if not rs_temp.eof then%>
<option value="<%=rs_temp("id")%>"><%=rs_temp("name")%>/<%=rs_temp("rolename")%></option>
<% end if
rs_temp.close
set rs_temp = nothing
end if
Loop
end if
%>
</select>
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
<table width=100%>
<tr>
<td align="middle" colspan="2">
<input type=button class="button0" onmouseout=className="button0" onmouseover=className="button1" value=确定 name="bQD" id="bQD" onclick="vbscript:doSave">
<input type=button class="button0" onmouseout=className="button0" onmouseover=className="button1" value=放弃 name="bFQ" id="bFQ" onclick='vbscript:window.close'>
</td>
</tr>
</table>
</td></tr></table>
<%
set rs = nothing
oConn.Close
set oConn = nothing
%>
</BODY>
</html>
<script language=vbscript>
<!--
sub usery
frmxx.R1(0).checked=true
trsel.style.display="none"
window.dialogWidth="510px"
window.dialogHeight="120px"
end sub
sub usebm
frmxx.R1(1).checked=true
trsel.style.display="block"
frmxx.dxbm.style.display="inline"
frmxx.dxzw.style.display="none"
frmxx.yxbm.style.display="inline"
frmxx.yxzw.style.display="none"
window.dialogWidth="510px"
window.dialogHeight="280px"
end sub
sub usezw
frmxx.R1(2).checked=true
trsel.style.display="block"
frmxx.dxzw.style.display="inline"
frmxx.dxbm.style.display="none"
frmxx.yxzw.style.display="inline"
frmxx.yxbm.style.display="none"
window.dialogWidth="510px"
window.dialogHeight="280px"
end sub
sub dosall
dim i,j,ba
if frmxx.R1(1).checked then
for i= 0 to frmxx.dxbm.options.length-1
ba=0
for j=0 to frmxx.yxbm.length-1
if frmxx.dxbm.item(i).value=frmxx.yxbm.item(j).value then
ba=1
exit for
end if
next
if ba=0 then
Set e = Document.createElement("OPTION")
e.value=frmxx.dxbm.item(i).value
e.text=frmxx.dxbm.item(i).text
frmxx.yxbm.options.add e
end if
next
for i= 0 to frmxx.dxbm.options.length-1
frmxx.dxbm.options.remove 0
next
else
for i= 0 to frmxx.dxzw.options.length-1
ba=0
for j=0 to frmxx.yxzw.length-1
if frmxx.dxzw.item(i).value=frmxx.yxzw.item(j).value then
ba=1
exit for
end if
next
if ba=0 then
Set e = Document.createElement("OPTION")
e.value=frmxx.dxzw.item(i).value
e.text=frmxx.dxzw.item(i).text
frmxx.yxzw.options.add e
end if
next
for i= 0 to frmxx.dxzw.options.length-1
frmxx.dxzw.options.remove 0
next
end if
end sub
sub dosnone
dim i,j,ba
if frmxx.R1(1).checked then
for i= 0 to frmxx.yxbm.options.length-1
ba=0
for j=0 to frmxx.dxbm.length-1
if frmxx.yxbm.item(i).value=frmxx.dxbm.item(j).value then
ba=1
exit for
end if
next
if ba=0 then
Set e = Document.createElement("OPTION")
e.value=frmxx.yxbm.item(i).value
e.text=frmxx.yxbm.item(i).text
frmxx.dxbm.options.add e
end if
next
for i= 0 to frmxx.yxbm.options.length-1
frmxx.yxbm.options.remove 0
next
else
for i= 0 to frmxx.yxzw.options.length-1
ba=0
for j=0 to frmxx.dxzw.length-1
if frmxx.yxzw.item(i).value=frmxx.dxzw.item(j).value then
ba=1
exit for
end if
next
if ba=0 then
Set e = Document.createElement("OPTION")
e.value=frmxx.yxzw.item(i).value
e.text=frmxx.yxzw.item(i).text
frmxx.dxzw.options.add e
end if
next
for i= 0 to frmxx.yxzw.options.length-1
frmxx.yxzw.options.remove 0
next
end if
end sub
sub dodselone
dim i,j,ba
if frmxx.R1(1).checked then
if frmxx.yxbm.options.length=0 then exit sub
if frmxx.yxbm.selectedIndex<0 then exit sub
ba=0
for j=0 to frmxx.dxbm.length-1
if frmxx.yxbm.item(frmxx.yxbm.selectedIndex).value=frmxx.dxbm.item(j).value then
ba=1
exit for
end if
next
if ba=0 then
Set e = Document.createElement("OPTION")
e.value=frmxx.yxbm.item(frmxx.yxbm.selectedIndex).value
e.text=frmxx.yxbm.item(frmxx.yxbm.selectedIndex).text
frmxx.dxbm.options.add e
end if
frmxx.yxbm.options.remove frmxx.yxbm.selectedIndex
else
if frmxx.yxzw.options.length=0 then exit sub
if frmxx.yxzw.selectedIndex<0 then exit sub
ba=0
for j=0 to frmxx.dxzw.length-1
if frmxx.yxzw.item(frmxx.yxzw.selectedIndex).value=frmxx.dxzw.item(j).value then
ba=1
exit for
end if
next
if ba=0 then
Set e = Document.createElement("OPTION")
e.value=frmxx.yxzw.item(frmxx.yxzw.selectedIndex).value
e.text=frmxx.yxzw.item(frmxx.yxzw.selectedIndex).text
frmxx.dxzw.options.add e
end if
frmxx.yxzw.options.remove frmxx.yxzw.selectedIndex
end if
end sub
sub doselone
dim i,j,ba
if frmxx.R1(1).checked then
if frmxx.dxbm.options.length=0 then exit sub
if frmxx.dxbm.selectedIndex<0 then exit sub
ba=0
for j=0 to frmxx.yxbm.length-1
if frmxx.dxbm.item(frmxx.dxbm.selectedIndex).value=frmxx.yxbm.item(j).value then
ba=1
exit for
end if
next
if ba=0 then
Set e = Document.createElement("OPTION")
e.value=frmxx.dxbm.item(frmxx.dxbm.selectedIndex).value
e.text=frmxx.dxbm.item(frmxx.dxbm.selectedIndex).text
frmxx.yxbm.options.add e
end if
frmxx.dxbm.options.remove frmxx.dxbm.selectedIndex
else
if frmxx.dxzw.options.length=0 then exit sub
if frmxx.dxzw.selectedIndex<0 then exit sub
ba=0
for j=0 to frmxx.yxzw.length-1
if frmxx.dxzw.item(frmxx.dxzw.selectedIndex).value=frmxx.yxzw.item(j).value then
ba=1
exit for
end if
next
if ba=0 then
Set e = Document.createElement("OPTION")
e.value=frmxx.dxzw.item(frmxx.dxzw.selectedIndex).value
e.text=frmxx.dxzw.item(frmxx.dxzw.selectedIndex).text
frmxx.yxzw.options.add e
end if
frmxx.dxzw.options.remove frmxx.dxzw.selectedIndex
end if
end sub
sub doSave
dim i
dim s0,s1,s2
if frmxx.R1(0).checked then
s0="0"
elseif frmxx.R1(1).checked then
s0="1"
s1=""
s2=""
for i=0 to frmxx.yxbm.length-1
s1=s1 & "," & frmxx.yxbm.item(i).value
s2=s2 & " " & frmxx.yxbm.item(i).text
next
if s1<>"" then
s1=mid(s1,2)
s2=mid(s2,2)
end if
else
s0="2"
s1=""
s2=""
for i=0 to frmxx.yxzw.length-1
s1=s1 & "," & frmxx.yxzw.item(i).value
s2=s2 & " " & frmxx.yxzw.item(i).text
next
if s1<>"" then
s1=mid(s1,2)
s2=mid(s2,2)
end if
end if
window.returnValue = s0 & "_" & s1 & "_" & s2
window.close
end sub
//-->
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -