%'Include Data Connection%> <%'Include ADO constants include file for VBScript%> <% 'open data connection OpenConn() %> <%'Include Utility Scripts%> <%'Include Modal Window JavaScript%> <% 'dim strMode - The strMode variable is defined in the header_inc.asp file. 'dim strLanguage - The strLanguage variable is defined in the common_utils.asp file. dim intPostingId dim intPostingTypeId dim intOriginalContentTypeId dim intContentTypeId dim strPostingTitle dim strPostingBody dim datPostingDate dim intOpenInNewWindow dim strDynamicContentFormPath dim rsPosting 'if form elements have been submitted (to be added/edited into the DB) and the user does not wish to continue editing then... If Request.Form <> "" And Trim(Request.Form("txtMode")) <> "continue" Then 'get form elements values strMode = Trim(Request.Form("txtMode")) intPostingId = Trim(Request.Form("txtId")) Select Case True Case (LCase(strMode) = "add" Or LCase(strMode) = "edit") 'BEGIN: ADD/EDIT (DB TRANSACTION) 'get form elements values intPostingTypeId = Request.Form("txtPostingTypeId") intContentTypeId = Request.Form("txtContentTypeId") intOpenInNewWindow = Request.Form("txtOpenInNewWindow") datPostingDate = Request.Form("txtPostingDate") strPostingTitle = Request.Form("txtPostingTitle") strPostingBody = Request.Form("txtPostingBody") 'if the application is in 'edit' mode If LCase(strMode) = "edit" Then 'modify Posting Call ModifyPosting(CInt(intPostingId), CInt(intContentTypeId), CInt(intOpenInNewWindow), datPostingDate, strPostingTitle, strPostingBody) 'if the application is in 'add' mode Else 'add Posting intPostingId = AddPosting(CInt(intPostingTypeId), CInt(intContentTypeId), CInt(intOpenInNewWindow), datPostingDate, strPostingTitle, strPostingBody) End If Case (LCase(strMode) = "delete") 'delete Posting Call DeletePosting(CInt(intPostingId)) End Select 'give the user feedback with regards to the success of the add/edit database transaction Session("FeedbackMode") = LCase(strMode) Session("FeedbackError") = err.number Session("FeedbackModule") = "posting" Response.Write "" 'begin: comment out default prompt to send out postings---------- 'if the application is in edit or in add mode then... If LCase(strMode) = "edit" Or LCase(strMode) = "add" Then 'prompt to notify subscribers of new/updated posting Response.Write "" End If 'end: comment out default prompt to send out postings---------- Response.Write "" 'Server.Execute("/admin/feedback.asp") 'END: ADD/EDIT (DB TRANSACTION) Else 'BEGIN: INPUT (ADD/EDIT) 'set english as the default language strLanguage = "ENG" 'if a mode value was not submitted via a form element then... If Trim(Request.Form("txtMode")) = "" Then 'get the mode value from via a querystring strMode = Trim(Request.QueryString("mode")) 'if a mode value was submitted via a form element then... Else 'get the mode value from via a form element strMode = Trim(Request.Form("txtMode")) End If 'get the dynamic content type intContentTypeId = Trim(Request.QueryString("content_type")) 'get the posting type id querystring value intPostingTypeId = Trim(Request.QueryString("type_id")) 'validate 'validate content_type querystring: 'if a value was passed via the content_type query string then... If intContentTypeId <> "" Then 'if the intContentTypeId variable value is not numeric or if it is not equal to 1, 2 or 3 then... If Not IsNumeric(intContentTypeId) or Not (intContentTypeId = 1 Or intContentTypeId = 2 Or intContentTypeId = 3) Then 'release command object from memory cmd.Close Set cmd = Nothing 'redirect user to the posting type index Response.Redirect("/admin/content.asp") 'if intContentTypeId is a valid value then... Else 'cast intContentTypeId into an Integer intContentTypeId = CInt(intContentTypeId) End If End If 'if application is in edit mode or continue editing mode then... If LCase(strMode) = "edit" Or LCase(strMode) = "continue" Then 'begin: get current Posting info to be edited 'if application is in edit mode then... If LCase(strMode) = "edit" Then intPostingId = Trim(Request.QueryString("id")) 'if intPostingId is not a valid value then... If Not IsNumeric(intPostingId) or Not (intPostingId <> "") Then 'release command object from memory cmd.Close Set cmd = Nothing 'redirect user to posting type index Response.Redirect("/admin/posting.asp") 'if intPostingId is a valid value then... Else 'get the related Posting information Set rsPosting = GetSelectedPosting(CInt(intPostingId)) End If 'if intPostingId does not relate to an existing Posting id then... If rsPosting.EOF Then 'release the recordset from memory rsPosting.Close set rsPosting = Nothing 'release the connection object from memory before closing the window conn.Close Set conn = Nothing 'redirect user to posting type index Response.Redirect("/admin/posting.asp") 'if intPostingId does relate to an existing Posting id then... Else 'get the posting information into the relevant variables intPostingTypeId = rsPosting("POSTING_TYPE_ID") intOriginalContentTypeId = rsPosting("DYNAMIC_CONTENT_TYPE_ID") strPostingTitle = rsPosting("POSTING_TITLE_" & strLanguage) datPostingDate = rsPosting("POSTING_DATE") intOpenInNewWindow = rsPosting("POSTING_OPENS_IN_NEW_WINDOW") strPostingBody = rsPosting("POSTING_BODY_" & strLanguage) 'release the recordset from memory rsPosting.Close set rsPosting = Nothing End If 'if application is in continue editing mode then... Else 'set the info of the previewed posting info into the posting variables intPostingId = Request.Form("txtId") intPostingTypeId = Request.Form("txtPostingTypeId") intContentTypeId = Request.Form("txtContentTypeId") intOpenInNewWindow = Request.Form("txtOpenInNewWindow") datPostingDate = Request.Form("txtPostingDate") strPostingTitle = Request.Form("txtPostingTitle") strPostingBody = Request.Form("txtPostingBody") 'if the intPostingId variable value is different than an empty string (current posting is not new) If intPostingId <> "" Then 'get the related Posting information Set rsPosting = GetSelectedPosting(CInt(intPostingId)) intOriginalContentTypeId = rsPosting("DYNAMIC_CONTENT_TYPE_ID") 'release the recordset from memory rsPosting.Close set rsPosting = Nothing End If End If 'end: get current posting info to be edited 'if application is in add mode then... Else 'get the posting type id querystring value intPostingTypeId = Trim(Request.QueryString("type_id")) 'validate 'set default values for the posting info variables intPostingId = "" strPostingTitle = "" strPostingBody = "" datPostingDate = Date() intOpenInNewWindow = 0 End If 'if the intContentTypeId variable contains an empty string then... If intContentTypeId = "" Then 'if intOriginalContentTypeId variable contains an empty string then... If intOriginalContentTypeId = "" Then 'set the intOriginalContentTypeId to 2 (web content form) intOriginalContentTypeId = 2 End If intContentTypeId = intOriginalContentTypeId Else 'if intOriginalContentTypeId variable contains an empty string then... If intOriginalContentTypeId = "" Then 'set the intOriginalContentTypeId to the value of the intContentTypeId variable intOriginalContentTypeId = intContentTypeId End If End If 'get the path to the relevant dynamic content form elements according to the dynamic content type id Select Case intContentTypeId 'if the dynamic content type id is equal to 1 then... Case 1 'set the strDynamicContentFormPath variable to the path to the URL input include file strDynamicContentFormPath = "includes/dynamic_content_url_inc.asp" 'if the dynamic content type id is equal to 2 then... Case 2 'set the strDynamicContentFormPath variable to the path to the web content editor include file strDynamicContentFormPath = "includes/dynamic_content_text_inc.asp" 'if the dynamic content type id is equal to 3 then... Case 3 'set the strDynamicContentFormPath variable to the path to the uploaded file input form include file strDynamicContentFormPath = "includes/dynamic_content_upload_inc.asp" End Select %>