⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editor.aspx.cs

📁 最好用的站点内容管理系统 全部源代码都有
💻 CS
字号:
//======================================================
//==     (c)2008 aspxcms inc by NeTCMS v1.0              ==
//==          Forum:bbs.aspxcms.com                   ==
//==         Website:www.aspxcms.com                  ==
//======================================================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text.RegularExpressions;
using System.Text;

public partial class manage_Templet_editor : NetCMS.Web.UI.ManagePage
{
    public string dir = string.Empty;
    public string filename = string.Empty;
    private string str_dirMana = NetCMS.Config.UIConfig.dirDumm;
    private string str_Templet = NetCMS.Config.UIConfig.dirTemplet;  //获取模板路径
    private string str_FilePath = string.Empty;

    protected void Page_Load(object sender, EventArgs e)
    {
        Response.CacheControl = "no-cache";

        if (SiteID == "0")
        {
            str_FilePath = Server.MapPath(str_dirMana + "\\" + str_Templet);
        }
        else
        {
            string _sitePath = str_dirMana + "\\" + str_Templet + "\\siteTemplets\\" + NetCMS.Global.Current.SiteID;
            if (!Directory.Exists(Server.MapPath(_sitePath))) { Directory.CreateDirectory(Server.MapPath(_sitePath)); }
            str_FilePath = Server.MapPath(_sitePath);
        }
        dir = Request.QueryString["dir"];
        filename = Request.QueryString["filename"];
        string filepath = str_FilePath + dir.Replace("\\\\", "\\") + "\\" + filename;
        string action = Request.QueryString["action"];
        if (!IsPostBack)                                               //判断页面是否重载
        {
                                                 //判断用户是否登录
            dirPath.InnerHtml = "<span style=\"color:#999999;font-size:11.5px;\">当前路径:" + str_FilePath + dir.Replace("\\\\", "\\") + "&nbsp;&nbsp;&nbsp;&nbsp;当前文件:" + filename + "</span>";

            copyright.InnerHtml = CopyRight;            //获取版权信息
            ShowFileContet(filepath);
            getLabelList();
        }
        FilePath.Text = filepath;
    }

    /// <summary>
    /// 显示文件内容
    /// </summary>
    /// <param name="filepath">文件夹路径</param>
    /// <returns>显示文件内容</returns>
    /// Code By DengXi

    protected void ShowFileContet(string filepath)
    {
        NetCMS.Content.Templet.Templet tpClass = new NetCMS.Content.Templet.Templet();
        this.FileContent.Value = tpClass.showFileContet(filepath);
    }

    /// <summary>
    /// 保存文件
    /// </summary>
    /// <returns>保存文件</returns>
    /// Code By DengXi

    protected void Button1_ServerClick(object sender, EventArgs e)
    {
        int result = 0;
        string str_content = this.FileContent.Value;
        string str_path = FilePath.Text.ToString();

        NetCMS.Content.Templet.Templet tpClass = new NetCMS.Content.Templet.Templet();
        result = tpClass.saveFile(str_path, str_content);
        if (result == 1)
            PageRight("保存成功", "Manage_List.aspx");
        else
            PageError("参数错误", "Manage_List.aspx");
    }

    protected void getLabelList()
    {
        NetCMS.Content.Label lb = new NetCMS.Content.Label();
        DataTable dt = lb.getLableList(SiteID,2);
        if (dt != null)
        {
            LabelList.DataTextField = "Label_Name";
            LabelList.DataValueField = "Label_Name";
            LabelList.DataSource = dt;
            LabelList.DataBind();
            dt.Clear();
            dt.Dispose();
        }
        ListItem itm = new ListItem();
        itm.Selected = true;
        itm.Value = "";
        itm.Text = "=自定义标签(最新20条)";
        LabelList.Items.Insert(0, itm);
        itm = null;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -