/// <summary> /// 创建单图资讯组件 /// </summary> /// <param name="click"></param> /// <param name="data"></param> /// <param name="src"></param> public UICMS(UIClick click, WebMeta data, String src) { this.data = data;// = new UICMS(data); this.data.Put("src", src); this.data.Put("click", click); this.Type = "CMSOne"; }
void Append() { if (data.Count > 0 || dataText.Length > 0) { if (dataText.Length > 0) { data.Put("m" + data.Count.ToString(), dataText.ToString()); } dataText = new StringBuilder(); var sb = new StringBuilder(); for (int i = 0; i < data.Count; i++) { sb.Append("{m"); sb.Append(i); sb.Append("}"); } var cell = UICell.Create(data["type"] ?? "CMSText", data); data.Remove("type"); cell.Format.Put("text", sb.ToString()); cell.Style.Copy(style); cells.Add(cell); data = new WebMeta(); style = new UIStyle(); } }
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); } }
/// <summary> /// 创建单图或者大图资讯组件 /// </summary> /// <param name="click"></param> /// <param name="data"></param> /// <param name="src"></param> /// <param name="max">是否是大图</param> public UICMS(UIClick click, WebMeta data, String src, bool max) { this.data = data; this.data.Put("src", src); this.data.Put("click", click); this.Type = max ? "CMSMax" : "CMSOne"; }
public UICMSLook(String src, UIClick click, WebMeta data) { this.data = data; this.data.Put("src", src); this.data.Put("click", click); this.Type = "CMSLook"; }
public UIImageTitleBottom(UIClick click, WebMeta data, String src) { this.data = data; this.data.Put("src", src); this.data.Put("click", click); this.Type = "ImageTitleBottom"; }
public static UIImageTitleBottom Create(WebMeta data, String src) { var t = new UIImageTitleBottom(data); t.data.Put("src", src); t.Type = "ImageTitleBottom"; return(t); }
public static UICMS CreateMax(UIClick click, WebMeta data) { var t = new UICMS(data); t.data.Put("click", click); t.Type = "CMSMax"; return(t); }
public UIDiscount(UIClick click) { //var t = Create(); data = new WebMeta(); data.Put("click", click); this.Type = "Discount"; //return t; }
public override object Data => data; public UISheet(String title) { this.data = new WebMeta().Put("title", title); this.data.Put("items", items); this.Type = "UISheet"; this.Style.Name("icon").Font("wdk").Color(0x999); this.Style.Name("info").Font("wdk").Color(0xef4f4f); }
/// <summary> /// 创建三张图资讯组件 /// </summary> /// <param name="click"></param> /// <param name="data"></param> /// <param name="src1"></param> /// <param name="src2"></param> /// <param name="src3"></param> public UICMS(UIClick click, WebMeta data, String src1, String src2, String src3) { this.data = data; this.data.Put("click", click); this.Type = "CMSThree"; this.data.Put("images", new string[] { src1, src2, src3 }); }
public static UICMS CreateOne(UIClick click, WebMeta data, String src) { var t = new UICMS(data); t.data.Put("src", src); t.data.Put("click", click); t.Type = "CMSOne"; return(t); }
public static UICMSLook Create(String src, UIClick click, WebMeta data) { var t = new UICMSLook(data); t.data.Put("src", src); t.data.Put("click", click); t.Type = "CMSLook"; return(t); }
public static UICMS CreateThree(UIClick click, WebMeta data, params String[] src) { var t = new UICMS(data); t.data.Put("images", src); t.data.Put("click", click); t.Type = "CMSThree"; return(t); }
void Design(WebRequest request, Guid itemId) { var entity = Database.Instance().ObjectEntity <Design_Item>(); entity.Where.And().Equal(new Design_Item { Id = itemId }); Design_Item item = entity.Single(); if (item == null) { Design_Item max = entity .Where.Reset().And().Equal(new Design_Item() { design_id = Guid.Empty, for_id = Guid.Empty }) //Design_id(Utility.uuidEmpty).For_id(Utility.uuidEmpty)) .Entities.Max(new Design_Item { Seq = 0 }); max.Seq = (max.Seq ?? 0) + 1; item = max; } Design_Item fitem = item; WebMeta meta = this.AsyncDialog(g => { UIFormDialog from = new UIFormDialog(); from.Title = ("页面分类项"); from.AddText("标题", "ItemName", fitem.ItemName); from.AddNumber("顺序", "Seq", fitem.Seq); from.Submit("确认", request, "Design"); return(from); }, "Setting"); Design_Item newItem = new Design_Item() { ItemName = meta.Get("ItemName"), ModifiedDate = DateTime.Now, Seq = Utility.Parse(meta.Get("Seq"), 0) }; entity.Where.Reset().And().Equal(new Design_Item() { Id = itemId }); entity.IFF(e => e.Update(newItem) == 0, e => { newItem.design_id = Guid.Empty; newItem.for_id = Guid.Empty; newItem.Id = Guid.NewGuid(); newItem.Type = UIDesigner.StoreDesignType; e.Insert(newItem); }); this.Context.Send("Design", true); }
string Oracle(WebMeta meta) { if (meta.ContainsKey("Port") == false) { meta["Port"] = "1521"; } var str = "User Id={2};Password={3};Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={0})(PORT={4})))(CONNECT_DATA=(SERVICE_NAME={1})))"; return(String.Format(str, meta["Server"], meta["Database"], meta["User"], meta["Password"], meta["Port"])); }
void Portfolio(Guid projectid, WebResponse response) { var ids = new List <Guid>(); var user = UMC.Security.Identity.Current; var projectEntity = Utility.CMS.ObjectEntity <ProjectItem>(); var project = projectEntity.Where.And().In(new ProjectItem { Id = projectid }).Entities.Single(); var team = Utility.CMS.ObjectEntity <Project>().Where.And().In(new Project { Id = project.project_id }).Entities.Single(); var editer = team.user_id == user.Id; int status = 1; if (editer == false) { status = -1; var member = Utility.CMS.ObjectEntity <ProjectMember>().Where.And().Equal(new ProjectMember { project_id = team.Id, user_id = user.Id }).Entities.Single(); if (member != null) { switch (member.AuthType) { case WebAuthType.Admin: status = 1; break; case WebAuthType.All: status = -1; break; case WebAuthType.Guest: status = -1; break; case WebAuthType.User: status = 1; break; } } } var menu = new WebMeta(); menu.Put("nav", String.Format("{0}/{1}", team.Code, project.Code)); menu.Put("subs", Portfolio(team, project, status)); response.Redirect(menu);// //return Portfolio(team, project, status); }
public override void ProcessActivity(WebRequest request, WebResponse response) { var ids = new List <String>(); var menus = new List <UMC.Data.Entities.Menu>(); UMC.Data.Database.Instance().ObjectEntity <UMC.Data.Entities.Menu>().Where.And().Equal(new Data.Entities.Menu { IsDisable = false }).Entities.Order.Asc(new UMC.Data.Entities.Menu { Seq = 0 }) .Entities.Query(dr => { ids.Add(dr.Id.ToString()); menus.Add(dr); }); var auths = Security.AuthManager.IsAuthorization(ids.ToArray()); var menu = new List <WebMeta>(); foreach (var p in menus.FindAll(d => d.ParentId == Guid.Empty)) { var m = new WebMeta().Put("icon", p.Icon).Put("text", p.Caption).Put("id", p.Id); if (auths[ids.IndexOf(p.Id.ToString())] == false) { continue; } var data2 = new System.Data.DataTable(); data2.Columns.Add("id"); data2.Columns.Add("text"); data2.Columns.Add("url"); var childs = menus.FindAll(c => c.ParentId == p.Id); if (childs.Count > 0) { childs = childs.FindAll(d => auths[ids.IndexOf(d.Id.ToString())]); if (childs.Count == 0) { continue; } foreach (var ch in childs) { data2.Rows.Add(ch.Id, ch.Caption, ch.Url); } m.Put("menu", data2); } else { m.Put("url", p.Url); } menu.Add(m); } response.Redirect(menu); }
string MSSQL(WebMeta meta) { var str = "Data Source={0},{4};Initial Catalog={1};User ID={2};Password={3};"; if (meta["Port"] == "1433") { str = "Data Source={0};Initial Catalog={1};User ID={2};Password={3};"; } return(String.Format(str, meta["Server"], meta["Database"], meta["User"], meta["Password"], meta["Port"])); }
string MySQL(WebMeta meta) { var str = "Server={0};Port={4};Database={1};Uid={2};Pwd={3};Charset=utf8"; if (meta["Port"] == "3306") { str = "Server={0};Database={1};Uid={2};Pwd={3};Charset=utf8"; } return(String.Format(str, meta["Server"], meta["Database"], meta["User"], meta["Password"], meta["Port"])); //Port }
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); } }
public UISheet AddItem(String text, string desc, bool isInfo) { var b = new WebMeta().Put("text", text, "desc", desc); if (isInfo) { b.Put("icon", '\uF05A'); } else { b.Put("info", '\uF05D'); } this.items.Add(b); return(this); }
// 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); } }
public override void ProcessActivity(WebRequest request, WebResponse response) { var oosr = WebResource.Instance(); var Key = this.AsyncDialog("Key", g => { var f = Web.UIDialog.CreateDialog("File"); f.Config.Put("Submit", new UIClick(new WebMeta().Put("Key", "WebResource", "media_id", "Value", "UI", this.AsyncDialog("UI", "none"))) { Command = request.Command, Model = request.Model }); return(f); }); var user = Security.Identity.Current; var media_id = this.AsyncDialog("media_id", "none"); if (String.Equals(media_id, "none") == false) { var url = new Uri(media_id); var name = url.AbsolutePath.Substring(url.AbsolutePath.LastIndexOf('/') + 1); var urlKey = String.Format("UserResources/{0}/{1}/{2}", Utility.Parse62Encode(user.Id.Value.GetHashCode()), Utility.TimeSpan(), name); oosr.Transfer(url, urlKey); var posmata = new WebMeta(); posmata.Put("src", String.Format("{0}{1}", oosr.WebDomain(), urlKey)).Put("name", name); this.Context.Send(new WebMeta().UIEvent(Key, this.AsyncDialog("UI", "none"), posmata), true); } else { var UseKey = UMC.Data.Utility.Parse36Encode(UMC.Security.Identity.Current.Id.Value.GetHashCode()); var sourceKey = new Uri(String.Format("{2}TEMP/{0}/{1}", UMC.Data.Utility.GetRoot(request.Url), Key, oosr.TempDomain())); Key = String.Format("UserResources/{0}/{1}", UseKey, Key); oosr.Transfer(sourceKey, Key); response.Redirect(new WebMeta().Put("src", String.Format("{0}{1}", oosr.WebDomain(), Key))); } }
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); } }
void Seq(WebRequest request, WebResponse response, Design_Item item) { var entity = Database.Instance().ObjectEntity <Design_Item>(); entity.Where.And().Equal(new Design_Item() { Id = (item.Id) }); WebMeta meta = this.AsyncDialog(g => { UIFormDialog from = new UIFormDialog(); from.Title = ("调整顺序"); from.AddNumber("展示顺序", "Seq", item.Seq); return(from); }, "Setting"); entity.Update(new Design_Item() { ModifiedDate = DateTime.Now, Seq = Utility.IntParse(meta.Get("Seq"), 0) }); }
public UITabFixed Add(String text, WebMeta search, String key) { items.Add(new WebMeta().Put("text", text).Put("search", search).Put("Key", key)); return(this); }
/// <summary> /// 创建视频资讯组件 /// </summary> public UICMS(WebMeta data, Uri videoSrc, String src) { this.data = data.Put("src", src).Put("video-src", videoSrc); this.Type = "CMSMax"; }
/// <summary> /// 创建无图资讯组件 /// </summary> /// <param name="click"></param> /// <param name="data"></param> public UICMS(UIClick click, WebMeta data) { this.data = data; this.data.Put("click", click); this.Type = "CMSMax"; }
public UIItemText(WebMeta data) { this.data = data; this.Type = "ItemText"; }