<%'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 intUrlId dim intSectionId dim strSectionName dim intOriginalDisplayTypeId dim intDisplayTypeId dim intPostingTypeId dim strTempUrl dim strUrl dim strFolder dim strUrlBody dim strDisplayFormPath dim rsUrl dim bolUsesAltTemplate Dim strUserLanguage Dim intDynamicFormId 'manually set language until functionality is set strUserLanguage = "en" '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")) intUrlId = Trim(Request.Form("txtId")) Select Case True Case (LCase(strMode) = "add" Or LCase(strMode) = "edit") 'BEGIN: ADD/EDIT (DB TRANSACTION) 'get form elements values intUrlId = Request.Form("txtId") intDisplayTypeId = Request.Form("txtDisplayTypeId") 'if intDisplayTypeId variable value is equal to an empty string (form was submitted from url_edit.asp) then... If intDisplayTypeId = "" Then 'set the intDisplayTypeId variable value with the value of the selDisplayType form element intDisplayTypeId = Request.Form("selDisplayType") End If If Trim(Request.Form("txtPostingTypeId")) <> "" Then intPostingTypeId = Request.Form("txtPostingTypeId") Else 'if selPostingType value is equal to an empty string (form was submitted from url_edit.asp) then... If Request.Form("selPostingType") <> "" Then 'set the intPostingTypeId variable value with the value of the selPostingType form element intPostingTypeId = Request.Form("selPostingType") 'if selPostingType value is not equal to an empty string then... Else intPostingTypeId = 0 End If End If If Trim(Request.Form("txtDynamicFormid")) <> "" Then intDynamicFormid = Request.Form("txtDynamicFormid") Else 'if selDynamicForm value is equal to an empty string (form was submitted from url_edit.asp) then... If Request.Form("selDynamicForm") <> "" Then 'set the selDynamicForm variable value with the value of the selDynamicForm form element intDynamicFormid = Request.Form("selDynamicForm") 'if selDynamicForm value is not equal to an empty string then... Else intDynamicFormid = 0 End If End If 'if the selFolders form element is not empty then... If Request.Form("selFolders") <> "" Then 'concatenate the selFolders form element value to the txtURL value into the strUrl variable strUrl = LCase(Replace(Request.Form("selFolders"), Chr(92), "/") & "/" & Replace(Request.Form("txtUrl"), Chr(92), "/")) Else 'set strUrl with the value of txtURL strUrl = LCase(Replace(Request.Form("txtUrl"), Chr(92), "/")) End If bolUsesAltTemplate = ((Request.Form("txtAltTemplate")="1") Or (Request.Form("chkAltTemplate")="1")) strUrlBody = Request.Form("txtUrlBody") intSectionId = Request.Form("txtSectionId") 'if the application is in 'edit' mode If LCase(strMode) = "edit" Then 'modify Url Call ModifyUrl(CInt(intUrlId), CInt(intDisplayTypeId), CInt(intPostingTypeId), CInt(intDynamicFormId), bolUsesAltTemplate, strUrl, strUrlBody) 'associate the new url with the appropriate section Call ModifySection_URL(intUrlId, intSectionId) 'if the application is in 'add' mode Else 'add Url intUrlId = AddUrl(CInt(intDisplayTypeId), CInt(intPostingTypeId), CInt(intDynamicFormId), bolUsesAltTemplate, strUrl, strUrlBody) 'create 2nd level page Call CreatePage(Replace(strUrl, "/", Chr(92)), ReadSecondLevelPage()) 'associate the new url with the appropriate section Call ModifySection_URL(intUrlId, intSectionId) End If Case (LCase(strMode) = "delete") 'BEGIN: DELETE URL 'delete the related file Call DeleteUrlFile(CInt(intUrlId)) 'delete Url and related sections Call DeleteUrl(CInt(intUrlId)) Call DeleteRelatedSection(CInt(intUrlId)) 'END: DELETE URL 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") = "url" 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 url id intUrlId = Trim(Request.QueryString("id")) 'get the section id 'get the display type intDisplayTypeId = Trim(Request.QueryString("display_type")) 'validate display_type querystring: 'if a value was passed via the display_type query string then... If intDisplayTypeId <> "" Then 'if the intDisplayTypeId variable value is not numeric or if it is not equal to 1, 2 or 3 then... If Not IsNumeric(intDisplayTypeId) or Not (intDisplayTypeId >= 1 And intDisplayTypeId <= 13) Then 'redirect user to the url index Response.Redirect("/admin/urls.asp") 'if intDisplayTypeId is a valid value then... Else 'cast intDisplayTypeId into an Integer intDisplayTypeId = CInt(intDisplayTypeId) 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 Url info to be edited 'if application is in edit mode then... If LCase(strMode) = "edit" Then intSectionId = Trim(Request.QueryString("sectionid")) intUrlId = Trim(Request.QueryString("id")) 'if intUrlId is not a valid value then... If Not IsNumeric(intUrlId) or Not (intUrlId <> "") Then 'redirect user to url index Response.Redirect("/admin/urls.asp") 'if intUrlId is a valid value then... Else 'get the related Posting information Set rsUrl = GetSelectedUrl(CInt(intUrlId)) End If 'if intUrlId does not relate to an existing Url id then... If rsUrl.EOF Then 'release the recordset from memory rsUrl.Close set rsUrl = Nothing 'release the connection object from memory before closing the window conn.Close Set conn = Nothing 'redirect user to url index Response.Redirect("/admin/urls.asp") 'if intUrlId does relate to an existing Url id then... Else 'get the url information into the relevant variables intOriginalDisplayTypeId = rsUrl("DISPLAY_TYPE_ID") intPostingTypeId = rsUrl("POSTING_TYPE_ID") intDynamicFormId = rsUrl("DYNAMIC_FORM_ID") strTempUrl = rsUrl("URL_" & strLanguage) 'get file name only strUrl = Mid(strTempUrl, (InStrRev(strTempUrl, "/")+1), Len(strTempUrl)) 'get folder name only strFolder = Replace(Left(strTempUrl, (InStrRev(strTempUrl, "/")-1)), "/", Chr(92)) strUrlBody = rsUrl("URL_BODY_" & strLanguage) bolUsesAltTemplate = rsUrl("URL_USES_ALT_TEMPLATE") If intSectionId = "" or Not IsNumeric(intSectionId) Then intSectionId = GetSectionId (strTempUrl) End If strSectionName = GetSectionName(intSectionId) 'release the recordset from memory rsUrl.Close set rsUrl = Nothing End If 'if application is in continue editing mode then... Else 'set the info of the previewed URL info into the url variables intUrlId = Request.Form("txtId") intPostingTypeId = Request.Form("txtPostingTypeId") intDynamicFormId = Request.Form("txtDynamicFormId") intDisplayTypeId = Request.Form("txtDisplayTypeId") strTempUrl = Request.Form("txtUrl") 'get file name only strUrl = Mid(strTempUrl, (InStrRev(strTempUrl, "/")+1), Len(strTempUrl)) If strMode = "continue" Then 'get folder name only strFolder = Replace(Left(strTempUrl, (InStrRev(strTempUrl, "/")-1)), "/", Chr(92)) Else strFolder = "" End If strUrlBody = Request.Form("txtUrlBody") bolUsesAltTemplate = (Request.Form("txtAltTemplate")="1") intSectionId = Request.Form("txtSectionId") strSectionName = GetSectionName(intSectionId) 'if the intUrlId variable value is different than an empty string (current url is not new) If intUrlId <> "" Then 'get the related Url information Set rsUrl = GetSelectedUrl(CInt(intUrlId)) intOriginalDisplayTypeId = rsUrl("DISPLAY_TYPE_ID") 'release the recordset from memory rsUrl.Close set rsUrl = Nothing End If End If 'end: get current url info to be edited 'if application is in add mode then... Else 'set default values for the url info variables intUrlId = "" strUrl = "" strUrlBody = "" End If 'if the intDisplayTypeId variable contains an empty string then... If intDisplayTypeId = "" Then 'if intOriginalDisplayTypeId variable contains an empty string then... If intOriginalDisplayTypeId = "" Then 'set the intOriginalDisplayTypeId to 4 (web content form) intOriginalDisplayTypeId = 4 End If intDisplayTypeId = intOriginalDisplayTypeId Else 'if intOriginalDisplayTypeId variable contains an empty string then... If intOriginalDisplayTypeId = "" Then 'set the intOriginalDisplayTypeId to the value of the intDisplayTypeId variable intOriginalDisplayTypeId = intDisplayTypeId End If End If 'get the path to dynamic content form elements according to the display type id strDisplayFormPath = GetDisplayFormPath(CInt(intDisplayTypeId)) %> <%If intUrlId = "" Then%> <%Else%> <%End If%>
This page displays:

***Select the Type of Display for this Page***
<%If intUrlId = "" Then%> Select the menu item for this page: <%Else%> Menu item: <%End If%>
Create the page in the following folder:
The file name for this page will be:

***All files must contain the ".asp" extension***
Folder and File name:
<%If strFolder <> "" Then%> " disabled> <%Else%> " disabled> <%End If%>
checked="checked"<%End If%>>This page displays a template without the left navigation and the right links.
<% 'if the strDisplayFormPath variable value is not equal to an empty string then... If strDisplayFormPath <> "" Then 'assign the session variables with the relevant variable values Session("UrlBody") = strUrlBody Session("DisplayTypeId") = intOriginalDisplayTypeId Session("NewDisplayTypeId") = intDisplayTypeId Session("PostingTypeId") = intPostingTypeId Session("DynamicFormId") = intDynamicFormId 'get the display form elements Server.Execute(strDisplayFormPath) 'set the session variables to empty strings Session("PostingBody") = "" Session("OriginalContentTypeId") = "" Session("NewContentTypeId") = "" Session("PostingTypeId") = "" Session("DynamicFormId") = "" End If %>
<% 'if the display type for the page is 'Dynamic Text and Images' then... If intDisplayTypeId = 4 Then %>    <% 'if the display type for the page is not 'Dynamic Text and Images' then... Else %> Update<%Else%>Add<%End If%>" onclick="javascript:this.form.action='/admin/includes/url_edit_inc.asp';if(validateForm(this.form)){this.form.submit();}">   <% End If %> <% 'if the application mode is edit or continue (editing) then... If LCase(strMode) = "edit" Or LCase(strMode) = "continue" Then %>    <% End If %>       "> <% 'if the application mode is edit or continue (editing) then... If LCase(strMode) = "edit" Or LCase(strMode) = "continue" Then %> <% End If %>
<% 'END: INPUT (ADD/EDIT) End If %> <% 'close data connection CloseConn() %>