예제 #1
0
 public static HtmlString HtmlForText(this WidgetFactory html, string text, string tag = "p")
 {
     if (!text.HasValue())
     {
         text = " ";
     }
     else
     {
         if (!tag.HasValue())
         {
             text = text.Replace("\n", "");
         }
         else if (tag == "br")
         {
             text = text.Replace("\n", "<br/>");
         }
         else
         {
             text = $"<{tag}>{text.Replace("\n", $"</{tag}><{tag}>")}</{tag}>";
         }
     }
     return(new HtmlString(text));
 }
예제 #2
0
        public static HtmlString HtmlForAttach(this WidgetFactory ace, string attachs, string cls = "lh20")
        {
            if (!attachs.HasValue())
            {
                return(new HtmlString("&nbsp;"));
            }

            var sb    = new StringBuilder();
            int index = 0;

            attachs.Trim(',').Split(',').Each(delegate(string item)
            {
                if (item.HasValue())
                {
                    string text        = App.GetWebPath(item);
                    string attachTitle = ace.GetAttachTitle(item);
                    sb.Append("<div>");
                    sb.Append($"<a class=\"{cls}\" href=\"{text}\" target=\"_blank\" title=\"{attachTitle}\">{++index}.{attachTitle}</a>");
                    sb.Append("</div>");
                }
            });
            return(new HtmlString(sb.ToString()));
        }
예제 #3
0
 public ContentWidgetBase(WidgetFactory ace)
     : base(ace)
 {
     Controls = new List <IHtmlContent>();
 }
예제 #4
0
 public static HtmlString HtmlForMobile(this WidgetFactory html, string mobile, string none = "未绑定")
 {
     mobile = (mobile.HasValue() ? (mobile.Left(3) + "****" + mobile.Right(4)) : none);
     return(new HtmlString(mobile));
 }
예제 #5
0
 public ListWidgetBase(WidgetFactory ace) : base(ace)
 {
     Items = new List <Item>();
 }
예제 #6
0
 public TreeWidgetBase(WidgetFactory ace)
     : base(ace)
 {
     Nodes = new List <Node>();
 }
예제 #7
0
 public void Initialize(WidgetFactory ace)
 {
     Ace     = ace;
     Context = ace.Context;
 }
예제 #8
0
 public WidgetBase(WidgetFactory ace) : this()
 {
     Initialize(ace);
 }
예제 #9
0
 public TreeNodeWidgetBase(WidgetFactory ace, T tree)
     : base(ace)
 {
     base.Widget = null;
     Tree        = tree;
 }