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

数据库编程

开发平台:

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. <%
  6. 'on error resume next
  7. Dim Conn,User_Conn,ManageGroupRs,GType,GroupIndex,sRootDir
  8. MF_Default_Conn
  9. MF_User_Conn
  10. MF_Session_TF 
  11. if not MF_Check_Pop_TF("ME_GUser") then Err_Show 
  12. if G_VIRTUAL_ROOT_DIR<>"" then sRootDir="/"+G_VIRTUAL_ROOT_DIR else sRootDir=""
  13. Dim GroupName,UpfileNum,UpfileSize,GroupDate,GroupPoint,GroupMoney,GroupType,CorpTemplet,LimitInfoNum,GroupDebateNum,JuniorDomain,KeywordsNumber,Ishtml,BcardNumber,Templetwatermark
  14. if Request.QueryString("Act")="update" then
  15. if not MF_Check_Pop_TF("ME034") then Err_Show 
  16. GType=NoSqlHack(Request.Form("GType"))
  17. GroupIndex=NoSqlHack(Request.Form("GroupIndex"))
  18. if GType="all" then
  19. User_Conn.execute("Update FS_ME_Group set GroupName='"&Request.Form("GroupName")&"',UpfileNum="&Request.Form("UpfileNum")&",UpfileSize="&Request.Form("UpfileSize")&",GroupDate="&Request.Form("GroupDate")&",GroupPoint="&Request.Form("GroupPoint")&",GroupMoney="&Request.Form("GroupMoney")&",GroupType="&Request.Form("GroupType")&",CorpTemplet='CorpTemplet',LimitInfoNum="&Request.Form("LimitInfoNum")&",GroupDebateNum='"&trim(Request.Form("GroupDebateNum_1"))&","&trim(Request.Form("GroupDebateNum_2"))&"',ProductDiscount="&trim(request.Form("ProductDiscount"))&",JuniorDomain=1,KeywordsNumber=0,isHtml="&Request.Form("isHtml")&",BcardNumber="&Request.Form("BcardNumber")&",Templetwatermark="&Request.Form("Templetwatermark"))
  20. elseif GroupIndex="user" then
  21. User_Conn.execute("Update FS_ME_Group set GroupName='"&Request.Form("GroupName")&"',UpfileNum="&Request.Form("UpfileNum")&",UpfileSize="&Request.Form("UpfileSize")&",GroupDate="&Request.Form("GroupDate")&",GroupPoint="&Request.Form("GroupPoint")&",GroupMoney="&Request.Form("GroupMoney")&",GroupType="&Request.Form("GroupType")&",CorpTemplet='CorpTemplet',LimitInfoNum="&Request.Form("LimitInfoNum")&",GroupDebateNum='"&trim(Request.Form("GroupDebateNum_1"))&","&trim(Request.Form("GroupDebateNum_2"))&"',ProductDiscount="&trim(request.Form("ProductDiscount"))&",JuniorDomain=1,KeywordsNumber=0,isHtml="&Request.Form("isHtml")&",BcardNumber="&Request.Form("BcardNumber")&",Templetwatermark="&Request.Form("Templetwatermark")&" where GroupType=1")
  22. elseif GroupIndex="corp" then
  23. User_Conn.execute("Update FS_ME_Group set GroupName='"&Request.Form("GroupName")&"',UpfileNum="&Request.Form("UpfileNum")&",UpfileSize="&Request.Form("UpfileSize")&",GroupDate="&Request.Form("GroupDate")&",GroupPoint="&Request.Form("GroupPoint")&",GroupMoney="&Request.Form("GroupMoney")&",GroupType="&Request.Form("GroupType")&",CorpTemplet='CorpTemplet',LimitInfoNum="&Request.Form("LimitInfoNum")&",GroupDebateNum='"&trim(Request.Form("GroupDebateNum_1"))&","&trim(Request.Form("GroupDebateNum_2"))&"',ProductDiscount="&trim(request.Form("ProductDiscount"))&",JuniorDomain=1,KeywordsNumber=0,isHtml="&Request.Form("isHtml")&",BcardNumber="&Request.Form("BcardNumber")&",Templetwatermark="&Request.Form("Templetwatermark")&" where GroupType=0")
  24. else
  25. User_Conn.execute("Update FS_ME_Group set GroupName='"&Request.Form("GroupName")&"',UpfileNum="&Request.Form("UpfileNum")&",UpfileSize="&Request.Form("UpfileSize")&",GroupDate="&Request.Form("GroupDate")&",GroupPoint="&Request.Form("GroupPoint")&",GroupMoney="&Request.Form("GroupMoney")&",GroupType="&Request.Form("GroupType")&",CorpTemplet='CorpTemplet',LimitInfoNum="&Request.Form("LimitInfoNum")&",GroupDebateNum='"&trim(Request.Form("GroupDebateNum_1"))&","&trim(Request.Form("GroupDebateNum_2"))&"',ProductDiscount="&trim(request.Form("ProductDiscount"))&",JuniorDomain=1,KeywordsNumber=0,isHtml="&Request.Form("isHtml")&",BcardNumber="&Request.Form("BcardNumber")&",Templetwatermark="&Request.Form("Templetwatermark")&" where GroupID="&GroupIndex)
  26. End if
  27. if err.number>0 then
  28. Response.Redirect("../error.asp?ErrCodes="&err.description&"&ErrorUrl="&Request.ServerVariables("HTTP_REFERER"))
  29. Response.End()
  30. else
  31. Response.Redirect("../success.asp?ErrCodes=<li>操作成功</li>&ErrorUrl="&Request.ServerVariables("HTTP_REFERER"))
  32. Response.End()
  33. end if
  34. elseif Request.QueryString("Act")="delete" then
  35. if not MF_Check_Pop_TF("ME036") then Err_Show 
  36. if Request.QueryString("tf")="all" then
  37. User_Conn.execute("Delete from FS_ME_Group")
  38. elseif Request.QueryString("tf")="user" then
  39. User_Conn.execute("Delete from FS_ME_Group where GroupType=1")
  40. elseif Request.QueryString("tf")="corp" then
  41. User_Conn.execute("Delete from FS_ME_Group where GroupType=0")
  42. else
  43. User_Conn.execute("Delete from FS_ME_Group where GroupID="&NoSqlHack(Request.QueryString("tf")))
  44. end if
  45. if err.number>0 then
  46. Response.Redirect("../error.asp?ErrCodes="&err.description)
  47. Response.End()
  48. else
  49. Response.Redirect("../success.asp?ErrCodes=<li>删除成功</li>&ErrorUrl=./user/Group_Manage.asp")
  50. Response.End()
  51. end if
  52. end if
  53. %>
  54. <html xmlns="http://www.w3.org/1999/xhtml">
  55. <HEAD>
  56. <TITLE>FoosunCMS</TITLE>
  57. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
  58. </HEAD>
  59. <script language="JavaScript" src="../../FS_Inc/PublicJS.js" type="text/JavaScript"></script>
  60. <script language="JavaScript" src="lib/UserJS.js" type="text/JavaScript"></script>
  61. <link href="../images/skin/Css_<%=Session("Admin_Style_Num")%>/<%=Session("Admin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  62. <BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=yes > 
  63. <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table"> 
  64. <form action="?Act=update" method="post" name="ManageGroup" id="ManageGroup">  
  65.   <tr class="hback"> 
  66.     <td align="right" class="xingmu" colspan="2"><div align="left">会员组管理</div></td></tr>
  67.   <tr class="hback">
  68.     <td width="183" align="right">会员组选择:</td>
  69.     <td>会员组类型:      
  70.       <select name="GType" id="GType" onChange="getFormInfo(this)">
  71.         <option value="all">所有会员组</option>
  72.         <option value="1">个人会员组</option>
  73.         <option value="0">企业会员组</option>
  74.       </select> 
  75.       &nbsp;
  76.       <span id="GroupIndexContent"></span></td>
  77.   </tr> 
  78.         <tr class="hback"> 
  79.           <td align="right">组名称:</td> 
  80.           <td width="791"> <input name="GroupName" type="text" id="GroupName" size="50" />
  81.           <font color="#FF0000">*</font> <span class="style1" id="GroupName_Alert"></span></td> 
  82.         </tr> 
  83.       
  84. <tr class="hback">
  85.     <td align="right">文件个数限制: </td>
  86.     <td><input name="UpfileNum" type="text" id="UpfileNum"  value="0" size="50" onChange="if(length(this.value)<=9){alert('文件大小限制最多只能输入9位整数');this.value='0';}" >
  87.     <span id="UpfileNum_Alert"></span></td>
  88.   </tr>
  89. <tr class="hback">
  90.     <td align="right">文件大小限制:</td>
  91.     <td><input name="UpfileSize" type="text" id="UpfileSize" value="0" size="50">
  92.     k<span id="UpfileSize_Alert"> 会员空间占用</span></td>
  93.   <tr class="hback">
  94.   <td align="right">会员折扣:</td>
  95.   <td><input name="ProductDiscount" type="text" id="ProductDiscount" value="0" size="50" onChange="if(length(this.value)<=9){alert('最多只能输入4个字符!');this.value='0';}">比如:打八折,该处则填写0.8 <span id="ProductDiscount_Alert"></span></td>
  96.   </tr>
  97. <tr class="hback"> 
  98.                 <td align="right">组有效期限:</td> 
  99.                 <td><input name="GroupDate" type="text" id="GroupDate"  value="0" size="50" onChange="if(length(this.value)<=4){alert('组有效期限最多只能输入4位整数');this.value='0';}"/> 
  100.                 天 <span id="GroupDate_Alert"></span></td> 
  101.     </tr> 
  102.       <tr class="hback"> 
  103.           
  104.       <td align="right">积分:</td> 
  105.           <td><input name="GroupPoint" type="text" id="GroupPoint"  value="0" size="50" onChange="if(this.value>32500){alert('积分不能大于32500');this.value='0';}"/>
  106.           <span id="GroupPoint_Alert"></span></td> 
  107.     </tr>
  108.         <tr class="hback">
  109.           
  110.       <td align="right">金币:</td>
  111.           <td><input name="GroupMoney" type="text" id="GroupMoney"  value="0" size="50" onChange="if(length(this.value)>4){alert('金币数不能大于9999');this.value='0';}"/>
  112.           <span id="GroupMoney_Alert"></span></td>
  113.         </tr> 
  114.       <tr class="hback"> 
  115.           <td align="right">组类型:</td> 
  116.         <td><label>
  117.             <input name="GroupType" type="radio" value="1"> 
  118.             个人会员组</label>
  119.             <label>
  120.             <input type="radio" name="GroupType" value="0" >
  121. 企业会员组</label>&nbsp;<span id="GroupType_Alert">(企业会员组暂时应用于以后扩展使用。您目前建立并不能使用)</span></td> 
  122.     </tr> 
  123.       <tr class="hback"> 
  124.           <td align="right">信息发布数量上限:</td> 
  125.           <td><input name="LimitInfoNum" type="text" id="LimitInfoNum" value="10" size="50"/>
  126.           <span id="LimitInfoNum_Alert"></span></td> 
  127.     </tr>
  128.         <tr class="hback" style="display:none">
  129.           
  130.       <td align="right">会员模板地址:</td>
  131.           <td><input name="CorpTemplet" type="text" size="50">
  132.   <input name="Submit5" type="button" id="selNewsTemplet" value="选择模板"  onClick="OpenWindowAndSetValue('../CommPages/SelectManageDir/SelectTemplet.asp?CurrPath=<%=sRootDir %>/<% = G_TEMPLETS_DIR %>',400,300,window,document.all.CorpTemplet);document.all.CorpTemplet.focus();">
  133.   <span id="CorpTemplet_Alert"></span></td>
  134.         </tr>
  135.         <tr class="hback">                 
  136.           <td align="right">社群参数:</td>
  137.           <td>社群最大数量:
  138.             <input name="GroupDebateNum_1" type="text" id="GroupDebateNum_1" value="0" size="15"> 
  139.           &nbsp;社群最大人数
  140.           <input name="GroupDebateNum_2" type="text" id="GroupDebateNum_2" value="0" size="15" >
  141.           <span id="GroupDebateNum1_Alert"></span> &nbsp;<span id="GroupDebateNum2_Alert"></span></td>
  142.         </tr>
  143.         <tr class="hback" style="display:none">
  144.           <td align="right">开通二级域名:</td>
  145.           <td><p>
  146.             <label>
  147.             <input type="radio" name="JuniorDomain" value="1" <%if JuniorDomain=1 then Response.Write("checked") end if%>>
  148.   是</label>
  149.             <label>
  150.             <input name="JuniorDomain" type="radio" value="0" checked <%if JuniorDomain=0 then Response.Write("checked") end if%>>
  151.   否</label>
  152.             <br>
  153.           </p></td>
  154.         </tr>
  155.         <tr class="hback" style="display:none">
  156.           <td align="right">信息关键字个数:</td>
  157.           <td><input name="KeywordsNumber" type="text" id="KeywordsNumber" value="0" size="50" onChange="if(length(this.value)>3){alert('信息关键字个数不能大于999');this.value='0';}"/>
  158.           <span id="KeywordsNumber_Alert"></span></td>
  159.         </tr>
  160.         <tr class="hback" style="display:none">
  161.           <td align="right">生成静态文件:</td>
  162.           <td><label>
  163.             <input type="radio" name="Ishtml" value="1"/>
  164. 是</label>
  165.             <label>
  166.             <input name="Ishtml" type="radio" value="0" checked >
  167. 否</label></td>
  168.         </tr>
  169.         <tr class="hback" style="display:none">
  170.           <td align="right">名片收藏个数限制:</td>
  171.           <td><input name="BcardNumber" type="text" id="BcardNumber" value="0" size="50" onChange="if(length(this.value)>4){alert('名片收藏个数不能大于9999');this.value='0';}"/>
  172.           <span id="BcardNumber_Alert"></span></td>
  173.         </tr>
  174.         <tr class="hback" style="display:none">
  175.           <td align="right">开通水印:</td>
  176.           <td><label>
  177.             <input type="radio" name="Templetwatermark" value="1" >
  178. 是</label>
  179.             <label>
  180.             <input name="Templetwatermark" type="radio" value="0" checked>
  181. 否</label></td>
  182.         </tr> 
  183.       <tr class="hback"> 
  184.           <td align="right">&nbsp;</td> 
  185.         <td><input type="Button" name="ManageGroupButton" value=" 保存 " onClick="MySubmit()"/> 
  186.             <input type="reset" name="Submit2" value=" 重置 " />
  187.             <input type="Button" name="DeleteGroup_Button" value=" 删 除 " onClick="AlertBeforeDelete()"></td> 
  188.     </tr> 
  189.   </form> 
  190.   </tr> 
  191. </table> 
  192. </body>
  193. <%
  194. Conn.close
  195. Set Conn=nothing
  196. User_Conn.close
  197. Set User_Conn=nothing
  198. %>
  199. <script language="JavaScript" type="text/JavaScript">
  200. <!--
  201. function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  202.   if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
  203.     document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  204.   else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
  205. }
  206. MM_reloadPage(true);
  207. //-->
  208. function MySubmit()
  209. {
  210. var flag1=isNumber('UpfileNum','UpfileNum_Alert','文件个数应为正整数',true)
  211. var flag2=isNumber('UpfileSize','UpfileSize_Alert','文件大小应为正整数',true)
  212. var flag3=isNumber('GroupDate','GroupDate_Alert','文件大小应为正整数',true)
  213. var flag4=isNumber('GroupMoney','GroupMoney_Alert','金币数量应为正整数',true)
  214. var flag5=isNumber('LimitInfoNum','LimitInfoNum_Alert','信息数量应为正整数',true)
  215. var flag6=isNumber('GroupDebateNum_1','GroupDebateNum1_Alert','社群数量应为正整数',true)
  216. var flag7=isNumber('GroupDebateNum_2','GroupDebateNum2_Alert','社群人数应为正整数',true)
  217. //var flag8=isNumber('KeywordsNumber','KeywordsNumber_Alert','关键字个数应为正整数',true)
  218. var flag9=isNumber('BcardNumber','BcardNumber_Alert','关键字个数应为正整数',true)
  219. var flag10=isEmpty('GroupName','GroupName_Alert','组名不能为空')
  220. //var flag11=isEmpty('CorpTemplet','CorpTemplet_Alert','模版地址不能为空')
  221. //var flag12=isNumber('ProductDiscount','ProductDiscount_Alert',false)
  222. if(document.ManageGroup.GroupType[0].checked|document.ManageGroup.GroupType[1].checked)
  223. {
  224. document.getElementById("GroupType_Alert").innerHTML=""
  225. if(flag1&&flag2&&flag3&&flag4&&flag5&&flag6&&flag7&&flag9&&flag10)
  226. {
  227. if(document.getElementById("GType").value=="all")
  228. {
  229. if(confirm("确定修改所有用户组?"))
  230. {
  231. document.ManageGroup.submit();
  232. }
  233. }else if(document.getElementById("GroupIndex").value=="user")
  234. {
  235. if(confirm("确定修改所有个人会员组?"))
  236. {
  237. document.ManageGroup.submit();
  238. }
  239. }
  240. else if(document.getElementById("GroupIndex").value=="corp")
  241. {
  242. if(confirm("确定修改所有企业会员组?"))
  243. {
  244. document.ManageGroup.submit();
  245. }
  246. }
  247. else
  248. document.ManageGroup.submit();
  249. }
  250. }else
  251. {
  252. document.getElementById("GroupType_Alert").innerHTML="<font color='F43631'>组类性质必须选择</font>";
  253. }
  254. }
  255. //Ajax
  256. var request=true;
  257. var result;
  258. var ParamArray;
  259. try
  260. {
  261. request=new XMLHttpRequest();
  262. }catch(trymicrosoft)
  263. {
  264. try
  265. {
  266. request=new ActiveXObject("Msxml2.XMLHTTP")
  267. }catch(othermicrosoft)
  268. {
  269. try
  270. {
  271. request=new ActiveXObject("Microsoft.XMLHTTP")
  272. }catch(filed)
  273. {
  274. request=false;
  275. }
  276. }
  277. }
  278. if(!request) alert("Error initializing XMLHttpRequest!");
  279. function getFormInfo(Obj)
  280. {
  281. var typeID=Obj.value;
  282. if(isNaN(typeID))
  283. {
  284. document.getElementById("GroupIndexContent").innerHTML="";
  285. return ;
  286. }
  287. var url="getUserGroup.asp?page=UserGroup&id="+typeID+"&r="+Math.random();//构造url
  288. request.open("GET",url,true);//建立连接
  289. request.onreadystatechange = getFormInfoResult;
  290. request.send(null);//传送数据,因为数据通过url传递了,所以这里传递的是null
  291. }
  292. function getFormInfoResult()//当服务器响应的时候就使用这个方法
  293. {
  294. if(request.readyState ==4)//根据HTTP 就绪状态判断响应是否完成
  295. {
  296. if(request.status == 200)//判断请求是否成功
  297. {
  298. result=request.responseText;//获得响应的结果,也就是新的<select>
  299. document.getElementById("GroupIndexContent").innerHTML="|&nbsp;&nbsp;会员组:"+result;//将这个结果现实在客户端
  300. }
  301. }
  302. }
  303. function getGroupParam(Obj)
  304. {
  305. var GroupID=Obj.value;
  306. if(!isNaN(GroupID))
  307. {
  308. var url="getUserGroupParam.asp?id="+GroupID+"&r="+Math.random();//构造url
  309. request.open("GET",url,true);//建立连接
  310. request.onreadystatechange = getGroupParamResult;
  311. request.send(null);//传送数据,因为数据通过url传递了,所以这里传递的是null
  312. }
  313. }
  314. //ajax end
  315. function getGroupParamResult()//当服务器响应的时候就使用这个方法
  316. {
  317. if(request.readyState ==4)//根据HTTP 就绪状态判断响应是否完成
  318. {
  319. if(request.status == 200)//判断请求是否成功
  320. {
  321. result=request.responseText;//获得响应的结果,也就是新的<select>
  322. //获取原有设置
  323. ParamArray=result.split("|");
  324. document.getElementById("GroupName").value=ParamArray[0];
  325. document.getElementById("UpfileNum").value=ParamArray[1];
  326. document.getElementById("UpfileSize").value=ParamArray[2];
  327. document.getElementById("GroupDate").value=ParamArray[3];
  328. document.getElementById("GroupPoint").value=ParamArray[4];
  329. document.getElementById("GroupMoney").value=ParamArray[5];
  330. if(ParamArray[6]==1)
  331. {
  332. document.ManageGroup.GroupType[0].checked=true;
  333. }
  334. else
  335. {
  336. document.ManageGroup.GroupType[1].checked=true;
  337. }
  338. document.getElementById("LimitInfoNum").value=ParamArray[7];
  339. document.getElementById("CorpTemplet").value=ParamArray[8];
  340. if(ParamArray[9]!=null && ParamArray[9]!="")
  341. {
  342. var TempArray=ParamArray[9].split(",");
  343. document.getElementById("GroupDebateNum_1").value=TempArray[0]
  344. document.getElementById("GroupDebateNum_2").value=TempArray[1]
  345. }
  346. if(ParamArray[10]==1)
  347. {
  348. document.ManageGroup.JuniorDomain[0].checked=true;
  349. }
  350. else
  351. {
  352. document.ManageGroup.JuniorDomain[1].checked=true;
  353. }
  354. document.getElementById("KeywordsNumber").value=ParamArray[11];
  355. if(ParamArray[12]==1)
  356. {
  357. document.ManageGroup.Ishtml[0].checked=true;
  358. }
  359. else
  360. {
  361. document.ManageGroup.Ishtml[1].checked=true;
  362. }
  363. document.getElementById("BcardNumber").value=ParamArray[13];
  364. if(ParamArray[14]==1)
  365. {
  366. document.ManageGroup.Templetwatermark[0].checked=true;
  367. }
  368. else
  369. {
  370. document.ManageGroup.Templetwatermark[1].checked=true;
  371. }
  372. document.getElementById("ProductDiscount").value=ParamArray[15];
  373. }
  374. }
  375. }
  376. //end
  377. function AlertBeforeDelete()
  378. {
  379. if(document.getElementById("GType").value=="all")
  380. {
  381. if(confirm("确定要删除所有用户组!"))
  382. location='Group_manage.asp?act=delete&tf=all'
  383. }else if(document.getElementById("GType").value==1&&document.getElementById("GroupIndex").value=="user")
  384. {
  385. if(confirm("确定要删除所有个人用户组!"))
  386. location='Group_manage.asp?act=delete&tf=user'
  387. }else  if(document.getElementById("GType").value==0&&document.getElementById("GroupIndex").value=="corp")
  388. {
  389. if(confirm("确定要删除所有企业用户组!"))
  390. location="Group_manage.asp?act=delete&tf=corp"
  391. }else
  392. {
  393. if(confirm("确定要删除该用户组!"))
  394. location='Group_manage.asp?act=delete&tf='+document.getElementById("GroupIndex").value
  395. }
  396. }
  397. </script>
  398. </html>