<!--#include file="../SQLconn.asp"-->

<html>
<head><title></title><meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="../css/style.css" />

<style type="text/css">
<!--
.STYLE3 {color: #990033}
-->
</style>
<body>
<script language=javascript>


function unselectall(){
if(document.myform.chkAll.checked){
document.myform.chkAll.checked = document.myform.chkAll.checked&0;
}
}
function CheckAll(form){
for (var i=0;i<form.elements.length;i++){
var e = form.elements[i];
if (e.Name != 'chkAll'&&e.disabled==false)
e.checked = form.chkAll.checked;
}
}
</script>



<!--//////////////////////////////////	 --> 
<script language="javascript" type="text/javascript">
 var classlist=new Array(); //定义js数组
<%
i=1
Set rs = Conn.Execute("SELECT a.vid,a.vname as bumen, b.vname, b.vid AS id  FROM varSet a INNER JOIN     varSet b ON a.vname = b.name AND a.name = 'bumenfile'")
			While NOT rs.EOF %>
			//使用asp循环填充js数组,三维数组,分别保存栏目的父ID,栏目名称,栏目ID
			
 classlist[<%=i-1%>]=new Array(<%=rs("vid")%>,"<%=rs("vname")%>","<%=rs("bumen")%>");

 
 <%  i=i+1
 
 rs.MoveNext 
   
			Wend
			rs.Close%>

//一级栏目选择变动触发函数

function getSmallClass()
{
 var parentid=document.all.bumen.value;  //获取父栏目的ID
 document.all.ftype.length=0;   //将二级栏目下拉清空
 document.all.ftype.options.add(new Option("","0"))  //添加一个自定义的下拉选项
 for(i=0;i<classlist.length;i++)   //遍历js数组
 {
  
  if(classlist[i][2]==parentid)   //js数组里的选项符合条件(父栏目ID来判断)
  {
     document.all.ftype.options.add(new Option(classlist[i][1],classlist[i][1]))  //添加到二级栏目的下拉选项里
  }
 }
}
</script>

<!--//////////////////////////////////	 --> 
<%
   years=request.cookies("nowxueqi")
   tname=request.cookies("tname")
   curpage=Request.QueryString("curpage") '将URL参数curpage传给curpage变量
   %>
   <FORM ACTION="yidong.asp?curpage=<%=curpage%>" METHOD="post"  NAME="form2"> 
   
<table width="99%" height="499" border="0" cellpadding="0" cellspacing="0">
  <tr>
   <td height="33"><table width="100%" height="33" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td width="100" class="NemuNot"><div align="center"><a href="addfile.asp" target="_self">上传部门文件</a></div></td>
        <td width="100" class="Nemuselect"><div align="center"><a href="manage.asp?years=<%=years%>" target="_self">部门文件列表</a></div></td>
       <td class="NemuLine">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="470" valign="top"     class="NemuMainBox">
	<br>
	<%
  
   
  '检查权限
       Set MyOAASPObj = Server.CreateObject("YFSchoolOApro.YFSchoolDll")
           if MyOAASPObj.QuanXian(tname,"添加部门文件")=0 then 
		    response.redirect  "../NoPower.asp"
           end if 
		   set MyOAASPObj=nothing
  '检查权限结束

 
   
   
		
'检查权限
	tname=request.cookies("tname") 
	Set MyOAASPObj= Server.CreateObject("YFSchoolOApro.YFSchoolDll")
	if MyOAASPObj.QuanXian(tname,"系统参数")=0 then    
	   sql="Select * from bumenfile where  (upname ='"&tname&"') and  (years='"&years& "')   order by id desc"
	else
	   sql="Select * from bumenfile   order by id desc"
	end if
		   
		Set rs=Server.CreateObject("Adodb.Recordset")
		rs.open sql,conn,1,1
		%>
		
		<%
		rs.pagesize=12 '每页记录条数
		
		rs.absolutepage=curpage '将本页设为curpage设置的页数
		if curpage=0 then
		curpage=1
		end if 
		
		%>
		
		
	 
		
		
		<table width="95%" align="center" border="1" cellpadding="3"   cellspacing="0"  bordercolor="#6D8DD8"  class="mtable">
		<tr style="background-color:#D6E4FF"  class="TableHeader">
		
		<td height="27" align="center" nowrap class="STYLE1"><span class="STYLE1">日期</span></td>
		
		<td align="center" nowrap class="STYLE1">部门</td>
		<td align="center" nowrap class="STYLE1">类别</td>
		<td align="center" nowrap class="STYLE1"><span class="STYLE1">标题</span></td>
		<td align="center" nowrap class="STYLE1"><span class="STYLE1">操作</span></td>
		</tr>
		<%
		for i= 1 to rs.pagesize
		if rs.eof then
		exit for
		end if
		%>
		<tr> <td width="173" height="28" class="STYLE1">
		  
		<div align="left">&nbsp;
		<input type="checkbox" name="checkbox" value=<%=rs("id")%>>&nbsp;
		<%=formatdatetime(rs("fdate"),2)%></div></td>
		<td width="121" class="STYLE1"><div align="center"><%=rs("bumen")%></div></td>
		<td width="145" class="STYLE1"><div align="center"><%=rs("ftype")%></div></td>
		<td width="538" class="STYLE1"><div align="center"><a href="newfile.asp?id=<%=rs("id")%>"  target="_blank" class="STYLE1"><%=rs("title")%></a></div></td> 
		<td width="89" class="STYLE1">
		
		<div align="center">
		
		 <a   href= "# "   onclick= "javascript:if(confirm( '您真的要删除记录？ '))href= 'delete.asp?years=<%=years%>&curpage=<%=curpage%>&id=<%=rs("id")%>'; "> 删除 </a>		</div></td>
		</tr>
		<%  rs.movenext
		next%>
		<tr>
    <td height="35" colspan="4">
	
	<span class="STYLE1">&nbsp;<input name='chkAll' type='checkbox' id='chkAll' onclick='CheckAll(this.form)' value='checkbox'>全选</span>&nbsp;&nbsp;&nbsp;&nbsp;
	<input name="Submit2" type="submit" class="topanniu" value="移动到">
	<span class="STYLE1">
	<select name="bumen" id="bumen" style= "width:130px " onChange="getSmallClass();">
      <option selected="selected" value="<%=bumen%>"><%=bumen%></option>
      <%
'一级栏目通过asp代码的方式加载
 Set RSsel = Conn.Execute("select * from  varset where name='bumenfile' order by vid")
			While NOT RSsel.EOF %>
      <option value="<%=RSsel( "vname" )%>"><%=RSsel( "vname" )%></option>
      <% RSsel.MoveNext
			Wend
			RSsel.Close%>
    </select>
	<select name="ftype" id="ftype" style= "width:130px ">
      <option selected="selected" value="<%=ftype%>"><%=ftype%></option>
    </select>
	</span></td>
  </tr>
		</table>
		<div align="center"><br>
		  
		  
		    <span class="STYLE1">
	        <%if curpage=1 then%>
		      
	        首页
	        <%else%>
	        <a href="?curpage=1">首页</a>
	        <%end if%>
		      
	        <%if curpage=1 then%>
	        上一页
	        <%else%>
	        <a href="?curpage=<%=curpage-1%>">上一页</a>
	        <%end if%>
		      
	        <%if rs.pagecount<curpage+1 then%>
	        下一页
	        <%else%>
	        <a href="?curpage=<%=curpage+1%>">下一页</a>
	        <%end if%>
		      
	        <%if rs.pagecount<curpage+1 then%>
	        尾页
	        <%else%>
	        <a href="?curpage=<%=rs.pagecount%>">尾页</a>
	        <%end if%>
	        (当前第<%=curpage%>页，共有<%=rs.pagecount%>页，共有：<%=rs.recordcount%>条记录)</span>		  </div>
		  
		  
		  
		  
		  
		  
		  
		  
          </div></td>
  </tr>
</table>
</FORM>
</body>
</html>
