<!--#include file="conn.asp"-->
<!--#include file="adminset.asp"-->
<!--#include file="../fuction.asp"-->
<%if session("admin")="" then
response.Write "<script LANGUAGE='javascript'>alert('网络超时或者您还没有登录请登录');window.location.href='login.asp';</script>"
response.End
end if
if session("flag")>1 then
response.Write "<div align=center><font size=80 color=red><b>您没有此项目管理权限！</b></font></div>"
response.End
end if
if qx6<>1 then
response.Write "<div align=center><font size=80 color=red><b>您没有此项目管理权限！</b></font></div>"
response.End
end if

Content	= Request.Form("Content")			'商品说明
'将里面的链接换成本地链接
 aa	= "http://"&Request.ServerVariables("server_name")&Request.ServerVariables("path_info")
 aa	= mid(aa,1,len(aa)-18)		
content	= replace(content,aa,"")

 if request.QueryString("action")="save" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_news",conn,1,3
rs.addnew
rs("classid")=request("anclassid")
rs("classid2")=request("nclassid")
rs("classid3")=request("xclassid")
rs("newsname")=trim(request("newsname"))
rs("addname")=trim(request("addname"))
if trim(request("tp"))="" then
rs("tp")=1
else
rs("tp")=trim(request("tp"))
end if
if trim(request("newstop"))="" then
rs("newstop")=1
else
rs("newstop")=trim(request("newstop"))
end if
if trim(request("newstj"))="" then
rs("newstj")=1
else
rs("newstj")=trim(request("newstj"))
end if
if trim(request("iuser"))="" then
rs("iuser")=1
else
rs("iuser")=trim(request("iuser"))
end if

'将里面的链接换成本地链接
 'aa="http://"&Request.ServerVariables("server_name")&Request.ServerVariables("path_info")
 'aa= mid(aa,1,len(aa)-17)		'16=admin/addnews.asp
 'response.write aa
 'response.end 
'content=replace(content,aa,"")
'session("content")=content
rs("newscontent")=content
rs("adddate")=now()
rs("viewcount")=0
rs.update
rs.close
set rs=nothing
session("content")=""
response.write "<script language=javascript>alert('添加成功！');window.location.href='news_manage.asp';</script>"
response.End
end if
%>
<html>
<head>
<title>网软志成在线购物系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="javascript">
<!--
function checkdata()
{
if (form1.newsname.value=="")
	{
	  alert("对不起，请输入新闻主题！")
	  form1.newsname.focus()
	  return false
	 }

}


function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
<%dim count
set rs=server.createobject("adodb.recordset")
rs.open "select * from shop_news_class2 order by px ",conn,1,1

set rs2=server.createobject("adodb.recordset")
rs2.open "select * from shop_news_class3 order by px ",conn,1,1
%>
<script language = "JavaScript">
var onecount;
var threecount;
onecount=0;
threecount=0

subcat3=new Array();
<%
   count = 0
   do while not rs2.eof 
%>
subcat3[<%=count%>] = new Array("<%= trim(rs2("classname"))%>","<%= rs2("classid2")%>","<%= rs2("id")%>");
<%
        count = count + 1
        rs2.movenext
        loop
        rs2.close
%>
threecount=<%=count%>;

subcat = new Array();
<%
   count = 0
   do while not rs.eof 
%>
subcat[<%=count%>] = new Array("<%= trim(rs("classname"))%>","<%= rs("classid1")%>","<%= rs("id")%>");
<%
        count = count + 1
        rs.movenext
        loop
        rs.close
%>
		
onecount=<%=count%>;

function changelocation(locationid)
    {
    document.form1.nclassid.length = 0; 
    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
             document.form1.nclassid.options[document.form1.nclassid.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
		if(document.form1.nclassid.length!=0){
     changelocation3(document.form1.nclassid.options[document.form1.nclassid.selectedIndex].value) 
	 }else{
	 document.form1.xclassid.length=0
	 }      
    }    
    
function changelocation3(locationid)
    {
    document.form1.xclassid.length = 0; 

    var locationid=locationid;
    var i;
    for (i=0;i < threecount; i++)
        {
            if (subcat3[i][1] == locationid)
            { 
             document.form1.xclassid.options[document.form1.xclassid.length] = new Option(subcat3[i][0], subcat3[i][2]);
            }        
        }
        
    } 
//-->
</script>
<link href="../css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.STYLE1 {color: #FF0000}
-->
</style></head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="1%" height="28">&nbsp;</td>
    <td width="99%"><table width="100%" border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td width="77%" height="27" style="font-size:14px;color:#ffffff">&nbsp;<strong><font color="#000000">网软志成购物后台管理系统 &gt;&gt; 新闻管理 &gt;&gt; 添加新闻 </font></strong></td>
        <td width="23%" style="font-size:14px;color:#ffffff"><span class="STYLE1">* 为必添项目</span></td>
      </tr>
    </table></td>
  </tr>
</table>
<form name="form1" method="post" action="news_add.asp?action=save" onSubmit="return checkdata()" >
  <table width="95%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#999999">
    <tr bgcolor="#F3F3F3">
      <td width="195" bgcolor="#F3F3F3" style="PADDING-LEFT: 6px"><div align="center">新闻主题：</div></td>
      <td width="719" style="PADDING-LEFT: 6px">
      <input name="newsname" class="wenbenkuang" type="text" id="newsname" size="80">
      <span class="STYLE1">*</span> </td>
    </tr>
    <tr bgcolor="#F3F3F3">
      <td bgcolor="#F3F3F3" style="PADDING-LEFT: 6px"><div align="center">选择分类：</div></td>
      <td width="719" style="PADDING-LEFT: 6px">
        大类:
      <%set rs=server.CreateObject("adodb.recordset")
        rs.open "select * from shop_news_class order by px",conn,1,1
	if rs.eof and rs.bof then
	response.write "请先添加栏目。"
	response.end
	else
%>
      <select name="anclassid" size="1" id="anclassid" onChange="changelocation(document.form1.anclassid.options[document.form1.anclassid.selectedIndex].value)">
        <%      dim selclass
         selclass=rs("id")
        
        do while not rs.eof

  response.write  "<option value="&rs("id")
  if anclassid=rs("id") then response.write " selected "
  response.write ">"&trim(rs("classname"))&"</option>"    
        rs.movenext
        loop
	end if
        rs.close
%>
      </select>
      &nbsp;&nbsp; 小类：
      <select name="nclassid" size="1" id="nclassid" onChange="changelocation3(document.form1.nclassid.options[document.form1.nclassid.selectedIndex].value)">
        <%set rs=server.CreateObject("adodb.recordset")
		rs.open "select * from shop_news_class2 where classid1="&selclass,conn,1,1
if not(rs.eof and rs.bof) then
%>
        <% 
                                 dim selclass3
 				 selclass3=rs("id")
do while not rs.eof
  response.write  "<option value="&rs("id")
  if nclassid=rs("id") then response.write " selected "
  response.write ">"&trim(rs("classname"))&"</option>"  
rs.movenext
loop
end if
        rs.close
        set rs = nothing
        
%>
      </select>
      <font color="#FF0000">&nbsp;&nbsp;&nbsp; </font> 子类：
      <select name="xclassid">
	  
        <%if selclass3="" then
		selclass3=0
		end if
		set rs2=server.CreateObject("adodb.recordset")
		rs2.open "select * from shop_news_class3 where classid2="&selclass3,conn,1,1
if not(rs2.eof and rs2.bof) then
do while not rs2.eof%>
        <option value="<%=rs2("id")%>"<%if xclassid=rs2("id") then %> selected <%end if %> ><%=rs2("classname")%></option>
        <% rs2.movenext
loop


end if
        rs2.close
        set rs2= nothing
%>
      </select>
      <span class="STYLE1">*</span></td>
    </tr>
    <tr bgcolor="#F3F3F3">
      <td width="195" bgcolor="#F3F3F3" style="PADDING-LEFT: 6px"><div align="center">发 表 人：</div></td>
      <td width="719" style="PADDING-LEFT: 6px">
      <input name="addname" type="text" class="wenbenkuang" id="addname" value="<%=session("admin")%>" size="30"></td>
    </tr>
    <tr bgcolor="#F3F3F3">
      <td width="195" bgcolor="#F3F3F3" style="PADDING-LEFT: 6px"><div align="center">新闻内容：</div></td>
      <td width="719" align=left style="PADDING-LEFT: 6px"><IFRAME ID="eWebEditor" SRC="eweb/ewebeditor.htm?id=content&style=yellow" FRAMEBORDER="0" SCROLLING="no" WIDTH="650" HEIGHT="350"></IFRAME>
        <br>      </td>
    </tr>
    <tr bgcolor="#F3F3F3">
      <td height="28" style="PADDING-LEFT: 6px"><div align="center">选择属性：</div></td>
      <td height="28" style="PADDING-LEFT: 6px"><input name="tp" type="checkbox" id="tp" value="0">
是否图片新闻
  <input name="newstop" type="checkbox" id="newstop" value="0">
是否置顶新闻
<input name="newstj" type="checkbox" id="newstj" value="0">
是否推荐新闻
<input name="iuser" type="checkbox" id="iuser" value="0" checked>
是否游客可见</td>
    </tr>
    <tr bgcolor="#F3F3F3">
      <td height="28" colspan="2" style="PADDING-LEFT: 6px"><div align="center">
        <input type="submit" class="go-wenbenkuang" name="Submit" value="提交发表" >
        <input type="hidden" name="Content" value="">
      </div></td>
    </tr>
  </table>
</form>
<br>
<br>
<!--#include file="copyright.asp"-->
<p>&nbsp;</p>
</body>
</html>
