<!--#include file="../Inc/Function.asp" -->
<!--#include file="../Inc/Cls_DB.asp" -->
<!--#include file="../Inc/Const.asp" -->
<% dim  dbc,conn
   set  dbc=new databaseclass
   set  conn=dbc.openconnection()
   set  dbc=nothing
   %>
<!--#include file="../Inc/MemberCheck.asp" -->
<%
Dim ConID,ConModObj
	ConID = Replace(Request("ContID"),"'","")
	If ConID = "" or isnull(ConID) then
		Response.Write("<script>alert(""参数传递错误"");location=""javascript:history.back()"";</script>")
		Response.end
	End If
	Set ConModObj = Conn.Execute("Select * from Contribution where ContID='"&ConID&"'")
	If ConModObj.eof then
		Response.Write("<script>alert(""稿件已经被管理审核通过或是删除,请返回刷新再试"");location=""javascript:history.back()"";</script>")
		Response.end
	End If
	
Dim NewsContent
    If Request.Form("Content")<>"" then
		NewsContent = Replace(Replace(Request.Form("Content"),"""","%22"),"'","%27")
	Else
		NewsContent = Replace(Replace(ConModObj("Content"),"""","%22"),"'","%27")
	End If
%>
<html>
<link href="../CSS/css.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>会员投稿</title><body>
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr>
    <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr bgcolor="#EFEFEF"> 
          <td width="26" height="32">&nbsp;</td>
          <td width="445"><b><font color="#000000"><b>稿件修改</b></font></b></td>
          <td width="96"><div align="center"><a href="Usermain.asp">会员中心首页 </a></div></td>
          <td width="72"><div align="center"><a href="Logout.asp"><font color="#FF0000">安全退出</font></a></div></td>
          <td width="9"></td>
        </tr>
      </table></td>
  </tr>
</table>
<br>
<table width="80%" border="0" align="center" cellpadding="6" cellspacing="1" bgcolor="#CCCCCC">
<form action="" method="POST" name="NewsForm">
    <tr bgcolor="e6e6e6"> 
      <td colspan="3"> <div align="center">&#31295;&#20214;&#26631;&#39064;
          <input name="Title" id="Title" style="width:50% " value="<%=ConModObj("Title")%>">
      </div></td>
    </tr>
    <tr bgcolor="e6e6e6"> 
      <td colspan="3"> <div align="center">&#21103; &#26631; &#39064;
          <input name="SubTitle" id="SubTitle" style="width:50% " value="<%=ConModObj("SubTitle")%>">
      </div></td>
    </tr>
    <tr bgcolor="e6e6e6"> 
      <td colspan="3"> <div align="center">&#20851; &#38190; &#23383;
          <input name="KeyWords" type="text" id="KeyWords" style="width:22% " value="<%=ConModObj("KeyWords")%>">
          &nbsp; &nbsp;&nbsp; 
      &#20316;&#32773;
      <input name="Author" type="hidden" style="width:21% " value="<%=ConModObj("Author")%>"><input name="Author" type="text" style="width:21% " value="<%=ConModObj("Author")%>" disabled>
</div></td>
    </tr>
    <tr bgcolor="e6e6e6"> 
      <td colspan="3"> <div align="center">&#25152;&#23646;&#26639;&#30446;
          <select name="ClassID" id="ClassID" style="width:50% ">
	   <%
	   Dim UserAddRikerObj
	   Set UserAddRikerObj = Conn.Execute("Select ClassID,ClassCName from NewsClass where DelFlag=0 and Contribution=1 order by AddTime desc")
	   Do While Not UserAddRikerObj.eof
	   %>
	   <option value="<%=UserAddRikerObj("ClassID")%>" <%If  Cstr(ConModObj("ClassID")) = Cstr(UserAddRikerObj("ClassID")) then Response.Write("selected")%>><%=UserAddRikerObj("ClassCName")%></option>
	   <%
	   	UserAddRikerObj.MoveNext
	   Loop
	   UserAddRikerObj.Close
	   Set UserAddRikerObj = Nothing
	   %>
		  </select>
</div></td>
    </tr>
    <tr bgcolor="e6e6e6"> 
      <td colspan="3"><div align="center"> 
          <iframe id='NewsContent' src='Editer/NewsEditer.asp' frameborder=0 scrolling=no width='100%' height='360'></iframe>
        </div></td>
    </tr>
    <tr bgcolor="e6e6e6"> 
      <td colspan="3"><div align="center"> 
          <input name="submitggg" type="button" onClick="SubmitFun();" value=" &#25552; &#20132; ">
          <input name="reset" type="reset" value=" &#22797; &#20301; ">
          <input type="hidden" name="Content" value="<% = NewsContent %>">
          <input name="action" type="hidden" id="action" value="add">
      </div></td>
    </tr></form>
  <tr>
    <td bgcolor="#DFDFDF">
<div align="center">
        <p >
		<%
		Dim Rsconfig
		set Rsconfig=conn.execute("select * from config")
		Response.Write(""&Rsconfig("Copyright")&"")
		Rsconfig.close
		set Rsconfig=nothing
		%></p>
      </div></td>
  </tr>
</table>

</body></html>
<script>
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
		if Replace(Replace(Replace(request.form("Title"),"'",""),"\",""),"/","")="" or request.form("Content")="" then
			Response.Write("<script>alert(""请填写稿件标题和内容"");location=""javascript:history.back(1)"";</script>")  
			Response.End
		end if
		if Cstr(Request.Form("ClassID")) = "" then
			Response.Write("<script>alert(""请选择投稿栏目"");location=""javascript:history.back(1)"";</script>")  
			Response.End
		end if
	  set rs = server.createobject("adodb.recordset")
	  sql1 = "select * from Contribution where ContID='"&ConID&"'"
	  rs.open sql1,conn,1,3
	  rs("Title")=Replace(Replace(Replace(request.form("Title"),"'",""),"\",""),"/","")
	  rs("SubTitle")=Replace(request.form("SubTitle"),"'","")
	  rs("Content")=request.Form("Content")
	  rs("AddTime")=now()
	  rs("KeyWords")=Replace(request.form("KeyWords"),"'","")
	  rs("Author")=Replace(Request.Form("Author"),"'","")
	  rs("ClassID")=Cstr(Request.Form("ClassID"))
	  rs.update
	  rs.close()
	  Response.Write("<script>alert('稿件修改成功'); window.location=""Mycon.asp"";</script>")
	  Response.End
	  set rs=nothing
  end if
  %>
