<meta http-equiv="Content-Type" content="text/html; chars_newset=gb2312">
<!--#include file="conn.asp"-->
<!--#include file="admin.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
if request("no")="modi" then
newsid=request("newsid")
title=request("title")

BigClassName=request("BigClassName")
SmallClassName=request("SmallClassName")
author=request("author")

pic=request("pic")

FileName2=request("FileName2")


set rsbig=server.createobject("adodb.recordset")
sqlbig="select count (*) as bigClassNum from SmallClass_New where BigClassName='"&BigClassName&"'"
rsbig.open sqlbig,conn,1,1
bigClassNum2=rsbig("bigClassNum")

set rsbig2=server.createobject("adodb.recordset")
sqlbig2="select * from SmallClass_New where BigClassName='"&BigClassName&"' and SmallClassName='"&SmallClassName&"'"
rsbig2.open sqlbig2,conn,1,1
conclass2=rsbig2("conclass")

if (bigClassNum2>0) and (SmallClassName="") then

response.write"<Script>alert('“"&BigClassName&"”栏目下还有二级栏目，您必须选择一个二级栏目方可添加。');history.back();</Script>"

else
	
	set rsClassNum=server.createobject("adodb.recordset")
	sqlClassNum="select count (*) as ClassNum from News where BigClassName='"&BigClassName&"' and SmallClassName='"&SmallClassName&"'"
	rsClassNum.open sqlClassNum,conn,1,1
	ClassNum2=rsClassNum("ClassNum")
		if (conclass2="简介类") and ClassNum2>1 then
		response.write"<Script>alert('“"&BigClassName&"”－“"&SmallClassName&"”栏目为简介类栏目，数据库中只允许有一条信息，为避免引起混乱，请您先删除此栏目中的信息，再重新添加！');history.back();</Script>"
		else
	
			set rs_news=server.createobject("adodb.recordset")
			sql="select * from News where id="&newsid
			rs_news.open sql,conn,1,3
			rs_news("title")=title
			'
			rs_news("BigClassName")=BigClassName
			rs_news("SmallClassName")=SmallClassName
			rs_news("author")=author
			
				if pic="" then rs_news("pic")="No" 
				if pic<>"" then rs_news("pic")=pic
				
				
				if FileName2="" then rs_news("FileName2")="Null" 
				if FileName2<>"" then rs_news("FileName2")=FileName2
				
			
			Dim strNewsContent
			For i = 1 To Request.Form("newscontent").Count 
			strNewsContent = strNewsContent & Request.Form("newscontent")(i) 
			Next 
			rs_news("content")=strNewsContent
			
			rs_news.update
			rs_news.close
			set rs_news=nothing
			response.write "<script language='javascript'>" & chr(13)
					response.write "alert('信息修改成功！');" & Chr(13)
					response.write "window.document.location.href='Manage_news.asp?bigclassname="&bigclassname&"';"&Chr(13)
					response.write "</script>" & Chr(13)
			Response.End
			end if
		end if
	rsClassNum.close
end if
rsbig2.close
rsbig.close
%>
<%
dim rs_news
dim sql
dim count
set rs_news=server.createobject("adodb.recordset")
sql = "select * from SmallClass_New order by SmallClassID asc"
rs_news.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
        <%
        count = 0
        do while not rs_news.eof 
        %>
subcat[<%=count%>] = new Array("<%= trim(rs_news("SmallClassName"))%>","<%= trim(rs_news("BigClassName"))%>","<%= trim(rs_news("SmallClassName"))%>");
        <%
        count = count + 1
        rs_news.movenext
        loop
        rs_news.close
        %>
onecount=<%=count%>;

function changelocation(locationid)
    {
    document.addNEWS.SmallClassName.length = 1; 
    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.addNEWS.SmallClassName.options[document.addNEWS.SmallClassName.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
    }    
function CheckForm()
{
     document.addNEWS.cnWords.value = document.frames.cnEditBox.getHTML(true);     
     document.addNEWS.imageNum.value = document.frames.cnEditBox.document.all("editImageNum").value;
     document.addNEWS.editFirs_newstImageName.value = document.frames.cnEditBox.document.all("editFirs_newstImageName").value;

	if (document.addNEWS.title.value.length == 0) {
		alert("专题标题没有填写.");
		document.addNEWS.title.focus();
		return false;
	}
	//if (document.addNEWS.remark.value.length == 0) {
		//alert("专题内容提要没有填写.");
		//document.addNEWS.remark.focus();
		//return false;
	//}
	if (document.addNEWS.user.value.length == 0) {
		alert("专题来源没有填写.");
		document.addNEWS.user.focus();
		return false;
	}
	return true;
}
</script>

<Script Language=JavaScript>
//获取上传文件的文件名
function doChange(objText, objDrop){
	if (!objDrop) return;
	var str = objText.value;
	var arr = str.split("|");
	objDrop.length=0;
	for (var i=0; i<arr.length; i++){
		objDrop.options[i] = new Option(arr[i], arr[i]);
	}
}
</Script>
<style type="text/css">
<!--
.style1 {color: #0000CC}
.style2 {color: #000000}
-->
</style>
<!-- #include file="Inc/Head.asp" -->
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="80" align="center" valign="top" bgcolor="#A0CCD8"><!-- #include file="info_left.asp" --></td>
    <td align="center" valign="top">
	
	  <table width="100%" height="0"  border="0" cellpadding="5" cellspacing="0">
        <tr>
          <td height="24" background="image/usercenter_3.jpg">
            <div align="center"><span style=""><strong><font color="#FFFFFF">修 改 <span style="font-weight: bold"><font color="#FFFFFF">动 态 信 息</font></span> </font></strong></span> </div></td>
        </tr>
      </table>
	  <% 
newsid=request("id")
Set rs_newso=Server.CreateObject("ADODB.RecordSet") 
sql="select * from News where  id="&newsid
rs_newso.Open sql,conn,1,1
if rs_newso.eof and rs_newso.bof then
response.Write("没有记录")
else
uptoppic=rs_newso("pic")
%>
<table width="90%" border="1" align="center" cellpadding="0" cellspacing="2">
  <form name="addNEWS" method="post" action="admin_infomodi_news.asp?no=modi" onSubmit="return CheckForm();">
    <tr align="center" bgcolor="#FFFFEE"> 
      <td height="30" bgcolor="#FFFFFF"><span class="style1"><strong><strong><span class="style2">修 改 </span><span style="font-weight: bold">动 态 信 息</span> </strong></strong>  </span></td>
    </tr>
	<tr> 
            <td height="18"> 
              <table width="100%" class="border" border="0" cellspacing="1"  cellpadding="0" style="word-break:break-all">
                <tr > 
                  <td width="18%" height="26"> 
                    <div align="left"><font color="#FF0000">*</font>重新上传作品：</div></td>
                  <td width="30%" > <font color="#FF0000"> 
                    <div class="Btn" LANGUAGE="javascript" onclick="pic()"> <font color="#FF0000"> 
                      <input name="FileName2" type="text" id="FileName2" size="55" value="<%=rs_newso("filename2")%>">
                      </font></div>
                    </font></td>
                  <td ><font color="#FF0000"><a href="editor_InsertPic1.asp"><img src="../images/upload2.gif" width="127" height="25" border="0" class="Ico" ></a></font></td>
                </tr>
              </table></td>
          </tr>
    <tr> 
      <td height="24" align="right" bgcolor="#FFFFFF">        <div align="left"><font color="#FF0000">*</font>标 题：　 
          <input name="title" type="text" class="input" value="<%=rs_newso("title")%>" size="53" maxlength="200">
          　          </div>      </td>
    </tr>
    <tr> 
      <td height="25" align="right" bgcolor="#FFFFFF"> 
        <div align="left"><font color="#FF0000">*</font>类 别：
		&nbsp;
		  <select name="SmallClassName">
               
                <%
			sql="select * from SmallClass_New where bigClassName='" & rs_newso("bigClassName") & "'" 
			rs_news.open sql,conn,1,1 
			if not(rs_news.eof and rs_news.bof) then  
				do while not rs_news.eof %>
                <option <% if rs_news("SmallClassName")=rs_newso("SmallClassName") then response.Write("selected") end if%> value="<%=rs_news("SmallClassName")%>"><%=rs_news("SmallClassName")%></option>
                <%
			    	rs_news.movenext
				loop
			end if
	        rs_news.close
			%>
              </select>
              &nbsp;&nbsp;</div>      </td>
    </tr>
    <tr>
            <td height="25" bgcolor="#FFFFFF"><font color="#FF0000">*</font>作者： 
              <input name="author" type="text" class="input" id="author" value="<%=rs_newso("from")%>" size="31" maxlength="50" >
&nbsp;</td>
    </tr>
    <tr> 
      <td align="right" valign="top" bgcolor="#FFFFFF"> 
        <div align="left"><font color="#FF0000">*</font>内 容：<br> 
          <input type="hidden" name="newscontent" value="<% = Server.HtmlEncode(rs_newso("content")) %>" />
              <iframe id="newscontent" src="htmledit/ewebeditor.asp?id=newscontent&amp;style=standard&savefilename=FileName" frameborder="0" scrolling="No" width="90%" height="400"></iframe></div>      </td>
    </tr>
    <tr> 
            <td height="25"><font color="#FF0000">*</font>添加人： 
              <input name="author2" type="text" class="input" id="author2" value="<%=rs_newso("author")%>" size="31" maxlength="50" > 
            </td>
    </tr>
    <tr align="center"> 
      <td height="35" bgcolor="#FFFFFF"> 
        <input type="submit" name="Submit" value="保 存" class="input">
        <input type="hidden" name="newsId" value="<%=newsId%>">
        　 <input type="hidden" name="bigclassname" value="<%=rs_newso("bigclassname")%>">
        <input type="reset" name="Submit2" value="重 写" class="input">        </td>
    </tr>
  </form>
</table>
<% End If
rs_newso.close
set rs_newso=nothing
 %></td>
  </tr>
</table>
<!-- #include file="Inc/Foot.asp" -->
