<%@ Language=VBScript%>
<%
Response.Buffer=false
Response.Expires=0

%>
<!-- #include file="../dsn.asp" -->
<!-- #include file="../links.asp" -->
<%
yxid=cint(Request.QueryString("yxid"))
pageno=Request.QueryString("pageno")
flag=Request.QueryString("flag")
keyno=Request.QueryString("keyno")
pid=Request.QueryString("pid")
id=Request.QueryString("id")
ppid=Request.QueryString("ppid")
mode=Request.QueryString("mode")
if pageno="" then pageno=1
if flag="" then flag="1"
set cn=server.CreateObject("ADODB.Connection")
cn.Open mycnstr
set rs=server.CreateObject("ADODB.Recordset")
set rs1=server.CreateObject("ADODB.Recordset")

htmltitle="招聘岗位管理"
htmlname="engage_admin.asp?flag="+flag
addhtml="engage_edit.asp?flag="+flag
tabname="engage"
if Request.ServerVariables("REQUEST_METHOD")="POST" and mode<>"888" then
		if not isempty(request("sel")) then
     		idlist=request("sel")
     		if instr(idlist,",")>0 then
				dim idarr
				idArr=split(idlist)
				for i = 0 to ubound(idarr)
	       			delid=clng(idarr(i))
	       			call setupdate(delid,mode)
				next
			else
				delid=clng(idlist)
				call setupdate(delid,mode)
			end if	
		end if
		delid=0
		if err<>1 then
				Response.Redirect htmlname
		end if		
end if
  sub setupdate(id,mm)
    if mm="999" then
		call delrow(id)
	elseif  mm="777" then
		sqltext3="update "+tabname+" set state=1 where keyno="&id
		cn.Execute sqltext3
	elseif  mm="666" then
		sqltext3="update "+tabname+" set state=0 where keyno="&id
		cn.Execute sqltext3
	end if	
  end sub  

sub delrow(keyno)
	sqltext="select top 1 engageno from engage_user where engageno="&keyno
	rs.Open sqltext,cn,1,1
	if rs.EOF then
		sqltext="delete from engage where keyno="&keyno
		cn.Execute sqltext
	else
		Response.Write "<font color=red>警告:该岗位下已有人员应聘,不能删除!</font>"
		err=1
	end if
	rs.Close
end sub

%>
<html>
<head>
<title><%=htmltitle%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {font-size: 12px; color: #000000; font-family: 宋体}
td {font-size: 12px; color: #000000; font-family: 宋体;line-height:130%}
.t1 {font:12px 宋体;color=000000} 
.t2 {font:12px 宋体;color:ffffff} 
.t3 {font:12px 宋体;color:336699} 
.t4 {font:12px 宋体;color:ff0000} 
.t5 {font:12px 宋体;color:ff6600} 

.bt1 {font:14px 宋体;color=000000} 
.bt2 {font:12px 宋体;color:ffffff} 
.bt3 {font:14px 宋体;color:336699} 
.bt4 {font:14px 宋体;color:ff0000} 
.bt5 {font:14px 宋体;color:0000ff}
.bt10 {font:14px 宋体;color:0000ff}

.td1 {font-size:12px;background-color:#3388bb;color:#ffffff}
.td2 {font-size:12px;background-color:#ffffff;color:#000000;}

A:link {color: #000077}
A:visited {color: #000077}
A:hover {color: #ff0000}

A.title1:link {text-decoration:none;color:#336699;}
A.title1:visited {text-decoration:none;color:#336699;}
A.title1:active {text-decoration:none;color:#336699;}
A.title1:hover {text-decoration:none;color:#336699;}
-->
</style>
</head>
<body topmargin=5>
<table width="100%" align=center>
	<tr>
	<td valign="top" align="left" width="100%">
		<table width="100%" height="20" border="0">
			<tr>
			<td style="font-size:12px;"></td>
			<td><font class=t5>当前位置：网站综合管理→  招聘岗位列表</font></td>
			<td align="right">
			</td>
			</tr>
		</table>
		<table width="100%" height="20" border="0">
		<form action="<%=htmlname%>" method=post name="listform">
			<tr>
		<%
		sqltext="select * from engage where flag='"+flag+"'order by sortnum desc"
		'Response.Write sqltext
		rs.Open sqltext,cn,1,1

		listcs=20
		rs.PageSize=listcs
		if pageno="" then 
			pageno=1
		else
			pageno=cint(pageno)	
		end if	
		if rs.PageCount>0 then rs.AbsolutePage=pageno
	%>
		<td class=t1 align="left" width=500>
			<a href="Javascript:window.location.reload()">[刷新列表]</a>
			<a href="<%=addhtml%>">[增加]</a>
			<a href="javascript:delrows()">[删除]</a>
			<a href="javascript:shows()">[显示]</a>
			<a href="javascript:noshows()">[不显示]</a>			
		</td>	
		<td  align="right">
		<%if rs.PageCount>1 then%>
			[第<b><%=pageno%></b>页, 共<b><%=rs.PageCount%></b>页<b><%=rs.RecordCount%></b>条记录]		              
			<%if pageno>1 then%>
				<a class=r href="<%=htmlname%>&pageno=1">首页</a>              
				<a class=r href="<%=htmlname%>&pageno=<%=pageno-1%>">上页</a>              
			<%end if              
			if pageno<rs.PageCount then%>              
				<a class=r href="<%=htmlname%>&pageno=<%=pageno+1%>">下页</a>              
				<a class=r href="<%=htmlname%>&pageno=<%=rs.PageCount%>">末页</a>              
			<%end if%>              
		<%end if              
		%>              
		</td>
		</tr>
		</table>
			<table width="100%" border="0" cellspacing="1" cellpadding="1" style="font-size:14.5px;line-height:100%">
				<tr bgcolor="#666699" style="color:#ffffff" align="center">
				<td class=bt2></td><td class=bt2>序号</td><td class=bt2>是否显示</td>
				<td class=bt2>招聘岗位</td><td class=bt2>招聘部门</td></tr>
		<%
		i=0
		do while not rs.EOF and i<listcs 
			if (i mod 2)=1 then
				Response.Write("<tr bgcolor=fefefe>")
			else
				Response.Write("<tr bgcolor=efefef>")
			end if	
		%>
			<td width="20" align="center"><input type="checkbox" name="sel" value="<%=(rs("keyno"))%>"></td>
			<td width="60" align="center"><%=rs("sortnum")%></td>
			<td width="50" align="center">
				<%if rs("state")=1 then 
						Response.Write ("显示")
					else
						Response.Write ("<font color=red>不显示</font>")
				end if%>
			</td>
			<td align=left><a href="<%=addhtml%>&keyno=<%=rs("keyno")%>"><%=trim(rs("title"))%></td>
			<td width="100" align="center"><%=trim(rs("dept"))%></td>

			</tr>
		<%	
			i=i+1
			rs.MoveNext
		loop
		%>
			</table>
		</td></tr>
		<table width="100%"> 
		<tr><td bgcolor="336699">

		<%if rs.PageCount>1 then%>
			<tr><td><center>
			<%if pageno>1 then%>
				<a class=r href="<%=htmlname%>&pageno=1">[首页]</a>              
				<a class=r href="<%=htmlname%>&pageno=<%=pageno-1%>">[上页]</a>              
			<%end if              
			if pageno<rs.PageCount then%>              
				<a class=r href="<%=htmlname%>&pageno=<%=pageno+1%>">[下页]</a>              
				<a class=r href="<%=htmlname%>&pageno=<%=rs.PageCount%>">[末页]</a>              
			<%end if%>              
				[第<b><%=pageno%></b>页, 共<b><%=rs.PageCount%></b>页<b><%=rs.RecordCount%></b>条记录]		              
			</center></td></tr>              
		<%end if              
		%>              
		</table>
		</form>
</td></tr><table>
</body>
</html>

<script language="Javascript">
    function delrows()
    {
        if (confirm('您确认要删除你所选中的项目吗？')==true)
        {        
        document.listform.action="<%=htmlname%>&mode=999";
        document.listform.submit();
        }
    }
    function shows()
    {
		listform.action="<%=htmlname%>&mode=777";
        document.listform.submit();
    }
    function noshows()
    {
        document.listform.action="<%=htmlname%>&mode=666";
        document.listform.submit();
    }

</script>

