<!--#include file="../../conn.asp"-->
<!--#include file="../../common/inc/permission_manage.asp"-->
<%
Dim Action
Dim themes,Rs

	Action = Request.QueryString("act")
	Select Case Action
		   Case "changestyle"
		   		Call ChangeStyle()
		   Case Else
				Call Main()
	End Select
	
	Sub ChangeStyle()
		themes = Request("themes")
		Rs.Open "[T_Config]",Conn,1,3
	
		XMLDOM.loadxml("<Dream3>"&Rs("SiteSettingsXML")&"</Dream3>")
		SiteSettingsXMLStrings=""
		Set objNodes = XMLDOM.documentElement.ChildNodes
		Set objRoot = XMLDOM.documentElement
		
		objRoot.SelectSingleNode("DefaultSiteStyle").text = ""&server.HTMLEncode(Request("themes"))&""
		
		for each element in objNodes	
			SiteSettingsXMLStrings=SiteSettingsXMLStrings&"<"&element.nodename&">"&element.text&"</"&element.nodename&">"&vbCrlf
		next
		Set XMLDOM=nothing
		Rs("SiteSettingsXML")=SiteSettingsXMLStrings
		Rs.update
		Rs.close
		'重新加载全局变量用于显示
		Call loadConfig()
	End Sub
	
	Sub Main()
		'response.Write(ListFolderCombox(Server.MapPath("../../common/themes")))
		'call ListFolderContents(Server.MapPath("../../common/themes"))
	End Sub
%>
<!--#include file="../../common/inc/header_manage.asp"-->
<!--#include file="menu.asp"-->


<div id="box">
<div class="clear mainwide" id="content">
        <div class="clear box">
            
            <div class="box-content">
                <div class="head"><h2>模版修改</h2></div> 
					
				<div class="sect">
				
					<ul class="ImgList">
<%
	
    Dim fs, folder, subFolder,splitArr
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set folder = fs.GetFolder(Server.MapPath("../../common/themes"))
    
    For Each item In folder.SubFolders
		splitArr = split(item.Path,"\")
		subFolder = splitArr(ubound(splitArr))
%>
					  <li><img src="../../common/themes/<%=subFolder%>/Css/img/style_pic.jpg" />
					  <br><%=subFolder%><br>
					  <strong>
					  <a href="style.asp?act=changestyle&themes=<%=subFolder%>">[应用此风格]</a>
					  <%If SiteConfig("DefaultSiteStyle")=subFolder Then%>
					  [当前默认风格]
					  <%End If%>
					  </strong></li>
<%
Next
%>
					</ul>
				
                </div>
				
            </div>
            
        </div>
	</div>
</div>
<!--#include file="../../common/inc/footer_manage.asp"-->