<%@language=vbscript codepage=936 %>
<%
option explicit
response.buffer=true	
%>
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/Conn_User.asp"-->
<!--#include file="inc/function.asp"-->

<!--#include file="inc/config.asp"-->
<!--#include file="inc/admin_code_article.asp"-->

<%
if CheckUserLogined()=False then
	response.Redirect "User_Login.asp"
end if

dim ArticleID,rs,sql,rsArticle,FoundErr,ErrMsg,PurviewChecked
dim Author,AuthorName,AuthorEmail,CopyFrom,CopyFromName,CopyFromUrl,magic
ArticleID=trim(request("ArticleID"))
FoundErr=False
if ArticleID="" then
	FoundErr=True
	ErrMsg=ErrMsg & "<br><li>请指定要修改的文章ID</li>"
	call WriteErrMsg()
	call CloseConn()
	response.end
else
	ArticleID=Clng(ArticleID)
end if
sql="select * from article where ArticleID=" & ArticleID & ""
Set rsArticle= Server.CreateObject("ADODB.Recordset")
rsArticle.open sql,conn,1,1
if rsArticle.bof and rsArticle.eof then
	FoundErr=True
	ErrMsg=ErrMsg & "<br><li>找不到文章</li>"
else	
	if rsArticle("Editor")=request.Cookies("asp163")("UserName") then
	 	
	else
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>你不能修改其他人的文章！</li>"
	end if
end if
if FoundErr=True then
	call WriteErrMsg()
else
	Author=rsArticle("Author")
	CopyFrom=rsarticle("CopyFrom")
	if instr(Author,"|")>0 then
		AuthorName=left(Author,instr(Author,"|")-1)
		AuthorEmail=right(Author,len(Author)-instr(Author,"|"))
	else
		AuthorName=Author
		AuthorEmail=""
	end if
	if instr(CopyFrom,"|")>0 then
		CopyFromName=left(CopyFrom,instr(CopyFrom,"|")-1)
		CopyFromUrl=right(CopyFrom,len(CopyFrom)-instr(CopyFrom,"|"))
	else
		CopyFromName=CopyFrom
		CopyFromUrl=""
	end if

	dim ClassID,tClass,ClassName,RootID,ParentID,Depth,ParentPath
	ClassID=rsArticle("ClassID")
	set tClass=conn.execute("select ClassName,RootID,ParentID,Depth,ParentPath From ArticleClass where ClassID=" & ClassID)
	ClassName=tClass(0)
	RootID=tClass(1)
	ParentID=tClass(2)
	Depth=tClass(3)
	ParentPath=tClass(4)
	set tClass=nothing
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<title>修改日志</title>
<style type="text/css">
BODY {
	scrollbar-face-color:#DDDDDD;
	scrollbar-highlight-color: #cccccc;
	scrollbar-shadow-color: #CCCCCC;
	scrollbar-3dlight-color: #F5F5F5;
	scrollbar-darkshadow-color: #F5F5F5;
	scrollbar-track-color: #F0F0F0;
	scrollbar-arrow-color: #FFFFFF;
	margin-left: 10px;
	margin-top: 10px;
	margin-right: 10px;
	margin-bottom: 10px;
}
</style>
<link rel="stylesheet" type="text/css" href="new/css.css">
<script language = "JavaScript">
function AddItem(strFileName){
  document.myform.IncludePic.checked=true;
  document.myform.DefaultPicUrl.value=strFileName;
 
}
function CheckForm()
{
  if (editor.EditMode.checked==true)
	  document.myform.Content.value=editor.HtmlEdit.document.body.innerText;
  else
	  document.myform.Content.value=editor.HtmlEdit.document.body.innerHTML; 

  if (document.myform.ClassID.value=="")
  {
    alert("文章所属栏目不能指定为含有子栏目的栏目！");
	document.myform.ClassID.focus();
	return false;
  }
  if (document.myform.ClassID.value=="0")
  {
    alert("文章所属栏目不能指定为外部栏目！");
	document.myform.ClassID.focus();
	return false;
  }
  if (document.myform.ClassID.value=="-1")
  {
    alert("你没有在此栏目发表文章的权限，请选择其他栏目！");
	document.myform.ClassID.focus();
	return false;
  }

  if (document.myform.Title.value=="")
  {
    alert("文章标题不能为空！");
	document.myform.Title.focus();
	return false;
  }
  if (document.myform.Key.value=="")
  {
    alert("关键字不能为空！");
	document.myform.Key.focus();
	return false;
  }
  if (document.myform.Content.value=="")
  {
    alert("文章内容不能为空！");
	editor.HtmlEdit.focus();
	return false;
  }
  if (document.myform.Content.value.length>655360)
  {
    alert("文章内容太长，超出了ACCESS数据库的限制（64K）！建议将文章分成几部分录入。");
	editor.HtmlEdit.focus();
	return false;
  }
  return true;  
}
</script>

</head>

<body >
<form method="POST" name="myform" onSubmit="return CheckForm();" action="User_ArticleSave.asp" target="_self">

	<table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="1" height="1"></td>
        <td height="1" bgcolor="#BCBCBC"></td>
        <td width="1" height="1"></td>
      </tr>
      <tr>
        <td bgcolor="#BCBCBC"></td>
        <td height="25" align="center" bgcolor="f2f2f2"><strong>---&nbsp;修改日志&nbsp;--- </strong></td>
        <td bgcolor="#BCBCBC"></td>
      </tr>
    </table>
<table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
         
		  <tr bgcolor="#FFFFFF" class="tdbg"> 
            <td colspan="2" align="right"><table width="410" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="49" align="center"><strong>标题：</strong></td>
                  <td><%
			response.write "<select class=ifd><option value=>"
			call Admin_ShowPath2(ParentPath,ClassName,Depth)
			response.write "</option></select>"
			response.write "<input type='hidden' name='ClassID' value='" & rsArticle("ClassID") & "'>"%>
                   
                    <input name="Title" type="text" id="Title" value="<%=rsArticle("Title")%>" size="38" maxlength="255" class="ifd">
                    <select name="TitleFontColor" id="TitleFontColor">
                      <option value="" <%if rsArticle("TitleFontColor")="" then response.write " selected"%>>颜色</option>
                      <OPTION value="">默认</OPTION>
                      <OPTION value="#000000" style="background-color:#000000" <%if rsArticle("TitleFontColor")="#000000" then response.write " selected"%>></OPTION>
                      <OPTION value="#FFFFFF" style="background-color:#FFFFFF" <%if rsArticle("TitleFontColor")="#FFFFFF" then response.write " selected"%>></OPTION>
                      <OPTION value="#008000" style="background-color:#008000" <%if rsArticle("TitleFontColor")="#008000" then response.write " selected"%>></OPTION>
                      <OPTION value="#800000" style="background-color:#800000" <%if rsArticle("TitleFontColor")="#800000" then response.write " selected"%>></OPTION>
                      <OPTION value="#808000" style="background-color:#808000" <%if rsArticle("TitleFontColor")="#808000" then response.write " selected"%>></OPTION>
                      <OPTION value="#000080" style="background-color:#000080" <%if rsArticle("TitleFontColor")="#000080" then response.write " selected"%>></OPTION>
                      <OPTION value="#800080" style="background-color:#800080" <%if rsArticle("TitleFontColor")="#800080" then response.write " selected"%>></OPTION>
                      <OPTION value="#808080" style="background-color:#808080" <%if rsArticle("TitleFontColor")="#808080" then response.write " selected"%>></OPTION>
                      <OPTION value="#FFFF00" style="background-color:#FFFF00" <%if rsArticle("TitleFontColor")="#FFFF00" then response.write " selected"%>></OPTION>
                      <OPTION value="#00FF00" style="background-color:#00FF00" <%if rsArticle("TitleFontColor")="#00FF00" then response.write " selected"%>></OPTION>
                      <OPTION value="#00FFFF" style="background-color:#00FFFF" <%if rsArticle("TitleFontColor")="#00FFFF" then response.write " selected"%>></OPTION>
                      <OPTION value="#FF00FF" style="background-color:#FF00FF" <%if rsArticle("TitleFontColor")="#FF00FF" then response.write " selected"%>></OPTION>
                      <OPTION value="#FF0000" style="background-color:#FF0000" <%if rsArticle("TitleFontColor")="#FF0000" then response.write " selected"%>></OPTION>
                      <OPTION value="#0000FF" style="background-color:#0000FF" <%if rsArticle("TitleFontColor")="#0000FF" then response.write " selected"%>></OPTION>
                      <OPTION value="#008080" style="background-color:#008080" <%if rsArticle("TitleFontColor")="#008080" then response.write " selected"%>></OPTION>
                    </select>
                    <input name="Key" type="hidden"
           id="Key" value="isky" size="50" maxlength="255">
                  </td></tr>
              </table></td>
          </tr>
          <tr bgcolor="#FFFFFF" class="tdbg"> 
            <td colspan="2" align="left" valign="middle">            
              <table width="100%"  border="0" cellspacing="0" cellpadding="2">
                <tr>
                  <td align="center"><textarea name="Content" style="display:none"></textarea> 
				  <%ArticleID=request("articleid")%>
              <iframe ID="editor" src="editors.asp?UserType=User&Action=Modify&ArticleID=<%=request("articleid")%>" frameborder=0 scrolling=no width="405" height="330" class=4></iframe>	</td>
				</tr>
              </table>   	        </td>
          </tr>

   <tr align="center" bgcolor="#FFFFFF">
           <td colspan="2"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
             <tr>
               <td align="center"><img onclick=a() align=absmiddle src="gif/1.gif" width="35" height="35" alt="图片" border="0"></td>
               <td align="center"><img onclick=a() align=absmiddle src="gif/2.gif" width="35" height="35" alt="图片" border="0"></td>
               <td align="center"><img onclick=a() align=absmiddle src="gif/3.gif" width="35" height="35" alt="图片" border="0"></td>
               <td align="center"><img onclick=a() align=absmiddle src="gif/4.gif" width="35" height="35" alt="图片" border="0"></td>
               <td align="center"><img onclick=a() align=absmiddle src="gif/5.gif" width="35" height="35" alt="图片" border="0"></td>
               <td align="center"><img onclick=a() align=absmiddle src="gif/6.gif" width="35" height="35" alt="图片" border="0"></td>
               <td align="center"><img onclick=a() align=absmiddle src="gif/7.gif" width="35" height="35" alt="图片" border="0"></td>
               <td align="center"><img onclick=a() align=absmiddle src="gif/8.gif" width="35" height="35" alt="图片" border="0"></td>
               <td align="center"><img onclick=a() align=absmiddle src="gif/9.gif" width="35" height="35" alt="图片" border="0"></td>
               <td align="center"><img onclick=a() align=absmiddle src="gif/10.gif" width="35" height="35" alt="图片" border="0"></td>
             </tr>
             <tr>
               <td align="center"><% if rsArticle("magic")=1  then%>
                   <input name="magic" type="radio" value="1"   checked>
                 <%else%>
                 <input type="radio" name="magic" value="1" >
                 <%end if%></td>
               <td align="center"><% if rsArticle("magic")=2 then%>
                   <input name="magic" type="radio" value="2" checked>
                 <%else%>
                 <input type="radio" name="magic" value="2">
                 <%end if%></td>
               <td align="center"><% if rsArticle("magic")=3 then%>
                   <input name="magic" type="radio" value="3" checked>
                 <%else%>
                 <input type="radio" name="magic" value="3">
                 <%end if%></td>
               <td align="center"><% if rsArticle("magic")=4 then%>
                   <input name="magic" type="radio" value="4" checked>
                 <%else%>
                 <input type="radio" name="magic" value="4">
                 <%end if%></td>
               <td align="center"><% if rsArticle("magic")=5 then%>
                   <input name="magic" type="radio" value="5" checked>
                 <%else%>
                 <input type="radio" name="magic" value="5">
                 <%end if%></td>
               <td align="center"><% if rsArticle("magic")=6 then%>
                   <input name="magic" type="radio" value="6" checked>
                 <%else%>
                 <input type="radio" name="magic" value="6">
                 <%end if%></td>
               <td align="center"><% if rsArticle("magic")=7 then%>
                   <input name="magic" type="radio" value="7" checked>
                 <%else%>
                 <input type="radio" name="magic" value="7">
                 <%end if%></td>
               <td align="center"><% if rsArticle("magic")=8 then%>
                   <input name="magic" type="radio" value="8" checked>
                 <%else%>
                 <input type="radio" name="magic" value="8">
                 <%end if%></td>
               <td align="center"><% if rsArticle("magic")=9 then%>
                   <input name="magic" type="radio" value="9" checked>
                 <%else%>
                 <input type="radio" name="magic" value="9">
                 <%end if%></td>
               <td align="center"><% if rsArticle("magic")=10 then%>
                   <input name="magic" type="radio" value="10" checked>
                 <%else%>
                 <input type="radio" name="magic" value="10">
                 <%end if%></td>
             </tr>
           </table></td>
         </tr>
         <tr align="center" bgcolor="#FFFFFF"> 
            <td colspan="2"><input name="ArticleID" type="hidden" id="ArticleID" value="<%=rsArticle("ArticleID")%>">
              <%dim trs
	  set trs=conn.execute("select SkinID from Skin where IsDefault=True")
	  %>
              <input name="SkinID" type="hidden" id="SkinID2" value="非常视觉">
              <%
	  set trs=conn.execute("select LayoutID from Layout where IsDefault=True and LayoutType=3")
	  %><%end if%>  <input name="LayoutID" type="hidden" id="LayoutID2" value="<%=trs(0)%>">
	  <input name="IncludePic" type="hidden" id="IncludePic" value="<%=rsarticle("IncludePic")%>">
	   <input name="DefaultPicUrl" type="hidden" id="DefaultPicUrl" value="<%=rsarticle("DefaultPicUrl")%>">
              <input name="Action" type="hidden" id="Action2" value="Modify">
            <input name="Save" type="submit"  id="Save" value=" 修 改 " onClick="document.myform.action='User_ArticleSave.asp';document.myform.target='_self';"></td>
          </tr>
  </table> 

</form>
</body>
</html>
