<!--#include file="include/check_admin.asp"-->
<!--#include FILE="../include/upload_5xsoft.inc"-->
<%
Check_Power("0101,")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>内容管理</title>
<!--#include file="../conn/conn.asp" -->
<%
dim idarr
cmd=Request("cmd")
if Request.Form("cmd")<>"" then cmd=Request.Form("cmd")
zxt_news_class_id=Clng(Request("zxt_news_class_id"))
zxt_news_id=Clng(Request("zxt_news_id"))
ArticleID=trim(request("ArticleID"))
Select Case cmd
	Case "Open":Open
	Case "del":
		Del
		referrer
	Case "shenghe_all":
		if instr(ArticleID,",")>0 then
			idArr=split(ArticleID)
			for i = 0 to ubound(idArr)
				zxt_news_id=clng(idarr(i))
				shenhe 1
			next
		end if
		Response.Write("<script language=""javascript"">alert('审核成功！');</script>")
		referrer
	Case "del_all":
		if instr(ArticleID,",")>=0 then
			idArr=split(ArticleID)
			for i = 0 to ubound(idArr)
				zxt_news_id=clng(idarr(i))
				Del
			next
		end if
		Response.Write("<script language=""javascript"">alert('删除成功！');</script>")
		referrer
	Case "shenhe":
		shenhe 1
		referrer
	Case "shenhed":
		shenhe 0
		referrer
	Case "user_pass":
		user_pass 1
		referrer
	Case "user_no":
		user_pass 0
		referrer
	Case Else:
End Select
function shenhe(pass)
	zxt_conn.Execute("Update zxt_news Set zxt_news_passed="&pass&" Where zxt_news_id="&zxt_news_id&" and zxt_news_user_id="&session("admin_id"))
end function
function user_pass(pass)
	zxt_conn.Execute("Update zxt_news Set zxt_news_user="&pass&" Where zxt_news_id="&zxt_news_id&" and zxt_news_user_id="&session("admin_id"))
end function

sub showpage(sfilename,totalnumber,maxperpage,ShowTotal,ShowAllPages,strUnit)
	dim n, i,strTemp,strUrl
	if totalnumber mod maxperpage=0 then
    	n= totalnumber \ maxperpage
  	else
    	n= totalnumber \ maxperpage+1
  	end if
  	strTemp= "<table align='center'><form name='showpages' method='Post' action='" & sfilename & "'><tr><td>"
	if ShowTotal=true then 
		strTemp=strTemp & "共 <b>" & totalnumber & "</b> " & strUnit & "&nbsp;&nbsp;"
	end if
	strUrl=JoinChar(sfilename)
  	if CurrentPage<2 then
    		strTemp=strTemp & "首页 上一页&nbsp;"
  	else
    		strTemp=strTemp & "<a href='" & strUrl & "page=1'>首页</a>&nbsp;"
    		strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage-1) & "'>上一页</a>&nbsp;"
  	end if

  	if n-currentpage<1 then
    		strTemp=strTemp & "下一页 尾页"
  	else
    		strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage+1) & "'>下一页</a>&nbsp;"
    		strTemp=strTemp & "<a href='" & strUrl & "page=" & n & "'>尾页</a>"
  	end if
   	strTemp=strTemp & "&nbsp;页次：<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页 "
    strTemp=strTemp & "&nbsp;<b>" & maxperpage & "</b>" & strUnit & "/页"
	if ShowAllPages=True then
		strTemp=strTemp & "&nbsp;转到：<select name='page' size='1' onchange='javascript:submit()'>"   
    	for i = 1 to n   
    		strTemp=strTemp & "<option value='" & i & "'"
			if cint(CurrentPage)=cint(i) then strTemp=strTemp & " selected "
			strTemp=strTemp & ">第" & i & "页</option>"   
	    next
		strTemp=strTemp & "</select>"
	end if
	strTemp=strTemp & "</td></tr></form></table>"
	response.write strTemp
end sub

function JoinChar(strUrl)
	if strUrl="" then
		JoinChar=""
		exit function
	end if
	if InStr(strUrl,"?")<len(strUrl) then 
		if InStr(strUrl,"?")>1 then
			if InStr(strUrl,"&")<len(strUrl) then 
				JoinChar=strUrl & "&"
			else
				JoinChar=strUrl
			end if
		else
			JoinChar=strUrl & "?"
		end if
	else
		JoinChar=strUrl
	end if
end function

FuncTion CheckList(ParentID,Cs,str1,del,link)
     Dim j
     j=0
     For i=0 To Ubound(List,2)
           If List(1,i)=ParentID Then                  
                       Response.write(Str1)
                       If j<Cs-1 Then Str2="├" Else Str2="└"
                       Str2="<a class=Link1 href='?cmd=Open&Id="&List(0,i)&"'>"&Str2&"</a>"
                       Response.Write(Str2)

                 Response.Write "<a Href='"&link&"?zxt_news_class_id="&List(0,i)&"&zxt_news_class_title="&List(2,i)&"'>"&List(2,i)&"</a>　"&VBcrlf
				 if del=1 then 
				 	Response.Write "<a Title=""删除此节点"&VBCRLF&"此节点的子节点将向上递进一层!"" href='JavaScript:Del("&List(0,i)&");'><span class=""red"">删除</span></a>"
				end if
                 Response.Write "<BR>"
                 If j<Cs-1 Then CheckList List(0,i),10,Str1&"┆",del,link Else CheckList List(0,i),10,Str1&"　",del,link  '关键所在,递归调用
                 j=j+1
           End IF
     Next
End Function


function referrer()
%>
<script>
  location.href=document.referrer;
</script>
<%
end function

Function Del
    zxt_conn.Execute("Delete From zxt_news Where zxt_news_id="&zxt_news_id&" and zxt_news_user_id="&session("admin_id")) 
    If Err.Number<>0 Then 
        Response.Write("<script language=""javascript"">alert('删除操作失败！');</script>")
    End If
End Function

dim strFileName
const MaxPerPage=10
dim totalPut,CurrentPage,TotalPages
dim ArticleID
dim Title
dim sql,rs
Title=Trim(request("Title"))
ArticleID=Request("ArticleID")
strFileName="news_manage.asp?zxt_news_class_id=" & zxt_news_class_id & "&title=" & title
if Trim(Request("zxt_news_class_title"))<>"" then Session("zxt_news_class_title")=Trim(Request("zxt_news_class_title"))

if request("page")<>"" then
    currentPage=cint(request("page"))
else
	currentPage=1
end if
sql="select * from zxt_news where zxt_news_user_id="&session("admin_id")&" "
if Title<>"" then
	sql=sql & "and zxt_news_title like '%" & Title & "%' "
end if
if zxt_news_class_id>0 then
	sql=sql & "and zxt_news_class=" & zxt_news_class_id & " "
end if
sql=sql & "order by zxt_news_id desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,zxt_conn,3,2
%>
<link rel="stylesheet" type="text/css" href="images/css.css">
<style Type=Text/Css>
a.link1:link { color: #FF0000; text-decoration:none}
a.link1:visited { color: #FF0000; text-decoration: none}
a.link1:hover { color: #FF0000; text-decoration: none; background-color: #eeeeee}
</style>
<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(document.getElementById('cmd').value=='del_all'){
	   	if(confirm("确定要删除选中的内容吗？一旦删除将不能恢复！"))
		 	return true;
	   	else
		 	return false;
	}
}
function del(ID){
	if(confirm('确定要删除此用户\n确定要继续吗?')){
		window.location.href='news_manage.asp?cmd=del&zxt_news_id='+ID;
	}
}
function checkform(){
	if(document.getElementById('title').value==''){
		alert('请填写要搜索的内容！');
		document.getElementById('title').focus();
		return false;
	}else{
		return true;
	}
}
</SCRIPT>
</head>
<body>
<br>
<table class="helpbox" width="95%" align="center" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="160" height="275" valign="top"><table width="100%" border="0" cellpadding="5" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="160" height="25" valign="top" bgcolor="#6e9dd1" class="title">选择内容的栏目：</td>
      </tr>
      <tr>
        <td height="160" valign="top">
		<%
			Public List
			Set Rs1=zxt_conn.Execute("Select zxt_news_class_id,zxt_news_class_Parent_id,zxt_news_class_title From zxt_news_class where zxt_news_class_id = 1 order by zxt_news_class_Parent_id,zxt_news_class_order,zxt_news_class_id")
			If Not Rs1.Eof Then
				List =Rs1.GetRows
				Max=zxt_conn.Execute("Select Count(zxt_news_class_Parent_id) From zxt_news_class Where zxt_news_class_Parent_id=0")(0)
				Set Rs1=Nothing
				'Set zxt_conn=Nothing
				CheckList 0,Max,"&nbsp;",0,"news_manage.asp"
			Else
				Set Rs1=Nothing
				'Set zxt_conn=Nothing
			End If
		%></td>
      </tr>
      
      
    </table>
    </td>
	<td width="2" bgcolor="#f0f0f0"></td>
    <td align="center" valign="top">
	<%if zxt_news_class_id>0 or title<>"" or request("page")<>"" then%>
	<table width="98%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td height="5"></td>
        </tr>
    </table>
	<table width="98%" border="0" cellpadding="0" cellspacing="0" class="helpbox">
      <tr>
      <td width="160" height="20" valign="middle" bgcolor="#6e9dd1" class="title">&nbsp;内容管理:</td>
    </tr>
        <tr>
          <td height="22" bgcolor="#f0f0f0">&nbsp;&nbsp;<a href="news_add.asp?zxt_news_class=<%=zxt_news_class_id%>&zxt_news_class_title=<%=Trim(Request("zxt_news_class_title"))%>">添加内容</a></td>
        </tr>
    </table>
	<table width="98%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td height="5"></td>
        </tr>
    </table>
              <%
  	if rs.eof and rs.bof then
	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
	    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%>
	<table width="98%" border="0" cellpadding="0" cellspacing="0">
	  <form name="del" method="Post" onSubmit="return ConfirmDel();">
      <tr>
      <td height="20" valign="middle" bgcolor="#6e9dd1" class="title">&nbsp;<%if title<>"" then Response.Write("以下是您所输入'"&title&"'的搜索结果:") else Response.Write(zxt_conn.Execute("Select zxt_news_class_title From zxt_news_class Where zxt_news_class_id="&zxt_news_class_id)(0)) end if%></td>
    </tr>
        <tr>
          <td height="22" align="center">
		  <%
		  If Not Rs.Eof Then
			strtmp="<table width=""100%"" border=""1"" cellpadding=""0"" cellspacing=""0"" bordercolor=""#e0e0e0"" bordercolordark=""#FFFFFF"" bgcolor=""#ffffff"">"
			strtmp=strtmp & "<tr bgcolor=""#f0f0f0""><td height=""22"">&nbsp;&nbsp;<strong>内容标题</strong>(点击查看)</td><td width=""120"" align=""center""><strong>发布时间</strong></td><td width=""90"" align=""center""><strong>操作</strong></td><td width=""10"" align=""center""><input name=""chkAll"" type=""checkbox"" id=""chkAll"" onclick=""CheckAll(this.form)"" value=""checkbox""></td></tr>"
		  	i=0
			do while not rs.eof
			  strtmp=strtmp & "<tr><td height=""20"">&nbsp;&nbsp;"
			  strtmp=strtmp & "<a href=""http://"&session("admin_url")&"/showart.asp?artid="&rs("zxt_news_id")&"&zxt_news_class_id="&zxt_news_class_id&""" target=""_blank"">"&rs("zxt_news_title")&"</a>"
			  strtmp=strtmp & "</td><td align=""center"">"
			  strtmp=strtmp & rs("zxt_news_time")
			  strtmp=strtmp & "</td><td align=""left"" width=""195"">"
			  strtmp=strtmp & "&nbsp;<a href=""news_edit.asp?zxt_news_id="&rs("zxt_news_id")&"&zxt_news_class_title="&Trim(Request("zxt_news_class_title"))&""">修改</a> | "
			  if rs("zxt_news_passed") then
				  strtmp=strtmp & "<a href=""news_manage.asp?cmd=shenhed&zxt_news_id="&rs("zxt_news_id")&""">审核</a> | "
			  else
				  strtmp=strtmp & "<a href=""news_manage.asp?cmd=shenhe&zxt_news_id="&rs("zxt_news_id")&"""><font style=""color:#ff0000;"">未审核</font></a> | "
			  end if
			  if rs("zxt_news_user") then
				  strtmp=strtmp & "<a href=""news_manage.asp?cmd=user_no&zxt_news_id="&rs("zxt_news_id")&"""><font style=""color:#ff0000;"">会员信息</font></a>"
			  else
				  strtmp=strtmp & "<a href=""news_manage.asp?cmd=user_pass&zxt_news_id="&rs("zxt_news_id")&""">普通信息</a>"
			  end if
			  strtmp=strtmp & " | <a href=""javascript:del("&rs("zxt_news_id")&")"">删除</a>"
			  strtmp=strtmp & "</td><td align=""center"">"
			  strtmp=strtmp & "<input name=""ArticleID"" type=""checkbox"" onClick=""unselectall()"" id=""ArticleID"" value="""&rs("zxt_news_id")&""">"
			  'strtmp=strtmp & "<input name=""Action"" type=""hidden"" id=""Action"" value=""Del"">"
			  strtmp=strtmp & "</td></tr>"
			  i=i+1
			  if i>=MaxPerPage then exit do
			  rs.movenext
			loop
			strtmp=strtmp&"</table>"
			Response.Write(strtmp)
		  else
		  	Response.Write("&nbsp;&nbsp;没有内容,请添加!")
		  end if
		  Set Rs=Nothing
		  'Set zxt_conn=Nothing
		  %></td>
        </tr>
        <tr>
          <td height="5"></td>
        </tr>
        <tr>
          <td height="35" align="center"><label>
            <input name="Submit" type="button" class="btn" value="添加内容" onClick="javascript:window.location='news_add.asp?zxt_news_class=<%=zxt_news_class_id%>&zxt_news_class_title=<%=Trim(Request("zxt_news_class_title"))%>';"><input name="cmd" id="cmd" type="hidden">
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input name="Submit" type="submit" class="btn" id="Submit" value=" 审 核 " onClick="document.getElementById('cmd').value='shenghe_all'">
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input name="Submit" type="submit" class="btn" id="Submit" value=" 删 除 " onClick="document.getElementById('cmd').value='del_all'">
</label></td>
        </tr></form>
    </table>
	<%end sub%>
	<table width="98%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td height="5"></td>
        </tr>
    </table>
	<table width="98%" border="0" cellpadding="0" cellspacing="0" class="helpbox">
      <tr>
      <td width="160" height="20" valign="middle" bgcolor="#6e9dd1" class="title">&nbsp;内容搜索</td>
    </tr>
        <tr class="tdbg"> 
          <form name="searchsoft" method="get" action="" onSubmit="return checkform()">
            <td height="30" bgcolor="#f0f0f0"> <strong>&nbsp;&nbsp;查找内容：</strong> <input name="Title" type="text" class=smallInput id="Title" size="20" maxlength="50"> 
            <input name="Query" type="submit" id="Query" class="btn" value="查 询"> 
            &nbsp;&nbsp;请输入内容名称。</td>
          </form>
        </tr>
    </table>
	<%end if%>&nbsp;
	</td>
  </tr>
</table>
<br>
<table class="helpbox" width="95%" align="center" cellpadding="5" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td><a name="help_01"></a>1、先选定要修改的栏目，再填上相对应的内容。<br>
    <a name="help_02"></a>2、填写内容时，带&quot;<span class="red">*</span>&quot;的为必填的内容。</td>
  </tr>
</table>
</body>
</html>