private void bindPickedList(IList serviceData, IBlock block) { for (int i = 1; i < serviceData.Count; i++) { ContentPost post = serviceData[i] as ContentPost; IPageAdminSection sectionController = BinderUtils.GetPageSectionAdmin(post, ctx, "AdminSectionShow"); String typeIcon = sectionController.GetSectionIcon(post.SectionId); String attIcon = post.Attachments > 0 ? BinderUtils.iconAttachment : ""; if (strUtil.HasText(post.TitleHome)) { block.Set("post.Title", post.TitleHome); } else { block.Set("post.Title", post.Title); } block.Set("post.Url", alink.ToAppData(post, ctx)); block.Set("post.DataIcon", typeIcon); block.Set("post.AttachmentIcon", attIcon); block.Set("post.Created", post.Created.ToShortDateString()); block.Next(); } }
private String bindData(IBlock sectionBlock, ContentSection articleSection) { IPageAdminSection section = BinderUtils.GetPageSectionAdmin(articleSection, ctx, "AdminSectionShow"); ControllerBase controller = section as ControllerBase; bindSettingLink(sectionBlock, section.GetSettingLink(articleSection.Id)); section.AdminSectionShow(articleSection.Id); return(controller.utils.getActionResult()); }
// TODO //private void makeHtml( String ids ) { // List<ContentPost> posts = postService.GetByIds( ids ); // foreach (ContentPost post in posts) { // HtmlHelper.SetCurrentPost( ctx, post ); // HtmlHelper.DeleteDetailHtml( ctx ); // int sectionId = post.PageSection.Id; // int recordCount = postService.CountBySection( sectionId ); // new HtmlListMaker().MakeHtml( ctx, sectionId, recordCount ); // } //} private void bindAdminList(DataPage <ContentPost> posts, bool isTrash) { IBlock block = getBlock("list"); foreach (ContentPost post in posts.Results) { IPageAdminSection sectionController = BinderUtils.GetPageSectionAdmin(post, ctx, "AdminSectionShow"); String typeIcon = BinderUtils.getTypeIcon(sectionController, post); String pickIcon = BinderUtils.getPickedIcon(post); String attIcon = post.Attachments > 0 ? BinderUtils.iconAttachment : ""; block.Set("post.ImgIcon", typeIcon); block.Set("post.PickIcon", pickIcon); block.Set("post.AttachmentIcon", attIcon); block.Set("post.Title", strUtil.SubString(post.GetTitle(), 50)); block.Set("post.TitleCss", post.Style); block.Set("post.TitleFull", post.Title); block.Set("post.SectionName", post.SectionName); block.Set("post.Url", post.SourceLink); block.Set("post.Link", alink.ToAppData(post)); block.Set("post.PubDate", post.Created); if (post.Creator != null) { block.Set("post.Submitter", string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", toUser(post.Creator), post.Creator.Name)); } else { block.Set("post.Submitter", "无"); } block.Bind("post", post); String lnkEdit = isTrash ? "#" : sectionController.GetEditLink(post.Id); String lnkDelete = to(Delete, post.Id); if (isTrash) { lnkDelete = to(DeleteSys, post.Id); } block.Set("post.EditUrl", lnkEdit); block.Set("post.DeleteUrl", lnkDelete); block.Set("post.RestoreUrl", to(Restore, post.Id)); block.Set("post.EditTitleStyleUrl", to(EditTitleStyle, post.Id)); block.Set("post.AttachmentLink", to(new AttachmentController().AdminList, post.Id)); block.Next(); } set("page", posts.PageBar); }