public override void Layout() { ContentApp app = ctx.app.obj as ContentApp; ContentSkin s = ContentSkin.findById(app.SkinId); set("skinPath", strUtil.Join(sys.Path.Skin, s.StylePath)); set("adminUrl", to(new Admin.ContentController().Index)); set("appUrl", to(new ContentController().Index)); set("adminCheckUrl", t2(new SecurityController().CanAppAdmin, app.Id) + "?appType=" + typeof(ContentApp).FullName); // 当前app/module所有页面,所属的首页 List <String> moduleUrlList = new List <string>(); moduleUrlList.Add(to(new ContentController().Index)); moduleUrlList.Add(HtmlLink.ToApp(app)); ContentSetting setting = app.GetSettingsObj(); if (strUtil.HasText(setting.StaticPath)) { // 把所有可能的路径都加到 _moduleUrl 中 moduleUrlList.Add(setting.StaticPath); //news/default.html moduleUrlList.Add(getStaticDir(setting.StaticPath)); //news/ } ctx.SetItem("_moduleUrl", moduleUrlList.ToArray()); // admin link set("allPostsLink", to(new Admin.Common.PostController().List, 0)); set("trashPostsLink", to(new Admin.Common.PostController().Trash)); set("settingLink", to(new Admin.SettingController().Index)); set("defaultLink", to(new Admin.ContentController().Home)); set("commentLink", to(new CommentController().List)); IBlock htmlBlock = getBlock("html"); if (ctx.owner.obj is Site) { htmlBlock.Set("staticLink", to(new Admin.HtmlController().Index)); htmlBlock.Next(); } if (app.GetSettingsObj().EnableSubmit == 1) { String slnk = string.Format("<li><a href=\"{0}\" class=\"frmLink\" loadTo=\"contentPage\" nolayout=3>{1}</a></li>", to(new Admin.SubmitSettingController().List), "投递员管理"); set("submitterLink", slnk); } else { set("submitterLink", ""); } }
public virtual void SaveHtmlPath() { String htmlPath = strUtil.SubString(ctx.Post("htmlPath"), 30); if (strUtil.IsNullOrEmpty(htmlPath)) { echoError("请填写内容"); return; } ContentApp app = ctx.app.obj as ContentApp; ContentSetting s = app.GetSettingsObj(); if (htmlPath == s.StaticPath) { echoError("您没有修改目录名称"); return; } if (HtmlHelper.IsHtmlDirError(htmlPath, ctx.errors)) { echoError(); return; } s.StaticPath = htmlPath; app.Settings = Json.ToString(s); app.update(); echoToParentPart(lang("opok")); }
private int getPageSize(long appId) { ContentApp app = ContentApp.findById(appId); ContentSetting s = app.GetSettingsObj(); return(s.ListPostPerPage); }
public virtual void Index() { ContentApp app = ctx.app.obj as ContentApp; ContentSetting setting = app.GetSettingsObj(); ctx.Page.Title = ctx.app.Name; ctx.Page.Description = setting.MetaDescription; if (strUtil.HasText(setting.MetaKeywords)) { this.Page.Keywords = setting.MetaKeywords; } else { this.Page.Keywords = ctx.app.Name; } set("app.Style", app.Style); set("app.SkinStyle", app.SkinStyle); set("lnkSendPost", to(new Submit.PostController().Index)); List <ContentSection> sections = SectionService.GetByApp(ctx.app.Id); bindRows(app, sections); }
public void SaveHtmlDir() { String htmlDir = strUtil.SubString(ctx.Post("htmlDir"), 30); if (strUtil.IsNullOrEmpty(htmlDir)) { echoError("请填写内容"); return; } if (HtmlHelper.IsHtmlDirError(htmlDir, ctx.errors)) { echoError(); return; } ContentApp app = ctx.app.obj as ContentApp; ContentSetting s = app.GetSettingsObj(); s.StaticDir = htmlDir; app.Settings = Json.ToString(s); app.update(); echoToParentPart(lang("opok")); }
public void Index() { target(Save); ContentApp app = ctx.app.obj as ContentApp; bindSettings(app.GetSettingsObj()); set("submitSettingLink", to(new SubmitSettingController().EditRole)); }
public virtual void EditAutoHtml() { target(SaveAutoHtml); ContentApp app = ctx.app.obj as ContentApp; ContentSetting s = app.GetSettingsObj(); String chkAutoHtml = s.IsAutoHtml == 1 ? "checked=\"checked\"" : ""; set("chkAutoHtml", chkAutoHtml); }
// 静态配置 private void setStaticPath( ContentApp app, string staticPath ) { ContentSetting setting = app.GetSettingsObj(); setting.IsAutoHtml = 1; setting.StaticPath = staticPath; setting.ArticleListMode = 1; // 摘要列表 app.Settings = Json.ToString( setting ); app.update(); }
// 静态配置 private void setStaticPath(ContentApp app, string staticPath) { ContentSetting setting = app.GetSettingsObj(); setting.IsAutoHtml = 1; setting.StaticPath = staticPath; setting.ArticleListMode = 1; // 摘要列表 app.Settings = Json.ToString(setting); app.update(); }
public virtual void SaveAutoHtml() { ContentApp app = ctx.app.obj as ContentApp; ContentSetting s = app.GetSettingsObj(); s.IsAutoHtml = ctx.PostIsCheck("IsAutoHtml"); app.Settings = Json.ToString(s); app.update(); echoToParentPart(lang("opok")); }
private bool isAutoMakeHtml(int appId) { ContentApp app = ContentApp.findById(appId); if (app == null) { return(false); } ContentSetting setting = app.GetSettingsObj(); return(setting.IsAutoHtml == 1); }
public virtual void EditHtmlPath() { target(SaveHtmlPath); ContentApp app = ctx.app.obj as ContentApp; ContentSetting s = app.GetSettingsObj(); String htmlPath = HomeMaker.GetAppPath(app.Id).TrimStart('/'); set("htmlPath", htmlPath); set("host", ctx.url.SiteAndAppPath); }
public override void Layout() { ContentApp app = ctx.app.obj as ContentApp; set("allPostsLink", to(new Common.PostController().List, 0)); set("trashPostsLink", to(new Common.PostController().Trash)); set("settingLink", to(new SettingController().Index)); set("defaultLink", to(new ContentController().Home)); set("commentLink", to(new CommentController().List)); IBlock htmlBlock = getBlock("html"); if (ctx.owner.obj is Site) { htmlBlock.Set("staticLink", to(new HtmlController().Index)); htmlBlock.Next(); } if (app.GetSettingsObj().EnableSubmit == 1) { String slnk = string.Format("<li style=\"width:100px;\"><a href=\"{0}\" class=\"frmLink\" loadTo=\"adminPortalContainer\" nolayout=3>{1}</a><span></span></li>", to(new SubmitSettingController().List), "投递员管理"); set("submitterLink", slnk); } else { set("submitterLink", ""); } String appStyle = app.Style == null ? "" : app.Style.Replace("display:none;", ""); String skinStyle = app.SkinStyle == null ? "" : app.SkinStyle.Replace("display:none;", ""); set("app.Style", appStyle); set("app.SkinStyle", skinStyle); StringBuilder sb = new StringBuilder(); if (ctx.owner.obj is Site) { //sb.AppendLine( "#adminPortalContainer {width: 1000px;}" ); //sb.AppendLine( "#portalAdminNav,#portalAdminNavWrap,.tabMain {width:1030px;}" ); //sb.AppendLine( "#toggleSidebar { display:none;}" ); sb.AppendLine("#adminPortalContainer {width: 100%;}"); sb.AppendLine("#portalAdminNav,#portalAdminNavWrap,.tabMain {width:100%;}"); sb.AppendLine("#toggleSidebar { display:none;}"); } set("portalWrapCss", sb); }
private void loadComment(ContentPost post) { ContentApp app = ctx.app.obj as ContentApp; if (post.CommentCondition == CommentCondition.Close || app.GetSettingsObj().AllowComment == 0) { set("commentSection", ""); return; } ctx.SetItem("createAction", to(new ContentCommentController().Create, post.Id)); ctx.SetItem("commentTarget", post); load("commentSection", new ContentCommentController().ListAndForm); }
public void List(int sectionId) { ContentSection section = ctx.Get <ContentSection>(); ContentApp app = ctx.app.obj as ContentApp; ContentSetting s = app.GetSettingsObj(); DataPage <ContentPost> posts = postService.GetPageBySection(sectionId, s.ListPostPerPage); bindListCommon(sectionId, section, s, posts); Boolean isMakeHtml = HtmlHelper.IsMakeHtml(ctx); String listLink = clink.toSection(sectionId, ctx); set("page", posts.GetPageBar(listLink, isMakeHtml)); }
public override void CheckPermission() { ContentApp app = ctx.app.obj as ContentApp; if (app.GetSettingsObj().EnableSubmit == 0) { echo("对不起,尚未开放投递功能"); return; } if (ctx.viewer.IsLogin == false) { redirectUrl(t2(new MainController().Login) + "?returnUrl=" + ctx.url.EncodeUrl); } }
public void EditHtmlDir() { target(SaveHtmlDir); ContentApp app = ctx.app.obj as ContentApp; ContentSetting s = app.GetSettingsObj(); String htmlDir = HomeMaker.GetlAppDirName(app.Id); htmlDir = htmlDir.TrimStart('/').TrimEnd('/'); set("htmlDir", htmlDir); set("host", ctx.url.SiteAndAppPath); }
public override void CheckPermission() { if (ctx.viewer.IsLogin == false) { redirectLogin(); return; } ContentApp app = ctx.app.obj as ContentApp; if (app.GetSettingsObj().EnableSubmit == 0) { echo("对不起,尚未开放投递功能"); return; } }
public void Index() { ContentApp app = ctx.app.obj as ContentApp; ContentSetting s = app.GetSettingsObj(); List <ContentPost> posts = postService.GetRankPost(ctx.app.Id, s.RankPosts, PostCategory.Post); bindPosts(posts, "list"); List <ContentPost> imgs = postService.GetRankPost(ctx.app.Id, s.RankPics, PostCategory.Img); bindImgs(imgs, "img"); List <ContentPost> videos = postService.GetRankPost(ctx.app.Id, s.RankVideos, PostCategory.Video); bindVideos(videos, "video"); }
public void Save() { ContentApp app = ctx.app.obj as ContentApp; ContentSetting s = ctx.PostValue(app.GetSettingsObj()) as ContentSetting; s.AllowComment = ctx.PostIsCheck("contentSetting.AllowComment"); s.AllowAnonymousComment = ctx.PostIsCheck("contentSetting.AllowAnonymousComment"); s.EnableSubmit = ctx.PostIsCheck("contentSetting.EnableSubmit"); s.MetaDescription = strUtil.CutString(s.MetaDescription, 500); app.Settings = Json.ToString(s); app.update(); echoRedirect(lang("opok")); }
public virtual void List(long sectionId) { ContentSection section = sectionService.GetById(sectionId, ctx.app.Id); if (section == null) { echoRedirect(lang("exDataNotFound")); return; } Page.Title = section.Title; ContentApp app = ctx.app.obj as ContentApp; ContentSetting s = app.GetSettingsObj(); DataPage <ContentPost> posts = postService.GetPageBySectionAndCategory(section.Id, ctx.GetLong("categoryId"), s.ListVideoPerPage); bindPosts(section, posts); }
public static Boolean CanHtml(MvcContext ctx) { if (ctx.owner == null || ctx.owner.obj == null) { return(false); } // 只限网站使用 if (ctx.owner.obj.GetType() != typeof(Site)) { return(false); } // 是否需要自动生成 ContentApp app = ctx.app.obj as ContentApp; ContentSetting setting = app.GetSettingsObj(); return(setting.IsAutoHtml == 1); }
public override void Layout() { ContentApp app = ctx.app.obj as ContentApp; ContentSetting s = app.GetSettingsObj(); List <ContentPost> posts = postService.GetRankPost(ctx.app.Id, s.RankPosts, PostCategory.Post); bindPosts(posts, "list"); List <ContentPost> imgs = postService.GetRankPost(ctx.app.Id, s.RankPics, PostCategory.Img); bindImgs(imgs, "img"); List <ContentPost> videos = postService.GetRankPost(ctx.app.Id, s.RankVideos, PostCategory.Video); bindVideos(videos, "video"); set("adSidebarTop", AdItem.GetAdById(AdCategory.ArticleSidebarTop)); set("adSidebarBottom", AdItem.GetAdById(AdCategory.ArticleSidebarBottom)); }
public void Index() { ContentApp app = ctx.app.obj as ContentApp; ContentSetting setting = app.GetSettingsObj(); if (setting.CacheSeconds > 0) { String content = loadFromCache(); if (strUtil.IsNullOrEmpty(content)) { content = loadHtml(IndexPage); SysCache.Put(getKey(), content, setting.CacheSeconds); } actionContent(content); } else { run(IndexPage); } }
public void List(int sectionId) { ContentSection section = sectionService.GetById(sectionId, ctx.app.Id); if (section == null) { echoRedirect(lang("exDataNotFound")); return; } Page.Title = section.Title; ContentApp app = ctx.app.obj as ContentApp; ContentSetting s = app.GetSettingsObj(); String cpLink = clink.toSection(sectionId, ctx); Boolean isMakeHtml = HtmlHelper.IsMakeHtml(ctx); DataPage <ContentPost> posts = postService.GetPageBySection(sectionId, s.ListPostPerPage); set("page", posts.GetPageBar(cpLink, isMakeHtml)); bindPosts(section, posts); }
public void List(int sectionId) { ContentSection section = sectionService.GetById(sectionId, ctx.app.Id); if (section == null) { echoRedirect(lang("exDataNotFound")); return; } Page.Title = section.Title; ContentApp app = ctx.app.obj as ContentApp; ContentSetting s = app.GetSettingsObj(); if (s.ArticleListMode == ArticleListMode.Summary) { view("ListSummary"); } DataPage <ContentPost> posts = postService.GetBySectionAndCategory(section.Id, ctx.GetInt("categoryId"), s.ListPostPerPage); bindPostList(section, posts, s); }
private void bindHtmlSetting() { ContentApp app = ctx.app.obj as ContentApp; ContentSetting s = app.GetSettingsObj(); String htmlPath = HomeMaker.GetAppPath(app.Id); htmlPath = htmlPath.TrimStart('/').TrimEnd('/'); set("htmlPath", htmlPath); set("host", ctx.url.SiteAndAppPath); set("editHtmlDirLink", to(EditHtmlPath)); String lnkHtmlHome = strUtil.Join(ctx.url.SiteAndAppPath, htmlPath); set("lnkHtmlHome", lnkHtmlHome); set("lnkOriginalHome", alink.ToApp(app)); String chkAutoHtml = s.IsAutoHtml == 1 ? "checked=\"checked\"" : ""; set("chkAutoHtml", chkAutoHtml); set("lnkEditAutoHtml", to(EditAutoHtml)); }