home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
bombers.k12.ar.us
/
bombers.k12.ar.us.tar
/
bombers.k12.ar.us
/
survey_unconfigured
/
ImportUsers.asp
< prev
next >
Wrap
Text File
|
2006-10-25
|
9KB
|
233 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 do a bulk import of users
'
' COPYRIGHT NOTICE
'
' See attached Software License Agreement
'
' (c) Copyright 2002 - 2006 by ClassApps.com. All rights reserved.
'***********************************************************************
%>
<!--#Include File="Include/SurveyUtility_inc.asp"-->
<!--#Include File="Include/Utility_inc.asp"-->
<!--#Include File="Include/Constants_inc.asp"-->
<!--#Include File="Include/Config_inc.asp"-->
<!--#Include File="Include/adovbs_inc.asp"-->
<!--#Include File="Include/CurrentUser_inc.asp"-->
<!--#Include File="Include/SurveySecurity_inc.asp"-->
<%
'If the user is not an admin, do not allow them to import user
If lngUserSecurityLevel <> SUR_SECURITY_LEVEL_ADMIN Then
Response.Redirect "AccessDenied.asp?Reason=" & SUR_ACCESS_DENIED_NOT_ADMIN_SECURITY_LEVEL
End If
%>
<html>
<head>
<title>Import Users</title>
<link rel="stylesheet" href="Resources/StyleSheet/SurveyStyle.css">
</head>
<script language ="JavaScript" src="ClientInclude/Utility.js"></script>
<script language ="JavaScript">
function submitCheck()
{
var strEmailText;
var arrUsers;
var arrUserData;
var i;
var strTemp;
// Check the list of Users. Split on the line feed, creating an array of distinct user records
// email address/first name/last name/custom data records
var strUsers = document.forms['frmImportUsers'].txtUsers.value;
arrUsers = strUsers.split('\n');
// Loop through each of the email address/first name/last name/custom data records
for (i = 0; i < arrUsers.length; i++)
{
// If the line has nothing but an Enter key on it, ignore it
if (arrUsers[i] != '\r')
{
// Split on the comma to create an array containing 1-12 items.
arrUserData = arrUsers[i].split(",");
// Make sure that the required username field has been entered
if (arrUserData.length < 1)
{
alert("The user on line number " + (i + 1) + " does not have a username, which is a required field.");
document.forms['frmImportUsers'].txtUsers.focus();
return false;
}
else
{
if (trim(arrUserData[0]) == '')
{
alert("The user on line number " + (i + 1) + " does not have a username, which is a required field.");
document.forms['frmImportUsers'].txtUsers.focus();
return false;
}
}
// Make sure that the required password field has been entered
if (arrUserData.length < 2)
{
alert("The user on line number " + (i + 1) + " does not have a password, which is a required field.");
document.forms['frmImportUsers'].txtUsers.focus();
return false;
}
else
{
if (trim(arrUserData[1]) == '')
{
alert("The user on line number " + (i + 1) + " does not have a password, which is a required field.");
document.forms['frmImportUsers'].txtUsers.focus();
return false;
}
}
// Make sure that the required first name field has been entered
if (arrUserData.length < 3)
{
alert("The user on line number " + (i + 1) + " does not have a first name, which is a required field.");
document.forms['frmImportUsers'].txtUsers.focus();
return false;
}
else
{
if (trim(arrUserData[2]) == '')
{
alert("The user on line number " + (i + 1) + " does not have a first name, which is a required field.");
document.forms['frmImportUsers'].txtUsers.focus();
return false;
}
}
// Make sure that the required last name field has been entered
if (arrUserData.length < 4)
{
alert("The user on line number " + (i + 1) + " does not have a last name, which is a required field.");
document.forms['frmImportUsers'].txtUsers.focus();
return false;
}
else
{
if (trim(arrUserData[3]) == '')
{
alert("The user on line number " + (i + 1) + " does not have a last name, which is a required field.");
document.forms['frmImportUsers'].txtUsers.focus();
return false;
}
}
// Make sure that the required email address field has been entered
if (arrUserData.length < 5)
{
alert("The user on line number " + (i + 1) + " does not have an email address, which is a required field.");
document.forms['frmImportUsers'].txtUsers.focus();
return false;
}
else
{
if (trim(arrUserData[4]) == '')
{
alert("The user on line number " + (i + 1) + " does not have an email address, which is a required field.");
document.forms['frmImportUsers'].txtUsers.focus();
return false;
}
// Check to make sure the email address is valid.
if (isValidEmailAddress(trim(arrUserData[4])) == false)
{
alert("The user on line number " + (i + 1) + " has the following invalid email address: " + trim(arrUserData[4]));
document.forms['frmImportUsers'].txtUsers.focus();
return false;
}
}
}
}
return true;
}
</script>
<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">Import Users</a></span> <img style="cursor:hand" alt="Help" onClick="javascript:window.open('Help/Help.htm#ImportingUsers', 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="6" cellspacing="0" class="LightGrayBackgroundColor">
<form action="ImportUsersAction.asp" method="post" name="frmImportUsers" onSubmit="return submitCheck();">
<tr>
<td width="1"></td>
<td height="40" valign="center">
<span class="H2HeadingStyle">Import Users</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 rowspan="15" width="1"></td>
<td align="left">
<span class="Normal">
<label for="txtUsers">Import users by pasting user information on each line.</label> The acceptable format
for each line is: Username<span class="Required">*</span>, Password<span class="Required">*</span>,
First Name<span class="Required">*</span>,
Last Name<span class="Required">*</span>, Email Address<span class="Required">*</span>,
Current Position, Company, Location, Custom Data 1, Custom Data 2, Custom Data 3. All fields marked
with a red asterisk (<span class="Required">*</span>) are required. Separate each
field by a comma, do not include commas in the actual data, and make sure that each entry is on its
own line. If you wish to omit any intermediate, non-required fields, you must insert a comma as a
placeholder. The examples below, which demostrate correct syntax, should be removed when actually submitting Users.
</span>
<br>
</td>
<td rowspan="15" width="1"> </td>
</tr>
<tr>
<td valign="top" class="Normal" align="left">
<textarea class="TextareaStyle" rows="12" wrap="off" name="txtUsers" id="txtUsers" style="width:708">fsmith,33245,Fred,Smith,fsmith@classapps.com,CTO,ClassApps.com,USA,111,222,333
jalbert,29,John,Albert,jalbert@classapps.com
lstevens,fido,Lynn,Stevens,lstevens@classapps.com,,,New York City,,,$100K per year</textarea>
<span class="InlineHelpSpanStyle">Field Order: Username<span class="Required">*</span>,
Password<span class="Required">*</span>,
First Name<span class="Required">*</span>,
Last Name<span class="Required">*</span>, Email Address<span class="Required">*</span>,
Current Position, Company, Location, Custom Data 1, Custom Data 2, Custom Data 3</span>
</td>
</tr>
<tr>
<td align="right">
<a href="UserList.asp"><img border="0" alt="Cancel" src="Resources/Buttons/Cancel.gif" name="btnCancel"></a>
<input type="image" border="0" alt="Import" src="Resources/Buttons/Import.gif" name="btnImport">
</td>
</tr>
</form>
</table>
<!--#Include File="Include/FrameworkBottom_inc.asp"-->
</body>
</html>
<%
'Ensure that the web server returns the page
Response.Flush
%>