newsedit.asp

来自「生成html的ASP企业站点,可以进行二次开发的」· ASP 代码 · 共 298 行

ASP
298
字号
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META HTTP-EQUIV="ContentCH-Type" ContentCH="text/html; charset=gb2312" />
<TITLE>新闻编辑</TITLE>
<link rel="stylesheet" href="Images/Admin.css">
<script language="javascript" src="../Script/Admin.js"></script>
</HEAD>
<!--#include file="../Include/Const.asp" -->
<!--#include file="../Include/ConnSiteData.asp" -->
<!--#include file="Admin_htmlconfig.asp"-->
<BODY>
<%
Dim quanxian
quanxian=trim(Request.ServerVariables(name))

if Instr(session("AdminPurview"),"|8,")=0 then
  response.write ("<br><br><div align=""center""><font style=""color:red; font-size:9pt; "")>您没有管理该模块的权限!</font></div>")
  response.end
end if
dim Result
Result=request.QueryString("Result")
dim ID,NewsNameCh,NewsNameEn,ViewFlagCh,ViewFlagEn,SortNameCh,SortID,SortPath
dim GroupID,GroupIdName,Exclusive,NoticeFlag,SourceCh,SourceEn,ContentCh,ContentEn,SeoKeywordsCH,SeoKeywordsEN,SeoDescriptionCH,SeoDescriptionEN
ID=request.QueryString("ID")
call NewsEdit()
call AdminSiteInfo
%>
<br>
<table width="95%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  <tr>
    <th height="24" nowrap="nowrap">新闻检索及分类查看:添加,修改,删除新闻信息</th>
  </tr>
  <tr>
    <td height="24" align="center" nowrap="nowrap"  class="forumrow"><a href="NewsEdit.asp?Result=Add" onclick='changeAdminFlag(&quot;添加产品信息&quot;)'>添加新闻信息</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="NewsList.asp" onclick='changeAdminFlag(&quot;新闻列表&quot;)'>查看所有新闻信息</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="NewsSort.asp?Action=Add&amp;ParentID=0" onclick='changeAdminFlag(&quot;产品列表&quot;)'>添加新闻类别</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="Admin_htmlnewsort.asp" onclick='changeAdminFlag(&quot;生成新闻分类页面&quot;)'>生成新闻分类页面</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="Admin_htmlnews.asp" onclick='changeAdminFlag(&quot;生成新闻详细页面&quot;)'>生成新闻详细页面</a></td>
  </tr>
</table>
<br>
<table class="tableborder" width="95%" border="0" align="center" cellpadding="3" cellspacing="1">
  <form name="editForm" method="post" action="NewsEdit.asp?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>">
    <tr>
      <th height="22" colspan="2">【<%If Result = "Add" then%>添加<%ElseIf Result = "Modify" then%>修改<%End If%>新闻】</th>
    </tr>
    <tr>
      <td width="20%" align="right" class="forumRow">中文标题:</td>
      <td width="80%" class="forumRowHighlight"><input name="NewsNameCH" type="text" id="NewsNameCH" style="width: 280" value="<%=NewsNameCH%>" maxlength="100">
        是否显示:<input name="ViewFlagCH" type="checkbox" value="1" checked <%if ViewFlagCH then response.write ("checked")%>>
        <font color="red">*</font> <input type="button" name="btn" value="复制标题" title="复制标题到中文:MetaDescription、MetaKeywords" onClick="CopyWebTitleCH(document.editForm.NewsNameCH.value);"></td>
    </tr>
    <tr>
      <td width="20%" align="right" class="forumRow">英文标题:</td>
      <td width="80%" class="forumRowHighlight"><input name="NewsNameEN" type="text" id="NewsNameEN" style="width: 280" value="<%=NewsNameEN%>" maxlength="100">
        是否显示:<input name="ViewFlagEN" type="checkbox" id="ViewFlagEN" value="1" <%if ViewFlagCH then response.write ("checked")%>>
        <input type="button" name="btn2" value="复制标题" title="复制标题到英文:MetaDescription、MetaKeywords" onClick="CopyWebTitleEN(document.editForm.NewsNameEN.value);"></td>
    </tr> 
    <tr>
      <td align="right" class="forumRow">中文MetaKeywords:</td>
      <td class="forumRowHighlight"><input name="SeoKeywordsCH" type="text" id="SeoKeywordsCH" style="width: 500" value="<%=SeoKeywordsCH%>" maxlength="250"></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">中文MetaDescription:</td>
      <td class="forumRowHighlight"><input name="SeoDescriptionCH" type="text" id="SeoDescriptionCH" style="width: 500" value="<%=SeoDescriptionCH%>" maxlength="250"></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">英文MetaKeywords:</td>
      <td class="forumRowHighlight"><input name="SeoKeywordsEN" type="text" id="SeoKeywordsEN" style="width: 500" value="<%=SeoKeywordsEN%>" maxlength="250"></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">英文MetaDescription:</td>
      <td class="forumRowHighlight"><input name="SeoDescriptionEN" type="text" id="SeoDescriptionEN" style="width: 500" value="<%=SeoDescriptionEN%>" maxlength="250"></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">新闻类别:</td>
      <td class="forumRowHighlight"><input name="SortID" type="text" id="SortID" style="width: 18; background-color:#fffff0" value="<%=SortID%>" readonly> <input name="SortPath" type="text" id="SortPath" style="width: 70; background-color:#fffff0" value="<%=SortPath%>" readonly> <input name="SortNameCH" type="text" id="SortNameCH" value="<%=SortNameCH%>" style="width: 180; background-color:#fffff0" readonly> <a href="javaScript:OpenScript('SelectSort.asp?Result=News',500,500,'')">选择类别</a> <font color="red">*</font></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">中文新闻来源:</td>
      <td class="forumRowHighlight"><input name="SourceCH" type="text" style="width: 280;" value="<%=SourceCH%>" maxlength="100"> <a href="javascript:" onClick="document.editForm.SourceCH.value='<%=AdminSiteTitleCH%>'"><%=AdminSiteTitleCH%></a></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">英文新闻来源:</td>
      <td class="forumRowHighlight"><input name="SourceEN" type="text" id="SourceEN" style="width: 280;" value="<%=SourceEN%>" maxlength="100"> 
      <a href="javascript:" onClick="document.editForm.SourceEN.value='<%=AdminSiteTitleEN%>'"><%=AdminSiteTitleEN%></a></td>
    </tr> 
      <tr>
        <td align="right" class="forumRow">标  记:</td>
        <td class="forumRowHighlight"><input name="NoticeFlag" type="checkbox" style="HEIGHT: 13px;WIDTH: 13px;" value="1" <%if NoticeFlag then response.write ("checked")%>>&nbsp;是否公告</td>
      </tr>	<tr>
      <td align="right" class="forumRow">阅读权限:</td>
      <td class="forumRowHighlight"><select name="GroupID">
          <% call SelectGroup() %>
        </select>
        <input name="Exclusive" type="radio" value="&gt;=" <%if Exclusive="" or Exclusive=">=" then response.write ("checked")%>>
        隶属
        <input type="radio" <%if Exclusive="=" then response.write ("checked")%> name="Exclusive" value="=">
        专属(隶属:权限值≥可查看,专属:权限值=可查看)</td>
    </tr>
    <tr>
      <td align="right" class="forumRow">中文内容:</td>
      <td class="forumRowHighlight"><textarea name="ContentCH" id="ContentCH" style="display:none"><%=Server.HTMLEncode((ContentCH))%></textarea>
	  <iframe ID="eWebEditor1" src="../Editor/ewebeditor.htm?id=ContentCH&style=coolblue" frameborder="0" scrolling="no" width="550" height="350"></iframe></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">英文内容:</td>
      <td class="forumRowHighlight"><textarea name="ContentEN" id="ContentEN" style="display:none"><%=Server.HTMLEncode((ContentEN))%></textarea>
	  <iframe ID="eWebEditor1" src="../Editor/ewebeditor.htm?id=ContentEN&style=coolblue" frameborder="0" scrolling="no" width="550" height="350"></iframe></td>
    </tr>    
	<tr>
      <td align="right" class="forumRow"></td>
      <td class="forumRowHighlight"><input name="submitSaveEdit" type="submit" id="submitSaveEdit" value="保存"> <input type="button" value="返回上一页" onClick="history.back(-1)"></td>
    </tr>
  </form>
</table>
</BODY>
</HTML>
<%

sub NewsEdit()
  dim Action,rsRepeat,rs,sql
  Action=request.QueryString("Action")
  if Action="SaveEdit" then
    set rs = server.createobject("adodb.recordset")
    if len(trim(request.Form("NewsNameCH")))<1 then
      response.write ("<script language='javascript'>alert('请填写新闻名称!');history.back(-1);</script>")
      response.end
    end if
    if request.Form("ViewFlagEn")=1 then
      if len(trim(request.Form("NewsNameEn")))<1 then
      response.write ("<script language=javascript> alert('您已经选择了""英文""显示,因此英文标题必填!');history.back(-1);</script>")
      response.end
      end if
    end if
    if Result="Add" then
	  sql="select * from LiangJingCMS_News"
      rs.open sql,conn,1,3
      rs.addnew
      rs("NewsNameCh")=trim(Request.Form("NewsNameCh"))
      rs("NewsNameEn")=trim(Request.Form("NewsNameEn"))
	  if Request.Form("ViewFlagCh")=1 then
        rs("ViewFlagCh")=Request.Form("ViewFlagCh")
	  else
        rs("ViewFlagCh")=0
	  end if
	  if Request.Form("ViewFlagEn")=1 then
        rs("ViewFlagEn")=Request.Form("ViewFlagEn")
	  else
        rs("ViewFlagEn")=0
	  end if
	  if Request.Form("SortID")="" and Request.Form("SortPath")="" then
        response.write ("<script language='javascript'>alert('请选择所属分类!');history.back(-1);</script>")
        response.end
	  else
	    rs("SortID")=Request.Form("SortID")
		rs("SortPath")=Request.Form("SortPath")
	  end if
	  rs("SourceCh")=trim(Request.Form("SourceCh"))
	  rs("SourceEn")=trim(Request.Form("SourceEn"))	  
	  rs("ContentCh")=trim(Request.Form("ContentCh"))
	  rs("ContentEn")=trim(Request.Form("ContentEn"))
	  if Request.Form("NoticeFlag")=1 then
        rs("NoticeFlag")=Request.Form("NoticeFlag")
	  else
        rs("NoticeFlag")=0
	  end if
      GroupIdName=split(Request.Form("GroupID"),"┎╂┚")
	  rs("GroupID")=GroupIdName(0)
	  rs("Exclusive")=trim(Request.Form("Exclusive"))
	  rs("ContentCH")=trim(Request.Form("ContentCH"))
	  rs("SeoKeywordsCH")=trim(Request.Form("SeoKeywordsCH"))
	  rs("SeoDescriptionCH")=trim(Request.Form("SeoDescriptionCH"))
	  rs("SeoKeywordsEN")=trim(Request.Form("SeoKeywordsEN"))
	  rs("SeoDescriptionEN")=trim(Request.Form("SeoDescriptionEN"))
	  rs("AddTime")=now()
	  rs.update
	  rs.close
	  set rs=Nothing
	  set rs=server.createobject("adodb.recordset")
	  sql="select top 1 ID from LiangJingCMS_News order by ID desc"
	  rs.open sql,conn,1,1
	  ID=rs("ID")
	  rs.close
	  set rs=Nothing
	  if ISHTML = 1 then
	  call htmll("/CH/","/CH/",""&NewName&""&Separated&""&ID&"."&HTMLName&"","NewsView.asp","ID=",ID,"","")
	  call htmll("/EN/","/EN/",""&NewName&""&Separated&""&ID&"."&HTMLName&"","NewsView.asp","ID=",ID,"","")
	  End If
	end if
	if Result="Modify" then
      sql="select * from LiangJingCMS_News where ID="&ID
      rs.open sql,conn,1,3
      rs("NewsNameCh")=trim(Request.Form("NewsNameCh"))
      rs("NewsNameEn")=trim(Request.Form("NewsNameEn"))
	  if Request.Form("ViewFlagCh")=1 then
        rs("ViewFlagCh")=Request.Form("ViewFlagCh")
	  else
        rs("ViewFlagCh")=0
	  end if
	  if Request.Form("ViewFlagEn")=1 then
        rs("ViewFlagEn")=Request.Form("ViewFlagEn")
	  else
        rs("ViewFlagEn")=0
	  end if
	  if Request.Form("SortID")<>"" and Request.Form("SortPath")<>"" then
	    rs("SortID")=Request.Form("SortID")
		rs("SortPath")=Request.Form("SortPath")
	  else
        response.write ("<script language='javascript'>alert('请选择所属分类!');history.back(-1);</script>")
        response.end
	  end if
	  rs("SourceCh")=trim(Request.Form("SourceCh"))
	  rs("SourceEn")=trim(Request.Form("SourceEn"))	  
	  if Request.Form("NoticeFlag")=1 then
        rs("NoticeFlag")=Request.Form("NoticeFlag")
	  else
        rs("NoticeFlag")=0
	  end if
      GroupIdName=split(Request.Form("GroupID"),"┎╂┚")
	  rs("GroupID")=GroupIdName(0)
	  rs("Exclusive")=trim(Request.Form("Exclusive"))
	  rs("ContentCh")=trim(Request.Form("ContentCh"))
	  rs("ContentEn")=trim(Request.Form("ContentEn"))
	  rs("SeoKeywordsCH")=trim(Request.Form("SeoKeywordsCH"))
	  rs("SeoDescriptionCH")=trim(Request.Form("SeoDescriptionCH"))
	  rs("SeoKeywordsEN")=trim(Request.Form("SeoKeywordsEN"))
	  rs("SeoDescriptionEN")=trim(Request.Form("SeoDescriptionEN"))
	  rs.update
	  rs.close
	  set rs=Nothing
	  if ISHTML = 1 then
	  call htmll("/CH/","/CH/",""&NewName&""&Separated&""&ID&"."&HTMLName&"","NewsView.asp","ID=",ID,"","")
	  call htmll("/EN/","/EN/",""&NewName&""&Separated&""&ID&"."&HTMLName&"","NewsView.asp","ID=",ID,"","")
	  End If
	end if
    if ISHTML = 1 then
    response.write "<script language='javascript'>alert('设置成功,相关静态页面已更新!');location.replace('NewsList.asp');</script>"
	Else
	response.write "<script language='javascript'>alert('设置成功!');location.replace('NewsList.asp');</script>"
	End If
  else
	if Result="Modify" then
      set rs = server.createobject("adodb.recordset")
      sql="select * from LiangJingCMS_News where ID="& ID
      rs.open sql,conn,1,1
      if rs.bof and rs.eof then
        response.write ("<center>数据库记录读取错误!</center>")
        response.end
      end if
	  NewsNameCh=rs("NewsNameCh")
	  NewsNameEn=rs("NewsNameEn")
	  ViewFlagCh=rs("ViewFlagCh")
	  ViewFlagEn=rs("ViewFlagEn")
	  SortNameCh=SortText(rs("SortID"))
	  SortID=rs("SortID")
	  SortPath=rs("SortPath")
	  SourceCh=rs("SourceCh")
	  SourceEn=rs("SourceEn")
	  NoticeFlag=rs("NoticeFlag")
	  GroupID=rs("GroupID")
	  Exclusive=rs("Exclusive")
      ContentCh=rs("ContentCh")
      ContentEn=rs("ContentEn")
	  SeoKeywordsCH=rs("SeoKeywordsCH")
	  SeoDescriptionCH=rs("SeoDescriptionCH")
	  SeoKeywordsEN=rs("SeoKeywordsEN")
	  SeoDescriptionEN=rs("SeoDescriptionEN")
	  rs.close
      set rs=nothing
    end if
  end if
end sub

sub SelectGroup()
  dim rs,sql
  set rs = server.createobject("adodb.recordset")
  sql="select GroupID,GroupNameCH from LiangJingCMS_MemGroup"
  rs.open sql,conn,1,1
  if rs.bof and rs.eof then
    response.write("未设组别")
  end if
  while not rs.eof
    response.write("<option value='"&rs("GroupID")&"┎╂┚"&rs("GroupNameCH")&"'")
    if GroupID=rs("GroupID") then response.write ("selected")
    response.write(">"&rs("GroupNameCH")&"</option>")
    rs.movenext
  wend
  rs.close
  set rs=nothing
end sub

Function SortText(ID)
  Dim rs,sql
  Set rs=server.CreateObject("adodb.recordset")
  sql="Select * From LiangJingCMS_NewsSort where ID="&ID
  rs.open sql,conn,1,1
  SortText=rs("SortNameCH")
  rs.close
  set rs=nothing
End Function
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?