
<!--#include file="../inc/Conn.asp"-->
<!--#include file="Inc/Admin.Asp"-->
<!--#include file="Inc/Function.asp"-->
<%
PurviewValue="addnews"
If not CheckAdmin(PurviewValue) then
Response.Write("<script language=""JavaScript"">alert(""越权操作!"");history.go(-1);")
response.end
End If
%>
<%

dim rs
dim sql
dim count
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("SmallClassName"))%>");
        <%
        count = count + 1
        rs.movenext
        loop
        rs.close
        %>
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 AddItem(UploadFiles){
  document.myform.IncludePic.checked=true;
  document.myform.DefaultPicUrl.value=UploadFiles;
  document.myform.DefaultPicList.options[document.myform.DefaultPicList.length]=new Option(UploadFiles,UploadFiles);
  document.myform.DefaultPicList.selectedIndex+=1;
  if(document.myform.UploadFiles.value==''){
	document.myform.UploadFiles.value=UploadFiles;
  }
  else{
    document.myform.UploadFiles.value=document.myform.UploadFiles.value+"|"+strFileName;
  }
}
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>
<!-- #include file="Inc/Head.asp" -->

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td align="center" valign="top">
	<table width="95%" border="0" cellpadding="2" cellspacing="1" class="border">
        <form method="POST" name="myform"  action="News_save.asp?action=Add" target="_self">
          <tr> 
            <td class="topbg" height="30" colspan="2" align="center">增加新闻</td>
          </tr>
          <tr class=tdbg> 
            <td width="155" height="25" align="right" class="tdbgl"><font color="#FF0000">*</font>新闻标题：</td>
            <td width="476"> <input name="title" type="text" class="input" size="50" maxlength="200"></td>
          </tr>
          <tr class=tdbg> 
            <td width="155" height="25" align="right" class="tdbgl"><font color="#FF0000">*</font>新闻类别：</td>
            <td> <%		
        sql = "select * from BigClass_New"
        rs.open sql,conn,1,1
		if rs.eof and rs.bof then
			response.write "请先添加栏目。"
		else
		%> <select name="BigClassName" onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1">
                <option selected value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
                <%
			dim selclass
		    selclass=rs("BigClassName")
        	rs.movenext
		    do while not rs.eof
			%>
                <option value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
                <%
		        rs.movenext
    	    loop
		end if
        rs.close
			%>
              </select> <select name="SmallClassName">
                <option value="" selected>不指定小类</option>
                <%
			sql="select * from SmallClass_New where BigClassName='" & selclass & "'"
			rs.open sql,conn,1,1
			if not(rs.eof and rs.bof) then
			%>
                <option value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
                <% rs.movenext
				do while not rs.eof%>
                <option value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
                <%
			    	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 class=tdbg> 
            <td width="155" height="25" align="right" valign="top" class="tdbgl"><font color="#FF0000">*</font>新闻内容：</td>
            <td valign="top"> <textarea name="Content" style="display:none"></textarea> 
            <iframe ID="eWebEditor1" src="Editor/ewebeditor.asp?id=content&style=news&savepathfilename=UploadFiles" frameborder="0" scrolling="no" width="550" HEIGHT="450"></iframe></td>
          </tr>
		  						            <tr> 
            <td align="right" class="tdbgl">首页图片新闻：</td>
            <td colspan="2" class="tdbg"><input name="IncludePic" type="checkbox" id="IncludePic" value="no">
              是<font color="#FF0000">（设为首页图片新闻，选择此项时请注意文章中是否添加有图片！）</font></td>
          </tr>
          <tr class=tdbg> 
            <td width="155" height="25" align="right" class="tdbgl">首页图片： 
            
            <input name="UploadFiles" type="hidden" id="UploadFiles" value=""  onChange="doChange(this,document.myform.DefaultPicList)"></td>
            <td><input name="DefaultPicUrl" type="text" id="DefaultPicUrl" size="40" maxlength="120"> 
              <br>
              首页的图片,直接从上传图片中选择： 
              <select name="DefaultPicList" id="select" onChange="DefaultPicUrl.value=this.value;">
                <option selected>不指定首页图片</option>
            </select>
            （<span style="color: #FF0000">先在WEB编辑器中上传图片，然后指定首页图片</span>）</td>
          </tr>
          <tr class=tdbg> 
            <td width="155" height="25" align="right" class="tdbgl"><font color="#FF0000">*</font>发布人：</td>
            <td> <input name="user" type="text" class="input" value="<%=session("AdminName")%>" size="30"></td>
          </tr>
          <tr> 
            <td width="155" height="30" align="right" class=tdbgl>录入时间：</td>
            <td height="30" class=tdbg><div align="left"> 
                <input name="AddDate" type="text" id="AddDate" value="<%=now()%>" maxlength="50">
            </div></td>
          </tr>
          <tr> 
            <td height="30" colspan="2" align="center" class=tdbg> <input type="submit" name="Submit" value="提交" class="input">
              　 
            <input type="reset" name="Submit" value="重置" class="input"></td>
          </tr>
        </form>
      </table></td>
  </tr>
</table>
<!-- #include file="Inc/Foot.asp" -->
