yns_list.asp
上传用户:yjkj1008
上传日期:2020-10-17
资源大小:1496k
文件大小:15k
源码类别:

电子政务应用

开发平台:

HTML/CSS

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> 
  2. <!--#include file="Connections/conn_news.asp" -->
  3. <%
  4. Dim rsn__MMColParam
  5. rsn__MMColParam = "1"
  6. If (Request("n_title")  <> "") Then 
  7.   rsn__MMColParam = Request("n_title") 
  8. End If
  9. %>
  10. <%
  11. Dim rsn__MMColParam2
  12. rsn__MMColParam2 = "1"
  13. If (Request.QueryString("t_id") <> "") Then 
  14.   rsn__MMColParam2 = Request.QueryString("t_id")
  15. End If
  16. %>
  17. <%
  18. ' *** Restrict Access To Page: Grant or deny access to this page
  19. MM_authorizedUsers="1,2,3"
  20. MM_authFailedURL="default.asp"
  21. MM_grantAccess=false
  22. If Session("MM_Username") <> "" Then
  23.   If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
  24.          (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
  25.     MM_grantAccess = true
  26.   End If
  27. End If
  28. If Not MM_grantAccess Then
  29.   MM_qsChar = "?"
  30.   If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  31.   MM_referrer = Request.ServerVariables("URL")
  32.   if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  33.   MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  34.   Response.Redirect(MM_authFailedURL)
  35. End If
  36. %>
  37. <%
  38. Dim rsn
  39. Dim rsn_numRows
  40. Set rsn = Server.CreateObject("ADODB.Recordset")
  41. rsn.ActiveConnection = MM_conn_news_STRING
  42. if Request("n_title")<>"" then
  43. rsn.Source = "SELECT n_id, n_tid, n_title, n_index, n_fname, n_check, t_name  FROM t_news inner join t_type on t_news.n_tid = t_type.t_id  WHERE n_title LIKE '%" + Replace(rsn__MMColParam, "'", "''") + "%'  ORDER BY n_date DESC"
  44. elseif Request.QueryString("t_id")<>"" then
  45. rsn.Source = "SELECT n_id, n_tid, n_title, n_index, n_fname, n_check, t_name  FROM t_news inner join t_type on t_news.n_tid = t_type.t_id  WHERE n_tid = " + Replace(rsn__MMColParam2, "'", "''") + "  ORDER BY n_date DESC"
  46. else
  47. rsn.Source = "SELECT n_id, n_tid, n_title, n_index, n_fname, n_check, t_name  FROM t_news inner join t_type on t_news.n_tid = t_type.t_id  ORDER BY n_date DESC"
  48. end if
  49. rsn.CursorType = 0
  50. rsn.CursorLocation = 2
  51. rsn.LockType = 1
  52. rsn.Open()
  53. rsn_numRows = 0
  54. %>
  55. <%
  56. Dim rst
  57. Dim rst_numRows
  58. Set rst = Server.CreateObject("ADODB.Recordset")
  59. rst.ActiveConnection = MM_conn_news_STRING
  60. rst.Source = "SELECT * FROM t_type"
  61. rst.CursorType = 0
  62. rst.CursorLocation = 2
  63. rst.LockType = 1
  64. rst.Open()
  65. rst_numRows = 0
  66. %>
  67. <%
  68. Dim rssetup
  69. Dim rssetup_numRows
  70. Set rssetup = Server.CreateObject("ADODB.Recordset")
  71. rssetup.ActiveConnection = MM_conn_news_STRING
  72. rssetup.Source = "SELECT * FROM t_setup"
  73. rssetup.CursorType = 0
  74. rssetup.CursorLocation = 2
  75. rssetup.LockType = 1
  76. rssetup.Open()
  77. rssetup_numRows = 0
  78. %>
  79. <%
  80. Dim Repeat1__numRows
  81. Dim Repeat1__index
  82. Repeat1__numRows = (rssetup.Fields.Item("st_lnum").Value)
  83. Repeat1__index = 0
  84. rsn_numRows = rsn_numRows + Repeat1__numRows
  85. %>
  86. <%
  87. Dim Repeat2__numRows
  88. Dim Repeat2__index
  89. Repeat2__numRows = -1
  90. Repeat2__index = 0
  91. rst_numRows = rst_numRows + Repeat2__numRows
  92. %>
  93. <%
  94. '  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
  95. Dim rsn_total
  96. Dim rsn_first
  97. Dim rsn_last
  98. ' set the record count
  99. rsn_total = rsn.RecordCount
  100. ' set the number of rows displayed on this page
  101. If (rsn_numRows < 0) Then
  102.   rsn_numRows = rsn_total
  103. Elseif (rsn_numRows = 0) Then
  104.   rsn_numRows = 1
  105. End If
  106. ' set the first and last displayed record
  107. rsn_first = 1
  108. rsn_last  = rsn_first + rsn_numRows - 1
  109. ' if we have the correct record count, check the other stats
  110. If (rsn_total <> -1) Then
  111.   If (rsn_first > rsn_total) Then
  112.     rsn_first = rsn_total
  113.   End If
  114.   If (rsn_last > rsn_total) Then
  115.     rsn_last = rsn_total
  116.   End If
  117.   If (rsn_numRows > rsn_total) Then
  118.     rsn_numRows = rsn_total
  119.   End If
  120. End If
  121. %>
  122. <%
  123. ' *** Recordset Stats: if we don't know the record count, manually count them
  124. If (rsn_total = -1) Then
  125.   ' count the total records by iterating through the recordset
  126.   rsn_total=0
  127.   While (Not rsn.EOF)
  128.     rsn_total = rsn_total + 1
  129.     rsn.MoveNext
  130.   Wend
  131.   ' reset the cursor to the beginning
  132.   If (rsn.CursorType > 0) Then
  133.     rsn.MoveFirst
  134.   Else
  135.     rsn.Requery
  136.   End If
  137.   ' set the number of rows displayed on this page
  138.   If (rsn_numRows < 0 Or rsn_numRows > rsn_total) Then
  139.     rsn_numRows = rsn_total
  140.   End If
  141.   ' set the first and last displayed record
  142.   rsn_first = 1
  143.   rsn_last = rsn_first + rsn_numRows - 1
  144.   
  145.   If (rsn_first > rsn_total) Then
  146.     rsn_first = rsn_total
  147.   End If
  148.   If (rsn_last > rsn_total) Then
  149.     rsn_last = rsn_total
  150.   End If
  151. End If
  152. %>
  153. <%
  154. Dim MM_paramName 
  155. %>
  156. <%
  157. ' *** Move To Record and Go To Record: declare variables
  158. Dim MM_rs
  159. Dim MM_rsCount
  160. Dim MM_size
  161. Dim MM_uniqueCol
  162. Dim MM_offset
  163. Dim MM_atTotal
  164. Dim MM_paramIsDefined
  165. Dim MM_param
  166. Dim MM_index
  167. Set MM_rs    = rsn
  168. MM_rsCount   = rsn_total
  169. MM_size      = rsn_numRows
  170. MM_uniqueCol = ""
  171. MM_paramName = ""
  172. MM_offset = 0
  173. MM_atTotal = false
  174. MM_paramIsDefined = false
  175. If (MM_paramName <> "") Then
  176.   MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
  177. End If
  178. %>
  179. <%
  180. ' *** Move To Record: handle 'index' or 'offset' parameter
  181. if (Not MM_paramIsDefined And MM_rsCount <> 0) then
  182.   ' use index parameter if defined, otherwise use offset parameter
  183.   MM_param = Request.QueryString("index")
  184.   If (MM_param = "") Then
  185.     MM_param = Request.QueryString("offset")
  186.   End If
  187.   If (MM_param <> "") Then
  188.     MM_offset = Int(MM_param)
  189.   End If
  190.   ' if we have a record count, check if we are past the end of the recordset
  191.   If (MM_rsCount <> -1) Then
  192.     If (MM_offset >= MM_rsCount Or MM_offset = -1) Then  ' past end or move last
  193.       If ((MM_rsCount Mod MM_size) > 0) Then         ' last page not a full repeat region
  194.         MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
  195.       Else
  196.         MM_offset = MM_rsCount - MM_size
  197.       End If
  198.     End If
  199.   End If
  200.   ' move the cursor to the selected record
  201.   MM_index = 0
  202.   While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1))
  203.     MM_rs.MoveNext
  204.     MM_index = MM_index + 1
  205.   Wend
  206.   If (MM_rs.EOF) Then 
  207.     MM_offset = MM_index  ' set MM_offset to the last possible record
  208.   End If
  209. End If
  210. %>
  211. <%
  212. ' *** Move To Record: if we dont know the record count, check the display range
  213. If (MM_rsCount = -1) Then
  214.   ' walk to the end of the display range for this page
  215.   MM_index = MM_offset
  216.   While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
  217.     MM_rs.MoveNext
  218.     MM_index = MM_index + 1
  219.   Wend
  220.   ' if we walked off the end of the recordset, set MM_rsCount and MM_size
  221.   If (MM_rs.EOF) Then
  222.     MM_rsCount = MM_index
  223.     If (MM_size < 0 Or MM_size > MM_rsCount) Then
  224.       MM_size = MM_rsCount
  225.     End If
  226.   End If
  227.   ' if we walked off the end, set the offset based on page size
  228.   If (MM_rs.EOF And Not MM_paramIsDefined) Then
  229.     If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
  230.       If ((MM_rsCount Mod MM_size) > 0) Then
  231.         MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
  232.       Else
  233.         MM_offset = MM_rsCount - MM_size
  234.       End If
  235.     End If
  236.   End If
  237.   ' reset the cursor to the beginning
  238.   If (MM_rs.CursorType > 0) Then
  239.     MM_rs.MoveFirst
  240.   Else
  241.     MM_rs.Requery
  242.   End If
  243.   ' move the cursor to the selected record
  244.   MM_index = 0
  245.   While (Not MM_rs.EOF And MM_index < MM_offset)
  246.     MM_rs.MoveNext
  247.     MM_index = MM_index + 1
  248.   Wend
  249. End If
  250. %>
  251. <%
  252. ' *** Move To Record: update recordset stats
  253. ' set the first and last displayed record
  254. rsn_first = MM_offset + 1
  255. rsn_last  = MM_offset + MM_size
  256. If (MM_rsCount <> -1) Then
  257.   If (rsn_first > MM_rsCount) Then
  258.     rsn_first = MM_rsCount
  259.   End If
  260.   If (rsn_last > MM_rsCount) Then
  261.     rsn_last = MM_rsCount
  262.   End If
  263. End If
  264. ' set the boolean used by hide region to check if we are on the last record
  265. MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
  266. %>
  267. <%
  268. ' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
  269. Dim MM_keepNone
  270. Dim MM_keepURL
  271. Dim MM_keepForm
  272. Dim MM_keepBoth
  273. Dim MM_removeList
  274. Dim MM_item
  275. Dim MM_nextItem
  276. ' create the list of parameters which should not be maintained
  277. MM_removeList = "&index="
  278. If (MM_paramName <> "") Then
  279.   MM_removeList = MM_removeList & "&" & MM_paramName & "="
  280. End If
  281. MM_keepURL=""
  282. MM_keepForm=""
  283. MM_keepBoth=""
  284. MM_keepNone=""
  285. ' add the URL parameters to the MM_keepURL string
  286. For Each MM_item In Request.QueryString
  287.   MM_nextItem = "&" & MM_item & "="
  288.   If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
  289.     MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
  290.   End If
  291. Next
  292. ' add the Form variables to the MM_keepForm string
  293. For Each MM_item In Request.Form
  294.   MM_nextItem = "&" & MM_item & "="
  295.   If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
  296.     MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
  297.   End If
  298. Next
  299. ' create the Form + URL string and remove the intial '&' from each of the strings
  300. MM_keepBoth = MM_keepURL & MM_keepForm
  301. If (MM_keepBoth <> "") Then 
  302.   MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
  303. End If
  304. If (MM_keepURL <> "")  Then
  305.   MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
  306. End If
  307. If (MM_keepForm <> "") Then
  308.   MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
  309. End If
  310. ' a utility function used for adding additional parameters to these strings
  311. Function MM_joinChar(firstItem)
  312.   If (firstItem <> "") Then
  313.     MM_joinChar = "&"
  314.   Else
  315.     MM_joinChar = ""
  316.   End If
  317. End Function
  318. %>
  319. <%
  320. ' *** Move To Record: set the strings for the first, last, next, and previous links
  321. Dim MM_keepMove
  322. Dim MM_moveParam
  323. Dim MM_moveFirst
  324. Dim MM_moveLast
  325. Dim MM_moveNext
  326. Dim MM_movePrev
  327. Dim MM_urlStr
  328. Dim MM_paramList
  329. Dim MM_paramIndex
  330. Dim MM_nextParam
  331. MM_keepMove = MM_keepBoth
  332. MM_moveParam = "index"
  333. ' if the page has a repeated region, remove 'offset' from the maintained parameters
  334. If (MM_size > 1) Then
  335.   MM_moveParam = "offset"
  336.   If (MM_keepMove <> "") Then
  337.     MM_paramList = Split(MM_keepMove, "&")
  338.     MM_keepMove = ""
  339.     For MM_paramIndex = 0 To UBound(MM_paramList)
  340.       MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=") - 1)
  341.       If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
  342.         MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
  343.       End If
  344.     Next
  345.     If (MM_keepMove <> "") Then
  346.       MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
  347.     End If
  348.   End If
  349. End If
  350. ' set the strings for the move to links
  351. If (MM_keepMove <> "") Then 
  352.   MM_keepMove = MM_keepMove & "&"
  353. End If
  354. MM_urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="
  355. MM_moveFirst = MM_urlStr & "0"
  356. MM_moveLast  = MM_urlStr & "-1"
  357. MM_moveNext  = MM_urlStr & CStr(MM_offset + MM_size)
  358. If (MM_offset - MM_size < 0) Then
  359.   MM_movePrev = MM_urlStr & "0"
  360. Else
  361.   MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
  362. End If
  363. %>
  364. <html>
  365. <head>
  366. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  367. <title>业一新闻系统3.0正式版-------业一网络Yeyi.net制作</title>
  368. <link href="style/css.css" rel="stylesheet" type="text/css">
  369. </head>
  370. <body bgcolor="#FFFFFF">
  371. <table width="610" border="0" align="center" cellpadding="0" cellspacing="0">
  372.   <tr> 
  373.     <form name="form2" method="get" action="yns_list.asp">
  374.       <td width="255" height="30" > 
  375.       <input style="font-family: 宋体; font-size: 9pt" name="n_title" type="text" id="n_title" size="20"> 
  376.         <input style="font-family: 宋体; font-size: 9pt" name="Submit2" type="submit"   value="标题搜索"> 
  377.       </td>
  378.       <td width="355" height="30" >共有结果 <font color="#FF0000"><%=(rsn_total)%></font>&nbsp; 本页显示第 <font color="#FF0000"><%=(rsn_first)%></font> 到 <font color="#FF0000"><%=(rsn_last)%></font> 记录 </td>
  379.     </form>
  380.   </tr>
  381.   <tr> 
  382.     <td height="3" colspan="2" bgcolor="#CCCCCC"></td>
  383.   </tr>
  384.   <tr> 
  385.     <td height="25" colspan="2" class="bg">| 
  386.       <% 
  387. While ((Repeat2__numRows <> 0) AND (NOT rst.EOF)) 
  388. %>
  389.       <a href="yns_list.asp?t_id=<%=(rst.Fields.Item("t_id").Value)%>"><%=(rst.Fields.Item("t_name").Value)%></a> | 
  390.       <% 
  391.   Repeat2__index=Repeat2__index+1
  392.   Repeat2__numRows=Repeat2__numRows-1
  393.   rst.MoveNext()
  394. Wend
  395. %> </td>
  396.   </tr>
  397. </table>
  398. <p class="title"></p>
  399. <table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
  400.   
  401.   <% 
  402. While ((Repeat1__numRows <> 0) AND (NOT rsn.EOF)) 
  403. %>
  404.   <tr> 
  405.     <td width="70%"><font color="#FF0000">[<%=(rsn.Fields.Item("t_name").Value)%>]</font><a href="<%=(rsn.Fields.Item("n_tid").Value)%>/<%=(rsn.Fields.Item("n_fname").Value)%>" target="_blank"><%=(rsn.Fields.Item("n_title").Value)%></a> <% if rsn("n_index")=true then  %> <font color="#999900">(图)</font> <% End If %> </td>
  406.     <% If Session("MM_UserAuthorization")="3" Then %>
  407.     <form name="form1" method="post" action="yns_del.asp">
  408.       <td width="10%"> 
  409.         <input type="submit" name="Submit" value="删除"> <input name="n_fname" type="hidden" id="n_fname" value="<%=(rsn.Fields.Item("n_fname").Value)%>"> 
  410.         <input name="n_id" type="hidden" id="n_id" value="<%=(rsn.Fields.Item("n_id").Value)%>"> 
  411.         <input name="n_fpath" type="hidden" id="n_fpath" value="<%=(rsn.Fields.Item("n_tid").Value)%>"> 
  412.       </td>
  413.     </form>
  414.     <% End If %>
  415.     <% If Session("MM_UserAuthorization")="3" or Session("MM_UserAuthorization")="2" Then %>
  416.     <td width="10%"><a href="yns_updata.asp?n_id=<%=(rsn.Fields.Item("n_id").Value)%>">更新</a> 
  417.     </td>
  418.     <% End If %>
  419.     <% If  Session("MM_UserAuthorization")="2" or Session("MM_UserAuthorization")="3" Then %>
  420.     <form name="form3" method="post" action="yns_check.asp">
  421.       <td width="10%"> 
  422.         <% If rsn.Fields.Item("n_check").Value = false Then %> <input type="submit" name="Submit3" value="未审核"> <input name="n_id" type="hidden" id="n_id" value="<%=(rsn.Fields.Item("n_id").Value)%>"> 
  423.         <input name="n_check" type="hidden" id="n_check2" value="true"> <% Else %> <input type="submit" name="Submit4" value="已审核"> <input name="n_id" type="hidden" id="n_id" value="<%=(rsn.Fields.Item("n_id").Value)%>"> 
  424.         <input name="n_check" type="hidden" id="n_check3" value="false"> <% end if %> </td>
  425.     </form>
  426.     <% End If %>
  427.   </tr>
  428.   <% 
  429.   Repeat1__index=Repeat1__index+1
  430.   Repeat1__numRows=Repeat1__numRows-1
  431.   rsn.MoveNext()
  432. Wend
  433. %>
  434. </table>
  435. <br><br><table border="0" width="50%" align="center">
  436.   <tr> 
  437.     <td width="23%" align="center"> <% If MM_offset <> 0 Then %>
  438.       <a href="<%=MM_moveFirst%>">第一页</a> 
  439.       <% End If ' end MM_offset <> 0 %> </td>
  440.     <td width="31%" align="center"> <% If MM_offset <> 0 Then %>
  441.       <a href="<%=MM_movePrev%>">前一页</a> 
  442.       <% End If ' end MM_offset <> 0 %> </td>
  443.     <td width="23%" align="center"> <% If Not MM_atTotal Then %>
  444.       <a href="<%=MM_moveNext%>">下一页</a> 
  445.       <% End If ' end Not MM_atTotal %> </td>
  446.     <td width="23%" align="center"> <% If Not MM_atTotal Then %>
  447.       <a href="<%=MM_moveLast%>">最后一页</a> 
  448.       <% End If ' end Not MM_atTotal %> </td>
  449.   </tr>
  450. </table>
  451. </body>
  452. </html>
  453. <%
  454. rsn.Close()
  455. Set rsn = Nothing
  456. %>
  457. <%
  458. rst.Close()
  459. Set rst = Nothing
  460. %>
  461. <%
  462. rssetup.Close()
  463. Set rssetup = Nothing
  464. %>