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

数据库编程

开发平台:

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. <!--#include file="../lib/strlib.asp" -->
  7. <!--#include file="../lib/UserCheck.asp" -->
  8. <%'Copyright (c) 2006 Foosun Inc. Code by Einstein.liu
  9. session("audit")=request.QueryString("audit")
  10. session("classid")=request.QueryString("classid")
  11. session("myclassid")=request.QueryString("myclassid")
  12. Dim contrRs,classid,sql_info_cmd,AuditTF
  13. Dim int_RPP,int_Start,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo,i
  14. '---------------------------------分页定义
  15. int_RPP=15 '设置每页显示数目
  16. int_showNumberLink_=8 '数字导航显示数目
  17. showMorePageGo_Type_ = 1 '是下拉菜单还是输入值跳转,当多次调用时只能选1
  18. str_nonLinkColor_="#999999" '非热链接颜色
  19. toF_="<font face=webdings title=""首页"">9</font>"   '首页 
  20. toP10_=" <font face=webdings title=""上十页"">7</font>" '上十
  21. toP1_=" <font face=webdings title=""上一页"">3</font>" '上一
  22. toN1_=" <font face=webdings title=""下一页"">4</font>" '下一
  23. toN10_=" <font face=webdings title=""下十页"">8</font>" '下十
  24. toL_="<font face=webdings title=""最后一页"">:</font>" '尾页
  25. '--------------------------------------------------
  26. if session("classid")<>"0" and session("classid")<>"" then'如果classid不为根目录
  27. if  session("audit")="1" then '如果已经审核
  28. if session("myclassid")<>"" then
  29. sql_info_cmd="Select ContID,ContTitle,addtime,classid,InfoType,ContSytle,UserNumber,IsPublic,AdminLock,IsLock,isTF,MainID,untread,AuditTF,type from FS_ME_InfoContribution where classid="&session("myclassid")&" and  AuditTF=1 and MainID="&session("classid")&" and usernumber='"&session("FS_UserNumber")&"'"
  30. else
  31. sql_info_cmd="Select ContID,ContTitle,addtime,classid,InfoType,ContSytle,UserNumber,IsPublic,AdminLock,IsLock,isTF,MainID,untread,AuditTF,type from FS_ME_InfoContribution where  AuditTF=1 and MainID="&session("classid")&" and usernumber='"&session("FS_UserNumber")&"'"
  32. End if
  33. else'如果未审核
  34. if session("myclassid")<>"" then
  35. sql_info_cmd="Select ContID,ContTitle,addtime,classid,InfoType,ContSytle,UserNumber,IsPublic,AdminLock,IsLock,isTF,MainID,untread,AuditTF,type from FS_ME_InfoContribution where classid="&session("myclassid")&" and MainID="&session("classid")&" and usernumber='"&session("FS_UserNumber")&"'"
  36. else
  37. sql_info_cmd="Select ContID,ContTitle,addtime,classid,InfoType,ContSytle,UserNumber,IsPublic,AdminLock,IsLock,isTF,MainID,untread,AuditTF,type from FS_ME_InfoContribution where MainID="&session("classid")&" and usernumber='"&session("FS_UserNumber")&"'"
  38. End if
  39. End if
  40. else'如果classid为空
  41. if session("audit")="1" then'如果已经审核  
  42. if session("myclassid")<>"" then
  43. sql_info_cmd="Select ContID,ContTitle,addtime,classid,InfoType,ContSytle,UserNumber,IsPublic,AdminLock,IsLock,isTF,MainID,untread,AuditTF,type from FS_ME_InfoContribution where classid="&session("myclassid")&" and  AuditTF=1  and usernumber='"&session("FS_UserNumber")&"' order by addtime DESC,ContID DESC"
  44. else
  45. sql_info_cmd="Select ContID,ContTitle,addtime,classid,InfoType,ContSytle,UserNumber,IsPublic,AdminLock,IsLock,isTF,MainID,untread,AuditTF,type from FS_ME_InfoContribution where  AuditTF=1 and usernumber='"&session("FS_UserNumber")&"' order by addtime DESC,ContID DESC"
  46. End if
  47. else'如果未审核 
  48. if session("myclassid")<>"" then
  49. sql_info_cmd="Select ContID,ContTitle,addtime,classid,InfoType,ContSytle,UserNumber,IsPublic,AdminLock,IsLock,isTF,MainID,untread,AuditTF,type from FS_ME_InfoContribution where classid="&session("myclassid")&"  and usernumber='"&session("FS_UserNumber")&"' order by addtime DESC,ContID DESC"
  50. else
  51. sql_info_cmd="Select ContID,ContTitle,addtime,classid,InfoType,ContSytle,UserNumber,IsPublic,AdminLock,IsLock,isTF,MainID,untread,AuditTF,type from FS_ME_InfoContribution where usernumber='"&session("FS_UserNumber")&"' order by addtime DESC,ContID DESC"
  52. End if
  53. End if
  54. End IF
  55. %>
  56. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  57. <html xmlns="http://www.w3.org/1999/xhtml">
  58. <head>
  59. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  60. <title>CMS4</title>
  61. <link href="../images/skin/Css_<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>/<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  62. <script language="javascript" src="../../FS_Inc/PublicJS.js"></script>
  63. <script language="javascript" src="../../FS_Inc/CheckJs.js"></script>
  64. <script language="javascript" src="../../FS_Inc/prototype.js"></script>
  65. </head>
  66. <body style="margin-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;">
  67. <table width="100%" height="25" border="0" align="center" cellpadding="1" cellspacing="1" class="table" id="listContainer">
  68. <tr>
  69. <td class="xingmu" align="center" colspan="6">新 闻</td>
  70. </tr>
  71. <tr>
  72. <td class="hback" align="center">标题</td>
  73. <td class="hback" align="center">分类</td>
  74. <td class="hback" align="center">添加时间</td>
  75. <td class="hback" align="center">状态</td>
  76. <td class="hback" align="center">操作</td>
  77. <td class="hback" align="center"><input type="checkbox" name="contrList" value="" onclick="selectAll(document.all('contrList'))"/></td>
  78. </tr>
  79. <%
  80. Dim contrType,ContSytle,InfoType,classRs,className,AuditStatus,constrlock
  81. Set contrRs=Server.CreateObject(G_FS_Rs)
  82. contrRs.open sql_info_cmd,User_Conn,1,3
  83. If Not contrRs.eof then
  84. '分页使用-----------------------------------
  85. contrRs.PageSize=int_RPP
  86. cPageNo=NoSqlHack(Request.QueryString("page"))
  87. If cPageNo="" Then cPageNo = 1
  88. If not isnumeric(cPageNo) Then cPageNo = 1
  89. cPageNo = Clng(cPageNo)
  90. If cPageNo<=0 Then cPageNo=1
  91. If cPageNo>contrRs.PageCount Then cPageNo=contrRs.PageCount 
  92. contrRs.AbsolutePage=cPageNo
  93. End if
  94. for i=0 to int_RPP
  95. if contrRs.eof then exit for
  96. select case contrRs("type")
  97. case "0" contrType="[新闻]"
  98. case "1" contrType="[下载]"
  99. case "2" contrType="[商品]"
  100. case else contrType="[新闻]"
  101. end select
  102. select case contrRs("ContSytle")
  103. case "0" ContSytle="[原创]"
  104. case "1" ContSytle="[转载]"
  105. case "3" ContSytle="[代理]"
  106. case else ContSytle="[原创]"
  107. End select
  108. select case contrRs("InfoType")
  109. case "0" InfoType="[普通]"
  110. case "1" InfoType="<font color='#A4D234'>[优先]</font>"
  111. case "2" InfoType="<font color='red'>[加急]</font>"
  112. case else InfoType="[普通]"
  113. End select
  114. '获得分类名------------------------------------------------------------*/
  115. Set classRs=Conn.execute("select ClassID,ClassName from FS_NS_NewsClass where isConstr=1 and id="&contrRs("MainID"))
  116. if not classRs.eof then
  117. className=classRs("ClassName")
  118. Else
  119. ClassName="无"
  120. End if
  121. classRs.close
  122. Set classRs=nothing
  123. if contrRs("AuditTF")="1" then
  124. AuditStatus="<font color='#A4D234'>已审核</font>"
  125. Else
  126. AuditStatus="未审核"
  127. End if
  128. if contrRs("IsLock")="1" then
  129. constrlock="<a href='解锁' onClick=""contrAction('unlock','"&contrRs("ContID")&"','span_lock_"&contrRs("ContID")&"');return false;""><font color='red'>解锁</font></a>"
  130. Else
  131. constrlock="<a href='锁定' onClick=""contrAction('lock','"&contrRs("ContID")&"','span_lock_"&contrRs("ContID")&"');return false;"">锁定</a>"
  132. End if
  133. Dim delStr,modStr,lockStr
  134. delStr="<a href='删除' onClick=""if(confirm('确定要删除?'))contrAction('delete','"&contrRs("ContID")&"','span_lock_"&contrRs("ContID")&"');return false;"">删除</a>"
  135. modStr="<a href='contrEdit.asp?action=edit&id="&contrRs("ContID")&"' target='_parent'>修改</a>"
  136. lockStr="<span id='span_lock_"&contrRs("ContID")&"'>"&constrlock&"</span>"
  137. 'End获得分类名------------------------------------------------------------*/
  138. Response.Write("<tr onMouseOver=overColor(this) onMouseOut=outColor(this) height='20'>"&vbcrlf)
  139. Response.Write("<td class='hback'><a href='contrEdit.asp?action=edit&id="&contrRs("ContID")&"' target='_parent'>{"&InfoType&contrType&ContSytle&"} "&contrRs("ContTitle")&"</a></td>"&vbcrlf)
  140. Response.Write("<td class='hback' align='center'>"&className&"</td>"&vbcrlf)
  141. Response.Write("<td class='hback' align='center'>"&contrRs("addtime")&"</td>"&vbcrlf)
  142. Response.Write("<td class='hback' align='center'>"&AuditStatus&"</td>"&vbcrlf)
  143. Response.Write("<td class='hback' align='center'>"&modStr&" |"&delStr&"| "&lockStr&"</td>"&vbcrlf)
  144. Response.Write("<td class='hback' align='center'><input type='checkbox' name='contrList' value='"&contrRs("ContID")&"'/></td>"&vbcrlf)
  145. contrRs.movenext
  146. Response.Write("</tr>"&vbcrlf)
  147. next
  148. %>
  149. <tr>
  150. <td class="hback" align="right" colspan="6">
  151. <button name="bnt_lock" onclick="parent.location='contrEdit.asp?action=add'">投 稿</button>&nbsp;
  152. <button name="bnt_lock" onclick="contrBatAction('lock')">批量锁定</button>&nbsp;
  153. <button name="bnt_unlock" onclick="contrBatAction('unlock')" >批量解锁</button>&nbsp;
  154. <button name="bnt_delete" onclick="contrBatAction('delete')">批量删除</button>&nbsp;
  155. </td>
  156. </tr>
  157. <%
  158. Response.Write("<tr>"&vbcrlf)
  159. Response.Write("<td align='right' colspan='10'  class=""hback"">"&fPageCount(contrRs,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo)&"</td>"&vbcrlf)
  160. Response.Write("</tr>"&vbcrlf)
  161. %>
  162. </table>
  163. </body>
  164. </html>
  165. <%
  166. Conn.close
  167. User_Conn.close
  168. Set Conn=nothing
  169. Set contrRs=nothing
  170. %>
  171. <script language="javascript">
  172. <!--
  173. parent.hd_audit.value="<%=session("audit")%>";
  174. parent.hd_classid.value="<%=session("classid")%>";
  175. parent.hd_myclassid.value="<%=session("myclassid")%>";
  176. function contrAction(act,id,container)
  177. {
  178. $(container).innerHTML="<img src='../../sys_images/small_loading.gif'/>";
  179. if(act=="lock")
  180. {
  181. var ajax1=new Ajax.Updater(container,"contrAction.asp",{method:'get',parameters:"action=lock&id="+id+"&and"+Math.random()});
  182. }else if(act=="unlock")
  183. {
  184. var ajax2=new Ajax.Updater(container,"contrAction.asp",{method:'get',parameters:"action=unlock&id="+id+"&and"+Math.random()});
  185. }else if(act=="delete")
  186. {
  187. var ajax3=new Ajax.Request("contrAction.asp",{method:'get',parameters:"action=delete&id="+id+"&and"+Math.random(),onComplete:showResponse});
  188. }
  189. function showResponse(originalRequest)
  190. {
  191. var result=originalRequest.responseText;
  192. if(result=="ok")
  193. {
  194. $('listContainer').firstChild.removeChild($(container).parentNode.parentNode)
  195. $('recordcount').innerHTML=parseInt($('recordcount').innerText)-1;
  196. }else
  197. {
  198. alert("发生异常,请联系技术人员!");
  199. }
  200. }
  201. }
  202. function contrBatAction(act)
  203. {
  204. var elements=document.all("contrList");
  205. if(act=="lock")
  206. {
  207. for(var i=1;i<elements.length;i++)
  208. {
  209. if(elements[i].checked)
  210. contrAction('lock',elements[i].value,"span_lock_"+elements[i].value);
  211. }
  212. }else if(act=="unlock")
  213. {
  214. for(var i=1;i<elements.length;i++)
  215. {
  216. if(elements[i].checked)
  217. contrAction('unlock',elements[i].value,"span_lock_"+elements[i].value);
  218. }
  219. }else if(act=="delete")
  220. {
  221. if(confirm("确定要删除?"))
  222. {
  223. for(var i=1;i<elements.length;i++)
  224. {
  225. if(elements[i].checked)
  226. contrAction('delete',elements[i].value,"span_lock_"+elements[i].value);
  227. }
  228. }
  229. }
  230. }
  231. -->
  232. </script>