<%@language=vbscript codepage=936 %>
<!--#include file="conn.asp"-->
<!--#include file="admin.asp"-->
<!--#include file="Inc/Function.asp"-->
<!--#include file="class_page.asp"-->
<!-- #include file="Inc/Head.asp" -->
<!--#include file="../Inc/config.asp"-->
<style>
table{ border:1px solid #D4D4D4;font-family: Arial, Helvetica, sans-serif;font-size: 12px; background-color:#faf9d1}
table td{BORDER-bottom: #D4D4D4 1px dashed;BORDER-right: #D4D4D4 1px dashed;}
		</style>
<% 
If request.Form("button") = "设为推荐" Then
if Request("id")="" then
Response.Write "<script>alert('错误!请选择要操作的记录!');window.location.href='news_manage.asp';</script>" 
response.end()
end if
dim sql4 
sql4="update news set sytj=true where id in ("&Request("id")&")"
conn.Execute ( sql4 )
end if
If request.Form("button") = "取消推荐" Then
if Request("id")="" then
Response.Write "<script>alert('错误!请选择要操作的记录!');window.location.href='news_manage.asp';</script>" 
response.end()
end if
dim sql2 
sql2="update news set sytj=false where id in ("&Request("id")&")"
conn.Execute ( sql2 )
end if
If request.Form("button") = "设为置顶" Then
if Request("id")="" then
Response.Write "<script>alert('错误!请选择要操作的记录!');window.location.href='news_manage.asp';</script>" 
response.end()
end if
dim sql5 
sql5="update news set tt=1 where id in ("&Request("id")&")"
conn.Execute ( sql5 )
end if
If request.Form("button") = "取消置顶" Then
if Request("id")="" then
Response.Write "<script>alert('错误!请选择要操作的记录!');window.location.href='news_manage.asp';</script>" 
response.end()
end if
dim sql6 
sql6="update news set tt=0 where id in ("&Request("id")&")"
conn.Execute ( sql6 )
end if
If request.Form("button") = "设为幻灯" Then
if Request("id")="" then
Response.Write "<script>alert('错误!请选择要操作的记录!');window.location.href='news_manage.asp';</script>" 
response.end()
end if
dim sql7
sql7="update news set tj=true where id in ("&Request("id")&")"
conn.Execute ( sql7 )
end if
If request.Form("button") = "取消幻灯" Then
if Request("id")="" then
Response.Write "<script>alert('错误!请选择要操作的记录!');window.location.href='news_manage.asp';</script>" 
response.end()
end if
dim sql8
sql8="update news set tj=false where id in ("&Request("id")&")"
conn.Execute ( sql8 )
end if
If request.Form("button") = "批量删除" Then
if Request("id")="" then
Response.Write "<script>alert('错误!请选择要操作的记录!');window.location.href='news_manage.asp';</script>" 
response.end()
end if
for y=1 to request("ID").count
if request("ID").count=1 then
ArticleID=request("ID")
else
ArticleID=replace(request("id")(y),"'","")
end if	
set rs=server.CreateObject("adodb.recordset")
sql = "select * from news where id ="&ArticleID&""
rs.open sql,conn,1,3
pone=rs("zmone")
if rs("zdfy")=0 then
if Instr(rs("content"),"[zmcmsfy]")=0 then
call DeleteFile("../showinfo/"&NewName&""&Separated&""&pone&""&Separated&""&ArticleID&""&Separated&"1.html")
else
arrContent=split(rs("content"),"[zmcmsfy]")
pages=Ubound(arrContent)+1
for j=1 to pages
call DeleteFile("../showinfo/"&NewName&""&Separated&""&pone&""&Separated&""&ArticleID&""&Separated&""&j&".html") 
next
end if
else
ContentLen=len(rs("content")) '文章内容长度
maxpages=int(ContentLen/zdfy) '计算分页数
If (maxpages * zdfy)<ContentLen Then
maxpages=maxpages+1
End If
if maxpages<=1 then
call DeleteFile("../showinfo/"&NewName&""&Separated&""&pone&""&Separated&""&ArticleID&""&Separated&"1.html")
else
for n=1 to maxpages
call DeleteFile("../showinfo/"&NewName&""&Separated&""&pone&""&Separated&""&ArticleID&""&Separated&""&n&".html")
next
end if
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from news where ID in ("&ArticleID&")",conn,0,1
dim picUrl
dim picUrlArray
dim x,y
picUrl = getPicUrl(rs("content"))
if picUrl <> "" then
picUrl = left(picUrl,len(picUrl)-1)
picUrlArray = split(picUrl,",")
for x = 0 to ubound(picUrlArray)
if instr(picUrlArray(x),"") > 0 then
DeleteFile(picUrlArray(x))
end if
next
end if
next
conn.Execute ( "delete from news where id in ("&Request("id")&")" )
response.Write "<script language=javascript>alert(""删除成功！"");window.location.href=""news_manage.asp""</script>"
end if
%> 


<form name="zmqy" method="Post">
  <%
DB_Sql = "select * from news "
DB_Sql = DB_Sql & "order by tt desc, ID desc"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open DB_Sql,Conn,1,1
If Not(rs.Bof and rs.Eof) Then


'================================================
'调用分页类开始
Dim Obj_Page, Obj_PageListnum, II
Obj_PageListnum = 20 

Set Obj_Page = New HHYY_Pageclass

Obj_Page.Setpage_RS = rs
Obj_Page.Setpage_Listnum = Obj_PageListnum

Obj_Page.Setpage_Pathurl = "news_manage.asp" '执行分页的页面
Obj_Page.Setpage_Navtype = 1 '分页导航样式(可选1文字,2数字)

Call Obj_Page.Page_Init() '初始化分页
%>
  <table width="98%"  border="0" cellpadding="6" cellspacing="0"  bgcolor="#f9f9f9" align="center">
  		
          <tr   >
            <td background="images/lin.gif" ><div align="center">全选</div></td>
            <td background="images/lin.gif"><div align="center">ID</div></td>
            <td height="30" background="images/lin.gif"><div align="center">新闻</div></td>
            <td background="images/lin.gif"><div align="center">发布日期</div></td>
            <td background="images/lin.gif"><div align="center">浏览次数</div></td>
            <td background="images/lin.gif"><div align="center">基本操作</div></td>
          </tr>
<%
'/循环开始
For II = 1 to Obj_PageListnum
If rs.Eof Then
	Exit For
End If
%>
          <tr   onMouseOver="style.backgroundColor='#faf9d1'" onMouseout="style.backgroundColor='#FFF'"  style="line-height:3;"> 
            <td width="5%" > 
              <div align="center">
  <input name="ID" type="checkbox" id="ID" value="<%=rs("id")%>" />
 </div></td>
		    <td width="4%"><div align="center"><%=rs("id")%></div></td>
		    <td width="42%">
			<%
			if rs("tt")=1 then
response.Write("<font color=#FF0000>[置顶]</font>")
else
end if%>
<% if rs("gg")=false then%>
 <%
if rs("sytj")=true then
response.Write("<img src=""image/tj.gif"" alt=""推荐新闻""/>")
else
end if



if rs("tj")=true then
response.Write("<font color=#FF0000>[ 幻灯新闻 ]</font>")
else
end if
%>
 		
	          [
	          <%dim rsc
		  set rsc=server.CreateObject("adodb.recordset")
		  rsc.open "select * from newsclass",conn,1,1
		  while not rsc.eof
		    if rs("zmtwo")=0 and rs("zmthree")=0 and rs("zmone")=rsc("id") then
			response.Write("" & rsc("classname") & "")
			end if
			if rs("zmone")<>0  and rs("zmthree")=0 and  rs("zmtwo")=rsc("id") then
			response.Write("" & rsc("classname") & "")
			end if
			if rs("zmone")<>0 and rs("zmtwo")<>0 and  rs("zmthree")=rsc("id") then
			response.Write("" & rsc("classname") & "")
			end if
			rsc.movenext
		wend
		rsc.close
		set rsc=nothing
		  %>
	          ]
			  <%else%>
			  [公告]
			  <%end if%>
        <font color="<%=rs("btcolor")%>"><%=rs("title")%></font>
            </td>
		    <td width="17%"><div align="center"><%= rs("adddate") %></div></td>
		    <td width="13%"><div align="center"><%= (rs("hits")) %></div></td>
		    <td width="19%"><div align="center"><a href="News_modi.asp?ID=<%=rs("id")%>">修改</a> 
		          <a href="News_Del.asp?ID=<%=rs("ID")%>" onClick="return ConfirmDel();">删除  </a>
	            <a href="dhtmlnews.asp?ID=<%=rs("ID")%>" ><font color=red>生成静态页</font></a></div></td>
          </tr>
		      <%
rs.MoveNext
Next	
%>          <tr   onMouseOver="style.backgroundColor='#faf9d1'" onMouseout="style.backgroundColor='#FFF'" >
           <td  colspan="7" style="padding-left:18px;"><input type="checkbox" name="allbox" onclick="CheckAll()" />
           全选
          
              
			  <input class="bnt" onMouseOver="style.backgroundColor='#FFF'"style="background-color: #F1F5F8;"type="submit" name="button" id="button" value="设为推荐"  onClick="return confirm('确定要推荐吗？');"class="btn"/>
			  <input class="bnt" onMouseOver="style.backgroundColor='#FFF'"style="background-color: #F1F5F8;"type="submit" name="button" id="button" value="取消推荐" onClick="return confirm('确定要取消推荐吗？');" class="btn"/>
			  <input class="bnt" onMouseOver="style.backgroundColor='#FFF'"style="background-color: #F1F5F8;"type="submit" name="button" id="button" value="设为置顶" onClick="return confirm('确定要设为置顶吗？');" class="btn"/>
			  <input class="bnt" onMouseOver="style.backgroundColor='#FFF'"style="background-color: #F1F5F8;"type="submit" name="button" id="button" value="取消置顶" onClick="return confirm('确定要取消置顶吗？');" class="btn"/>
			  <input class="bnt" onMouseOver="style.backgroundColor='#FFF'"style="background-color: #F1F5F8;"type="submit" name="button" id="button" value="设为幻灯" onClick="return confirm('确定要设为幻灯新闻吗？');" class="btn"/>
			  <input class="bnt" onMouseOver="style.backgroundColor='#FFF'"style="background-color: #F1F5F8;"type="submit" name="button" id="button" value="取消幻灯" onClick="return confirm('确定要取消幻灯新闻吗？');" class="btn"/>
              <input class="bnt" onMouseOver="style.backgroundColor='#FFF'"style="background-color: #F1F5F8;"type="submit" name="button" id="button" value="批量删除"  class="btn" onClick="return confirm('确定要批量删除选中的新闻吗，将不可恢复?');"/>
&nbsp;          </td>
            </tr>
  </table>

  <%If Obj_Page.OutErrInfo <> "" Then
		Response.Write Obj_Page.OutErrInfo '报错信息显示
		Response.End
		else
	Call Obj_Page.Page_Navigation() '分页导航
	end if
    else
Response.Write "目前暂无任何信息"
Response.end
	%>
<%Set Obj_Page = Nothing

RS.Close
Set RS = Nothing
End If
%>
 
</form>
      
<SCRIPT language=javascript>
function CheckAll(){ 
 for (var i=0;i<eval(zmqy.elements.length);i++){ 
  var e=zmqy.elements[i]; 
  if (e.name!="allbox") e.checked=zmqy.allbox.checked; 
 } 
} 
function ConfirmDel()
{
   if(confirm("确定要删除选中的新闻吗？一旦删除将不能恢复！"))
     return true;
   else
     return false;
	 
}

</SCRIPT>
