<!--#include file="include.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>插件安装</title>
 <link href="../../Images/style.css" rel="stylesheet" type="text/css">
 <link href="Images/New.css" rel="stylesheet" type="text/css">
   </head>
 <body> 
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
  <tr>
    <td class="bg_tr">您现在的位置：插件样式 &gt;&gt; 插件管理</td>
  </tr>
  <tr>
    <td>
  <div class="md-head" >
<div class="zsj"></div>
<a href="fy.Theme.ACTList.asp" class="a10 wrap"  >在线安装插件</a>
<a href="fy.Theme.Reg.asp" class="a10 wrap"  >我的帐号</a>
<a href="Index.asp" class="a10 wrap cur wid"  >插件管理</a>
<a href="fy.Theme.Check.asp" class="a10 wrap"  >查看插件的可用更新</a>
 </div>
 
</td>
  </tr>
</table>
  <%
Dim title
title=fycms.s("title")
If title<>"" Then 
	echo "<span id=""title""><strong>提示：</strong>"&title&"</span>"
Else 
	echo "<div class=""top1""><strong>提示：</strong>点击可进入查看并对其进行管理操作</div>"
End If 
Action=Request.QueryString("act")
NewVersionExists=False
If Action = "themedel" Then

	SelectedTheme=Request.QueryString("theme")
	SelectedThemeName=Request.QueryString("themename")

	If fycms.CheckPlugin(SelectedTheme) Then
		echo "<p class=""red"">您请求的插件正在使用, 无法删除...</p>"
		echo "<script>setTimeout(""self.history.back(1)"",2000);</script>"
		Response.End
	End If

	Dim DelError
	DelError = 0

	If SelectedTheme<>"" Then
		echo "<p class=""red"">正在处理您的请求...</p>"
		Response.Flush

		echo "<p>"
		DelError = DelError + DeleteFolder(Tpath & ThemePath & SelectedTheme)
		echo "</p>"
	Else
		echo "<p class=""red"">请求的参数错误, 正在退出...</p>"
		Response.Flush
		DelError = 13
	End If

	If DelError = 0 Then
		echo "<p><font color=""green""> √ 插件 - " & SelectedThemeName & "  删除成功!</font><p>"
	Else
		echo "<p><font color=""red""> × 插件 - " & SelectedThemeName & "  删除失败! 请手动删除之.</font><p>"
	End If

	echo "<p class=""red"">如果您的浏览器没能自动跳转 请 <a href=""Index.asp"">[点击这里]</a>.<p>"
	echo "<script>setTimeout(""self.location.href='Index.asp'"",1500);</script>"
	response.end
End If

echo "<span id=""loading"">正在载入插件列表, 请稍候... 如果长时间停止响应, 请 <a href=""javascript:window.location.reload();"" title=""点此重试"">[点此重试]</a></span>"
	Response.Flush
  	echo "<div class=""top1"" id=""newVersion""  style=""display:none;""><p ><a href=""fy.Theme.Check.asp"" class=""notice"" title=""查看插件的可用更新"">[发现了您安装的某个插件有了新版本, 点此查看现有插件的可用更新]</a>.</p></div>"
	  Echo"   <table width=""98%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" class=""table"">" & vbCrLf
	  Echo"    <tr>" & vbCrLf
	  Echo"      <td colspan=""7"" class=""bg_tr"">您现在的位置：系统设置 &gt;&gt;  插件列表</td>" & vbCrLf
	  Echo"    </tr>" & vbCrLf
	  Echo"    <tr>" & vbCrLf
	  Echo"      <td width=""236"" align=""center"">名称</td>" & vbCrLf
	  Echo"      <td width=""123"" align=""center"">作者</td>" & vbCrLf
	  Echo"      <td width=""245"" align=""center"">当前版本</td>" & vbCrLf
	  Echo"      <td width=""182"" align=""center"">最后更新</td>" & vbCrLf
	  Echo"      <td width=""161"" align=""center"">状态</td>" & vbCrLf
	  Echo"      <td width=""261"" align=""center"">管理</td>" & vbCrLf
	  Echo"    </tr>" & vbCrLf
  	
	echo  "<tr> "
	Dim objXmlFile,strXmlFile
	Dim fso, f, f1, fc, s, t 
	Set fso = CreateObject(fycms.FsoName)
 	Set f = fso.GetFolder(Tpath & ThemePath)
	Set fc = f.SubFolders
	For Each f1 in fc
 		ThemeSource_Name=Empty:ThemeSource_Url=Empty:ThemeID=Empty:ThemeName=Empty:ThemeURL=Empty:ThemeNote=Empty:ThemeModified=Empty
  		If fso.FileExists(Tpath & ThemePath & f1.name & "/" & "theme.xml") Then
    			Set XML=fycms.NoAppGetXMLFromFile(Tpath & ThemePath  & f1.name & "/" & "theme.xml")
			If IsObject(XML) And XML.readyState=4 Then
 				If XML.parseError.errorCode = 0 Then 
  					 ThemeAuthor_Name=GetNode("author/name"):ThemeAuthor_Url=GetNode("author/url"):ThemeSource_Name=GetNode("source/name")
					 ThemeSource_Url=GetNode("source/url"):ThemeID=GetNode("id"):ThemeName=GetNode("name"):ThemeURL=GetNode("url")
					 ThemePubDate=GetNode("pubdate"):ThemeModified=GetNode("modified"):ThemeNote=GetNode("note")
					 Themeversion=GetNode("version"):ThemeAdminUrl=GetNode("themeadminurl")
					 If ThemeAuthor_Name=Empty Then
						ThemeAuthor_Name=ThemeSource_Name
						ThemeAuthor_Url=ThemeSource_Url
					 End If
					If ThemeModified=Empty Then ThemeModified=ThemePubDate
 					ThemeNote=delhtml(ThemeNote)
					If Len(ThemeNote)>38 then ThemeNote=Left(ThemeNote,38-7) & "...<a href=""fy.Theme.Type.asp?theme=" & Server.URLEncode(ThemeID) & """>more</a>"
 				End If 
			Set XML=Nothing
 		Else
 			ThemeSource_Name="unknown":ThemeSource_Url=Empty:ThemeID=f1.name
			ThemeName=f1.name:ThemeURL=Empty:ThemeNote="unknown":ThemeModified="unknown"
 	  End If 
   	  End If
  		If fso.FileExists(Tpath & ThemePath & f1.name & "/" & "verchk.xml") Then
			t="<a class=""notice"" href=""fy.Theme.Install.Asp?act=update&amp;url=" & Server.URLEncode(Update_URL & f1.name) & """ title=""升级插件""><b >发现新版本!</b></a>"
 			NewVersionExists=True
		ElseIf fso.FileExists(Tpath & ThemePath& f1.name & "/" & "error.log") Then
			t="<b class=""red"">不支持在线更新.</b>"
		Else
			t=""
		End If

		If fso.FileExists(Tpath & ThemePath & f1.name & "/" & "preview.png") Then
			ThemeScreenShot="../../../" &ThemePath & f1.name & "/" & "preview.png"
		Else
			ThemeScreenShot="Images/nopreview.jpg"
		End If
	
	If fycms.CheckPlugin(SelectedTheme) Then
		echo "  <td  class=""thisclass""  align=""left""> "
    Else 
		echo "<td     align=""left"">"
	End If
 	If UCase(ThemeID)<>UCase(f1.name) Then
		echo "   该插件ID错误, 请 <a href=""fy.Theme.Edit.asp?theme=" & Server.URLEncode(f1.name) & """ title=""编辑插件信息""><font color=""red""><b>[重新编辑插件信息]</b></font></a>.<a href=""Index.asp?act=themedel&amp;theme=" & Server.URLEncode(f1.name) & "&amp;themename=" & Server.URLEncode(ThemeName) & """ title=""删除此插件"" onclick=""return window.confirm('您将删除此插件的所有文件, 确定吗?');"">删除</a> " 
   	Else
        echo t&"      <a href=""fy.Theme.Edit.asp?theme=" & Server.URLEncode(f1.name) & """  class=""green"" >"&f1.name&"</a>  "
  		echo" </td>" 
		echo "<td>"  
 		If ThemeAuthor_Url=Empty Then
		echo  ThemeAuthor_Name 
        Else
	    echo "<a href=""" & ThemeAuthor_Url & """ target=""_blank"" title=""作者主页"">" & ThemeAuthor_Name & "</a>"    
  	    End If
        echo" </td>" 
 		echo "<td>"  
	    echo Themeversion
		echo" </td>" 
		echo "<td>"  
 	    echo  ThemeModified 
		echo" </td>" 
		echo "<td>"  
	 	 If fycms.CheckPlugin(f1.name) =True  Then 
			echo "<font color=green>使用中</font> <a href=""fy.Theme.ThemeInstall.asp?A=PlugInoff&ThemeID=" & f1.name & """   title=""卸载这个插件""><font color=green><b>卸载插件</b></font></a>"
 		 Else 
 			echo "<font color=red>未使用</font> <a href=""fy.Theme.ThemeInstall.asp?A=PlugInOpen&ThemeID=" & f1.name & """   title=""启用这个插件""><font color=green><b>启用插件</b></font></a>"
		 End If 
		  echo" </td><td>"
 	      echo "  <a href=""fy.Theme.Edit.asp?theme=" & Server.URLEncode(f1.name) & """  class=""green"" >修改</a>    "    
 			If  ThemeAdminUrl<>"" Then 
				  Echo "<a href=""" & ThemeAdminUrl & """ >管理</a>"    
			End If 
         echo "   </td> </tr>  	"
	End If 
 	Next
	Set fso = nothing
	Err.Clear
  
	If NewVersionExists Then
		echo "<script language=""JavaScript"" type=""text/javascript"">document.getElementById('newVersion').style.display = 'block';</script>"
	End If
	Response.Flush
 	echo "<script language=""JavaScript"" type=""text/javascript"">try{document.getElementById('loading').style.display = 'none';}catch(e){};</script>"
 %>
</body>
</html>
