<%@ language=VBScript %> <% ' /////////////////////////////////////////////////////// ' // CMS - M ' // Copyright 2004 Dimac Development/Duplo AB, Sweden ' // www.Dimac.net ' // ' // NOTE: ' // You are not allowed to remove this ' // Copyright information without written ' // permission from Dimac Development. '// ' /////////////////////////////////////////////////////// Dim mbl:mbl=Session("Member_Level") if Not IsNumeric(mbl) Or mbl="" Then mbl="0" dbType = GetSettingValue("DatabaseType", "SiteResources\Data\") strActiveLanguage=Session("contentLanguage") StartNode = 2 'dtmSQLDate = Day(Date) &"/"& Month(Date) &"/"& Year(Date) & " " & FormatDateTime(Time, vbLongTime) dtmSQLDate = now() 'dtmSQLDate = Day(Date) &"/"& Month(Date) &"/"& Year(Date) & " " & FormatDateTime(Time, vbLongTime) '// ============================================================ Function FF ( x ) FF = Replace( x ,"'","") End Function '// ============================================================ Function GetMenuData() Dim s s = "var TREE_NODES = [ " s = s & vbCrLf s = s & FindChildren(StartNode) s = s & " ];" GetMenuData = s End Function '// ========================================================<==== Function FindChildren(ID) Dim Con, Rs1, SQL, tmpVar Set Conn = Server.CreateObject("ADODB.Connection") Set Rs1 = Server.CreateObject("ADODB.Recordset") Conn.Open GetConStr ("SiteResources\Data\") If dbType = "Access" Then StrSql = "SELECT *, DocumentLanguages.DocName AS DocName FROM Documents " StrSql = StrSql & " INNER JOIN DocumentLanguages ON Documents.DocumentID = DocumentLanguages.DocId" StrSql = StrSql & " WHERE (ParentID = " & ID & ")" StrSql = StrSql & " AND (secLevel <= " &mbl& ") " StrSql = StrSql & " AND ((DocumentLanguages.LangId = " & strActiveLanguage & ") AND (DocumentLanguages.LangStatus=5) )" StrSql = StrSql & " AND (PublishDate <= cdate(now())) " StrSql = StrSql & " AND (ExpiresDate >= cdate(now())) " StrSql = StrSql & " ORDER BY SortOrder,Documents.DocName " ELSE StrSql = "SELECT *, DocumentLanguages.DocName AS DocName FROM Documents " StrSql = StrSql & " INNER JOIN DocumentLanguages ON Documents.DocumentID = DocumentLanguages.DocId" StrSql = StrSql & " WHERE (ParentID = " & ID & ")" StrSql = StrSql & " AND (secLevel <= " &mbl& ") " StrSql = StrSql & " AND ((DocumentLanguages.LangId = " & strActiveLanguage & ") AND (DocumentLanguages.LangStatus=5))" StrSql = StrSql & " AND (PublishDate <= cdate(now())) " StrSql = StrSql & " AND (ExpiresDate >= cdate(now()))) " StrSql = StrSql & " ORDER BY SortOrder,Documents.DocName " End If Rs1.Open StrSql , Conn While Not rs1.EOF ' ------------------------------------------ vChildren = HasChildren(rs1("DocumentID").Value) extURL = Trim(rs1("LangModuleURL").Value) If vChildren > 0 Then s = s & " ['" & FF(rs1("DocName").Value) & "','read.asp?docid=" & rs1("DocumentID").Value & "','" & "main" & "'" & "," s = s & vbCrLf s = s & FindChildren(rs1("DocumentID").Value) s = s & "]," s = s & vbCrLf Else ' // If vChildren = 0 , No children If Rs1("ModuleID").value > 0 Then If extURL <> "" Then s = s & " ['" & FF(rs1("DocName").Value) & "','" & extURL & "','" & "main" & "'" & "]," Else s = s & " ['" & FF(rs1("DocName").Value) & "','" & Rs1("TemplateURL").value & "?docid=" & rs1("DocumentID").Value & "&lang=" & strActiveLanguage & "','" & "main" & "'" & "]," End If Else 'If Trim(Rs1("ExternalPageURL").value) <> "" Then ' s = s & " ['" & FF(rs1("DocName").Value) & "','" & Rs1("ExternalPageURL").value & "?docid=" & rs1("DocumentID").Value & "','" & "main" & "'" & "]," 'Else s = s & " ['" & FF(rs1("DocName").Value) & "','read.asp?docid=" & rs1("DocumentID").Value & "','" & "main" & "'" & "]," 'End If End If s = s & vbCrLf End If ' If vChildren = 0 , No children rs1.MoveNext Wend ' ------------------------------------------------------- rs1.Close FindChildren = s End Function '// ============================================================ Function HasChildren(vID) Dim Conn2, Rs2, SQL, tmpVar, x x = 0 Set Conn2 = Server.CreateObject("ADODB.Connection") Set Rs2 = Server.CreateObject("ADODB.Recordset") Conn2.Open GetConStr ("SiteResources\Data\") If dbType = "Access" Then StrSql = "SELECT *, DocumentLanguages.DocName AS DocName FROM Documents " StrSql = StrSql & " INNER JOIN DocumentLanguages ON Documents.DocumentID = DocumentLanguages.DocId" StrSql = StrSql & " WHERE (ParentID = " & vID & ")" StrSql = StrSql & " AND (secLevel <= " &mbl& ") " StrSql = StrSql & " AND ((DocumentLanguages.LangId = " & strActiveLanguage & ") AND (DocumentLanguages.LangStatus=5))" StrSql = StrSql & " AND (PublishDate <= cdate(now())) " StrSql = StrSql & " AND (ExpiresDate >= cdate(now())) " StrSql = StrSql & " ORDER BY SortOrder,Documents.DocName " ELSE StrSql = "SELECT *, DocumentLanguages.DocName AS DocName FROM Documents " StrSql = StrSql & " INNER JOIN DocumentLanguages ON Documents.DocumentID = DocumentLanguages.DocId" StrSql = StrSql & " WHERE (ParentID = " & vID & ")" StrSql = StrSql & " AND (secLevel <= " &mbl& ") " StrSql = StrSql & " AND ((DocumentLanguages.LangId = " & strActiveLanguage & ") AND (DocumentLanguages.LangStatus=5))" StrSql = StrSql & " AND (PublishDate <= cdate(now())) " StrSql = StrSql & " AND (ExpiresDate >= cdate(now())) " StrSql = StrSql & " ORDER BY SortOrder,Documents.DocName " End If Rs2.Open StrSql , Conn2 If Not Rs2.EOF Then While Not rs2.EOF x = x + 1 rs2.MoveNext wend HasChildren = x Else HasChildren = 0 End if Set Rs2 = Nothing Set Conn2 = Nothing End Function '// ============================================================ '// ============================================================ %>