<% Option Explicit %>
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312" />
<TITLE>编辑视频</TITLE>
<link rel="stylesheet" href="../Images/CssAdmin.css">
<script language="javascript" src="../inc/Admin.js"></script>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
</HEAD>
<!--#include file="../../Include/Const.asp" -->
<!--#include file="../../Include/Conn1.asp" -->
<!--#include file="../CheckAdmin.asp"-->
<!-- #INCLUDE file="../../angel_ckf110/fckeditor.asp" -->
<BODY>
<% 
dim Result
Result=request.QueryString("Result")
dim ID,ArticleName,ViewFlag,ArticleNameEn,ViewFlagEn,SortID,Content,ContentEn,CommendFlag,NewFlag,KeyWord,LDescription
ID=request.QueryString("ID")
call ArticleEdit() 
%>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#628AE1">
  <tr>
    <td height="24" nowrap><font color="#FFFFFF"><img src="../Images/Explain.gif" width="18" height="18" border="0" align="absmiddle">&nbsp;<strong>添加，修改视频信息</strong></font></td>
  </tr>
  <tr>
    <td height="24" align="center" nowrap  bgcolor="#FFFFFF"><a href="ArticleEdit.asp?Result=Add" >添加视频信息</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="ArticleList.asp" >查看所有视频信息</a></td>
  </tr>
</table>
<br>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#628AE1">
  <form name="editForm" method="post" action="ArticleEdit.asp?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>">
  <tr>
    <td height="24" nowrap bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="0" cellspacing="0" id=editArticle idth="100%">

      <tr>
        <td width="90" height="20" align="right">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="30" align="right">视频标题：</td>
        <td><input name="ArticleName" type="text" class="textfield" id="ArticleName" style="WIDTH: 380px" value="<%=ArticleName%>" maxlength="100">
          <span class="STYLE1">*</span></td>
      </tr>
	  <tr>
        <td height="30" align="right">关键词：</td>
        <td><input name="KeyWord" type="text" class="textfield" id="KeyWord" style="WIDTH: 380px" value="<%=KeyWord%>" maxlength="100">
          </td>
      </tr>
	  <tr>
        <td height="100" align="right">优化描述：</td>
        <td>
		<textarea name="Description" id="Description" cols="50" rows="6"><%=LDescription%></textarea>
          </td>
      </tr>
	        <tr>
        <td height="30" align="right">所属类别：</td>
        <td>
		<select name="SortID" id="SortID" style="width:200px;">
          <option value="">请选择分类</option>
          <% 
		  dim rs,sql
	  Set rs=server.CreateObject("adodb.recordset")
	  sql="Select * From Angel_VodeoSort order by id asc"
	  rs.open sql,conn,1,1
	  if rs.eof then
        response.write "No Content"
      else
	    while not rs.eof
	  %>
          <option value="<%=rs("id")%>" <%if SortID=rs("id") then response.Write("selected='selected'")%>><%=rs("SortName")%></option>
		   <%
	    rs.movenext
		wend
	  end if
	  rs.close
	  set rs=nothing
	  %> 
        </select>
		<span class="STYLE1">*</span> </td>
      </tr>
	  
	  <tr>
        <td height="25" align="right">标　　记：</td>
        <td><input name="CommendFlag" type="checkbox" id="CommendFlag" style="HEIGHT: 13px;WIDTH: 13px; " value="1" <%if CommendFlag then response.write ("checked")%>> 首页显示&nbsp;&nbsp;(<font color="#FF0000">将在首页优先展示</font>)</td>
      </tr>
	  
	  <tr>
        <td height="25" align="right">标　　记：</td>
        <td>
  <input name="NewFlag" id="NewFlag" type="checkbox" style="HEIGHT: 13px;WIDTH: 13px;" value="1" <%if NewFlag then response.write ("checked")%>>
推荐 &nbsp;&nbsp;(<font color="#FF0000">推荐将在首页“精彩推荐”展示</font>)</td>
      </tr>
	  
      <tr>
        <td height="30" align="right" valign="top">详细内容：<br>
        <td>
<%
Dim sBasePath
sBasePath = "../../angel_ckf110/"
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath	= sBasePath
oFCKeditor.height	= 400
oFCKeditor.width	= 700
oFCKeditor.Value	= content
oFCKeditor.Create "content1"
%></td>
      </tr>
      <tr>
        <td height="30" align="right">是否发布：</td>
        <td><input name="ViewFlag" type="checkbox" id="ViewFlag" style='HEIGHT: 13px;WIDTH: 13px;' value="1" checked <%if ViewFlag then response.write ("checked")%>></td>
      </tr>
      <tr>
        <td height="30" align="right">&nbsp;</td>
        <td valign="bottom"><input name="submitSaveEdit" type="submit" class="button"  id="submitSaveEdit" value="保存" style="WIDTH: 80;" ></td>
      </tr>
      <tr>
        <td height="20" align="right">&nbsp;</td>
        <td valign="bottom">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  </form>
</table>
</BODY>
</HTML>
<%
sub ArticleEdit()
  dim Action,rsRepeat,rs,sql
  Action=request.QueryString("Action")
  if Action="SaveEdit" then '保存编辑产品信息
    set rs = server.createobject("adodb.recordset")
    if len(trim(request.Form("ArticleName")))<1 then
      response.write ("<script language=javascript> alert('视频名称为必填项目！');history.back(-1);</script>")
      response.end
	end if

    if Result="Add" then '创建产品信息
	  sql="select * from Angel_Vodeo"
      rs.open sql,conn,1,3
      rs.addnew
	  id=GetID("id","Angel_Vodeo")
	  rs("id")=id
      rs("ArticleName")=trim(Request.Form("ArticleName"))
	  rs("KeyWord")=trim(Request.Form("KeyWord"))
	  rs("Description")=trim(Request.Form("Description"))
	  if Request.Form("ViewFlag")=1 then
        rs("ViewFlag")=Request.Form("ViewFlag")
	  else
        rs("ViewFlag")=0
	  end if
	  
	  if Request.Form("CommendFlag")=1 then
        rs("CommendFlag")=Request.Form("CommendFlag")
	  else
        rs("CommendFlag")=0
	  end if
	  
	  if Request.Form("NewFlag")=1 then
        rs("NewFlag")=Request.Form("NewFlag")
	  else
        rs("NewFlag")=0
	  end if
	  
	  if Request.Form("SortID")="" then
        response.write ("<script language=javascript> alert('请选择所属分类！');history.back(-1);</script>")
        response.end
	  else
	    rs("SortID")=Request.Form("SortID")
	  end if
	  rs("Content")=trim(Request.Form("Content1"))
	  rs("AddTime")=now()
	end if  
	if Result="Modify" then '修改产品信息
      sql="select * from Angel_Vodeo where ID="&ID
      rs.open sql,conn,1,3
      rs("ArticleName")=trim(Request.Form("ArticleName"))
	  rs("KeyWord")=trim(Request.Form("KeyWord"))
	  rs("Description")=trim(Request.Form("Description"))
	  if Request.Form("ViewFlag")=1 then
        rs("ViewFlag")=Request.Form("ViewFlag")
	  else
        rs("ViewFlag")=0
	  end if
	  
	  if Request.Form("CommendFlag")=1 then
        rs("CommendFlag")=Request.Form("CommendFlag")
	  else
        rs("CommendFlag")=0
	  end if
	  
	  if Request.Form("NewFlag")=1 then
        rs("NewFlag")=Request.Form("NewFlag")
	  else
        rs("NewFlag")=0
	  end if
	  
	  if Request.Form("SortID")<>"" then
	    rs("SortID")=Request.Form("SortID")
	  else
        response.write ("<script language=javascript> alert('请选择所属分类！');history.back(-1);</script>")
        response.end
	  end if
	  rs("Content")=trim(Request.Form("Content1"))
	end if
	rs.update
	rs.close
    set rs=nothing
	'response.redirect "createhtml/createhtml.asp?id="&ID '生成静态
    response.write "<script language=javascript> alert('成功编辑视频信息！');location.replace('ArticleList.asp');</script>" '不需生成静态
	response.End()
  else '提取产品信息
	if Result="Modify" then
      set rs = server.createobject("adodb.recordset")
      sql="select * from Angel_Vodeo where ID="& ID
      rs.open sql,conn,1,1
      if rs.bof and rs.eof then
        response.write ("数据库读取记录出错！")
        response.end
      end if
	  ArticleName=rs("ArticleName")
	  ViewFlag=rs("ViewFlag")
	  SortID=rs("SortID")
      Content=rs("Content")
	  KeyWord=rs("KeyWord")
	  LDescription=rs("Description")
	  NewFlag=rs("NewFlag")
	  CommendFlag=rs("CommendFlag")
	  
	  rs.close
      set rs=nothing 
    end if
  end if
end sub
%>