%@ language=VBScript %> <% ' /////////////////////////////////////////////////////// ' // Dimac CMS ' // Copyright 2004-2008 Dimac Development AB, Sweden ' // www.Dimac.net ' // ' // NOTE: ' // You are not allowed to remove this ' // Copyright information without written ' // permission from Dimac Development. ' /////////////////////////////////////////////////////// ' ----------------------------------------------------- Function GetTemplate(DID) Dim Conn, Rs, SQL, tmpVar mbl=Session("Member_Level") If Not IsNumeric(mbl) Or mbl = "" Then mbl=0 End If SQL = "SELECT TemplateURL,ExternalPage, ExternalPageURL, ModuleID FROM Documents WHERE DocumentID=" & DID & " AND SecLevel <= " & mbl Set Conn = Server.CreateObject("ADODB.Connection") Set Rs = Server.CreateObject("ADODB.Recordset") Conn.Open GetConStr ("SiteResources\Data\") Rs.Open SQL, Conn If Rs.EOF And Rs.BOF Then Rs.Close Conn.Close Set Conn = Nothing Set Rs = Nothing Exit Function End If intModId = CStr( Rs("ModuleID").Value ) If IsNumeric(intModId) And intModId <> "" Then intModId = CInt( intModId ) Else intModId = 0 End If If intModId > 0 Then tmpVar = Trim(Rs("TemplateURL").Value) If InStr(tmpVar, "?") < 1 Then tmpVar = tmpVar & "?" Else tmpVar = tmpVar & "&" End If tmpVar = tmpVar & "lang=" & Session("contentLanguage") & "&DocID=" + DID Else If Trim(Rs("ExternalPageURL").Value) <> "" Then tmpVar = Trim(Rs("ExternalPageURL").Value) Else tmpVar = "SiteResources/Data/Templates/" + Trim(Rs("TemplateURL").Value) + "?DocID=" + DID + "&v1ID=" + v1ID End If End If Set Conn = Nothing Set Rs = Nothing GetTemplate = tmpVar End Function ' ----------------------------------------------------- ' ----------------------------------------------------- ' ----------------------------------------------------- Dim docId Dim v1ID Dim Template Dim xURL docId = Request.QueryString("DocID").Item v1ID = Request.QueryString("m1ID").Item vLang = Request.QueryString("lang").Item If IsNumeric(vLang) And vLang <> "" Then Session("contentLanguage") = vLang End If If IsNumeric(docId) Then Session("DocID") = docId If docId > 0 Then Template = GetTemplate(docId) IF Trim(Template) <> "" then Response.Redirect( Template ) Else Response.Redirect("GlobalResources/NoTemplate.asp") End IF Else Response.Redirect("GlobalResources/RootPage.ASP") End If Else Response.Redirect("GlobalResources/NoTemplate.asp") End If %>