<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!--#include file="../inc/function.asp"-->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p21")
'''''''''''''''''''''''''''''''''''''''''''''''
%>
<%
dim recpage,i,act,currentpage,p_date,p_price,p_infotype,p_pid,p_cid,p_province,p_city,urls,first,c_pid,p_key,p_check,p_top,p_hot
if(request.QueryString("page")<>"") then
	currentpage=Clng(request.QueryString("page"))
else
	currentpage=1
end if
act=request.QueryString("act")
recpage=30
if(request.QueryString("p_date")<>"") then
	p_date=clng(request.QueryString("p_date"))
else
	p_date=0
end if
if(request.QueryString("p_price")<>"") then
	p_price=clng(request.QueryString("p_price"))
else
	p_price=0
end if

if(request.QueryString("p_infotype")<>"") then
	p_infotype=clng(request.QueryString("p_infotype"))
else
	p_infotype=0
end if
if(request.QueryString("p_pid")<>"") then
	p_pid=clng(request.QueryString("p_pid"))
else
	p_pid=0
end if
if(request.QueryString("p_cid")<>"") then
	p_cid=clng(request.QueryString("p_cid"))
	c_pid=p_cid
else
	p_cid=0
	c_pid=PlugIn_InfoId
end if
if(request.querystring("p_province")<>"") then
	p_province=cint(request.querystring("p_province"))
else
	p_province=-1
end if
if(request.querystring("p_city")<>"") then
	p_city=cint(request.querystring("p_city"))
else
	p_city=-1
end if

if(request.querystring("p_key")<>"") then
	p_key=replace(request.querystring("p_key"),"'","")
else
	p_key=""
end if
if(request.QueryString("p_check")<>"") then
	p_check=clng(request.QueryString("p_check"))
else
	p_check=0
end if
if(request.QueryString("p_hot")<>"") then
	p_hot=clng(request.QueryString("p_hot"))
else
	p_hot=0
end if
if(request.QueryString("p_top")<>"") then
	p_top=clng(request.QueryString("p_top"))
else
	p_top=0
end if
urls="act=do&p_date="&p_date&"&p_price="&p_price&"&p_infotype="&p_infotype&"&p_pid="&p_pid&"&p_cid="&p_cid&"&p_province="&p_province&"&p_city="&p_city&"&p_key="&p_key&"&p_check="&p_check&"&p_hot="&p_hot&"&p_top="&p_top
%>
<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 type="text/javascript" src="../js/prototype.js"></script>
<script type="text/javascript" src="../js/effects.js"></script>
<script type="text/javascript" src="../js/validation.js"></script>
<script type="text/javascript" src="/js/areas.js"></script>
<script type="text/javascript">
function selectcity(provinceid,cityid){	
var citySelect=document.PostForm.p_city;
citySelect.options.length = 0;		
new Ajax.Request('/member/get_citys.asp?pid='+provinceid,
  {
    method:'get',
    onSuccess: function(transport){
			var response = transport.responseXML.documentElement;
			var classidList = response.getElementsByTagName('city');	
			
			for(var i=0;i<classidList.length;i++){
				xx=classidList[i].getElementsByTagName('id');
				yy=classidList[i].getElementsByTagName('title');
				classid=xx[0].firstChild.data
				classtitle=yy[0].firstChild.data				
				citySelect.options[i]=new Option(classtitle,classtitle);							
				if(cityid==classtitle){
					citySelect.options[i].selected=true;
				}
			}
		},
    onFailure: function(){ alert('Something went wrong...') }
  });
}
////////////////////////	
function getCatalogs(pid,cid){
	var childs=$('p_cid');
	if(pid==0){
		childs.options[0]=new Option('不限',0);
		return;
	}
new Ajax.Request('/member/getchilds.asp?classid='+pid,
  {
    method:'get',
    onSuccess: function(transport){
      var response = transport.responseXML.documentElement;
			var classidList = response.getElementsByTagName('catalog');	
			childs.options[i]=new Option("不限",0);
			for(var i=0;i<classidList.length;i++){
				xx=classidList[i].getElementsByTagName('id');
				yy=classidList[i].getElementsByTagName('title');
				classid=xx[0].firstChild.data
				classtitle=yy[0].firstChild.data				
				childs.options[i+1]=new Option(classtitle,classid);							
				if(cid==classid){
					childs.options[i].selected=true;
				}
			}
    },
    onFailure: function(){ alert('Something went wrong...') }
  });
}
</script>
<script language="javascript">
function goto(frm)
{
	var gourl ="?<%=urls%>&";
	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="PostForm" method="get" action="?" id="PostForm">
  <div align="center">
    <select name="p_infotype">
      <option value="1" <%if(p_infotype=0) then response.write("selected") end if %>>不限</option>
      <option value="1" <%if(p_infotype=1) then response.write("selected") end if %>>供</option>
      <option value="2" <%if(p_infotype=2) then response.write("selected") end if %>>求</option>
    </select>
    <select name="p_pid" id="p_pid" onChange="getCatalogs(this.options[this.selectedIndex].value,0)">
      <option value="0">不限</option>
      <%
		dim sele
		set rs=server.CreateObject("adodb.recordset")
		rs.open "select id,title from catalogs where parentid="&PlugIn_InfoId&" order by id asc",conn,3,1
		if not rs.eof and not rs.bof then
			first=rs.GetRows()
		else
			
		end if
		rs.close
		set rs=nothing
		 for i=0 to ubound(first,2)
		 		if(first(0,i)=p_pid) then
					sele="selected"
				else
					sele=""
				end if
				response.Write("<option value="""&first(0,i)&""" "&sele&">"&first(1,i)&"</option>"&Chr(10))    	
  	next	
		%>
    </select>
    <select name="p_cid" id="p_cid">
      <option value="0">请选择二级分类</option>
    </select>
    <%
		if(p_pid>0) then
		%>
    <script type="text/javascript">
		getCatalogs(<%=p_pid%>,<%=p_cid%>);	
		</script>
    <%end if%>
    <select name="p_date">
      <option value="0" <%if(p_date=0) then response.write("selected") end if %>>不限日期</option>
      <option value="1" <%if(p_date=1) then response.write("selected") end if %>>一天之内</option>
      <option value="7" <%if(p_date=7) then response.write("selected") end if %>>一周之内</option>
      <option value="30" <%if(p_date=30) then response.write("selected") end if %>>一个月之内</option>
      <option value="180" <%if(p_date=180) then response.write("selected") end if %>>半年之内</option>
      <option value="360" <%if(p_date=360) then response.write("selected") end if %>>一年之内</option>
    </select>
    <select name="p_price">
      <option value="0" <%if(p_price=0) then response.write("selected") end if %>>不限价格</option>
      <option value="1" <%if(p_price=1) then response.write("selected") end if %>>0-100</option>
      <option value="2" <%if(p_price=2) then response.write("selected") end if %>>100-500</option>
      <option value="3" <%if(p_price=3) then response.write("selected") end if %>>500-1000</option>
      <option value="4" <%if(p_price=4) then response.write("selected") end if %>>1000-5000</option>
      <option value="5" <%if(p_price=5) then response.write("selected") end if %>>5000以上</option>
    </select>
    <select name="p_province" id="p_province" onChange="GetChilds(this.options[this.selectedIndex].value,0,'p_city')">
        <option value="0">选择城市</option>
        <script type="text/javascript">
				document.write(GetFirst(<%=p_province%>,''));
        </script>
      </select>
      <select name="p_city" id="p_city">
        <option value="0">选择地区</option>
      </select>	
      <script type="text/javascript">
				GetChilds(<%=p_province%>,<%=p_city%>,'p_city');
      </script>
    <select name="p_top">
      <option value="0" <%if(p_top=0) then response.write("selected") end if %>>不限</option>
      <option value="1" <%if(p_top=1) then response.write("selected") end if %>>置顶</option>
    </select>
    <select name="p_hot">
      <option value="0" <%if(p_hot=0) then response.write("selected") end if %>>不限</option>
      <option value="1" <%if(p_hot=1) then response.write("selected") end if %>>热点</option>
    </select>
    <input name="p_key" type="text" id="p_key" value="<%=p_key%>">
    <input type="hidden" name="act" value="do">
    <input type="hidden" name="p_check" value="-1">
    <input type="submit" name="Input" value="查看">
  </div>
</form>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>[<a href="?p_check=-1&p_top=-1&p_hot=-1">全部</a>] <a href="?p_check=0">未审核</a> <a href="?p_check=1">已审核</a> <a href="?p_top=1&p_check=-1">置顶</a> <a href="?p_hot=1&p_check=-1">热点</a></td>
  </tr>
</table>
<form action="info_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="10"><div align="center" class="style1">◆ 信息管理 ◆</div></td>
  </tr>
  <tr bgcolor="#EEEEEE">
    <td width="5%">&nbsp;</td>
    <td width="5%" height="22"><div align="center">ID</div></td>
    <td width="10%"><div align="center">分类</div></td>
    <td width="8%"><div align="center">价格</div></td>
    <td width="30%"><div align="center">标题</div></td>
    <td width="13%"><div align="center">添加时间</div></td>
    <td width="8%"><div align="center">热点</div></td>
    <td width="7%"><div align="center">置顶</div></td>
    <td width="7%"><div align="center">审核</div></td>
    <td width="7%"><div align="center">修改</div></td>
    </tr>
  <!-- 开始按行循环----------------------->
  <%
  	dim offset
		
		offset=(currentpage-1)*recpage
		if offset=0 then
			offset=1
		else
			offset=offset+1
		end if
		searchStr="select top "&recpage&" id,InfoTypeId,Title,PubDate,Price,Province,City,SavePath,IsCheck,IsDel,IsHot,IsTop,Photo,PubIp,UserId,ParentId from t_info where id <=(select min(id) from (select top "&offset&" id from t_info where 1=1"
		if(p_date>0) then
			searchStr=searchStr&" and DATEDIFF(Day, PubDate, getdate())< "&p_date
		end if
		if(p_infotype>0) then
			searchStr=searchStr&" and InfoTypeId="&p_infotype
		end if		
		if(p_pid>0) then
			searchStr=searchStr&" and ParentId="&p_pid
		end if
		if(p_cid>0) then
			searchStr=searchStr&" and CatalogId="&p_cid
		end if
		if(p_province>0) then
			searchStr=searchStr&" and Province="&p_province
		end if
		if(p_city>0) then
			searchStr=searchStr&" and City="&p_city
		end if
		if(p_key<>"") then
			searchStr=searchStr&" and Title like '%"&p_key&"%'"
		end if
		if(p_check>=0) then
			searchStr=searchStr&" and IsCheck="&p_check
		end if
		if(p_top>=0) then
			searchStr=searchStr&" and IsTop="&p_top
		end if
		if(p_hot>=0) then
			searchStr=searchStr&" and IsHot="&p_hot
		end if
		select case p_price
			case 1
				searchStr=searchStr&" and Price>=0 and Price<=100"
			case 2
				searchStr=searchStr&" and Price>100 and Price<=500"
			case 3
				searchStr=searchStr&" and Price>500 and Price<=1000"
			case 4
				searchStr=searchStr&" and Price>1000 and Price<=5000"
			case 5
				searchStr=searchStr&" and Price>5000"
		end select
		searchStr=searchStr&" order by id desc) as t) "
		if(p_date>0) then
			searchStr=searchStr&" and DATEDIFF(Day, PubDate, getdate())< "&p_date
		end if
		if(p_infotype>0) then
			searchStr=searchStr&" and InfoTypeId="&p_infotype
		end if
		if(p_pid>0) then
			searchStr=searchStr&" and ParentId="&p_pid
		end if
		if(p_cid>0) then
			searchStr=searchStr&" and CatalogId="&p_cid
		end if
		if(p_check>=0) then
			searchStr=searchStr&" and IsCheck="&p_check
		end if
		if(p_top>=0) then
			searchStr=searchStr&" and IsTop="&p_top
		end if
		if(p_hot>=0) then
			searchStr=searchStr&" and IsHot="&p_hot
		end if
		if(p_province>0) then
			searchStr=searchStr&" and Province="&p_province
		end if
		if(p_city>0) then
			searchStr=searchStr&" and City="&p_city
		end if
		if(p_key<>"") then
			searchStr=searchStr&" and Title like '%"&p_key&"%'"
		end if
		select case p_price
			case 1
				searchStr=searchStr&" and Price>=0 and Price<=100"
			case 2
				searchStr=searchStr&" and Price>100 and Price<=500"
			case 3
				searchStr=searchStr&" and Price>500 and Price<=1000"
			case 4
				searchStr=searchStr&" and Price>1000 and Price<=5000"
			case 5
				searchStr=searchStr&" and Price>5000"
		end select
		searchStr=searchStr&" order by id desc"
		countStr="select count(*) from t_info where 1=1"
		if(p_date>0) then
			countStr=countStr&" and DATEDIFF(Day, PubDate, getdate())< "&p_date
		end if		
		if(p_infotype>0) then
			countStr=countStr&" and InfoTypeId="&p_infotype
		end if
		if(p_pid>0) then
			countStr=countStr&" and ParentId="&p_pid
		end if
		if(p_cid>0) then
			countStr=countStr&" and CatalogId="&p_cid
		end if
		if(p_province>0) then
			countStr=countStr&" and Province="&p_province
		end if
		if(p_city>0) then
			countStr=countStr&" and City="&p_city
		end if
		if(p_key<>"") then
			countStr=countStr&" and Title like '%"&p_key&"%'"
		end if
		if(p_check>=0) then
			countStr=countStr&" and IsCheck="&p_check
		end if
		if(p_top>=0) then
			countStr=countStr&" and IsTop="&p_top
		end if
		if(p_hot>=0) then
			countStr=countStr&" and IsHot="&p_hot
		end if
		select case p_price
			case 1
				countStr=countStr&" and Price>=0 and Price<=100"
			case 2
				countStr=countStr&" and Price>100 and Price<=500"
			case 3
				countStr=countStr&" and Price>500 and Price<=1000"
			case 4
				countStr=countStr&" and Price>1000 and Price<=5000"
			case 5
				countStr=countStr&" and Price>5000"
		end select
		allrec=conn.execute(countStr)(0)
		totalpage=Cint((allrec-1+recpage)/recpage)
		'response.Write(searchStr)
		set rs=server.createobject("adodb.recordset")
  		rs.open searchStr,conn,3,1
		if not rs.eof then
			resultArr=rs.GetRows()			
		end if
		rs.close
	  set rs=nothing
		if(isarray(resultArr)) then
			for i=0 to ubound(resultArr,2)
	%>
  <tr>
    <td bgcolor="#FFFFFF"><div align="center"><input type="checkbox" name="newsid" value="<%=resultArr(0,i)%>"></div></td>
    <td height="20" bgcolor="#FFFFFF"><div align="center"><%=resultArr(0,i)%></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><a href="../list.asp?pid=<%=resultArr(15,i)%>" target="_blank">
    <%
			select case(resultArr(15,i))
				case 2
					response.Write("二手市场")
				case 3
					response.Write("招聘求职")
				case 4
					response.Write("车辆信息")
				case 5
					response.Write("生活服务")
				case 6
					response.Write("同城情缘")
				case 7
					response.Write("商务服务")
				case 8
					response.Write("教育培训")
				case 9
					response.Write("其它信息")
			end select 
		%></a>
    </div></td>
    <td bgcolor="#FFFFFF">
	<div align="center"><a href="<%=resultArr(8,i)%>" target="_blank"><font color=#0000ff><%=resultArr(4,i)%></font></a></div></td>
    <td bgcolor="#FFFFFF">
      <div align="left">
      <a href="/show.asp?id=<%=resultArr(0,i)%>" class="blue" target="_blank"><%=resultArr(2,i)%></a></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=resultArr(3,i)%><br><%=resultArr(13,i)%><br><%=resultArr(14,i)%></div></td>
    <td bgcolor="#FFFFFF"><div align="center">
      <%
	if(resultArr(10,i)=0) then
		response.Write("否")
	else
		response.Write("<font color=""red"">是</font>")
	end if
	%>
    </div></td>
    <td bgcolor="#FFFFFF"><div align="center">
      <%
	if(resultArr(11,i)=0) then
		response.Write("否")
	else
		response.Write("<font color=""red"">是</font>")
	end if
	%>
    </div></td>
    <td bgcolor="#FFFFFF">
      <div align="center">
        <%
	if(resultArr(8,i)=1) then 
		response.Write("<a href=""info_check.asp?id="&resultArr(0,i)&"&val=0""><font color=""red"">√</font></a>")
	else
		response.Write("<a href=""info_check.asp?id="&resultArr(0,i)&"&val=1"">×</a>")
	end if
	%>
      </div></td>
    <td bgcolor="#FFFFFF"><div align="center"><a href="info_mod.asp?id=<%=resultArr(0,i)%>">修改</a></div></td>
    </tr>
  
  <%
	next	
	end if  
  %>
  <tr>
    <td height="22" colspan="10" 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(document.form1)">
            <input class=Button type="button" name="chksel" value="反选" onClick="ContraSel(document.form1)">
            管理选项：
            <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_InfoId&" 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='?"&urls&"&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='?"&urls&"&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()
%>