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 >
Wrap
Text File
|
2006-10-25
|
5KB
|
138 lines
<!--#Include File="Include/Top_inc.asp"-->
<%
'***********************************************************************
' Application: SelectSurveyASP Advanced v8.1.11
' Author: Aaron Baril for ClassApps.com
' Page Description: This page changes the status of a survey by setting its status in
' the database equal to the value passed in on the querystring.
'
' COPYRIGHT NOTICE
'
' See attached Software License Agreement
'
' (c) Copyright 2002 - 2006 by ClassApps.com. All rights reserved.
'***********************************************************************
%>
<!--#Include File="Include/Config_inc.asp"-->
<!--#Include File="Include/SurveyUtility_inc.asp"-->
<!--#Include File="Include/Utility_inc.asp"-->
<!--#Include File="Include/adovbs_inc.asp"-->
<!--#Include File="Include/Encryption_inc.asp"-->
<!--#Include File="Include/CurrentUser_inc.asp"-->
<!--#Include File="Include/Constants_inc.asp"-->
<!--#Include File="Include/SurveySecurity_inc.asp"-->
<%
'In order to launch the survey, the user must be the survey owner or an admin
If IsUserOwnerOrAdmin(Request.QueryString("SurveyID")) = False Then
Response.Redirect "AccessDenied.asp?SurveyID=" & Request.QueryString("SurveyID") & "&Reason=" & SUR_ACCESS_DENIED_NOT_OWNER
End If
Dim strSQL
Dim conLaunchSurvey
Dim lngQuestionCount
Dim flgRedirect
Dim lngSurveyID
'Initialization
flgRedirect = False
lngSurveyID = Request.QueryString("SurveyID")
Set conLaunchSurvey = Server.CreateObject("ADODB.Connection")
conLaunchSurvey.Open SURVEY_APP_CONNECTION
'Get the number of questions associated with this survey
lngQuestionCount = GetQuestionCount(lngSurveyID)
'Check the question count because the status of a survey can only be changed if the survey has questions
If lngQuestionCount > 0 Then 'This survey has questions
strSQL = "UPDATE sur_survey SET status = " & SQLEncode(Request.QueryString("Status"))
'If the survey is being launched (status changed from Design to Open), update the launched date
If Request.QueryString("Launch") = "Yes" Then
strSQL = strSQL & ", launched_date = GETDATE()"
End If
'If the survey is being closed (status changed to Closed), update the closed date. If the survey is being
'set to open, make sure that the Closed date is null.
If Request.QueryString("Status") = SUR_STATUS_CLOSED Then
strSQL = strSQL & ", closed_date = GETDATE()"
Else
strSQL = strSQL & ", closed_date = Null"
End If
strSQL = strSQL & " WHERE survey_id = " & lngSurveyID
conLaunchSurvey.Execute ConvertSQL(strSQL), , adCmdText
flgRedirect = True 'Redirect when finished, since we do not need to display a message
Else
%>
<html>
<head>
<title>Launch Survey</title>
<link rel="stylesheet" href="Resources/StyleSheet/SurveyStyle.css">
</head>
<body class="MainBodyStyle">
<!--#Include File="Include/FrameworkTop_inc.asp"-->
<table border="0" cellspacing="0" cellpadding="0" width="754" class="MediumBlueBackgroundColor">
<tr>
<td height="36" valign="center">
<span class="H1HeadingStyle"><a name="skipnav" tabindex="1">Surveys</a></span>
</td>
</tr>
</table>
<!--#Include File="Include/FrameworkTop2_inc.asp"-->
<table width="740" border="0" cellpadding="0" cellspacing="6" class="LightGrayBackgroundColor">
<tr>
<td width="1"></td>
<td height="40" valign="center">
<span class="H2HeadingStyle">Invalid Survey Launch</span>
</td>
<td width="1"> </td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td height="1" background="Resources/Images/ThinDivider.gif"></td></tr>
<table border="0" cellpadding="0" cellspacing="6" width="740" class="WhiteBackgroundColor">
<tr>
<td width="1" rowspan="2"></td>
<td class="Normal" align="left" valign="center" height="150">
<br>
The survey that you are trying to launch does not have any questions. You can modify this survey by
clicking <a href="ModifySurvey.asp?SurveyID=<%=lngSurveyID%>">here</a>.
<br><br>
</td>
<td width="1" rowspan="2"></td>
</tr>
<tr>
<td align="right">
<a href="SurveyList.asp"><img border="0" alt="OK" src="Resources/Buttons/OK.gif"></a>
</td>
</tr>
</table>
<!--#Include File="Include/FrameworkBottom_inc.asp"-->
</body>
</html>
<%
End If
'Clean up
conLaunchSurvey.Close
Set conLaunchSurvey = Nothing
'Redirect to the main list of surveys for the current user
If flgRedirect = True Then
'If the querystring variable DeployNext was provided, then return to page Deploy.asp
If Len(Request.QueryString("DeployNext")) > 0 Then
Response.Redirect "Deploy.asp?SurveyID=" & lngSurveyID & "&SurveyName=" & Request.QueryString("SurveyName")
ElseIf Len(Request.QueryString("DisplaySurvey")) > 0 Then
Response.Redirect "TakeSurvey.asp?SurveyID=" & EncryptSurveyID(lngSurveyID)
Else
Response.Redirect "SurveyList.asp#SurveyID" & lngSurveyID
End If
End If
%>