/// <exclude /> public static Control GetFlowUi(FlowHandle flowHandle, string elementProviderName, string consoleId, out string uiContainerName) { uiContainerName = null; try { Control webControl = null; string viewId = ViewTransitionHelper.MakeViewId(flowHandle.Serialize()); FlowControllerServicesContainer flowServicesContainer = new FlowControllerServicesContainer(); flowServicesContainer.AddService(new ActionExecutionService(elementProviderName, consoleId)); flowServicesContainer.AddService(new ManagementConsoleMessageService(consoleId, viewId)); flowServicesContainer.AddService(new ElementDataExchangeService(elementProviderName)); FlowToken flowToken = flowHandle.FlowToken; IFlowUiDefinition flowUiDefinition = FlowControllerFacade.GetCurrentUiDefinition(flowToken, flowServicesContainer); var formFlowUiDefinition = flowUiDefinition as FormFlowUiDefinition; if (formFlowUiDefinition != null) { uiContainerName = formFlowUiDefinition.UiContainerType.ContainerName; IUiControl uiForm = FormFlowUiDefinitionRenderer.Render(consoleId, elementProviderName, flowToken, formFlowUiDefinition, WebManagementChannel.Identifier, false, flowServicesContainer); IWebUiControl webForm = (IWebUiControl)uiForm; webControl = webForm.BuildWebControl(); if (string.IsNullOrEmpty(webControl.ID)) { webControl.ID = "FlowUI"; } if (RuntimeInformation.TestAutomationEnabled) { var testAutomationLocatorInformation = formFlowUiDefinition.MarkupProvider as ITestAutomationLocatorInformation; if (testAutomationLocatorInformation != null) { var htmlform = webControl.Controls.OfType <HtmlForm>().FirstOrDefault(); if (htmlform != null) { htmlform.Attributes.Add("data-qa", testAutomationLocatorInformation.TestAutomationLocator); } } } } return(webControl); } catch (Exception ex) { ErrorServices.DocumentAdministrativeError(ex); ErrorServices.RedirectUserToErrorPage(uiContainerName, ex); } return(new LiteralControl("ERROR")); }
protected void Page_Load(object sender, EventArgs e) { this.Error += Composite_Management_FlowUi_Error; _consoleId = Request.QueryString[_consoleIdParameterName]; string flowHandleSerialized = Request.QueryString[_flowHandleParameterName]; string elementProviderName = Request.QueryString[_elementProviderNameParameterName]; if (string.IsNullOrEmpty(_consoleId)) { throw new ArgumentNullException(_consoleIdParameterName, "Missing query string parameter"); } if (string.IsNullOrEmpty(flowHandleSerialized)) { throw new ArgumentNullException(_flowHandleParameterName, "Missing query string parameter"); } if (string.IsNullOrEmpty(elementProviderName)) { throw new ArgumentNullException(_elementProviderNameParameterName, "Missing query string parameter"); } FlowHandle flowHandle = FlowHandle.Deserialize(flowHandleSerialized); try { using (GlobalInitializerFacade.CoreIsInitializedScope) { Control webControl = WebFlowUiMediator.GetFlowUi(flowHandle, elementProviderName, _consoleId, out _uiContainerName); if (webControl == null) { // TODO: check if "httpContext.ApplicationInstance.CompleteRequest();" can be used Response.Redirect(UrlUtils.ResolveAdminUrl("content/flow/FlowUiCompleted.aspx"), true); } else { this.Controls.Add(webControl); } } } catch (ThreadAbortException) { throw; } catch (Exception ex) { IConsoleMessageQueueItem errorLogEntry = new LogEntryMessageQueueItem { Sender = typeof(System.Web.UI.Page), Level = Composite.Core.Logging.LogLevel.Error, Message = ex.Message }; ConsoleMessageQueueFacade.Enqueue(errorLogEntry, _consoleId); throw; } Response.Cache.SetCacheability(HttpCacheability.NoCache); }
internal static void HandleNew(string consoleId, string elementProviderName, string serializedEntityToken, FlowToken flowToken, FlowUiDefinitionBase uiDefinition) { ActionResultResponseType actionViewType = uiDefinition.UiContainerType.ActionResultResponseType; if (actionViewType != ActionResultResponseType.None) { FlowHandle flowHandle = new FlowHandle(flowToken); string serializedFlowHandle = flowHandle.Serialize(); string viewId = MakeViewId(serializedFlowHandle); ViewType viewType; switch (actionViewType) { case ActionResultResponseType.OpenDocument: viewType = ViewType.Main; break; case ActionResultResponseType.OpenModalDialog: viewType = ViewType.ModalDialog; break; default: throw new Exception("unknown action response type"); } string url = string.Format("{0}?consoleId={1}&flowHandle={2}&elementProvider={3}", UrlUtils.ResolveAdminUrl("content/flow/FlowUi.aspx"), consoleId, HttpUtility.UrlEncode(serializedFlowHandle), HttpUtility.UrlEncode(elementProviderName)); OpenViewMessageQueueItem openView = new OpenViewMessageQueueItem { ViewType = viewType, EntityToken = serializedEntityToken, FlowHandle = flowHandle.Serialize(), Url = url, ViewId = viewId }; if (uiDefinition is VisualFlowUiDefinitionBase) { VisualFlowUiDefinitionBase visualUiDefinition = (VisualFlowUiDefinitionBase)uiDefinition; if (string.IsNullOrEmpty(visualUiDefinition.ContainerLabel) == false) { openView.Label = visualUiDefinition.ContainerLabel; } } ConsoleMessageQueueFacade.Enqueue(openView, consoleId); } }