<%'Include Data Connection%> <%'Include ADO constants include file for VBScript%> <% 'open data connection OpenConn() %> <%'Include Utility Scripts%> <% 'dim strMode - The strMode variable is defined in the header_inc.asp file. 'dim strDelimiter - The strDelimiter variable is defined in the common_utils.asp file. dim strSectionName dim intSectionId dim intUrlId dim intParentId dim intPositionId dim strSectionOrderList dim strReferer dim bolSectionIsEditable dim strAction 'the 2 possible values for strAction (in this context) are 'manage' and 'select'. 'select' would mean that the interface has been called from a Page (URL) admin interface. ' 'manage' would mean that this interface was called from a Menu Item (Section) Admin interface. 'get the action for this inteface strAction = Right(Request.Querystring("referer"), (Len(Request.Querystring("referer"))- InStr(Request.Querystring("referer"), "="))) If Request.Form <> "" Then 'begin add/edit (db transactions) dim strDel dim arDisplayTypes dim strUserFeedback 'get form elements values strMode = Request.Form("txtMode") strSectionName = Request.Form("txtName") intSectionId = Request.Form("txtId") intParentId = Request.Form("txtParentId") intUrlId = Request.Form("selURLs") strReferer = Request.Form("txtReferer") Select Case LCase(strMode) Case "edit" 'if the application is in 'edit' mode 'modify section Call ModifySection(intSectionId, strSectionName, intUrlId) 'if the sort order has been modified then... If Trim(Request.Form("txtSectionsList")) <> "" Then 'modify section sort order Call ModifySectionSortOrder(Trim(Request.Form("txtSectionsList")), strDelimiter) End If Case "add" 'if the application is in 'add' mode 'get the new section's sort order (last) intPositionId = GetSubsectionCount(intParentId) + 1 'add section Call AddSection(strSectionName, intPositionId, intUrlId, intParentId) End Select 'give the user feedback with regards to the success of the delete database transaction Session("FeedbackMode") = LCase(strMode) Session("FeedbackError") = err.number Session("FeedbackModule") = "section" Session("Referer") = strReferer Server.Execute("/admin/feedback.asp") 'end add/edit (db transactions) Else 'begin input (add/edit) strMode = Trim(Request.QueryString("mode")) strReferer = Trim(Request.QueryString("referer")) 'if application is in edit mode then... If LCase(strMode) = "edit" Then 'begin get current Section info to be edited dim rsSection dim intSectionCount intSectionId = Trim(Request.QueryString("id")) intSectionCount = GetSubsectionCount(GetParent(intSectionId)) 'if intSectionId is not a valid value then... If Not IsNumeric(intSectionId) or Not (intSectionId <> "") Then 'close the window Response.write("") 'if intSectionId is a valid value then... Else 'cast the intSectionId variable into an integer data type intSectionId = CInt(intSectionId) 'get the related Posting Type information Set rsSection = GetSelectedSection(intSectionId) End If 'if intSectionId does not relate to an existing Section id then... If rsSection.EOF Then 'release the recordset from memory rsSection.Close set rsSection = Nothing 'release the connection object from memory before closing the window conn.Close Set conn = Nothing 'close the window Response.write("") 'if intSectionId does relate to an existing Section id then... Else 'get the section values into the relevant variables strSectionName = rsSection("SECTION_NAME_ENG") intUrlId = rsSection("URL_ID") intParentId = rsSection("PARENT_ID") 'if the SECTION_ORDER for the Menu Item is not null then... If Not IsNull(rsSection("SECTION_ORDER")) Then 'set the intPositionId variable with the SECTION_ORDER value intPositionId = rsSection("SECTION_ORDER") Else 'set the intPositionId variable to zero (0) 'intPositionId = 0 End If bolSectionIsEditable = rsSection("SECTION_IS_EDITABLE") 'release the recordset from memory rsSection.Close set rsSection = Nothing End If 'end get current posting type info to be edited 'if application is in add mode then... Else bolSectionIsEditable = True strSectionName = "" End If %>
Enter the Menu Item's Name:
> <%If Not bolSectionIsEditable Then%>

*This Menu Item's name cannot be edited.

<%End If%>
<%If strMode = "add" Then%> The New Menu Item is a sub-item to the following Menu Item:
<% On Error Resume Next dim iTotal, sLeftIndent dim bLoaded Dim bLoadSubItems Dim objDocument Dim sOpenFolders iTotal = 0 sLeftIndent = "" 'Check if we clicked an "on demand" folder if (Request.Form <> "") then bLoadSubItems = true else bLoadSubItems = false end if bLoaded = LoadSectionsThatCanHaveChildren(objDocument, bLoadSubItems) if (bLoaded = true) then 'Start building the menu table structure%>
<% 'set the IDs of the folders that should be open (Home=7): 'if the current inteface has been called from the "Menu Item" (Sections) section then... If LCase(strAction) = "manage" Then 'if a grand-parent exists for section being edited then... If GetParent(intParentId) <> 0 Then sOpenFolders = ",0," & GetParent(intParentId) & "," & intParentId & "," Else sOpenFolders = ",0," & "," & intParentId & "," End If End If 'This subroutine generates the HTML for the menu based on 'data loaded into the XML object DisplayNode objDocument.childNodes, iTotal, sLeftIndent, sOpenFolders%>

<% 'Release memory reserved by XML object Set objDocument = Nothing if err <> 0 then 'We got an error, so display the message Response.Write err.description end if End If End If 'if the current menu item has a sort order then If intPositionId <> 0 Then 'display the link to enable the user to sort the menu items %>
, document.forms.frmMenu.txtName);">Select the order in which the Menu item should appear...
Current position is: of
<% End If 'if this interface has not been called from the Pages (URL) interface then... If LCase(strAction) = "manage" Then %>

Default URL:

<%End If%>
Update<%Else%>Add<%End If%>">  
<% End If %> <% 'close data connection CloseConn() %>