<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p19")
'''''''''''''''''''''''''''''''''''''''''''''''
const recpage=15
dim i,classid,currentpage,BeginTime,key,bykey,SoftChar,SoftRecommend,SoftTop,IsCheck,paras
BeginTime=Timer
if not isempty(request.QueryString("classid")) then 
	classid=Clng(request.QueryString("classid"))
else
	classid=0
end if
bykey=trim(request.QueryString("bykey"))
key=trim(request.QueryString("key"))
SoftChar=request.QueryString("SoftChar")
if(request.QueryString("SoftRecommend")<>"") then
	SoftRecommend=Cint(request.QueryString("SoftRecommend"))
else
	SoftRecommend=-1
end if
if(request.QueryString("SoftTop")<>"") then
	SoftTop=Cint(request.QueryString("SoftTop"))
else
	SoftTop=-1
end if
if(request.QueryString("IsCheck")<>"") then
	IsCheck=Cint(request.QueryString("IsCheck"))
else
	IsCheck=-1
end if
if not isempty(request.QueryString("page")) then 
	currentpage=Clng(request.QueryString("page"))
else 
	currentpage=1
end if
paras="key="&key&"&bykey="&bykey&"&SoftChar="&SoftChar&"&SoftRecommend="&SoftRecommend&"&SoftTop="&SoftTop&"&IsCheck="&IsCheck&"&classid="&classid
%>
<html>
<head>
<title>软件管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #FFFFFF;
	font-size:12px;
}
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
form{margin:0;}
-->
</style>
<link href="style/global.css" rel="stylesheet" type="text/css">
<script language="javascript">
function goto(frm)
{
	var gourl ="?<%=paras%>&";
	gourl += "page=" + (frm.page.value);
     var hid=parseInt(frm.hid.value);
	 if(parseInt(frm.page.value)>hid||frm.page.value<=0){
	 alert("错误！请确定你输入的数字在1-"+hid+"之间");
	 return false;
	 }
	window.location.href=gourl;
}
function ConfirmDel()
{
   if(confirm("确认删除？并且不能恢复！确定要删除此信息吗？"))
     return true;
   else
     return false;
	 
}
function charOptions(c){
	var sele="";
	var fonts = new Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');

	for(var i=0;i<fonts.length;i++){
		if(c==fonts[i])
			sele=" selected=selected";
		else
			sele="";		
		document.write('<option value="'+fonts[i]+'"'+sele+'>'+fonts[i]+'</option>');
	}
}
</script>
</head>
<body>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>

<form name="form3" method="get" action="?">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td><div align="center">关键字：
        <input name="key" type="text" id="key" value="<%=key%>">
      按：
      <select name="bykey" id="bykey">
        <option value="SoftName" <%if(bykey="SoftName") then response.write("selected=""selected""") end if%>>软件名称</option>
        <option value="SoftAuthor" <%if(bykey="SoftAuthor") then response.write("selected=""selected""") end if%>>作者</option>
        <option value="SoftLanguage" <%if(bykey="SoftLanguage") then response.write("selected=""selected""") end if%>>语言</option>
      </select>
      字母索引：
      <select name="SoftChar" id="SoftChar">
        <option value="">全部</option>
		<script>charOptions('<%=SoftChar%>');</script>
      </select>
      <select name="SoftRecommend" id="SoftRecommend">
        <option value="1" <%if(SoftRecommend=1) then response.write("selected=""selected""") end if%>>推荐</option>
        <option value="0" <%if(SoftRecommend=0) then response.write("selected=""selected""") end if%>>普通</option>
        <option value="-1" <%if(SoftRecommend=-1) then response.write("selected=""selected""") end if%>>全部</option>
      </select>
      <select name="SoftTop" id="select">
        <option value="1" <%if(SoftTop=1) then response.write("selected=""selected""") end if%>>置顶</option>
        <option value="0" <%if(SoftTop=0) then response.write("selected=""selected""") end if%>>普通</option>
        <option value="-1" <%if(SoftTop=-1) then response.write("selected=""selected""") end if%>>全部</option>
          </select>
      <select name="IsCheck" id="IsCheck">
        <option value="1" <%if(IsCheck=1) then response.write("selected=""selected""") end if%>>已审核</option>
        <option value="0" <%if(IsCheck=0) then response.write("selected=""selected""") end if%>>未审核</option>
        <option value="-1" <%if(IsCheck=-1) then response.write("selected=""selected""") end if%>>全部</option>
          </select>
      <input type="submit" value="搜索软件">
      </div></td>
    </tr>
  </table>
</form>
<form action="soft_do.asp" name="form1" method="post" enctype="application/x-www-form-urlencoded">
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr bgcolor="#FF9900">
    <td height="22" colspan="12"><div align="center" class="style1">◆ 软件管理 ◆</div></td>
  </tr>
  <tr bgcolor="#EEEEEE">
    <td width="5%">&nbsp;</td>
    <td width="4%" height="22"><div align="center">ID</div></td>
    <td width="9%"><div align="center">图片</div></td>
    <td width="8%"><div align="center">序号</div></td>
    <td width="29%"><div align="center">软件名称</div></td>
    <td width="12%"><div align="center">添加时间</div></td>
    <td width="6%"><div align="center">点击</div></td>
    <td width="5%"><div align="center">推荐</div></td>
    <td width="5%"><div align="center">置顶</div></td>
    <td width="4%"><div align="center">审核</div></td>
    <td width="7%"><div align="center">修改</div></td>
    <td width="6%"><div align="center">删除</div></td>
  </tr>
  <!-- 开始按行循环----------------------->
  <%
  		dim countSql,querySql,newsArr
		set rs=server.createobject("adodb.recordset")
		countSql="select count(*) from t_download_soft where 1=1"		
		if(classid>0) then
			countSql=countSql&" and CatalogId="&classid
		end if
		if(key<>"") then
			Select Case bykey
					Case "SoftName"
						countSql=countSql&" and SoftName like '%"&key&"%'"
					Case "SoftAuthor"
						countSql=countSql&" and SoftAuthor like '%"&key&"%'"
					Case "SoftLanguage"
						countSql=countSql&" and SoftLanguage like '%"&key&"%'"				
					Case Else				
			End Select
		end if
		if(SoftChar<>"") then
			countSql=countSql&" and SoftChar='"&SoftChar&"'"
		end if
		if(SoftRecommend>=0) then
			countSql=countSql&" and SoftRecommend="&SoftRecommend
		end if
		if(SoftTop>=0) then
			countSql=countSql&" and SoftTop="&SoftTop
		end if
		if(IsCheck>=0) then
			countSql=countSql&" and IsCheck="&IsCheck
		end if
		
  		rs.open countSql,conn,3,1
		allrec=rs(0)
		rs.close
		set rs=nothing
		totalpage=int((allrec+recpage-1)/recpage)		
		set rs=server.createobject("adodb.recordset")
		'查询sql
		querySql="select top "&recpage&" id,SoftName,SoftChar,SoftLanguage,SoftSize,SoftStars,SoftAuthor,SoftPhoto,SoftRecommend,SoftTop,InsertDate,ModifyDate,SoftHits,SoftSort,IsCheck from t_download_soft where id <=(select min(id) from (select top "&(recpage*(currentpage-1)+1)&" id from t_download_soft where 1=1"
		if(classid>0) then
			querySql=querySql&" and CatalogId="&classid
		end if
		if(key<>"") then
			Select Case bykey
					Case "SoftName"
						querySql=querySql&" and SoftName like '%"&key&"%'"
					Case "SoftAuthor"
						querySql=querySql&" and SoftAuthor like '%"&key&"%'"
					Case "SoftLanguage"
						querySql=querySql&" and SoftLanguage like '%"&key&"%'"				
					Case Else				
			End Select
		end if
		if(SoftChar<>"") then
			querySql=querySql&" and SoftChar='"&SoftChar&"'"
		end if
		if(SoftRecommend>=0) then
			querySql=querySql&" and SoftRecommend="&SoftRecommend
		end if
		if(SoftTop>=0) then
			querySql=querySql&" and SoftTop="&SoftTop
		end if
		if(IsCheck>=0) then
			querySql=querySql&" and IsCheck="&IsCheck
		end if
		
		querySql=querySql&" order by id desc) as t) "
		if(classid>0) then
			querySql=querySql&" and CatalogId="&classid
		end if
		if(key<>"") then
			Select Case bykey
					Case "SoftName"
						querySql=querySql&" and SoftName like '%"&key&"%'"
					Case "SoftAuthor"
						querySql=querySql&" and SoftAuthor like '%"&key&"%'"
					Case "SoftLanguage"
						querySql=querySql&" and SoftLanguage like '%"&key&"%'"				
					Case Else				
			End Select
		end if
		if(SoftChar<>"") then
			querySql=querySql&" and SoftChar='"&SoftChar&"'"
		end if
		if(SoftRecommend>=0) then
			querySql=querySql&" and SoftRecommend="&SoftRecommend
		end if
		if(SoftTop>=0) then
			querySql=querySql&" and SoftTop="&SoftTop
		end if
		if(IsCheck>=0) then
			querySql=querySql&" and IsCheck="&IsCheck
		end if
		querySql=querySql&" order by id desc "
		'response.write(querySql)
		rs.open querySql,conn,3,1
		if rs.eof or rs.bof then
			response.Write("请先选择左边的分类来显示相应的信息!")
			response.End()
		else
			newsArr=rs.GetRows()
		end if
		rs.close
		set rs=nothing
		for i=0 to ubound(newsArr,2)
	%>
  <tr>
    <td bgcolor="#FFFFFF"><div align="center"><input type="checkbox" name="newsid" value="<%=newsArr(0,i)%>"></div></td>
    <td height="20" bgcolor="#FFFFFF"><div align="center"><%=newsArr(0,i)%></div></td>
    <td bgcolor="#FFFFFF"><div align="center">
	<%if newsArr(7,i)<>"" then%>
	<a href="<%=newsArr(7,i)%>" target="_blank"><img src="<%=newsArr(7,i)%>" width="39" height="37" border="0"></a>
	<%
	else
		response.Write("没有图片")
	end if
	%>
	</div></td>
    <td bgcolor="#FFFFFF">
	<div align="center"><a href="<%=newsArr(8,i)%>" target="_blank"><%=newsArr(13,i)%></a></div></td>
    <td bgcolor="#FFFFFF">
	<div align="left">
	<a href="../soft/<%=newsArr(0,i)%>.htm" target="_blank"><%=newsArr(1,i)%></a>	</div></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=newsArr(10,i)%></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=newsArr(12,i)%></div></td>
    <td bgcolor="#FFFFFF"><div align="center">
      <%
	if(newsArr(8,i)=0) then
		response.Write("否")
	else
		response.Write("<font color=""red"">是</font>")
	end if
	%>
    </div></td>
    <td bgcolor="#FFFFFF"><div align="center">
      <%
	if(newsArr(9,i)=0) then
		response.Write("否")
	else
		response.Write("<font color=""red"">是</font>")
	end if
	%>
    </div></td>
    <td bgcolor="#FFFFFF">
	<div align="center">
	<%
	if(newsArr(14,i)=1) then 
		response.Write("<font color=""red"">√</font>")
	else
		response.Write("×")
	end if
	%>
	</div></td>
    <td bgcolor="#FFFFFF"><div align="center"><a href="soft_mod.asp?id=<%=newsArr(0,i)%>">修改</a></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><a href="dele.asp?id=<%=newsArr(0,i)%>&table=t_download_soft
" onClick="return ConfirmDel()">删除</a></div></td>
  </tr>
  
  <%
	next	  
  %>
  <tr>
    <td height="22" colspan="12" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="47%">
          <div align="right">
            <input class=Button type="button" name="chkall" value="全选" onClick="CheckAll(this.form)">
            <input class=Button type="button" name="chksel" value="反选" onClick="ContraSel(this.form)">
            管理选项：
            <select name="act" onChange="changeAct(this)">
                    <option value="0">请选择操作选项↓</option>
                    <option value="del">→批量删除</option>
                    <option value="top">→批量置顶</option>
                    <option value="notTop">→取消置顶</option>
                    <option value="recomme">→批量推荐</option>
                    <option value="notRecomme">→取消推荐</option>
                    <option value="check">→批量审核</option>
                    <option value="noCheck">→取消审核</option>
					<option value="remove" style="background-color:#CFEAFE;">→批量移动</option
                    ></select>
            </div></td>
        <td width="32%" id="removeContain" style="display:none; "><div align="center">移动至→          <select name="toCatalogId" >
  	<%
	set rs=server.CreateObject("adodb.recordset")
	sql="select id,title from catalogs where parentid="&PlugIn_DownloadId&" order by id asc"
	rs.open sql,conn,3,1
	if not rs.eof then
		first=rs.GetRows()
	else
		response.Write("<option>点击右边＋号选择栏目</option>")
	end if
	rs.close
	set rs=nothing
	if(isarray(first)) then
  		for i=0 to ubound(first,2)
			response.Write("<option value="&first(0,i)&">├"&first(1,i)&"</option>"&Chr(10))	    	
		next	
	end if
%>
	%>	  	     
 </select>&nbsp;&nbsp;<a href="#" onClick="addParentOption();">＋
        </div></td>
        <td width="21%"><input class=Button type="submit" name="Submit2" value="执行操作" onClick="return confirm('您确定执行该操作吗?')"></td>
      </tr>
    </table></td>
  </tr>
  <!--按行循环结束------------------------>
</table>
</form>
<table width="100%" height="20"  border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>
	<form name="form2" method="post" action="" style="margin:0 0 0 0">
      <div align="center">
<%
dim n,p
n=currentpage+1
p=currentpage-1
if p>0then
response.write("["&"<a href='?"&paras&"&page="&cstr(p)&"'>上一页</a>]&nbsp;&nbsp;&nbsp;")
else response.write("上一页&nbsp;&nbsp;&nbsp;")
end if 
if (n-1)*recpage>=allrec then 
response.write("下一页" )
else
response.Write("["&"<a href='?"&paras&"&page="&cstr(n)&"'>下一页</a>]")
end if
response.write("&nbsp;共"&allrec&"条&nbsp;")
response.Write("&nbsp;共"&totalpage&"页&nbsp;")
response.Write("&nbsp;第"&currentpage&"页&nbsp;")
%>
            <input type="hidden" name="hid" value="<%=totalpage%>">
&nbsp;&nbsp;跳至
<input name="page" type="text" size="5" onKeyPress="if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" onChange="goto(this.form)" style="border:1px solid #000000;height:18px ">
          页
          <input type="button" name="Button22" value="Go->" style="font-size:12px ;border:1px solid #000000;height:18px ">
        </div>
    </form></td>
  </tr>
</table>
<script language="javascript">
function CheckAll(form) {  
	for (var i=0;i<form.elements.length;i++)  {  
		var e = form.elements[i];  
		if (e.name != 'chkall')  
		e.checked = true // form.chkall.checked;  
	}  
} 
 
function ContraSel(form) {
	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if (e.name != 'chkall')
		e.checked=!e.checked;
	}
}
function changeAct(obj){
	var actType=obj.options[obj.selectedIndex].value;
	if(actType=="remove"){
		document.getElementById("removeContain").style.display="block";
	}
	else{
		document.getElementById("removeContain").style.display="none";
	}
}
function addParentOption()
{
	var arr = showModalDialog("tree_container.asp", "", "dialogWidth:410px; dialogHeight:420px; status:0");
  	if (arr != null){  
   		document.form1.toCatalogId.options[0]=new Option(arr[1],arr[0]);
  	}
	
}
</script>
</body>
</html>
<%
call connclose()
%>
执行时间：<%=CStr(FormatNumber((Timer-BeginTime)*1000,2))& "毫秒"%>             