void Sliders(Design_Item parent, List <Design_Item> baners, UISection U) { if (baners.Count > 0) { WebMeta config = UMC.Data.JSON.Deserialize <WebMeta>(parent.Data) ?? new UMC.Web.WebMeta(); UICell slider2 = UISlider.Create(Sliders(parent.Id.Value, baners)); int[] paddings = UIStyle.Padding(config); if (paddings.Length > 0) { slider2.Style.Padding(paddings); } U.Add(slider2); } else if (_editer) { UIDesc desc = new UIDesc("\ue907"); desc.Click(new UIClick(parent.Id.ToString()) .Send("Design", "Item")); desc.Desc("{desc}\r\n配置横幅栏"); desc.Style.AlignCenter().Name("desc", new UIStyle().Font("wdk").Size(38)); U.Add(desc); } }
void Items(Design_Item parent, List <Design_Item> baners, UISection U) { Guid parentId = parent.Id.Value; //List<UIItem> list = new List<UIItem>(); var item = new UIItems(); UMC.Data.WebResource webr = UMC.Data.WebResource.Instance(); for (int i = 0; i < baners.Count && i < 4; i++) { Design_Item b = baners[i]; WebMeta icon = UMC.Data.JSON.Deserialize <WebMeta>(b.Data) ?? new UMC.Web.WebMeta(); item.Add(icon); icon.Put("click", this.Click(b)); String t = "100"; switch (baners.Count) { case 1: t = "4-1"; break; case 2: t = "2-1"; break; case 3: if (i == 0) { t = "2-1"; } break; } icon.Put("src", String.Format("{0}!{1}?{2}", webr.ImageResolve(b.Id.Value, "1", 0), t, TimeSpan(b.ModifiedDate))); //list.Add(slider); } if (item.Count > 0) { U.Add(item); } else if (_editer) { ; UIDesc desc = new UIDesc("\ue907"); desc.Desc("{desc}\r\n配置分块栏"); desc.Style.AlignCenter().Name("desc", new UIStyle().Font("wdk").Size(38).Click(new UIClick(parentId.ToString()) .Send("Design", "Item"))); U.Add(desc); } }
// void Sliders(Design_Item parent, List <Design_Item> baners, UISection U) { if (baners.Count > 0) { WebMeta config = UMC.Data.JSON.Deserialize <WebMeta>(parent.Data) ?? new UMC.Web.WebMeta(); var type = config["type"]; var sType = "slider"; var slider2 = new UISlider(config.ContainsKey("auto")); switch (type) { case "Small": slider2.Small(); sType = "4-1"; break; case "Square": slider2.Square(); sType = "350"; break; default: type = "slider"; break; } Sliders(slider2, parent.Id.Value, sType, baners); int[] paddings = UIStyle.Padding(config); if (paddings.Length > 0) { slider2.Style.Padding(paddings); } U.Add(slider2); } else if (_editer) { UIDesc desc = new UIDesc("\ue907"); desc.Click(new UIClick(parent.Id.ToString()) .Send("Design", "Item")); desc.Desc("{desc}\r\n配置横幅栏"); desc.Style.AlignCenter().Name("desc", new UIStyle().Font("wdk").Size(38)); U.Add(desc); } }
void Icons(Guid parentId, List <Design_Item> baners, UISection U) { List <UIEventText> list = new List <UIEventText>(); UMC.Data.WebResource webr = UMC.Data.WebResource.Instance(); foreach (Design_Item b in baners) { UIEventText slider = new UIEventText(b.ItemName); if (String.IsNullOrEmpty(b.Data) == false) { WebMeta s = UMC.Data.JSON.Deserialize <WebMeta>(b.Data); slider.Icon(s.Get("icon"), s.Get("color")); } else { slider.Src(webr.ImageResolve(b.Id.Value, "1", 4) + "?" + TimeSpan(b.ModifiedDate)); } slider.Click(this.Click(b)); list.Add(slider); } if (list.Count > 0) { var ic = new UMC.Web.UI.UIIcon(); ic.Style.Name("icon", new UIStyle().Font("wdk").Size(24)); ic.Add(list.ToArray()); //U.AddIcon(new UIStyle().Name("icon", new UIStyle().Font("wdk").Size(24)), list.ToArray()); } else if (_editer) { UIDesc desc = new UIDesc("\ue907"); desc.Desc("{desc}\r\n配置图标栏"); desc.Click(new UIClick(parentId.ToString()) .Send("Design", "Item")); desc.Style.AlignCenter().Name("desc", new UIStyle().Font("wdk").Size(38)); U.Add(desc); } }
public override void ProcessActivity(WebRequest request, WebResponse response) { Guid designId = UMC.Data.Utility.Guid(this.AsyncDialog("Id", g => this.DialogValue(Guid.Empty.ToString()))).Value;//this.DialogValue(response.Ticket[AttributeNames.TICKET_STORE_ID])), true).Value; if (_isEditer) { WebMeta form = request.SendValues ?? request.Arguments; this.AsyncDialog("Model", anycId => { if (form.ContainsKey("limit") == false) { this.Context.Send(new UISectionBuilder(request.Model, request.Command, new WebMeta().Put("Id", designId)) .RefreshEvent("Design", "image") .Builder(), true); } var entity = Database.Instance().ObjectEntity <Design_Item>(); entity.Where.And().Equal(new Design_Item { design_id = Guid.Empty, for_id = Guid.Empty }); entity.Order.Asc(new Design_Item { Seq = 0 }); //IObjectEntity<Design_Item> entity = Database.instance().objectEntity(Design_Item.class); // entity.where().and().equal(new Design_Item().Design_id(Utility.uuidEmpty).For_id(Utility.uuidEmpty)); // entity.order().asc(new Design_Item().Seq(0)); Design_Item[] headers = entity.Query(); UISection section = UISection.Create(new UITitle("UMC")); int limit = UMC.Data.Utility.Parse(form.Get("limit"), 10); int start = UMC.Data.Utility.Parse(form.Get("start"), 0); switch (headers.Length) { case 0: break; case 1: section.Title.Title = (headers[0].ItemName); // section.title().right('\ue907', new UIClick("Id", headers[0].Id.toString(), "Model", "none").model(request.model(), request.cmd())); break; default: if (start == 0) { List <WebMeta> items = new List <WebMeta>(); foreach (Design_Item item in headers) { items.Add(new UMC.Web.WebMeta().Put("text", item.ItemName).Put("search", new WebMeta().Put("Id", item.Id))); } section.Add(UICell.Create("TabFixed", new UMC.Web.WebMeta().Put("items", items))); } break; } if (designId == Guid.Empty) { switch (headers.Length) { case 0: break; default: new UIDesigner(true).Section(section, headers[0].Id.Value); break; } } else { new UIDesigner(true).Section(section, designId); } if (section.Length == 0) { section.Add("Desc", new UMC.Web.WebMeta().Put("desc", "未有设计分类项,请添加").Put("icon", "\uEA05") , new UMC.Web.WebMeta().Put("desc", "{icon}\n{desc}"), new UIStyle().Align(1).Color(0xaaa).Padding(20, 20).BgColor(0xfff).Size(12).Name("icon", new UIStyle().Font("wdk").Size(60))); } UIFooter footer = new UIFooter(); footer.IsFixed = true;// e); switch (headers.Length) { case 0: footer.AddText(new UIEventText("添加分类项").Click(new UIClick("Model", "News", "Type", "Append").Send(request.Model, request.Command))); break; default: Guid did = designId; if (designId == Guid.Empty) { did = headers[0].Id.Value; } footer.AddIcon(new UIEventText("分类项").Icon('\uf009').Click(new UIClick("Model", "News", "Id", did.ToString()).Send(request.Model, request.Command))); footer.AddText(new UIEventText("增加UI组件").Click(new UIClick(did.ToString()).Send("Design", "Item"))); footer.AddText(new UIEventText("查看效果").Style(new UIStyle().BgColor(0xef4f4f)) .Click(new UIClick("Model", "News", "Type", "View").Send(request.Model, request.Command))); break; } section.UIFooter = (footer); response.Redirect(section); return(this.DialogValue("none")); }); String type = this.AsyncDialog("Type", g => { UIRadioDialog di = new UIRadioDialog(); di.Title = ("页面设计"); di.Options.Put("编辑分类项", "Edit"); di.Options.Put("增加分类项", "Append"); di.Options.Put("删除此分类", "Delete"); return(di); }); switch (type) { case "Edit": Design(request, designId); break; case "Append": Design(request, Guid.NewGuid()); //.randomUUID()); break; case "Delete": Delete(designId); break; case "View": if (request.IsApp) { List <WebMeta> tabs = new List <WebMeta>(); Database.Instance().ObjectEntity <Design_Item>() .Where.And().Equal(new Design_Item() { design_id = Guid.Empty, for_id = Guid.Empty }) //(Utility.uuidEmpty).For_id(Utility.uuidEmpty)) .Entities.Order.Asc(new Design_Item() { Seq = 0 }) .Entities.Query(dr => { tabs.Add(new UMC.Web.WebMeta().Put("text", dr.ItemName).Put("search", new UMC.Web.WebMeta().Put("Id", dr.Id.ToString())).Put("cmd", "Home", "model", "Design")); }); if (tabs.Count == 1) { UISectionBuilder builder = new UISectionBuilder("Design", "Home", new WebMeta().Put("Id", tabs[0].GetMeta("search").Get("Id"))); // builder.builder() this.Context.Send(builder.Builder(), true); //"Tab", new WebMeta().put("sections", tabs).put("text", "UMC界面设计"), true); } else { this.Context.Send("Tab", new WebMeta().Put("sections", tabs).Put("text", "UMC界面设计"), true); } } else { this.AsyncDialog("From", k => { UIFormDialog fm = new UMC.Web.UIFormDialog(); fm.Title = ("移动效果体验"); fm.AddImage(new Uri(UMC.Data.Utility.QRUrl("https://oss.365lu.cn/Click/Deisgn/Home/"))); fm.AddPrompt("请用支持UMC协议的APP“扫一扫”。"); return(fm); }); break; } break; } } else { if (designId == Guid.Empty) { var entity = Database.Instance().ObjectEntity <Design_Item>(); entity.Where.And().Equal(new Design_Item { design_id = Guid.Empty, for_id = Guid.Empty }); entity.Order.Asc(new Design_Item { Seq = 0 }); List <WebMeta> tabs = new List <WebMeta>(); entity.Query(dr => { tabs.Add(new UMC.Web.WebMeta().Put("text", dr.ItemName).Put("search", new UMC.Web.WebMeta().Put("Id", dr.Id)).Put("cmd", "UI", "model", "Design")); }); var chash = new Hashtable(); UITitle title = new UITitle("UMC移动界面"); title.Left('\uea0e', UIClick.Search()); title.Right(new UIEventText().Icon('\uf2c0').Click(new UIClick().Send("Account", "Info"))); chash.Add("sections", tabs); chash.Add("title", title); response.Redirect(chash); } else { UIDesigner designer = new UIDesigner(false); response.Redirect(designer.Section("", designId)); } } }
public override void ProcessActivity(WebRequest request, WebResponse response) { var ProjectId = Utility.Guid(this.AsyncDialog("Id", g => { this.Prompt("请输入项目"); return(this.DialogValue("Project")); })) ?? Guid.Empty; UISection ui = null; var project = Utility.CMS.ObjectEntity <Project>().Where.And().Equal(new Data.Entities.Project { user_id = ProjectId }).Entities.Single(); //var svs = request.SendValues ?? new UMC.Web.WebMeta(); var form = (request.SendValues ?? new UMC.Web.WebMeta()).GetDictionary(); int start = UMC.Data.Utility.IntParse(form["start"] as string, 0); var nextKey = this.AsyncDialog("NextKey", g => this.DialogValue("Header"));; if (start == 0 && String.Equals(nextKey, "Header")) { var logoUrl = UMC.Data.WebResource.Instance().ResolveUrl(String.Format("{0}{1}/1/0.jpg!200", UMC.Data.WebResource.ImageResource, project.Id)); // var mcode = "您未登录"; var members = Utility.CMS.ObjectEntity <UMC.Data.Entities.ProjectMember>() .Where.And().Equal(new Data.Entities.ProjectMember { project_id = project.Id }) .Entities.Count() + 1; var subs = Utility.CMS.ObjectEntity <Subject>().Where.And().Equal(new Data.Entities.Subject { project_id = project.Id }).Entities.Count(); //Sections.Add(cmsText); String mcode = String.Format("成员 {0} 图文 {1}", members, subs); var Discount = new UIHeader.Profile(project.Caption, mcode, logoUrl); var color = 0x63b359; Discount.Gradient(color, color); var header = new UIHeader(); var title = UITitle.Create(); title.Title = "项目介绍"; header.AddProfile(Discount, "{number}", "{amount}"); ui = UISection.Create(header, title); if (String.IsNullOrEmpty(project.Description) == false) { var cmsText = UICell.Create("CMSText", new UMC.Web.WebMeta().Put("text", project.Description)); cmsText.Style.Size(14).Color(0x999); } } else { ui = UISection.Create(); } var items = new List <WebMeta>(); items.Add(new UMC.Web.WebMeta().Put("text", "文章", "search", "Subs")); items.Add(new UMC.Web.WebMeta().Put("text", "成员", "search", "Member")); items.Add(new UMC.Web.WebMeta().Put("text", "动态", "search", "Dynamic")); int limit = UMC.Data.Utility.IntParse(form["limit"] as string, 25); var selectIndex = UMC.Data.Utility.IntParse(this.AsyncDialog("selectIndex", g => this.DialogValue("0")), 0); var webr = UMC.Data.WebResource.Instance(); switch (selectIndex) { case 0: { var subEntity = Utility.CMS.ObjectEntity <UMC.Data.Entities.Subject>(); subEntity.Order.Desc(new Subject { ReleaseDate = DateTime.Now }); subEntity.Where.And().Equal(new Data.Entities.Subject { Status = 1, IsDraught = false, project_id = project.Id }); SubjectUIActivity.Search(ui, subEntity, start, limit); response.Redirect(ui); } break; case 1: { int mlimit = limit * 4; int mstart = start * 4; var ids = new List <Guid>(); var subEntity = Utility.CMS.ObjectEntity <UMC.Data.Entities.ProjectMember>(); subEntity.Order.Desc(new ProjectMember { CreationTime = DateTime.Now }); subEntity.Query(mstart, mlimit, dr => ids.Add(dr.user_id.Value)); if (mstart == 0) { ids.Add(project.user_id.Value); } if (ids.Count > 0) { var users = new List <User>(); UMC.Data.Database.Instance().ObjectEntity <User>() .Where.And().In(new User { Id = ids[0] }, ids.ToArray()).Entities.Query(dr => users.Add(dr)); var icons = new List <UIEventText>(); foreach (var v in users) { icons.Add(new UIEventText(v.Alias).Src(webr.ResolveUrl(v.Id.Value, "1", "4"))); if (icons.Count % 4 == 0) { ui.AddIcon(icons.ToArray()); icons.Clear(); } } if (icons.Count > 0) { ui.AddIcon(icons.ToArray()); } } var m = subEntity.Count(); int total = m / 4; if (m % 4 > 0) { total++; } ui.Total = total; response.Redirect(ui); } break; case 2: { var subEntity = Utility.CMS.ObjectEntity <UMC.Data.Entities.ProjectDynamic>(); subEntity.Where.And().Equal(new ProjectDynamic { project_id = project.Id }).Entities.Order.Desc(new ProjectDynamic { Time = DateTime.MinValue }); var subs = new List <ProjectDynamic>(); var uids = new List <Guid>(); subEntity.Query(start, limit, dr => { subs.Add(dr); uids.Add(dr.user_id ?? Guid.Empty); }); var cates = new List <User>(); if (uids.Count > 0) { UMC.Data.Database.Instance().ObjectEntity <User>().Where.And().In(new User { Id = uids[0] }, uids.ToArray()) .Entities.Query(dr => cates.Add(dr)); } foreach (var sub in subs) { var sType = "成员动态"; switch (sub.Type) { case DynamicType.Member: break; case DynamicType.Portfolio: sType = "文集动态"; break; case DynamicType.Project: sType = "项目动态"; break; case DynamicType.Subject: sType = "文档动态"; break; case DynamicType.ProjectItem: sType = "栏位动态"; break; } // var user2 = cates.Find(d => d.Id == sub.user_id) ?? new User(); var data = new WebMeta().Put("alias", user2.Alias, "type", sType, "desc", sub.Explain).Put("time", sub.Time) .Put("title", sub.Title); var cell = UIImageTitleBottom.Create(webr.ResolveUrl(sub.user_id ?? Guid.Empty, "1", 5), data); cell.Format.Put("left", "{alias} {time} {desc}").Put("right", "{type}"); cell.Style.Name("image-radius", 30); ui.Add(cell); //data.Rows.Add(sub.user_id, sub.Title, sub.Explain, sub.Time, sType, webr.ResolveUrl(sub.user_id ?? Guid.Empty, "1", 5), //user2.Alias); } ui.Total = subEntity.Count(); } break; } //var appKey = UMC.Security.Principal.Current.AppKey ?? Guid.Empty; //var li = ui.NewSection();// UIClick.Pager("Member", "Order", new WebADNuke.Web.WebMeta().Put("type", "App", "selectIndex", "0")) //li.AddCell("我的订单", "查看全部", UIClick.Pager("Member", "Order", new UMC.Web.WebMeta().Put("type", "App", "selectIndex", "0"))); //li.AddCell("我的佣金", "", new Web.UIClick() { Command = "Commission", Model = "Member" }); //li.AddCell("我的收藏", new Web.UIClick() { Command = "Favs", Model = request.Model }); //li.AddCell("我的优惠券", new Web.UIClick() { Command = "Coupons", Model = "Member" }); //if (appKey == Guid.Empty) //{ // var cate = Utility.CMS.ObjectEntity<UMC.Data.Entities.Category>().Where.And().Equal(new Data.Entities.Category { user_id = user.Id }) // .Entities.Count(); // if (cate > 0) // { // li.NewSection().AddCell("我的版务", new Web.UIClick() { Command = "Apply", Model = "Subject" }); // } // li.AddCell("我的图文", new Web.UIClick() { Command = "Self", Model = "Subject" }); // li.NewSection().AddCell("积分政策", UIClick.Pager("Subject", "UIData", new UMC.Web.WebMeta().Put("Id", "Subject.Points"))); //} //else //{ //li.AddCell("我的图文", new Web.UIClick() { Command = "Self", Model = "Subject" }); //li.NewSection().AddCell("卡券分享", "被领取即可获的收益", UIClick.Pager("Corp", "Coupons")); ////} //if (request.IsApp) //{ // ui.NewSection().AddCell('\uf083', "扫一扫", "", new Web.UIClick() { Key = "Scanning" }); // //.AddCell('\uf0c5', "软文转码", "将检测粘贴板", new Web.UIClick() { Key = "CaseCMS" }); // ui.NewSection() // //.AddCell('\uf19c', "切换企业", "", Web.UIClick.Pager("Platform", "Corp", true)) // .AddCell('\uf013', "设置", "", Web.UIClick.Pager("UI", "Setting", true, "Close")); //} //else //{ // ui.NewSection() // .AddCell('\uf013', "设置", "", Web.UIClick.Pager("UI", "Setting", true, "Close")); //} response.Redirect(ui); //} }
private UISection Section(UISection Us, List <Design_Item> items) { List <Design_Item> groups = items.FindAll(g => g.for_id == Guid.Empty); Design_Item b = groups.Find(g => g.Type == StoreDesignTypeBanners); if (b != null) { Sliders(b, items.FindAll(it => it.for_id == b.Id), Us); } if (b != null) { groups.Remove(b); } foreach (Design_Item bp in groups) { UISection use = Us; if (Us.Length > 0) { use = Us.NewSection(); } switch (bp.Type ?? 0) { case StoreDesignTypeBanners: Sliders(bp, items.FindAll(it => it.for_id == bp.Id), use); break; case StoreDesignTypeIcons: //Icons(bp.Id, Utility.findAll(items, it->it.for_id.compareTo(bp.Id) == 0), use); Icons(bp.Id.Value, items.FindAll(it => it.for_id == bp.Id), use); break; case StoreDesignTypeItems: //Items(bp, Utility.findAll(items, it->it.for_id.compareTo(bp.Id) == 0), use); Items(bp, items.FindAll(it => it.for_id == bp.Id), use); break; case StoreDesignTypeTitleDesc: //TitleDesc(bp, Utility.findAll(items, it->it.for_id.compareTo(bp.Id) == 0), use); TitleDesc(bp, items.FindAll(it => it.for_id == bp.Id), use); break; case StoreDesignTypeProducts: case StoreDesignTypeDiscounts: break; case StoreDesignTypeCaption: //WebMeta config = Utility.isNull(UMC.Data.JSON.deserialize(bp.Data, WebMeta), new UMC.Web.WebMeta()); WebMeta config = UMC.Data.JSON.Deserialize <WebMeta>(bp.Data) ?? new UMC.Web.WebMeta(); if ("Hide".Equals(config.Get("Show"))) { if (_editer) { UITitleMore more = new UITitleMore(bp.ItemName).More("已隐藏{3:more}"); more.Style.Name("more", new UIStyle().Color(0xc00)); use.Add(more.Click(this.Click(bp))); } } else { UITitleMore more = new UITitleMore(bp.ItemName).Click(this.Click(bp)); more.Style.Padding(UIStyle.Padding(config)); use.Add(more); } List <Design_Item> groups2 = items.FindAll(it => it.for_id == (bp.Id)); // items.FindAll(it = > it.for_id == bp.Id); foreach (Design_Item bp2 in groups2) { switch (bp2.Type) { case StoreDesignTypeBanners: Sliders(bp2, items.FindAll(it => it.for_id == (bp2.Id)), use); break; case StoreDesignTypeIcons: //Icons(bp2.Id, Utility.findAll(items, it->it.for_id.compareTo(bp2.Id) == 0), use); Icons(bp2.Id.Value, items.FindAll(it => it.for_id == (bp2.Id)), use); break; case StoreDesignTypeItems: //Items(bp2, Utility.findAll(items, it->it.for_id.compareTo(bp2.Id) == 0), use); Items(bp2, items.FindAll(it => it.for_id == (bp2.Id)), use); break; case StoreDesignTypeTitleDesc: //TitleDesc(bp2, Utility.findAll(items, it->it.for_id.compareTo(bp2.Id) == 0), use); TitleDesc(bp2, items.FindAll(it => it.for_id == (bp2.Id)), use); break; } } break; } } return(Us); }
void TitleDesc(Design_Item parent, List <Design_Item> items, UISection U) { UMC.Data.WebResource webr = UMC.Data.WebResource.Instance(); //WebMeta config = Utility.isNull(UMC.Data.JSON.deserialize(parent.Data, WebMeta.class), new UMC.Web.WebMeta()); WebMeta config = UMC.Data.JSON.Deserialize <WebMeta>(parent.Data) ?? new UMC.Web.WebMeta(); int rows = UMC.Data.Utility.IntParse(config.Get("Total"), 1); if (rows <= 1) { int[] padding = UIStyle.Padding(config); foreach (Design_Item i in items) { UICell tdesc = this.TitleDesc(config, i, "cms1", webr); if (padding.Length > 0) { tdesc.Style.Padding(padding); } U.Add(tdesc); } } else { int m = 0; String hide = config.Get("Hide") ?? ""; if (hide.Contains("HideTitle")) { m |= 1; } if (hide.Contains("HideDesc")) { m |= 2; } if (hide.Contains("HideLeft")) { m |= 4; } if (hide.Contains("HideRight")) { m |= 8; } int len = items.Count; for (int i = 0; (i + rows - 1) < len; i = i + rows) { List <WebMeta> ls = new List <WebMeta>();//<>(); for (int c = 0; c < rows; c++) { UICell p = TitleDesc(config, items[i + c], "350", webr); ls.Add(new UMC.Web.WebMeta().Put("value", p.Data).Put("format", p.Format).Put("style", p.Style)); } UICell desc = UICell.Create("ItemsTitleDesc", new UMC.Web.WebMeta().Put("items", ls.ToArray()).Put("total", rows).Put("show", m)); int[] paddings = UIStyle.Padding(config); if (paddings.Length > 0) { desc.Style.Padding(paddings); } U.Add(desc); } int total = len % rows; if (total > 0) { List <WebMeta> ls = new List <WebMeta>(); for (int c = total; c > 0; c--) { UICell p = TitleDesc(config, items[len - c], "350", webr); ls.Add(new UMC.Web.WebMeta().Put("value", p.Data).Put("format", p.Format).Put("style", p.Style)); } UICell desc = UICell.Create("ItemsTitleDesc", new UMC.Web.WebMeta().Put("items", ls.ToArray()).Put("total", rows).Put("show", m)); int[] paddings = UIStyle.Padding(config); if (paddings.Length > 0) { desc.Style.Padding(paddings); } U.Add(desc); } } if (items.Count == 0 && _editer) { UIDesc desc = new UIDesc("\ue907"); desc.Desc("{desc}\r\n配置图文栏"); desc.Style.AlignCenter().Name("desc", new UIStyle().Font("wdk").Size(38).Click(new UIClick(parent.Id.ToString()) .Send("Design", "Item"))); U.Add(desc); } }
public override void ProcessActivity(WebRequest request, WebResponse response) { var ProjectId = Utility.Guid(this.AsyncDialog("Id", g => { this.Prompt("请输入项目"); return(this.DialogValue("Project")); })) ?? Guid.Empty; var project = Utility.CMS.ObjectEntity <Project>().Where.And().Equal(new Data.Entities.Project { Id = ProjectId }).Entities.Single(); var Model = this.AsyncDialog("Model", ml => { if (project == null) { return(this.DialogValue("News")); } var form = (request.SendValues ?? new UMC.Web.WebMeta()).GetDictionary(); if (form.ContainsKey("start") == false) { if (request.IsApp) { var buider = new UISectionBuilder(request.Model, request.Command, request.Arguments); this.Context.Send(buider.Builder(), true); } else { if (request.Url.Query.Contains("_v=Sub")) { this.Context.Send("Subject.Path", new WebMeta().Put("Path", project.Code), true); } else { var buider = new UISectionBuilder(request.Model, request.Command, request.Arguments); this.Context.Send(buider.Builder(), true); } } } var webr = UMC.Data.WebResource.Instance(); UISection ui = null; UISection ui2 = null; var selectIndex = UMC.Data.Utility.IntParse(this.AsyncDialog("selectIndex", g => this.DialogValue("0")), 0); var items = new List <WebMeta>();// items.Add(new UMC.Web.WebMeta().Put("text", "团队成员", "search", "Member", "Key", "List")); items.Add(new UMC.Web.WebMeta().Put("text", "文档资讯", "search", "Subs", "Key", "List")); items.Add(new UMC.Web.WebMeta().Put("text", "项目动态", "search", "Dynamic", "Key", "List")); var Keyword = (form["Keyword"] as string ?? String.Empty); if (String.IsNullOrEmpty(Keyword) && selectIndex > -1) { Keyword = items[selectIndex]["search"]; } int start = UMC.Data.Utility.IntParse(form["start"] as string, 0); var nextKey = this.AsyncDialog("NextKey", g => this.DialogValue("Header"));; if (start == 0 && String.Equals(nextKey, "Header")) { ; var logoUrl = webr.ResolveUrl(project.Id.Value, "1", 4); var members = Utility.CMS.ObjectEntity <UMC.Data.Entities.ProjectMember>() .Where.And().Equal(new Data.Entities.ProjectMember { project_id = project.Id }) .Entities.Count() + 1; var suject = Utility.CMS.ObjectEntity <Subject>() .Where.And().Equal(new Subject { project_id = project.Id }) .Entities.GroupBy().Sum(new Subject { Reply = 0 }) .Sum(new Subject { Look = 0 }).Count(new Subject { Seq = 0 }).Single(); var Discount = new UIHeader.Portrait(logoUrl); Discount.Value(project.Caption); Discount.Time(project.Description); var color = 0x63b359; Discount.Gradient(color, color); var header = new UIHeader(); var title = UITitle.Create(); title.Title = "项目介绍"; title.Style.BgColor(color); title.Style.Color(0xfff); header.AddPortrait(Discount); ui = UISection.Create(header, title); bool isIsAttention; UIIconNameDesc uIIcon = new UIIconNameDesc(); // uIIcon.Put("icon", '\uF0c0').Put("color", "#40c9c6").Put("name", "团队规模").Put("desc", members + "人"); if (request.Model == "Subject") { uIIcon.Button(SubjectAttentionActivity.Attention(project.Id.Value, out isIsAttention), Web.UIClick.Click(new Web.UIClick("Id", project.Id.ToString()) { Model = request.Model, Command = "ProjectAtten" }), isIsAttention ? 0x25b864 : 0xe67979); } ui.Add(uIIcon); uIIcon = new UIIconNameDesc(new UIIconNameDesc.Item('\uF02d', "文章数量", suject.Seq + "篇").Color(0x36a3f7), new UIIconNameDesc.Item('\uf06e', "浏览总数", suject.Look + "次").Color(0x34bfa3)); ui.Add(uIIcon); ui2 = ui.NewSection(); } else { ui2 = ui = UISection.Create(); } if (start == 0 && String.Equals(nextKey, "Self") == false) { if (selectIndex > 0) { ui2.Add(UICell.Create("TabFixed", new UMC.Web.WebMeta().Put("items", items).Put("selectIndex", selectIndex))); } else { ui2.Add(UICell.Create("TabFixed", new UMC.Web.WebMeta().Put("items", items)));; } } ui2.Key = "List"; int limit = UMC.Data.Utility.IntParse(form["limit"] as string, 25); switch (Keyword) { default: case "Subs": { var Type = this.AsyncDialog("Type", "Items"); var itemId = Utility.Guid(this.AsyncDialog("CId", project.Id.ToString())); switch (Type) { case "Items": { var subs = new List <Subject>(); Utility.CMS.ObjectEntity <Subject>().Where.And().In(new Subject { project_id = project.Id }).Entities .GroupBy(new Subject { project_item_id = Guid.Empty }) .Count(new Subject { Look = 0 }) .Query(dr => subs.Add(dr)); var projects = new List <ProjectItem>(); var projectEntity = Utility.CMS.ObjectEntity <ProjectItem>(); projectEntity.Where.And().In(new ProjectItem { project_id = project.Id }); projectEntity.Order.Asc(new ProjectItem { Sequence = 0 }); projectEntity.Query(dr => { var su = subs.Find(s => s.project_item_id == dr.Id); ui2.AddCell('\uf022', dr.Caption, String.Format("{0}篇", su == null ? 0 : su.Look) , new UIClick(new WebMeta().Put("key", "List").Put("send", new WebMeta().Put("CId", dr.Id).Put("Type", "Portfolio"))) { Key = "Query" }); }); } break; case "Portfolio": { var subs = new List <Subject>(); Utility.CMS.ObjectEntity <Subject>().Where.And().In(new Subject { project_item_id = itemId }).Entities .GroupBy(new Subject { portfolio_id = Guid.Empty }) .Count(new Subject { Look = 0 }) .Query(dr => subs.Add(dr)); var item = Utility.CMS.ObjectEntity <ProjectItem>().Where.And().In(new ProjectItem { Id = itemId }).Entities.Single(); var navData = new WebMeta().Put("item", item.Caption).Put("Icon", '\uf022'); navData.Put("nav", "目录"); navData.Put("split", '\uf105'); var cell = UICell.Create("UI", navData); cell.Style.Name("nav").Click(new UIClick(new WebMeta().Put("key", "List").Put("send", new WebMeta().Put("CId", item.project_id).Put("Type", "Items"))) { Key = "Query" }).Color(0x36a3f7); cell.Style.Name("item").Color(0x999); cell.Format.Put("text", "{nav} {split} {item}"); cell.Style.Name("split").Font("wdk"); ui2.Add(cell); Utility.CMS.ObjectEntity <Portfolio>().Where.And().Equal(new Portfolio { project_item_id = item.Id }).Entities .Order.Asc(new Portfolio { Sequence = 0 }).Entities .Query(dr => { var su = subs.Find(s => s.portfolio_id == dr.Id); ui2.AddCell('\uf22b', dr.Caption, String.Format("{0}篇", su == null ? 0 : su.Look) , new UIClick(new WebMeta().Put("key", "List").Put("send", new WebMeta().Put("CId", dr.Id).Put("Type", "Subs"))) { Key = "Query" }); }); } break; case "Subs": { var ui3 = ui2; if (start == 0) { var portfolio = Utility.CMS.ObjectEntity <Portfolio>().Where.And().In(new Portfolio { Id = itemId }).Entities.Single(); var item = Utility.CMS.ObjectEntity <ProjectItem>() .Where.And().In(new ProjectItem { Id = portfolio.project_item_id }).Entities.Single(); var navData = new WebMeta().Put("item", item.Caption).Put("Icon", '\uf022'); navData.Put("nav", "目录"); navData.Put("split", '\uf105'); navData.Put("port", portfolio.Caption); var cell = UICell.Create("UI", navData); cell.Style.Name("nav").Click(new UIClick(new WebMeta().Put("key", "List").Put("send", new WebMeta().Put("CId", item.project_id).Put("Type", "Items"))) { Key = "Query" }).Color(0x36a3f7); cell.Style.Name("item").Color(0x36a3f7).Click(new UIClick(new WebMeta().Put("key", "List").Put("send", new WebMeta().Put("CId", item.Id).Put("Type", "Portfolio"))) { Key = "Query" }); cell.Format.Put("text", "{nav} {split} {item} {split} {port}"); cell.Style.Name("port").Color(0x999); cell.Style.Name("split").Font("wdk"); ui2.Add(cell); ui3 = ui2.NewSection(); } ui3.Key = "Subs"; var subEntity = Utility.CMS.ObjectEntity <UMC.Data.Entities.Subject>(); subEntity.Order.Desc(new Subject { ReleaseDate = DateTime.Now }); subEntity.Where.And().Equal(new Data.Entities.Subject { Status = 1, portfolio_id = itemId }).And().Greater(new Subject { Status = 0, Visible = -1 }); SubjectUIActivity.Search(request.Model, ui3, subEntity, start, limit); if (ui3.Total == 0) { ui3.Add("Desc", new UMC.Web.WebMeta().Put("desc", "尚未有发布的项目资讯").Put("icon", "\uF016") , new UMC.Web.WebMeta().Put("desc", "{icon}\n{desc}"), new UIStyle().Align(1).Color(0xaaa).Padding(20, 20).BgColor(0xfff).Size(12).Name("icon", new UIStyle().Font("wdk").Size(60))); } } break; } } break; case "Member": { var style = new UIStyle().AlignLeft(); int mlimit = limit * 4; int mstart = start * 4; var ids = new List <Guid>(); var subEntity = Utility.CMS.ObjectEntity <UMC.Data.Entities.ProjectMember>(); subEntity.Where.And().Equal(new ProjectMember { project_id = project.Id }); subEntity.Order.Desc(new ProjectMember { CreationTime = DateTime.Now }); var wids = new List <Guid>(); var pms = new List <ProjectMember>(); if (mstart == 0) { ids.Add(project.user_id.Value); subEntity.Where.And().In(new ProjectMember { AuthType = WebAuthType.Admin }, WebAuthType.User) .And().Unequal(new ProjectMember { user_id = project.user_id }).Entities.Order.Desc(new ProjectMember { AuthType = 0 }); subEntity.Query(dr => { pms.Add(dr); ids.Add(dr.user_id.Value); }); wids.AddRange(ids); } subEntity.Where.Reset().And().Equal(new ProjectMember { project_id = project.Id, AuthType = WebAuthType.Guest }); subEntity.Query(mstart, mlimit, dr => ids.Add(dr.user_id.Value)); if (ids.Count > 0) { var users = new List <User>(); Utility.CMS.ObjectEntity <User>() .Where.And().In(new User { Id = ids[0] }, ids.ToArray()).Entities.Query(dr => users.Add(dr)); if (wids.Count > 0) { var puser = users.Find(u => u.Id == project.user_id) ?? new User { Alias = "未知", Id = project.user_id }; ui2.Add(new UIIconNameDesc(new UIIconNameDesc.Item(webr.ResolveUrl(puser.Id.Value, "1", "4"), puser.Alias, "创立于" + Utility.GetDate(project.CreationTime)) .Click(request.IsApp ? UIClick.Pager(request.Model, "Account", new WebMeta().Put("Id", puser.Id), true) : new UIClick(puser.Id.ToString()).Send(request.Model, "Account"))).Button("立项人", null, 0xb7babb)); var ites = new List <UIIconNameDesc.Item>(); foreach (var pm in pms) { var v = users.Find(u => u.Id == pm.user_id) ?? new User { Alias = pm.Alias }; var text = "专栏作家"; switch (pm.AuthType) { case WebAuthType.Admin: text = "管理员"; break; case WebAuthType.User: break; } ites.Add(new UIIconNameDesc.Item(webr.ResolveUrl(pm.user_id.Value, "1", "4"), v.Alias, text) .Click(request.IsApp ? UIClick.Pager(request.Model, "Account", new WebMeta().Put("Id", pm.user_id), true) : new UIClick(pm.user_id.ToString()).Send(request.Model, "Account"))); if (ites.Count % 2 == 0) { ui2.Add(new UIIconNameDesc(ites.ToArray())); ites.Clear(); } } if (ites.Count > 0) { ui2.Add(new UIIconNameDesc(ites.ToArray())); } ids.RemoveAll(g => wids.Exists(w => w == g)); } var icons = new List <UIEventText>(); foreach (var id in ids) { var v = users.Find(u => u.Id == id); icons.Add(new UIEventText(v.Alias).Src(webr.ResolveUrl(v.Id.Value, "1", "4")).Click(request.IsApp ? UIClick.Pager(request.Model, "Account", new WebMeta().Put("Id", v.Id), true) : new UIClick(v.Id.ToString()).Send(request.Model, "Account"))); if (icons.Count % 4 == 0) { ui2.Add(new Web.UI.UIIcon().Add(icons.ToArray())); icons.Clear(); } } if (icons.Count > 0) { var ls = new Web.UI.UIIcon().Add(icons.ToArray()); ls.Style.Copy(style); ui2.Add(ls); // new Web.UI.UIIcon().Add(icons.ToArray())); //ui2.AddIcon(style, icons.ToArray()); } //if (icons.Count > 0) // ui2.AddIcon(style, icons.ToArray()); } var m = subEntity.Count(); int total = m / 4; if (m % 4 > 0) { total++; } ui.Total = total; response.Redirect(ui); } break; case "Writer": { int mlimit = limit * 4; int mstart = start * 4; var ids = new List <ProjectMember>(); var subEntity = Utility.CMS.ObjectEntity <UMC.Data.Entities.ProjectMember>(); subEntity.Where.And().Equal(new ProjectMember { project_id = project.Id }); subEntity.Where.And().In(new ProjectMember { AuthType = WebAuthType.Admin }, WebAuthType.User); subEntity.Order.Desc(new ProjectMember { CreationTime = DateTime.Now }); subEntity.Query(mstart, mlimit, dr => ids.Add(dr)); var style = new UIStyle().AlignRight(); if (ids.Count > 0) { var icons = new List <UIEventText>(); foreach (var v in ids) { icons.Add(new UIEventText(v.Alias).Src(webr.ResolveUrl(v.user_id.Value, "1", "4")).Click(UIClick.Pager(request.Model, "Account", new WebMeta().Put("Id", v.user_id), true))); if (icons.Count % 4 == 0) { ui2.Add(new Web.UI.UIIcon().Add(icons.ToArray())); icons.Clear(); } } if (icons.Count > 0) { var ls = new Web.UI.UIIcon().Add(icons.ToArray()); ls.Style.Copy(style); ui2.Add(ls); // new Web.UI.UIIcon().Add(icons.ToArray())); //ui2.AddIcon(style, icons.ToArray()); } } var m = subEntity.Count(); int total = m / 4; if (m % 4 > 0) { total++; } ui.Total = total; response.Redirect(ui); } break; case "Dynamic": { var subEntity = Utility.CMS.ObjectEntity <UMC.Data.Entities.ProjectDynamic>(); subEntity.Where.And().Equal(new ProjectDynamic { project_id = project.Id }).Entities.Order.Desc(new ProjectDynamic { Time = 0 }); var subs = new List <ProjectDynamic>(); var uids = new List <Guid>(); subEntity.Query(start, limit, dr => { subs.Add(dr); uids.Add(dr.user_id ?? Guid.Empty); }); var cates = new List <User>(); if (uids.Count > 0) { Utility.CMS.ObjectEntity <User>().Where.And().In(new User { Id = uids[0] }, uids.ToArray()) .Entities.Query(dr => cates.Add(dr)); } foreach (var sub in subs) { var user2 = cates.Find(d => d.Id == sub.user_id) ?? new User(); var data = new WebMeta().Put("alias", user2.Alias, "desc", sub.Explain).Put("time", sub.Time) .Put("name", sub.Title) .Put("src", webr.ResolveUrl(sub.user_id ?? Guid.Empty, "1", 5)); var cell = UICell.Create("IconNameDesc", data); cell.Format.Put("desc", "{alias} {time} {desc}"); cell.Style.Name("name").Size(14); ui2.Add(cell); } ui.Total = subEntity.Count(); if (ui.Total == 0) { // webr. ui2.Add("Desc", new UMC.Web.WebMeta().Put("desc", "尚未有此项目动态").Put("icon", "\uF016") , new UMC.Web.WebMeta().Put("desc", "{icon}\n{desc}"), new UIStyle().Align(1).Color(0xaaa).Padding(20, 20).BgColor(0xfff).Size(12).Name("icon", new UIStyle().Font("wdk").Size(60))); } } break; } response.Redirect(ui); return(this.DialogValue("none")); }); var user = Security.Identity.Current; if (user.IsAuthenticated == false) { this.Prompt("请登录", false); response.Redirect("Account", "Login"); } if (project == null || project.user_id == user.Id) { switch (Model) { case "Icon": response.Redirect("Design", "Picture", new WebMeta().Put("id", project.Id).Put("seq", 1), true); break; case "Transfer": var userId = Utility.Guid(this.AsyncDialog("Transfer", request.Model, "Member", new WebMeta().Put("Type", "Admin").Put("Project", project.Id))).Value; this.AsyncDialog("Confirm", g => new UIConfirmDialog("你确认转移项目拥有者身份吗")); Utility.CMS.ObjectEntity <Project>().Where.And().Equal(new Data.Entities.Project { Id = project.Id }).Entities .Update(new Project { user_id = userId }); Utility.CMS.ObjectEntity <ProjectMember>().Where.And().Equal(new ProjectMember { user_id = userId, project_id = project.Id }) .Entities.Update(new ProjectMember { user_id = project.user_id, CreationTime = DateTime.Now, Alias = user.Alias }); this.Context.Send(new UMC.Web.WebMeta().Put("type", "Subject.Project").Put("Id", project.Id).Put("Text", project.Caption) .Put("Code", project.Code), true); break; } var Caption = this.AsyncDialog("Settings", d => { var fmdg = new Web.UIFormDialog(); fmdg.Title = "编辑项目"; switch (Model) { case "News": fmdg.Title = "新建项目"; fmdg.AddText("项目名称", "Caption", ""); fmdg.Submit("确认", request, "Subject.Project"); return(fmdg); //break; default: case "Caption": fmdg.Title = "项目名称"; fmdg.AddText("项目名称", "Caption", project.Caption); break; case "Description": fmdg.Title = "项目介绍"; fmdg.AddText("项目介绍", "Description", project.Description); break; case "Code": fmdg.Title = "项目简码"; fmdg.AddText("项目简码", "Code", project.Code).PlaceHolder("短小易记有助于访问和传播").Put("tip", ""); break; } fmdg.Submit("确认", request, "Subject.Project"); fmdg.AddUI("对接", "配置钉钉应用").Command(request.Model, "Dingtalk", project.Id.ToString()); fmdg.AddUI("对接", "配置钉钉机器人").Command(request.Model, "DDRobot", project.Id.ToString()); //fmdg.AddUI("对接", "配置钉钉机器人").Command(request.Model, request.Command, new WebMeta().Put("Id", project.Id.ToString(), "Model", "Transfer")); return(fmdg); }); var team = new Project(); if (Model == "News") { UMC.Data.Reflection.SetProperty(team, Caption.GetDictionary()); team.ModifiedTime = DateTime.Now; team.Id = Guid.NewGuid(); team.user_id = user.Id; team.Code = Utility.Parse36Encode(team.Id.Value.GetHashCode()); team.CreationTime = DateTime.Now; team.Sequence = 0; Utility.CMS.ObjectEntity <UMC.Data.Entities.Project>().Insert(team); var strt = UMC.Security.AccessToken.Current.Data["DingTalk-Setting"] as string;//, Utility.Guid(projectId)).Commit(); if (String.IsNullOrEmpty(strt) == false) { var userSetting = Utility.CMS.ObjectEntity <UMC.Data.Entities.ProjectUserSetting>() .Where.And().Equal(new ProjectUserSetting { Id = Utility.Guid(strt, true) }).Entities.Single(); if (userSetting != null) { var setting2 = new ProjectSetting() { user_setting_id = userSetting.Id, project_id = team.Id, Type = 11 }; Utility.CMS.ObjectEntity <UMC.Data.Entities.ProjectSetting>().Insert(setting2); } } Data.WebResource.Instance().Transfer(new Uri("https://oss.365lu.cn/UserResources/app/zhishi-icon.jpg"), team.Id.Value, 1); var p = new ProjectItem() { Id = Guid.NewGuid(), Caption = "Home", Code = Utility.Parse36Encode(Guid.NewGuid().GetHashCode()), CreationTime = DateTime.Now, project_id = team.Id, Sequence = 0, user_id = user.Id, }; Utility.CMS.ObjectEntity <UMC.Data.Entities.ProjectItem>() .Insert(p); var portfolio = new Portfolio() { Id = Guid.NewGuid(), Caption = "随笔", Count = 0, CreationTime = DateTime.Now, Sequence = 0, user_id = user.Id, project_id = team.Id, project_item_id = p.Id, }; Utility.CMS.ObjectEntity <UMC.Data.Entities.Portfolio>() .Insert(portfolio); Utility.CMS.ObjectEntity <ProjectDynamic>() .Insert(new ProjectDynamic { Time = Utility.TimeSpan(), //DateTime.Now, user_id = user.Id, Explain = "创建了项目", project_id = team.Id, refer_id = team.Id, Title = team.Caption, Type = DynamicType.Project }); this.Context.Send(new UMC.Web.WebMeta().Put("type", "Subject.Project").Put("id", team.Id).Put("text", team.Caption) .Put("code", team.Code), true); } UMC.Data.Reflection.SetProperty(team, Caption.GetDictionary()); if (String.IsNullOrEmpty(team.Code) == false) { if (team.Code.Length < 3) { this.Prompt("项目简码必须大于3个字符"); } if (System.Text.RegularExpressions.Regex.IsMatch(team.Code, "^\\d+$") == true) { this.Prompt("项目简码不能全是数字"); } if (System.Text.RegularExpressions.Regex.IsMatch(team.Code, "^\\w+$") == false) { this.Prompt("项目简码只能是字符和数字"); } if (String.Equals(team.Code, project.Code, StringComparison.CurrentCulture) == false) { if (Utility.CMS.ObjectEntity <UMC.Data.Entities.Project>() .Where.And().Equal(new Project { Code = team.Code }).Entities.Count() > 0) { this.Prompt("存在相同的简码"); } } } team.ModifiedTime = DateTime.Now; var objectEntity = Utility.CMS.ObjectEntity <UMC.Data.Entities.Project>(); objectEntity.Where.And().Equal(new Project { Id = project.Id }); objectEntity.Update(team); this.Prompt("修改成功", false); this.Context.Send(new UMC.Web.WebMeta().Put("type", "Subject.Project").Put("id", project.Id).Put("text", team.Caption ?? project.Caption).Put("code", team.Code ?? project.Code), true); } }
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" })); } } }