extend_plugs.aspx.cs 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*******************************************************************************
  2. * iNethinkCMS - 网站内容管理系统
  3. * Copyright (C) 2012-2013 inethink.com
  4. *
  5. * @author jackyang <69991000@qq.com>
  6. * @website http://cms.inethink.com
  7. * @version 1.3.6.0 (2013-08-14)
  8. *
  9. * This is licensed under the GNU LGPL, version 3.0 or later.
  10. * For details, see: http://www.gnu.org/licenses/gpl-3.0.html
  11. *******************************************************************************/
  12. using System;
  13. using System.IO;
  14. using System.Data;
  15. using System.Collections.Generic;
  16. using System.Web;
  17. using System.Web.UI;
  18. using System.Web.UI.WebControls;
  19. using iNethinkCMS.Web.UI;
  20. using iNethinkCMS.Helper;
  21. namespace iNethinkCMS.Web.admin.extend
  22. {
  23. public partial class extend_plugs : Admin_BasePage
  24. {
  25. private string vNavInfo = "当前位置:";
  26. //private string vAct = "";
  27. protected void Page_Load(object sender, EventArgs e)
  28. {
  29. CheckUserPower("c");
  30. this.mainID.Visible = false;
  31. this.navInfoID.InnerText = vNavInfo + "插件管理";
  32. this.mainID.Visible = true;
  33. Fun_PlugsList();
  34. }
  35. private void Fun_PlugsList()
  36. {
  37. //Command.Command_DataCache.SetCache("iskey","---");
  38. DataTable dt = new DataTable("Datas");
  39. dt.Columns.Add("i", Type.GetType("System.Int32"));
  40. dt.Columns.Add("PlugsName", Type.GetType("System.String"));
  41. dt.Columns.Add("PlugsDescription", Type.GetType("System.String"));
  42. dt.Columns.Add("PlugsVer", Type.GetType("System.String"));
  43. dt.Columns.Add("PlugsState", Type.GetType("System.String"));
  44. dt.Columns.Add("ManageUrl", Type.GetType("System.String"));
  45. int i = 0;
  46. string vPath = Server.MapPath("/plugs");
  47. DirectoryInfo[] dir = new DirectoryInfo(vPath).GetDirectories();
  48. foreach (DirectoryInfo d in dir)
  49. {
  50. i++;
  51. string vPlugsName = "";
  52. string vPlugsDescription = "";
  53. string vPlugsVer = "";
  54. string vPlugsState = "";
  55. string vManageUrl = "";
  56. //读取配置文件
  57. string vXmlPath = d.FullName + @"\setting.xml";
  58. vPlugsName = XMLHelper.GetXmlNodeByXpath(vXmlPath, "//plugs//main//name").InnerText.Trim();
  59. vPlugsDescription = XMLHelper.GetXmlNodeByXpath(vXmlPath, "//plugs//main//description").InnerText.Trim();
  60. vPlugsVer = XMLHelper.GetXmlNodeByXpath(vXmlPath, "//plugs//main//version").InnerText.Trim();
  61. vPlugsState = XMLHelper.GetXmlAttribute(vXmlPath, "//plugs//config//key[@name=\"state\"]", "value").Value.Trim();
  62. vPlugsState = vPlugsState == "0" ? "停用" : "启用";
  63. vManageUrl = XMLHelper.GetXmlNodeByXpath(vXmlPath, "//plugs//main//manageurl").InnerText.Trim();
  64. vManageUrl = "<a href=\"" + vManageUrl + "\">管理</a>";
  65. dt.Rows.Add(new object[] { i, vPlugsName, vPlugsDescription, vPlugsVer, vPlugsState, vManageUrl });
  66. }
  67. Repeater.DataSource = dt;
  68. Repeater.DataBind();
  69. this.iNoInfo.Visible = i == 0 ? true : false;
  70. }
  71. }
  72. }