<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
'****************************************************************
'**   版权所有：烈火工作室  演示网站http://www.strongfire.cn   **
'**   QQ:839225572   邮箱：strongfire2008@163.com              **
'**   非正版用户不得擅自非法修改用于商业用途！查出必究。       **
'****************************************************************
%>
<!--#include file="islogin.asp"-->
<!--#include file="Check_SqlIn.asp"-->
<!--#include file="admin_conn.asp"-->
<!--#include file="Startup.asp"-->
<%
Function inHTML(str)
	Dim sTemp
	sTemp = str
	inHTML = ""
	If IsNull(sTemp) = True Then
		Exit Function
	End If
	sTemp = Replace(sTemp, "&", "&amp;")
	sTemp = Replace(sTemp, "<", "&lt;")
	sTemp = Replace(sTemp, ">", "&gt;")
	sTemp = Replace(sTemp, Chr(34), "&quot;")
	inHTML = sTemp
End Function	


ClassName=Request("ClassName")

page=Request("page")
ID=Request.QueryString("id")

set rs = server.CreateObject ("Adodb.recordset")
sql="select * from article where ID="& id
rs.Open sql,conn,1,1
ClassName=rs("ClassName")
Picture = Rs("Picture")
keywords = Rs("keywords")
Title=rs("title")
Content=rs("Content")
addtime=rs("addtime")
SavePathFileName = Rs("SavePathFileName")
rs.close
set rs=nothing

Dim aSavePathFileName
if SavePathFileName<>"" then 
' 把带"|"的字符串转为数组，用于初始下拉框表单
	aSavePathFileName = Split(SavePathFileName, "|")
' 函数InitSelect，根据数组值及初始值返回下拉框输出字串，具体请见startup.asp文件中函数的说明部分
else
	SavePathFileName=""
	aSavePathFileName = Split(SavePathFileName, "|")
	
end if
	Dim sOptionSavePath
	sOptionSavePath = InitSelect("picture", aSavePathFileName, aSavePathFileName, Picture, "", "无")

%>
<html>
<head>
<LINK href="admin_Css.css" type=text/css rel=stylesheet>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>修改信息</title>
<script language="JavaScript">
	<!--
	
	 function   checkDate(s)   
    {   
            var   isOk   =   false;   
  			tempArray   =   s.split('-');   
      		if   (tempArray.length   ==   3)   
    	    if   (   parseInt(tempArray[0]).toString().length   ==   4)   
            if   (   parseInt(tempArray[1])   >=1   &&   parseInt(tempArray[1])   <=12)   
     		if   (   parseInt(tempArray[2])   >=1   &&   parseInt(tempArray[2])   <=   31)   
            isOk   =   true;   
    
           return isOk;  
	 }   
   
	function checkForm(){
		
		if (checkDate(document.postart.addtime.value)==false)
		{alert("请正确填写日期（例如:2008-1-23）！");
		return false;
		}
		 
		if (document.postart.ClassName.value=="") {
			alert("请选择类别！");
			document.postart.ClassName.focus();
			return false;
		}
		
		if (document.postart.txttitle.value.length == 0) {
			alert("请输入标题！");
			document.postart.txttitle.focus();
			return false;
		}
		
		
		if (eWebEditor.getHTML()==""){
			alert("信息内容不能为空！");
			return false;
		}
		
		
		
	    eWebEditor.remoteUpload("doSubmit()");
		return false;
	

	}
	function doSubmit(){
		document.postart.submit();
	}
	function doChange(objText, objDrop){
		if (!objDrop) return;
		var str = objText.value;
		var arr = str.split("|");
		var nIndex = objDrop.selectedIndex;
		objDrop.length=1;
		for (var i=0; i<arr.length; i++){
			objDrop.options[objDrop.length] = new Option(arr[i], arr[i]);
		}
		objDrop.selectedIndex = nIndex;
	}
	//-->
</script>
<style type="text/css">
<!--
.STYLE2 {color: #FF0000}
-->
</style>
</head>


<body>
<div align="center">
<form method="POST" action="AritcleModifySave.asp" name="postart" onSubmit="return checkForm()">
	
			<input type=hidden name=d_savepathfilename  onChange="doChange(this,document.postart.picture)"  value="<%=SavePathFileName%>">

            
           <input type=hidden name="id" value='<%=id%>'>
		   <input type=hidden name="page" value='<%=page%>'>
              <table border=0 cellspacing=1 align="center" class="list">
                <tr align="center"> 
                  <th height="20" colspan=3 align=center >修改信息--该信息ID为：<b><%=ID%></b>&nbsp;</th>
                </tr>
                <tr> 
                  <td width="10%" align="right" valign="middle"><div align="center">信息类别：</div></td>
                 
                  <td >

          <select name="ClassName" size="1" id="ClassName">
            <option value="" selected>选择类别</option>
<%set rs=conn.execute("select * from class")
if rs.eof or rs.bof then
	response.write "<option value=''>没有分类</option>"
else
	do until rs.eof
%>
<option value="<%=rs("classname")%>" <%if rs("ClassName")=ClassName then%>selected<%end if%>><%=rs("ClassName")%></option> 
<%   rs.movenext
     loop
	
end if
rs.close
set rs = nothing
%>
          </select>
          <span class="STYLE2">*</span></td>
                </tr>
                
                
                <tr> 
                  <td width="10%" align="right"  valign="middle" ><div align="center">标&nbsp;&nbsp;&nbsp; 题：</div></td>
                  <td  colspan="2"><input name="txttitle" type="TEXT" id="txttitle"  value="<%=inHTML(Title)%>" size=60>
                  <span class="STYLE2">*</span></td>
                </tr>
                <tr>
                  <td align="right"  valign="middle" ><div align="center">关 键 字：</div></td>
                  <td  colspan="2"><input name="keywords" type="TEXT" id="keywords"  value="<%=keywords%>" size=60>
                  (如留空则关键字为:标题_网站名)</td>
                </tr>
				
   
                <tr> 
                  <td width="10%" align="right" valign="top" ><div align="center">首页图片新闻</div></td>
                  <td colspan=2 > <%=sOptionSavePath%>当编辑区有插入图片时，将自动填充此下拉框              </td>
                </tr>
                
                <tr> 
                  <td height="25" colspan=3 align="center" > 
                    <textarea name="d_content" style="display:none"><%=Server.HtmlEncode(Content)%></textarea>
			<iframe ID="eWebEditor" src="../ewebeditor/ewebeditor.htm?id=d_content&style=coolblue&savepathfilename=d_savepathfilename" frameborder="0" scrolling="no" width="770" HEIGHT="420"></iframe>					</td>
                </tr>
                <tr>
                  <td height="20" align=center ><div align="center">发布日期：</div></td>
                  <td height="20" colspan="2"  ><input name="addtime" type="TEXT" size=20 maxlength=20  value="<%=addtime%>">
当前日期为：<%=date()%> 注意不要改变格式。</td>
                </tr>
                <tr> 
                  <td height="20" colspan=3 align=center > 
                    <input type="submit" value=" 修 改 "name="cmdok" >
                    &nbsp; 
                    <input type="reset" value=" 重 写 "name="cmdcancel" >
&nbsp;&nbsp;                  </td>
                </tr>
    </table>


</form>
</div>
<%
set rs=nothing
%>