<!--#include file="QvodCms_Conn.asp"-->
<!--#include file="QvodCms_Check.asp"-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<TITLE>模板管理页面</TITLE>
<link href="skins/css/jaja_main.css" rel="stylesheet" type="text/css" />
<script language = "javaScript" src = "QvodCms_All.js" type="text/javascript"></script>
</head>
<body>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr><th colspan=2 background="Skins/images/tdbg.gif" class="title">&nbsp;模板管理中心</th>
</tr>
<tr><td class="td2">
<%Dim rootPath,action,picpath
action = Trim(Request.queryString("action"))
rootPath = Trim(Request.queryString("rootPath"))
If instr(rootPath,"Skin/")<1 Then rootPath = "../Skin/"&Config(12)
'If rootPath = "" Then rootPath = "../Skin/"&Config(12)
Select Case action 
Case "edit"%>
	<table style="background:#cad9ea;" cellSpacing="1" cellPadding="5" width="96%" align="center" border="0">
	  <form name="skin" action="QvodCms_Skin.asp?Action=editseve" method="post" onSubmit="javascript:return CheckSkin()">
		<tr bgcolor="#ffffff">
		  <td width="15%">文件名称：</td>
		  <td><input name="filename" type="text" value="<%=LCase(Mid(Trim(Request.QueryString("file")), InStrRev(Trim(Request.QueryString("file")), "\") + 1))%>" size="40" readonly></td>
		</tr>
		<tr bgcolor="#ffffff">
		  <td colspan="2"><textarea name="htmlcontent" style="width:100%;font-family: Arial,Helvetica,sans-serif;font-size:14px;" rows="28" dataType="Require" msg="请填写模版内容"><%=GetMoBan(Trim(Request.QueryString("file")))%></textarea></td>
		</tr>
		<tr bgcolor="#ffffff">
		 <td colspan="2" align="center"><input type="submit" name="Submit" value="修改模板"/> <input type="button" value="返  回"  onClick="javascript:history.back();" /></td>
		</tr>
		<input name="file" type="hidden" value="<%=Trim(Request.QueryString("file"))%>">
		<input name="reurl" type="hidden" value="<%=Request.ServerVariables("Http_Referer")%>">
	  </form>
	</table>
<%Case "editseve"
	If Cint(Config(19))=1 Then
		Dim CacheObj 
		Set CacheObj = New QvodCms_Cache
		Call CacheObj.ClearAll
		Set CacheObj = Nothing
	End If
	Call MakeHtml(Trim(Request.Form("file")),Replace(Request.Form("htmlcontent"),"&lt;/textarea>","</textarea>"))
	Response.Redirect Trim(Request.Form("reurl"))%>
<%Case Else%>
	<table style="background:#cad9ea;" cellSpacing="1" cellPadding="5" width="100%" align="center" border="0">
	  <tr align="center" bgcolor="#f5fafe">
		<td><strong>文件名</strong></td>
		<td width="15%"><strong>模板类型</strong></td>
		<td width="10%"><strong>文件大小</strong></td>
		<td width="20%"><strong>修改时间</strong></td>
		<td width="12%"><strong>操作</strong></td>
	  </tr>
	  <%Call bianliFolder(rootPath)%>
	</table>
<%End Select%>
</td></tr>
</table>
<%Function bianliFolder(currentPath)
	path = server.mapPath(currentPath)
    set fso=server.CreateObject("scripting.filesystemobject")    
	on error resume next
	Set objFolder=fso.GetFolder(path)
    upperFolder = left(currentPath,(InStrRev(currentPath,"/")-1))
	If upperFolder <> "../Skin" then
			Response.Write "<tr bgcolor=""#ffffff"">"
			Response.Write "<td colspan=""5""><img src=""images/dir2.gif""> <a href=""?rootPath=" &upperFolder&""">上级目录</a></td>"
			Response.Write "</tr>"
	End If
	Set objSubFolders=objFolder.Subfolders
	for each objSubFolder in objSubFolders 
		nowpath=objSubFolder.name
		nextPath = currentPath & "/" & objSubFolder.name
		Response.Write "<tr bgcolor=""#ffffff"" onmouseover=""this.bgColor='#f5fafe'"" onmouseout=""this.bgColor='#ffffff'"">"
		Response.Write "<td colspan=""5""><img src=""images/dir.gif""> <a href=""?rootPath="&nextPath&""">"&nowpath&"</a></td>"
		Response.Write "</tr>"
	next 
	Call bianliFile(currentPath)
	set objFolder=nothing
	set objSubFolders=nothing
	set fso=nothing
End Function

Function bianliFile(currentPath)
	path = server.mapPath(currentPath)
	set fso=server.CreateObject("scripting.filesystemobject")    
	on error resume next
	set objFolder=fso.GetFolder(path)
		nowpath = path
		set objFiles=objFolder.Files
		for each objFile in objFiles
			Response.Write "<tr bgcolor=""#ffffff"" onmouseover=""this.bgColor='#f5fafe'"" onmouseout=""this.bgColor='#ffffff'"">"
			Response.Write "<td><img src=""images/asp.gif""> "&objFile.name&"</td>"
			Response.Write "<td align=""center"">"&SkinName(objFile.name)&"</td>"
			Response.Write "<td align=""center"">"&round(objFile.size/1024,3)&" KB</td>"
			Response.Write "<td align=""center"">"&objFile.DateLastModified&"</td>"
			FileExt = LCase(Mid(objFile.name, InStrRev(objFile.name, ".") + 1))
			Select Case FileExt
			Case "jpg", "gif", "bmp", "png", "swf", "db", "mdb"
			Response.Write "<td align=""center""><a href="""&currentPath&"\"&objFile.name&""" target=""_blank"">观看</a></td>"
			Case else
			Response.Write "<td align=""center""><a href=""?action=edit&file="&currentPath&"/"&objFile.name&""">编辑</a></td>"
			end Select
			Response.Write "</tr>"
		next
	 set objFolder=nothing
	set objSubFolders=nothing
	set fso=nothing
End Function

Function SkinName(filename)
	select case filename
	case "index.html"
	SkinName="首页模板"
	case "type.html"
	SkinName="栏目页模板"
	case "search.html"
	SkinName="搜索页模板"
	case "details.html"
	SkinName="内容页模板"
	case "player.html"
	SkinName="播放页模板"
	case "all.html"
	SkinName="全部影片页模板"
	case "header.html"
	SkinName="头部共用模板"
	case "footer.html"
	SkinName="底部共用模板"
	case "hot.html"
	SkinName="调用热门模板"
	case "elite.html"
	SkinName="调用推荐模板"
	case "new.html"
	SkinName="调用最新模板"	
	case "top.html"
	SkinName="排行榜模板"
	case "today.html"
	SkinName="今日更新模板"	
	case "news_type.html"
	SkinName="新闻列表模板"
	case "news_content.html"
	SkinName="新闻内容模板"
	case "prod_type.html"
	SkinName="奖品列表模板"
	case "prod_content.html"
	SkinName="奖品内容模板"
	case "login.html"
	SkinName="Ajax登陆窗口模板"
	case "login_not.html"
	SkinName="未登陆内容模板"
	case "login_ok.html"
	SkinName="已登陆内容模板"
	case "index_cs.html"
	SkinName="桌面播放器首页模板"
	case "player_cs.html"
	SkinName="桌面播放器模板"
	case "type_cs.html"
	SkinName="桌面播放器列表模板"
	case "Details_Cs.html"
	SkinName="桌面播放器内容模板"
	case "search_cs.html"
	SkinName="桌面播放器搜索模板"
	case "Style.css"
	SkinName="风格文件"				
	case else
	SkinName="自定义其它文件"
	end select
End Function
%>
</body>
</html>