home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
bombers.k12.ar.us
/
bombers.k12.ar.us.tar
/
bombers.k12.ar.us
/
survey_unconfigured
/
CreateTemplateAction.asp
< prev
next >
Wrap
Text File
|
2006-10-25
|
15KB
|
295 lines
<!--#Include File="Include/Top_inc.asp"-->
<%
'***********************************************************************
' Application: SelectSurveyASP Advanced v8.1.11
' Author: Aaron Baril for ClassApps.com
' Page Description: This page creates a new template either from scratch or by
' copying an existing template.
'
' 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/ID_inc.asp"-->
<!--#Include File="Include/CurrentUser_inc.asp"-->
<!--#Include File="Include/SurveySecurity_inc.asp"-->
<!--#Include File="Include/Constants_inc.asp"-->
<!--#Include File="Include/Collection_inc.asp"-->
<%
'If the user does not have "Create" or "Admin" permission, redirect them to the access denied page.
If lngUserSecurityLevel <> SUR_SECURITY_LEVEL_CREATE And lngUserSecurityLevel <> SUR_SECURITY_LEVEL_ADMIN Then
Response.Redirect "AccessDenied.asp?Reason=" & SUR_ACCESS_DENIED_NOT_ADMIN_SECURITY_LEVEL
End If
Dim strSQL
Dim conNewTemplate
Dim lngOriginalTemplateID
Dim lngNewTemplateID
Dim rsOriginalTemplate
Dim strActiveYN
Dim strTemplateName
Dim lngUserID
Dim strAllowUseYN
Dim strLogoPath
Dim strLogoAlignment
Dim strSurveyAlignment
Dim strDisplayBorderYN
Dim strBorderColor
Dim lngBorderWidth
Dim strSurveyBackgroundColor
Dim strPageBackgroundColor
Dim strMatrixHeaderColor
Dim strMatrixFirstColor
Dim strMatrixSecondColor
Dim strProgressFirstColor
Dim strProgressSecondColor
Dim strSurveyNameFontColor
Dim lngSurveyNameFontSize
Dim strSurveyNameFontWeight
Dim strSurveyNameFontFamily
Dim strPageTitleFontColor
Dim lngPageTitleFontSize
Dim strPageTitleFontWeight
Dim strPageTitleFontFamily
Dim strPageNumberFontColor
Dim lngPageNumberFontSize
Dim strPageNumberFontWeight
Dim strPageNumberFontFamily
Dim strQuestionTextFontColor
Dim lngQuestionTextFontSize
Dim strQuestionTextFontWeight
Dim strQuestionTextFontFamily
Dim strQuestionSubtextFontColor
Dim lngQuestionSubtextFontSize
Dim strQuestionSubtextFontWeight
Dim strQuestionSubtextFontFamily
Dim strHTMLTop
Dim strHTMLBottom
Dim strNavigationLinkFontColor
Dim lngNavigationLinkFontSize
Dim strNavigationLinkFontWeight
Dim strNavigationLinkFontFamily
Dim strNavigationBackButtonPath
Dim strNavigationBackLinkText
Dim strNavigationNextButtonPath
Dim strNavigationNextLinkText
Dim strNavigationCancelButtonPath
Dim strNavigationCancelLinkText
Dim strNavigationDoneButtonPath
Dim strNavigationDoneLinkText
'Initialization
Set rsOriginalTemplate = Server.CreateObject("ADODB.Recordset")
Set conNewTemplate = Server.CreateObject("ADODB.Connection")
conNewTemplate.Open SURVEY_APP_CONNECTION
lngNewTemplateID = ID_GetNextAvailableID("SurveyGenerationTemplate")
lngUserID = GetUserID()
'Set the values for all fields in the template based on whether this is a copy or a new template
If CLng(Request.Form("optType")) = SUR_CREATE_TEMPLATE_FROM_SCRATCH Then
strActiveYN = SUR_BOOLEAN_POSITIVE
strTemplateName = Request.Form("txtTemplateName")
strAllowUseYN = SUR_BOOLEAN_NEGATIVE
strLogoPath = ""
strLogoAlignment = SUR_LOGO_ALIGNMENT_LEFT
strSurveyAlignment = SUR_SURVEY_ALIGNMENT_CENTER
strDisplayBorderYN = SUR_BOOLEAN_POSITIVE
strBorderColor = SUR_DEFAULT_BORDER_COLOR
lngBorderWidth = SUR_DEFAULT_BORDER_WIDTH
strSurveyBackgroundColor = SUR_DEFAULT_SURVEY_BACKGROUND_COLOR
strPageBackgroundColor = SUR_DEFAULT_PAGE_BACKGROUND_COLOR
strMatrixHeaderColor = SUR_COLOR_MEDIUM_GRAY_BACKGROUND
strMatrixFirstColor = SUR_COLOR_MEDIUM_GRAY_BACKGROUND
strMatrixSecondColor = SUR_COLOR_LIGHT_GRAY_BACKGROUND
strSurveyNameFontColor = SUR_DEFAULT_FONT_COLOR
lngSurveyNameFontSize = "18"
strSurveyNameFontWeight = SUR_FONT_WEIGHT_BOLD
strSurveyNameFontFamily = SUR_DEFAULT_FONT_FAMILY
strPageTitleFontColor = SUR_DEFAULT_FONT_COLOR
lngPageTitleFontSize = "16"
strPageTitleFontWeight = SUR_FONT_WEIGHT_BOLD
strPageTitleFontFamily = SUR_DEFAULT_FONT_FAMILY
strPageNumberFontColor = SUR_DEFAULT_FONT_COLOR
lngPageNumberFontSize = "12"
strPageNumberFontWeight = SUR_FONT_WEIGHT_BOLD
strPageNumberFontFamily = SUR_DEFAULT_FONT_FAMILY
strQuestionTextFontColor = SUR_DEFAULT_FONT_COLOR
lngQuestionTextFontSize = "12"
strQuestionTextFontWeight = SUR_FONT_WEIGHT_NORMAL
strQuestionTextFontFamily = SUR_DEFAULT_FONT_FAMILY
strQuestionSubtextFontColor = SUR_DEFAULT_FONT_COLOR
lngQuestionSubtextFontSize = "10"
strQuestionSubtextFontWeight = SUR_FONT_WEIGHT_NORMAL
strQuestionSubtextFontFamily = SUR_DEFAULT_FONT_FAMILY
strHTMLTop = ""
strHTMLBottom = ""
strNavigationLinkFontColor = SUR_DEFAULT_FONT_COLOR
lngNavigationLinkFontSize = "14"
strNavigationLinkFontWeight = SUR_FONT_WEIGHT_NORMAL
strNavigationLinkFontFamily = SUR_DEFAULT_FONT_FAMILY
strNavigationBackButtonPath = "Resources/SurveyButtons/Back.gif"
strNavigationBackLinkText = ""
strNavigationNextButtonPath = "Resources/SurveyButtons/Next.gif"
strNavigationNextLinkText = ""
strNavigationDoneButtonPath = "Resources/SurveyButtons/Done.gif"
strNavigationDoneLinkText = ""
strNavigationCancelButtonPath = "Resources/SurveyButtons/Cancel.gif"
strNavigationCancelLinkText = ""
Else 'SUR_CREATE_TEMPLATE_FROM_EXISTING
'Load the existing data from the database
strSQL = "SELECT active_yn, template_name, user_id, allow_use_yn, logo_path, logo_alignment, " & _
"survey_alignment, display_border_yn, border_color, border_width, survey_background_color, " & _
"page_background_color, matrix_header_color, matrix_first_color, matrix_second_color, survey_name_font_color, " & _
"progress_first_color, progress_second_color, survey_name_font_size, survey_name_font_weight, " & _
"survey_name_font_family, page_title_font_color, page_title_font_size, page_title_font_weight, " & _
"page_title_font_family, page_number_font_color, page_number_font_size, page_number_font_weight, " & _
"page_number_font_family, question_text_font_color, question_text_font_size, question_text_font_weight, " & _
"question_text_font_family, question_subtext_font_color, question_subtext_font_size, " & _
"question_subtext_font_weight, question_subtext_font_family, navigation_link_font_color, " & _
"navigation_link_font_size, navigation_link_font_weight, navigation_link_font_family, html_top, html_bottom, " & _
"navigation_back_button_path, navigation_back_link_text, navigation_next_button_path, navigation_next_link_text, " & _
"navigation_cancel_button_path, navigation_cancel_link_text, navigation_done_button_path, navigation_done_link_text " & _
"FROM sur_template " & _
"WHERE template_id = " & Request.Form("cboTemplate")
rsOriginalTemplate.Open ConvertSQL(strSQL), SURVEY_APP_CONNECTION, adOpenForwardOnly, adLockReadOnly, adCmdText
rsOriginalTemplate.MoveFirst
'Capture all of the fields in local variables
strActiveYN = rsOriginalTemplate("active_yn")
strTemplateName = Request.Form("txtTemplateName")
strAllowUseYN = rsOriginalTemplate("allow_use_yn")
strLogoPath = rsOriginalTemplate("logo_path")
strLogoAlignment = rsOriginalTemplate("logo_alignment")
strSurveyAlignment = rsOriginalTemplate("survey_alignment")
strDisplayBorderYN = rsOriginalTemplate("display_border_yn")
strBorderColor = rsOriginalTemplate("border_color")
lngBorderWidth = rsOriginalTemplate("border_width")
strSurveyBackgroundColor = rsOriginalTemplate("survey_background_color")
strPageBackgroundColor = rsOriginalTemplate("page_background_color")
strMatrixHeaderColor = rsOriginalTemplate("matrix_header_color")
strMatrixFirstColor = rsOriginalTemplate("matrix_first_color")
strMatrixSecondColor = rsOriginalTemplate("matrix_second_color")
strProgressFirstColor = rsOriginalTemplate("progress_first_color")
strProgressSecondColor = rsOriginalTemplate("progress_second_color")
strSurveyNameFontColor = rsOriginalTemplate("survey_name_font_color")
lngSurveyNameFontSize = rsOriginalTemplate("survey_name_font_size")
strSurveyNameFontWeight = rsOriginalTemplate("survey_name_font_weight")
strSurveyNameFontFamily = rsOriginalTemplate("survey_name_font_family")
strPageTitleFontColor = rsOriginalTemplate("page_title_font_color")
lngPageTitleFontSize = rsOriginalTemplate("page_title_font_size")
strPageTitleFontWeight = rsOriginalTemplate("page_title_font_weight")
strPageTitleFontFamily = rsOriginalTemplate("page_title_font_family")
strPageNumberFontColor = rsOriginalTemplate("page_number_font_color")
lngPageNumberFontSize = rsOriginalTemplate("page_number_font_size")
strPageNumberFontWeight = rsOriginalTemplate("page_number_font_weight")
strPageNumberFontFamily = rsOriginalTemplate("page_number_font_family")
strQuestionTextFontColor = rsOriginalTemplate("question_text_font_color")
lngQuestionTextFontSize = rsOriginalTemplate("question_text_font_size")
strQuestionTextFontWeight = rsOriginalTemplate("question_text_font_weight")
strQuestionTextFontFamily = rsOriginalTemplate("question_text_font_family")
strQuestionSubtextFontColor = rsOriginalTemplate("question_subtext_font_color")
lngQuestionSubtextFontSize = rsOriginalTemplate("question_subtext_font_size")
strQuestionSubtextFontWeight = rsOriginalTemplate("question_subtext_font_weight")
strQuestionSubtextFontFamily = rsOriginalTemplate("question_subtext_font_family")
strNavigationLinkFontColor = rsOriginalTemplate("navigation_link_font_color")
lngNavigationLinkFontSize = rsOriginalTemplate("navigation_link_font_size")
strNavigationLinkFontWeight = rsOriginalTemplate("navigation_link_font_weight")
strNavigationLinkFontFamily = rsOriginalTemplate("navigation_link_font_family")
strHTMLTop = rsOriginalTemplate("html_top")
strHTMLBottom = rsOriginalTemplate("html_bottom")
strNavigationBackButtonPath = rsOriginalTemplate("navigation_back_button_path")
strNavigationBackLinkText = rsOriginalTemplate("navigation_back_link_text")
strNavigationNextButtonPath = rsOriginalTemplate("navigation_next_button_path")
strNavigationNextLinkText = rsOriginalTemplate("navigation_next_link_text")
strNavigationCancelButtonPath = rsOriginalTemplate("navigation_cancel_button_path")
strNavigationCancelLinkText = rsOriginalTemplate("navigation_cancel_link_text")
strNavigationDoneButtonPath = rsOriginalTemplate("navigation_done_button_path")
strNavigationDoneLinkText = rsOriginalTemplate("navigation_done_link_text")
'Clean up
rsOriginalTemplate.Close
Set rsOriginalTemplate = Nothing
End If
'Create the new template using all of the values set above
strSQL = "INSERT INTO sur_template(template_id, active_yn, template_name, user_id, allow_use_yn, " & _
"logo_path, logo_alignment, survey_alignment, display_border_yn, border_color, border_width, survey_background_color, " & _
"page_background_color, matrix_header_color, matrix_first_color, " & _
"matrix_second_color, progress_first_color, progress_second_color, survey_name_font_color, " & _
"survey_name_font_size, survey_name_font_weight, survey_name_font_family, page_title_font_color, " & _
"page_title_font_size, page_title_font_weight, page_title_font_family, page_number_font_color, " & _
"page_number_font_size, page_number_font_weight, page_number_font_family, question_text_font_color, " & _
"question_text_font_size, question_text_font_weight, question_text_font_family, question_subtext_font_color, " & _
"question_subtext_font_size, question_subtext_font_weight, question_subtext_font_family, " & _
"navigation_link_font_color, navigation_link_font_size, navigation_link_font_weight, " & _
"navigation_link_font_family, html_top, html_bottom, navigation_back_button_path, navigation_back_link_text, " & _
"navigation_next_button_path, navigation_next_link_text, navigation_cancel_button_path, " & _
"navigation_cancel_link_text, navigation_done_button_path, navigation_done_link_text) " & _
"VALUES(" & lngNewTemplateID & ", " & _
SQLEncode(strActiveYN) & ", " & _
SQLEncode(strTemplateName) & ", " & _
lngUserID & ", " & _
SQLEncode(strAllowUseYN) & ", " & _
SQLEncode(strLogoPath) & ", " & _
SQLEncode(strLogoAlignment) & ", " & _
SQLEncode(strSurveyAlignment) & ", " & _
SQLEncode(strDisplayBorderYN) & ", " & _
SQLEncode(strBorderColor) & ", " & _
lngBorderWidth & ", " & _
SQLEncode(strSurveyBackgroundColor) & ", " & _
SQLEncode(strPageBackgroundColor) & ", " & _
SQLEncode(strMatrixHeaderColor) & ", " & _
SQLEncode(strMatrixFirstColor) & ", " & _
SQLEncode(strMatrixSecondColor) & ", " & _
SQLEncode(SUR_DEFAULT_PROGRESS_FIRST_COLOR) & ", " & _
SQLEncode(SUR_DEFAULT_PROGRESS_SECOND_COLOR) & ", " & _
SQLEncode(strSurveyNameFontColor) & ", " & _
lngSurveyNameFontSize & ", " & _
SQLEncode(strSurveyNameFontWeight) & ", " & _
SQLEncode(strSurveyNameFontFamily) & ", " & _
SQLEncode(strPageTitleFontColor) & ", " & _
lngPageTitleFontSize & ", " & _
SQLEncode(strPageTitleFontWeight) & ", " & _
SQLEncode(strPageTitleFontFamily) & ", " & _
SQLEncode(strPageNumberFontColor) & ", " & _
lngPageNumberFontSize & ", " & _
SQLEncode(strPageNumberFontWeight) & ", " & _
SQLEncode(strPageNumberFontFamily) & ", " & _
SQLEncode(strQuestionTextFontColor) & ", " & _
lngQuestionTextFontSize & ", " & _
SQLEncode(strQuestionTextFontWeight) & ", " & _
SQLEncode(strQuestionTextFontFamily) & ", " & _
SQLEncode(strQuestionSubtextFontColor) & ", " & _
lngQuestionSubtextFontSize & ", " & _
SQLEncode(strQuestionSubtextFontWeight) & ", " & _
SQLEncode(strQuestionSubtextFontFamily) & ", " & _
SQLEncode(strNavigationLinkFontColor) & ", " & _
lngNavigationLinkFontSize & ", " & _
SQLEncode(strNavigationLinkFontWeight) & ", " & _
SQLEncode(strNavigationLinkFontFamily) & ", " & _
SQLEncode(strHTMLTop) & ", " & _
SQLEncode(strHTMLBottom) & ", " & _
SQLEncode(strNavigationBackButtonPath) & ", " & _
SQLEncode(strNavigationBackLinkText) & ", " & _
SQLEncode(strNavigationNextButtonPath) & ", " & _
SQLEncode(strNavigationNextLinkText) & ", " & _
SQLEncode(strNavigationCancelButtonPath) & ", " & _
SQLEncode(strNavigationCancelLinkText) & ", " & _
SQLEncode(strNavigationDoneButtonPath) & ", " & _
SQLEncode(strNavigationDoneLinkText) & ")"
conNewTemplate.Execute ConvertSQL(strSQL), , adCmdText
'Clean up
conNewTemplate.Close
Set conNewTemplate = Nothing
'Redirect to the template page for the template just created
Response.Redirect "Template.asp?TemplateID=" & lngNewTemplateID
%>