📄 news_edit.asp
字号:
<!--#include file="../inc/CheckAdmin.asp"-->
<!--#include file="../inc/Config.asp"-->
<!--#include file="../inc/Navtree.asp"-->
<!--#include file="../inc/Conn.asp"-->
<!--#include file="setting.asp"-->
<%
Dim Language,table,Sortid,delsImg
Language=formatStr(Request("Language"))
if Language="" then Language="C"
table_behind="NewsSort_"
table=Get_Table(table_behind,Language)
Sortid=request("Sortid")
id=request("id")
If id="" or not isnumeric(id) then Check_Alert "非法操作","news_admin.asp"
Sortid=request("Sortid")
If Sortid="" or not isnumeric(Sortid) then Check_Alert "非法操作","news_admin.asp"
if request.form("add")=1 then
N_Name=request("N_Name")
content1=request("content1")
if Trim(Request.Form("Commend2"))="1" then
filepath=AspToHtml(N_Name,content1,Sortid,session("admin"),request("textimg"))
end if
rs.open"select * from News where N_id="&request("id"),conn,1,3
rs("N_Name")=request("N_Name")
'rs("N_Language")=language
rs("N_Sortid")=request.form("Sortid")
rs("N_Content")=request("content1")
'rs("N_Power")=request("power")
set delImg=createobject("scripting.filesystemobject")
if rs("N_Pic")<>request("textimg") and left(rs("N_Pic"),4)=cstr(year(now())) then
delsImg=trim(rs("N_Pic"))
delsImg=server.mappath("../../uploadfile/News_title/"&delsImg)
if delimg.fileexists(delsImg) then
delImg.deletefile(delsImg)
end if
end if
rs("N_Pic")=request("textimg")
if Trim(Request.Form("Commend2"))="1" then
if rs("N_address")<>filepath and rs("N_address")<>"" then
delsImg2=trim(rs("N_address"))
delsImg2=server.mappath(delsImg2)
if delimg.fileexists(delsImg2) then
delImg.deletefile(delsImg2)
end if
end if
rs("N_Address")=filepath
End If
'rs("N_Model")=request("N_Model")
'rs("N_Price")=request("N_Price")
'rs("N_Memo")=request("Others")
rs("N_Special")=request("Commend")
rs("N_Editor")=session("admin")
rs.update
set delImg=nothing
set delImg2=nothing
closeconn
response.redirect("News_Admin.asp?language="&language&"&sortid="&request.form("Sortid"))
response.end
end if
if request("id")<>"" then
rs.open"select * from News where N_Id="&request("id"),conn,1,1
if not rs.eof then
title=rs("N_Name")
content=rs("N_Content")
id=rs("N_id")
Sortid=rs("N_Sortid")
'Power=rs("N_Power")
'Memo=rs("N_Memo")
textimg=rs("N_Pic")
'textimage=rs("N_Pic2")
Commend=rs("N_special")
'Model=rs("N_Model")
'Price=rs("N_Price")
end if
rs.close
end if
if left(textimg,4)=cstr(year(now())) then
spicpath="../../uploadfile/News_title/"&textimg
elseif textimg<>"" then
spicpath=textimg
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网站管理系统</title>
<link href="../Css_Main.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {color: #FF0000}
.style1 {color: #CCCCCC}
-->
</style>
</head>
<script language="JavaScript">
function Check()
{
if (form.Sortid.value == "")
{alert("请选择类别");
form.Sortid.focus();
return false;
}
if (form.N_Name.value == "")
{alert("产品名称不能为空");
form.N_Name.focus();
return false;
}
document.form.submit();
}
</script>
<body>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
<tr>
<td class="title_dh"><div align="center">新闻中心——修改新闻</div></td>
</tr>
</table>
<form name="form" action="" method="post">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
<tr class="title_top">
<td colspan="3"><div align="center">修改新闻</div></td>
</tr>
<tr class="tdbg">
<td width="20%">
<div align="right"><strong>语言版本:</strong></div></td>
<td colspan="2"><%= Check_Language(Language) %>
<input type="hidden" name="add" value=1 id="add"></td>
</tr>
<tr class="tdbg">
<td height="26"><div align="right"><strong>所属分类:</strong></div></td>
<td colspan="2"><select name="Sortid" id="select">
<option value="">类别列表</option>
<%showtreefornav table,"NS_",0,"rs","",SortId,isadd %>
</select>
<font color="#FF0000">*</font></td>
</tr>
<tr class="tdbg">
<td><div align="right"><strong>新闻标题:</strong></div></td>
<td colspan="2"><input name="N_Name" type="text" id="N_Name" size="40" value="<%= title %>">
<font color="#FF0000">*</font></td>
</tr>
<tr class="tdbg" style="display:<% If newsRadio(4)=1 Then %>''<% Else %>none<% End If %>">
<td><div align="right"><strong><strong>新闻预览图:</strong></strong></div></td>
<td id="showpic" style="display:'<%if len(textimg)>11 then%><%else%>none<%end if%>'" ><table width="100%">
<tr>
<td valign="middle" width="21%" id="pic"><a href="<%=spicpath%>" target="_blank"><img src="<%=spicpath%>" width="120" height="50" id="image" border="0"></a></td>
<td valign="middle"><a style="cursor:'hand'" onClick="document.all.hidpic.style.display='';document.all.showpic.style.display='none';"> 更改图片</a> <a style="cursor:hand" onClick="document.all.textimg.value='';document.all.showpic.style.display='none';document.all.hidpic.style.display='';">删除图片</a></td>
</tr>
</table></td>
<td id="hidpic" style="display:'<%if len(textimg)>11 then%>none<%end if%>'" ><table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td id="hiddenframe"><a style="cursor:hand" onClick="document.all.showframe.style.display='';document.all.hiddenframe.style.display='none';"> 上传图片</a> <a style="cursor:hand" onClick="document.all.adddz.style.display='';document.all.hiddenframe.style.display='none';">插入图片URL</a>
<input name="textimg" type="hidden" id="textimg" value="<%= textimg %>"></td>
</tr>
<tr>
<td height="17" id="showframe" style="display:none"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="15"> <div align="left">
<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="245"><iframe src='../inc/uppic.asp?up=../../uploadfile/News_title/&tup=textimg' frameborder=0 height=25 width="100%" scrolling="no"></iframe></td>
<td><div align="left"><a style="cursor:hand" onClick="document.all.showframe.style.display='none';document.all.hiddenframe.style.display='';">取消</a></div></td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="17" id="adddz" style="display:none">
<input name="dz" type="text" id="dz" onChange="document.all.textimg.value=this.value" size="30" >
<a style="cursor:hand" onClick="document.all.adddz.style.display='none';document.all.hiddenframe.style.display='';">取消</a> </td>
</tr>
</table></td>
</tr>
<tr class="tdbg" style="display:<% If newsRadio(0)=1 Then %>''<% Else %>none<% End If %>">
<td><div align="right"><strong>浏览权限:</strong></div></td>
<td colspan="2"><input name="power" type="radio" value="0" <% 'if Power=0 then Response.Write(" checked") %>>
所有浏览者
<input name="power" type="radio" value="1" <% 'if Power=1 then Response.Write(" checked") %>>
普通会员
<input name="power" type="radio" value="2" <% 'if Power=2 then Response.Write(" checked") %>>
商务会员
<input name="power" type="radio" value="3" <% 'if Power=3 then Response.Write(" checked") %>>
VIP会员</td>
</tr>
<tr class="tdbg">
<td><div align="right"><strong>详细说明:</strong></div></td>
<td colspan="2"><input type="hidden" name="content1" value="<%=Server.HTMLEncode(Content)%>">
<iframe ID="eWebEditor1" src="../WebEditor/ewebeditor.asp?id=content1&style=SamYan" frameborder="0" scrolling="no" width="560" HEIGHT="350"></iframe> </td>
</tr>
<tr class="tdbg" style="display:<% If newsRadio(1)=1 Then %>''<% Else %>none<% End If %>">
<td><div align="right"><strong>特殊标记:</strong></div></td>
<td colspan="2"><input name="Commend" type="checkbox" id="Commend" value="1" <% if commend=1 then response.Write(" checked") %>>
推荐</td>
</tr>
<tr class="tdbg" style="display:<% If newsRadio(2)=1 Then %>''<% Else %>none<% End If %>">
<td><div align="right"><strong>生成静态网页:</strong></div></td>
<td colspan="2"><div align="left">
<input type="radio" name="Commend2" value="1">
是
<input name="Commend2" type="radio" value="0" checked>
否
<input name="newsAddress" type="hidden" id="newsAddress" value="a">
</div></td>
</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="40">
<div align="center"><span class="style1">
<input type="hidden" name="id" value="<%= id %>">
<input name="Submit" type="button" id="Submit" value="修改" onClick="Check()">
<input name="reset" type="reset" id="reset" value="取消">
</span> </div></td>
</tr>
</table></form>
</body>
</html>
<%function AspToHtml(N_Name2,content2,ids,adder,pic)
sql="select top 1 * from Temple where tp_flag=1 and TP_Language like '%"&Language&"%' and tp_sortid="&ids&" order by Tp_id desc"
set rs=Server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof then
rs.close
exit function
end if
mb_code=rs("Tp_temple")
rs.close
c_title=N_Name2
c_content=content2
'lan=Trim(Request.Form("language"))
'response.Write lan
'response.End()
fname = makefilename(now()) ''makefilename为自定义函数
folder = "../../NewsCenter/"
filepath = folder&fname
'sql = "Select * from asp2html"
'Set rs = Server.CreateObject ("ADODB.Recordset")
'rs.Open sql,conn,3,2
'rs.addnew
'rs("a_title")=c_title
'rs("a_content")=c_content
'rs("a_filepath")=fname
'rs("A_language")=lan
'rs.update
'rs.close
c_title=htmlencode(c_title)
c_content=htmlencode(c_content)
mb_code=replace(mb_code,"$newstitle$",c_title)
mb_code=replace(mb_code,"$newspic$",pic)
mb_code=replace(mb_code,"$newscontent$",c_content)
mb_code=replace(mb_code,"$newsEditor$",adder)
'response.Write mb_code&"<br>"
paths=Server.MapPath(filepath)
'response.Write paths
'response.End()
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.CreateTextFile(paths, True)
fout.WriteLine mb_code
fout.close
AspToHtml=fname
end function%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -