Esempio n. 1
0
        /// <summary>
        /// 编辑页面
        /// </summary>
        public void ThemePage_Edit()
        {
            int             id    = RequestTool.RequestInt("id", 0);
            Lebi_Theme_Page model = B_Lebi_Theme_Page.GetModel(id);

            if (model == null)
            {
                model = new Lebi_Theme_Page();
            }
            B_Lebi_Theme_Page.BindForm(model);
            //model.Name = Language.RequestString("Name");
            model.StaticPath = "/" + model.StaticPath;
            model.StaticPath = ThemeUrl.CheckURL(model.StaticPath).TrimEnd('/');
            if (model.id == 0)
            {
                if (!EX_Admin.Power("themepage_add", "添加页面"))
                {
                    AjaxNoPower();
                    return;
                }
                B_Lebi_Theme_Page.Add(model);
                id = B_Lebi_Theme_Page.GetMaxId();
                string action = Tag("添加页面");
                Log.Add(action, "ThemePage", model.id.ToString(), CurrentAdmin);
            }
            else
            {
                if (!EX_Admin.Power("themepage_edit", "编辑页面"))
                {
                    AjaxNoPower();
                    return;
                }
                B_Lebi_Theme_Page.Update(model);
                string action = Tag("编辑页面");
                Log.Add(action, "ThemePage", model.id.ToString(), CurrentAdmin);
            }
            //更新模板中的生成路径
            List <Lebi_Theme_Skin> pages = B_Lebi_Theme_Skin.GetList("Code='" + model.Code + "'", "");

            foreach (Lebi_Theme_Skin page in pages)
            {
                page.PageName       = model.PageName;
                page.PageParameter  = model.PageParameter;
                page.StaticPageName = model.StaticPageName;
                B_Lebi_Theme_Skin.Update(page);
            }
            //处理静态
            ThemeUrl.CreateURLRewrite();
            ShopCache.SetThemePage();
            Response.Write("{\"msg\":\"OK\",\"id\":\"" + id + "\"}");
        }
Esempio n. 2
0
        /// <summary>
        /// 编辑模板-页面
        /// </summary>
        public void Skin_Edit()
        {
            if (RequestTool.GetConfigKey("OnlineFileEdit").Trim() != "1")
            {
                AjaxNoPower();
                return;
            }
            int             id    = RequestTool.RequestInt("id", 0);
            Lebi_Theme_Skin model = B_Lebi_Theme_Skin.GetModel(id);

            if (model == null)
            {
                model = new Lebi_Theme_Skin();
            }
            B_Lebi_Theme_Skin.BindForm(model);
            //if (model.IsPage == 1)
            //    model.Code = "";
            if (model.id == 0)
            {
                if (!EX_Admin.Power("theme_skin_add", "添加模板页面"))
                {
                    AjaxNoPower();
                    return;
                }
                B_Lebi_Theme_Skin.Add(model);
                id = B_Lebi_Theme_Skin.GetMaxId();
                Log.Add("添加模板-页面", "Theme_Skin", id.ToString(), CurrentAdmin, model.Name);
            }
            else
            {
                if (!EX_Admin.Power("theme_skin_edit", "编辑模板页面"))
                {
                    AjaxNoPower();
                    return;
                }
                B_Lebi_Theme_Skin.Update(model);
                Log.Add("编辑模板-页面", "Theme_Skin", id.ToString(), CurrentAdmin, model.Name);
            }
            //生成页面
            string SkinContent = Request["SkinContent"];

            if (SkinContent != "" && model.Path_Skin != "") //如果模板内容为空则不生成页面 by lebi.kingdge 2015-02-25
            {
                Lebi_Theme theme    = B_Lebi_Theme.GetModel(model.Theme_id);
                string     SkinPath = theme.Path_Files + "/" + model.Path_Skin;
                GreatSkin(SkinPath, SkinContent);
            }
            string result = "{\"msg\":\"OK\", \"id\":\"" + id + "\"}";

            Response.Write(result);
        }