home *** CD-ROM | disk | FTP | other *** search
/ bombers.k12.ar.us / bombers.k12.ar.us.tar / bombers.k12.ar.us / survey_unconfigured / ChangeStatus.asp < prev    next >
Text File  |  2006-10-25  |  5KB  |  138 lines

  1. <!--#Include File="Include/Top_inc.asp"-->
  2. <%
  3. '***********************************************************************
  4. '   Application: SelectSurveyASP Advanced v8.1.11
  5. '   Author: Aaron Baril for ClassApps.com
  6. '   Page Description: This page changes the status of a survey by setting its status in
  7. '                     the database equal to the value passed in on the querystring.
  8. '
  9. '   COPYRIGHT NOTICE                                
  10. '
  11. '   See attached Software License Agreement
  12. '
  13. '   (c) Copyright 2002 - 2006 by ClassApps.com.  All rights reserved.
  14. '***********************************************************************
  15. %>
  16. <!--#Include File="Include/Config_inc.asp"-->
  17. <!--#Include File="Include/SurveyUtility_inc.asp"-->
  18. <!--#Include File="Include/Utility_inc.asp"-->
  19. <!--#Include File="Include/adovbs_inc.asp"-->
  20. <!--#Include File="Include/Encryption_inc.asp"-->
  21. <!--#Include File="Include/CurrentUser_inc.asp"-->
  22. <!--#Include File="Include/Constants_inc.asp"-->
  23. <!--#Include File="Include/SurveySecurity_inc.asp"-->
  24. <%
  25.     'In order to launch the survey, the user must be the survey owner or an admin
  26.     If IsUserOwnerOrAdmin(Request.QueryString("SurveyID")) = False Then
  27.         Response.Redirect "AccessDenied.asp?SurveyID=" & Request.QueryString("SurveyID") & "&Reason=" & SUR_ACCESS_DENIED_NOT_OWNER
  28.     End If
  29.  
  30.     Dim strSQL
  31.     Dim conLaunchSurvey
  32.     Dim lngQuestionCount
  33.     Dim flgRedirect
  34.     Dim lngSurveyID
  35.     
  36.     'Initialization
  37.     flgRedirect = False
  38.     lngSurveyID = Request.QueryString("SurveyID")
  39.     Set conLaunchSurvey = Server.CreateObject("ADODB.Connection")
  40.     conLaunchSurvey.Open SURVEY_APP_CONNECTION
  41.  
  42.     'Get the number of questions associated with this survey
  43.     lngQuestionCount = GetQuestionCount(lngSurveyID)
  44.  
  45.     'Check the question count because the status of a survey can only be changed if the survey has questions
  46.     If lngQuestionCount > 0 Then 'This survey has questions
  47.         strSQL = "UPDATE sur_survey SET status = " & SQLEncode(Request.QueryString("Status"))
  48.  
  49.         'If the survey is being launched (status changed from Design to Open), update the launched date        
  50.         If Request.QueryString("Launch") = "Yes" Then
  51.             strSQL = strSQL & ", launched_date = GETDATE()"
  52.         End If
  53.         
  54.         'If the survey is being closed (status changed to Closed), update the closed date.  If the survey is being 
  55.         'set to open, make sure that the Closed date is null.
  56.         If Request.QueryString("Status") = SUR_STATUS_CLOSED Then
  57.             strSQL = strSQL & ", closed_date = GETDATE()"
  58.         Else
  59.             strSQL = strSQL & ", closed_date = Null"
  60.         End If
  61.  
  62.         strSQL = strSQL & " WHERE survey_id = " & lngSurveyID
  63.  
  64.         conLaunchSurvey.Execute ConvertSQL(strSQL), , adCmdText
  65.  
  66.         flgRedirect = True 'Redirect when finished, since we do not need to display a message
  67.     Else
  68. %>
  69.         <html>
  70.         <head>
  71.             <title>Launch Survey</title>
  72.             <link rel="stylesheet" href="Resources/StyleSheet/SurveyStyle.css">
  73.         </head>
  74.         <body class="MainBodyStyle">
  75.  
  76. <!--#Include File="Include/FrameworkTop_inc.asp"-->
  77.  
  78.         <table border="0" cellspacing="0" cellpadding="0" width="754" class="MediumBlueBackgroundColor">
  79.             <tr>
  80.                 <td height="36" valign="center">
  81.                       <span class="H1HeadingStyle"><a name="skipnav" tabindex="1">Surveys</a></span>
  82.                 </td>
  83.             </tr>
  84.         </table>
  85.  
  86. <!--#Include File="Include/FrameworkTop2_inc.asp"-->
  87.         
  88.         <table width="740" border="0" cellpadding="0" cellspacing="6" class="LightGrayBackgroundColor">
  89.             <tr>
  90.                 <td width="1"></td>
  91.                 <td height="40" valign="center">
  92.                     <span class="H2HeadingStyle">Invalid Survey Launch</span>
  93.                 </td>
  94.                 <td width="1"> </td>
  95.             </tr>
  96.         </table>
  97.         <table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td height="1" background="Resources/Images/ThinDivider.gif"></td></tr>
  98.         <table border="0" cellpadding="0" cellspacing="6" width="740" class="WhiteBackgroundColor">
  99.             <tr>
  100.                 <td width="1" rowspan="2"></td>
  101.                 <td class="Normal" align="left" valign="center" height="150">
  102.                     <br>
  103.                     The survey that you are trying to launch does not have any questions.  You can modify this survey by 
  104.                     clicking <a href="ModifySurvey.asp?SurveyID=<%=lngSurveyID%>">here</a>.
  105.                     <br><br>
  106.                 </td>
  107.                 <td width="1" rowspan="2"></td>
  108.             </tr>
  109.             <tr>
  110.                 <td align="right">
  111.                     <a href="SurveyList.asp"><img border="0" alt="OK" src="Resources/Buttons/OK.gif"></a>
  112.                 </td>
  113.             </tr>
  114.         </table>
  115.                 
  116. <!--#Include File="Include/FrameworkBottom_inc.asp"-->
  117.             
  118.         </body>
  119.         </html>
  120. <%    
  121.     End If
  122.  
  123.     'Clean up
  124.     conLaunchSurvey.Close
  125.     Set conLaunchSurvey = Nothing
  126.  
  127.     'Redirect to the main list of surveys for the current user
  128.     If flgRedirect = True Then
  129.         'If the querystring variable DeployNext was provided, then return to page Deploy.asp
  130.         If Len(Request.QueryString("DeployNext")) > 0 Then
  131.             Response.Redirect "Deploy.asp?SurveyID=" & lngSurveyID & "&SurveyName=" & Request.QueryString("SurveyName")
  132.         ElseIf Len(Request.QueryString("DisplaySurvey")) > 0 Then
  133.             Response.Redirect "TakeSurvey.asp?SurveyID=" & EncryptSurveyID(lngSurveyID)
  134.         Else
  135.             Response.Redirect "SurveyList.asp#SurveyID" & lngSurveyID
  136.         End If
  137.     End If
  138. %>