<%@language=vbscript codepage=936 %>
<!--#include file="Conn.asp"-->
<!--#include file ="Check_Manager.asp"-->
<!--#include file="../Inc/Ubbcode.asp"-->
<!--#include file="JsInc/Function.asp"-->
<!--#include file="JsInc/config.asp"-->
<%
Dim onecount
Set rs=Conn.Execute("Select * From [SmallClassNews]")
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
        <%
        count = 0
        do while not rs.eof 
        %>
subcat[<%=count%>] = new Array("<%=trim(rs("News_SmallClassName"))%>","<%= trim(rs("News_BigClassName"))%>","<%= trim(rs("News_SmallClassName"))%>");
        <%
        count = count + 1
        rs.movenext
        loop
        %>
onecount=<%=count%>;

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

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.Title.value=="")
  {
    alert("文章标题不能为空！");
	document.myform.Title.focus();
	return false;
  }
  if (document.myform.Content.value=="")
  {
    alert("文章内容不能为空！");
	editor.HtmlEdit.focus();
	return false;
  }
  return true;  
  if (document.myform.UpdateTime.value=="")
  {
    alert("文章内容不能为空！");
	document.myform.UpdateTime.focus();
	return false;
  }
  return true;  
}
function loadForm()
{
  editor.HtmlEdit.document.body.innerHTML=document.myform.Content.value;
  return true
}
</script>
<html>
<head>
<titel></titel>
<LINK href="admin/admin.css" type=text/css rel=stylesheet>
</head>
<body onLoad="javascipt:setTimeout('loadForm()',1000);">
<table width="100%" height="43%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td height="411" align="center" valign="top"> <br> 
      <form method="POST" name="myform" onSubmit="return CheckForm();" action="News_EditNews.asp?action=upnews&id=<%=Request("id")%>">
        <table width="620" border="0" align="center" cellpadding="0" cellspacing="0" class=tableBorder>
          <tr> 
            <td height="25" align="center" background="admin/admin_bg_1.gif" class="title"><font color="#ffffff"><b>修 
              改 新 闻</b></font></td>
          </tr>
          <tr align="center"> 
            <td valign="top" class="tdbg"> 
<%
Set rs_news=Server.CreateObject("Adodb.Recordset")
Sql="Select * From [News] Where News_ID="&Cint(Request("id"))
rs_news.Open Sql,Conn,1,1
%>
              <table width="100%" border="0" cellpadding="2" cellspacing="1">
                <tr> 
                  <td height="22" align="right">新闻名称：</td>
                  <td width="462"> <input name="Title" type="text"
           id="Title" value="<%=rs_news("Titel")%>" size="50" maxlength="80"> <font color="#FF0000">*</font></td>
                </tr>
                <tr> 
                  <td height="22" align="right">新闻类别：</td>
                  <td>
<%
Set b_news=Conn.Execute("Select * From [BigClassNews]")
Response.Write "<select name=BigClassName onChange='changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)'>"
If b_news.Eof and b_news.Bof Then
Response.Write "新闻大类!"
Else
Do until b_news.Eof
Response.Write "<option "
If b_news("News_BigClassName")=rs_news("News_BigClassName") Then Response.Write "selected "
Response.Write " value=" &Trim(b_news("News_BigClassName"))& ">" &Trim(b_news("News_BigClassName"))& "</option>"
b_news.MoveNext
Loop
End if
Response.Write "</select>"

Set s_news=Conn.Execute("Select * From [SmallClassNews] Where News_BigClassName='"&rs_news("News_BigClassName")&"'")
Response.Write "<select name=SmallClassName>" 
If s_news.Eof Then
Response.Write "新闻小类"
Else
Response.Write "<option value='0'>选择新闻小类</option>"
Do until s_news.Eof
Response.Write "<option "
If s_news("News_SmallClassName")=rs_news("News_SmallClassName") Then Response.Write "selected"
Response.Write " value=" &Trim(s_news("News_SmallClassName"))& ">" &Trim(s_news("News_SmallClassName"))& "</option>"
s_news.MoveNext
Loop
End if
Response.Write "</select>"
%>                                        
		      </td>
                </tr>
                <tr> 
                  <td height="22" align="right" valign="middle">新闻说明：</td>
                  <td> </td>
                </tr>
                <tr> 
                  <td colspan="2" align="right" valign="middle"> <div align="left"> 
                      <textarea name="Content" style="display:none"><%=rs_news("Content")%></textarea>
              <iframe ID="editor" src="Editor.asp" frameborder=1 scrolling=no width="620" height="405"></iframe>
                    </div></td>
                </tr>
                <tr> 
                  <td width="152" align="right">首页显示：</td>
                  <td colspan="3"> 
<input name="Elite" type="checkbox" id="Elite" value="yes" <%If rs_news("ShowIndex")=true Then response.Write("checked")%>>
                    是<font color="#0000FF">（如果选中的话将在首页显示）</font></td>
                </tr>
                <tr> 
                  <td height="22" align="right">录入时间：</td>
                  <td> <input name="UpdateTime" type="text" id="UpdateTime" value="<%=date()%>" maxlength="50">
                    当前时间为：<%=now()%> 注意不要改变格式。</td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
<%
rs_news.Close
set rs_news=Nothing
call CloseConn()
%>
        <div align="center"> 
          <p> 
            <input name="Save" type="submit" id="Save" value="修改">
          </p>
        </div>
      </form></td>
  </tr>
</table>
</body>
</html>