home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
bombers.k12.ar.us
/
bombers.k12.ar.us.tar
/
bombers.k12.ar.us
/
survey_unconfigured
/
CreateSurvey.asp
< prev
next >
Wrap
Text File
|
2006-10-25
|
8KB
|
217 lines
<!--#Include File="Include/Top_inc.asp"-->
<%
'***********************************************************************
' Application: SelectSurveyASP Advanced v8.1.11
' Author: Aaron Baril for ClassApps.com
' Page Description: This page allows the user to create a new survey either
' from scratch or from an existing survey.
'
' 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/SurveyUtility_inc.asp"-->
<!--#Include File="Include/adovbs_inc.asp"-->
<!--#Include File="Include/CurrentUser_inc.asp"-->
<!--#Include File="Include/Constants_inc.asp"-->
<!--#Include File="Include/SurveySecurity_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 rsSurveys
Dim strSQL
'Initialization
Set rsSurveys = Server.CreateObject("ADODB.Recordset")
%>
<html>
<head>
<title>Survey Administration -- Create Survey</title>
<link rel="stylesheet" href="Resources/StyleSheet/SurveyStyle.css">
</head>
<script language ="JavaScript" src="ClientInclude/Utility.js"></script>
<script language="JavaScript">
function submitCheck()
{
// Make sure that a title has been entered
if (trim(document.forms['frmSurvey'].txtTitle.value) == "")
{
alert("Please enter a value for the Title.");
document.forms['frmSurvey'].txtTitle.focus();
return false;
}
// Only validate the form if the user is creating a survey from an existing survey.
if (document.forms['frmSurvey'].optType[1].checked == true)
{
// Make sure that the user selected a survey
if (document.forms['frmSurvey'].cboSurvey.value == '<%=SUR_COMBO_PLEASE_SELECT%>')
{
alert("Please select an existing survey.");
document.forms['frmSurvey'].cboSurvey.focus();
return false;
}
// If the survey has a 'No surveys available' choice, there are no existing surveys, which means
// the user must create a new survey from scratch.
if (document.forms['frmSurvey'].cboSurvey.value == '<%=SUR_COMBO_NO_AVAILABLE_SURVEYS%>')
{
alert("There are no existing surveys. Please create a new survey from scratch.");
document.forms['frmSurvey'].optType[0].checked = true;
document.forms['frmSurvey'].optType[0].focus();
return false;
}
}
return true;
}
</script>
<body class="MainBodyStyle" onLoad="javascript:document.forms['frmSurvey'].txtTitle.focus();">
<!--#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">Create Survey</a></span> <img style="cursor:hand" alt="Help" onClick="javascript:window.open('Help/Help.htm#CreateSurveys', null, 'menubar=no,toolbar=no,titlebar=no,status=no,left=10,top=10,scrollbars=yes,resizable=yes,height=550,width=770');" border="0" src="Resources/Images/Help.gif">
</td>
</tr>
</table>
<!--#Include File="Include/FrameworkTop2_inc.asp"-->
<table width="740" border="0" cellpadding="0" cellspacing="6" class="LightGrayBackgroundColor">
<form name="frmSurvey" method="post" action="CreateSurveyAction.asp" onSubmit="return submitCheck();">
<tr>
<td width="1" rowspan="2"></td>
<td valign="center" height="40">
<span class="H2HeadingStyle">New Survey Options</span>
</td>
<td width="1" rowspan="2"> </td>
</tr>
<tr>
<td valign="top" class="Normal" height="18">
Create a new survey either by starting from scratch or by copying an existing survey.
</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 colspan="4" height="8"></td>
</tr>
<tr>
<td width="1" rowspan="10"></td>
<td valign="top" width="30">
<span class="NormalBold"><label for="txtTitle">Title:</label></span><span class="Required">*</span>
</td>
<td align="left" valign="top" colspan="3">
<input type="text" name="txtTitle" id="txtTitle" maxlength="50" style="width:410">
</td>
<td width="1" rowspan="10"> </td>
</tr>
<tr>
<td valign="top">
<label for="optType"> </label>
</td>
<td valign="top">
<input checked type="radio" name="optType" id="optType" value="<%=SUR_CREATE_SURVEY_FROM_SCRATCH%>">
</td>
<td valign="top" colspan="2">
<span class="NormalBold">From Scratch </span><span class="Normal">-- Create a new survey from scratch</span>
</td>
</tr>
<tr>
<td valign="top">
</td>
<td valign="top">
<input type="radio" name="optType" id="optType" value="<%=SUR_CREATE_SURVEY_FROM_EXISTING%>">
</td>
<td valign="top" colspan="2">
<span class="NormalBold">From Existing </span><span class="Normal">-- Copy questions, options, and page conditions from an existing survey</span>
</td>
</tr>
<tr>
<td valign="top">
</td>
<td valign="top">
</td>
<td valign="top" width="40">
<span class="NormalBold"><label for="cboSurvey">Survey:</label></span>
</td>
<td align="left" valign="top">
<select name="cboSurvey" id="cboSurvey" style="width:480">
<%
'Create the SQL for creating the list of surveys. If the user has "Create" permission, limit the list
'to surveys the s/he owns.
strSQL = "SELECT survey_id, title, created_date " & _
"FROM sur_survey "
'If the user has "Create" permission (as opposed to "Admin" permission), limit the list to only surveys that the
'user is an owner of.
If CLng(lngUserSecurityLevel) = SUR_SECURITY_LEVEL_CREATE Then
strSQL = strSQL & " WHERE owners LIKE '%" & GetUsername() & "%'"
End If
strSQL = strSQL & " ORDER BY created_date DESC"
rsSurveys.Open ConvertSQL(strSQL), SURVEY_APP_CONNECTION, adOpenForwardOnly, adLockReadOnly, adCmdText
'If there are not surveys, display an option indicating that there are no available surveys. Otherwise,
'display the list of surveys
If rsSurveys.EOF Then
%>
<option value="<%=SUR_COMBO_NO_AVAILABLE_SURVEYS%>"><%=SUR_COMBO_NO_AVAILABLE_SURVEYS%></option>
<%
Else
%>
<option value="<%=SUR_COMBO_PLEASE_SELECT%>"><%=SUR_COMBO_PLEASE_SELECT%></option>
<%
rsSurveys.MoveFirst
Do While Not rsSurveys.EOF
%>
<option value="<%=rsSurveys("survey_id")%>"><%=rsSurveys("title")%> (<%=CustomDateFormatDisplay(DateValue(rsSurveys("created_date")))%>)</option>
<%
rsSurveys.MoveNext
Loop
End If
'Clean up
rsSurveys.Close
Set rsSurveys = Nothing
%>
</select>
</td>
</tr>
<tr>
<td valign="top" align="right" colspan="4">
<br>
<a href="SurveyList.asp"><img style="cursor:hand" border="0" alt="Cancel" src="Resources/Buttons/Cancel.gif" name="btnCancel"></a>
<input type="image" border="0" alt="Save" src="Resources/Buttons/Save.gif" name="btnSave">
<br>
</td>
</tr>
</form>
</table>
<!--#Include File="Include/FrameworkBottom_inc.asp"-->
</body>
</html>
<%
'Ensure that the web server returns the page
Response.Flush
%>