home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
bombers.k12.ar.us
/
bombers.k12.ar.us.tar
/
bombers.k12.ar.us
/
survey_unconfigured
/
SurveyAction.asp
< prev
next >
Wrap
Text File
|
2006-10-25
|
7KB
|
181 lines
<!--#Include File="Include/Top_inc.asp"-->
<%
'***********************************************************************
' Application: SelectSurveyASP Advanced v8.1.11
' Author: Aaron Baril for ClassApps.com
' Page Description: This page works with ManageSurvey.asp, and processes
' the form for managing general information about a survey
' by writing to the database.
'
' 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/Utility_inc.asp"-->
<!--#Include File="Include/adovbs_inc.asp"-->
<!--#Include File="Include/CurrentUser_inc.asp"-->
<!--#Include File="Include/ID_inc.asp"-->
<!--#Include File="Include/SurveySecurity_inc.asp"-->
<!--#Include File="Include/Constants_inc.asp"-->
<%
Dim strSQL
Dim conSurvey
Dim strOwners
Dim lngSurveyID
Dim strPageNumbering
Dim strSecureSurvey
Dim strPreviousStatus
Dim rsSurvey
Dim strStartDate
Dim strEndDate
Dim strBorderColor
Dim strBackgroundColor
Dim lngMaximumResponses
Dim lngMaximumResponsesPerUser
Dim lngModifySurveyWithinDays
Dim strCloseButton
Dim strContinueButton
Dim strReportsButton
'Initialization
Set conSurvey = Server.CreateObject("ADODB.Connection")
Set rsSurvey = Server.CreateObject("ADODB.Recordset")
conSurvey.Open SURVEY_APP_CONNECTION
strOwners = Replace(Request.Form("txtOwners"), " ", "")
'Get the previous status of the survey. If the status was previously New, and
'it is now being changed to Live, update the launch_date
strSQL = "SELECT status FROM sur_survey WHERE survey_id = " & Request.Form("SurveyID")
rsSurvey.Open ConvertSQL(strSQL), SURVEY_APP_CONNECTION, adOpenForwardOnly, adLockReadOnly, adCmdText
rsSurvey.MoveFirst
strPreviousStatus = rsSurvey("status")
rsSurvey.Close
Set rsSurvey = Nothing
If Request.Form("chkPageNumbering") = "on" Then
strPageNumbering = SUR_BOOLEAN_POSITIVE
Else
strPageNumbering = SUR_BOOLEAN_NEGATIVE
End If
If Request.Form("chkSecureSurvey") = "on" Then
strSecureSurvey = SUR_BOOLEAN_POSITIVE
Else
strSecureSurvey = SUR_BOOLEAN_NEGATIVE
End If
If Len(Request.Form("txtStartDate")) > 0 Then
strStartDate = Request.Form("txtStartDate")
Else
strStartDate = "Null"
End If
If Len(Request.Form("txtEndDate")) > 0 Then
strEndDate = Request.Form("txtEndDate")
Else
strEndDate = "Null"
End If
If Len(Request.Form("cboBorderColor")) > 0 Then
strBorderColor = Request.Form("cboBorderColor")
Else
strBorderColor = Request.Form("txtBorderColor")
End If
If Len(Request.Form("cboBackgroundColor")) > 0 Then
strBackgroundColor = Request.Form("cboBackgroundColor")
Else
strBackgroundColor = Request.Form("txtBackgroundColor")
End If
If Len(Trim(Request.Form("txtMaximumResponses"))) = 0 Then
lngMaximumResponses = SUR_UNLIMITED_RESPONSES
Else
lngMaximumResponses = Request.Form("txtMaximumResponses")
End If
If Len(Trim(Request.Form("txtMaximumResponsesPerUser"))) = 0 Then
lngMaximumResponsesPerUser = SUR_UNLIMITED_RESPONSES
Else
lngMaximumResponsesPerUser = Request.Form("txtMaximumResponsesPerUser")
End If
If Len(Trim(Request.Form("txtModifySurveyWithinDays"))) = 0 Then
lngModifySurveyWithinDays = SUR_UNLIMITED_NUMBER_OF_DAYS
Else
lngModifySurveyWithinDays = Request.Form("txtModifySurveyWithinDays")
End If
'Completion buttons
If Request.Form("chkCloseButton") = "on" Then
strCloseButton = SUR_BOOLEAN_POSITIVE
Else
strCloseButton = SUR_BOOLEAN_NEGATIVE
End If
If Request.Form("chkContinueButton") = "on" Then
strContinueButton = SUR_BOOLEAN_POSITIVE
Else
strContinueButton = SUR_BOOLEAN_NEGATIVE
End If
If Request.Form("chkReportsButton") = "on" Then
strReportsButton = SUR_BOOLEAN_POSITIVE
Else
strReportsButton = SUR_BOOLEAN_NEGATIVE
End If
'Create the SQL statement to update the SUR_SURVEY table
strSQL = "UPDATE sur_survey SET "
'If the previous status was New and the status is now being updated to Live, set the launched date.
If strPreviousStatus = SUR_STATUS_DESIGN And Request.Form("cboStatus") = SUR_STATUS_OPEN Then
strSQL = strSQL & "launched_date = GETDATE(), "
End If
'If the previous status was not Closed and it is now being updated to Closed, set the closed date.
If strPreviousStatus <> SUR_STATUS_CLOSED And Request.Form("cboStatus") = SUR_STATUS_CLOSED Then
strSQL = strSQL & "closed_date = GETDATE(), "
End If
strSQL = strSQL & "title = " & SQLEncode(Request.Form("txtTitle")) & ", " & _
"template_id = " & Request.Form("cboTemplateID") & ", " & _
"report_security = " & SQLEncode(Request.Form("cboReportSecurity")) & ", " & _
"page_numbering_format = " & SQLEncode(Request.Form("cboPageNumbering")) & ", " & _
"question_numbering_format = " & SQLEncode(Request.Form("cboQuestionNumbering")) & ", " & _
"survey_language = " & SQLEncode(Request.Form("cboSurveyLanguage")) & ", " & _
"status = " & SQLEncode(Request.Form("cboStatus")) & ", " & _
"start_date = " & SQLEncodeDate(CustomDateFormatInsert(strStartDate)) & ", " & _
"end_date = " & SQLEncodeDate(CustomDateFormatInsert(strEndDate)) & ", " & _
"maximum_responses_for_survey = " & lngMaximumResponses & ", " & _
"respondent_access_level = " & Request.Form("optRespondentAccessLevel") & ", " & _
"survey_complete_message = " & SQLEncode(Request.Form("txtSurveyCompleteMessage")) & ", " & _
"owners = " & SQLEncode(strOwners) & ", " & _
"completion_action = " & SQLEncode(Request.Form("cboCompletionAction")) & ", " & _
"survey_complete_display_close = " & SQLEncode(strCloseButton) & ", " & _
"survey_complete_display_continue = " & SQLEncode(strContinueButton) & ", " & _
"survey_complete_display_reports = " & SQLEncode(strReportsButton) & ", " & _
"survey_complete_redirect_url = " & SQLEncode(Request.Form("txtSurveyCompleteRedirectURL")) & ", " & _
"response_email_addresses = " & SQLEncode(Request.Form("txtResponseEmailAddresses")) & ", " & _
"admin_email_address = " & SQLEncode(Request.Form("txtAdminEmailAddress")) & ", " & _
"highlight_responses_yn= " & SQLEncode(Request.Form("cboHighlightResponses")) & ", " & _
"back_button_display = " & SQLEncode(Request.Form("cboBackButtonDisplay")) & ", " & _
"cancel_button_display = " & SQLEncode(Request.Form("cboCancelButtonDisplay")) & ", " & _
"cancel_button_redirect_url = " & SQLEncode(Request.Form("txtCancelButtonRedirectURL")) & ", " & _
"maximum_responses_per_user = " & lngMaximumResponsesPerUser & ", " & _
"modify_survey_within_days = " & lngModifySurveyWithinDays & _
" WHERE survey_id = " & Request.Form("SurveyID")
conSurvey.Execute ConvertSQL(strSQL), , adCmdText
'Clean up
conSurvey.Close
Set conSurvey = Nothing
'Redirect to the main list of surveys for the current user
If Request.Form("Nav") = "Survey" Then
Response.Redirect "Survey.asp?SurveyID=" & Request.Form("SurveyID")
Else
Response.Redirect "SurveyList.asp"
End If
%>