Exemple #1
0
        /// <summary>
        /// 格式化之前
        /// </summary>
        protected override void BeforeFormat()
        {
            base.BeforeFormat();

            var container = new HtmlElement(HtmlTag.Div);

            container.AddClass("container-fluid");
            Body.Append(container);

            var row = new HtmlElement(HtmlTag.Div);

            row.AddClass("row");
            container.Append(row);

            var col = new HtmlElement(HtmlTag.Div);

            col.AddClass("col-sm-6 col-sm-offset-3");
            col.AddClass("simple-main");
            row.Append(col);

            var script = new Script(string.Format("$man.init('.simple-main', '{0}');", Location.Path));

            Body.Append(script);
            foreach (var item in InitAfterScripts)
            {
                Body.Append(item);
            }
        }
        public IHtmlNode CellTag(DateTime currentDay, DateTime? selectedDate, string urlFormat, bool isOtherMonth)
        {
            IHtmlNode cell = new HtmlElement("td");

            if (isOtherMonth)
            {
                cell.AddClass("t-other-month");
            }
            else if (selectedDate.HasValue && IsInRange(selectedDate.Value) && currentDay.Day == selectedDate.Value.Day)
            {
                cell.AddClass(UIPrimitives.SelectedState);
            }

            if (IsInRange(currentDay))
            {
                var href = GetUrl(currentDay, urlFormat);

                IHtmlNode link = new HtmlElement("a")
                                 .AddClass(UIPrimitives.Link + (href != "#" ? " t-action-link" : string.Empty))
                                 .Attribute("href", href)
                                 .Attribute("title", currentDay.ToLongDateString())
                                 .Text(currentDay.Day.ToString());

                cell.Children.Add(link);
            }
            else
            {
                cell.Html("&nbsp;");
            }

            return cell;
        }
Exemple #3
0
        /// <summary>
        /// 添加查找面板
        /// </summary>
        /// <typeparam name="TModel"></typeparam>
        /// <param name="source"></param>
        /// <param name="location"></param>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <param name="placeHolder"></param>
        public static void AddSearchPanel <TModel>(this DynamicTable <TModel> source, ILocation location, string key, string value, string placeHolder = null) where TModel : class
        {
            if (source == null)
            {
                return;
            }
            if (location == null)
            {
                throw new ArgumentNullException("location");
            }
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            var connector = "?";

            if (location.Path.IndexOf("?") > -1)
            {
                connector = "&";
            }
            var script = string.Format("$app.same('{0}{1}{2}=' + encodeURIComponent($.trim($(this).parent().parent().find('input[name={2}]').val())))", location.Path, connector, key);

            var form = new HtmlElement(HtmlTag.Form);

            form.OnClient(HtmlEvent.Submit, string.Format("$app.same('{0}{1}{2}=' + encodeURIComponent($.trim($(this).find('input[name={2}]').val()))); return false;", location.Path, connector, key));
            form.PrependTo(source);

            var search = new HtmlElement(HtmlTag.Div);

            search.AddClass("form-group");
            search.AppendTo(form);

            var group = new HtmlElement(HtmlTag.Div);

            group.AppendTo(search);
            group.AddClass(Column.Sm5);
            group.AddClass("input-group");
            var input = new HtmlElement(HtmlTag.Input);

            input.AppendTo(group);
            input.Attribute(HtmlAttribute.Name, key);
            input.Attribute(HtmlAttribute.Value, value);
            input.Attribute(HtmlAttribute.PlaceHolder, placeHolder);
            input.AddClass("form-control");
            var span = new HtmlElement(HtmlTag.Span);

            span.AddClass("input-group-addon");
            span.AppendTo(group);
            var button = new HtmlElement(HtmlTag.Input);

            button.AppendTo(span);
            button.Attribute(HtmlAttribute.Value, "查找");
            button.Attribute(HtmlAttribute.Type, "submit");
        }
Exemple #4
0
        /// <summary>
        /// 设置输入模式
        /// </summary>
        public override void SetInputMode()
        {
            Tag = HtmlTag.Div;
            AddClass("mulit-file-group");
            if (!PropertyContent.Disabled && !PropertyContent.ReadOnly)
            {
                SetFileInput();
            }
            foreach (var item in Value)
            {
                var group = new HtmlElement(HtmlTag.Div);
                group.AppendTo(this);
                group.AddClass("control-line");

                var control = new HtmlElement(HtmlTag.Div);
                control.AppendTo(group);
                control.AddClass("form-control");
                if (PropertyContent.ReadOnly)
                {
                    control.Attribute(HtmlAttribute.ReadOnly, "readonly");
                }
                if (PropertyContent.Disabled)
                {
                    control.Attribute(HtmlAttribute.ReadOnly, "disabled");
                }

                var icon = Util.ContentTypeMapping.Instance.ToIcon(item.ContentType, item.FileName);
                icon.CreateElement().AppendTo(control);
                var a = new HtmlElement(HtmlTag.A);
                a.Text(item.FileName);
                a.AddClass("icon-fa-text");
                a.Attribute(HtmlAttribute.Href, item.Location);
                a.Attribute(HtmlAttribute.Target, "_none");
                HtmlData.SetContext(a);
                a.AppendTo(control);

                var delInput = new HtmlElement(HtmlTag.Input);
                delInput.AppendTo(group);
                delInput.Attribute(HtmlAttribute.Type, "hidden");
                delInput.Attribute(HtmlAttribute.Name, string.Format("{0}_DeleteMark", Name));
                delInput.AddClass("del-file-input");
                delInput.Attribute(HtmlAttribute.Value, "0");

                if (FileOption.SupportDelete && (!PropertyContent.Disabled && !PropertyContent.ReadOnly))
                {
                    group.AddClass("input-group");

                    var span = new HtmlElement(HtmlTag.Span);
                    span.AppendTo(group);
                    span.AddClass("input-group-addon del-files");
                    span.Append(FontAwesome.Times.CreateElement());
                }
            }
            SetFormValidator();
        }
Exemple #5
0
        /// <summary>
        /// 格式化
        /// </summary>
        /// <param name="outer"></param>
        protected override void Format(IHtmlOutput outer)
        {
            var name = outer.Generator.GetGeneratorName();

            SetTableAction(outer, name);

            foreach (var item in FrontNodes)
            {
                item.Format(outer);
            }

            var table = new HtmlElement(HtmlTag.Table);

            table.AddClass(name);
            table.AddClass("dataTable");
            table.AddClass("hover");
            table.Data("parameter", GetSelectedParameterName());

            var header = new HtmlElement(HtmlTag.THead);

            table.Append(header);
            var tbody = new HtmlElement(HtmlTag.TBody);
            var count = SetBody(tbody);

            table.Append(tbody);
            var footer = new HtmlElement(HtmlTag.TFoot);

            table.Append(footer);

            header.Append(CreateDefinitionColumns());
            footer.Append(CreateDefinitionColumns());

            base.Append(table);
            if (IsDisplayTableInfo)
            {
                base.Append(GetBodyTableInfo(count));
            }
            base.Format(outer);

            foreach (var item in AfterNodes)
            {
                item.Format(outer);
            }

            outer.AddEvent(AppEvent.Load,
                           string.Format(
                               "oldmansoft.webman.setStaticTable(view, '{0}', {1});",
                               name,
                               GetOptionScript()
                               )
                           );
        }
Exemple #6
0
        private void SetSearchAction(IHtmlElement header)
        {
            var form = new HtmlElement(HtmlTag.Form);

            header.Append(form);
            form.Attribute(HtmlAttribute.Method, "post").Attribute(HtmlAttribute.Action, SearchAction.Path);
            SearchAction.Behave.SetTargetAttribute(form);

            var input = new HtmlElement(HtmlTag.Input)
                        .Attribute(HtmlAttribute.Type, "text")
                        .Attribute(HtmlAttribute.Name, SearchInputName)
                        .AddClass("form-control");

            if (!string.IsNullOrEmpty(SearchAction.Display))
            {
                input.Attribute(HtmlAttribute.PlaceHolder, SearchAction.Display);
            }

            var button = new HtmlElement(HtmlTag.I).AddClass("fa fa-search");

            form.Append(input).Append(button);
            if (SearchAction == Location.Empty)
            {
                form.AddClass("hidden");
            }
        }
Exemple #7
0
        /// <summary>
        /// 创建元素
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static HtmlElement CreateElement(this FontAwesome source)
        {
            var result = new HtmlElement(HtmlTag.I);

            result.AddClass(string.Format("fa fa-{0}", source.ToString().ToLower().Replace("_", "-")));
            return(result);
        }
Exemple #8
0
        private IHtmlElement CreateForm(string action, string returnUrl)
        {
            var form = new HtmlElement(HtmlTag.Form).Attribute(HtmlAttribute.Method, "post").Attribute(HtmlAttribute.Action, action);

            if (returnUrl != null)
            {
                var hidden = new HtmlElement(HtmlTag.Input);
                hidden.Attribute(HtmlAttribute.Name, "ReturnUrl");
                hidden.Attribute(HtmlAttribute.Type, "hidden");
                hidden.Attribute(HtmlAttribute.Value, returnUrl);
                form.Append(hidden);
            }

            form.AddClass("form-horizontal");
            form.Append(CreateFormGroup("帐号", "Account", "text"));
            form.Append(CreateFormGroup("密码", "Password", "password"));

            var group = new HtmlElement(HtmlTag.Div);

            form.Append(group);
            group.AddClass("form-group btn-group-center");

            var submit = new HtmlElement(HtmlTag.Input).Attribute(HtmlAttribute.Type, "submit").Attribute(HtmlAttribute.Value, "提交");

            submit.AddClass("btn btn-primary");
            group.Append(submit);

            return(form);
        }
        private HtmlNode DealCustom(FileLocation file, ModelPropertyContent propertyContent)
        {
            var icon = ContentTypeMapping.Instance.ToIcon(file.ContentType, file.FileName);

            if (icon == FontAwesome.Picture_O)
            {
                var a = new HtmlElement(HtmlTag.A);
                a.Attribute(HtmlAttribute.Href, file.Location);
                a.Attribute(HtmlAttribute.Target, "_none");
                propertyContent.Attributes.Get <Annotations.HtmlDataAttribute>().SetContext(a);
                var img = new HtmlElement(HtmlTag.Img);
                img.Attribute(HtmlAttribute.Src, file.Location);
                img.AppendTo(a);
                return(a);
            }
            else
            {
                var a = new HtmlElement(HtmlTag.A);
                a.AddClass("icon-fa-text");
                a.Attribute(HtmlAttribute.Href, file.Location);
                a.Attribute(HtmlAttribute.Target, "_none");
                propertyContent.Attributes.Get <Annotations.HtmlDataAttribute>().SetContext(a);
                a.Text(file.FileName);
                return(new HtmlNodeContainer(icon.CreateElement(), a));
            }
        }
Exemple #10
0
        public void Should_add_class()
        {
            IHtmlNode tag = new HtmlElement("div");

            tag.AddClass("t-widget");
            Assert.Equal("t-widget", tag.Attribute("class"));
        }
Exemple #11
0
        /// <summary>
        /// 设置查找框
        /// </summary>
        /// <param name="location"></param>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <param name="placeholder"></param>
        public void SetSearch(ILocation location, string key = "key", string value = null, string placeholder = null)
        {
            HeaderSearchForm = new HtmlElement(HtmlTag.Form);
            HeaderSearchForm.Attribute(HtmlAttribute.Action, location.Path);
            HeaderSearchForm.Attribute(HtmlAttribute.Target, LinkBehave.Self.GetTarget());
            var group = new HtmlElement(HtmlTag.Div);

            group.AddClass("input-group");
            group.AppendTo(HeaderSearchForm);
            var input = new HtmlElement(HtmlTag.Input);

            input.AddClass("form-control");
            input.Attribute(HtmlAttribute.Name, key);
            if (!string.IsNullOrWhiteSpace(value))
            {
                input.Attribute(HtmlAttribute.Value, value);
            }
            if (!string.IsNullOrWhiteSpace(placeholder))
            {
                input.Attribute(HtmlAttribute.PlaceHolder, placeholder);
            }
            input.AppendTo(group);
            var addon = new HtmlElement(HtmlTag.Span);

            addon.AddClass("input-group-addon");
            addon.Append(FontAwesome.Search.CreateElement());
            addon.AppendTo(group);
            addon.OnClient(HtmlEvent.Click, "$(this).parentsUntil('form').submit();");
        }
Exemple #12
0
        /// <summary>
        /// 设置输入模式
        /// </summary>
        public override void SetInputMode()
        {
            Tag = HtmlTag.Div;
            foreach (var option in Source)
            {
                var label = new HtmlElement(HtmlTag.Label);
                Append(label);
                label.AddClass("radio-inline");

                var input = new HtmlElement(HtmlTag.Input);
                label.Append(input);
                input.Attribute(HtmlAttribute.Type, "radio");
                input.Attribute(HtmlAttribute.Name, Name);
                input.Attribute(HtmlAttribute.Value, option.Key.ToString().ToLower());
                if (Value.HasValue && option.Key == Value.Value)
                {
                    input.Attribute(HtmlAttribute.Checked, "checked");
                }
                if (PropertyContent.Disabled || PropertyContent.ReadOnly)
                {
                    input.Attribute(HtmlAttribute.Disabled, "disabled");
                }
                HtmlData.SetContext(input);
                label.Append(new HtmlRaw(option.Value.HtmlEncode()));
            }
        }
Exemple #13
0
        /// <summary>
        /// 设置输入模式
        /// </summary>
        public override void SetInputMode()
        {
            Tag = HtmlTag.Div;
            foreach (var option in Options)
            {
                var label = new HtmlElement(HtmlTag.Label);
                Append(label);
                label.AddClass("checkbox-inline");

                var input = new HtmlElement(HtmlTag.Input);
                label.Append(input);
                input.Attribute(HtmlAttribute.Type, "checkbox");
                input.Attribute(HtmlAttribute.Name, Name);
                input.Attribute(HtmlAttribute.Value, option.Value);
                if (Values.Contains(option.Value))
                {
                    input.Attribute(HtmlAttribute.Checked, "checked");
                }
                if (PropertyContent.Disabled || PropertyContent.ReadOnly)
                {
                    input.Attribute(HtmlAttribute.Disabled, "disabled");
                }
                HtmlData.SetContext(input);
                label.Append(new HtmlRaw(option.Text.HtmlEncode()));
            }
        }
        private HtmlNode DealBase(IFormFile file)
        {
            var icon = ContentTypeMapping.Instance.ToIcon(file.ContentType, file.FileName);
            var span = new HtmlElement(HtmlTag.Span);

            span.AddClass("icon-fa-text");
            span.Text(file.FileName);
            return(new HtmlNodeContainer(icon.CreateElement(), span));
        }
Exemple #15
0
        /// <summary>
        /// 设置查看模式
        /// </summary>
        public override void SetViewMode()
        {
            Tag = HtmlTag.Div;
            AddClass("control-value");

            var i = new HtmlElement(HtmlTag.I);

            Append(i);
            i.AddClass("fa fa-eye-slash");
        }
Exemple #16
0
        private void SetQuickMenu(HtmlElement nav)
        {
            if (Quick.Avatar.Photo == null && Quick.Avatar.Display == null)
            {
                return;
            }

            var account = new HtmlElement(HtmlTag.A).AddClass("webman-account");

            if (string.IsNullOrEmpty(Quick.Avatar.Photo))
            {
                account.Append(FontAwesome.User.CreateElement());
            }
            else
            {
                account.Append(new HtmlElement(HtmlTag.Img).Attribute(HtmlAttribute.Src, Quick.Avatar.Photo));
            }
            account.Append(new HtmlElement(HtmlTag.Span).Text(Quick.Avatar.Display));
            account.AddClass("dropdown-toggle");
            account.Data("toggle", "dropdown");

            var quick = new HtmlElement(HtmlTag.Li).Append(account);

            nav.Append(quick);
            quick.AddClass("dropdown");

            if (Quick.Items.Count == 0)
            {
                return;
            }
            var quickItems = new HtmlElement(HtmlTag.Ul);

            quick.Append(quickItems);
            quickItems.AddClass("dropdown-menu");
            quickItems.AddClass("pull-right");
            foreach (var item in Quick.Items)
            {
                var a = item.CreateElement();
                a.AddClass("badge-container");
                quickItems.Append(new HtmlElement(HtmlTag.Li).Append(a));
            }
        }
Exemple #17
0
        protected virtual IHtmlNode CreateFooter(GridRenderingData renderingData)
        {
            var tfoot = new HtmlElement("tfoot");

            tfoot.AddClass("k-grid-footer");

            var tr = DataSectionBuilder.CreateFooter(renderingData);

            tr.AppendTo(tfoot);
            return(tfoot);
        }
        public void Apply(IHtmlNode parent)
        {
            var span = new HtmlElement("span");

            span.Attributes(button.ImageHtmlAttributes);
            if (button.SpriteCssClass.HasValue())
            {
                span.AddClass(UIPrimitives.Icon, button.SpriteCssClass);
            }

            span.AppendTo(parent);
        }
Exemple #19
0
        /// <summary>
        /// 设置查看模式
        /// </summary>
        public override void SetViewMode()
        {
            Tag = HtmlTag.Div;
            AddClass("control-value");

            var i = new HtmlElement(HtmlTag.I);

            Append(i);
            i.AddClass("fa fa-calendar-o");

            Append(new HtmlText(GetValue()));
        }
Exemple #20
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="text"></param>
        /// <param name="grid"></param>
        /// <returns></returns>
        public FormHorizontal Add(string text, GridOption grid)
        {
            if (grid == null)
            {
                throw new ArgumentNullException("grid");
            }
            var group = new HtmlElement(HtmlTag.Div);

            Append(group);
            group.AddClass("form-group");

            var label = new HtmlElement(HtmlTag.Label);

            group.Append(label);
            label.AddClass(Column.Sm3 | Column.Md2);
            label.AddClass("control-label");
            label.Text(text);

            group.Append(grid);
            return(this);
        }
        public void Apply(IHtmlNode parent)
        {
            var span = new HtmlElement("span");

            span.Attributes(button.ImageHtmlAttributes);
            if (button.SpriteCssClass.HasValue())
            {
                span.AddClass(UIPrimitives.Icon, button.SpriteCssClass);
            }

            span.AppendTo(parent);
        }
        protected override IHtmlNode BuildCore()
        {
            var li = new HtmlElement("li");

            if (tool.Template.HasValue())
            {
                li.AddClass(UIPrimitives.Editor.Custom);

                tool.Template.Apply(li);
            }
            else
            {
                li.AddClass(UIPrimitives.Editor.ToolbarButton);
                var a = new HtmlElement("a")
                        .Attributes(tool.HtmlAttributes)
                        .Attribute("href", "#")
                        .AddClass(UIPrimitives.Editor.ToolIcon);

                a.AppendTo(li);
            }

            return li;
        }
Exemple #23
0
        private void AddButtonGroup()
        {
            if (Buttons.Count == 0)
            {
                return;
            }

            var group = new HtmlElement(HtmlTag.Div);

            Append(group);
            group.AddClass("form-group");
            for (var i = 0; i < Buttons.Count; i++)
            {
                var container = new HtmlElement(HtmlTag.Div);
                if (i == 0)
                {
                    container.AddClass(ColumnOffset.Sm3 | ColumnOffset.Md2);
                }
                container.AddClass("col-container");
                container.Append(Buttons[i]);
                container.AppendTo(group);
            }
        }
        protected override IHtmlNode BuildCore()
        {
            var li = new HtmlElement("li");

            if (tool.Template.HasValue())
            {
                li.AddClass(UIPrimitives.Editor.Custom);

                tool.Template.Apply(li);
            }
            else
            {
                li.AddClass(UIPrimitives.Editor.ToolbarButton);
                var a = new HtmlElement("a")
                        .Attributes(tool.HtmlAttributes)
                        .Attribute("href", "#")
                        .AddClass(UIPrimitives.Editor.ToolIcon);

                a.AppendTo(li);
            }

            return(li);
        }
Exemple #25
0
        private void SetFileInput()
        {
            var group = new HtmlElement(HtmlTag.Div);

            group.AppendTo(this);
            group.AddClass("input-group control-line");

            var span = new HtmlElement(HtmlTag.Span);

            span.AppendTo(group);
            span.AddClass("input-group-addon");
            span.Append(new HtmlElement(HtmlTag.I).AddClass("fa fa-files-o"));

            var templateInput = new HtmlElement(HtmlTag.Input);

            templateInput.AppendTo(group);
            templateInput.Attribute(HtmlAttribute.Type, "file");
            templateInput.Attribute(HtmlAttribute.Name, Name);
            HtmlData.SetContext(templateInput);
            templateInput.Data("temporary", "temporary");
            templateInput.Data("temporary-for", Name);
            if (FileOption.Accept != Annotations.ContentType.None)
            {
                var list = new List <string>();
                foreach (var item in FileOption.Accept.ToArray())
                {
                    var contentType = item.ToString().ToLower().Replace('_', '-');
                    if (FileOption.Extensions.Length == 0)
                    {
                        list.Add(string.Format("{0}/*", contentType));
                    }
                    else
                    {
                        foreach (var extension in FileOption.Extensions)
                        {
                            list.Add(string.Format("{0}/{1}", contentType, extension.ToLower()));
                        }
                    }
                }
                templateInput.Attribute(HtmlAttribute.Accept, string.Join(",", list));
            }
            templateInput.AddClass("template-mulit-file-input");

            var virtualInput = new HtmlElement(HtmlTag.Div);

            virtualInput.AddClass("form-control virtual-mulit-file-input");
            virtualInput.Text(string.IsNullOrEmpty(PropertyContent.Description) ? "选择多个文件" : PropertyContent.Description);
            virtualInput.AppendTo(group);
            SetAttributeDisabledReadOnly(virtualInput, PropertyContent.Disabled);
        }
Exemple #26
0
        public override void SetInputMode()
        {
            Tag = HtmlTag.Div;
            var hidden = new HtmlElement(HtmlTag.Input);

            hidden.Attribute(HtmlAttribute.Type, "hidden");
            hidden.Attribute(HtmlAttribute.Name, Name);
            hidden.Attribute(HtmlAttribute.Value, Value);
            hidden.AppendTo(this);

            var input = new HtmlElement(HtmlTag.Input);

            input.AddClass("form-control");
            input.OnClient(HtmlEvent.Change, "$(this).prev().val($(this).val());");
            input.AppendTo(this);
        }
Exemple #27
0
        private IHtmlElement GetBodyTableInfo(int count)
        {
            var content = new HtmlElement(HtmlTag.Div);

            content.AddClass("table-content");

            var col = new HtmlElement(HtmlTag.Div);

            col.AddClass(Column.Sm12);
            col.AppendTo(content);

            var info = new HtmlElement(HtmlTag.Div);

            info.AddClass("dataTables_info");
            info.Text(string.Format("共 {0} 条数据", count));
            info.AppendTo(col);
            return(content);
        }
Exemple #28
0
        /// <summary>
        /// 创建面板
        /// </summary>
        public Panel()
            : base(HtmlTag.Div)
        {
            Header = new HtmlElement(HtmlTag.Header);
            base.Append(Header);

            HeaderCaption = new HtmlElement(HtmlTag.H2);
            Header.Append(HeaderCaption);

            var tools = new HtmlElement(HtmlTag.Div).AddClass("webman-panel-tools");

            Header.Append(tools);
            tools.Append(new HtmlElement(HtmlTag.A).Append(FontAwesome.Times.CreateElement()).AddClass("webapp-close"));

            Body = new HtmlElement(HtmlTag.Div);
            base.Append(Body);
            Body.AddClass("webman-body");
        }
Exemple #29
0
        /// <summary>
        /// 设置查看模式
        /// </summary>
        public override void SetViewMode()
        {
            Tag = HtmlTag.Ul;
            AddClass("control-value");

            foreach (var item in Value)
            {
                var li = new HtmlElement(HtmlTag.Li);
                li.AppendTo(this);

                var icon = Util.ContentTypeMapping.Instance.ToIcon(item.ContentType, item.FileName);
                li.Append(icon.CreateElement());
                var a = new HtmlElement(HtmlTag.A);
                a.Text(item.FileName);
                a.AddClass("icon-fa-text");
                a.Attribute(HtmlAttribute.Href, item.Location);
                a.Attribute(HtmlAttribute.Target, "_none");
                HtmlData.SetContext(a);
                a.AppendTo(li);
            }
        }
Exemple #30
0
        /// <summary>
        /// 设置输入模式
        /// </summary>
        public override void SetInputMode()
        {
            Tag = HtmlTag.Div;
            AddClass("input-group");

            var span = new HtmlElement(HtmlTag.Span);

            Append(span);
            span.AddClass("input-group-addon");
            span.Append(FontAwesome.Eye_Slash.CreateElement());

            var input = new HtmlElement(HtmlTag.Input);

            Append(input);
            input.Attribute(HtmlAttribute.Type, "password");
            input.Attribute(HtmlAttribute.Name, Name);
            input.Attribute(HtmlAttribute.Value, Value);
            SetAttributeDisabledReadOnlyPlaceHolder(input, PropertyContent.Disabled);
            input.AddClass("form-control");
            HtmlData.SetContext(input);
        }
Exemple #31
0
        /// <summary>
        /// 设置输入模式
        /// </summary>
        public override void SetInputMode()
        {
            Tag = HtmlTag.Div;
            AddClass("input-group");

            var span = new HtmlElement(HtmlTag.Span);

            Append(span);
            span.AddClass("input-group-addon");
            span.Append(FontAwesome.Calendar_O.CreateElement());

            var input = new HtmlElement(HtmlTag.Input);

            Append(input);
            input.Attribute(HtmlAttribute.Type, "datetime-local");
            input.Attribute(HtmlAttribute.Name, Name);
            input.Attribute(HtmlAttribute.Value, GetValue().Replace(" ", "T"));
            SetAttributeDisabledReadOnlyPlaceHolder(input, PropertyContent.ReadOnly || PropertyContent.Disabled);
            input.AddClass("form-control");
            HtmlData.SetContext(input);
        }
Exemple #32
0
        /// <summary>
        /// 设置查看模式
        /// </summary>
        public override void SetViewMode()
        {
            Tag = HtmlTag.Div;
            AddClass("control-value");
            if (Value == null)
            {
                return;
            }

            var icon = Util.ContentTypeMapping.Instance.ToIcon(Value.ContentType, Value.FileName);

            Append(icon.CreateElement());
            var a = new HtmlElement(HtmlTag.A);

            a.Text(Value.FileName);
            a.AddClass("icon-fa-text");
            a.Attribute(HtmlAttribute.Href, Value.Location);
            a.Attribute(HtmlAttribute.Target, "_none");
            HtmlData.SetContext(a);
            a.AppendTo(this);
        }
Exemple #33
0
        private void SetTableAction(IHtmlOutput outer, string name)
        {
            if (TableActions.Count == 0)
            {
                return;
            }

            var tableAction = new HtmlElement(HtmlTag.Div);

            tableAction.AddClass("dataTable-action btn-group");
            tableAction.Data("target", name);
            for (var i = 0; i < TableActions.Count; i++)
            {
                var item = TableActions[i];
                var a    = new HtmlElement(HtmlTag.A);
                tableAction.Append(a);
                a.AddClass("btn");
                a.Data("index", i.ToString());
                a.Data("path", item.Location);
                a.Data("behave", ((int)item.Behave).ToString());
                a.Data("other", ((item.IsSupportParameter ? 1 : 0) + (item.IsNeedSelected ? 2 : 0)).ToString());
                if (!string.IsNullOrEmpty(item.ConfirmContent))
                {
                    a.Data("tips", item.ConfirmContent);
                }
                var span = new HtmlElement(HtmlTag.Span);
                a.Append(span);
                span.Text(item.Text);

                if (item.IsSupportParameter)
                {
                    IsDisplayCheckboxColumn = true;
                }
            }
            ((IHtmlElement)tableAction).Format(outer);
        }
Exemple #34
0
        protected virtual IHtmlNode CreateFooter(GridRenderingData renderingData)
        {
            var tfoot = new HtmlElement("tfoot");
            tfoot.AddClass("k-grid-footer");

            var tr = DataSectionBuilder.CreateFooter(renderingData);
            tr.AppendTo(tfoot);
            return tfoot;
        }