<%
'------------------------------------------------------------------------------
' Alle Rechte vorbehalten.
' Entwickler: Marcus Taegtmeyer
' Firma: Fa. RedDot Solutions AG, Oldenburg, Germany
' Projekt: Navigations
' Modulname: Menu ASP
' Subsystem: RedDot CMS Professional 5.5 or higher
' Copyright (c) RedDot Solutions AG 2004
'------------------------------------------------------------------------------
' Revision: $Revision:$
' $State: $
' $Name: $
'------------------------------------------------------------------------------
' Description: Creates dynamic Navigation; use Edit-Variant to expand,
' Run-Variant to use.
'------------------------------------------------------------------------------
' Disclaimer Dieses Skript ist kein offizieller Bestandteil der RedDot
' Content Management Software. Die RedDot Solutions AG übernimmt
' für dieses Skript keinerlei Gewährleistung und haftet nicht für
' eventuelle durch den Einsatz des Skriptes entstehenden Schäden
' und deren Folgeschäden.
' Das Skript wird nicht von der RedDot Solutions AG supportet.
' Alle Hinweise zu der Funktion des Skripts sind unverbindlich
' und werden nicht von der RedDot Solutions AG garantiert. Alle
' Rechte an diesem Script stehen der RedDot Solutions AG zu.
' Dieses Skript wird kostenlos zur Verfügung gestellt und darf
' nicht weiterverkauft werden
'------------------------------------------------------------------------------
' maximum depth
dim maxdepth
maxdepth = 5
' xml String, that will contain the menu structure
dim xml
' xmlDoc will contain the DOM-Object of xml
dim xmlDoc
' rootNode is the rootNode of the xml
dim rootNode
' success is the flag, that indicates, if the matching ID has been found
dim success
' global path contains a string with each node's content that has been passed to reach the matchig node.
dim global_path
' link will be each item's Properties (linkname|url_of_following_page|page_id_of_following_page)
dim link
' link_string is an array with all links in it
dim link_string
' link_details is an array of each link
dim link_details
' detail is each value of each link
' n and m are counter variables
dim detail, n, m
' my_path(n,0): linkname, my_path(n,1): url_of_following_page, my_path(n,2): ID; limits number of levels to 10
dim my_path(9,2)
dim activeLink
' 1. read xml-structure to xml
xml = "" & vbcrlf & ""
' 2. Load structure into DOM-Object
Set xmlDoc = Server.CreateObject("MSXML.DOMDocument")
XMLDoc.async = False
success = xmlDoc.loadxml(xml)
' 2.a Check for errors!
If Not success Then
Response.Write "Could not load the XML document!"
Else
' 3. Start! Set Root Node to Root of XML
Set rootNode = XMLDoc.documentElement
' 4. Find own ID in xml-tree
call SearchNode(rootNode,1, "")
' 4.a ID found! Global variable global_path now contains path to active link
' 5. Extract path(n,m) from global_path
n=0
m=0
link_string = split(global_path,"||")
for Each link in link_string
link_details = split(link, "|")
For Each detail in link_details
my_path(n,m)=detail
m=m+1
next
m=0
n=n+1
next
' 5.a path to active link now in path(n,m)
' 6. Output the breadcrump-path now!
' call OutputPath(rootNode,1)
End If
' Function to find the own Page ID in the xml-tree; writes data into global_path
Function SearchNode(ByVal node, ByVal nDepth, ByVal path)
dim item
' Check, if this is the main menu-item. If not, go on.
if node.nodeName <> "menu" Then
' Save this items values into path.
path = path & node.attributes(0).value & "|" & node.attributes(1).value & "|" & node.attributes(2).value & "||"
' If this node is the one with my id write global_path
if node.attributes(1).value = my_id then
global_path = path 'found matching link
end if
End if
' If one of this node's children is the one with my id write global_path
For Each item in node.childNodes
if item.nodeName="item" then
if item.attributes(1).value = my_id and maxdepth > ndepth then 'found active link
global_path = path & item.attributes(0).value & "|" & item.attributes(1).value & "|" & item.attributes(2).value & "||"
exit function
end if
end if
' Look into substructures, call this function again and give it the so far collected path-informations
If item.hasChildNodes() Then
call SearchNode(item,nDepth+1, path) 'recursive call of OutputNode for deeper structure
End If
Next
End Function
' Function to write the breadcrumbs
Function OutputPath(ByVal node, ByVal nDepth) 'Write Menu-Entries into page
dim item
dim counter
' If this node is the one, with my_id as page_id write it
For Each item in node.childNodes
if item.nodeName="item" then
if item.attributes(1).value = my_id then 'found active link
setcurrentDepth(nDepth)
response.write " " & unescape(item.attributes(0).value) & ""
' Else if this node is part of my path write it
elseif item.hasChildNodes() and item.attributes(1).value = my_path(nDepth-1,1) and maxdepth > ndepth Then
response.write " " & unescape(item.attributes(0).value) & " "
' Check the next level
call OutputPath(item,nDepth+1) 'recursive call of OutputNode for deeper structure
End If
End If
Next
End Function
Function RewriteImageText(ByVal strImgText)
strImgText= Lcase(strImgText)
strImgText= replace(strImgText, " ", " ")
strImgText= replace(strImgText, "", " ")
strImgText= replace(strImgText, " ", " ")
strImgText= replace(strImgText, "", "")
strImgText= replace(strImgText, "", "")
RewriteImageText = strImgText
End Function
' Write Menu Structure for toplevel
Function OutputTopLevel(ByVal node, ByVal nDepth) 'Write Menu-Entries into page
dim item
dim counter
' Check each child node
For Each item in node.childNodes
if item.nodeName="item" then
' Check, if this link is to be highlighted
if item.attributes(1).value = my_id or item.attributes(1).value = my_path(nDepth-1,1) then 'found active link; use or item.attributes(1).value = my_path(nDepth-1,1) if whole path should be highlighted
' Write highlighted link
setSiteArea(unescape(item.attributes(0).value))
response.write "" & unescape(item.attributes(0).value) & ""
elseif not item.attributes(1).value = my_path(nDepth-1,1) then 'found inactive link
' Write normal link
' use if not item.attributes(1).value = my_path(nDepth-1,1) then if whole path should be highlighted
response.write "" & unescape(item.attributes(0).value) & ""
end if
end if
Next
End Function
call OutputTopLevel(rootNode,1)
%>
|
<%ShowLangSelection=true%>
<%
if ("" = "") then
nav_lv_link = "http://www.maxonmotor.es/index.htm"
else
nav_lv_link = ""
end if
%> <%
if ("http://www.maxonmotor.ch/medienmiteilungen-ch-deu_RE-50.html" = "") then
nav_lv_link = "http://www.maxonmotor.ch/index.htm"
else
nav_lv_link = "http://www.maxonmotor.ch/medienmiteilungen-ch-deu_RE-50.html"
end if
%>
DE / |