示例#1
0
 protected override object CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType)
 {
     var positionType = controllerContext.HttpContext.Request["PositionType"];
     object model = null;
     switch (positionType)
     {
         case "View":
             model = new ViewPosition();
             break;
         case "Module":
             model = new ModulePosition();
             break;
         case "Content":
             model = new HtmlPosition();
             break;
         default:
             break;
     }
     bindingContext.ModelMetadata = ModelMetadataProviders.Current.GetMetadataForType(() => model, model.GetType());
     return model;
 }
示例#2
0
 protected virtual IHtmlString RenderHtmlPosition(HtmlPosition htmlPosition)
 {
     string html = htmlPosition.Html;
     if (PageContext.EnabledInlineEditing(EditingType.Page) && PageContext.PageRequestContext.Page.IsLocalized(PageContext.PageRequestContext.Site))
     {
         if (PageContext.PageRequestContext.Page.Published.Value == false
             || (PageContext.PageRequestContext.Page.Published.Value == true && ServiceFactory.UserManager.Authorize(PageContext.PageRequestContext.Site, PageContext.ControllerContext.HttpContext.User.Identity.Name, Kooboo.CMS.Account.Models.Permission.Sites_Page_PublishPermission)))
         {
             html = string.Format("<var start=\"true\" editType=\"html\" dataType=\"{0}\" positionId=\"{1}\" positionName=\"{2}\" style=\"display:none;\"></var>{3}<var end=\"true\" style=\"display:none;\"></var>", FieldDataType.RichText.ToString(), htmlPosition.PagePositionId, HttpUtility.HtmlAttributeEncode(htmlPosition.ToString()), html);
         }
     }
     return new HtmlString(html);
 }
示例#3
0
        public PageDesignHtmlContent(HtmlPosition pos)
            : base(pos)
        {
            // html
            this.Parameter.Add("Html", PageDesignContent.Code(pos.Html));

            // name
            var name = HttpUtility.UrlDecode(pos.Html).StripAllTags().Trim();
            name = System.Text.RegularExpressions.Regex.Replace(name, "\\s+", " ");
            if (name.Length > 10) { name = name.Substring(0, 7) + "..."; }
            this.Parameter["Name"] = PageDesignContent.Code("Html:" + name);
        }