AFPoint_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,AID,AFPointRs,ATopic,needPoint,PrizePoint,APic,ADesc,startDate,endDate,AnswerStr,RightAnswerID,AnswerArray,AnswerRs,ArrayIndex
  8. Dim i,str_CurrPath
  9. MF_Default_Conn
  10. MF_Session_TF 
  11. MF_User_Conn
  12. if not MF_Check_Pop_TF("ME_award") then Err_Show 
  13. '************************************Update
  14. if Request.QueryString("Act")="editAFPoint" then
  15. AID=NoSqlHack(Request.QueryString("AID"))
  16. Set AFPointRs=User_Conn.execute("Select ATopic,needPoint,PrizePoint,APic,ADesc,AStartDate,AEndDate,AnswerIDS,RightAnswerID from FS_ME_AnswerForPoint where Aid="&AID)
  17. if not AFPointRs.eof then
  18. ATopic=AFPointRs("ATopic")
  19. needPoint=AFPointRs("needPoint")
  20. PrizePoint=AFPointRs("PrizePoint")
  21. APic=AFPointRs("APic")
  22. ADesc=AFPointRs("ADesc")
  23. startDate=AFPointRs("AstartDate")
  24. endDate=AFPointRs("AendDate")
  25. AnswerStr=AFPointRs("AnswerIDS")
  26. if not isnull(AnswerStr) then
  27. if AnswerStr<>"" then
  28. AnswerArray=split(DelHeadAndEndDot(AnswerStr),",")
  29. end if
  30. end if
  31. for ArrayIndex=0 to ubound(AnswerArray)
  32. if(AFPointRs("RightAnswerID")=Cint(AnswerArray(ArrayIndex))) then
  33. RightAnswerID=ArrayIndex+1
  34. end if
  35. next
  36. end if
  37. elseif Request.QueryString("Act")="add" then
  38. if not MF_Check_Pop_TF("ME027") then Err_Show 
  39.  startDate=datevalue(Now())
  40.  needPoint=0
  41. end if
  42. str_CurrPath = Replace("/"&G_VIRTUAL_ROOT_DIR &"/"&G_USERFILES_DIR&"/"&Session("FS_UserNumber"),"//","/")
  43. %>
  44. <html xmlns="http://www.w3.org/1999/xhtml">
  45. <HEAD>
  46. <TITLE>FoosunCMS</TITLE>
  47. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
  48. </HEAD>
  49. <script language="JavaScript" src="../../FS_Inc/PublicJS.js" type="text/JavaScript"></script>
  50. <script language="JavaScript" src="lib/UserJS.js" type="text/JavaScript"></script>
  51. <script language="javascript" src="../../FS_Inc/prototype.js"></script>
  52. <link href="../images/skin/Css_<%=Session("Admin_Style_Num")%>/<%=Session("Admin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  53. <BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=yes > 
  54. <%
  55. if NoSqlHack(Request.QueryString("act"))="editAFPoint" then
  56. Response.Write("<form name='AFPointPanel' id='AFPointPanel' method='post' action='awardAction.asp?act=editAFPointaction&AID="&NoSqlHack(Request.QueryString("AID"))&"'>")
  57. else
  58. Response.Write("<form name='AFPointPanel' id='AFPointPanel' method='post' action='awardAction.asp?act=addAFPointaction'>")
  59. end if
  60. %>
  61. <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table"> 
  62.   <tr class="hback">
  63.     <td align="right" class="xingmu" colspan="2"><div align="left">竞答项目设置&nbsp;&nbsp;| &nbsp;<a href="#" onClick="history.back()">后退</a></div></td></tr> 
  64.         <tr class="hback"> 
  65.           <td align="right">竞答主题:</td> 
  66.           <td> <input name="ATopic" type="text" id="ATopic" size="50" value="<%=ATopic%>"/><font color="#FF0000">*</font><span id="ATopic_Alert"></span></td> 
  67.         </tr> 
  68.       
  69. <tr class="hback">
  70.     <td align="right">需要积分: </td>
  71.     <td><input name="needpoint" type="text" id="needpoint" size="50" value="<%=needPoint%>" onKeyUp="if(isNaN(value)||event.keyCode==32)execCommand('undo')"  onafterpaste="if(isNaN(value)||event.keyCode==32)execCommand('undo')"><font color="#FF0000">*</font><span id="needpoint_Alert"></span>
  72.     </td>
  73.   </tr>
  74. <tr class="hback">
  75.   <td align="right">奖励积分:</td>
  76.   <td><input name="PrizePoint" type="text" id="PrizePoint" size="50" value="<%=PrizePoint%>" onKeyUp="if(isNaN(value)||event.keyCode==32)execCommand('undo')"  onafterpaste="if(isNaN(value)||event.keyCode==32)execCommand('undo')"><font color="#FF0000">*</font><span id="PrizePoint_Alert"></span></td>
  77. </tr>
  78. <tr class="hback">
  79.     <td align="right">主题图片:</td>
  80.     <td><input name="APic" type="text" id="APic" size="50" value="<%=APic%>" maxlength="120">
  81.     <span id="APic_Alert"><button onClick="javascript:OpenWindowAndSetValue('../CommPages/SelectManageDir/SelectPic.asp?CurrPath=<% = str_CurrPath %>&f_UserNumber=<% = session("FS_UserNumber")%>',500,320,window,$('APic'));">选择图片</button></span></td>
  82.   </tr>
  83. <tr class="hback">
  84.   <td align="right">竞答说明:</td>
  85.   <td><textarea name="ADesc" cols="60" rows="10" id="ADesc"><%=ADesc%></textarea></td>
  86. </tr>
  87. <tr class="hback">
  88.   <td align="right">&nbsp;</td>
  89.   <td>&nbsp;</td>
  90. </tr>
  91.       <tr class="hback"> 
  92.           <td align="right">开始日期:</td> 
  93.           <td><input name="startDate" type="text" id="startDate" value="<%=startDate%>" size="49" readonly="true"> 
  94.             <button onClick="OpenWindowAndSetValue('../CommPages/SelectDate.asp',280,120,window,document.AFPointPanel.startDate);document.AFPointPanel.startDate.focus();">选择时间</button><font color="#FF0000">*</font><span id="startDate_Alert"></span></td> 
  95.   </tr>
  96.         <tr class="hback">
  97.           <td align="right">截止日期:</td>
  98.           <td><input name="EndDate" type="text" id="EndDate" value="<%=endDate%>" size="49" readonly="true"> 
  99.             <button onClick="OpenWindowAndSetValue('../CommPages/SelectDate.asp',280,120,window,document.AFPointPanel.EndDate);document.AFPointPanel.EndDate.focus();">选择时间</button><font color="#FF0000">*</font><span id="EndDate_Alert"></span></td>
  100.         </tr>
  101.         <tr class="hback">
  102.           <td align="right"> 竞答答案数 :</td>
  103.           <td><input name="AnswerNum" type="text" id="AnswerNum" size="50" value="<%if Request.QueryString("act")="editAFPoint" then Response.Write(ubound(AnswerArray)+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(AnswerNum.value)">设置</button>竞答答案均为多选一,即只有一个是正确的</td>
  104.         </tr>
  105. </table> 
  106. <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
  107.   <tr class='hback'>
  108. <td height="21" colspan="2" id="PrizeContainer">
  109. <%
  110. if Request.QueryString("act")="editAFPoint" then
  111. Response.Write("<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' >")
  112. for ArrayIndex=0 to Ubound(AnswerArray)
  113. Set AnswerRs=User_Conn.Execute("Select AnswerDesc,AnswerID  from FS_ME_Answer where AnswerID="&AnswerArray(ArrayIndex))
  114. Response.Write("<tr class='hback'>")
  115. Response.Write("<td align='right' width='14%'>答案"&(ArrayIndex+1)&":</td><td><input name='Answer_"&(ArrayIndex+1)&"' type='text' id='Answer_"&(ArrayIndex+1)&"' size='50' value='"&AnswerRs("AnswerDesc")&"'></td></tr>")
  116. next
  117. Response.Write("</table>")
  118. AnswerRs.close
  119. end if
  120. %> </td>
  121. </tr>
  122. <tr class='hback'>
  123. <td width="14%" align="right">正确答案: </td>
  124. <td width="86%"><input name="rightAnswer" type="text" id="rightAnswer" size="50" value="<%=RightAnswerID%>" onKeyUp="if(isNaN(value)||event.keyCode==32)execCommand('undo')"  onafterpaste="if(isNaN(value)||event.keyCode==32)execCommand('undo')" maxlength="4"><font color="#FF0000">*</font>请填写答案题编号<span id="rightAnswer_Alert"></span></td>
  125. </tr>
  126. <tr class='hback'>
  127. <td>&nbsp;</td>
  128. <td><div align="left"><input type="button" name="ADDEditAFPointButton" onClick="ADDEditAFPoint()" value="保存"> | <input type="reset" name="" value="重置"></div></td>
  129. </tr>
  130. </table>
  131. </form>
  132. </body>
  133. <%
  134. if Request.QueryString("Act")="editAFPoint" then
  135. AFPointRs.close
  136. set AFPointRs=nothing
  137. Conn.close
  138. Set Conn=nothing
  139. User_Conn.close
  140. Set User_Conn=nothing
  141. Set AnswerRs=nothing
  142. end if
  143. %>
  144. <script language="JavaScript" type="text/JavaScript">
  145. <!--
  146. function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  147.   if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
  148.     document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  149.   else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
  150. }
  151. MM_reloadPage(true);
  152. //-->
  153. if("<%=Request.QueryString("act")%>"!="editAFPoint")
  154. {
  155. setPrizeGradeNum(1);
  156. }
  157. function setPrizeGradeNum(Num){
  158. Num = parseInt(Num);
  159. if(isNaN(Num))Num=1;
  160. //alert(Num);
  161. var i,PrizeGradeNum='';
  162. for (i=1;i<=Num;i++)
  163. {
  164. PrizeGradeNum = PrizeGradeNum +"<tr class='hback'><td align='right' width='14%'>答案"+i+":</td><td><input name='Answer_"+i+"' type='text' id='Answer_"+i+"' size='50' value=''></td></tr>";
  165. }
  166. document.getElementById("PrizeContainer").innerHTML="<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' >"+PrizeGradeNum+"</table>";
  167. }
  168. function ADDEditAFPoint()
  169. {
  170. var flag1=isEmpty("ATopic","ATopic_Alert");
  171. var flag2=isEmpty("startDate","startDate_Alert");
  172. var flag3=isEmpty("EndDate","EndDate_Alert");
  173. var flag4=isEmpty("needpoint","needpoint_Alert")
  174. var flag5=isEmpty("Prizepoint","Prizepoint_Alert")
  175. var flag6=isNumber('needpoint','needpoint_Alert','积分应该为正整数',true);
  176. var flag7=isNumber('Prizepoint','Prizepoint_Alert','积分应该为正整数',true);
  177. var flag8=isEmpty('rightAnswer','rightAnswer_Alert')
  178. if(flag1&&flag2&&flag3&&flag4&&flag5&&flag6&&flag7&&flag8)
  179. {
  180. document.AFPointPanel.submit();
  181. }
  182. }
  183. </script>
  184. </html>