<!--#include file="../include/hf_conn.asp"-->
<!--#include file="checkadmin.asp"-->
<!--#include file="Inc/Ubbcode.asp"-->
<!--#include file="Inc/Function.asp"-->
<script language=javascript src=../include/mouse_on_title.js></script>
<%
call checkmanage("03")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="manage.css" type="text/css">
</head>
<BODY background="../images/admin/back.gif">
<%
dim strFileName
const MaxPerPage=20
dim totalPut,CurrentPage,TotalPages
dim i,j
dim ProductID
dim Title
dim sql,rs
dim BigClassID,SmallClassName,SpecialName
dim PurviewChecked
dim strAdmin,arrAdmin
PurviewChecked=false
strFileName="ProductManage_sbzs.asp?BigClassID=" & BigClassID & "&SmallClassName=" & SmallClassName & "&SpecialName=" & SpecialName

Title=Trim(request("Title"))
ProductID=Request("ProductID")
BigClassID=Trim(request("BigClassID"))
SmallClassName=Trim(request("SmallClassName"))
SpecialName=trim(request("SpecialName"))

if request("page")<>"" then
currentPage=cint(request("page"))
else
	currentPage=1
end if

sql="select * from hf_sbzs where ProductID>0"
if session("purview")>4 then
	sql=sql & " and Editor='" & Session("admin") & "' and Passed=false"
end if
if Title<>"" then
	sql=sql & " and title like '%" & Title & "%' "
end if
if BigClassID<>"" then
	sql=sql & " and BigClassID='" & BigClassID & "' "
	if SmallClassName<>"" then
		sql=sql & " and SmallClassName='" & SmallClassName & "' "
	end if
else
	if SpecialName<>"" then
		sql=sql & " and SpecialName='" & SpecialName & "' "
	end if
end if
sql=sql & " order by ProductID desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
%>
<SCRIPT language=javascript>
function unselectall()
{
if(document.del.chkAll.checked){
	document.del.chkAll.checked = document.del.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.checked = form.chkAll.checked;
}
}
function ConfirmDel()
{
 if(confirm("确定要删除选中的产品吗？一旦删除将不能恢复！"))
 return true;
 else
 return false;
	 
}

</SCRIPT>
<table width="98%" border="1"  style="border-collapse: collapse; border-style: dotted; border-width: 0px" bordercolor="#333333" cellspacing="0" cellpadding="2">
<tr> 
<td align="center" valign="top">
<br>
<strong>产 品 管 理</strong><br>
<br>

<table width="98%" border="1"  style="border-collapse: collapse; border-style: dotted; border-width: 0px" bordercolor="#333333" cellspacing="0" cellpadding="2">
<tr> 
<td class="td" height="25">|&nbsp; 
<%
dim sqlBigClass,sqlSmallClass,rsBigClass,rsSmallClass,sqlSpecial,rsSpecial
sqlBigClass="select * from BigClass_sbzs"
Set rsBigClass= Server.CreateObject("ADODB.Recordset")
rsBigClass.open sqlBigClass,conn,1,1
if rsBigClass.eof then 
	response.Write("还没有任何栏目，请首先添加栏目。")
end if
do while not rsBigClass.eof
	if rsBigClass("BigClassID")=BigClassID then
		response.Write("<a href='ProductManage_sbzs.asp?BigClassID=" & rsBigClass("BigClassID") & "'>" & rsBigClass("BigClassID") & "</a> | ")
		if session("purview")=3 then
			strAdmin=rsBigClass("Admin")
			if Instr(strAdmin,"|")>0 then
				arrAdmin=split(strAdmin)
				for i=0 to ubound(arrAdmin)
					if trim(arrAdmin(i))=session("admin") then
						PurviewChecked=True
						exit for
					end if
				next
			else
				if trim(strAdmin)=session("Admin") then
					PurviewChecked=True
				end if
			end if
		end if
	else
		response.Write("<a href='ProductManage_sbzs.asp?BigClassID=" & rsBigClass("BigClassID") & "'>" & rsBigClass("BigClassname") & "</a> | ")
	end if
	rsBigClass.movenext
loop
rsBigClass.close
set rsBigClass=nothing
%>
</td>
</tr>
</table>
<form name="del" method="Post" action="ProductDel_sbzs.asp" onsubmit="return ConfirmDel();">
<table width="95%" border="0" cellpadding="0" cellspacing="0" class="HeaderTdStyle">
<tr> 
<td class="td" height="25"><a href="productManage_sbzs.asp">&nbsp;产品管理</a> 
&gt;&gt; 
<%
if request.querystring="" then
	response.write "所有产品"
else
	if request("Query")<>"" then
		if Title<>"" then
			response.write "名称中含有“<font color=blue>" & Title & "</font>”的产品"
		else
			response.Write("所有产品")
		end if
 	else
	    set list=Server.CreateObject("ADODB.Recordset")
		list.open "select * from bigclass_sbzs where bigclassid="&bigclassid,conn,3,3
		
		if BigClassID<>"" then
			response.write "<a href='ProductManage_sbzs.asp?BigClassID=" & BigClassID & "'>" & list("bigclassname") & "</a>&nbsp;&gt;&gt;&nbsp;"
			list.close
			set list=nothing
		end if

	end if
end if
%>
</td>
<td width="150">&nbsp;
<%
	if rs.eof and rs.bof then
		response.write "共有 0 个产品</td></tr></table>"
	else
	totalPut=rs.recordcount
		if currentpage<1 then
 		currentpage=1
	end if
	if (currentpage-1)*MaxPerPage>totalput then
	 		if (totalPut mod MaxPerPage)=0 then
	 		currentpage= totalPut \ MaxPerPage
			else
			currentpage= totalPut \ MaxPerPage + 1
	 		end if

	end if
		response.Write "共有 " & totalPut & " 个产品"
%>
</td>
</tr>
</table>
<br>
<%		
	if currentPage=1 then
	showContent
	showpage strFileName,totalput,MaxPerPage,true,false,"个产品"
 	 	else
 	 	if (currentPage-1)*MaxPerPage<totalPut then
 	 	rs.move(currentPage-1)*MaxPerPage
 		dim bookmark
 		bookmark=rs.bookmark
	showContent
	showpage strFileName,totalput,MaxPerPage,true,false,"个产品"
	else
		currentPage=1
 		showContent
 		showpage strFileName,totalput,MaxPerPage,true,false,"个产品"
		end if
		end if
	end if
%>
<%
sub showContent
 	dim i
i=0
%>
<table width="95%" border="0" cellpadding="3" cellspacing="1" bgcolor="#666666" style="word-break:break-all">
<tr bgcolor="#C0C0C0" class="td"> 
<td width="47" height="25" align="center" >选中</td>
<td width="28"height="25" align="center" class="td"><strong>ID</strong></td>
<td width="82" align="center"  ><strong>产品编号</strong></td>
<td width="200" align="center"  ><strong>产品名称</strong></td>
<td align="center"   ><strong>点击数</strong></td>
<td width="68" align="center"  ><strong>加入时间</strong></td>
<td width="68" align="center"  ><strong>审核情况</strong></td>
<td width="80" align="center"  ><strong>操作</strong></td>
</tr>
<%do while not rs.eof%>
<tr class="tdbg"> 
<td width="47" height="22" align="center" bgcolor="#C0C0C0"> <input name='ProductID' type='checkbox' onclick="unselectall()" id="ProductID" value='<%=cstr(rs("ProductID"))%>'> 
</td>
<td width="28" align="center" bgcolor="#E3E3E3"><%=rs("ProductID")%></td>
<td width="82" align="center" bgcolor="#E3E3E3"><%=rs("Product_Id")%></td>
<td bgcolor="#E3E3E3"><a href="../hf_sbzslist.asp?id=<%=rs("ProductID")%>" target="_blank"><%=rs("title")%></a></td>
<td width="68" align="center" bgcolor="#E3E3E3"><%=rs("Hits")%></td>
<td width="68" align="center" bgcolor="#E3E3E3"><%= FormatDateTime(rs("UpdateTime"),2) %></td>
<td width="68" align="center" bgcolor="#E3E3E3"> 
<%if rs("Passed")=true then%>
已审核 
<%else%>
<font color="#FF0000">未审核</font> 
<%end if%>
</td>
<td width="80" align="center" bgcolor="#E3E3E3"> 
<a href="ProductModify_sbzs.asp?ProductID=<%=rs("ProductID")%>">修改</a> 
<a href="ProductDel_sbzs.asp?ProductID=<%=rs("ProductID")%>&Action=Del" onclick="return ConfirmDel();">删除</a> 
</td>
</tr>
<%
	i=i+1
	if i>=MaxPerPage then exit do
	rs.movenext
	loop
%>
</table>
<table width="95%" border="0" cellpadding="0" cellspacing="0">
<tr> 
<td width="250" height="30"><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
选中本页显示的所有产品</td>
<td><input name="submit" type='submit' value='删除选定的产品' <%if session("purview")>=3 and session("purview")<=4 and PurviewChecked=False then response.write "disabled"%>> 
<input name="Action" type="hidden" id="Action" value="Del"></td>
</tr>
</table>
<%
 end sub 
%>
</form>
<table width="620" border="0" cellpadding="0" cellspacing="0" class="border">
<tr class="tdbg">
<form name="searchsoft" method="get" action="productManage_sbzs.asp">
<td height="30"> <strong>查找产品：</strong> 
<input name="Title" type="text" class=smallInput id="Title3" size="20" maxlength="50"> 
<input name="Query" type="submit" id="Query" value="查 询">
&nbsp;&nbsp;请输入产品名称。如果为空，则查找所有产品。</td>
</form>
</tr>
</table></td>
</tr>
</table>
<%
rs.close
set rs=nothing
call CloseConn()
%>