home *** CD-ROM | disk | FTP | other *** search
/ bombers.k12.ar.us / bombers.k12.ar.us.tar / bombers.k12.ar.us / survey_unconfigured / TakeSurveyError.asp < prev    next >
Text File  |  2005-11-03  |  15KB  |  364 lines

  1. <!--#Include File="Include/Top_inc.asp"-->
  2. <%
  3. '***********************************************************************
  4. '   Application: SelectSurveyASP Advanced v8.1.1
  5. '   Author: Aaron Baril for ClassApps.com
  6. '   Page Description: This page is displayed when the user attempts to
  7. '                     access a survey that cannot be taken.
  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/adovbs_inc.asp"-->
  18. <!--#Include File="Include/ID_inc.asp"-->
  19. <!--#Include File="Include/CurrentUser_inc.asp"-->
  20. <!--#Include File="Include/SurveySecurity_inc.asp"-->
  21. <!--#Include File="Include/SurveyEmail_inc.asp"-->
  22. <!--#Include File="Include/Encryption_inc.asp"-->
  23. <!--#Include File="Include/Constants_inc.asp"-->
  24. <!--#Include File="Include/SurveyUtility_inc.asp"-->
  25. <!--#Include File="Include/Utility_inc.asp"-->
  26. <!--#Include File="Include/Email_inc.asp"-->
  27. <%
  28.     Dim strSQL
  29.     Dim rsSurvey
  30.     Dim lngSurveyID
  31.     Dim strTitle
  32.     Dim strLogoPath
  33.     Dim strLogoAlignment
  34.     Dim strSurveyAlignment
  35.     Dim strSurveyLanguage
  36.     Dim strHTMLTop
  37.     Dim strHTMLBottom
  38.     Dim strCompletionAction
  39.     Dim strSurveyCompleteURL
  40.     Dim strDisplayBorderYN
  41.     Dim strBorderColor
  42.     Dim lngBorderWidth
  43.     Dim strSurveyBackgroundColor
  44.     Dim strPageBackgroundColor
  45.     Dim strResponseEmailAddresses
  46.     Dim strAdminEmailAddress
  47.     Dim strPageTitle1
  48.     Dim strPageTitle2
  49.     Dim strMessage
  50.     Dim strQuestionTextFontFamily
  51.  
  52.     'Initialization
  53.     lngSurveyID = DecryptSurveyID(Request.QueryString("SurveyID"))
  54.     Set rsSurvey = Server.CreateObject("ADODB.Recordset")
  55.  
  56. '--10/28/2005 moved two text fields to end of query due to it rendering page wrong if slq driver issue
  57.     'Select information about the survey and the template
  58.     strSQL = "SELECT title, logo_path, logo_alignment, survey_alignment, survey_language, completion_action, survey_complete_redirect_url, " & _
  59.                 "display_border_yn, border_color, border_width, matrix_header_color, " & _
  60.                 "survey_background_color, page_background_color, matrix_first_color, matrix_second_color, " & _
  61.                 "survey_name_font_color, survey_name_font_size, survey_name_font_weight, " & _
  62.                 "admin_email_address, survey_name_font_family, page_title_font_color, page_title_font_size, " & _
  63.                 "page_title_font_weight, page_title_font_family, page_number_font_color, page_number_font_size, " & _
  64.                 "page_number_font_weight, page_number_font_family, question_text_font_color, question_text_font_size, " & _
  65.                 "question_text_font_weight, question_text_font_family, question_subtext_font_color, question_subtext_font_size, " & _
  66.                 "question_subtext_font_weight, question_subtext_font_family, response_email_addresses, " & _
  67.                 "html_top, html_bottom " & _
  68.              "FROM sur_survey s, sur_template t " & _
  69.              "WHERE s.template_id = t.template_id " & _
  70.              "AND survey_id = " & lngSurveyID
  71.  
  72.  
  73.     rsSurvey.Open ConvertSQL(strSQL), SURVEY_APP_CONNECTION, adOpenForwardOnly, adLockReadOnly, adCmdText
  74. '--10/28/2005 styles not rendering
  75.     strQuestionTextFontFamily = rsSurvey("question_text_font_family")
  76.     strPageBackgroundColor = rsSurvey("page_background_color")
  77.     strTitle = rsSurvey("title")
  78.     strLogoPath = rsSurvey("logo_path")
  79.     strLogoAlignment = rsSurvey("logo_alignment")
  80.     strSurveyAlignment = rsSurvey("survey_alignment")
  81.     strSurveyLanguage = rsSurvey("survey_language")
  82.     strCompletionAction = rsSurvey("completion_action")
  83.     strSurveyCompleteURL = rsSurvey("survey_complete_redirect_url")
  84.     strHTMLTop = rsSurvey("html_top")
  85.     strHTMLBottom = rsSurvey("html_bottom")
  86.     strResponseEmailAddresses = rsSurvey("response_email_addresses")
  87.     strAdminEmailAddress = rsSurvey("admin_email_address")
  88.     strDisplayBorderYN = rsSurvey("display_border_yn")
  89.     strBorderColor = rsSurvey("border_color")
  90.     lngBorderWidth = rsSurvey("border_width")
  91.     strSurveyBackgroundColor = rsSurvey("survey_background_color")
  92.  
  93.  
  94.     'Render the styles required for the survey
  95.  
  96. %>
  97. <style>
  98.     .SurveyBodyStyle
  99.     {
  100.         FONT-FAMILY: <%=strQuestionTextFontFamily%>;
  101.         BACKGROUND-COLOR: <%=strPageBackgroundColor%>;
  102.         COLOR: <%=rsSurvey("question_text_font_color")%>;
  103. <%
  104.         If Len(Trim(strHTMLTop)) > 0 Or Len(Trim(strHTMLBottom)) > 0 Then
  105. %>
  106.             MARGIN-LEFT: 0;
  107. <%
  108.         ElseIf strDisplayBorderYN = SUR_BOOLEAN_POSITIVE Then
  109. %>
  110.             MARGIN-LEFT: 10;
  111. <%
  112.         Else
  113. %>
  114.             MARGIN-LEFT: 3;
  115. <%
  116.         End If
  117. %>
  118.         MARGIN-RIGHT: 0;
  119.         MARGIN-BOTTOM: 0;
  120. <%
  121.         'If not top HTML was provided, leave a 15-pixel margin at the top; otherwise, flush the survey with the top,
  122.         'and let the top HTML establish the look and feel.
  123.         If Len(Trim(strHTMLTop)) = 0 Then
  124. %>
  125.             MARGIN-TOP: 15;
  126. <%
  127.         Else
  128. %>
  129.             MARGIN-TOP: 0;
  130. <%
  131.         End If
  132. %>
  133.     }
  134.  
  135.     .Normal
  136.     {
  137.         COLOR: <% If Len(rsSurvey("question_text_font_color")) > 0 Then Response.Write rsSurvey("question_text_font_color") Else Response.Write SUR_DEFAULT_FONT_COLOR End If %>;
  138.         FONT-FAMILY: <%=rsSurvey("question_text_font_family")%>;
  139.         FONT-SIZE: <% If Len(rsSurvey("question_text_font_size")) > 0 Then Response.Write rsSurvey("question_text_font_size") Else Response.Write "12" End If %>px;
  140.         FONT-WEIGHT: <%=rsSurvey("question_text_font_weight")%>;
  141.     }
  142.  
  143.     .H1HeadingStyle
  144.     {
  145.         COLOR: <% If Len(rsSurvey("survey_name_font_color")) > 0 Then Response.Write rsSurvey("survey_name_font_color") Else Response.Write SUR_DEFAULT_FONT_COLOR End If %>;
  146.         FONT-FAMILY: <%=rsSurvey("survey_name_font_family")%>;
  147.         FONT-WEIGHT: <%=rsSurvey("survey_name_font_weight")%>;
  148.         FONT-SIZE: <% If Len(rsSurvey("survey_name_font_size")) > 0 Then Response.Write rsSurvey("survey_name_font_size") Else Response.Write "18" End If %>px;
  149.     }
  150.  
  151.     .H2HeadingStyle
  152.     {
  153.         COLOR: <% If Len(rsSurvey("page_number_font_color")) > 0 Then Response.Write rsSurvey("page_number_font_color") Else Response.Write SUR_DEFAULT_FONT_COLOR End If %>;
  154.         FONT-FAMILY: <%=rsSurvey("page_number_font_family")%>;
  155.         FONT-WEIGHT: <%=rsSurvey("page_number_font_weight")%>;
  156.         FONT-SIZE: <% If Len(rsSurvey("page_number_font_size")) > 0 Then Response.Write rsSurvey("page_number_font_size") Else Response.Write "16" End If %>px;
  157.     }
  158.  
  159.     .InlineHelpSpanStyle
  160.     {
  161.         COLOR: <% If Len(rsSurvey("question_subtext_font_color")) > 0 Then Response.Write rsSurvey("question_subtext_font_color") Else Response.Write SUR_DEFAULT_FONT_COLOR End If %>;
  162.         FONT-FAMILY: <%=rsSurvey("question_subtext_font_family")%>;
  163.         FONT-SIZE: <% If Len(rsSurvey("question_subtext_font_size")) > 0 Then Response.Write rsSurvey("question_subtext_font_size") Else Response.Write "10" End If %>px;
  164.         FONT-WEIGHT: <%=rsSurvey("question_subtext_font_weight")%>;
  165.     }
  166.  
  167.     .SurveyPageTitle
  168.     {
  169.         COLOR: <% If Len(rsSurvey("page_title_font_color")) > 0 Then Response.Write rsSurvey("page_title_font_color") Else Response.Write SUR_DEFAULT_FONT_COLOR End If %>;
  170.         FONT-FAMILY: <%=rsSurvey("page_title_font_family")%>;
  171.         FONT-SIZE: <% If Len(rsSurvey("page_title_font_size")) > 0 Then Response.Write rsSurvey("page_title_font_size") Else Response.Write "16" End If %>px;
  172.         FONT-WEIGHT: <%=rsSurvey("page_title_font_weight")%>;
  173.     }
  174. </style>
  175. <%
  176.     'Clean up
  177.     rsSurvey.Close
  178.     Set rsSurvey = Nothing
  179.  
  180.     'Based on the reason passed in, display the appropriate error message
  181.     Select Case CLng(Request.QueryString("Reason"))
  182.         Case SUR_ACCESS_DENIED_NOT_LIVE:
  183.             strPageTitle1 = "Unable to Access Survey"
  184.             strPageTitle2 = "Survey Is Not Live"
  185.             strMessage = "Sorry, but the survey '" & strTitle & "' is not currently live, so you cannot take it at this time."
  186.             If IsUserOwnerOrAdmin(lngSurveyID) = True Then
  187.                 strMessage = strMessage & " Click <a href=""ChangeStatus.asp?SurveyID=" & lngSurveyID & "&DisplaySurvey=Yes&Launch=Yes&Status=Open"">here</a> to launch this survey."
  188.             End If
  189.         Case SUR_ACCESS_DENIED_ALREADY_TAKEN:
  190.             strPageTitle1 = "Unable to Access Survey"
  191.             strPageTitle2 = "Survey Response Already Exists"
  192.             strMessage = "You have already taken the survey  '" & strTitle & "' and cannot take it again."
  193.         Case SUR_ACCESS_DENIED_MAX_RESPONSE_COUNT_EXCEEDED:
  194.             strPageTitle1 = "Unable to Take Survey"
  195.             strPageTitle2 = "Maximum Responses for Survey Exceeded"
  196.             strMessage = "You cannot take this survey because the maximum response count for the survey has been reached."
  197.         Case SUR_ACCESS_DENIED_MAX_RESPONSE_COUNT_PER_USER_EXCEEDED:
  198.             strPageTitle1 = "Unable to Take Survey"
  199.             strPageTitle2 = "Maximum Individual Responses for Survey Exceeded"
  200.             strMessage = "You cannot take this survey because you have reached the maximum response count per user."
  201.         Case SUR_ACCESS_DENIED_MAX_DAYS_FOR_UPDATE_REACHED:
  202.             strPageTitle1 = "Unable to Update Survey"
  203.             strPageTitle2 = "Maximum Days to Update Survey Exceeded"
  204.             strMessage = "You cannot update your response to this survey because the number of days during which an update is allowed have been reached."
  205.         Case SUR_ACCESS_DENIED_MANUAL_ENTRY_MODE:
  206.             strPageTitle1 = "Unable to Take Survey"
  207.             strPageTitle2 = "Survey Temporarily Closed"
  208.             strMessage = "This survey cannot currently be accessed because it has been temporarily closed by survey owner."
  209.         Case SUR_ACCESS_DENIED_ALREADY_RESPONDED_TO_MESSAGE:
  210.             strPageTitle1 = "Unable to Take Survey"
  211.             strPageTitle2 = "Survey Response Already Exists"
  212.             strMessage = "You have already responded to this email invitation for the survey '" & strTitle & "'.  You cannot respond to the same email invitation more than once."
  213.         Case SUR_ACCESS_DENIED_IP_ADDRESS_OUT_OF_RANGE:
  214.             strPageTitle1 = "Unable to Take Survey"
  215.             strPageTitle2 = "IP Address Not in Valid Range"
  216.             strMessage = "You cannot take this survey because your IP address is not with the range of IP addresses that have been granted permission to take this survey."
  217.         Case SUR_ACCESS_DENIED_ALREADY_TAKEN_MULTIPLE:
  218.             strPageTitle1 = "Unable to Access Survey"
  219.             strPageTitle2 = "Survey Response Already Exists"
  220.             strMessage = "You have already taken the survey  '" & strTitle & "'.  You may take the survey again by clicking <a href='TakeSurvey.asp?PageNumber=1&SurveyID=" & Request.QueryString("SurveyID") & "'>here</a>."
  221.     End Select
  222. %>
  223.     <html lang="<%=strSurveyLanguage%>">
  224.     <head>
  225.         <title><%=strPageTitle1%></title>
  226.     </head>
  227.  
  228.     <body class="SurveyBodyStyle">
  229. <%
  230.     'If an HTML header was provided, display it
  231.     If Len(strHTMLTop) > 0 Then
  232.         Response.Write strHTMLTop
  233.     End If
  234. %>
  235.     <table border="0" cellspacing="0" cellpadding="5" width="760" align="<% If strSurveyAlignment = SUR_SURVEY_ALIGNMENT_CENTER Then Response.Write "center" End If %>">
  236. <%
  237.         'Optionally display a logo at the top of the survey
  238.         If IsNull(strLogoPath) Or Len(strLogoPath) = 0 Then
  239. %>
  240.             <tr>
  241.                 <td height="44" valign="bottom">
  242.                     <% If strDisplayBorderYN = SUR_BOOLEAN_NEGATIVE Then Response.Write " " End If %><span class="H1HeadingStyle"><a name="skipnav" tabindex="1"><%=strTitle%></a></span>
  243.                 </td>
  244.             </tr>
  245. <%
  246.         Else
  247.             'Whether the image alignment is left or right determines how the image and title are rendered
  248.             If strLogoAlignment = SUR_LOGO_ALIGNMENT_LEFT Then
  249. %>
  250.                 <tr>
  251.                     <td align="left">
  252.                         <img border="0" src="<%=strLogoPath%>" alt="Survey logo">
  253.                     </td>
  254.                     <td align="right">
  255.                         <span class="H1HeadingStyle"><a name="skipnav" tabindex="1"><%=strTitle%></a></span>
  256.                     </td>
  257.                 </tr>
  258. <%
  259.             ElseIf strLogoAlignment = SUR_LOGO_ALIGNMENT_RIGHT Then
  260. %>
  261.                 <tr>
  262.                     <td align="left">
  263.                         <span class="H1HeadingStyle"><a name="skipnav" tabindex="1"><%=strTitle%></a></span>
  264.                     </td>
  265.                     <td align="right">
  266.                         <img border="0" src="<%=strLogoPath%>" alt="Survey logo">
  267.                     </td>
  268.                 </tr>
  269. <%
  270.             Else
  271. %>
  272.                 <tr>
  273.                     <td align="left">
  274.                         <img border="0" src="<%=strLogoPath%>" alt="Survey logo">
  275.                     </td>
  276.                 </tr>
  277.                 <tr>
  278.                     <td align="left">
  279.                         <span class="H1HeadingStyle"><a name="skipnav" tabindex="1"><%=strTitle%></a></span>
  280.                     </td>
  281.                 </tr>
  282. <%
  283.             End If
  284.         End If
  285. %>
  286.     </table>
  287. <%
  288.     'Optionally display the border
  289.     If strDisplayBorderYN = SUR_BOOLEAN_POSITIVE Then
  290. %>
  291.         <table style="background-color:<%=strBorderColor%>" cellspacing="0" cellpadding="<%=lngBorderWidth%>" width="760" align="<% If strSurveyAlignment = SUR_SURVEY_ALIGNMENT_CENTER Then Response.Write "center" End If %>"><tr><td>
  292.         <table cellpadding="0" border="0" style="background-color:<%=strSurveyBackgroundColor%>" width="100%"><tr><td>
  293. <%
  294.     Else
  295. %>
  296.         <table style="background-color:<%=strSurveyBackgroundColor%>" cellspacing="0" cellpadding="0" width="760" align="<% If strSurveyAlignment = SUR_SURVEY_ALIGNMENT_CENTER Then Response.Write "center" End If %>"><tr><td>
  297. <%
  298.     End If
  299. %>
  300.     <table border="0" cellpadding="8" cellspacing="0" width="100%">
  301.         <tr>
  302.             <td>
  303.                 <span class="SurveyPageTitle"><%=strPageTitle2%></span>
  304.             </td>
  305.         </tr>
  306.     </table>
  307.     <br>
  308.     <table border="0" cellpadding="3" cellspacing="3" height="225" width="95%" align="center">
  309.         <tr>
  310.             <td width="1" rowspan="20"></td>
  311.             <td align="left" valign="top" class="Normal">
  312.                 <br>
  313.                 <%=strMessage%>
  314.                 <br>
  315.                 <br>
  316. <%
  317.                 If CLng(Request.QueryString("Reason")) = SUR_ACCESS_DENIED_NOT_ADMIN_SECURITY_LEVEL Or CLng(Request.QueryString("Reason")) = SUR_ACCESS_DENIED_INVALID_SURVEY_ID Then
  318. %>
  319.  
  320.                     If you believe you received this message in error, please contact the application administrator:<br><br>
  321. <%
  322.                 Else
  323. %>
  324.                     If you believe you received this message in error, please contact the survey administrator:<br><br>
  325. <%
  326.                 End If
  327. %>
  328.                 <a href="mailto:<%=strAdminEmailAddress%>"><%=strAdminEmailAddress%></a>
  329.                 <br>
  330.                 <br>
  331.             </td>
  332.             <td width="1" rowspan="20"> </td>
  333.         </tr>
  334.         <tr>
  335.             <td align="right" valign="top" class="Normal">
  336.                 <a href="javascript:window.close();"><img border="0" alt="OK" src="Resources/SurveyButtons/OK.gif" name="btnOK"></a>
  337.             </td>
  338.         </tr>
  339.     </table>
  340. <%
  341.     'If the border was displayed, close out an extra table
  342.     If strDisplayBorderYN = SUR_BOOLEAN_POSITIVE Then
  343. %>
  344.         </td></tr></table>
  345. <%
  346.     End If
  347. %>
  348.     </td></tr></table>
  349. <%
  350.     'If an HTML footer was provided, display it
  351.     If Len(strHTMLBottom) > 0 Then
  352.         Response.Write strHTMLBottom
  353.     Else
  354.         Response.Write "<br>"
  355.     End If
  356. %>
  357.     </body>
  358.     </html>
  359. <%
  360.  
  361.     'Ensure that the web server returns the page
  362.     Response.Flush
  363. %>
  364.