<%@ 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. ' /////////////////////////////////////////////////////// If NOT CBool(Session("ValidAdminUser")) Then Response.Redirect("../LIO/loggin.asp") End IF ' ----------------------------------------------------- Dim Conn, Rs, strSQL Dim strResult, dicTemplate, dicDefaults Set Conn = Server.CreateObject("ADODB.Connection") Set Rs = Server.CreateObject("ADODB.Recordset") Conn.Open GetConStr ("..\..\SiteResources\Data\") vDI = Session("DocID") vNewT = Request.QueryString("template").Item If vNewT <> "" And vDI <> "" And CStr(vDI) <> "0" And Session("User_Type") = 5 Then LoadFields("../../SiteResources/data/Templates/" & vNewT) Set dicTemplate = Server.CreateObject("Scripting.Dictionary") Set dicDefaults = Server.CreateObject("Scripting.Dictionary") Set dicLangs = Server.CreateObject("Scripting.Dictionary") strSQL = "SELECT ID, Code FROM Languages" Rs.Open strSQL, Conn, 1, 3 While Not Rs.EOF dicLangs.Add CStr(Rs("ID").Value), Rs("Code").Value Rs.MoveNext Wend Rs.Close If Join(vFields) <> "" Then For i = 1 to UBound( vFields ) - 1 For Each field In dicLangs dicTemplate.Add vFields(i) & "|" & field, False Next dicDefaults.Add vFields(i), vFieldDefaultValues(i) Next Else nsync = langLabelNoDynamicFields End If strSQL = "UPDATE Documents SET TemplateURL='" & vNewT & "' WHERE DocumentID=" & vDI Conn.Execute( strSQL ) strResult = nsyncDocument(vDI, dicTemplate, dicDefaults, dicLangs, Conn, true) 'Response.Write strSQL & "

" & strResult & "

" Set dicTemplate = Nothing End If If Session("DocID") <> "" And CStr(vDI) <> "0" Then strSQL = "SELECT DocName, TemplateURL FROM Documents WHERE DocumentID=" & vDI Rs.Open strSQL, Conn vP = Rs("DocName").Value vT = Rs("TemplateURL").Value Rs.Close End If Conn.Close Set Rs = Nothing Set Conn = Nothing ' ---------------------------------------------------------------- ' ---------------------------------------------------------------- %>

<%=langLabelChangeTemplate%>

<%If strResult <> "" Then%>
<%=langLabelTemplateChanged%>
<%End If%> <% If Session("DocID") >= 0 And CStr(vDI) <> "0" And Session("User_Type") = 5 Then %> <%=langLabelSelectNewTemplate%> "<%= vP %>"
<%=langLabelCurrentTemplate%> "<%= vT %>" <% Else %>

<%=langErrorSelParentNode%>

<% End If %>