PageRenderTime 26ms CodeModel.GetById 0ms RepoModel.GetById 1ms app.codeStats 0ms

/Wap/User/User_EnterPriseNews.asp

https://github.com/joechen2010/health
ASP | 203 lines | 193 code | 8 blank | 2 comment | 0 complexity | 138acb261b36b020d246949f2b801a93 MD5 | raw file
  1. <% @LANGUAGE="VBSCRIPT" CODEPAGE="65001" %>
  2. <!--#include file="../Conn.asp"-->
  3. <!--#include file="../KS_Cls/Kesion.CommonCls.asp"-->
  4. <%Response.ContentType = "text/vnd.wap.wml; charset=utf-8"%><?xml version="1.0" encoding="utf-8"?>
  5. <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
  6. <wml>
  7. <head>
  8. <meta http-equiv="Cache-Control" content="no-Cache"/>
  9. <meta http-equiv="Cache-Control" content="max-age=0"/>
  10. </head>
  11. <card id="main" title="企业新闻管理">
  12. <p>
  13. <%
  14. Set KS=New PublicCls
  15. MaxPerPage =12
  16. IF Cbool(KSUser.UserLoginChecked)=False Then
  17. Response.redirect KS.GetDomain&"User/Login/"
  18. Response.End
  19. End If
  20. %>
  21. <a href="User_EnterPriseNews.asp?Action=Add&amp;<%=KS.WapValue%>">发布新闻</a><br/>
  22. <a href="User_EnterPriseNews.asp?<%=KS.WapValue%>">所有</a>
  23. <a href="User_EnterPriseNews.asp?Status=1&amp;<%=KS.WapValue%>">待审核[<%=Conn.Execute("select count(id) from KS_EnterPrisenews where status=0 and username='"& KSUser.UserName &"'")(0)%>]</a>
  24. <a href="User_EnterPriseNews.asp?Status=2&amp;<%=KS.WapValue%>">已审核[<%=Conn.Execute("select count(id) from ks_enterprisenews where status=1 and username='"& KSUser.UserName &"'")(0)%>]</a>
  25. <br/>
  26. <%
  27. Select Case KS.S("Action")
  28. Case "Del" Call ArticleDel()
  29. Case "Add","Edit" Call ArticleAdd()
  30. Case "DoSave" Call DoSave()
  31. Case Else Call ArticleList()
  32. End Select
  33. Response.write "<br/>"
  34. Response.Write "<a href=""Index.asp?" & KS.WapValue & """>我的地盘</a>" &vbcrlf
  35. Response.write " <a href=""" & KS.GetGoBackIndex & """>返回首页</a><br/><br/>" &vbcrlf
  36. Call CloseConn
  37. Set KSUser=Nothing
  38. Set KS=Nothing
  39. Response.Write "</p>" &vbcrlf
  40. Response.Write "</card>" &vbcrlf
  41. Response.Write "</wml>" &vbcrlf
  42. Sub ArticleList()
  43. If KS.S("page") <> "" Then
  44. CurrentPage = KS.ChkClng(KS.S("page"))
  45. Else
  46. CurrentPage = 1
  47. End If
  48. Dim Sql,Param:Param=" where UserName='" & KSUser.UserName & "'"
  49. IF KS.S("Status")<>"" Then Param= Param & " and status=" & KS.ChkClng(KS.S("Status"))-1
  50. If (KS.S("KeyWord")<>"") Then Param = Param & " and title like '%" & KS.S("KeyWord") & "%'"
  51. sql = "select * from KS_EnterPriseNews " & Param & " order by AddDate DESC"
  52. Response.Write "【新闻列表】<br/>" &vbcrlf
  53. Set RS=Server.CreateObject("AdodB.Recordset")
  54. RS.open sql,Conn,1,1
  55. If RS.EOF And RS.BOF Then
  56. Response.Write "没有你要的新闻!<br/>" &vbcrlf
  57. Else
  58. totalPut = RS.RecordCount
  59. If CurrentPage < 1 Then CurrentPage = 1
  60. If (CurrentPage - 1) * MaxPerPage > totalPut Then
  61. If (totalPut Mod MaxPerPage) = 0 Then
  62. CurrentPage = totalPut \ MaxPerPage
  63. Else
  64. CurrentPage = totalPut \ MaxPerPage + 1
  65. End If
  66. End If
  67. If CurrentPage >1 And (CurrentPage - 1) * MaxPerPage < totalPut Then
  68. Rs.Move (CurrentPage - 1) * MaxPerPage
  69. Else
  70. CurrentPage = 1
  71. End If
  72. Dim I
  73. Do While Not RS.Eof
  74. %>
  75. <a href="User_EnterPriseNews.asp?Action=Edit&amp;id=<%=rs("id")%>&amp;<%=KS.WapValue%>"><%=KS.GotTopic(trim(RS("title")),45)%></a>
  76. <%
  77. If rs("status")=1 Then
  78. Response.Write "已审核" &vbcrlf
  79. Else
  80. Response.Write "未审核" &vbcrlf
  81. End If
  82. %>
  83. <br/>
  84. <%
  85. If RS("ClassID")=0 Then
  86. Response.Write "没有指定分类" &vbcrlf
  87. Else
  88. On Error Resume Next
  89. Response.Write Conn.Execute("select classname from ks_userclass where ClassID=" & RS("ClassID"))(0)
  90. End If
  91. %>
  92. <%=formatdatetime(rs("AddDate"),2)%>
  93. <a href="User_EnterPriseNews.asp?id=<%=rs("id")%>&amp;Action=Edit&amp;page=<%=CurrentPage%>&amp;<%=KS.WapValue%>">修改</a>
  94. <a href="User_EnterPriseNews.asp?action=Del&amp;ID=<%=rs("id")%>&amp;<%=KS.WapValue%>">删除</a>
  95. <br/>
  96. <%
  97. RS.MoveNext
  98. I = I + 1
  99. If I >= MaxPerPage Then Exit Do
  100. Loop
  101. Call KS.ShowPageParamter(totalPut, MaxPerPage, "User_Enterprisenews.asp", True, "新闻", CurrentPage, "status=" & KS.S("Status") & "&amp;" & KS.WapValue & "")
  102. Response.Write "<br/>" &vbcrlf
  103. End If
  104. %>
  105. 关键字<input type="text" name="KeyWord" value="关键字" />
  106. <anchor> <go href="User_EnterPriseNews.asp?<%=KS.WapValue%>" method="post">
  107. <postfield name="KeyWord" value="$(KeyWord)"/>
  108. </go></anchor><br/>
  109. <%
  110. End Sub
  111. '删除文章
  112. Sub ArticleDel()
  113. Dim ID:ID=KS.S("ID")
  114. ID=KS.FilterIDs(ID)
  115. If ID="" Then
  116. Response.Write "你没有选中要删除的新闻!<br/>" &vbcrlf
  117. Else
  118. Conn.Execute("Delete From KS_EnterPriseNews Where UserName='" & KSUser.UserName & "' and ID In(" & ID & ")")
  119. Response.Write "删除成功!<br/>" &vbcrlf
  120. End If
  121. Response.Write "<a href=""User_EnterPriseNews.asp?" & KS.WapValue & """>新闻管理</a><br/>" &vbcrlf
  122. End Sub
  123. '添加文章
  124. Sub ArticleAdd()
  125. If KS.S("Action")="Edit" Then
  126. Dim KS_A_RS_Obj:Set KS_A_RS_Obj=Server.CreateObject("ADODB.RECORDSET")
  127. KS_A_RS_Obj.Open "Select * From KS_EnterPriseNews Where ID=" & KS.ChkClng(KS.S("ID")),Conn,1,1
  128. If Not KS_A_RS_Obj.Eof Then
  129. Title = KS_A_RS_Obj("Title")
  130. Content = KS_A_RS_Obj("Content")
  131. AddDate = KS_A_RS_Obj("AddDate")
  132. ClassID = KS_A_RS_Obj("ClassID")
  133. End If
  134. KS_A_RS_Obj.Close:Set KS_A_RS_Obj=Nothing
  135. Else
  136. AddDate=Now:ClassID=0
  137. End If
  138. IF KS.S("Action")="Edit" Then
  139. Response.Write "【修改新闻】<br/>" &vbcrlf
  140. Else
  141. Response.Write "【发布新闻】<br/>" &vbcrlf
  142. End iF
  143. %>
  144. 新闻标题:<input name="Title" type="text" value="<%=Title%>" maxlength="100" /><br/>
  145. 选择分类:<select name='ClassID'>
  146. <option value="0">不指定分类</option>
  147. <%=KSUser.UserClassOption(4,ClassID)%>
  148. </select> <br/>
  149. 发布时间:<input name="AddDate" type="text" value="<%=AddDate%>" /><br/>
  150. 新闻内容:<input name="Content" type="text" value="<%=KS.HTMLEncode(Content)%>" /><br/>
  151. <anchor> <go href="User_EnterPriseNews.asp?Action=DoSave&amp;ID=<%=KS.S("ID")%>&amp;<%=KS.WapValue%>" method="post">
  152. <postfield name="Title" value="$(Title)"/>
  153. <postfield name="ClassID" value="$(ClassID)"/>
  154. <postfield name="AddDate" value="$(AddDate)"/>
  155. <postfield name="Content" value="$(Content)"/>
  156. </go></anchor><br/>
  157. <%
  158. End Sub
  159. Sub DoSave()
  160. Title=KS.LoseHtml(KS.S("Title"))
  161. Content=KS.S("Content")
  162. Dim RSObj
  163. If Title="" Then
  164. Response.Write "你没有输入新闻标题!<br/>" &vbcrlf
  165. Exit Sub
  166. End IF
  167. If Content="" Then
  168. Response.Write "你没有输入新闻内容!<br/>" &vbcrlf
  169. Exit Sub
  170. End IF
  171. Set RSObj=Server.CreateObject("Adodb.Recordset")
  172. RSObj.Open "Select * From KS_EnterpriseNews Where UserName='" & KSUser.UserName & "' And ID=" & KS.ChkClng(KS.S("ID")),Conn,1,3
  173. If rsobj.eof Then
  174. RSObj.Addnew
  175. RSObj("UserName")=KSUser.UserName
  176. RSObj("Adddate")=Now
  177. If KS.SSetting(18)=1 Then
  178. RSObj("Status")=0
  179. Else
  180. RSObj("Status")=1
  181. End If
  182. End If
  183. RSObj("Title")=Title
  184. RSObj("Content")=Content
  185. RSObj("ClassID")=KS.ChkClng(KS.S("ClassID"))
  186. RSObj.Update
  187. RSObj.Close:Set RSObj=Nothing
  188. IF KS.ChkClng(KS.S("id"))=0 Then
  189. Response.Write "成功添加新闻!<br/>" &vbcrlf
  190. Else
  191. Response.Write "新闻修改成功!<br/>" &vbcrlf
  192. End If
  193. Response.Write "<a href=""User_EnterPriseNews.asp?" & KS.WapValue & """>新闻管理</a><br/>" &vbcrlf
  194. End Sub
  195. %>