home *** CD-ROM | disk | FTP | other *** search
/ bombers.k12.ar.us / bombers.k12.ar.us.tar / bombers.k12.ar.us / survey / LibraryAction.asp < prev    next >
Text File  |  2006-11-29  |  3KB  |  75 lines

  1. <!--#Include File="Include/Top_inc.asp"-->
  2. <%
  3. '***********************************************************************
  4. '   Application: SelectSurveyASP Advanced v8.1.11
  5. '   Author: Aaron Baril for ClassApps.com
  6. '   Page Description: This page works with Library.asp, and processes
  7. '                     the form for registering new libraries by writing a database
  8. '                      record to the SUR_LIBRARY table.
  9. '
  10. '   COPYRIGHT NOTICE                                
  11. '
  12. '   See attached Software License Agreement
  13. '
  14. '   (c) Copyright 2002 - 2006 by ClassApps.com.  All rights reserved.
  15. '***********************************************************************
  16. %>
  17. <!--#Include File="Include/Config_inc.asp"-->
  18. <!--#Include File="Include/Utility_inc.asp"-->
  19. <!--#Include File="Include/adovbs_inc.asp"-->
  20. <!--#Include File="Include/Constants_inc.asp"-->
  21. <!--#Include File="Include/ID_inc.asp"-->
  22. <!--#Include File="Include/CurrentUser_inc.asp"-->
  23. <!--#Include File="Include/SurveySecurity_inc.asp"-->
  24. <%
  25.     'If the user does not have "Create" or "Admin" permission, redirect to the access denied page.
  26.     If lngUserSecurityLevel <> SUR_SECURITY_LEVEL_CREATE And lngUserSecurityLevel <> SUR_SECURITY_LEVEL_ADMIN Then
  27.         Response.Redirect "AccessDenied.asp?Reason=" & SUR_ACCESS_DENIED_NOT_ADMIN_SECURITY_LEVEL
  28.     End If
  29.  
  30.     Dim strSQL
  31.     Dim conLibrary
  32.     Dim lngLibraryID
  33.             
  34.     'Initialization
  35.     Set conLibrary = Server.CreateObject("ADODB.Connection")
  36.     conLibrary.Open SURVEY_APP_CONNECTION
  37.     
  38.     'Check to see if this is an INSERT or an UPDATE
  39.     If Request.Form("State") = SUR_STATE_INSERT Then
  40.         lngLibraryID = ID_GetNextAvailableID("SurveyGenerationLibrary")
  41.         strSQL = "INSERT INTO sur_library (library_id, active_yn, library_name, user_id, created_date, public_yn) " & _    
  42.                  "VALUES(" & lngLibraryID & ", " & _
  43.                  SQLEncode(Request.Form("cboActive")) & ", " & _
  44.                  SQLEncode(Request.Form("txtLibrary")) & ", " & _
  45.                  GetUserID() & ", " & _
  46.                  "GETDATE(), " & _
  47.                  SQLEncode(Request.Form("cboPublic")) & ")"
  48.     Else 'SUR_STATE_EDIT
  49.         lngLibraryID = Request.Form("LibraryID")
  50.         strSQL = "UPDATE sur_library " & _
  51.                  "SET library_name = " & SQLEncode(Request.Form("txtLibrary")) & ", " & _
  52.                  "active_yn = " & SQLEncode(Request.Form("cboActive")) & ", " & _
  53.                  "public_yn = " & SQLEncode(Request.Form("cboPublic")) & _
  54.                  " WHERE library_id = " & Request.Form("LibraryID")
  55.     End If
  56.     
  57.     'Execute the SQL
  58.     conLibrary.Execute ConvertSQL(strSQL), , adCmdText
  59.         
  60.     'Clean up
  61.     conLibrary.Close
  62.     Set conLibrary = Nothing
  63.  
  64.     'If a library was just created, redirect to the page for modifying the library
  65.     If Request.Form("State") = SUR_STATE_INSERT Then
  66.         Response.Redirect "ModifyLibrary.asp?LibraryID=" & lngLibraryID
  67.     Else
  68.         'Redirect back to either the list of libraries or to the modify library page
  69.         If Len(Request.Form("Nav")) > 0 Then
  70.             Response.Redirect "ModifyLibrary.asp?LibraryID=" & lngLibraryID
  71.         Else
  72.             Response.Redirect "LibraryList.asp"
  73.         End If
  74.     End If
  75. %>