<!--#include file="../conn/conn2.asp" -->
<!--#include file="../conn/function.asp" -->
<!--#include file="admin_check.asp" -->
<%
if CA_a3<>1 then
response.Write "<div style='border:#FF0000 solid 1px;padding:10px;margin:10px;color:#FF0000'>您没有权限管理该模块！</div>"
response.end()
end if
%>
<%
action=Request.QueryString("action")
N_id=Request.QueryString("N_id")

if N_id<>"" then
aa="edit&N_id="&N_id
sql="Select * from news Where N_id="&N_id
		set rs=Server.CreateObject("ADODB.RecordSet")
		rs.open sql,conn,1,1
		if not rs.eof then
		N_title=rs("N_title")
		N_content=rs("N_content")
		N_pic=rs("N_pic")
N_thumb=rs("N_thumb")
		N_sort=rs("N_sort")
		end if
		rs.close
set rs=nothing
else
aa="add"
end if
		
if action="add" then

N_title=Request.Form("N_title")
N_content=Request.Form("N_content")
N_pic=Request.Form("N_pic")
N_thumb=Request.Form("N_thumb")
N_sort=Request.Form("N_sort")

if left(N_pic,5)="media" then
N_pic=N_pic
end if

if left(N_pic,4)="http" then
N_pic=N_pic
end if

if left(N_pic,1)="2" then
N_pic="media/"&N_pic
end if

if left(N_thumb,5)="media" then
N_thumb=N_thumb
end if

if left(N_thumb,4)="http" then
N_thumb=N_thumb
end if

if left(N_thumb,1)="2" then
N_thumb="media/"&N_thumb
end if
if N_title<>"" and N_content<>"" and N_pic<>"" and N_sort<>"" then
sql="Insert into news(N_title,N_content,N_pic,N_thumb,N_sort,N_date) values('"&N_title&"','"&N_content&"','"&N_pic&"','"&N_thumb&"',"&N_sort&",'"&now()&"')"
conn.execute(sql)
Response.Write"<script>alert('添加新闻成功!');window.location='news_list.asp';</script>"
else
Response.Write"<script>alert('请填全信息!');history.back();</script>"
end if
end if

if action="edit" then
N_title=Request.Form("N_title")
N_content=Request.Form("N_content")
N_pic=Request.Form("N_pic")
N_thumb=Request.Form("N_thumb")
N_sort=Request.Form("N_sort")

if left(N_pic,5)="media" then
N_pic=N_pic
end if

if left(N_pic,4)="http" then
N_pic=N_pic
end if

if left(N_pic,1)="2" then
N_pic="media/"&N_pic
end if

if left(N_thumb,5)="media" then
N_thumb=N_thumb
end if

if left(N_thumb,4)="http" then
N_thumb=N_thumb
end if

if left(N_thumb,1)="2" then
N_thumb="media/"&N_thumb
end if

if N_title<>"" and N_content<>"" and N_pic<>"" and N_sort<>"" then
sql="Select * from news Where N_id="&N_id
		set rs=Server.CreateObject("ADODB.RecordSet")
		rs.open sql,conn,1,3
		if not rs.eof then
		rs("N_title")=N_title
		rs("N_content")=N_content
		rs("N_pic")=N_pic
		if W_Nthumb="true" then
		rs("N_thumb")=N_thumb
		end if
		rs("N_sort")=N_sort
		rs("N_date")=now()
		rs.update
		rs.close
		end if
Response.Write"<script>alert('修改新闻成功!');window.location='news_list.asp';</script>"
else
Response.Write"<script>alert('请填全信息!');history.back();</script>"
end if
end if

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Flash后台管理</title>
<style>
html,body,div,span,p,a,img,ul,li,dl,dt,dd,ol,form,label,form{ margin:0; padding:0; border:0; outline:0; font-size:100%;}
body{ font-size:12px;font-family:微软雅黑; line-height:150%; background-color:#eeeeee}
a{ font-size:12px; color:#000000; text-decoration:none;}
a:link{ color:#000000;}
a:visited{ color:#000000;}
a:hover{ text-decoration:underline; color:#0066ff;}
a:active{ color:#0066ff;}

a img {
	border:none;
}
.container{ width:1000px; margin:0 auto;}
.title{width:1010px; height:30px; margin-top:10px; background-image:url(img/untitled.png);}
.content{width:990px; background-color:#FFFFFF; padding-left:10px; padding-top:10px;padding-bottom:10px;padding-right:10px; line-height:200%}
.input1 {border-top:1px solid #ABADB3;border-left:1px solid #ABADB3;border-right:1px solid #ddd;border-bottom:1px solid #ddd;height:24px;width:400px;padding:0 5px;}
.input2 {border:1px solid #FFB334;outline:2px solid #ffdc97;*border:2px solid #FFB334;*padding:2px 5px;height:24px;width:400px;padding:0 5px;}
.right{width:150px;float:left}
.left{width:800px; padding-right:10px; float:left}
.submit{ width:131px;height:34px; border:hidden; font-family:"微软雅黑";color:#FFFFFF;background-image:url(img/btn.png);cursor:hand;font-size:15px}
.submit2{ width:131px;height:34px; border:hidden; font-family:"微软雅黑";color:#FFFFFF;background-image:url(img/btn2.png);cursor:hand;font-size:15px}
/********光标说明**************/
#pltsTipLayer
{
	FILTER: alpha(opacity=100);
	opacity: 1;
	background: #ffffff;
	color:#0066ff;
	border: 1px solid #dddddd;

}
.Bttd
{
	font-size:12px;

	border:0;
	padding:5px;

}



</style>
<script type="text/javascript" src="../upload/AienUpload/init.js"></script>
<SCRIPT LANGUAGE="JavaScript" src="js/help2.js"></SCRIPT>
<script type="text/javascript" src="js/show.js"></script>
<script> 
function sayHello(name) {
form.N_content.value=name;
}
</script>
</head>
<body>
<!--#include file="left.asp" -->
<div class="container">
<div class="title"><img src="img/orange.png" style="margin-left:10px; margin-top:5px; margin-right:10px;"><b>新闻管理</b> >>  <a href="news_list.asp">新闻列表</a> | <font color="#0066ff"><u>新增新闻</u></font> | <a href="Nsort_list.asp">新闻分类列表</a> | <a href="Nsort_add.asp">新增新闻分类</a></div>
<div class="content">
<h2>添加新闻</h2><hr>
<form id="form" name="form1" method="post" action="news_add.asp?action=<%=aa%>" onsubmit="return check();">
<table width="100%">
<tr><td width="12%">新闻标题：</td><td><input type="text" name="N_title" value="<%=N_title%>" class="input1" onFocus="this.className='input2'" onBlur="this.className='input1'"/></td></tr></table>

<%
if GetBody(D_domain)="" then
%>
<embed src="yz.swf?domain=<%=D_domain%>&vision=<%=D_version%>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="0" height="0"></embed>
<script> 
function sendToJavaScript(value) {
if(value=="1"){
document.getElementById("old").innerHTML="<table width='100%'><tr><td width='12%'>新闻描述：</td><td><textarea name='N_content' id='N_content' ROWS='1' COLS='1' style='display:none'><%=replace(N_content,"""","'")%></textarea><embed src='txt.swf?D_type=news&D_id=<%=N_id%>&domain=<%=D_domain%>&vision=<%=D_version%>' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='770' height='410'></embed></td></tr></table>"
}else{
document.getElementById("old").innerHTML="<table width='100%'><tr><td width='12%'>新闻描述：</td><td><textarea name='N_content' id='N_content' ROWS='10' COLS='80'><%=replace(N_content,"""","'")%></textarea> *免费版无富文本编辑器</td></tr></table>"
}
}
</script>
<div id="old"></div>
<%
else 
if split(GetBody(D_domain),"|")(0)="1" then
%>
<table width="100%"><tr><td width="12%">新闻描述：</td><td><script charset="utf-8" src="../kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="../kindeditor/lang/zh_CN.js"></script>
<script>
KindEditor.ready(function(K) {
        K.create('#content', {
                uploadJson : '../kindeditor/asp/upload_json.asp',
                fileManagerJson : '../kindeditor/asp/file_manager_json.asp',
                allowFileManager : true,
				items:[ 'source', '|', 'undo', 'redo', '|', 'preview', 'cut', 'copy', 'paste','plainpaste', '|', 'justifyleft', 'justifycenter', 'justifyright','justifyfull', 'insertunorderedlist','clearhtml', 'selectall', '|', 'fullscreen', 'fontname', 'fontsize', '|', 'forecolor', 'bold','italic', 'underline', 'removeformat', '|', 'image', 'multiimage','insertfile',  'link', 'unlink', '|', 'about']
				
        });
		
});
</script>
<textarea name="N_content" style="width:100%;height:350px;" id="content"><%=server.htmlencode(N_content)%></textarea></td></tr></table>
<%else%>
<table width="100%"><tr><td width="12%">新闻描述：</td><td><textarea name="N_content" id="N_content" ROWS="10" COLS="80"><%=N_content%></textarea> *免费版无富文本编辑器</td>
</tr></table>
<%
end if
end if
%>
<table width="100%"><tr><td width="12%">新闻图片：</td><td><input type="text" name="N_pic" id="N_pic" value="<%=N_pic%>" class="input1" onFocus="this.className='input2'" onBlur="this.className='input1'"/> <input type="button" value="上传文件" onclick="showUpload('N_pic','N_pic','',1,null,'<%=N_picw%>','<%=N_pich%>');" /> <a href="javascript:void(0);" onClick="alertWin('使用帮助','最佳尺寸<%=N_picw%>*<%=N_pich%>，图片不符合尺寸将会自动裁切',700,50);"><img src="img/q.png" alt="最佳尺寸<%=N_picw%>*<%=N_pich%>，图片不符合尺寸将会自动裁切"></a></td></tr>
<%if W_Nthumb="true" then%>
<tr><td width="12%">新闻小图：</td><td><input type="text" name="N_thumb" id="N_thumb" value="<%=N_thumb%>" class="input1" onFocus="this.className='input2'" onBlur="this.className='input1'"/> <input type="button" value="上传文件" onclick="showUpload('N_thumb','N_thumb','',1,null,'<%=N_thumbw%>','<%=N_thumbh%>');" /> <a href="javascript:void(0);" onClick="alertWin('使用帮助','最佳尺寸<%=N_thumbw%>*<%=N_thumbh%>，图片不符合尺寸将会自动裁切',700,50);"><img src="img/q.png" alt="最佳尺寸<%=N_thumbw%>*<%=N_thumbh%>，图片不符合尺寸将会自动裁切"></a></td></tr>
<%end if%>
<tr><td width="12%">新闻分类：</td><td><select name="N_sort">
			<%
				sql1="Select S_title,S_id from NSort"
				set rs1=Server.CreateObject("ADODB.RecordSet")
				rs1.open sql1,conn,1,1
				if not rs1.eof then
				for i=1 to rs1.recordcount
			%>
				<option value="<%=rs1("S_id")%>" <%if cstr(rs1("S_id"))=cstr(N_sort) then%>selected="selected"<%end if%>><%=rs1("S_title")%></option>
			<%
				rs1.movenext
				next
				end if
				rs1.close
				set rs1=nothing
			%>
			  </select></td></tr>
<tr><td width="12%"></td><td><input name="Submit" type="submit" class="submit" onmouseover="this.className='submit2'" onmouseout="this.className='submit'"  value="确 认" /></td></tr></table>
</form>
</div>

</div>
</body>
</html>
<%
Call CloseConn()
Response.End()
%>