示例#1
0
        public static string EditCaption(this Tk5FieldInfoEx field, int col, string @class)
        {
            TkDebug.AssertArgumentNull(field, "field", null);

            return(BootcssCommonUtil.EditCaption(field.NickName, field.DisplayName, col, @class));
        }
示例#2
0
        private static string ListButtonFromConfig(Operator optr, IFieldValueProvider receiver)
        {
            string icon;

            if (!string.IsNullOrEmpty(optr.IconClass))
            {
                icon = string.Format(ObjectUtil.SysCulture, "<i class=\"{0} mr5\"></i>",
                                     optr.IconClass);
            }
            else
            {
                icon = string.Empty;
            }
            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            string totalClass            = BootcssCommonUtil.GetTotalClass("mr10", BootcssButton.Default, false);

            builder.Add("type", "button");
            builder.Add("class", totalClass);

            string info = optr.Info ?? string.Empty;
            string attrUrl;
            bool   isJs = info.Contains("JS");

            if (isJs)
            {
                string js = "javascript:" + HtmlCommonUtil.ResolveString(receiver,
                                                                         optr.Content);
                builder.Add("onClick", js);
            }
            else
            {
                if (info.Contains("Dialog"))
                {
                    attrUrl = "data-dialog-url";
                    string dialogTitle = HtmlCommonUtil.ResolveString(receiver, optr.DialogTitle);
                    builder.Add("data-title", dialogTitle);
                }
                else if (info.Contains("AjaxUrl"))
                {
                    attrUrl = "data-ajax-url";
                    if (info.Contains("Post"))
                    {
                        builder.Add("data-method", "post");
                    }
                }
                else
                {
                    attrUrl = "data-url";
                }
                builder.Add(attrUrl, HtmlUtil.ParseLinkUrl(receiver, optr.Content));
                if (!string.IsNullOrEmpty(optr.ConfirmData))
                {
                    builder.Add("data-confirm", optr.ConfirmData);
                }
            }

            string button = string.Format(ObjectUtil.SysCulture, "<button {1}>{2}{0}</button>",
                                          optr.Caption, builder.CreateAttribute(), icon);

            return(button);
        }