Xml_Pack.asp
上传用户:saigedz
上传日期:2019-10-14
资源大小:997k
文件大小:23k
源码类别:

中间件编程

开发平台:

HTML/CSS

  1. <%@ CODEPAGE=65001 %>
  2. <%
  3. '///////////////////////////////////////////////////////////////////////////////
  4. '// 插件应用:    1.8 Pre Terminator 及以上版本, 其它版本的Z-blog未知
  5. '// 插件制作:    haphic(http://haphic.com/)
  6. '// 备    注:    主题管理插件
  7. '// 最后修改:   2008-7-6
  8. '// 最后版本:    1.2
  9. '///////////////////////////////////////////////////////////////////////////////
  10. %>
  11. <% Option Explicit %>
  12. <% On Error Resume Next %>
  13. <% Response.Charset="UTF-8" %>
  14. <% Response.Buffer=True %>
  15. <% Server.ScriptTimeout=99999999 %>
  16. <!-- #include file="../../c_option.asp" -->
  17. <!-- #include file="../../function/c_function.asp" -->
  18. <!-- #include file="../../function/c_system_lib.asp" -->
  19. <!-- #include file="../../function/c_system_base.asp" -->
  20. <!-- #include file="../../function/c_system_plugin.asp" -->
  21. <!-- #include file="c_sapper.asp" -->
  22. <%
  23. Call System_Initialize()
  24. '检查非法链接
  25. Call CheckReference("")
  26. '检查权限
  27. If BlogUser.Level>1 Then Call ShowError(6)
  28. If CheckPluginState("ThemeSapper")=False Then Call ShowError(48)
  29. BlogTitle = "将主题打包"
  30. %>
  31. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  32. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%=ZC_BLOG_LANGUAGE%>" lang="<%=ZC_BLOG_LANGUAGE%>">
  33. <head>
  34. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  35. <meta http-equiv="Content-Language" content="<%=ZC_BLOG_LANGUAGE%>" />
  36. <meta name="robots" content="noindex,nofollow"/>
  37. <link rel="stylesheet" rev="stylesheet" href="../../CSS/admin.css" type="text/css" media="screen" />
  38. <link rel="stylesheet" rev="stylesheet" href="images/style.css" type="text/css" media="screen" />
  39. <title><%=BlogTitle%></title>
  40. </head>
  41. <body>
  42. <div id="divMain">
  43. <div class="Header">Theme Sapper - 主题导出 - 导出主题为 ZTI 文件. <a href="help.asp#exportzti" title="如何导出主题为 ZTI 文件">[页面帮助]</a></div>
  44. <%Call SapperMenu("0")%>
  45. <div id="divMain2">
  46. <%
  47. Action=Request.QueryString("act")
  48. SelectedTheme=Request.QueryString("theme")
  49. SelectedThemeName=Request.QueryString("themename")
  50. If Action <> "pack" Then Call GetBlogHint()
  51. Response.Write "<div>"
  52. Response.Flush
  53. If Action="view" Then
  54. Call ViewXMLPackInfo()
  55. End If
  56. If Action="" Then
  57. Response.Write "<p id=""loading"">正在载入主题信息, 请稍候...  如果长时间停止响应, 请 <a href=""javascript:window.location.reload();"" title=""点此重试"">[点此重试]</a></p>"
  58. Response.Flush
  59. Call EditXMLPackInfo()
  60. Response.Write "<script language=""JavaScript"" type=""text/javascript"">document.getElementById('loading').style.display = 'none';</script>"
  61. End If
  62. If Action="pack" Then
  63. Dim Pack_Error
  64. Pack_Error=0
  65. If SelectedTheme="" Then
  66. Response.Write "<p><font color=""red""> × 主题的名称为空.</font></p>"
  67. Pack_Error=Pack_Error+1
  68. Else
  69. Response.Write "<p id=""loading2"">正在打包主题, 请稍候...  如果长时间停止响应, 请 <a href=""javascript:window.location.reload();"" title=""点此重试"">[点此重试]</a></p>"
  70. Response.Write "<p class=""status-box"">正在打包主题...<p>"
  71. Response.Flush
  72. Dim ZipPathDir,ZipPathFile,Pack_ThemeDir
  73. Dim TS_startime,TS_endtime
  74. '打包文件目录与生成文件名
  75. ZipPathDir = BlogPath & "THEMES" & LCase(SelectedTheme)
  76. If right(ZipPathDir,1)<>"" Then ZipPathDir=ZipPathDir&""
  77. Pack_ThemeDir = SelectedTheme
  78. If right(Pack_ThemeDir,1)<>"" Then Pack_ThemeDir=Pack_ThemeDir &""
  79. If Request.Form("PubOrBack")="Pub" Then 
  80. ZipPathFile = BlogPath & "PLUGINThemeSapperExport" & SelectedTheme & ".zti"
  81. Pack_Error=Pack_Error+DeleteFile(ZipPathFile)
  82. ElseIf Request.Form("PubOrBack")="Bak" Then
  83. Dim BakNum
  84. BakNum = 0
  85. Do
  86. BakNum = BakNum + 1
  87. ZipPathFile=BlogPath & "PLUGINThemeSapperExport" & SelectedTheme & "_Bak("& Cstr(BakNum) & ").zti"
  88. Loop Until FileExists(ZipPathFile)=False
  89. Else
  90. Response.Write "<p><font color=""red""> × 导出设置错误.</font></p>"
  91. ZipPathFile = BlogPath & "PLUGINThemeSapperExport" & SelectedTheme & ".xml"
  92. Pack_Error=Pack_Error+1
  93. End If
  94. '开始打包
  95. CreateXml(ZipPathFile)
  96. Response.Write "<script language=""JavaScript"" type=""text/javascript"">document.getElementById('loading2').style.display = 'none';</script>"
  97. End If
  98. If Pack_Error = 0 Then
  99. If Request.Form("PubOrBack")="Pub" Then 
  100. Response.Write "<p class=""status-box""> √ 主题打包完成, 并保存在主机上, 名称为: """ & SelectedTheme & ".zti"". 如果您的浏览器没能自动跳转, 请 <a href=""Xml_Pack.asp?act=view&amp;theme="& Server.URLEncode(SelectedTheme) &"&amp;themename="& Server.URLEncode(SelectedTheme) &""">[点击这里]</a>.</p>"
  101. Response.Write "<script>setTimeout(""self.location.href='Xml_Pack.asp?act=view&theme="& Server.URLEncode(SelectedTheme) &"&themename="& Server.URLEncode(SelectedTheme) &"'"",3000);</script>"
  102. ElseIf Request.Form("PubOrBack")="Bak" Then
  103. Response.Write "<p class=""status-box""> √ 主题打包完成, 并保存在主机上, 名称为: """ & SelectedTheme & "_Bak("& Cstr(BakNum) & ").zti"". 如果您的浏览器没能自动跳转, 请 <a href=""Xml_Pack.asp?act=view&amp;theme="& Server.URLEncode(SelectedTheme & "_Bak("& Cstr(BakNum) & ")") &"&amp;themename="& Server.URLEncode(SelectedTheme) &""">[点击这里]</a>.</p>"
  104. Response.Write "<script>setTimeout(""self.location.href='Xml_Pack.asp?act=view&theme="& Server.URLEncode(SelectedTheme & "_Bak("& Cstr(BakNum) & ")") &"&themename="& Server.URLEncode(SelectedTheme) &"'"",3000);</script>"
  105. Else
  106. Response.Write "<p class=""status-box""><font color=""red""> × 这种情况不可能发生. </font></p>"
  107. End If
  108. Else
  109. Response.Write "<p class=""status-box""><font color=""red""> × 主题打包失败. "
  110. Response.Write "<a href=""javascript:history.back(-1)"" title=""返回上一个页面""><span>[返回]</span></a> 或 <a href=""javascript:window.location.reload();"" title=""点此重试""><span>[重试]</span></a></font></p>"
  111. End If
  112. End If
  113. Response.Write "</div>"
  114. %>
  115. </div>
  116. </div>
  117. </body>
  118. </html>
  119. <%
  120. '预览XML安装包内的信息
  121. Sub ViewXMLPackInfo()
  122. On Error Resume Next
  123. If InStr(UCase(Request.ServerVariables("HTTP_USER_AGENT")),UCase("Opera"))>0 Then '如果是Opera浏览器
  124. Response.Write "<p class=""download-box""><a href=""Export/"& SelectedTheme & ".zti"" title=""右键另存为下载此 ZTI 文件"">[右键点击这里, 选择 ""链接另存为...(Save Link As...)""  保存此 ZTI 文件 - " & SelectedTheme & ".zti - 到本地]</a></p>"
  125. Else
  126. Response.Write "<p class=""download-box""><a href=""Xml_Download.asp?theme="& Server.URLEncode(SelectedTheme & ".zti") &""" title=""左键点击下载此 ZTI 文件"">[左键点击这里下载此 ZTI 文件 - " & SelectedTheme & ".zti - 到本地]</a>"
  127. End If
  128. Dim objXmlFile,strXmlFile
  129. Dim fso
  130. Set fso = CreateObject("Scripting.FileSystemObject")
  131. If fso.FileExists(BlogPath & "PLUGIN/ThemeSapper/Export/" & SelectedTheme & ".zti") Then
  132. strXmlFile =BlogPath & "PLUGIN/ThemeSapper/Export/" & SelectedTheme & ".zti"
  133. Set objXmlFile=Server.CreateObject("Microsoft.XMLDOM")
  134. objXmlFile.async = False
  135. objXmlFile.ValidateOnParse=False
  136. objXmlFile.load(strXmlFile)
  137. If objXmlFile.readyState=4 Then
  138. If objXmlFile.parseError.errorCode <> 0 Then
  139. Else
  140. ThemeAuthor_Name=objXmlFile.documentElement.selectSingleNode("author/name").text
  141. ThemeAuthor_Url=objXmlFile.documentElement.selectSingleNode("author/url").text
  142. ThemeAuthor_Email=objXmlFile.documentElement.selectSingleNode("author/email").text
  143. ThemeID=objXmlFile.documentElement.selectSingleNode("id").text
  144. ThemeName=objXmlFile.documentElement.selectSingleNode("name").text
  145. ThemeURL=objXmlFile.documentElement.selectSingleNode("url").text
  146. ThemePubDate=objXmlFile.documentElement.selectSingleNode("pubdate").text
  147. ThemeNote=objXmlFile.documentElement.selectSingleNode("note").text
  148. ThemeAdapted=objXmlFile.documentElement.selectSingleNode("adapted").text
  149. ThemeVersion=objXmlFile.documentElement.selectSingleNode("version").text
  150. ThemeModified=objXmlFile.documentElement.selectSingleNode("modified").text
  151. End If
  152. Set objXmlFile=Nothing
  153. End If
  154. If fso.FileExists(BlogPath & "/THEMES/" & SelectedThemeName & "/" & "screenshot.png") Then
  155. ThemeScreenShot="../../THEMES/" & SelectedThemeName & "/" & "screenshot.png"
  156. Else
  157. ThemeScreenShot="Images/noscreenshot.png"
  158. End If
  159. Response.Write "<div class=""themeDetail"">"
  160. Response.Write "<p><img src=""" & ThemeScreenShot & """ title=""" & ThemeName & """ alt=""ScreenShot"" /></p>"
  161. Response.Write "<p>以下为 ZTI 文件中所包含的信息:</p><hr />"
  162. Response.Write "<p><b>ID:</b> " & ThemeID & "</p>"
  163. Response.Write "<p><b>名称:</b> " & ThemeName & "</p>"
  164. If ThemeURL<>Empty Then Response.Write "<p><b>网址:</b> <a href=""" & ThemeURL & """ target=""_blank"" title=""主题发布地址"">" & ThemeURL & "</a></p>"
  165. If ThemeAuthor_Url=Empty Then
  166. Response.Write "<p><b>作者:</b> " & ThemeAuthor_Name & "</p>"
  167. Else
  168. Response.Write "<p><b>作者:</b> <a href=""" & ThemeAuthor_Url & """ target=""_blank"" title=""作者主页"">" & ThemeAuthor_Name & "</a></p>"
  169. End If
  170. If ThemeAuthor_Email<>Empty Then Response.Write "<p><b>邮箱:</b> <a href=""mailto:" & ThemeAuthor_Email & """ title=""作者邮箱"">" & ThemeAuthor_Email & "</a></p>"
  171. Response.Write "<p><b>发布:</b> " & ThemePubDate & "</p>"
  172. Response.Write "<p><b>简介:</b> " & ThemeNote & "</p><br />"
  173. Response.Write "<p><b>适用:</b> " & ThemeAdapted & "</p>"
  174. Response.Write "<p><b>版本:</b> " & ThemeVersion & "</p>"
  175. Response.Write "<p><b>修正:</b> " & ThemeModified & "</p><hr />"
  176. Response.Write "</div>"
  177. Response.Write "<p><form id=""edit"" name=""edit"" method=""get"" action=""#"">"
  178. Response.Write "<p><input onclick=""self.location.href='ThemeList.asp';"" type=""button"" class=""button"" value=""返回主题管理"" title=""返回主题管理页"" /></p>"
  179. Response.Write "</form></p>"
  180. Else
  181. Response.Write "<p><font color=""red""> × 无法找到主题包. </p>"
  182. End If
  183. Set fso = nothing
  184. Err.Clear
  185. End Sub
  186. '编辑XML安装包内的信息
  187. Sub EditXMLPackInfo()
  188. On Error Resume Next
  189. Dim objXmlFile,strXmlFile
  190. Dim fso
  191. Set fso = CreateObject("Scripting.FileSystemObject")
  192. If fso.FileExists(BlogPath & "/THEMES/" & SelectedTheme & "/" & "theme.xml") Then
  193. strXmlFile =BlogPath & "/THEMES/" & SelectedTheme & "/" & "theme.xml"
  194. Set objXmlFile=Server.CreateObject("Microsoft.XMLDOM")
  195. objXmlFile.async = False
  196. objXmlFile.ValidateOnParse=False
  197. objXmlFile.load(strXmlFile)
  198. If objXmlFile.readyState=4 Then
  199. If objXmlFile.parseError.errorCode <> 0 Then
  200. Else
  201. ThemeAuthor_Name=objXmlFile.documentElement.selectSingleNode("author/name").text
  202. ThemeAuthor_Url=objXmlFile.documentElement.selectSingleNode("author/url").text
  203. ThemeAuthor_Email=objXmlFile.documentElement.selectSingleNode("author/email").text
  204. ThemeSource_Name=objXmlFile.documentElement.selectSingleNode("source/name").text
  205. ThemeSource_Url=objXmlFile.documentElement.selectSingleNode("source/url").text
  206. ThemeSource_Email=objXmlFile.documentElement.selectSingleNode("source/email").text
  207. If ThemeAuthor_Name=Empty Then
  208. ThemeAuthor_Name=ThemeSource_Name
  209. ThemeAuthor_Url=ThemeSource_Url
  210. ThemeAuthor_Email=ThemeSource_Email
  211. End If
  212. ThemeID=objXmlFile.documentElement.selectSingleNode("id").text
  213. ThemeName=objXmlFile.documentElement.selectSingleNode("name").text
  214. ThemeURL=objXmlFile.documentElement.selectSingleNode("url").text
  215. ThemePubDate=objXmlFile.documentElement.selectSingleNode("pubdate").text
  216. ThemeNote=objXmlFile.documentElement.selectSingleNode("note").text
  217. ThemeAdapted=objXmlFile.documentElement.selectSingleNode("adapted").text
  218. ThemeVersion=objXmlFile.documentElement.selectSingleNode("version").text
  219. ThemeModified=objXmlFile.documentElement.selectSingleNode("modified").text
  220. ThemeDescription=objXmlFile.documentElement.selectSingleNode("description").text
  221. ThemeAuthor_Name=TransferHTML(ThemeAuthor_Name,"[html-format]")
  222. ThemeSource_Name=TransferHTML(ThemeSource_Name,"[html-format]")
  223. ThemeName=TransferHTML(ThemeName,"[html-format]")
  224. ThemeNote=TransferHTML(ThemeNote,"[html-format]")
  225. ThemeDescription=TransferHTML(ThemeDescription,"[html-format]")
  226. End If
  227. Set objXmlFile=Nothing
  228. End If
  229. Else
  230. ThemeSource_Name="unknown"
  231. ThemeSource_Url=Empty
  232. ThemeSource_Email="null@null.com"
  233. ThemeAuthor_Name="unknown"
  234. ThemeAuthor_Url=Empty
  235. ThemeAuthor_Email="null@null.com"
  236. ThemeName=SelectedTheme
  237. ThemeURL=Empty
  238. ThemeNote="unknown"
  239. ThemePubDate=Date()
  240. ThemeAdapted="Z-Blog 1.8"
  241. ThemeVersion="1.0"
  242. ThemeModified=Date()
  243. ThemeDescription="nothing..."
  244. End If
  245. Set fso = nothing
  246. Err.Clear
  247. Response.Write "<form id=""edit"" name=""edit"" method=""post"">"
  248. Response.Write "<p><b>请指定 ZTI 文件中所包含的主题信息, 仅用于基于 Z-blog 1.8 的主题. <a href=""help.asp#aboutzti"">[什么是 ZTI 文件?]</a></b></p><hr />"
  249. Response.Write "<p>※主题ID: (插件ID应为插件信息文档中的ID, 此处不可修改.)</p><p><input name=""ThemeID"" style=""width:99%"" type=""text"" value="""&ThemeID&""" readonly /></p><p></p>"
  250. Response.Write "<p>※主题名称:</p><p><input name=""ThemeName"" style=""width:99%"" type=""text"" value="""&ThemeName&""" /></p><p></p>"
  251. Response.Write "<p>※主题的发布页面: (强列建议填写, 以方便使用者在安装插件前能看到作者的发布页面, 从而获得更多的发布信息.)</p><p><input name=""ThemeURL"" style=""width:99%"" type=""text"" value="""&ThemeURL&""" /></p><p></p>"
  252. Response.Write "<p>※主题简介 (可以用 &lt;br /&gt; 换行, 可以使用 html 标签):</p><p><textarea name=""ThemeNote"" style=""width:99%"" rows=""5"">"&ThemeNote&"</textarea></p><p></p>"
  253. Response.Write "<p><b>以下信息从主题信息文档 Theme.xml 中读取且必须与之保持一致, 此处不可修改. <a href=""Xml_Edit.asp?theme=" & Server.URLEncode(SelectedTheme) & """ title=""编辑主题信息文档-Theme.xml"">[编辑主题信息文档]</a></b></p><br />"
  254. Response.Write "<p>※主题适用的 Z-Blog 版本: (写法应为: ""Z-Blog 1.8 Spirit"")</p><p><input name=""ThemeAdapted"" style=""width:99%"" type=""text"" value="""&ThemeAdapted&""" readonly /></p><p></p>"
  255. Response.Write "<p>※主题的修订版本号:</p><p><input name=""ThemeVersion"" style=""width:99%"" type=""text"" value="""&ThemeVersion&""" readonly /></p><p></p>"
  256. Response.Write "<p>※主题的发布日期: (日期标准格式应为:"""&Date()&""")</p><p><input name=""ThemePubDate"" style=""width:99%"" type=""text"" value="""&ThemePubDate&""" readonly /></p><p></p>"
  257. Response.Write "<p>※主题的最后修改日期: (日期标准格式应为:"""&Date()&""")</p><p><input name=""ThemeModified"" style=""width:99%"" type=""text"" value="""&ThemeModified&""" readonly /></p><p></p>"
  258. Response.Write "<p>※主题作者:</p><p><input name=""AuthorName"" style=""width:99%"" type=""text"" value="""&ThemeAuthor_Name&""" readonly /></p><p></p>"
  259. Response.Write "<p>※主题作者主页:</p><p><input name=""AuthorURL"" style=""width:99%"" type=""text"" value="""&ThemeAuthor_Url&""" readonly /></p><p></p>"
  260. Response.Write "<p>※主题作者 Email:</p><p><input name=""AuthorEmail"" style=""width:99%"" type=""text"" value="""&ThemeAuthor_Email&""" readonly /></p><p></p>"
  261. Response.Write "<p><b>主题将被按 Z-Blog 主题专用安装包 Version 0.1 打包成 ZTI 文件, 并保存在 TS 插件的 Export 目录下.</b></p><hr />"
  262. Response.Write "<p><input name=""PubOrBack"" type=""radio"" value=""Pub"" checked=""checked""/> 这次导出是为了<b>发布</b> (导出的文件名必须为 <b>"& SelectedTheme &".zti</b>)<br /><input name=""PubOrBack"" type=""radio"" value=""Bak""/> 这次导出是为了<b>备份</b> (导出的文件名为 <b>"& SelectedTheme &"_Bak(n).zti</b> 的形式)</p><hr />"
  263. Response.Write "<p><input type=""submit"" class=""button"" value=""确认信息并打包主题"" id=""btnPost"" onclick='document.getElementById(""edit"").action=""Xml_Pack.asp?act=pack&theme="& SelectedTheme &""";' title=""确认信息并打包主题"" /> <input onclick=""self.location.href='ThemeList.asp';"" type=""button"" class=""button"" value=""取消并返回主题管理"" title=""取消并返回主题管理页"" />  <input onclick=""window.scrollTo(0,0);"" type=""button"" class=""button"" value=""TOP"" title=""返回页面顶部"" /></p>"
  264. Response.Write "</form>"
  265. End Sub
  266. '遍历目录内的所有文件以及文件夹
  267. Sub LoadData(DirPath)
  268. On Error Resume Next
  269. Dim XmlDoc
  270. Dim fso            'fso对象
  271. Dim objFolder      '文件夹对象
  272. Dim objSubFolders  '子文件夹集合
  273. Dim objSubFolder   '子文件夹对象
  274. Dim objFiles       '文件集合
  275. Dim objFile        '文件对象
  276. Dim objStream
  277. Dim pathname,TextStream,pp,Xfolder,Xfpath,Xfile,Xpath,Xstream
  278. Dim PathNameStr
  279. Set fso=server.CreateObject("scripting.filesystemobject")
  280. Set objFolder=fso.GetFolder(DirPath)'创建文件夹对象
  281. Response.Write("<p>打包目录: "& Replace(DirPath,BlogPath,"") &"...</p>")
  282. Response.flush
  283. Set XmlDoc = Server.CreateObject("Microsoft.XMLDOM")
  284. XmlDoc.async = False
  285. XmlDoc.ValidateOnParse=False
  286. XmlDoc.load (ZipPathFile)
  287. '写入每个文件夹路径
  288. Set Xfolder = XmlDoc.SelectSingleNode("//root").AppendChild(XmlDoc.CreateElement("folder"))
  289. Set Xfpath = Xfolder.AppendChild(XmlDoc.CreateElement("path"))
  290. Xfpath.text = replace(DirPath,ZipPathDir,Pack_ThemeDir)
  291. Response.Write "<blockquote><font color=""Teal"">"
  292. Set objFiles=objFolder.Files
  293. for each objFile in objFiles
  294. If lcase(DirPath & objFile.name) <> lcase(Request.ServerVariables("PATH_TRANSLATED")) Then
  295. PathNameStr = DirPath & "" & objFile.name
  296. Response.Write Replace(PathNameStr,BlogPath,"") & "<br />"
  297. Response.flush
  298. '================================================
  299. '写入文件的路径及文件内容
  300.    Set Xfile = XmlDoc.SelectSingleNode("//root").AppendChild(XmlDoc.CreateElement("file"))
  301.    Set Xpath = Xfile.AppendChild(XmlDoc.CreateElement("path"))
  302.    Xpath.text = replace(PathNameStr,ZipPathDir,Pack_ThemeDir)
  303.    '创建文件流读入文件内容,并写入XML文件中
  304.    Set objStream = Server.CreateObject("ADODB.Stream")
  305.    objStream.Type = 1
  306.    objStream.Open()
  307.    objStream.LoadFromFile(PathNameStr)
  308.    objStream.position = 0
  309.    
  310.    Set Xstream = Xfile.AppendChild(XmlDoc.CreateElement("stream"))
  311.    Xstream.SetAttribute "xmlns:dt","urn:schemas-microsoft-com:datatypes"
  312.    '文件内容采用二制方式存放
  313.    Xstream.dataType = "bin.base64"
  314.    Xstream.nodeTypedValue = objStream.Read()
  315.    
  316.    Set objStream=Nothing
  317.    Set Xpath = Nothing
  318.    Set Xstream = Nothing
  319.    Set Xfile = Nothing
  320.   '================================================
  321. end if
  322. next
  323. Response.Write "</font></blockquote>"
  324. XmlDoc.Save(ZipPathFile)
  325. Set Xfpath = Nothing
  326. Set Xfolder = Nothing
  327. Set XmlDoc = Nothing
  328. '创建的子文件夹对象
  329. Set objSubFolders=objFolder.Subfolders
  330. '调用递归遍历子文件夹
  331. for each objSubFolder in objSubFolders
  332. pathname = DirPath & objSubFolder.name & ""
  333. LoadData(pathname)
  334. next
  335. Set objFolder=Nothing
  336. Set objSubFolders=Nothing
  337. Set fso=Nothing
  338. If Err.Number<>0 Then Pack_Error=Pack_Error+1
  339. Err.Clear
  340. End Sub
  341. '创建一个空的XML文件,为写入文件作准备
  342. Sub CreateXml(FilePath)
  343. On Error Resume Next
  344. '程序开始执行时间
  345. TS_startime=timer()
  346. Dim XmlDoc,Root,xRoot
  347. Set XmlDoc = Server.CreateObject("Microsoft.XMLDOM")
  348. XmlDoc.async = False
  349. XmlDoc.ValidateOnParse=False
  350. Set Root = XmlDoc.createProcessingInstruction("xml","version='1.0' encoding='utf-8'")
  351. XmlDoc.appendChild(Root)
  352. Set xRoot = XmlDoc.appendChild(XmlDoc.CreateElement("root"))
  353. xRoot.setAttribute "version",XML_Pack_Ver
  354. xRoot.setAttribute "type",XML_Pack_Type
  355. xRoot.setAttribute "for",XML_Pack_Version
  356. Set xRoot = Nothing
  357. '写入文件信息
  358. Dim Author,AuthorName,AuthorURL,AuthorEmail
  359. Set ThemeID = XmlDoc.SelectSingleNode("//root").AppendChild(XmlDoc.CreateElement("id"))
  360. ThemeID.Text = SelectedTheme
  361. Set ThemeID=Nothing
  362. Set ThemeName = XmlDoc.SelectSingleNode("//root").AppendChild(XmlDoc.CreateElement("name"))
  363. ThemeName.Text = Request.Form("ThemeName")
  364. Set ThemeName=Nothing
  365. Set ThemeURL = XmlDoc.SelectSingleNode("//root").AppendChild(XmlDoc.CreateElement("url"))
  366. ThemeURL.Text = Request.Form("ThemeURL")
  367. Set ThemeURL=Nothing
  368. Set ThemePubDate = XmlDoc.SelectSingleNode("//root").AppendChild(XmlDoc.CreateElement("pubdate"))
  369. ThemePubDate.Text = Request.Form("ThemePubDate")
  370. Set ThemePubDate=Nothing
  371. Set ThemeAdapted = XmlDoc.SelectSingleNode("//root").AppendChild(XmlDoc.CreateElement("adapted"))
  372. ThemeAdapted.Text = Request.Form("ThemeAdapted")
  373. Set ThemeAdapted=Nothing
  374. Set ThemeVersion = XmlDoc.SelectSingleNode("//root").AppendChild(XmlDoc.CreateElement("version"))
  375. ThemeVersion.Text = Request.Form("ThemeVersion")
  376. Set ThemeVersion=Nothing
  377. Set ThemeModified = XmlDoc.SelectSingleNode("//root").AppendChild(XmlDoc.CreateElement("modified"))
  378. ThemeModified.Text = Request.Form("ThemeModified")
  379. Set ThemeModified=Nothing
  380. Set ThemeNote = XmlDoc.SelectSingleNode("//root").AppendChild(XmlDoc.CreateElement("note"))
  381. ThemeNote.Text = Replace(Replace(Request.Form("ThemeNote"),vbCr,""),vbLf,"")
  382. Set ThemeNote=Nothing
  383. Set Author = XmlDoc.SelectSingleNode("//root").AppendChild(XmlDoc.CreateElement("author"))
  384. Set AuthorName = Author.AppendChild(XmlDoc.CreateElement("name"))
  385. AuthorName.Text = Request.Form("AuthorName")
  386. Set AuthorName=Nothing
  387. Set AuthorURL = Author.AppendChild(XmlDoc.CreateElement("url"))
  388. AuthorURL.Text = Request.Form("AuthorURL")
  389. Set AuthorURL=Nothing
  390. Set AuthorEmail = Author.AppendChild(XmlDoc.CreateElement("email"))
  391. AuthorEmail.Text = Request.Form("AuthorEmail")
  392. Set AuthorEmail=Nothing
  393. Set Author=Nothing
  394. XmlDoc.Save(FilePath)
  395. Set Root = Nothing
  396. Set XmlDoc = Nothing
  397. If Err.Number<>0 Then Pack_Error=Pack_Error+1
  398. Err.Clear
  399. LoadData(ZipPathDir)
  400. '程序结束时间
  401. TS_endtime=timer()
  402. Dim TS_PageTime
  403. TS_PageTime=FormatNumber((TS_endtime-TS_startime),3)
  404. If left(TS_PageTime,1)="." Then TS_PageTime="0" & TS_PageTime
  405. Response.Write("<p>页面执行时间:" & TS_PageTime & "秒</p>")
  406. End Sub
  407. Call System_Terminate()
  408. If Err.Number<>0 Then
  409. Call ShowError(0)
  410. End If
  411. %>