📄 txteditor.aspx.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_Txteditor : NetCMS.Web.UI.ManagePage
{
public string dir = "";
public string filename = "";
private string str_dirMana = NetCMS.Config.UIConfig.dirDumm;
private string str_Templet = NetCMS.Config.UIConfig.dirTemplet; //获取模板路径
private string str_FilePath = "";
protected void Page_Load(object sender, EventArgs e)
{
dir = Request.QueryString["dir"];
filename = Request.QueryString["filename"];
if (!IsPostBack) //判断页面是否重载
{
//判断用户是否登录
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);
}
dirPath.InnerHtml = "<span style=\"color:#999999;font-size:11.5px;\">当前路径:" + str_FilePath + dir.Replace("\\\\", "\\") + " 当前文件:" + filename + "</span>";
copyright.InnerHtml = CopyRight; //获取版权信息
string filepath = str_FilePath + dir.Replace("\\\\", "\\") + "\\" + filename;
FilePath.Text = filepath;
ShowFileContet(filepath);
getLabelList();
}
}
/// <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();
FileContent.Text = tpClass.showFileContet(filepath);
}
protected void getLabelList()
{
NetCMS.Content.Label lb = new NetCMS.Content.Label();
DataTable dt = lb.getLableList(NetCMS.Global.Current.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;
}
protected void Button2_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
string filepath = FilePath.Text;
int result = 0;
NetCMS.Content.Templet.Templet tpClass = new NetCMS.Content.Templet.Templet();
result = tpClass.saveFile(filepath, this.FileContent.Text);
if (result == 1)
PageRight("保存成功", "Manage_List.aspx");
else
PageError("参数错误", "Manage_List.aspx");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -