NewsList.asp
上传用户:mtjhgs
上传日期:2021-12-08
资源大小:3755k
文件大小:13k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

HTML/CSS

  1. <%@ LANGUAGE = VBScript.Encode %>
  2. <HTML xmlns="http://www.w3.org/1999/xhtml">
  3. <HEAD>
  4. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312" />
  5. <TITLE>新闻列表</TITLE>
  6. <link rel="stylesheet" href="Images/Admin.css">
  7. <script language="javascript" src="../Script/Admin.js"></script>
  8. </HEAD>
  9. <!--#include file="../Include/Const.asp" -->
  10. <!--#include file="../Include/ConnSiteData.asp" -->
  11. <!--#include file="CheckAdmin.asp"-->
  12. <BODY>
  13. <%
  14. if Instr(session("AdminPurview"),"|7,")=0 then
  15.   response.write ("<br><br><div align=""center""><font style=""color:red; font-size:9pt; "")>您没有管理该模块的权限!</font></div>")
  16.   response.end
  17. end if
  18. %>
  19. <%
  20. dim Result,Keyword,SortID,SortPath
  21. Result=request.QueryString("Result")
  22. Keyword=request.QueryString("Keyword")
  23. SortID=request.QueryString("SortID")
  24. SortPath=request.QueryString("SortPath")
  25. function PlaceFlag()
  26.   if Result="Search" Then
  27. If Keyword<>"" Then
  28. Response.Write "新闻:列表 -> 检索 -> 关键字:<font color='red'>"&Keyword&"</font>"
  29. Else
  30. Response.Write "新闻:列表 -> 检索 -> 关键字为空(显示全部新闻)"
  31. End If
  32.   else
  33.     if SortPath<>"" then
  34.       Response.Write "新闻:列表 -> <a href='NewsList.asp'>全部</a>"
  35.   TextPath(SortID)
  36. else
  37.       Response.Write "新闻:列表 -> 全部"
  38. end if
  39.   end if
  40. end function
  41. %>
  42. <br>
  43. <table width="95%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  44.   <tr>
  45.     <th height="24" nowrap="nowrap">新闻检索及分类查看:添加,修改,删除新闻信息</th>
  46.   </tr>
  47.   <tr>
  48.     <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>
  49.   </tr>
  50. </table>
  51. <br>
  52. <table class="tableBorder" width="95%" border="0" align="center" cellpadding="5" cellspacing="1">
  53. <form name="formSearch" method="post" action="Search.asp?Result=News">
  54.   <tr>
  55.     <th height="22" colspan="2" sytle="line-height:150%">【新闻检索及分类查看】</th>
  56.   </tr>
  57.   <tr>
  58.     <td class="forumRow">关键字:<input name="Keyword" type="text" value="<%=Keyword%>" size="20"> <input name="submitSearch" type="submit" value="搜索新闻"></td>
  59.     <td align="right" class="forumRow"><span class="forumrow"><a href="NewsEdit.asp?Result=Add" onclick='changeAdminFlag(&quot;添加产品信息&quot;)'>添加新闻信息</a><font color="#0000FF">&nbsp;|&nbsp;</font></span><a href="NewsList.asp" onclick='changeAdminFlag(&quot;新闻列表&quot;)'>全部新闻</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="NewsSort.asp" onclick='changeAdminFlag(&quot;选择查看分类&quot;)'>其他类别新闻</a></td>
  60.   </tr>
  61.   <tr>
  62.     <td colspan="2" class="forumRow"><%PlaceFlag()%></td>
  63.   </tr>
  64.   </form>
  65. </table>
  66. <br>
  67. <table class="tableBorder" width="95%" border="0" align="center" cellpadding="5" cellspacing="1">
  68. <form action="DelContent.asp?Result=News" method="post" name="formDel">
  69.   <tr>
  70.     <td class="title" width="20">ID</td>
  71. <td width="20" align="center" class="title">中</td>
  72. <td width="20" align="center" class="title">英</td>
  73. <td class="title">新闻标题</td>
  74. <td width="40" align="center" class="title">标记</td>
  75. <td width="80" align="center" class="title">查看组别</td>
  76. <td class="title" width="200">新闻来源</td>
  77. <td class="title" width="120">发布时间</td>
  78. <td width="80" align="center" class="title">人气</td>
  79. <td width="80" align="center" class="title">操作</td>
  80. <td width="80" align="center" class="title"> <input onClick="CheckAll(this.form)" name="buttonAllSelect" type="button" id="submitAllSearch" value="全选"> <input onClick="CheckOthers(this.form)" name="buttonOtherSelect" type="button" id="submitOtherSelect" value="反选"></td>
  81.   </tr>
  82.   <% NewsList() %>
  83.   </form>
  84. </table>
  85. </BODY>
  86. </HTML>
  87. <%
  88. function NewsList()
  89.   dim idCount
  90.   dim pages
  91.       pages=20
  92.   dim pagec
  93.   dim page
  94.       page=clng(request("Page"))
  95.   dim pagenc
  96.       pagenc=2
  97.   dim pagenmax
  98.   dim pagenmin
  99.   dim datafrom
  100.       datafrom="Wygkcnflash_News"
  101.   dim datawhere
  102.       if Result="Search" then
  103.      datawhere="where NewsNameCH like '%" & Keyword &_
  104.            "%' "
  105.   else
  106.     if SortPath<>"" then
  107.   datawhere="where Instr(SortPath,'"&SortPath&"')>0 "
  108.         else
  109.   datawhere=""
  110. end if
  111.   end if
  112.   dim sqlid
  113.   dim Myself,PATH_INFO,QUERY_STRING
  114.       PATH_INFO = request.servervariables("PATH_INFO")
  115.   QUERY_STRING = request.ServerVariables("QUERY_STRING")'
  116.       if QUERY_STRING = "" or Instr(PATH_INFO & "?" & QUERY_STRING,"Page=")=0 then
  117.     Myself = PATH_INFO & "?"
  118.   else
  119.     Myself = Left(PATH_INFO & "?" & QUERY_STRING,Instr(PATH_INFO & "?" & QUERY_STRING,"Page=")-1)
  120.   end if
  121.   dim taxis
  122.       taxis="order by id desc"
  123.   dim i
  124.   dim rs,sql
  125.   sql="select count(ID) as idCount from ["& datafrom &"]" & datawhere
  126.   set rs=server.createobject("adodb.recordset")
  127.   rs.open sql,conn,0,1
  128.   idCount=rs("idCount")
  129.   if(idcount>0) then
  130.     if(idcount mod pages=0)then
  131.   pagec=int(idcount/pages)
  132.     else
  133.       pagec=int(idcount/pages)+1
  134.     end if
  135.     sql="select id from ["& datafrom &"] " & datawhere & taxis
  136.     set rs=server.createobject("adodb.recordset")
  137.     rs.open sql,conn,1,1
  138.     rs.pagesize = pages
  139.     if page < 1 then page = 1
  140.     if page > pagec then page = pagec
  141.     if pagec > 0 then rs.absolutepage = page  
  142.     for i=1 to rs.pagesize
  143.   if rs.eof then exit for  
  144.   if(i=1)then
  145.     sqlid=rs("id")
  146.   else
  147.     sqlid=sqlid &","&rs("id")
  148.   end if
  149.   rs.movenext
  150.     next
  151.   end if
  152.   if(idcount>0 and sqlid<>"") then
  153.     sql="select * from ["& datafrom &"] where id in("& sqlid &") "&taxis
  154.     set rs=server.createobject("adodb.recordset")
  155.     rs.open sql,conn,0,1
  156.     while(not rs.eof)
  157.   Response.Write "<tr>" & vbCrLf
  158.       Response.Write "<td nowrap class=""forumRow"">"&rs("ID")&"</td>" & vbCrLf
  159.       if rs("ViewFlagCH") then
  160.         Response.Write "<td nowrap align='center' class=""forumRow""><a href=""Conversion.asp?id="&rs("ID")&"&LX="&datafrom&"&Operation=downCH""><font color='green'>√</font></a></td>" & vbCrLf
  161.       else
  162.         Response.Write "<td nowrap align='center' class=""forumRow""><a href=""Conversion.asp?id="&rs("ID")&"&LX="&datafrom&"&Operation=upCH""><font color='red'>×</font></a></td>" & vbCrLf
  163.   end If
  164.       if rs("ViewFlagEN") then
  165.         Response.Write "<td nowrap align='center' class=""forumRow""><a href=""Conversion.asp?id="&rs("ID")&"&LX="&datafrom&"&Operation=downEN""><font color='green'>√</font></a></td>" & vbCrLf
  166.       else
  167.         Response.Write "<td nowrap align='center' class=""forumRow""><a href=""Conversion.asp?id="&rs("ID")&"&LX="&datafrom&"&Operation=upEN""><font color='red'>×</font></a></td>" & vbCrLf
  168.   end If
  169.   if StrLen((rs("NewsNameCH")))>40 then
  170.         Response.Write "<td nowrap title='"&rs("NewsNameCH")&"' class=""forumRow""><a href='NewsEdit.asp?Result=Modify&ID="&rs("ID")&"''>"&StrLeft(rs("NewsNameCH"),37)&"</a></td>" & vbCrLf
  171.       else
  172.         Response.Write "<td nowrap title='"&rs("NewsNameCH")&"' class=""forumRow""><a href='NewsEdit.asp?Result=Modify&ID="&rs("ID")&"''>"&rs("NewsNameCH")&"</a></td>" & vbCrLf
  173.       end if 
  174.       Response.Write "<td nowrap align=""center"" class=""forumRow"">" & vbCrLf
  175.       if rs("NoticeFlag") Then
  176.       Response.Write "<font color='red'>公告</font>"
  177.   Else
  178.   Response.Write "<font color='red'>新闻</font>"
  179.   End If
  180.   Response.Write "</td>"
  181.       if rs("Exclusive")=">=" then
  182.         Response.Write "<td nowrap align=""center"" class=""forumRow"">"&ViewGroupName(rs("GroupID"))&" <font color='green'>隶</font></td>" & vbCrLf
  183.       else
  184.         Response.Write "<td nowrap align=""center"" class=""forumRow"">"&ViewGroupName(rs("GroupID"))&" <font color='red'>专</font></td>" & vbCrLf
  185.   end if
  186.   if StrLen((rs("SourceCH")))>21 then
  187.         Response.Write "<td nowrap title='来源:&#13;"&rs("SourceCH")&"' class=""forumRow"">"&StrLeft(rs("SourceCH"),20)&"</td>" & vbCrLf
  188.       else
  189.         Response.Write "<td nowrap title='来源:&#13;"&rs("SourceCH")&"' class=""forumRow"">"&rs("SourceCH")&"</td>" & vbCrLf
  190.       end if 
  191.       Response.Write "<td nowrap class=""forumRow"">"&rs("AddTime")&"</td>" & vbCrLf
  192.       Response.Write "<td align=""center""nowrap class=""forumRow"">"&rs("ClickNumber")&"</td>" & vbCrLf
  193.     Response.Write "<td nowrap align='center' class=""forumRow""><a href='NewsEdit.asp?Result=Modify&ID="&rs("ID")&"'>修改</a></td>" & vbCrLf
  194.   Response.Write "<td nowrap align='center' class=""forumRow""><input name='selectID' type='checkbox' value='"&rs("ID")&"'></td>" & vbCrLf
  195.       Response.Write "</tr>" & vbCrLf
  196.   rs.movenext
  197.     wend
  198.     Response.Write "<tr>" & vbCrLf
  199.     Response.Write "<td colspan='11' nowrap align=""right"" class=""forumRow""> <input type=""submit"" name=""batch"" value=""中文批量显示"" onClick=""return test();""> <input type=""submit"" name=""batch"" value=""英文批量显示"" onClick=""return test();""> <input type=""submit"" name=""batch"" value=""中文批量不显示"" onClick=""return test();""> <input type=""submit"" name=""batch"" value=""英文批量不显示"" onClick=""return test();""> <input name='batch' type='submit' value='删除所选' onClick=""return test();""></td>" & vbCrLf
  200.     Response.Write "</tr>" & vbCrLf
  201.   else
  202.     response.write "<tr><td nowrap align='center' colspan='11' class=""forumRow"">暂无企业新闻</td></tr>"
  203.   end if
  204.   Response.Write "<tr>" & vbCrLf
  205.   Response.Write "<td colspan='11' nowrap class=""forumRow"">" & vbCrLf
  206.   Response.Write "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>" & vbCrLf
  207.   Response.Write "<tr>" & vbCrLf
  208.   Response.Write "<td class=""forumRow"">共计:<font color='red'>"&idcount&"</font>条记录 页次:<font color='red'>"&page&"</font></strong>/"&pagec&" 每页:<font color='red'>"&pages&"</font>条</td>" & vbCrLf
  209.   Response.Write "<td align='right'>" & vbCrLf
  210.   pagenmin=page-pagenc
  211.   pagenmax=page+pagenc
  212.   if(pagenmin<1) then pagenmin=1
  213.   if(page>1) then response.write ("<a href='"& myself &"Page=1'><font style='font-size: 14px; font-family: Webdings'>9</font></a> ")
  214.   if(pagenmin>1) then response.write ("<a href='"& myself &"Page="& page-(pagenc*2+1) &"'><font style='font-size: 14px; font-family: Webdings'>7</font></a> ")
  215.   if(pagenmax>pagec) then pagenmax=pagec
  216.   for i = pagenmin to pagenmax
  217. if(i=page) then
  218.   response.write (" <font color='red'>"& i &"</font> ")
  219. else
  220.   response.write ("[<a href="& myself &"Page="& i &">"& i &"</a>]")
  221. end if
  222.   next
  223.   if(pagenmax<pagec) then response.write (" <a href='"& myself &"Page="& page+(pagenc*2+1) &"'><font style='font-size: 14px; font-family: Webdings'>8</font></a> ")
  224.   if(page<pagec) then response.write ("<a href='"& myself &"Page="& pagec &"'><font style='font-size: 14px; font-family: Webdings'>:</font></a> ")
  225.   Response.Write "第<input name='SkipPage' onKeyDown='if(event.keyCode==13)event.returnValue=false' onchange=""if(/D/.test(this.value)){alert('请输入需要跳转到的页数并且必须为整数!');this.value='"&Page&"';}"" style='width: 28px;' type='text' value='"&Page&"'>页" & vbCrLf
  226.   Response.Write "<input name='submitSkip' type='button' onClick='GoPage("""&Myself&""")' value='转到'>" & vbCrLf
  227.   Response.Write "</td>" & vbCrLf
  228.   Response.Write "</tr>" & vbCrLf
  229.   Response.Write "</table>" & vbCrLf
  230.   rs.close
  231.   set rs=nothing
  232.   Response.Write "</td>" & vbCrLf
  233.   Response.Write "</tr>" & vbCrLf
  234. end Function
  235. Function TextPath(ID)
  236.   Dim rs,sql
  237.   Set rs=server.CreateObject("adodb.recordset")
  238.   sql="Select * From Wygkcnflash_NewsSort where ID="&ID
  239.   rs.open sql,conn,1,1
  240.   TextPath=" -> <a href=""NewsList.asp?SortID="&rs("ID")&"&SortPath="&rs("SortPath")&""">"&rs("SortNameCH")&"</a>"
  241.   if rs("ParentID")<>0 then TextPath rs("ParentID")
  242.   response.write(TextPath)
  243. End Function
  244. Function SortText(ID)
  245.   Dim rs,sql
  246.   Set rs=server.CreateObject("adodb.recordset")
  247.   sql="Select * From Wygkcnflash_NewsSort where ID="&ID
  248.   rs.open sql,conn,1,1
  249.   SortText=rs("SortNameCH")
  250.   rs.close
  251.   set rs=nothing
  252. End Function
  253. Function ViewGroupName(GruopID)
  254.   dim rs,sql
  255.   set rs = server.createobject("adodb.recordset")
  256.   sql="select GroupID,GroupNameCH from Wygkcnflash_MemGroup where GroupID='"&GruopID&"'"
  257.   rs.open sql,conn,1,1
  258.   if rs.bof and rs.eof then
  259.     ViewGroupNameSi="未设组别"
  260.   else
  261.     ViewGroupName=rs("GroupNameCH")
  262.   end if
  263.   rs.close
  264.   set rs=nothing
  265. end Function
  266. %>