<%@ codepage ="936" %>
<%charset="gb2312"%>
<%Session.CodePage=936%>
<!--#include file="Admin.asp"-->
<!--#include file="Conn.asp"-->
<!--#include file="../Inc/Ubbcode.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
dim ArticleID,rsArticle,FoundErr,ErrMsg,BigClassID,SmallClassID

FoundErr=False

sql="select * from conews"
Set rsArticle= Server.CreateObject("ADODB.Recordset")
rsArticle.open sql,conn,1,1
if FoundErr=True then
	call WriteErrMsg()
else
	BigClassID=request("BigClassID")
	SmallClassID=request("SmallClassID")
	If SmallClassID="" Then SmallClassID=0

dim rs
dim sql,sql_s
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from NewsSmallClass order by orders desc,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("BigClassID"))%>","<%= trim(rs("SmallClassID"))%>");
        <%
        count = count + 1
        rs.movenext
        loop
        rs.close
        %>
onecount=<%=count%>;

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

function CheckForm()
{
  if (document.myform.Title.value=="")
  {
    alert("信息标题不能为空！");
	document.myform.Title.focus();
	return false;
  }
  if (editor.getHTML()=="")
  {
    alert("信息内容不能为空！");
	editor.shuziren_editor.focus();
	return false;
  }
  myform.submit();    
}
</script>
<script type="text/javascript" src="inc/color.js"></script>
<SCRIPT language=javascript>
function changetemple(temples)
    {
    var temples=temples;
	editor.shuziren_editor.document.body.innerHTML=temples;
    } 
function InsertImage()
{
	var toph = screen.availHeight/2-90;
	var left = screen.availWidth/2-200;	window.open("insertfile.asp?mode=Article","","width=400,height=130,top="+toph+",left="+left);
}
</SCRIPT>
<script type="text/javascript" src="../inc/rq.js"></script>
<!-- #include file="Inc/Head.asp" -->
<body>
<div align=center>
<TABLE class=tableBorder1 style="WIDTH: 100%" cellSpacing=0 cellPadding=3 
align=center border=0>
  <TBODY>
  <TR>
    <TD height=20></TD></TR></TBODY></TABLE>
<TABLE class=tableBorder cellSpacing=0 cellPadding=0 width="85%" align=center border=0>
	<tr> 
	  <td height="25" class=forumHeaderBackgroundAlternate>
	    <div align="center"><strong>添 加 频 道 内 容</strong></div>
	  </td>
	</tr>
	<tr> 
	  <td align=center class=forumrowHighlight>
      <form method="POST" name="myform" onSubmit="return CheckForm();" action="News_Save.asp?action=add">
        <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="border" >
          <tr>
            <td height="25" align="center" class="title">　</td>
    </tr>
    <tr align="center">
      <td class="tdbg">
	<table width="100%" border="0" cellpadding="0" cellspacing="2" class=tableBorder_white>
                <tr> 
                  <td width="100" height="22" align="right" bgcolor="#CBDCFD">所属栏目：</td>
                  <td bgcolor="#D2E1FD"> <%

        sql = "select * From NewsBigClass order by orders desc,BigClassID asc"
        rs.open sql,conn,1,1
		if rs.eof and rs.bof then
			response.write "请先添加栏目。"
		else
		%>			<select name="BigClassID" onChange="changelocation(document.myform.BigClassID.options[document.myform.BigClassID.selectedIndex].value)" size="1">
                      <%
			If Not(rs.bof And rs.eof) Then firstBigClassID=rs("BigClassID")
			If BigClassID<>"" Then firstBigClassID=BigClassID
		    do while not rs.eof
				If CLng(firstBigClassID) = rs("BigClassID") Then
					myselectd = " selected"
				Else
					myselectd = ""
				End if
			%>
             <option value="<%=trim(rs("BigClassID"))%>"<%=myselectd%>><%=trim(rs("BigClassName"))%></option>
            <%
		        rs.movenext
    	    loop
		end if
        rs.close
			%>
                    </select> 
					<select name="SmallClassID">
                      <option value="0">不指定小类</option>
            <%
			If firstBigClassID<>"" then
			sql="select * from NewsSmallClass where BigClassID=" & firstBigClassID
			rs.open sql,conn,1,1
			if not(rs.eof and rs.bof) then
				do while not rs.eof
					If CLng(SmallClassID) = rs("SmallClassID") Then
						myselectd = " selected"
					Else
						myselectd = ""
					End if
				%>
                      <option value="<%=rs("SmallClassID")%>"<%=myselectd%>><%=rs("SmallClassName")%></option>
                      <%
			    	rs.movenext
				loop
			end if
	        rs.close
			End if
					%>
                    </select>
                  </td>
                </tr>
                <tr> 
                  <td height="22" align="right" bgcolor="#CBDCFD">标　　题：</td>
                  <td bgcolor="#D2E1FD"> 
					<input name="Title" type="text" id="Title" size="50" maxlength="150">&nbsp;<input type="hidden" name="post[style]" id="color_input_1" value=""/><img src="image/color.gif" width="21" height="18" align="absmiddle" id="color_img_1" style="cursor:pointer;background:" alt="选择颜色" title="选择颜色" onclick="color_show(1, document.getElementById('color_input_1').value, this);"/>  
                    <font color="#FF0000">*</font></td>
                </tr>
                
                <tr> 
                  <td height="22" align="right" bgcolor="#CBDCFD">作　　者：</td>
                  <td bgcolor="#D2E1FD"> <input name="admin" type="text" id="admin" value="气动工具" size="50" maxlength="255"></td>
                </tr>
                <tr> 
                  <td height="22" align="left" valign="middle" bgcolor="#CBDCFD" colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;信息内容：</td>
                </tr>
                <tr bgcolor="#D2E1FD"> 
                  <td colspan="2" align="right" valign="middle"> <div align="left"> 
                      <textarea name="Content" style="display:none"></textarea>
                      <iframe id="editor" src="../edit/hy_html/edit.asp?id=Content&source=0" frameborder="0" scrolling="no" width="100%" height="350"></iframe>
                    </div></td>
                </tr>
                <tr> 
                  <td width="100" align="right" bgcolor="#CBDCFD">展示图片： 
                    <input name="IncludePic" type="hidden" id="IncludePic" value="yes"></td>
                  <td bgcolor="#D2E1FD" style="padding-top:2px;">
					<input type="hidden" name="D_changed" value="no">  
					<input name="DefaultPicUrl" type="text" id="DefaultPicUrl" size="50" maxlength="200"> 
					&nbsp;<input type=button onClick="InsertImage()" value=" 上传 ">
                    <br>
                    展示的图片,直接从上传图片中选择： 
                    <select name="DefaultPicList" id="DefaultPicList" onChange="DefaultPicUrl.value=this.value;">
                      <option value="">不指定展示图片</option>
                  
                    </select> <input name="UploadFiles" type="hidden" id="UploadFiles" value=""> 
                  </td>
                </tr>
                <tr> 
                  <td height="22" align="right" bgcolor="#CBDCFD">推荐：</td>
                  <td bgcolor="#D2E1FD"> <input name="Passed" type="checkbox" id="Passed" value="yes">
                    是<font color="#0000FF">（首页推荐资讯栏展示）</font></td>
                </tr>
                <tr> 
                  <td height="22" align="right" bgcolor="#CBDCFD">图文：</td>
                  <td bgcolor="#D2E1FD"> <input name="Elite" type="checkbox" id="Elite" value="yes">
                    是<font color="#0000FF">（首页推荐图文栏展示）</font></td>
                </tr>
                <tr> 
                  <td height="22" align="right" bgcolor="#CBDCFD">录入时间：</td>
                  <td bgcolor="#D2E1FD"> <input name="UpdateTime" type="text" id="UpdateTime" value="<%=now()%>" maxlength="50">
                    当前时间为：<%=now()%> 注意不要改变格式。</td>
                </tr>
              </table>
      </td>
    </tr>
  </table>
  <div align="center">
    <p>
       <input name="Save" type="button" onclick="javascript:CheckForm();" id="Save" value="保存添加结果">&nbsp;&nbsp;
	  <input name="btn01" type="button" onclick="history.go(-1);" value=" 返回 ">
    </p>
  </div>
</form>
	  </td>
  </tr>
</table>
<!-- #include file="Inc/Foot.asp" -->
</div>
<%
end if
rsArticle.close
set rsArticle=nothing
call CloseConn()
%>