Exemple #1
0
        public CmsTemplateCore()
        {
            this.site = Cms.Context.CurrentSite;
            this.siteId = this.site.SiteId;

            //缓存=》模板设置
            string settingCacheKey = String.Format("{0}_{1}_settings", CacheSign.Template.ToString(), this.site.Tpl);
            object settings = Cms.Cache.Get(settingCacheKey);
            if (settings == null)
            {
                this.TplSetting = new TemplateSetting(this.site.Tpl);
                Cms.Cache.Insert(settingCacheKey, this.TplSetting, String.Format("{0}templates/{1}/tpl.conf", Cms.PyhicPath, this.site.Tpl));
            }
            else
            {
                this.TplSetting = settings as TemplateSetting;
            }
        }
Exemple #2
0
        public void Settings_POST()
        {
            string tpl = Request["tpl"];
            if (String.IsNullOrEmpty(tpl))
            {
                tpl = base.CurrentSite.Tpl;
            }
            else
            {
                if (UserState.Administrator.Current.SiteId>0)
                {
                    base.RenderError("无权执行此操作!");
                    return;
                }
            }

            TemplateSetting tplSetting = new TemplateSetting(tpl);
            var req = base.Request;
            int outlineLength;
            int.TryParse(req["tpl_cfg_outlinelength"], out outlineLength);
            tplSetting.CFG_OutlineLength = outlineLength;
            tplSetting.CFG_AllowAmousComment = req["tpl_cfg_allowamouscomment"] == "on";
            tplSetting.CFG_CommentEditorHtml = req["tpl_cfg_commenteditorhtml"];
            tplSetting.CFG_ArchiveTagsFormat = req["tpl_cfg_archivetagsformat"];
            tplSetting.CFG_FriendLinkFormat = req["tpl_cfg_friendlinkformat"];
            int friendlinkNum;
            int.TryParse(req["tpl_cfg_friendshownum"], out friendlinkNum);
            tplSetting.CFG_FriendShowNum = friendlinkNum;
            tplSetting.CFG_NavigatorLinkFormat = req["tpl_cfg_navigatorlinkformat"];
            tplSetting.CFG_NavigatorChildFormat = req["tpl_cfg_navigatorchildformat"];
            tplSetting.CFG_SitemapSplit = req["tpl_cfg_sitemapsplit"];
            tplSetting.CFG_TrafficFormat = req["tpl_cfg_trafficformat"];
            tplSetting.Save();

            base.RenderSuccess("修改成功!");
        }
Exemple #3
0
        /// <summary>
        /// 模板设置
        /// </summary>
        public void Settings_GET()
        {
            string tpl = Request["tpl"];
            if (String.IsNullOrEmpty(tpl))
            {
                tpl = base.CurrentSite.Tpl;
            }

            var tplSetting = new TemplateSetting(tpl);

            base.RenderTemplate(ResourceMap.GetPageContent(ManagementPage.Template_Setting), new
            {
                //模板
                tpl_CFG_OutlineLength = tplSetting.CFG_OutlineLength.ToString(),
                tpl_CFG_allowAmousComment = tplSetting.CFG_AllowAmousComment ? " checked=\"checked\"" : String.Empty,
                tpl_CFG_CommentEditorHtml = tplSetting.CFG_CommentEditorHtml,
                tpl_CFG_ArchiveTagsFormat = tplSetting.CFG_ArchiveTagsFormat,
                tpl_CFG_FriendLinkFormat = tplSetting.CFG_FriendLinkFormat,
                tpl_CFG_FriendShowNum = tplSetting.CFG_FriendShowNum,
                tpl_CFG_NavigatorLinkFormat = tplSetting.CFG_NavigatorLinkFormat,
                tpl_CFG_NavigatorChildFormat = tplSetting.CFG_NavigatorChildFormat,
                tpl_CFG_SitemapSplit = tplSetting.CFG_SitemapSplit,
                tpl_CFG_TrafficFormat = tplSetting.CFG_TrafficFormat
            });
        }