public XElement GetDefaultMarkup(Field field) { var result = new XElement("Field", new XAttribute("name", field.Name)); string functionName = (string)field.FunctionNode.Attribute("name"); IFunction function; if (functionName != null && FunctionFacade.TryGetFunction(out function, functionName)) { if (function.ParameterProfiles.Any(p => p.Name == "Name" && p.IsRequired)) { result.Add(new XElement(Namespaces.Function10 + "param", new XAttribute("name", "Name"), new XAttribute("value", StringResourceSystemFacade.ParseString(field.Label)))); } if (function.ParameterProfiles.Any(p => p.Name == "Label")) { result.Add(new XElement(Namespaces.Function10 + "param", new XAttribute("name", "Label"), new XAttribute("value", StringResourceSystemFacade.ParseString(field.Label)))); } } return(result); }
/// <exclude /> protected override void RenderAttributes(HtmlTextWriter writer) { string clientId = Attributes["clientid"]; if (clientId.IsNullOrEmpty() && !ID.IsNullOrEmpty()) { clientId = ID; } if (!clientId.IsNullOrEmpty()) { writer.WriteAttribute("id", clientId); Attributes.Remove("clientid"); } string label = Attributes["label"]; if (!label.IsNullOrEmpty()) { Attributes["label"] = StringResourceSystemFacade.ParseString(label); } Attributes.Remove("OnServerClick"); // Server-side attribute Attributes.Remove("OnCommand"); // Server-side attribute this.Attributes.Render(writer); }
private void codeActivity1_ExecuteCode(object sender, EventArgs e) { var templateTypes = new List <Tuple <string, string, int> >(); foreach (var providerInfo in PageTemplateFacade.GetProviders()) { var provider = providerInfo.Value; if (provider.AddNewTemplateWorkflow == null) { continue; } templateTypes.Add(new Tuple <string, string, int>( providerInfo.Key, !provider.AddNewTemplateLabel.IsNullOrEmpty() ? StringResourceSystemFacade.ParseString(provider.AddNewTemplateLabel) : providerInfo.Key, provider.GetPageTemplates().Count())); } Verify.That(templateTypes.Any(), "No page templates supporting adding new templates defined in configuration"); // Most used page template type will be first in the list and preselected string preseceltedTemplate = templateTypes.OrderByDescending(t => t.Item3).Select(t => t.Item1).First(); List <KeyValuePair <string, string> > options = templateTypes .OrderBy(t => t.Item2) // Sorting alphabetically by label .Select(t => new KeyValuePair <string, string>(t.Item1, t.Item2)).ToList(); this.Bindings.Add(Binding_TemplateTypeOptions, options); this.Bindings.Add(Binding_TemplateTypeId, preseceltedTemplate); }
/// <exclude /> public string ReplaceValues(DynamicValuesHelperReplaceContext context) { string currentValue = this.Template; if (this.DataFieldValueHelper != null) { currentValue = this.DataFieldValueHelper.ReplaceValues(currentValue, context.PiggybagDataFinder, context.CurrentDataItem, this.UseUrlEncode); } if (currentValue.Contains(CurrentEntityTokenMask)) { string serializedEntityToken = context.CurrentEntityToken != null ? EntityTokenSerializer.Serialize(context.CurrentEntityToken) : "(null)"; if (this.UseUrlEncode) { serializedEntityToken = HttpUtility.UrlEncode(serializedEntityToken); } currentValue = currentValue.Replace(CurrentEntityTokenMask, serializedEntityToken); } return(StringResourceSystemFacade.ParseString(currentValue)); }
private void LoadExtraSettings(FormFieldModel field, XElement bindingsXElement, XElement lastTabElement) { var config = FormBuilderConfiguration.GetSection(); var plugin = (DynamicFormBuilderConfiguration)config.Plugins["dynamic"]; var inputElement = plugin.InputElementHandlers.Single(el => el.ElementType.GetType() == field.InputElementType.GetType()); var settingsHandler = inputElement.SettingsHandler; if (settingsHandler != null) { var formFile = "\\InstalledPackages\\CompositeC1Contrib.FormBuilder.Dynamic\\InputElementSettings\\" + inputElement.Name + ".xml"; var settingsMarkupProvider = new FormDefinitionFileMarkupProvider(formFile); var formDefinitionElement = XElement.Load(settingsMarkupProvider.GetReader()); var settingsTab = new XElement(Namespaces.BindingFormsStdUiControls10 + "PlaceHolder"); var layout = formDefinitionElement.Element(Namespaces.BindingForms10 + FormKeyTagNames.Layout); var bindings = formDefinitionElement.Element(Namespaces.BindingForms10 + FormKeyTagNames.Bindings); settingsTab.Add(new XAttribute("Label", StringResourceSystemFacade.ParseString(inputElement.Name))); settingsTab.Add(layout.Elements()); bindingsXElement.Add(bindings.Elements()); lastTabElement.AddAfterSelf(settingsTab); settingsHandler.Load(field); foreach (var prop in settingsHandler.GetType().GetProperties()) { var value = prop.GetValue(settingsHandler, null); Bindings.Add(prop.Name, value); } } }
/// <exclude /> public static void Parse(XContainer container) { IEnumerable <XElement> elements = container.Descendants().ToList(); foreach (XElement element in elements) { if (element.Name.Namespace == LocalizationXmlConstants.XmlNamespace) { if (element.Name.LocalName == "string") { HandleStringElement(element); } else if (element.Name.LocalName == "switch") { HandleSwitchElement(element); } } IEnumerable <XAttribute> attributes = element.Attributes().ToList(); foreach (XAttribute attribute in attributes) { Match match = _attributRegex.Match(attribute.Value); if ((match.Success) && (match.Groups["type"].Value == "lang")) { string newValue = StringResourceSystemFacade.ParseString(string.Format("${{{0}}}", match.Groups["id"].Value)); attribute.SetValue(newValue); } } } }
private void BuildWidgets(ActionInformation action, PlaceHolder placeHolder, bool createEvenIfDisabled) { if (!action.Enabled && !createEvenIfDisabled) { return; } var bindings = new Dictionary <string, object>(); foreach (var parameterProfile in action.ParameterProfiles) { var loadedValue = action.ParameterValues.FirstOrDefault(p => p.Item1 == parameterProfile.Name); object parameterValue = loadedValue != null ? loadedValue.Item2 : parameterProfile.GetDefaultValue(); bindings.Add(parameterProfile.Name, parameterValue); } action.FormTreeCompiler = FunctionUiHelper.BuildWidgetForParameters( action.ParameterProfiles, bindings, "widgets", StringResourceSystemFacade.ParseString(action.ConfigurationElement.Label), WebManagementChannel.Identifier); action.Control = (IWebUiControl)action.FormTreeCompiler.UiControl; action.ControlPlaceHolder = placeHolder; var webControl = action.Control.BuildWebControl(); placeHolder.Controls.Add(webControl); }
/// <exclude /> protected override void Render(HtmlTextWriter writer) { writer.WriteBeginTag("ui:checkbox"); writer.WriteAttribute("label", StringResourceSystemFacade.ParseString(this.ItemLabel ?? "")); if (string.IsNullOrEmpty(this.ToolTip) == false) { writer.WriteAttribute("title", StringResourceSystemFacade.ParseString(this.ToolTip ?? "")); } writer.WriteAttribute("name", this.UniqueID); if (this.AutoPostBack) { writer.WriteAttribute("callbackid", this.ClientID); writer.WriteAttribute("oncommand", "this.dispatchAction(PageBinding.ACTIONEVENT_DOPOSTBACK);"); } writer.WriteAttribute("ischecked", this.Checked.ToString().ToLower()); this.WriteClientAttributes(writer); writer.Write(HtmlTextWriter.SelfClosingTagEnd); }
private void showErrorCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e) { List<string> rowHeader = new List<string>(); rowHeader.Add(StringResourceSystemFacade.ParseString("${Composite.Plugins.PackageElementProvider, InstallLocalPackage.ShowError.MessageTitle}")); this.UpdateBinding("ErrorHeader", rowHeader); }
private ConsoleSearchResultFacetField[] EmptyFacetsFromSelections( ConsoleSearchQuery query, List <DocumentField> facetFields) { if (query.Selections == null) { return(null); } return((from selection in query.Selections where selection.Values.Length > 0 let facetField = facetFields.Where(ff => ff.Name == selection.FieldName) .FirstOrException($"Facet field '{selection.FieldName}' not found") select new ConsoleSearchResultFacetField { FieldName = MakeFieldNameJsFriendly(selection.FieldName), Label = StringResourceSystemFacade.ParseString(facetField.Label), Facets = selection.Values.Select(value => new ConsoleSearchResultFacetValue { Label = (facetField.Facet.PreviewFunction ?? (v => v))(value), Value = value, HitCount = 0 }).ToArray() }).ToArray()); }
/// <exclude /> protected void ShowFieldMessage(string fieldBindingPath, string message) { var flowControllerServicesContainer = GetFlowControllerServicesContainer(); var formFlowRenderingService = flowControllerServicesContainer.GetService <IFormFlowRenderingService>(); formFlowRenderingService.ShowFieldMessage(fieldBindingPath, StringResourceSystemFacade.ParseString(message)); }
/// <exclude /> protected void ShowFieldMessage(string fieldBindingPath, string message) { FlowControllerServicesContainer flowControllerServicesContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId); IFormFlowRenderingService formFlowRenderingService = flowControllerServicesContainer.GetService <IFormFlowRenderingService>(); formFlowRenderingService.ShowFieldMessage(fieldBindingPath, StringResourceSystemFacade.ParseString(message)); }
/// <summary> /// Tries to find a locale title for given tag /// </summary> /// <param name="tag"></param> /// <returns></returns> public string GetTagTitle(string tag) { if (_tagToTitleMap.ContainsKey(tag)) { return(StringResourceSystemFacade.ParseString(_tagToTitleMap[tag])); } return(tag); }
private void AppendFolderManagementActions(string websiteFolderPath, IEnumerable <IFolderWhiteList> manageableFolderWhiteLists, IList <ElementAction> folderActions) { for (int i = 0; i < _manageableKeyNames.Count; i++) { string keyName = _manageableKeyNames[i]; string itemLabel = StringResourceSystemFacade.ParseString(_manageableKeyNameLabels[i]); ResourceHandle icon = null; string label = null; string tooltip = null; WorkflowActionToken workflowActionToken = null; ActionCheckedStatus checkedStatus = ActionCheckedStatus.Uncheckable; if (manageableFolderWhiteLists.Where(f => f.KeyName == keyName && f.TildeBasedPath == IFolderWhiteListExtensions.GetTildePath(websiteFolderPath)).Any()) { workflowActionToken = new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.RemoveWebsiteFolderFromWhiteListWorkflow"), _changeWhiteListPermissionTypes); label = StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "RemoveFolderFromWhiteListTitle"); tooltip = StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "RemoveFolderFromWhiteListToolTip"); icon = WebsiteFileElementProvider.RemoveFolderFromWhiteList; checkedStatus = ActionCheckedStatus.Checked; } else { workflowActionToken = new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.AddWebsiteFolderToWhiteListWorkflow"), _changeWhiteListPermissionTypes); label = StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "AddFolderToWhiteListTitle"); tooltip = StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "AddFolderToWhiteListToolTip"); icon = WebsiteFileElementProvider.AddFolderToWhiteList; checkedStatus = ActionCheckedStatus.Unchecked; } label = string.Format(label, itemLabel); tooltip = string.Format(tooltip, itemLabel); workflowActionToken.Payload = keyName; folderActions.Add( new ElementAction(new ActionHandle(workflowActionToken)) { VisualData = new ActionVisualizedData { Label = label, ToolTip = tooltip, Icon = icon, Disabled = false, ActionLocation = new ActionLocation { ActionType = ActionType.Other, IsInFolder = false, IsInToolbar = false, ActionGroup = PrimaryFolderToolsActionGroup }, ActionCheckedStatus = checkedStatus } }); } }
/// <exclude /> public static string DescriptionLocalized(this IMetaFunction function) { if (function.Description != null && function.Description.Contains("${")) { return(StringResourceSystemFacade.ParseString(function.Description)); } return(function.Description); }
/// <exclude /> protected override void RenderContents(HtmlTextWriter writer) { for (int i = 0; i < this.Items.Count; i++) { string label = StringResourceSystemFacade.ParseString(this.Items[i].Text); int firstNonSpaceSpacePosition = 0; while (firstNonSpaceSpacePosition < label.Length && label.Substring(firstNonSpaceSpacePosition, 1) == " ") { firstNonSpaceSpacePosition++; } string spacing = new String(Convert.ToChar(160), firstNonSpaceSpacePosition * 2); this.Items[i].Text = string.Concat(spacing, label.Substring(firstNonSpaceSpacePosition)); } if (this.SimpleSelectorMode == false) { ListItemCollection items = this.Items; int count = items.Count; if (count > 0) { bool flag = false; for (int i = 0; i < count; i++) { ListItem item = items[i]; if (item.Enabled) { writer.WriteBeginTag("ui:selection"); if (item.Selected && this.SelectionRequired == false) { if (flag) { this.VerifyMultiSelect(); } flag = true; writer.WriteAttribute("selected", "true"); } writer.WriteAttribute("label", item.Text, true); writer.WriteAttribute("value", item.Value, true); writer.WriteAttribute("tooltip", item.Text, true); if (this.Page != null) { this.Page.ClientScript.RegisterForEventValidation(this.UniqueID, item.Value); } writer.Write(HtmlTextWriter.SelfClosingTagEnd); } } } } else { base.RenderContents(writer); } }
private void ShowServerValidationErrors(FormTreeCompiler formTreeCompiler, Dictionary <string, Exception> serverValidationErrors) { foreach (var serverValidationError in serverValidationErrors) { string controlId = formTreeCompiler.GetBindingToClientIDMapping()[serverValidationError.Key]; string message = StringResourceSystemFacade.ParseString(serverValidationError.Value.Message); plhErrors.Controls.Add(new FieldMessage(controlId, message)); } }
/// <exclude /> protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { FlowControllerServicesContainer container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId); IManagementConsoleMessageService service = container.GetService <IManagementConsoleMessageService>(); service.ShowMessage(this.DialogType, StringResourceSystemFacade.ParseString(this.Title), StringResourceSystemFacade.ParseString(this.Message)); return(ActivityExecutionStatus.Closed); }
private void rptHandlers_OnItemDataBound(object sender, RepeaterItemEventArgs repeaterItemEventArgs) { var action = (ActionInformation)repeaterItemEventArgs.Item.DataItem; var placeholder = (PlaceHolder)repeaterItemEventArgs.Item.FindControl("plhWidgets"); var chkEnabled = (Composite.Core.WebClient.UiControlLib.CheckBox)repeaterItemEventArgs.Item.FindControl("chkEnabled"); var divWidgets = (HtmlGenericControl)repeaterItemEventArgs.Item.FindControl("divWidgets"); var divEnableAction = (HtmlGenericControl)repeaterItemEventArgs.Item.FindControl("divEnableAction"); string eventTarget = Request.Form["__EVENTTARGET"]; bool chkEnabledIsTarget = eventTarget != null && eventTarget.StartsWith(chkEnabled.NamingContainer.UniqueID) && eventTarget.EndsWith(chkEnabled.ID); bool @checked = Request[chkEnabled.UniqueID] == "on"; bool yesClicked = chkEnabledIsTarget && @checked; bool noClicked = chkEnabledIsTarget && !@checked; if (yesClicked) { action.Enabled = true; action.Initializing = true; action.Element = new XElement("Action", new XAttribute("name", action.ConfigurationElement.Name)); } if (noClicked) { action.Enabled = false; } chkEnabled.Checked = action.Enabled; chkEnabled.ItemLabel = StringResourceSystemFacade.ParseString(action.ConfigurationElement.Label); BuildWidgets(action, placeholder, noClicked); if (action.Enabled && (yesClicked || _isInitialRequest)) { action.Control.InitializeViewState(); } if (action.Enabled) { // Moving the checkbox control inside of the box var checkboxContainer = (PlaceHolder)repeaterItemEventArgs.Item.FindControl("plhCheckboxContainer"); action.ControlPlaceHolder.Controls[0].Controls[0].Controls.AddAt(0, checkboxContainer); } divWidgets.Attributes["style"] = "display: " + (action.Enabled ? "block" : "none") + ";"; divEnableAction.Attributes["style"] = "display: " + (!action.Enabled ? "block" : "none") + ";"; }
/// <exclude /> public HelpDefinition GetLocalized() { if (this.HelpText.StartsWith("${")) { return(new HelpDefinition(StringResourceSystemFacade.ParseString(this.HelpText))); } else { return(new HelpDefinition(this.HelpText)); } }
private static void HandleStringElement(XElement element) { XAttribute attribute = element.Attribute("key"); if (attribute == null) { throw new InvalidOperationException(string.Format("Missing attibute named 'key' at {0}", element)); } string newValue = StringResourceSystemFacade.ParseString(string.Format("${{{0}}}", attribute.Value)); element.ReplaceWith(newValue); }
private static DataTypeDescriptorFormsHelper CreateDataTypeDescriptorFormsHelper(IPageMetaDataDefinition pageMetaDataDefinition, DataTypeDescriptor dataTypeDescriptor) { var bindingPrefix = $"{pageMetaDataDefinition.Name}:{dataTypeDescriptor.Namespace}.{dataTypeDescriptor.Name}"; var helper = new DataTypeDescriptorFormsHelper(dataTypeDescriptor, bindingPrefix); var generatedTypesHelper = new GeneratedTypesHelper(dataTypeDescriptor); helper.AddReadOnlyFields(generatedTypesHelper.NotEditableDataFieldDescriptorNames); helper.FieldGroupLabel = StringResourceSystemFacade.ParseString(pageMetaDataDefinition.Label); return(helper); }
/// <exclude /> protected override void Render(HtmlTextWriter writer) { writer.WriteBeginTag("ui:clickbutton"); writer.WriteAttribute("label", StringResourceSystemFacade.ParseString(this.Text)); writer.WriteAttribute("callbackid", this.ClientID); string oncommand = ""; if (string.IsNullOrEmpty(this.OnClientClick) == false) { oncommand += this.OnClientClick; } if (this.AutoPostBack) { if (oncommand.Length > 0 && oncommand.Trim().EndsWith(";") == false) { oncommand += ";"; } // now implied by callbackid! // oncommand += "this.dispatchAction(PageBinding.ACTION_DOPOSTBACK)"; } if (string.IsNullOrEmpty(oncommand) == false) { writer.WriteAttribute("oncommand", oncommand); } if (string.IsNullOrEmpty(this.CustomClientId) == false) { writer.WriteAttribute("id", this.CustomClientId); } if (string.IsNullOrEmpty(this.ImageUrl) == false) { writer.WriteAttribute("image", this.ImageUrl); } if (string.IsNullOrEmpty(this.ImageUrlWhenDisabled) == false) { writer.WriteAttribute("image-disabled", this.ImageUrlWhenDisabled); } if (this.Enabled == false) { writer.WriteAttribute("isdisabled", "true"); } this.WriteClientAttributes(writer); writer.Write(HtmlTextWriter.SelfClosingTagEnd); }
public static ElementCompileTreeNode BuildRec(XElement element) { int depth = element.Ancestors().Count(); var debugInfo = new XmlSourceNodeInformation(depth, element.Name.LocalName, element.Name.LocalName, element.Name.NamespaceName); var result = new ElementCompileTreeNode(debugInfo); foreach (var attribute in element.Attributes()) { if (attribute.Name.LocalName == "xmlns") { continue; } bool isNamespaceDeclaration = attribute.Name.Namespace == "http://www.w3.org/2000/xmlns/"; var property = new PropertyCompileTreeNode(attribute.Name.LocalName, debugInfo, isNamespaceDeclaration); property.Value = StringResourceSystemFacade.ParseString(attribute.Value); result.AddNamedProperty(property); } foreach (var node in element.Nodes()) { if (node is XElement) { result.Children.Add(BuildRec(node as XElement)); continue; } if (node is XText) { string text = (node as XText).Value; if (string.IsNullOrWhiteSpace(text)) { continue; } var textProperty = new PropertyCompileTreeNode(CompilerGlobals.DefaultPropertyName, debugInfo); textProperty.Value = StringResourceSystemFacade.ParseString(text); result.DefaultProperties.Add(textProperty); continue; } } return(result); }
/// <exclude /> protected override void Render(HtmlTextWriter writer) { writer.WriteBeginTag("ui:treenode"); writer.WriteAttribute("label", StringResourceSystemFacade.ParseString(this.Text)); writer.WriteAttribute("id", this.ClientID); // bool checksumAttrRequired = false; if (!Focused) { writer.WriteAttribute("callbackid", this.ClientID); } if (!string.IsNullOrEmpty(this.ImageUrl)) { writer.WriteAttribute("image", this.ImageUrl); } if (this.Focused) { // checksumAttrRequired = true; writer.WriteAttribute("focused", "true"); } //if(checksumAttrRequired) //{ // writer.WriteAttribute("checksum", DateTime.Now.Ticks.ToString()); //} //if (this.Focused) //{ // writer.WriteAttribute("focused", "true"); // if (string.IsNullOrEmpty(this.OnClientClick) == false) // { // writer.WriteAttribute("onbindingfocus", this.OnClientClick); // } //} //else //{ // string clientScripting = string.Format("this.dispatchAction(PageBinding.ACTION_DOPOSTBACK);{0}", this.OnClientClick); // writer.WriteAttribute("onbindingfocus", clientScripting); //} this.WriteClientAttributes(writer); writer.Write(HtmlTextWriter.SelfClosingTagEnd); }
/// <exclude /> protected void ShowMessage(DialogType dialogType, string title, string message) { var container = GetFlowControllerServicesContainer(); IManagementConsoleMessageService service = container.GetService <IManagementConsoleMessageService>(); string localizedTitle = StringResourceSystemFacade.ParseString(title); string localizedMessage = StringResourceSystemFacade.ParseString(message); service.ShowMessage( dialogType, localizedTitle, localizedMessage ); }
/// <exclude /> protected override void Render(HtmlTextWriter writer) { writer.WriteBeginTag("ui:errorset"); writer.WriteAttribute("timestamp", HttpUtility.HtmlAttributeEncode(DateTime.Now.Ticks.ToString())); writer.Write(HtmlTextWriter.TagRightChar); writer.WriteBeginTag("ui:error"); writer.WriteAttribute("text", HttpUtility.HtmlAttributeEncode(StringResourceSystemFacade.ParseString(this.Text))); writer.WriteAttribute("targetname", HttpUtility.HtmlAttributeEncode(this.TargetName)); writer.Write(HtmlTextWriter.SelfClosingTagEnd); writer.WriteEndTag("ui:errorset"); }
/// <exclude /> protected override void RenderContents(HtmlTextWriter writer) { for (int i = 0; i < this.Items.Count; i++) { if (Items[i].Text == ReservedKey) { continue; } string label = StringResourceSystemFacade.ParseString(this.Items[i].Text); int firstNonSpaceSpacePosition = 0; while (firstNonSpaceSpacePosition < label.Length && label.Substring(firstNonSpaceSpacePosition, 1) == " ") { firstNonSpaceSpacePosition++; } string spacing = new String(Convert.ToChar(160), firstNonSpaceSpacePosition * 2); this.Items[i].Text = string.Concat(spacing, label.Substring(firstNonSpaceSpacePosition)); } ListItemCollection items = this.Items; if (items.Count == 0) { return; } foreach (ListItem item in items) { if (!item.Enabled || item.Text == ReservedKey) { continue; } writer.WriteBeginTag("ui:selection"); writer.WriteAttribute("value", item.Value, true); //if (this.Page != null) //{ // this.Page.ClientScript.RegisterForEventValidation(this.UniqueID, item.Value); //} writer.Write(HtmlTextWriter.SelfClosingTagEnd); } }
/// <exclude /> protected override void Render(HtmlTextWriter writer) { writer.WriteBeginTag("ui:toolbarbutton"); writer.WriteAttribute("label", StringResourceSystemFacade.ParseString(this.Text)); writer.WriteAttribute("callbackid", this.ClientID); /* * PageBinding.ACTION_DOPOSTBACK emitted by default when callbackid is specified. * Note that this uncomment has disabled support for further clientside oncommand actions... * * string clientScripting = string.Format("this.dispatchAction(PageBinding.ACTION_DOPOSTBACK);{0}", this.OnClientClick); * writer.WriteAttribute("oncommand", clientScripting); */ if (string.IsNullOrEmpty(this.CustomClientId) == false) { writer.WriteAttribute("id", this.CustomClientId); } else { writer.WriteAttribute("id", this.ClientID); } if (string.IsNullOrEmpty(this.ObservesClientBroadcaster) == false) { writer.WriteAttribute("observes", this.ObservesClientBroadcaster); } if (string.IsNullOrEmpty(this.ImageUrl) == false) { writer.WriteAttribute("image", this.ImageUrl); } if (string.IsNullOrEmpty(this.ImageUrlWhenDisabled) == false) { writer.WriteAttribute("image-disabled", this.ImageUrlWhenDisabled); } if (this.Enabled == false) { writer.WriteAttribute("isdisabled", "true"); } this.WriteClientAttributes(writer); writer.Write(HtmlTextWriter.SelfClosingTagEnd); }
private ConsoleSearchResultFacetField[] GetFacets(SearchResult queryResult, ICollection <DocumentField> facetFields) { if (queryResult.Facets == null) { return(null); } var result = new List <ConsoleSearchResultFacetField>(); foreach (var field in facetFields.Where(f => queryResult.Facets.ContainsKey(f.Name))) { if (field.Label == null) { continue; } Facet[] values = queryResult.Facets[field.Name]; if (values.Length == 0) { continue; } result.Add(new ConsoleSearchResultFacetField { FieldName = MakeFieldNameJsFriendly(field.Name), Label = StringResourceSystemFacade.ParseString(field.Label), Facets = values.Select(v => new ConsoleSearchResultFacetValue { Value = v.Value, HitCount = v.HitCount, Label = (field.Facet.PreviewFunction ?? (value => value))(v.Value) }).ToArray() }); } return(result.ToArray()); }