home *** CD-ROM | disk | FTP | other *** search
/ bombers.k12.ar.us / bombers.k12.ar.us.tar / bombers.k12.ar.us / survey / EmailListAction.asp < prev    next >
Text File  |  2006-11-29  |  2KB  |  59 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 EmailList.asp, and processes
  7. '                     the form for registering new email lists by writing a database
  8. '                      record to the SUR_EMAIL_LIST 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 conEmailList
  32.             
  33.     'Initialization
  34.     Set conEmailList = Server.CreateObject("ADODB.Connection")
  35.     conEmailList.Open SURVEY_APP_CONNECTION
  36.     
  37.     'If the email list was set to be the default, set all the other email lists not to be the defaults
  38.     If Request.Form("cboDefault") = SUR_BOOLEAN_POSITIVE Then
  39.         strSQL = "UPDATE sur_email_list " & _
  40.                  "SET default_yn = 'N' " & _
  41.                  "WHERE user_id = (SELECT user_id FROM sur_user WHERE username = " & SQLEncode(GetUsername()) & ")"
  42.         conEmailList.Execute ConvertSQL(strSQL), , adCmdText
  43.     End If
  44.     
  45.     'Update the email list
  46.     strSQL = "UPDATE sur_email_list " & _
  47.                 "SET list_name = " & SQLEncode(Request.Form("txtListName")) & ", " & _
  48.                 "list_description = " & SQLEncode(Request.Form("txtDescription")) & ", " & _
  49.                 "default_yn = " & SQLEncode(Request.Form("cboDefault")) & _
  50.                 " WHERE email_list_id = " & Request.Form("EmailListID")
  51.     conEmailList.Execute ConvertSQL(strSQL), , adCmdText
  52.  
  53.     'Clean up
  54.     conEmailList.Close
  55.     Set conEmailList = Nothing
  56.  
  57.     'Redirect back to the list of email lists
  58.     Response.Redirect "EmailListList.asp"
  59. %>