コード例 #1
0
        public override void ProcessActivity(WebRequest request, WebResponse response)
        {
            var strId = this.AsyncDialog("Id", g =>
            {
                return(new Web.UITextDialog()
                {
                    Title = "主题"
                });
            });
            var form = request.SendValues ?? new UMC.Web.WebMeta();

            if (form.ContainsKey("limit") == false)
            {
                this.Context.Send(new UISectionBuilder(request.Model, request.Command, new UMC.Web.WebMeta().Put("Id", strId))

                                  .Builder(), true);
            }
            var sid1      = UMC.Data.Utility.Guid(strId);
            var subEntity = Utility.CMS.ObjectEntity <UMC.Data.Entities.Subject>();

            if (sid1.HasValue)
            {
                subEntity.Where.And().Equal(new Data.Entities.Subject {
                    Id = sid1
                });
            }
            if (strId.IndexOf("/") > 0)
            {
                var paths = new List <String>();
                paths.AddRange(strId.Split('/'));
                if (paths.Count == 3)
                {
                    var project = Utility.CMS.ObjectEntity <Project>().Where.And().Equal(new Project
                    {
                        Code = paths[0]
                    }).Entities.Single();
                    if (project != null)
                    {
                        var projectItem = Utility.CMS.ObjectEntity <ProjectItem>().Where.And().Equal(new ProjectItem
                        {
                            project_id = project.Id,
                            Code       = paths[1]
                        }).Entities.Single();
                        if (projectItem != null)
                        {
                            sid1 = Guid.Empty;
                            subEntity.Where.And().Equal(new Subject
                            {
                                project_id      = project.Id,
                                project_item_id = projectItem.Id,
                                Code            = paths[2]
                            });
                        }
                    }
                }
            }


            int limit = UMC.Data.Utility.IntParse(form["limit"] as string, 25);
            int start = UMC.Data.Utility.IntParse(form["start"] as string, 0);


            var webr    = UMC.Data.WebResource.Instance();
            var user    = UMC.Security.Identity.Current;
            var nextKey = this.AsyncDialog("NextKey", g => this.DialogValue("Subject"));


            var selectIndex = UMC.Data.Utility.IntParse(this.AsyncDialog("selectIndex", g => this.DialogValue("0")), 0);

            UITabFixed tabFixed = new UITabFixed();

            tabFixed.Add("评论", "Comments", "Comments");
            tabFixed.Add("点赞", "Proposal", "Comments");
            tabFixed.Add("已读", "Access", "Comments");
            tabFixed.SelectIndex = selectIndex;



            Subject sub = sid1.HasValue ? subEntity.Single() : null;

            var ui  = UISection.Create();
            var rui = ui;

            if (nextKey == "Subject")
            {
                ui.Key = nextKey;
                if (sub == null || sub.Visible == -1)
                {
                    var title = new UITitle("图文正文");
                    ui.Title = title;
                    if (strId.IndexOf("/") > 0)
                    {
                        ui.Add("Desc", new UMC.Web.WebMeta().Put("desc", "此图文已删除").Put("icon", "\uea0d")
                               , 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)));
                    }
                    else
                    {
                        ui.Add("Desc", new UMC.Web.WebMeta().Put("desc", String.Format("未有{0}路径文档", strId)).Put("icon", "\uea0d")
                               , 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)));
                    }
                    ui.IsNext = false;
                }
                else
                {
                    //
                    ui.IsNext = true;
                    var title = new UITitle("图文正文");
                    ui.Title = title;
                    title.Name("title", sub.Title);
                    title.Name("Id", sub.Id.ToString());
                    title.Float();
                    if (sub.Status > 0)
                    {
                        if ((sub.PublishTime ?? 0) + 3600 < Utility.TimeSpan())// DateTime.Now)
                        {
                            title.Name("releaseId", sub.Id.ToString());
                        }
                    }
                    var         isEditer    = false;
                    Project     project     = null;
                    ProjectItem projectItem = null;
                    if (sub.project_id.HasValue && sub.project_item_id.HasValue)
                    {
                        project = Utility.CMS.ObjectEntity <UMC.Data.Entities.Project>().Where.And().Equal(new Data.Entities.Project {
                            Id = sub.project_id
                        })
                                  .Entities.Single();



                        projectItem = Utility.CMS.ObjectEntity <UMC.Data.Entities.ProjectItem>().Where.And().Equal(new Data.Entities.ProjectItem {
                            Id = sub.project_item_id
                        })
                                      .Entities.Single();
                    }

                    UIItem item = null;
                    if (project != null && projectItem != null)
                    {
                        if (String.IsNullOrEmpty(sub.Code) == false)
                        {
                            title.Name("Path", String.Format("{0}/{1}/{2}", project.Code, projectItem.Code, sub.Code));

                            if (request.IsApp)
                            {
                                title.Right('\uf141', UIClick.Click(new UIClick("Id", sub.Id.ToString())
                                {
                                    Command = "TipOff", Model = request.Model
                                }));
                            }

                            var proider = UMC.Data.Reflection.GetDataProvider("cmsui", String.Format("{0}.{1}.{2}", project.Code, projectItem.Code, sub.Code));
                            if (proider == null)
                            {
                                proider = UMC.Data.Reflection.GetDataProvider("cmsui", String.Format("{0}.{1}", project.Code, projectItem.Code, sub.Code));
                            }
                            if (proider != null)
                            {
                                item = UMC.Data.Reflection.CreateObject(proider) as UIItem;
                            }
                        }

                        if (project.user_id == user.Id)
                        {
                            isEditer = true;
                        }
                        else
                        {
                            var member = Utility.CMS.ObjectEntity <ProjectMember>()
                                         .Where.And().Equal(new ProjectMember
                            {
                                project_id = project.Id,
                                user_id    = user.Id
                            }).Entities.Single();
                            if (member != null)
                            {
                                switch (member.AuthType)
                                {
                                case WebAuthType.Admin:
                                case WebAuthType.User:
                                    isEditer = true;
                                    break;
                                }
                            }
                        }
                    }
                    if (item != null && item.Header(ui, sub) == false)
                    {
                        ui.Add("Desc", new UMC.Web.WebMeta().Put("desc", "此图文已删除").Put("icon", "\ue953"), 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)));
                        ui.IsNext = false;
                    }
                    else
                    {
                        var desc = new UIDesc(new WebMeta().Put("desc", sub.Title).Put("state", "未发布"));
                        desc.Style.Bold().Size(18).Name("border", "none");
                        if (sub.Status < 0)
                        {
                            desc.Desc("{desc} [{1:state:1}]");
                            desc.Style.Name("state").Color(0x999).Size(13);
                        }
                        //if (request.IsApp)
                        //{
                        desc.Style.Padding(55, 10, 10, 10);
                        //}
                        //else
                        //{
                        //    desc.Style.Padding(10);

                        //}
                        ui.Add(desc);
                    }
                    if (isEditer == false && sub.Status < 1)
                    {
                        ui.Add("Desc", new UMC.Web.WebMeta().Put("desc", "此文档未发布,现还不能查看").Put("icon", "\uF0E6"), 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)));
                        ui.IsNext = false;
                    }
                    else
                    {
                        ui.DisableSeparatorLine();
                        Subject(request.Model, ui, sub, project, isEditer);
                        if (sub.Look.HasValue)
                        {
                            subEntity.Update("{0}+{1}", new Data.Entities.Subject {
                                Look = 1
                            });
                        }
                        else
                        {
                            subEntity.Update(new Data.Entities.Subject {
                                Look = 1
                            });
                        }
                        if (item != null && ui.IsNext == true)
                        {
                            item.Footer(ui, sub);
                        }
                        if (ui.IsNext == true)
                        {
                            ui.IsNext = String.Equals(request.Model, "Subject");
                        }
                    }
                }

                if (ui.IsNext == false)
                {
                    response.Redirect(ui);
                }
                if (sub.IsComment == false)
                {
                    ui.IsNext = false;
                }

                ui.Add(SubjectBestActivity.BSSArea(sub, request.Model, request.IsApp));

                ui.StartIndex = 0;
                ui            = ui.NewSection();
                start         = 0;
            }
            var Keyword = (form["Keyword"] as string ?? String.Empty);

            if (String.IsNullOrEmpty(Keyword) && selectIndex > -1)
            {
                Keyword = tabFixed.SelectValue["search"];
            }
            tabFixed.Style.Name("border", "bottom");
            ui.Add(tabFixed);
            ui.Key = "Comments";
            switch (Keyword)
            {
            case "Comments":
            {
                var entity = Utility.CMS.ObjectEntity <UMC.Data.Entities.Comment>();
                entity.Where.And().Equal(new Data.Entities.Comment {
                        ref_id = sub.Id.Value, for_id = Guid.Empty
                    });

                entity.Order.Desc(new Data.Entities.Comment {
                        CommentDate = DateTime.Now
                    });
                entity.Where.And().Greater(new Comment {
                        Visible = -1
                    });
                var count = entity.Count();
                var hash  = Utility.Comments(entity, start, limit, request.Model);
                if (count == 0)
                {
                    rui.IsNext = false;
                    ui.Add("Desc", new UMC.Web.WebMeta().Put("desc", "暂无评论").Put("icon", "\uF0E6"), 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)));
                }
                else
                {
                    ui.AddCells(hash.ToArray());
                    rui.IsNext = ui.Total > limit + start;
                }
            }
            break;

            case "Access":
            {
                var style     = new UIStyle().AlignLeft().Name("border", "none");
                int mlimit    = limit * 4;
                int mstart    = start * 4;
                var ids       = new List <Guid>();
                var accEntity = Utility.CMS.ObjectEntity <UMC.Data.Entities.ProjectAccess>();
                accEntity.Where.And().Equal(new ProjectAccess {
                        sub_id = sub.Id
                    });
                accEntity.Order.Desc(new ProjectAccess {
                        LastAccessTime = DateTime.Now
                    });
                accEntity.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));

                    var icons = new List <UIEventText>();
                    foreach (var id in ids)
                    {
                        var v = users.Find(u => u.Id == id) ?? new User()
                        {
                            Id = id, Alias = "未知"
                        };
                        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)
                        {
                            ui.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);
                        ui.Add(ls);        // new Web.UI.UIIcon().Add(icons.ToArray()));
                                           //ui2.AddIcon(style, icons.ToArray());
                    }
                }
                var m     = accEntity.Count();
                int total = m / 4;
                if (m % 4 > 0)
                {
                    total++;
                }
                ui.IsNext = (mstart + mlimit) < total;
                if (m == 0)
                {
                    ui.Add("Desc", new UMC.Web.WebMeta().Put("desc", "暂无访问").Put("icon", "\uF0E6"), 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)));
                }

                response.Redirect(ui);
            }
            break;

            case "Proposal":
            {
                var style     = new UIStyle().AlignLeft().Name("border", "none");
                int mlimit    = limit * 4;
                int mstart    = start * 4;
                var ids       = new List <Guid>();
                var accEntity = Utility.CMS.ObjectEntity <UMC.Data.Entities.Proposal>();
                accEntity.Where.And().Equal(new Proposal {
                        ref_id = sub.Id
                    });
                accEntity.Order.Desc(new Proposal {
                        CreationDate = DateTime.Now
                    });

                accEntity.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));

                    var icons = new List <UIEventText>();
                    foreach (var id in ids)
                    {
                        var v = users.Find(u => u.Id == id) ?? new User()
                        {
                            Id = id, Alias = "未知"
                        };
                        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)
                        {
                            ui.Add(new Web.UI.UIIcon().Add(icons.ToArray()));
                            //ui.AddIcon(style, icons.ToArray());
                            icons.Clear();
                        }
                    }
                    if (icons.Count > 0)
                    {
                        var ls = new Web.UI.UIIcon().Add(icons.ToArray());
                        ls.Style.Copy(style);
                        ui.Add(ls);        // new Web.UI.UIIcon().Add(icons.ToArray()));
                                           //ui2.AddIcon(style, icons.ToArray());
                    }
                }
                var m     = accEntity.Count();
                int total = m / 4;
                if (m % 4 > 0)
                {
                    total++;
                }
                ui.IsNext = (mstart + mlimit) < total;
                if (m == 0)
                {
                    ui.Add("Desc", new UMC.Web.WebMeta().Put("desc", "暂无点赞").Put("icon", "\uf087"), 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)));
                }

                response.Redirect(ui);
            }
            break;
            }
            response.Redirect(rui);
        }
コード例 #2
0
        public static void Search(UISection ui, Data.Sql.IObjectEntity <Subject> subEntity, String model, String cmd, int start, int limit, bool isblock)
        {
            var subs    = new List <Subject>();
            var cateids = new List <Guid>();
            var ids     = new List <Guid>();
            var itemIds = new List <Guid>();

            var search = UMC.Data.Reflection.CreateInstance <Subject>();

            search.DataJSON  = null;
            search.Content   = null;
            search.ConfigXml = null;
            subEntity.Query(search, start, limit, dr =>
            {
                subs.Add(dr);
                if (dr.project_id.HasValue)
                {
                    cateids.Add(dr.project_id ?? Guid.Empty);
                }
                ids.Add(dr.Id.Value);
                if (dr.project_item_id.HasValue)
                {
                    itemIds.Add(dr.project_item_id.Value);
                }
            });
            var cates  = new List <Project>();
            var pitems = new List <Data.Entities.ProjectItem>();


            if (itemIds.Count > 0)
            {
                Utility.CMS.ObjectEntity <ProjectItem>().Where.And().In(new ProjectItem
                {
                    Id = itemIds[0]
                }, itemIds.ToArray())
                .Entities.Query(dr => pitems.Add(dr));
            }
            if (cateids.Count > 0)
            {
                Utility.CMS.ObjectEntity <Project>().Where.And().In(new Project {
                    Id = cateids[0]
                }, cateids.ToArray())
                .Entities.Query(dr => cates.Add(dr));
            }
            var pics = new List <UMC.Data.Entities.Picture>();

            if (ids.Count > 0)
            {
                Utility.CMS.ObjectEntity <Data.Entities.Picture>().Where.And().In(new Data.Entities.Picture
                {
                    group_id = ids[0]
                }, ids.ToArray()).Entities.Order.Asc(new Data.Entities.Picture {
                    Seq = 0
                }).Entities.Query(g => pics.Add(g));
            }
            ;
            var items = ui;
            var webr  = UMC.Data.WebResource.Instance();


            foreach (var sub in subs)
            {
                if (sub.Visible == 0)
                {
                    continue;
                }
                var ims = new List <UMC.Data.Entities.Picture>();
                pics.RemoveAll(g =>
                {
                    if (g.group_id == sub.Id)
                    {
                        ims.Add(g);
                        return(true);
                    }
                    return(false);
                });
                var imgs = new List <String>();

                if (ims.Count > 0)
                {
                    switch (ims.Count)
                    {
                    case 2:
                    case 1:

                        imgs.Add(webr.ResolveUrl(sub.Id.Value, 1, "0") + "!cms" + ((sub.IsPicture ?? false) ? "1" : "3") + "?_ts=" + UMC.Data.Utility.TimeSpan(ims[0].UploadDate.Value));

                        break;

                    default:
                        for (var i = 0; i < 3; i++)
                        {
                            imgs.Add(webr.ResolveUrl(sub.Id.Value, ims[i].Seq ?? 0, "0") + "!cms3?_ts=" + UMC.Data.Utility.TimeSpan(ims[i].UploadDate.Value));
                        }
                        break;
                    }
                }
                var click = new Web.UIClick(sub.Id.ToString()).Send(model, cmd);
                var data  = new UMC.Web.WebMeta().Put("title", sub.Title).Put("reply", (sub.Reply ?? 0).ToString()).Put("look", (sub.Look ?? 0).ToString());


                var cate  = cates.Find(g => g.Id == sub.project_id);
                var pitem = pitems.Find(g => g.Id == sub.project_item_id);
                data.Put("pname", cate == null ? "草稿" : cate.Caption);
                if (sub.project_id == sub.user_id)
                {
                    data.Put("iname", "");
                }
                else
                {
                    data.Put("iname", pitem == null ? "" : pitem.Caption);
                }
                data.Put("time", Utility.GetDate(sub.ReleaseDate));
                if (cate != null && pitem != null)
                {
                    data.Put("spa", new WebMeta().Put("id", sub.Id).Put("path", String.Format("{0}/{1}/{2}", cate.Code, pitem.Code, sub.Code)));
                }
                else
                {
                    data.Put("sub-id", Utility.Guid(sub.Id.Value));//.Put("path", String.Format("{0}/{1}/{2}", cate.Code, pitem.Code, sub.Code)));
                }
                data.Put("desc", sub.Description);
                UICell cell;
                switch (imgs.Count)
                {
                case 0:
                    cell = new UICMS(click, data);
                    break;

                default:
                    cell = (sub.IsPicture ?? false) ? new UICMS(click, data, imgs[0], true) : (ims.Count > 2 ? new UICMS(click, data, imgs[0], imgs[1], imgs[2]) : new UICMS(click, data, imgs[0]));


                    break;
                }
                cell.Format.Put("left", "{pname} {iname} {time}");
                cell.Style.Name("licon", new UIStyle().Size(12).Font("wdk")).Name("ricon", new UIStyle().Size(12).Font("wdk"));
                cell.Style.Name("pname").Color(0x777);
                cell.Style.Name("iname").Color(0x777);
                if (isblock)
                {
                    cell.Style.Name("block").Size(12).Color(0xaaa).Font("wdk").Click(UIClick.Click(new UIClick("Id", sub.Id.ToString(), "Type", "Block").Send(model, "TipOff")));
                    data.Put("block", "\uea0d");

                    cell.Format.Put("right", "\uF06E{1:licon} {look}   \uF0E6{1:ricon} {reply}  {2:block}");
                }
                else
                {
                    cell.Format.Put("right", "\uF06E{1:licon} {look}   \uF0E6{1:ricon} {reply}");
                }
                items.Add(cell);
            }
            ui.Total = subEntity.Count();;
        }
コード例 #3
0
        public override void ProcessActivity(WebRequest request, WebResponse response)
        {
            var Url = this.AsyncDialog("Id", g =>
            {
                if (request.IsApp == false)
                {
                    return(this.DialogValue("News"));
                }
                var optls   = new Web.UISheetDialog();
                optls.Title = "新建图文";;
                optls.Options.Add(new UIClick("News")
                {
                    Command = request.Command, Model = request.Model, Text = "新建富文本图文"
                });
                optls.Options.Add(new UIClick("Markdown")
                {
                    Command = request.Command, Model = request.Model, Text = "新建Markdown文档"
                });
                optls.Options.Add(new UIClick()
                {
                    Key = "CaseCMS", Text = "抓取粘贴板网址图文"
                });

                return(optls);
            });
            var user = UMC.Security.Identity.Current;

            if (user.IsAuthenticated == false)
            {
                this.Prompt("请先登录", false);
                response.Redirect("Account", "Login");
            }

            var sId = UMC.Data.Utility.Guid(Url);

            if (sId.HasValue == false)
            {
                var sType = "text/html";
                switch (Url)
                {
                case "Project":
                    response.Redirect(request.Model, "ProjectUI", "News", true);
                    break;

                case "Markdown":
                    sType = "markdown";
                    if (request.IsApp)
                    {
                        this.Context.Send("Markdown", new WebMeta().Put("Id", "News"), true);
                    }
                    break;
                }
                if (request.IsApp == false)
                {
                    var sub2 = new Subject()
                    {
                        Visible      = 1,
                        CreationTime = DateTime.Now,
                        Title        = DateTime.Now.ToShortDateString(),
                        IsPicture    = false,
                        IsDraught    = true,
                        Id           = Guid.NewGuid(),
                        ContentType  = sType,
                        LastDate     = DateTime.Now,
                        Poster       = user.Alias,
                        Seq          = Utility.TimeSpan(),
                        last_user_id = user.Id,
                        user_id      = user.Id,
                        Status       = -1
                    };
                    SubjectSaveActivity.Dashboard(user, sub2);
                    Utility.CMS.ObjectEntity <Subject>().Insert(sub2);
                    this.Context.Send("Markdown", new WebMeta().Put("Id", Utility.Guid(sub2.Id.Value)), true);
                }
            }


            var sub = sId.HasValue ? (Utility.CMS.ObjectEntity <Subject>()
                                      .Where.And().Equal(new Subject
            {
                Id = sId
            }).Entities.Single() ?? new Subject {
                Id = sId
            }) : new Subject {
                Id = sId
            };;

            if (String.IsNullOrEmpty(request.SendValue) == false)
            {
                if (sub.project_id.HasValue)
                {
                    var project = Utility.CMS.ObjectEntity <Project>().Where.And().Equal(new Project
                    {
                        Id = sub.project_id
                    }).Entities.Single();
                    if (project != null)
                    {
                        if (project.user_id == user.Id)
                        {
                        }
                        else
                        {
                            var member = Utility.CMS.ObjectEntity <ProjectMember>().Where.And().Equal(new ProjectMember
                            {
                                project_id = sub.project_id,
                                user_id    = user.Id
                            }).Entities.Single();
                            if (member != null)
                            {
                                switch (member.AuthType)
                                {
                                case WebAuthType.Admin:
                                case WebAuthType.User:
                                    break;

                                default:
                                    this.Prompt("您未有编辑此图文的权限");
                                    break;
                                }
                            }
                            else
                            {
                                this.Prompt("您未有编辑此图文的权限");
                            }
                        }
                    }
                }
                if (String.Equals("markdown", sub.ContentType, StringComparison.CurrentCultureIgnoreCase))
                {
                    this.Context.Send("Markdown", new WebMeta().Put("Id", sId), true);
                }
                else
                {
                    if (request.IsApp)
                    {
                        this.Context.Send(new UISectionBuilder(request.Model, request.Command, new UMC.Web.WebMeta().Put("Id", sId.HasValue ? sId : Guid.NewGuid()))
                                          .CloseEvent("Subject.Save")
                                          .Builder().Put("IsEditer", true), true);
                    }
                    else
                    {
                        this.Context.Send("Markdown", new WebMeta().Put("Id", Utility.Guid(sId.Value)), true);
                    }
                }
            }

            var Next  = this.AsyncDialog("Next", "none");
            var ui    = UISection.Create();
            var title = new UITitle("图文编辑器");

            ui.Title = title;
            title.Right(new UIEventText().Icon('\uf0c7').Click(UIClick.Click(new UIClick("Id", sub.Id.ToString(), "Next", Next)
            {
                Command = "Save",
                Model   = request.Model
            })));


            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":
                    pom.Put("style", new UIStyle().Padding(0, 10));
                    break;
                }
            }

            if (celss.Length == 0)
            {
                var ed = ui.NewSection();
                ed.DisableSeparatorLine();
                ed.IsEditer = true;
                ed.AddCells(new UMC.Web.WebMeta().Put("_CellName", "CMSText").Put("value", new UMC.Web.WebMeta().Put("text", "新建文档")));
            }
            else
            {
                var ed = ui.NewSection();
                ed.IsEditer = true;
                ed.AddCells(celss);
                ed.DisableSeparatorLine();
            }
            var style  = new UIStyle();
            var footer = new UIHeader();

            ui.UIFooter = footer;//
            footer.Desc(new UMC.Web.WebMeta("icon", "\uf004", "desc", "天天录,录入您知识财富"), "{icon}\n{desc}", style);

            style.Height(350).Color(0xf0f0f0).AlignCenter().BgColor(0xf8f8f8).Name("border", "none");//.BorderColor
            style.Name("icon").Font("wdk").Size(40);


            response.Redirect(ui);
        }