private static string CreateRowOperator(IFieldValueProvider row, HtmlAttributeBuilder attrBuilder, Operator operRow) { string caption = operRow.Caption; string urlContent = operRow.Content; if (string.IsNullOrEmpty(urlContent)) { return(string.Format(ObjectUtil.SysCulture, "<li>{0}</li>", caption)); } else { attrBuilder.Clear(); attrBuilder.Add("href", "#"); string info = operRow.Info ?? string.Empty; bool isJs = info.Contains("JS"); if (isJs) { string js = "javascript:" + HtmlCommonUtil.ResolveString(row, urlContent); attrBuilder.Add("onClick", js); } else { string attrUrl; if (info.Contains("Dialog")) { string dialogTitle = HtmlCommonUtil.ResolveString(row, operRow.DialogTitle); attrBuilder.Add("data-title", dialogTitle); attrUrl = "data-dialog-url"; } else if (info.Contains("AjaxUrl")) { attrUrl = "data-ajax-url"; } else { attrUrl = "data-url"; } attrBuilder.Add(attrUrl, HtmlUtil.ParseLinkUrl(row, urlContent)); string dataConfirm = operRow.ConfirmData; if (!string.IsNullOrEmpty(dataConfirm)) { attrBuilder.Add("data-confirm", dataConfirm); } } if (info.Contains("_blank")) { attrBuilder.Add("data-target", "_blank"); } return(string.Format(ObjectUtil.SysCulture, "<li><a {0}>{1}</a></li>", attrBuilder.CreateAttribute(), caption)); } }
public static string ParseLinkUrl(IFieldValueProvider provider, string content) { string linkUrl = HtmlCommonUtil.ResolveString(provider, content); return(WebUtil.ResolveUrl(linkUrl)); }
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); }