/// <summary> /// /// </summary> /// <param name="theme"></param> /// <param name="skin"></param> /// <returns></returns> private string GetSkinStr(Lebi_Supplier_Skin skin) { string str = ""; string path = skin.Path.TrimEnd('/') + "/index.html"; path = ThemeUrl.GetFullPath(path); str = HtmlEngine.ReadTxt(path); return(str); }
/// <summary> /// /// </summary> /// <param name="theme"></param> /// <param name="skin"></param> /// <returns></returns> private string GetSkinStr(Lebi_AdminSkin skin) { string str = ""; string path = site.AdminPath + "/custom/skin/" + skin.Code + ".html"; path = ThemeUrl.GetFullPath(path); str = HtmlEngine.ReadTxt(path); return(str); }
/// <summary> /// /// </summary> /// <param name="theme"></param> /// <param name="skin"></param> /// <returns></returns> private string GetSkinStr(Lebi_Theme theme, Lebi_Theme_Skin skin) { string str = ""; string path = theme.Path_Files + "/" + skin.Path_Skin; path = ThemeUrl.GetFullPath(path); str = HtmlEngine.ReadTxt(path); return(str); }
/// <summary> /// 生成页面皮肤 /// 针对单个皮肤生成的情况 /// </summary> /// <returns></returns> public void CreateSkin() { string Msg = ""; int ThemeID = 0; int SkinID = 0; string Content = ""; string SkinPath = ""; //皮肤路径 string Path = ""; //输入Path要包含路径及文件名 SkinID = RequestTool.RequestInt("id", 0); Lebi_Theme_Skin skin = B_Lebi_Theme_Skin.GetModel(SkinID); Lebi_Theme theme; if (skin == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } ThemeID = skin.Theme_id; theme = B_Lebi_Theme.GetModel(ThemeID); SkinPath = theme.Path_Files + "/" + skin.Path_Skin; SkinPath = ThemeUrl.GetFullPath(SkinPath); Content = HtmlEngine.ReadTxt(SkinPath); List <Lebi_Language> langs = B_Lebi_Language.GetList("Theme_id=" + theme.id + "", ""); if (langs.Count == 0) { Response.Write("{\"msg\":\"" + Tag("请在站点语言设置中关联此模板") + "\"}"); return; } Site site = new Site(); foreach (Lebi_Language lang in langs) { if (lang.Theme_id != ThemeID) { continue; } Lebi_Site s = B_Lebi_Site.GetModel(lang.Site_id); if (s == null) { Path = lang.Path + "/" + skin.PageName; } else { Path = s.Path + lang.Path + "/" + skin.PageName; } Msg = Shop.Bussiness.Theme.CreatAspx(s, lang, theme, skin, Path, Content); } Response.Write("{\"msg\":\"" + Msg + "\"}"); }
/// <summary> /// 生成自定义页面文件 /// </summary> /// <param name="FileName">生成路径</param> /// <param name="SkinContent">内容</param> private void CreatAdminSkin(string FileName, string SkinContent) { FileName = ThemeUrl.GetFullPath(FileName); string PhysicsPath = HttpContext.Current.Server.MapPath(@"~/" + ThemeUrl.GetPath(FileName)); if (!Directory.Exists(PhysicsPath)) { Directory.CreateDirectory(PhysicsPath); } string PhysicsFileName = HttpContext.Current.Server.MapPath(FileName); if (System.IO.File.Exists(PhysicsFileName)) { System.IO.File.Delete(PhysicsFileName); } HtmlEngine.Instance.WriteFile(PhysicsFileName, SkinContent); }
/// <summary> /// /// </summary> /// <param name="theme"></param> /// <param name="skin"></param> /// <returns></returns> private string GetSkinStr(Lebi_AdminSkin skin) { string str = ""; string path = ""; if (!string.IsNullOrEmpty(RequestTool.GetConfigKey("SystemAdmin").Trim())) { path = site.AdminPath + "/custom/skin2/" + skin.Code + ".html"; } else { path = site.AdminPath + "/custom/skin/" + skin.Code + ".html"; } path = ThemeUrl.GetFullPath(path); str = HtmlEngine.ReadTxt(path); return(str); }
/// <summary> /// 生成单个自定义页面 /// </summary> public void AdminSkin_Create() { int id = RequestTool.RequestInt("id", 0); Lebi_AdminSkin model = B_Lebi_AdminSkin.GetModel(id); if (model == null) { model = new Lebi_AdminSkin(); } string FileName = site.AdminPath + "/custom/" + model.Code + ".aspx"; FileName = ThemeUrl.GetFullPath(FileName); //string PhysicsPath = HttpContext.Current.Server.MapPath(@"~/" + ThemeUrl.GetPath(FileName)); //if (!Directory.Exists(PhysicsPath)) //{ // Directory.CreateDirectory(PhysicsPath); //} string PhysicsFileName = HttpContext.Current.Server.MapPath(FileName); if (System.IO.File.Exists(PhysicsFileName)) { System.IO.File.Delete(PhysicsFileName); } string SkinContent = Request["SkinContent"]; SkinContent = Shop.Bussiness.Theme.AdminSkin_DoCodeConvert(SkinContent); string top = "<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeBehind=\"Shop.Bussiness.PageBase.AdminCustomPageBase.cs\" Inherits=\"Shop.Bussiness.AdminCustomPageBase\" %>\r\n"; top += "<%@ Import Namespace=\"DB.LebiShop\" %>\r\n"; top += "<%@ Import Namespace=\"Shop.Bussiness\" %>\r\n"; top += "<%@ Import Namespace=\"Shop.Model\" %>\r\n"; top += "<%@ Import Namespace=\"System.Collections.Generic\" %>\r\n"; SkinContent = top + SkinContent; HtmlEngine.Instance.WriteFile(PhysicsFileName, SkinContent); string result = "{\"msg\":\"OK\"}"; Response.Write(result); }