<% Option Explicit %>
<!--#include file="../../Inc/Const.asp" -->
<!--#include file="../../Inc/Cls_DB.asp" -->
<!--#include file="../../Inc/Function.asp" -->
<%
'==============================================================================
'软件名称：风讯网站信息管理系统
'当前版本：Foosun Content Manager System 2.0 
'最新更新：2004.12
'==============================================================================
'商业注册联系：028-85098980-601,602 技术支持：028-85098980-606、607,客户支持：608
'产品咨询QQ：159410,655071,66252421
'技术支持:所有程序使用问题，请提问到bbs.foosun.net我们将及时回答您
'程序开发：风讯开发组 & 风讯插件开发组
'论坛支持：风讯在线论坛(http://bbs.foosun.net)
'官方网站：www.Foosun.net  演示站点：test.cooin.com    
'网站建设专区：www.cooin.com
'==============================================================================
'免费版本请在新闻首页保留版权信息，并做上本站LOGO友情连接
'==============================================================================
Dim DBC,Conn
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
%>
<!--#include file="../../Inc/Session.asp" -->
<!--#include file="../../Inc/CheckPopedom.asp" -->
<%
if Not JudgePopedomTF(Session("Name"),"P0105") then Call ReturnError()
    Dim TempNewsID,RsContObj,OldClassEName
	If Request("NewsID")<>"" then
	   TempNewsID = Cstr(Request("NewsID"))
		Set RsContObj = Conn.Execute("select * from Contribution where ContID='"&TempNewsID&"'")
		if RsContObj.Eof then
		   Response.Write("<script>alert(""新闻参数传递错误"");dialogArguments.location.reload();window.close();</script>")
		   Response.End
		end if
	 else
	   Response.Write("<script>alert(""参数传递错误"");dialogArguments.location.reload();window.close();</script>")
	   Response.End
	End If
	
Dim NewsContent
    If Request.Form("Content")<>"" then
		NewsContent = Replace(Replace(Request.Form("Content"),"""","%22"),"'","%27")
	Else
		NewsContent = Replace(Replace(RsContObj("Content"),"""","%22"),"'","%27")
	End If
%>
<html>
<head>
<link href="../Inc/ModeWindow.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>稿件修改</title>
</head>
<script language="JavaScript" src="../JS/PublicJS.js"></script>
<body>
<form action="" name="NewsForm" method="post">
  <table width="100%" border="0" cellspacing="4" cellpadding="0">
    <tr> 
      <td height="10" colspan="5"></td>
    </tr>
    <tr> 
      <td width="4%">&nbsp;</td>
      <td width="8%">新闻标题</td>
      <td><input name="Title" type="text" id="Title" style="width:90%" value="<%=LoseHtml(RsContObj("Title"))%>">
        <input name="ClassID" type="hidden" id="ClassID" value="<%=TempNewsID%>"></td>
      <td width="8%">副 标 题</td>
      <td width="42%"><input name="SubTitle" type="text" id="SubTitle2" style="width:91.5%" value="<%=RsContObj("SubTitle")%>"></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>新闻作者</td>
      <td><input name="Author" type="text" style="width:90%" value="<%=RsContObj("Author")%>" readonly></td>
      <td>关 键 字</td>
      <td><input name="Keywords" type="text" style="width:91.5%" value="<%=RsContObj("Keywords")%>"> 
      </td>
    </tr>
    <tr> 
      <td colspan="5"><div align="center"> 
          <iframe id='NewsContent' src='../Editer/NewsEditer.asp' frameborder=0 scrolling=no width='93%' height='360'></iframe>
        </div></td>
    </tr>
    <tr> 
      <td height="40" colspan="5"> <div align="center"> 
          <input type="button" name="Submit2" value=" 修 改 " onClick="SubmitFun();">
          <input type="hidden" name="Content" value="<% = NewsContent %>">
          <input name="action" type="hidden" id="action" value="add">
          &nbsp;&nbsp;&nbsp;&nbsp; 
          <input type="button" name="Submit3" value=" 取 消 " onClick="window.close();">
        </div></td>
    </tr>
  </table>
</form></body>
</html>
<script language="javascript">
function SubmitFun()
{
	frames["NewsContent"].SaveCurrPage();
	var TempContentArray=frames["NewsContent"].NewsContentArray;
	document.NewsForm.Content.value='';
	for (var i=0;i<TempContentArray.length;i++)
	{
		if (TempContentArray[i]!='')
		{
			if (document.NewsForm.Content.value=='') document.NewsForm.Content.value=TempContentArray[i];
			else document.NewsForm.Content.value=document.NewsForm.Content.value+'[Page]'+TempContentArray[i];
		} 
	}
	document.NewsForm.submit();
}
</script>
<%
  if Request.Form("action")="add" then
     Dim ITitle,IClassID,INewsTemplet,IClickNum,IAddDate,INewsAddObj,INewsAddSql
     if Request.Form("Title")<>"" then
		ITitle = Replace(Replace(Request.Form("Title"),"""",""),"'","")
	 else
	    Response.Write("<script>alert('请输入新闻标题');</script>")
		Response.End
	 end if
	 if Request.Form("Content")="" or isnull(Request.Form("Content")) then
	    Response.Write("<script>alert('请输入新闻内容');</script>")
		Response.End
	 end if
	 if Request.Form("Author")="" or isnull(Request.Form("Author")) then
	    Response.Write("<script>alert('请留下您的大名');</script>")
		Response.End
	 end if
	  set INewsAddObj=server.createobject("adodb.recordset")
	  INewsAddSql="select * from Contribution where ContID='"&TempNewsID&"'"
	  INewsAddObj.open INewsAddSql,Conn,1,3
	  INewsAddObj("Title") =  ITitle
	  INewsAddObj("SubTitle") = Replace(Replace(Request.Form("SubTitle"),"""",""),"'","")
	  INewsAddObj("Content") =  Request.Form("Content")   '新闻内容 尚未判断
	  INewsAddObj("KeyWords") = Replace(Replace(Request.Form("KeyWords"),"""",""),"'","")
	  INewsAddObj("Author") = Replace(Replace(Request.Form("Author"),"""",""),"'","")
	  INewsAddObj.Update
	  INewsAddObj.Close
	  Set INewsAddObj = Nothing
	  Response.Write("<script>alert(""稿件修改成功"");dialogArguments.location.reload();window.close();</script>")
	  Response.End
  end if
%>