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

数据库编程

开发平台:

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="../../FS_Inc/Func_page.asp"-->
  6. <%
  7. on error resume next
  8. Dim Conn,User_Conn,NewsRs,i
  9. Dim int_RPP,int_Start,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo
  10. MF_Default_Conn
  11. MF_User_Conn
  12. MF_Session_TF
  13. if not MF_Check_Pop_TF("ME_News") then Err_Show 
  14. Set NewsRs=Server.CreateObject(G_FS_RS)
  15. NewsRs.open "select NewsID,title,addtime,groupid,newspoint,isLock from FS_ME_News order by addtime desc",User_Conn,1,3
  16. '---------------------------------分页定义
  17. int_RPP=15 '设置每页显示数目
  18. int_showNumberLink_=8 '数字导航显示数目
  19. showMorePageGo_Type_ = 1 '是下拉菜单还是输入值跳转,当多次调用时只能选1
  20. str_nonLinkColor_="#999999" '非热链接颜色
  21. toF_="<font face=webdings title=""首页"">9</font>"   '首页 
  22. toP10_=" <font face=webdings title=""上十页"">7</font>" '上十
  23. toP1_=" <font face=webdings title=""上一页"">3</font>" '上一
  24. toN1_=" <font face=webdings title=""下一页"">4</font>" '下一
  25. toN10_=" <font face=webdings title=""下十页"">8</font>" '下十
  26. toL_="<font face=webdings title=""最后一页"">:</font>" '尾页
  27. '-----------------------------------------
  28. %>
  29. <html xmlns="http://www.w3.org/1999/xhtml">
  30. <HEAD>
  31. <TITLE>FoosunCMS</TITLE>
  32. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
  33. </HEAD>
  34. <script language="JavaScript" src="../../FS_Inc/PublicJS.js" type="text/JavaScript"></script>
  35. <script language="JavaScript" src="lib/UserJS.js" type="text/JavaScript"></script>
  36. <link href="../images/skin/Css_<%=Session("Admin_Style_Num")%>/<%=Session("Admin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  37. <BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=yes>
  38. <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
  39.   <tr class="xingmu">
  40.     <td class="xingmu">公告管理</td>
  41.   </tr>
  42.   <tr class="hback">
  43.     <td class="hback"><a href="News_manage.asp">首页</a> | <a href="AddEditNews.asp?Act=add">发布公告</a></td>
  44.   </tr>
  45. </table>
  46. <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
  47.   <form action="NewsAction.asp?act=delete" method="post" name="NewsForm" id="NewsForm">
  48.     <tr class="xingmu"> 
  49.       <td width="33%" align="center" class="xingmu">标题</td>
  50.       <td width="19%" align="center" class="xingmu">发布时间</td>
  51.       <td width="12%" align="center" class="xingmu">允许查看组</td>
  52.       <td width="17%" align="center" class="xingmu">积分限制</td>
  53.       <td width="12%" align="center" class="xingmu">锁定
  54.         <input type="checkbox" name="Lock_CheckAll" value="all" onClick="CheckAll(this,'lock',true)"></td>
  55.       <td width="7%" align="center" class="xingmu"><input type="checkbox" name="Delete_CheckAll" value="all" onClick="CheckAll(this,'deleteNews',false)"></td>
  56.     </tr>
  57.     <%
  58. If Not NewsRs.eof then
  59. '分页使用-----------------------------------
  60. NewsRs.PageSize=int_RPP
  61. cPageNo=NoSqlHack(Request.QueryString("page"))
  62. If cPageNo="" Then cPageNo = 1
  63. If not isnumeric(cPageNo) Then cPageNo = 1
  64. cPageNo = Clng(cPageNo)
  65. If cPageNo<=0 Then cPageNo=1
  66. If cPageNo>NewsRs.PageCount Then cPageNo=NewsRs.PageCount 
  67. NewsRs.AbsolutePage=cPageNo
  68. End if
  69. For i=0 To int_RPP
  70. If NewsRs.eof Then Exit for
  71. Response.Write("<tr class='hback'>")
  72. Response.Write("<td align='left'><a href='AddEditNews.asp?act=edit&newsID="&NewsRS("newsid")&"'>"&NewsRs("title")&"</a></td>"&Chr(10)&Chr(13))
  73. Response.Write("<td align='center'>"&NewsRs("addtime")&"</td>"&Chr(10)&Chr(13))
  74. Response.Write("<td align='center'>"&NewsRs("GroupID")&"</td>"&Chr(10)&Chr(13))
  75. Response.Write("<td align='center'>"&NewsRs("NewsPoint")&"</td>"&Chr(10)&Chr(13))
  76. Response.Write("<td align='center'>")
  77. if NewsRs("isLock")=1 then
  78. Response.Write("<input type='checkbox' id='"&NewsRs("NewsID")&"' name='lock' value=1 onclick='changeLock(this.id,this.checked,false)'checked>"&Chr(10)&Chr(13))
  79. elseif NewsRs("isLock")=0 then
  80. Response.Write("<input type='checkbox' id='"&NewsRs("NewsID")&"' name='lock' value=1 onclick='changeLock(this.id,this.checked,false)'>"&Chr(10)&Chr(13))
  81. end if
  82. Response.Write("</td>")
  83. Response.Write("<td align='center'><input type='checkbox' name='deleteNews' value='"&NewsRs("NewsID")&"'></td>")
  84. Response.Write("</tr>")
  85. NewsRs.movenext 
  86. next
  87. %>
  88.   </form>
  89.   <tr class="hback"> 
  90.     <td align="center" colspan="6"><div align="right">
  91.         <input type="Button" name="DeleteNews" value="删除" onClick="AlertBeforeSubmite()">
  92.         &nbsp;&nbsp;&nbsp;&nbsp;</div></td>
  93.   </tr>
  94.   <tr> 
  95.     <td align="right" colspan="6" class="hback"> <% Response.Write(fPageCount(NewsRs,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo)&vbcrlf)
  96. %> </td>
  97.   </tr>
  98. </table> 
  99. </body>
  100. <%
  101. if Request.QueryString("Act")="addGroup" then
  102. AddGroupRs.close
  103. set AddGroupRs=nothing
  104. Conn.close
  105. Set Conn=nothing
  106. User_Conn.close
  107. Set User_Conn=nothing
  108. end if
  109. %>
  110. <script language="JavaScript" type="text/JavaScript">
  111. <!--
  112. function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  113.   if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
  114.     document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  115.   else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
  116. }
  117. MM_reloadPage(true);
  118. //-->
  119. var request=true;
  120. var result;
  121. try
  122. {
  123. request=new XMLHttpRequest();
  124. }catch(trymicrosoft)
  125. {
  126. try
  127. {
  128. request=new ActiveXObject("Msxml2.XMLHTTP")
  129. }catch(othermicrosoft)
  130. {
  131. try
  132. {
  133. request=new ActiveXObject("Microsoft.XMLHTTP")
  134. }catch(filed)
  135. {
  136. request=false;
  137. }
  138. }
  139. }
  140. if(!request) alert("Error initializing XMLHttpRequest!");
  141. function changeLock(Obj1,Obj2)
  142. {
  143. var url="NewsAction.asp?newsid="+Obj1+"&value="+Obj2+"&r="+Math.random();//构造url
  144. request.open("GET",url,true);//建立连接
  145. request.onreadystatechange = getResult;
  146. request.send(null);//传送数据,因为数据通过url传递了,所以这里传递的是null
  147. }
  148. function getResult()//当服务器响应的时候就使用这个方法
  149. {
  150. if(request.readyState ==4)//根据HTTP 就绪状态判断响应是否完成
  151. {
  152. if(request.status == 200)//判断请求是否成功
  153. {
  154. result=request.responseText;//获得响应的结果,也就是新的<select>
  155. alert("修改成功")
  156. }
  157. }
  158. }
  159. function CheckAll(Obj,TargetName,isSync)
  160. {
  161. var CheckBoxArray;
  162. CheckBoxArray=document.getElementsByName(TargetName);
  163. for(var i=0;i<CheckBoxArray.length;i++)
  164. {
  165. if(Obj.checked)
  166. {
  167. CheckBoxArray[i].checked=true;
  168. if(isSync)
  169. changeLock('all','true')
  170. }
  171. else
  172. {
  173. CheckBoxArray[i].checked=false;
  174. if(isSync)
  175. changeLock('all','false')
  176. }
  177. }
  178. }
  179. function AddNewsSubmit()
  180. {
  181. location='AddEditNews.asp?Act=add'
  182. }
  183. function AlertBeforeSubmite()
  184. {
  185. var checkGroup=document.NewsForm.deleteNews;
  186. var flag=false;
  187. for(var i=0;i<checkGroup.length;i++)
  188. {
  189. if(checkGroup[i].checked)
  190. {
  191. flag=true;
  192. }
  193. }
  194. if(flag)
  195. {
  196. if(confirm("确认要删除该记录?"))
  197. {
  198. document.NewsForm.submit();
  199. }
  200. }else
  201. {
  202. alert("请选择要删除的记录")
  203. }
  204. }
  205. </script>
  206. </html>