home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
bombers.k12.ar.us
/
bombers.k12.ar.us.tar
/
bombers.k12.ar.us
/
survey_unconfigured
/
LibraryAction.asp
< prev
next >
Wrap
Text File
|
2006-10-25
|
3KB
|
75 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 Library.asp, and processes
' the form for registering new libraries by writing a database
' record to the SUR_LIBRARY table.
'
' 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/Constants_inc.asp"-->
<!--#Include File="Include/ID_inc.asp"-->
<!--#Include File="Include/CurrentUser_inc.asp"-->
<!--#Include File="Include/SurveySecurity_inc.asp"-->
<%
'If the user does not have "Create" or "Admin" permission, redirect 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 conLibrary
Dim lngLibraryID
'Initialization
Set conLibrary = Server.CreateObject("ADODB.Connection")
conLibrary.Open SURVEY_APP_CONNECTION
'Check to see if this is an INSERT or an UPDATE
If Request.Form("State") = SUR_STATE_INSERT Then
lngLibraryID = ID_GetNextAvailableID("SurveyGenerationLibrary")
strSQL = "INSERT INTO sur_library (library_id, active_yn, library_name, user_id, created_date, public_yn) " & _
"VALUES(" & lngLibraryID & ", " & _
SQLEncode(Request.Form("cboActive")) & ", " & _
SQLEncode(Request.Form("txtLibrary")) & ", " & _
GetUserID() & ", " & _
"GETDATE(), " & _
SQLEncode(Request.Form("cboPublic")) & ")"
Else 'SUR_STATE_EDIT
lngLibraryID = Request.Form("LibraryID")
strSQL = "UPDATE sur_library " & _
"SET library_name = " & SQLEncode(Request.Form("txtLibrary")) & ", " & _
"active_yn = " & SQLEncode(Request.Form("cboActive")) & ", " & _
"public_yn = " & SQLEncode(Request.Form("cboPublic")) & _
" WHERE library_id = " & Request.Form("LibraryID")
End If
'Execute the SQL
conLibrary.Execute ConvertSQL(strSQL), , adCmdText
'Clean up
conLibrary.Close
Set conLibrary = Nothing
'If a library was just created, redirect to the page for modifying the library
If Request.Form("State") = SUR_STATE_INSERT Then
Response.Redirect "ModifyLibrary.asp?LibraryID=" & lngLibraryID
Else
'Redirect back to either the list of libraries or to the modify library page
If Len(Request.Form("Nav")) > 0 Then
Response.Redirect "ModifyLibrary.asp?LibraryID=" & lngLibraryID
Else
Response.Redirect "LibraryList.asp"
End If
End If
%>