Debate_Add.asp
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:16k
源码类别:

数据库编程

开发平台:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../FS_Inc/Const.asp" -->
  3. <!--#include file="../FS_InterFace/MF_Function.asp" -->
  4. <!--#include file="../FS_Inc/Function.asp" -->
  5. <!--#include file="lib/strlib.asp" -->
  6. <!--#include file="lib/UserCheck.asp" -->
  7. <%
  8. Dim GroupRs,DebateRs,UserGroupRs,DebateID,ClassID,GroupName,CroupContent,InfoType,ClassType,AddTime,GroupCreater,GroupManager,isSys,TempRs,ForIndex,GroupManagerArray,selectedTF,AppointUserGroup,AppointUserNumber,action,Debate_Title,Debate_Content,Debate_ID,GroupMembers,GroupID,AccessFile
  9. ClassID=NoSqlHack(Request.QueryString("classid"))
  10. DebateID=NoSqlHack(Request.QueryString("DebateID"))
  11. action=NoSqlHack(Request.QueryString("act"))
  12. Set GroupRs=Server.CreateObject(G_FS_RS)
  13. Set DebateRs=Server.CreateObject(G_FS_RS)
  14. '获得用户文件保存路径
  15. Dim str_CurrPath
  16. str_CurrPath = Replace("/"&G_VIRTUAL_ROOT_DIR &"/"&G_USERFILES_DIR&"/"&Session("FS_UserNumber"),"//","/")
  17. GroupRs.open "select gdID,title,content,InfoType,ClassType,AddTime,PerPageNum,UserNumber,AdminName,ClassMember,isSys,hits,isLock from FS_ME_GroupDebateManage where gdID="&ClassID,User_Conn,1,3
  18. If Not GroupRs.eof then
  19. GroupMembers=GroupRs("ClassMember")
  20. if Instr(GroupMembers,session("FS_UserNumber"))=0 then
  21. Response.Redirect("lib/error.asp?ErrCodes=<li>请先加入该社群</li>")
  22. Response.End()
  23. end If
  24. if GroupRs("isLock")=1 then
  25. Response.Redirect("lib/error.asp?ErrCodes=<li>该群以被锁定</li>")
  26. Response.End()
  27. end If
  28. End if
  29. if DebateID<>"" then
  30. DebateRs.open "select DebateID,title,content,ParentID,ClassID,UserNumber,AddTime,AppointUserNumber,AppointUserGroup,AddIP,AccessFile from FS_ME_GroupDebate  where DebateID="&DebateID,User_Conn,1,3
  31. else
  32. DebateRs.open "select DebateID,title,content,ParentID,ClassID,UserNumber,AddTime,AppointUserNumber,AppointUserGroup,AddIP,AccessFile from FS_ME_GroupDebate  where ClassID="&ClassID,User_Conn,1,3
  33. end if
  34. if action="addaction" then 
  35. DebateRs.addNew
  36. DebateRs("title")=Request.Form("title")
  37. DebateRs("Content")=Request.Form("Content")
  38. DebateRs("AppointUserNumber")=Request.Form("AppointUserNumber")
  39. if trim(Request.Form("userGroup"))<>"" or trim(Request.Form("corpGroup"))<>"" then
  40. DebateRs("AppointUserGroup")=trim(Request.Form("userGroup"))&","&trim(Request.Form("corpGroup"))
  41. End if
  42. DebateRs("ClassID")=ClassID
  43. DebateRs("ParentID")=0
  44. DebateRs("AddTime")=Now()
  45. DebateRs("UserNumber")=session("FS_UserNumber")
  46. DebateRs("AddIP")=request.ServerVariables("REMOTE_ADDR")
  47. If Trim(request.Form("file"))<>"" then
  48. DebateRs("AccessFile")=Trim(request.Form("file"))
  49. End if
  50. DebateRs.update
  51. DebateRs.close
  52. if err.number=0 then 
  53. Response.Redirect("lib/success.asp?ErrCodes=<li>添加成功</li>&ErrorURL=../Group_unit.asp?GDID="&ClassID)
  54. Response.End()
  55. else
  56. Response.Redirect("lib/error.asp?ErrCodes=<li>"&err.description&"</li>")
  57. Response.End()
  58. end if
  59. elseif action="edit" then
  60. Debate_ID=DebateRs("DebateID")
  61. Debate_Title=DebateRs("title")
  62. Debate_Content=DebateRs("content")
  63. AppointUserNumber=DebateRs("AppointUserNumber")
  64. If Not IsNull(DebateRs("AppointUserGroup")) Then AppointUserGroup=split(DebateRs("AppointUserGroup"),",")
  65. AccessFile=DebateRs("AccessFile")
  66. elseif action="editaction" then 
  67. DebateID=DebateRs("ParentID")
  68. if DebateID=0 then 
  69. DebateID=DebateRs("DebateID")
  70. end if
  71. DebateRs("title")=Request.Form("title")
  72. DebateRs("Content")=Request.Form("Content")
  73. DebateRs("AppointUserNumber")=Request.Form("AppointUserNumber")
  74. if trim(Request.Form("userGroup"))<>"" or trim(Request.Form("corpGroup"))<>"" then
  75. DebateRs("AppointUserGroup")=trim(Request.Form("userGroup"))&","&trim(Request.Form("corpGroup"))
  76. End if
  77. DebateRs("AddTime")=Now
  78. DebateRs("UserNumber")=session("FS_UserNumber")
  79. DebateRs("AddIP")=request.ServerVariables("REMOTE_ADDR")
  80. If  Trim(request.Form("file"))<>"" then
  81. DebateRs("AccessFile")=Trim(request.Form("file"))
  82. End if
  83. DebateRs.update
  84. DebateRs.close
  85. if err.number=0 then 
  86. Response.Redirect("lib/success.asp?ErrCodes=<li>修改成功</li>&ErrorURL=../Debate_unit.asp?gdid="&ClassID&"***DebateID="&DebateID)
  87. Response.End()
  88. else
  89. Response.Redirect("lib/error.asp?ErrCodes=<li>"&err.description&"</li>")
  90. Response.End()
  91. end if
  92. elseif action="revert" then
  93. Debate_Title="回复:"&Request.QueryString("title")
  94. elseif action="revertaction" then
  95. DebateRs.addNew
  96. DebateRs("title")=Request.Form("title")
  97. DebateRs("Content")=Request.Form("Content")
  98. DebateRs("AppointUserNumber")=Request.Form("AppointUserNumber")
  99. if trim(Request.Form("userGroup"))<>"" or trim(Request.Form("corpGroup"))<>"" then
  100. DebateRs("AppointUserGroup")=trim(Request.Form("userGroup"))&","&trim(Request.Form("corpGroup"))
  101. End if
  102. DebateRs("ClassID")=classID
  103. DebateRs("ParentID")=DebateID
  104. DebateRs("AddTime")=Now
  105. DebateRs("UserNumber")=session("FS_UserNumber")
  106. DebateRs("AddIP")=request.ServerVariables("REMOTE_ADDR")
  107. If Trim(request.Form("file"))<>"" then
  108. DebateRs("AccessFile")=Trim(request.Form("file"))
  109. End if
  110. DebateRs.update
  111. DebateRs.close
  112. if err.number=0 then 
  113. Response.Redirect("lib/success.asp?ErrCodes=<li>添加成功</li>&ErrorURL=../Debate_unit.asp?gdid="&ClassID&"***DebateID="&DebateID)
  114. Response.End()
  115. else
  116. Response.Redirect("lib/error.asp?ErrCodes=<li>"&err.description&"</li>")
  117. Response.End()
  118. end if
  119. end if
  120. if not DebateRs.eof then
  121. AppointUserNumber=DebateRs("AppointUserNumber")
  122. if DebateRs("AppointUserGroup")<>"" then
  123. AppointUserGroup=split(DebateRs("AppointUserGroup"),",")
  124. end if
  125. else
  126. AppointUserGroup=null
  127. end if
  128. %>
  129. <html xmlns="http://www.w3.org/1999/xhtml">
  130. <title>User Manage Center-网站内容管理系统</title>
  131. <meta name="keywords" content="风讯cms,cms,FoosunCMS,FoosunOA,FoosunVif,vif,风讯网站内容管理系统">
  132. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  133. <meta content="MSHTML 6.00.3790.2491" name="GENERATOR" />
  134. <link href="images/skin/Css_<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>/<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  135. <head></head>
  136. <script language="JavaScript" src="../FS_Inc/PublicJS.js" type="text/JavaScript"></script>
  137. <script language="javascript" src="lib/UserJs.js" type="text/javascript"></script>
  138. <body> 
  139. <table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" class="table"> 
  140.   <tr> 
  141.     <td> <!--#include file="top.asp" --> </td> 
  142.   </tr> 
  143. </table> 
  144. <table width="98%" height="135" border="0" align="center" cellpadding="1" cellspacing="1" class="table"> 
  145.   <tr class="back"> 
  146.     <td   colspan="2" class="xingmu" height="26"> <!--#include file="Top_navi.asp" --> </td> 
  147.   </tr> 
  148.   <tr class="back"> 
  149.     <td width="18%" valign="top" class="hback"> <div align="left"> 
  150.         <!--#include file="menu.asp" --> 
  151.       </div></td> 
  152.     <td width="82%" valign="top" class="hback"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> 
  153.         <tr> 
  154.           <td width="72%"  valign="top"> <table width="98%" height="112" border="0" align="center" cellpadding="3" cellspacing="1" class="table"> 
  155.               <tr class="hback_1"> 
  156.                 <td height="33">&nbsp;&nbsp;&nbsp;<a href='GroupClass.asp?Act=Add'>创建社群</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='myGroup.asp?userNumber=<%=session("FS_UserNumber")%>'>我的社群</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='#'>社群帮助</a></td> 
  157.               </tr>
  158.               <%
  159. '-------------------------------------群介绍
  160. ClassID=GroupRs("gdID")
  161. GroupName=GroupRs("title")
  162. CroupContent=GroupRs("content")
  163. InfoType=GroupRs("InfoType")
  164. ClassType=GroupRs("ClassType")
  165. AddTime=GroupRs("AddTime")
  166. GroupCreater=GroupRs("UserNumber")
  167. GroupManager=GroupRs("AdminName")
  168. isSys=GroupRs("isSys")
  169. '----------------------获得管理员------------------
  170. GroupManagerArray=split(GroupManager,",")
  171. GroupManager=""
  172. for ForIndex=0 to ubound(GroupManagerArray)
  173. Set TempRs=User_Conn.execute("Select UserName from FS_ME_Users where UserNumber='"&GroupManagerArray(ForIndex)&"'")
  174. if not TempRs.eof then
  175. GroupManager=GroupManager&","&TempRs("UserName")
  176. end if
  177. next
  178. GroupManager=DelHeadAndEndDot(GroupManager)
  179. '-------------获得创建人-------------------------------
  180. if isSys=1 then
  181. GroupCreater="管理员"
  182. else
  183. Set TempRs=User_Conn.execute("Select UserName from FS_ME_Users where UserNumber='"&GroupCreater&"'")
  184. if not TempRs.eof then
  185. GroupCreater=TempRs("UserName")
  186. end if
  187. end if
  188. '-----------------获得社群所属行业----------------------
  189. Set TempRs=User_Conn.execute("select vClassName from FS_ME_VocationClass where vcid="&ClassType)
  190. if not TempRs.eof then
  191. ClassType=TempRs("vClassName")
  192. else
  193. ClassType="其他"
  194. end if
  195. '-------------------------------------
  196. Response.Write("<tr class='hback'><td>")
  197. Response.Write("<table width='100%' height='60' border='0' cellpadding='3' cellspacing='1' class='table'>"&Chr(10)&chr(13))
  198. Response.Write("<tr class='hback'><td colspan=9><a href='Group_unit.asp?GDID="&ClassID&"'><strong><img src=""images/GroupUser.gif"" border=""0""/> "&GroupName&"</strong></a></td></tr>"&Chr(10)&chr(13))
  199. Response.Write("<tr height='20'>"&Chr(10)&chr(13))
  200. Response.Write("<td class='hback' align='right' width='8%'>创建时间:</td><td class='hback' align='left'>"&Datevalue(AddTime)&"</td>"&Chr(10)&chr(13))
  201. Response.Write("<td class='hback' align='right'>创建人:</td><td class='hback' align='left'><a href=""ShowUser.asp?UserName="& GroupCreater &""" target=""_blank"">"&GroupCreater&"</a></td>"&Chr(10)&chr(13))
  202. Response.Write("<td class='hback' align='right'>管理员:</td><td class='hback' align='left'><a href=""ShowUser.asp?UserName="& GroupManager &""" target=""_blank"">"&GroupManager&"</a></td>"&Chr(10)&chr(13))
  203. Response.Write("<td class='hback' align='right'>所属行业:</td><td class='hback' align='left'>"&ClassType&"</td>"&Chr(10)&chr(13))
  204. Response.Write("<td class='hback' align='right'>"&Chr(10)&chr(13))
  205. if Instr(GroupMembers,session("FS_UserNumber"))=0 then
  206. Response.Write("<a href='Group_unit.asp?act=join&GDID="&ClassID&"'>加入该社区</a>")
  207. else
  208. Response.Write("<a href='Group_unit.asp?act=exit&GDID="&ClassID&"'>退出该社区</a>")
  209. end if
  210. Response.Write("</td></tr>"&Chr(10)&chr(13))
  211. Response.Write("<tr height='30'>"&Chr(10)&chr(13))
  212. Response.Write("<td class='hback' colspan=9>&nbsp;<img src=""images/GroupNews.gif""/>"&CroupContent&"</td>"&Chr(10)&chr(13))
  213. Response.Write("</tr>"&Chr(10)&chr(13))
  214. Response.Write("</table>")
  215. Response.Write("</td></tr>")
  216.   %>
  217.   </table></td> 
  218.         </tr> 
  219. <tr>
  220. <td>
  221. <%
  222. if action="new" then 
  223. Response.Write("<form action='?act=addaction&classid="&Request.QueryString("classid")&"' method='post' name='addDebateForm' id='addDebateForm'>")
  224. elseif action="edit" then
  225. Response.Write("<form action='?act=editaction&classID="&Request.QueryString("classid")&"&DebateID="&Debate_ID&"' method='post' name='addDebateForm' id='addDebateForm'>")
  226. elseif action="revert" then
  227. Response.Write("<form action='?act=revertaction&classID="&NoSqlHack(Request.QueryString("classid"))&"&DebateID="&NoSqlHack(request.QueryString("DebateID"))&"' method='post' name='addDebateForm' id='addDebateForm'>")
  228. end if
  229. %>
  230. <table width="98%" height="110" border="0" align="center" cellpadding="1" cellspacing="1" class="table">
  231. <tr>
  232. <td width="19%" align="right" class="hback">主题:</td>
  233. <td width="81%" class="hback"><input name="title" type="text" id="title" size="50" value="<%=Debate_Title%>"><span id="title_Alert"></span></td>
  234. </tr>
  235. <tr>
  236.   <td height="35" align="right" class="hback">上传附件:</td>
  237.   <td class="hback"><input name="file" type="text" size="50" value="<%=AccessFile%>"> <input type="button" name="Submit4" value="选择图片" onClick="var TempReturnValue=OpenWindow('Commpages/SelectPic.asp?CurrPath=<% = str_CurrPath %>&f_UserNumber=<% = session("FS_UserNumber")%>',500,290,window);if (TempReturnValue!='') document.addDebateForm.file.value=TempReturnValue;"></td>
  238.   </tr>
  239. <tr>
  240.   <td height="35" align="right" class="hback">内容:</td>
  241.   <td class="hback"><textarea name="content" cols="50" rows="10" id="content"><%=Debate_Content%></textarea><span id="content_Alert"></span></td>
  242. </tr>
  243. <tr>
  244.   <td height="35" align="right" class="hback">该主题个人查看权限:</td>
  245.   <td class="hback"><textarea name="AppointUserNumber" cols="50" id="AppointUserNumber"><%=AppointUserNumber%></textarea>
  246.     [填写允许查看人的编号,用,隔开]</td>
  247.   </tr>
  248. <tr>
  249.   <td align="right" class="hback">该主题组查看权限:<br></td>
  250.   <td class="hback">
  251.   <select name="userGroup" size="10" multiple>
  252.           <option value="" style="background-color:#014952; color:#FFFFFF;">-个人用户组-</option>
  253.   <%
  254.    Set UserGroupRs=User_Conn.Execute("Select GroupID,GroupName from FS_ME_Group where GroupType=1")
  255. while not UserGroupRs.eof
  256. selectedTF=false
  257. if  isArray(AppointUserGroup) then
  258. for ForIndex=0 to Ubound(AppointUserGroup)
  259. if not isnumeric(AppointUserGroup(ForIndex)) then exit for
  260. if Cint(trim(AppointUserGroup(ForIndex)))=UserGroupRs("GroupID") then
  261. selectedTF=true
  262. exit for
  263. end if
  264. next
  265. end if
  266. if selectedTF then
  267. Response.Write("<option value='"&UserGroupRs("GroupID")&"' selected>"&UserGroupRs("GroupName")&"</option>")
  268. else
  269. Response.Write("<option value='"&UserGroupRs("GroupID")&"'>"&UserGroupRs("GroupName")&"</option>")
  270. end if
  271. UserGroupRs.movenext
  272. wend
  273.   %>
  274.         </select> 
  275.           <select name="corpGroup" size="10" multiple>
  276.             <option value="" style="background-color:#014952; color:#FFFFFF;">-企业用户组-</option>
  277. <%
  278. Set UserGroupRs=User_Conn.Execute("Select GroupID,GroupName from FS_ME_Group where GroupType=0")
  279. while not UserGroupRs.eof
  280. selectedTF=false
  281. if  not isNull(AppointUserGroup) then
  282. for ForIndex=0 to Ubound(AppointUserGroup)
  283. if not isnumeric(AppointUserGroup(ForIndex)) then exit for
  284. if Cint(trim(AppointUserGroup(ForIndex)))=UserGroupRs("GroupID") then
  285. selectedTF=true
  286. exit for
  287. end if
  288. next
  289. end if
  290. if selectedTF then
  291. Response.Write("<option value='"&UserGroupRs("GroupID")&"' selected>"&UserGroupRs("GroupName")&"</option>")
  292. else
  293. Response.Write("<option value='"&UserGroupRs("GroupID")&"'>"&UserGroupRs("GroupName")&"</option>")
  294. end if
  295. UserGroupRs.movenext
  296. wend
  297. %>
  298.             </select>
  299.           [选择的组将允许查看]</td>
  300. </tr>
  301. <tr>
  302.   <td align="right" class="hback">&nbsp;</td>
  303.   <td class="hback"><input type="Button" name="Submit" onClick="MySubming()" value="提交">
  304. &nbsp;&nbsp;
  305. <input type="reset" name="Submit2" value="重置"></td>
  306. </tr>
  307. </table>
  308. </form>
  309. </td>
  310. </tr>
  311.       </table></td> 
  312.   </tr> 
  313.   <tr class="back"> 
  314.     <td height="20"  colspan="2" class="xingmu"> <div align="left"> 
  315.         <!--#include file="Copyright.asp" --> 
  316.       </div></td> 
  317.   </tr> 
  318. </table> 
  319. </body>
  320. </html>
  321. <script language="javascript">
  322. function MySubming()
  323. {
  324. var flag1=isEmpty("title","title_Alert")
  325. var flag2=isEmpty("content","content_Alert")
  326. if(flag1&&flag2)
  327. document.addDebateForm.submit()
  328. }
  329. </script>
  330. <%
  331. Set GroupRs=nothing
  332. Set DebateRs=nothing
  333. Set UserGroupRs=nothing
  334. Set User_Conn=nothing
  335. Set Fs_User = Nothing
  336. %>
  337. <!--Powsered by Foosun Inc.,Product:FoosunCMS V4.0系列-->