void Subject(String model, UISection ui, UMC.Data.Entities.Subject sub, Project project, bool isEditer) { var webr = UMC.Data.WebResource.Instance(); var user = UMC.Security.Identity.Current; if (project != null) { bool isIsAttention; var attent = new UMC.Web.WebMeta().Put("desc", project.Description ?? "未写描述", "name", project.Caption) .Put("src", webr.ImageResolve(project.Id.Value, "1", 4)); var desc2 = UICell.Create("IconNameDesc", attent); if (model == "Subject") { attent.Put("button", SubjectAttentionActivity.Attention(sub.project_id.Value, out isIsAttention)) .Put("button-click", Web.UIClick.Click(new Web.UIClick("Id", project.Id.ToString()) { Model = model, Command = "Attention" })) .Put("button-color", isIsAttention ? "#25b864" : "#e67979"); desc2.Format.Put("button", "{button}"); if (isIsAttention == false) { desc2.Style.Fixed(); } } attent.Put("click", new Web.UIClick("Id", project.Id.ToString()) { Model = model, Command = "ProjectUI" }); desc2.Style.Name("desc", new UIStyle().Color(0x999)).Name("name", new UIStyle().Bold()); desc2.Style.Name("border", "none"); ui.Title.Name("text", project.Caption); ui.Title.Name("src", webr.ImageResolve(project.Id.Value, "1", 4)); ui.Add(desc2); if (user.IsAuthenticated) { UMC.Data.Database.Instance().ObjectEntity <UMC.Data.Entities.ProjectAccess>() .Where.And().Equal(new UMC.Data.Entities.ProjectAccess { user_id = user.Id, sub_id = sub.Id }) .Entities.IFF(e => e.Update("{0}+{1}", new UMC.Data.Entities.ProjectAccess { Times = 1 } , new UMC.Data.Entities.ProjectAccess { LastAccessTime = DateTime.Now }) == 0, e => e.Insert(new UMC.Data.Entities.ProjectAccess { CreationTime = DateTime.Now, Times = 1, LastAccessTime = DateTime.Now, sub_id = sub.Id, user_id = user.Id })); } } var celss = UMC.Data.JSON.Deserialize <WebMeta[]>((String.IsNullOrEmpty(sub.DataJSON) ? "[]" : sub.DataJSON)) ?? new UMC.Web.WebMeta[] { }; foreach (var pom in celss) { switch (pom["_CellName"]) { case "CMSImage": { var value = pom.GetDictionary()["value"] as Hashtable; if (value != null && value.ContainsKey("size")) { value.Remove("size"); } pom.Put("style", new UIStyle().Padding(0, 10)); } break; case "CMSCode": { var value = pom.GetDictionary()["value"] as Hashtable; if (value != null && value.ContainsKey("code")) { var code = value["code"] as string; var type = value["type"] as string; if (String.IsNullOrEmpty(code) == false) { var cell = Data.Markdown.Highlight(code, type); pom.Put("value", cell.Data); pom.Put("format", cell.Format); pom.Put("style", cell.Style); } } } break; } } ui.AddCells(celss);; var cateData = new UMC.Web.WebMeta().Put("icon", "\uf02c", "name", sub.Poster).Put("look", (sub.Look ?? 0) + "").Put("Reply", (sub.Reply ?? 0) + ""); var footer2 = new UIButton(cateData); footer2.Title("{icon} {name} | 阅读({look}) | 评论({Reply})"); footer2.Style.Color(0x999).Size(14).Name("icon", new UIStyle().Font("wdk")); ui.Add(footer2); if (project != null && isEditer) { ui.Title.Name("Editer", "OK"); if (this.Context.Request.IsApp) { footer2.Button(new UIEventText("编辑图文").Style(new UIStyle().Color(0x3F51B5).Name("border", "none")).Click(new UIClick(sub.Id.ToString()) { Model = model, Command = "EditUI" })); } } }