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

数据库编程

开发平台:

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,awardID,awardRs,awardName,awardPic,startDate,endDate,prizeStr,prizeArray,prizeRs,ArrayIndex,needPoint
  8. Dim i,str_CurrPath
  9. '************************************Update
  10. if Request("Act")="edit" then
  11. awardID=NoSqlHack(Request("awardID"))
  12. MF_Default_Conn
  13. MF_User_Conn
  14. MF_Session_TF
  15. if not MF_Check_Pop_TF("ME028") then Err_Show 
  16. Set awardRs=User_Conn.execute("Select awardName,awardPic,startDate,EndDate,prizeIDS from FS_ME_award where awardid="&awardID)
  17. if not awardRs.eof then
  18. awardName=awardRs("awardName")
  19. awardPic=awardRs("awardPic")
  20. startDate=awardRs("startDate")
  21. endDate=awardRs("endDate")
  22. prizeStr=awardRs("PrizeIDS")
  23. if not isnull(prizeStr) then
  24. if prizeStr<>"" then
  25. prizeArray=split(DelHeadAndEndDot(prizeStr),",")
  26. end if
  27. end if
  28. end if
  29. elseif Request("Act")="add" then
  30. if not MF_Check_Pop_TF("ME027") then Err_Show 
  31.  startDate=datevalue(Now())
  32.  needPoint=0
  33. end if
  34. str_CurrPath = Replace("/"&G_VIRTUAL_ROOT_DIR &"/"&G_UP_FILES_DIR&"/adminfiles/"&Session("admin_name"),"//","/")
  35. %>
  36. <html xmlns="http://www.w3.org/1999/xhtml">
  37. <HEAD>
  38. <TITLE>FoosunCMS</TITLE>
  39. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
  40. </HEAD>
  41. <script language="JavaScript" src="../../FS_Inc/PublicJS.js" type="text/JavaScript"></script>
  42. <script language="JavaScript" src="lib/UserJS.js" type="text/JavaScript"></script>
  43. <script language="javascript" src="../../FS_Inc/prototype.js"></script>
  44. <link href="../images/skin/Css_<%=Session("Admin_Style_Num")%>/<%=Session("Admin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  45. <BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=yes > 
  46. <%
  47. if NoSqlHack(Request("act"))="edit" then
  48. Response.Write("<form name='AwardPanel' id='AwardPanel' method='post' action='awardAction.asp?act=editaction&awardid="&NoSqlHack(Request("awardid"))&"'>")
  49. else
  50. Response.Write("<form name='AwardPanel' id='AwardPanel' method='post' action='awardAction.asp?act=addaction'>")
  51. end if
  52. %>
  53. <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table"> 
  54.   <tr class="hback">
  55.     <td align="right" class="xingmu" colspan="2"><div align="left">奖品项目设置&nbsp;&nbsp;| &nbsp;<a href="#" onClick="history.back()">后退</a></div></td></tr> 
  56.         <tr class="hback"> 
  57.           <td align="right">主题名称:</td> 
  58.           <td> <input name="awardName" type="text" id="awardName" size="50" value="<%=awardName%>"/ ><font color="#FF0000">*</font><span id="awardName_Alert"></span></td> 
  59.         </tr> 
  60.       <tr class="hback">
  61.     <td align="right">主题图片:</td>
  62.     <td>
  63. <input type="text" name="awardPic" id="awardPic" value="<%=awardPic%>" size="50" maxlength="120">
  64. <button onClick="javascript:OpenWindowAndSetValue('../CommPages/SelectManageDir/SelectPic.asp?CurrPath=<% = str_CurrPath %>&f_UserNumber=<% = session("FS_UserNumber")%>',500,320,window,$('awardPic'));">选择图片</button>
  65.     <span id="UpfileSize_Alert"></span></td>
  66.   </tr>
  67. <%
  68. for i=0 to NoSqlHack(Request("prizeGradeNum"))
  69. next
  70. %>
  71.       <tr class="hback"> 
  72.           <td align="right">开始日期:</td> 
  73.           <td><input name="startDate" type="text" id="startDate" value="<%=startDate%>" size="50" readonly="true"><button onClick="OpenWindowAndSetValue('../CommPages/SelectDate.asp',280,120,window,document.AwardPanel.startDate);document.AwardPanel.startDate.focus();">选择时间</button><font color="#FF0000">*</font><span id="startDate_Alert"></span></td> 
  74.   </tr>
  75.         <tr class="hback">
  76.           <td align="right">截止日期:</td>
  77.           <td><input name="EndDate" type="text" id="EndDate" value="<%=endDate%>" size="50" readonly="true"><button onClick="OpenWindowAndSetValue('../CommPages/SelectDate.asp',280,120,window,document.AwardPanel.EndDate);document.AwardPanel.EndDate.focus();">选择时间</button><font color="#FF0000">*</font><span id="EndDate_Alert"></span></td>
  78.         </tr>
  79.         <tr class="hback">
  80.           <td align="right">奖品等级数:</td>
  81.           <td><input name="PrizeGradeNum" type="text" id="PrizeGradeNum" size="50" value="<%if request("act")="edit" then Response.Write(ubound(prizeArray)+1) else Response.Write("1")%>"  onKeyUp="if(isNaN(value)||event.keyCode==32)execCommand('undo')"  onafterpaste="if(isNaN(value)||event.keyCode==32)execCommand('undo')"><button onClick="setPrizeGradeNum(PrizeGradeNum.value)">设置</button></td>
  82.         </tr>
  83. </table> 
  84. <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="table"> 
  85. <tr class='hback'>
  86. <td id="PrizeContainer" colspan="2">
  87. <%
  88. if Request("act")="edit" then
  89. Response.Write("<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' >")
  90. for ArrayIndex=0 to Ubound(prizeArray)
  91. Set prizeRs=User_Conn.Execute("Select PrizeName,PrizePic,PrizeNum,NeedPoint from FS_ME_Prize where PrizeID="&prizeArray(ArrayIndex))
  92. if not prizeRs.eof then
  93. Response.Write("<tr class='hback'>")
  94. Response.Write("<td align='right' width='8%'>"&(ArrayIndex+1)&"等奖:</td>")
  95. Response.Write("<td><input name='Prize_"&(ArrayIndex+1)&"_name' type='text' id='Prize_"&(ArrayIndex+1)&"_name' size='25' value='"&prizeRs("PrizeName")&"'>")
  96. Response.Write("    |需要积分:<input name='needPoint_"&(ArrayIndex+1)&"' type='text' id='needPoint_"&(ArrayIndex+1)&"' size='5' value='"&prizeRs("NeedPoint")&"'  onKeyUp=""if(isNaN(value)||event.keyCode==32)execCommand('undo')""  onafterpaste=""if(isNaN(value)||event.keyCode==32)execCommand('undo')"">")
  97. Response.Write("    |图片:<input type=""text"" name=""prize_"&(ArrayIndex+1)&"_pic"" id=""Prize_"&(ArrayIndex+1)&"_name""   value="""&prizeRs("PrizePic")&""" style=""width:30%"" maxlength=""120""><button onClick=""javascript:OpenWindowAndSetValue('../CommPages/SelectManageDir/SelectPic.asp?CurrPath="&str_CurrPath&"&f_UserNumber="&session("FS_UserNumber")&"',500,320,window,'document.all.prize_"&(ArrayIndex+1)&"');"">选择图片</button>")
  98. Response.Write("    |数量:<input name='prize_"&(ArrayIndex+1)&"_number' type='text' id='prize_"&(ArrayIndex+1)&"_number' size='5' value='"&prizeRs("PrizeNum")&"'  onKeyUp=""if(isNaN(value)||event.keyCode==32)execCommand('undo')""  onafterpaste=""if(isNaN(value)||event.keyCode==32)execCommand('undo')""></td></tr>")
  99. End if
  100. next
  101. Response.Write("</table>")
  102. end if
  103. %>
  104. </td>
  105. </tr>
  106. <tr class='hback'>
  107. <td width="20">&nbsp;</td>
  108. <td><div align="left"><input type="button" name="ADDEditAwardButton" onClick="ADDEditAward()" value="保存"> | <input type="reset" name="" value="重置"></div></td>
  109. </tr>
  110. </table>
  111. </form>
  112. </body>
  113. <%
  114. if Request("Act")="eidt" then
  115. awardRs.close
  116. set awardRs=nothing
  117. Conn.close
  118. Set Conn=nothing
  119. User_Conn.close
  120. Set User_Conn=nothing
  121. Set prizeRs=nothing
  122. end if
  123. %>
  124. <script language="JavaScript" type="text/JavaScript">
  125. if("<%=Request("act")%>"!="edit")
  126. {
  127. setPrizeGradeNum(1);
  128. }
  129. function setPrizeGradeNum(Num){
  130. Num = parseInt(Num);
  131. if(isNaN(Num))Num=1;
  132. //alert(Num);
  133. var i,PrizeGradeNum='';
  134. for (i=1;i<=Num;i++)
  135. {
  136. PrizeGradeNum = PrizeGradeNum +"<tr class='hback'><td align='right' width='15%'>"+i+"等奖:</td><td><input name='Prize_"+i+"_name' type='text' id='Prize_"+i+"_name+' size='25' value=''>|需要积分:<input name='needPoint_"+i+"' type='text' id='needPoint_"+i+"' size='5' value='' onKeyUp=if(isNaN(value)||event.keyCode==32)execCommand('undo');  onafterpaste=if(isNaN(value)||event.keyCode==32)execCommand('undo');>    |图片:<input name='prize_"+i+"_pic' type='text' id='prize_"+i+"_pic' style='width:30%'><button onClick="javascript:OpenWindowAndSetValue('../CommPages/SelectManageDir/SelectPic.asp?CurrPath=<%=str_CurrPath%>&f_UserNumber=<%=session("FS_UserNumber")%>',500,320,window,$('prize_"+i+"_pic'));">选择图片</button>    |数量:<input name='prize_"+i+"_number' type='text' id='prize_"+i+"_number' size='5' value='' onKeyUp=if(isNaN(value)||event.keyCode==32)execCommand('undo');  onafterpaste=if(isNaN(value)||event.keyCode==32)execCommand('undo');></td></tr>";
  137. }
  138. document.getElementById("PrizeContainer").innerHTML="<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' >"+PrizeGradeNum+"</table>";
  139. }
  140. function ADDEditAward()
  141. {
  142. var flag1=isEmpty("awardName","awardName_Alert");
  143. var flag2=isEmpty("startDate","startDate_Alert");
  144. var flag3=isEmpty("EndDate","EndDate_Alert");
  145. if(flag1&&flag2&&flag3)
  146. document.AwardPanel.submit();
  147. }
  148. </script>
  149. </html>