<!--#include file="QvodCms_Conn.asp"-->
<!--#include file="QvodCms_Check.asp"-->
<%
dim action,id,reurl,Title,data_lastdate,Content,News_Color,allid,newspic,class_id,Author,fSource,keywords,news_elite,news_hits,Descriptions,news_Hot
reurl=Request.ServerVariables("Http_Referer")'来源地址
If reurl="" Then reurl="QvodCms_News.asp"
action=Trim(Request.QueryString("action"))
id=Clng(Request.QueryString("id"))
allid=Trim(Request.Form("allid"))'批量影片ID
Title=Left(request.form("Title"),255)'新闻标题
data_lastdate=Cint(request.form("data_lastdate"))'是否更新时间,0,1
Content=Trim(request.form("Content"))'影片简介
News_Color=Trim(request.form("News_Color")) '标题颜色
newspic=request.form("newspic")
Author=Left(request.form("Author"),50)
fSource=Left(request.form("Source"),50)
keywords=Left(request.form("keywords"),255)
Descriptions=Trim(request.form("Description"))
class_id=Clng(Request.form("class_id"))
news_elite=Clng(Request.form("news_elite"))
news_hot=Clng(Request.form("news_hot"))
Call OpenConn()
Sub News_Add '作用:入库新的新闻信息
    If Title=""  Then 
	    Call QvodCms_Err("新闻名称不能为空！")
	    Response.End
    ElseIf Content=""  Then
	    Call QvodCms_Err("新闻内容不能为空！")
	    Response.End	
    End if
	Set rs = Server.CreateObject("adodb.recordset")
	sql = " select * from QvodCms_News "
	rs.Open sql, Conn, 1, 3
	rs.AddNew
	rs("class_id")=class_id
	rs("Pic")=newspic
	rs("keywords")=keywords
	rs("Description")=Descriptions
	rs("title")=Title
	rs("Author")=Author
	rs("Source")=fSource
	rs("Hot")=news_hot
	rs("Elite")=news_elite
	rs("Content")=Content
	rs("Color")=News_Color
	rs("datetimes")=now()
	rs.update
	rs.Close
	Set rs=nothing
	Call QvodCms_Err_Url("新闻增加成功！","qvodcms_news.asp")

End sub

Sub News_Edit '作用:编辑新闻信息
    If Title=""  Then 
	    Call QvodCms_Err_Url("新闻名称不能为空！")
	    Response.End
    ElseIf Content=""  Then
	    Call QvodCms_Err_Url("新闻内容不能为空！")
	    Response.End	
    End if
    Set rs = Server.CreateObject("adodb.recordset")
	sql = " select * from qvodcms_News where id="&id&" "
	rs.Open sql, Conn, 1, 3
	If Not (rs.bof And rs.eof) Then 
		rs("class_id")=class_id
	    rs("Pic")=newspic
	    rs("keywords")=keywords
	    rs("Description")=Descriptions
	    rs("title")=Title
	    rs("Author")=Author
	    rs("Source")=fSource
	    rs("Hot")=news_Hot
	    rs("Elite")=news_elite
	    rs("Content")=Content
	    rs("Color")=News_Color
		If data_lastdate=1 Then
		rs("datetimes")=now()
		End If
		rs.update
	End if
	rs.Close
	set rs=nothing
	Call QvodCms_Err_Url("新闻修改成功！","qvodcms_news.asp")
End Sub

Sub News_Del '作用:删除新闻信息 
    If allid<>"" then '批量删除新闻信息
	ad=Split(allid,",")
	  for bd=0 to Ubound(ad)
	    conn.execute(" delete from qvodcms_News where id="&ad(bd)&" ")'删除新闻信息
	  next
	  Response.Redirect(reurl)
	Elseif id>0 Then
      conn.execute(" delete from qvodcms_News where id="&id&" ")'删除新闻信息
	  Response.Redirect(reurl)
	Else
	  Call QvodCms_Err_Url("没有指点参数:错误:"&Err.Number&" ！","qvodcms_news.asp") 
	End if  
End Sub

%>

<%
If action="add" then 
    Call News_Add
ElseIf action="edit" then 
    Call News_Edit
ElseIf action="del" then 
    Call News_Del		
Else
   Call QvodCms_Err("请检查你提交的参数是否正确！")
   Response.End
End if
Call CloseConn()
%>
