<!--#include file="../../Inc/conn.asp"-->
<!--#include file="../admin.asp"-->
<!-- #include file="../Inc/Head.asp" -->
<%
dim rs,sql,count,ID,bclass,sclass,DefaultPic
ID=strToNum(Request("ID"))
Set NewsRs=Conn.execute("select * from News Where ID="&ID)
If NewsRs.Eof then
	Response.Write "信息不存在"
    Response.End
End If
DefaultPic=Trim(NewsRs("DefaultPicUrl"))
If DefaultPic="" then
	DefaultPic="images/Nopic.jpg"
End If
sclass=NewsRs("SmallClassName")
bclass=NewsRs("BigClassName")

set rs=server.createobject("adodb.recordset")
sql = "select * from SmallClass_New order by SmallClassID asc"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
        <%
        count = 0
        do while not rs.eof 
        %>
subcat[<%=count%>] = new Array("<%= trim(rs("SmallClassName"))%>","<%= trim(rs("BigClassName"))%>","<%= trim(rs("SmallClassID"))%>");
        <%
        count = count + 1
        rs.movenext
        loop
        rs.close
        %>
onecount=<%=count%>;

function changelocation(locationid)
    {
    document.myform.SmallClass.length = 0; 
    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.myform.SmallClass.options[document.myform.SmallClass.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
    }    

function CheckForm()
{

	if (document.myform.title.value.length == 0) {
		alert("信息标题没有填写.");
		document.myform.title.focus();
		return false;
	}
		if (document.myform.Author.value.length == 0) {
		alert("信息发布人没有填写");
		document.myform.Author.focus();
		return false;
	}
		if (document.myform.ComeFrom.value.length == 0) {
		alert("信息来源没有填写");
		document.myform.ComeFrom.focus();
		return false;
	}	
	if (eWebEditor1.eWebEditor.document.body.innerHTML == ''){
		alert("信息内容不能为空！");
		eWebEditor1.eWebEditor.focus();
		return false;
	}
	return true;
}

function SetDropDownPic(url){
	document.myform.UploadFiles.value=document.myform.UploadFiles.value + url +"|";
	document.myform.IncludePic.value="1";
}
</script>
<style type="text/css">
<!--
.tr_southidc {BACKGROUND-COLOR: ECF5FF;}
-->
</style>

<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="table_southidc">
  <form name="myform" method="post" action="News_save.asp" onSubmit="return CheckForm();">
    <tr>
      <td height="30" colspan="3" align="center" class="blod">修改信息</td>
    </tr>
    <tr bgcolor="#ECF5FF">
      <td width="133" height="25" align="center">信息标题：</td>
      <td colspan="2"><input name="title" type="text" class="input" value="<%=NewsRs("title")%>" size="30"></td>
    </tr>
    <tr bgcolor="#ECF5FF">
      <td height="25" align="center">信息类别：</td>
      <td colspan="2"><%		
        sql = "select * from BigClass_New"
        rs.open sql,conn,1,1
		if rs.eof and rs.bof then
			response.write "请先添加栏目。"
		else
		%>
        <select name="BigClass" size="1" id="BigClass" onChange="changelocation(document.myform.BigClass.options[document.myform.BigClass.selectedIndex].text)">
	<%
		dim selclass
		selclass=rs("BigClassName")
		do while not rs.eof
			If Rs("BigClassName")=bclass Then
			   Response.Write "<option selected value="""&trim(rs("BigClassID"))&""">"&trim(rs("BigClassName"))&"</option>"
			   selclass=rs("BigClassName")
			Else
			   Response.Write "<option value="""&trim(rs("BigClassID"))&""">"&trim(rs("BigClassName"))&"</option>"
			End If
		rs.movenext
		loop
		end if
		rs.close
	%>
        </select>
        <select name="SmallClass" id="SmallClass">
          <option value="" >不指定小类</option>
	<%
	sql="select * from SmallClass_New where BigClassName='" & selclass & "'"
	rs.open sql,conn,1,1
	
	if not(rs.eof and rs.bof) then
	do while not rs.eof
	If Rs("smallClassName")=sclass Then
		Response.Write "<option selected value="""&rs("SmallClassID")&""">"&rs("SmallClassName")&"</option>"
	Else
		Response.Write "<option value="""&rs("SmallClassID")&""">"&rs("SmallClassName")&"</option>"
	End If
		rs.movenext
		loop
	end if
		rs.close
	%>
          <%
			ranNum=int(9*rnd)+10
			iddata=month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum
			%>
        </select></td>
    </tr>
    <tr bgcolor="#ECF5FF">
      <td height="25" align="center">发 布 人：</td>
      <td colspan="2"><input name="Author" type="text" id="auther" value="<%=NewsRs("Author")%>">
        <span class="TableRow1">
        <select name=font2 onChange="Author.value=this.value;">
          <option selected value="">选择作者</option>
          <option value='佚名'>佚名</option>
          <option value='本站'>本站</option>
          <option value='不详'>不详</option>
          <option value='未知'>未知</option>
          <option value='admin'>admin</option>
        </select>
      </span></td>
    </tr>
    <tr bgcolor="#ECF5FF">
      <td height="25" align="center">信息来源：</td>
      <td colspan="2"><input name="ComeFrom" type="text" id="ComeFrom" value="<%=NewsRs("ComeFrom")%>">
        <span class="TableRow1">
        <select name=font1 onChange="ComeFrom.value=this.value;">
          <option selected value="">选择来源</option>
          <option value='本站原创'>本站原创</option>
          <option value='本站整理'>本站整理</option>
          <option value='不详'>不详</option>
          <option value='转载'>转载</option>
        </select>
      </span></td>
    </tr>
    <tr bgcolor="#ECF5FF">
      <td height="25" align="center" valign="top">信息内容：</td>
      <td colspan="2" valign="top">
      
      <iframe id="eWebEditor1" src="/eWebEditor7/ewebeditor.htm?id=content&style=standard650&skin=office2003" frameborder="0" scrolling="no" width="600" height="350"></iframe> 
      <textarea name="content" id='content' style="display:none"><%=NewsRs("content")%></textarea>
     </td>
    </tr>
    <tr>
      <td height="30" align="center" bgcolor="#ECF5FF"><span class="tr_southidc">首页图片：</span></td>
      <td width="314" height="30" bgcolor="#ECF5FF"><span class="tr_southidc">
        <input name="DefaultPicUrl" type="text" id="DefaultPicUrl" value="<%=DefaultPic%>" size="30" maxlength="120" />
      </span></td>
      <td width="499" bgcolor="#ECF5FF"><span class="tr_southidc">
        <input type="button" name="Submit22" value="直接从上传图片中选择" onClick="window.open('../SelectPic.asp','','status=no,scrollbars=yes,top=300,left=200,width=396,height=254');" />
        <input name="Submit222" type="button" value="上传图片"  onClick="window.open('../../inc/mx_upload_flash.asp?formname=myform&editname=DefaultPicUrl&uppath=UploadFiles/Arcitle&filelx=jpg','','status=no,scrollbars=no,top=300,left=200,width=420,height=136')">
      </span></td>
    </tr>
    <tr>
      <td height="30" align="center" bgcolor="#ECF5FF"><span class="tr_southidc">是否推荐：</span></td>
      <td height="30" colspan="2" align="left" bgcolor="#ECF5FF"><input name="Elite" type="checkbox" id="Passed" value="yes" <%if NewsRs("Elite")=true then%>checked<%end if%>>
      是<font color="#0000FF">（如果选中的话将在首页做为图片信息显示）</font></td>
    </tr>
    <tr>
      <td height="30" align="center" bgcolor="#ECF5FF"><span class="tr_southidc">发布时间：</span></td>
      <td height="30" colspan="2" align="left" bgcolor="#ECF5FF"><span class="tr_southidc">
        <input name="PostTime" type="text" id="PostTime" value="<%=NewsRs("PostTime")%>" size="30" maxlength="120" />
      </span><font color="#0000FF">（为了避免出错，尽量不要更改。格式：<%=Now()%>）</font></td>
    </tr>
    <tr>
      <td height="30" colspan="3" align="center" bgcolor="#ECF5FF"><input type="submit" name="Submit" value="确认修改" class="input">
        &nbsp;
        <input type="button" name="Submit2" value="返回上一页" class="input" onClick="history.go(-1);">
        <input name="Act" type="hidden" id="Act" value="Edit">        <input name="ID" type="hidden" id="ID" value="<%=ID%>">
        <input name="UploadFiles" type="hidden" id="UploadFiles" value="<%=NewsRs("UploadFiles")%>" />
        <span class="tr_southidc">
		<%
		If NewsRs("IncludePic") Then
		    ii=1
		Else
		    ii=0
		End If	
		'Response.Write ii
		%>
        <input name="IncludePic" type="hidden" id="IncludePic" value="<%=ii%>" />
        </span></td>
    </tr>
  </form>
</table>
<!-- #include file="../Inc/Foot.asp" -->