public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
 {
     PackageCreatorFacade.DeletePackageInformation(entityToken.Source);
     SpecificTreeRefresher treeRefresher = new SpecificTreeRefresher(flowControllerServicesContainer);
     treeRefresher.PostRefreshMesseges(new PackageCreatorElementProviderEntityToken());
     return null;
 }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var packageName = PackageCreatorFacade.ActivePackageName;
            if (entityToken is PackageCreatorEntityToken)
            {
                packageName = (entityToken as PackageCreatorEntityToken).Source;
            }
            if (string.IsNullOrEmpty(packageName))
            {
                flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
                var consoleServices = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
                consoleServices.ShowMessage(DialogType.Warning, PackageCreatorFacade.GetLocalization("NoPackages.Title"),
                                            PackageCreatorFacade.GetLocalization("NoPackages.Message"));
                return null;
            }

            if (actionToken is AddLocalizationActionToken)
            {
                var token = actionToken as AddLocalizationActionToken;
                PackageCreatorFacade.AddItem(new PCLocalizations(token.CultureName), packageName);
            }

            var treeRefresher = new SpecificTreeRefresher(flowControllerServicesContainer);
            treeRefresher.PostRefreshMesseges(new PackageCreatorElementProviderEntityToken());

            return null;
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var packageName = PackageCreatorFacade.ActivePackageName;

            if (entityToken is PackageCreatorEntityToken)
            {
                packageName = (entityToken as PackageCreatorEntityToken).Source;
            }
            if (string.IsNullOrEmpty(packageName))
            {
                flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
                IManagementConsoleMessageService consoleServices = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
                consoleServices.ShowMessage(DialogType.Warning, PackageCreatorFacade.GetLocalization("NoPackages.Title"), PackageCreatorFacade.GetLocalization("NoPackages.Message"));
                return null;
            }
            if (actionToken is PackageCreatorActionToken)
            {
                var token = actionToken as PackageCreatorActionToken;

                foreach (var item in PackageCreatorActionFacade.GetPackageCreatorItems(entityToken))
                {
                    if (item.CategoryName == token.CategoryName)
                    {
                        //if diffent item for one category and entitytoken
                        var itemActionToken = item as IPackItemActionToken;
                        if (itemActionToken != null)
                        {
                            if (token.Name != itemActionToken.ActionTokenName)
                            {
                                continue;
                            }
                        }
                        if (item is IPackToggle)
                        {
                            if ((item as IPackToggle).CheckedStatus == ActionCheckedStatus.Checked)
                            {
                                 PackageCreatorFacade.RemoveItem(item, packageName);
                            }
                            else
                            {
                                PackageCreatorFacade.AddItem(item, packageName);
                            }
                            var parentTreeRefresher = new ParentTreeRefresher(flowControllerServicesContainer);
                            parentTreeRefresher.PostRefreshMesseges(entityToken);
                        }
                        else
                        {
                            PackageCreatorFacade.AddItem(item, packageName);
                        }
                        break;
                    }
                }

            }

            SpecificTreeRefresher treeRefresher = new SpecificTreeRefresher(flowControllerServicesContainer);
            treeRefresher.PostRefreshMesseges(new PackageCreatorElementProviderEntityToken());

            return null;
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            //string documentTitle = "Unpublished Pages and Page Folder Data";
            //string description = "The list below display pages and page data which are currently being edited or are ready to be approved / published.";
            string documentTitle = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.ViewUnpublishedItems-document-title");
            string description = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.ViewUnpublishedItems-document-description");
            string emptyLabel = StringResourceSystemFacade.GetString("Composite.Plugins.GeneratedDataTypesElementProvider", "ViewUnpublishedItems-document-empty-label");
            string url = string.Format("{0}?showpagedata=true&title={1}&description={2}&emptyLabel={3}",
                UrlUtils.ResolveAdminUrl(string.Format("content/views/publishworkflowstatus/ViewUnpublishedItems.aspx")),
                HttpUtility.UrlEncode(documentTitle, Encoding.UTF8),
                HttpUtility.UrlEncode(description, Encoding.UTF8),
                HttpUtility.UrlEncode(emptyLabel, Encoding.UTF8));

            IManagementConsoleMessageService consoleServices = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
            OpenViewMessageQueueItem openViewMsg = new OpenViewMessageQueueItem
            {
                EntityToken = EntityTokenSerializer.Serialize(entityToken, true),
                ViewId = "ViewUnpublishedPageItems",
                Label = documentTitle,
                Url = url,
                ViewType = ViewType.Main
            };

            ConsoleMessageQueueFacade.Enqueue(openViewMsg, consoleServices.CurrentConsoleId);

            return null;
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;

            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);

            if (actionToken.Serialize() == "ShowGraph")
            {
                string url = string.Format("{0}?EntityToken={1}", UrlUtils.ResolveAdminUrl("content/views/relationshipgraph/Default.aspx"), System.Web.HttpUtility.UrlEncode(serializedEntityToken));

                ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem { Url = url, ViewId = Guid.NewGuid().ToString(), ViewType = ViewType.Main, Label = "Show graph..." }, currentConsoleId);
            }
            else if (actionToken.Serialize() == "ShowOrientedGraph")
            {
                
                Guid id = Guid.NewGuid();
                string filename = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.TempDirectory), string.Format("{0}.RelationshipGraph", id));
                C1File.WriteAllLines(filename, new string[] { serializedEntityToken });

                string url = string.Format("{0}?Id={1}", UrlUtils.ResolveAdminUrl("content/views/relationshipgraph/ShowRelationshipOrientedGraph.aspx"), id);

                ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem { Url = url, ViewId = Guid.NewGuid().ToString(), ViewType = ViewType.Main, Label = "Show graph..." }, currentConsoleId);
            }

            return null;
        }
        /// <exclude />
        public DeleteTreeRefresher(EntityToken beforeDeleteEntityToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            Verify.ArgumentNotNull(beforeDeleteEntityToken, "beforeDeleteEntityToken");
            Verify.ArgumentNotNull(flowControllerServicesContainer, "flowControllerServicesContainer");

            _beforeGraph = new RelationshipGraph(beforeDeleteEntityToken, RelationshipGraphSearchOption.Both);
            _flowControllerServicesContainer = flowControllerServicesContainer;            
        }
        /// <exclude />
        public AddNewTreeRefresher(EntityToken parentEntityToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            Verify.ArgumentNotNull(parentEntityToken, "parentEntityToken");
            Verify.ArgumentNotNull(flowControllerServicesContainer, "flowControllerServicesContainer");

            _beforeGraph = new RelationshipGraph(parentEntityToken, RelationshipGraphSearchOption.Both, false, false);
            _flowControllerServicesContainer = flowControllerServicesContainer;
        }
        public static bool ExecuteElementDraggedAndDropped(ElementHandle draggedElementHandle, ElementHandle newParentdElementHandle, int dropIndex, string consoleId, bool isCopy)
        {
            FlowControllerServicesContainer flowServicesContainer = new FlowControllerServicesContainer();
            flowServicesContainer.AddService(new ManagementConsoleMessageService(consoleId));
            flowServicesContainer.AddService(new ElementDataExchangeService(draggedElementHandle.ProviderName));
            flowServicesContainer.AddService(new ActionExecutionService(draggedElementHandle.ProviderName, consoleId));

            return ElementFacade.ExecuteElementDraggedAndDropped(draggedElementHandle, newParentdElementHandle, dropIndex, isCopy, flowServicesContainer);
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            MessageBoxActionToken messageBoxActionToken = (MessageBoxActionToken)actionToken;

            IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();

            managementConsoleMessageService.ShowMessage(messageBoxActionToken.DialogType, messageBoxActionToken.Title, messageBoxActionToken.Message);

            return null;
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var generatedDataTypetoken = entityToken as GeneratedDataTypesElementProviderTypeEntityToken;
            string typeName = generatedDataTypetoken.SerializedTypeName;
            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;
            string url = DownloadUrl.FormatWith(typeName);

            ConsoleMessageQueueFacade.Enqueue(new DownloadFileMessageQueueItem(url), currentConsoleId);

            return null;
        }
        /// <exclude />
        public FlowToken Execute(string serializedEntityToken, string serializedActionToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            PageAddActionToken pageAddActionToken = (PageAddActionToken)actionToken;

            var newPage = DataFacade.BuildNew<IPage>();
            newPage.PageTypeId = pageAddActionToken.PageTypeId;

            var action = DataActionTokenResolverFacade.Resolve(newPage, ((PageAddActionToken)actionToken).ActionIdentifier);

            return ActionExecutorFacade.Execute(EntityTokenSerializer.Deserialize(serializedEntityToken), action, flowControllerServicesContainer);
        }
        /// <exclude />
        public FlowToken Execute(string serializedEntityToken, string serializedActionToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            DataEntityToken dataEntityToken = (DataEntityToken)EntityTokenSerializer.Deserialize(serializedEntityToken);

            IData data = dataEntityToken.Data;

            Verify.IsNotNull(data, "Failed to get the data from an entity token");

            var action = DataActionTokenResolverFacade.Resolve(data, ((ProxyDataActionToken)actionToken).ActionIdentifier);

            return ActionExecutorFacade.Execute(dataEntityToken, action, flowControllerServicesContainer);
        }
		public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
		{
			var currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;
			var packageName = entityToken.Source;

			string url = UrlUtils.ResolveAdminUrl(
				string.Format(@"InstalledPackages/content/views/Composite.Forms.FormSubmitHandler/GetData.aspx?entityToken={0}", EntityTokenSerializer.Serialize(entityToken))
			);

			ConsoleMessageQueueFacade.Enqueue(new DownloadFileMessageQueueItem(url), currentConsoleId);
			return null;
		}
		public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
		{
			var token = entityToken as DataEntityToken;
			var apiKey = token.Data as ApiKey;

			IssuuApi.SetDefault(apiKey);

			var treeRefresher = new ParentTreeRefresher(flowControllerServicesContainer);
			treeRefresher.PostRefreshMesseges(token.Data.GetDataEntityToken());

			return null;
		}
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;

            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);

            Dictionary<string, string> viewArguments = new Dictionary<string, string>();
            viewArguments.Add("serializedEntityToken", serializedEntityToken);

            ConsoleMessageQueueFacade.Enqueue(new OpenHandledViewMessageQueueItem(EntityTokenSerializer.Serialize(entityToken, true), "Composite.Management.PermissionEditor", viewArguments), currentConsoleId);

            return null;
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            PackageCreatorFacade.ActivePackageName = entityToken.Source;
            Tree.Page.ClearCache();
            Tree.Media.ClearCache();
            var specificTreeRefresher = new SpecificTreeRefresher(flowControllerServicesContainer);
            var parentTreeRefresher = new ParentTreeRefresher(flowControllerServicesContainer);
            specificTreeRefresher.PostRefreshMesseges(new PackageCreatorElementProviderEntityToken());
            specificTreeRefresher.PostRefreshMesseges(new PageElementProviderEntityToken("PageElementProvider"));
            parentTreeRefresher.PostRefreshMesseges(PCMediaFolder.GetRootEntityToken());

            return null;
        }
Beispiel #17
0
        internal Dictionary <string, Exception> GetBindingErrors()
        {
            Guid workflowId = WorkflowEnvironment.WorkflowInstanceId;;

            FlowControllerServicesContainer container = WorkflowFacade.GetFlowControllerServicesContainer(workflowId);
            var bindingValidationService = container.GetService <IBindingValidationService>();

            if (bindingValidationService == null)
            {
                return(new Dictionary <string, Exception>());
            }

            return(bindingValidationService.BindingErrors);
        }
 internal static void HandleRerender(string consoleId, string elementProviderName, FlowToken flowToken, FlowUiDefinitionBase oldUiDefinition, FlowUiDefinitionBase newUiDefinition, FlowControllerServicesContainer servicesContainer)
 {
     if (newUiDefinition.UiContainerType.ActionResultResponseType != oldUiDefinition.UiContainerType.ActionResultResponseType)
     {
         var messageService = servicesContainer.GetService<IManagementConsoleMessageService>();
         messageService.CloseCurrentView();
         HandleNew(consoleId, elementProviderName, string.Empty, flowToken, newUiDefinition);
     }
     else
     {
         // Force update in same container
         HttpContext.Current.Response.Redirect(HttpContext.Current.Request.Url.PathAndQuery, false);
     }
 }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var id          = String.Empty;
            var title       = String.Empty;
            var internalUrl = String.Empty;
            var publicUrl   = String.Empty;

            var currentConsoleId = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>().CurrentConsoleId;

            var mediaToken = actionToken as GetMediaLinkActionToken;

            if (mediaToken != null)
            {
                var file = mediaToken.File;

                id          = file.Id.ToString();
                title       = file.FileName;
                internalUrl = MediaUrlHelper.GetUrl(file);
                publicUrl   = MediaUrlHelper.GetUrl(file, false);
            }

            var pageToken = actionToken as GetPageLinkActionToken;

            if (pageToken != null)
            {
                var page = pageToken.Page;

                using (var data = new DataConnection(PublicationScope.Published))
                {
                    var publishedPage = data.Get <IPage>().SingleOrDefault(p => p.Id == page.Id);
                    if (publishedPage != null)
                    {
                        page = publishedPage;
                    }

                    id          = page.Id.ToString();
                    title       = page.Title;
                    internalUrl = PageUrls.BuildUrl(page, UrlKind.Internal);
                    publicUrl   = PageUrls.BuildUrl(page);
                }
            }

            ConsoleMessageQueueFacade.Enqueue(new MessageBoxMessageQueueItem
            {
                Title   = title,
                Message = "Id: " + id + "\n\rInternal: " + internalUrl + "\n\rPublic url: " + publicUrl
            }, currentConsoleId);

            return(null);
        }
Beispiel #20
0
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            UrlActionToken urlActionToken = (UrlActionToken)actionToken;

            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;

            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);

            string url = string.Format("{0}?EntityToken={1}", urlActionToken.Url, HttpUtility.UrlEncode(serializedEntityToken));

            ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem { Url = url, ViewId = Guid.NewGuid().ToString(), ViewType = ViewType.Main, Label = urlActionToken.Label }, currentConsoleId);

            return null;
        }
Beispiel #21
0
        /// <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.IsTestEnvironment)
                    {
                        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");
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var token = actionToken as DownloadPackageActionToken;
            if (token != null)
            {
                var currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;
                var packageName = entityToken.Source;

                var url = UrlUtils.ResolveAdminUrl(
                    string.Format(@"InstalledPackages/services/Composite.Tools.PackageCreator/GetPackage.ashx?{0}={1}&consoleId={2}", token.Name, packageName, currentConsoleId));

                ConsoleMessageQueueFacade.Enqueue(new DownloadFileMessageQueueItem(url), currentConsoleId);
            }
            return null;
        }
        /// <exclude />
        public static IFlowUiDefinition GetCurrentUiDefinition(FlowToken flowToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            if (flowToken == null) throw new ArgumentNullException("flowToken");

            IFlowController flowExecutor = FlowControllerCache.GetFlowController(flowToken, flowControllerServicesContainer);

            IFlowUiDefinition flowResult = flowExecutor.GetCurrentUiDefinition(flowToken);

            if (flowResult == null)
            {
                flowResult = new NullFlowUiDefinition();
            }

            return flowResult;
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            PackageCreatorFacade.ActivePackageName = entityToken.Source;
            Tree.Page.ClearCache();
            Tree.Media.ClearCache();
            var specificTreeRefresher = new SpecificTreeRefresher(flowControllerServicesContainer);
            var parentTreeRefresher   = new ParentTreeRefresher(flowControllerServicesContainer);

            specificTreeRefresher.PostRefreshMesseges(new PackageCreatorElementProviderEntityToken());
            specificTreeRefresher.PostRefreshMesseges(new PageElementProviderEntityToken("PageElementProvider"));
            parentTreeRefresher.PostRefreshMesseges(PCMediaFolder.GetRootEntityToken());


            return(null);
        }
Beispiel #25
0
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            MessageBoxActionNodeActionToken messageBoxActionNodeActionToken = (MessageBoxActionNodeActionToken)actionToken;

            MessageBoxActionNode messageBoxActionNode = (MessageBoxActionNode)ActionNode.Deserialize(messageBoxActionNodeActionToken.SerializedActionNode);

            IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>();

            managementConsoleMessageService.ShowMessage(
                messageBoxActionNode.DialogType,
                messageBoxActionNodeActionToken.Title,
                messageBoxActionNodeActionToken.Message);

            return(null);
        }
Beispiel #26
0
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var token       = (FieldDependencyEntityToken)entityToken;
            var definition  = DynamicFormsFacade.GetFormByName(token.FormName);
            var field       = definition.Model.Fields.Get(token.FieldName);
            var keyToRemove = field.DependencyAttributes.Single(itm => itm.ReadFromFieldName == token.FromFieldName);

            field.Attributes.Remove(keyToRemove);

            DynamicFormsFacade.SaveForm(definition);

            new ParentTreeRefresher(flowControllerServicesContainer).PostRefreshMessages(entityToken);

            return(null);
        }
Beispiel #27
0
        /// <exclude />
        protected void ShowMessage(DialogType dialogType, string title, string message)
        {
            FlowControllerServicesContainer container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);

            IManagementConsoleMessageService service = container.GetService <IManagementConsoleMessageService>();

            string localizedTitle   = StringResourceSystemFacade.ParseString(title);
            string localizedMessage = StringResourceSystemFacade.ParseString(message);

            service.ShowMessage(
                dialogType,
                localizedTitle,
                localizedMessage
                );
        }
Beispiel #28
0
        /// <exclude />
        protected void ReportException(Exception ex)
        {
            if (ex == null)
            {
                throw new ArgumentNullException("ex");
            }

            this.ShowMessage(DialogType.Error, "An unfortunate error occurred", string.Format("Sorry, but an error has occurred, preventing the opperation from completing as expected. The error has been documented in details so a technican may follow up on this issue.\n\nThe error message is: {0}", ex.Message));

            Log.LogCritical(this.GetType().Name, ex);

            FlowControllerServicesContainer  container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);
            IManagementConsoleMessageService service   = container.GetService <IManagementConsoleMessageService>();

            service.ShowLogEntry(this.GetType(), ex);
        }
Beispiel #29
0
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var token = actionToken as DownloadPackageActionToken;

            if (token != null)
            {
                var currentConsoleId = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>().CurrentConsoleId;
                var packageName      = entityToken.Source;

                var url = UrlUtils.ResolveAdminUrl(
                    string.Format(@"InstalledPackages/services/Composite.Tools.PackageCreator/GetPackage.ashx?{0}={1}&consoleId={2}", token.Name, packageName, currentConsoleId));

                ConsoleMessageQueueFacade.Enqueue(new DownloadFileMessageQueueItem(url), currentConsoleId);
            }
            return(null);
        }
        private void editPreviewCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            try
            {
                XhtmlDocument templateDocument = GetTemplateDocumentFromBindings();

                IVisualFunction function      = this.GetBinding <IVisualFunction>("Function");
                Type            interfaceType = TypeManager.GetType(function.TypeManagerName);

                DataTypeDescriptor typeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(interfaceType);

                this.LogMessage(Composite.Core.Logging.LogLevel.Info, DataScopeManager.CurrentDataScope.Name);

                FunctionContextContainer fcc = PageRenderer.GetPageRenderFunctionContextContainer();

                XhtmlDocument result = RenderingHelper.RenderCompleteDataList(function, templateDocument, typeDescriptor, fcc);

                IPage previewPage = DataFacade.BuildNew <IPage>();
                previewPage.Id    = GetRootPageId();
                previewPage.Title = function.Name;
                previewPage.DataSourceId.DataScopeIdentifier = DataScopeIdentifier.Administrated;
                previewPage.DataSourceId.LocaleScope         = LocalizationScopeManager.CurrentLocalizationScope;

                previewPage.TemplateId = this.GetBinding <Guid>("PreviewTemplateId");

                var pageTemplate = PageTemplateFacade.GetPageTemplate(previewPage.TemplateId);
                IPagePlaceholderContent placeHolderContent = DataFacade.BuildNew <IPagePlaceholderContent>();
                placeHolderContent.Content       = string.Concat((result.Body.Elements().Select(b => b.ToString())).ToArray());
                placeHolderContent.PlaceHolderId = pageTemplate.DefaultPlaceholderId;

                string output = PagePreviewBuilder.RenderPreview(previewPage, new List <IPagePlaceholderContent> {
                    placeHolderContent
                });

                var serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);

                var webRenderService = serviceContainer.GetService <IFormFlowWebRenderingService>();
                webRenderService.SetNewPageOutput(new LiteralControl(output));
            }
            catch (Exception ex)
            {
                FlowControllerServicesContainer serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);
                Control errOutput        = new LiteralControl("<pre>" + ex + "</pre>");
                var     webRenderService = serviceContainer.GetService <IFormFlowWebRenderingService>();
                webRenderService.SetNewPageOutput(errOutput);
            }
        }
Beispiel #31
0
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var dataToken = (DataEntityToken)entityToken;
            var key       = (IResourceKey)dataToken.Data;

            using (var data = new DataConnection())
            {
                var values = data.Get <IResourceValue>().Where(v => v.KeyId == key.Id);

                data.Delete <IResourceValue>(values);
                data.Delete(key);
            }

            new ParentTreeRefresher(flowControllerServicesContainer).PostRefreshMesseges(entityToken);

            return(null);
        }
Beispiel #32
0
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var token      = (FieldDependencyValueEntityToken)entityToken;
            var definition = DynamicFormsFacade.GetFormByName(token.FormName);

            var field         = definition.Model.Fields.Get(token.FieldName);
            var dependency    = (DependsOnConstantAttribute)field.DependencyAttributes.Single(d => d.ReadFromFieldName == token.FromFieldName);
            var valueToRemove = dependency.RequiredFieldValues.Single(v => v.ToString() == token.Value);

            dependency.RequiredFieldValues.Remove(valueToRemove);

            DynamicFormsFacade.SaveForm(definition);

            new ParentTreeRefresher(flowControllerServicesContainer).PostRefreshMessages(entityToken);

            return(null);
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var functionName = FavoriteFunctionWrapper.GetFunctionNameFromEntityToken(entityToken);

            using (var data = new DataConnection())
            {
                var favorite = data.Get <IFavoriteFunction>().Single(f => f.FunctionName == functionName);

                data.Delete(favorite);
            }

            var treeRefresher = new ParentTreeRefresher(flowControllerServicesContainer);

            treeRefresher.PostRefreshMesseges(entityToken);

            return(null);
        }
Beispiel #34
0
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var entryToken          = (DataSourceEntityToken)entityToken;
            var definition          = DynamicFormsFacade.GetFormByName(entryToken.FormName);
            var field               = definition.Model.Fields.Get(entryToken.FieldName);
            var dataSourceAttribute = field.Attributes.OfType <DataSourceAttribute>().First();

            field.Attributes.Remove(dataSourceAttribute);

            field.EnsureValueType();

            DynamicFormsFacade.SaveForm(definition);

            new ParentTreeRefresher(flowControllerServicesContainer).PostRefreshMessages(entityToken);

            return(null);
        }
Beispiel #35
0
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var fileToken = (WebsiteFileElementProviderEntityToken)entityToken;

            var urlString = new UrlBuilder(UrlUtils.AdminRootPath + "/services/Admin/DownloadFile.ashx");

            string relativeFilePath = fileToken.Path.Substring(fileToken.RootPath.Length);

            urlString["file"]     = relativeFilePath;
            urlString["provider"] = fileToken.Source;

            string currentConsoleId = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>().CurrentConsoleId;

            ConsoleMessageQueueFacade.Enqueue(new DownloadFileMessageQueueItem(urlString.ToString()), currentConsoleId);

            return(null);
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            string url = UrlUtils.ResolveAdminUrl("InstalledPackages/content/views/Composite.Tools.LinkChecker/ListBrokenLinks.aspx");

            var consoleServices = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>();
            var openViewMsg     = new OpenViewMessageQueueItem
            {
                EntityToken = EntityTokenSerializer.Serialize(entityToken, true),
                ViewId      = "LinkChecker",
                Label       = GetResourceString("LinkCheckerActionToken.Label"),
                Url         = url,
                ViewType    = ViewType.Main
            };

            ConsoleMessageQueueFacade.Enqueue(openViewMsg, consoleServices.CurrentConsoleId);

            return(null);
        }
        /// <exclude />
        protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            FormsWorkflow formsWorkflow = this.GetRoot <FormsWorkflow>();

            FlowControllerServicesContainer container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);

            if (container != null)
            {
                IManagementConsoleMessageService service = container.GetService <IManagementConsoleMessageService>();

                if (service != null)
                {
                    service.CloseCurrentView();
                }
            }

            return(ActivityExecutionStatus.Closed);
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var token      = (FormSubmitHandlerEntityToken)entityToken;
            var definition = DefinitionsFacade.GetDefinition(token.FormName);
            var handler    = definition.SubmitHandlers.Single(h => h.Name == token.Name);

            definition.SubmitHandlers.Remove(handler);

            handler.Delete(definition);

            var serializer = XmlDefinitionSerializer.GetSerializer(definition.Name);

            serializer.Save(definition);

            new ParentTreeRefresher(flowControllerServicesContainer).PostRefreshMessages(entityToken);

            return(null);
        }
        public void Execute(EntityToken entityToken, ActionToken actionToken, TaskManagerEvent taskManagerEvent)
        {
            var flowServicesContainer = new FlowControllerServicesContainer(
                new ManagementConsoleMessageService(this.ConsoleId),
                new ElementDataExchangeService(this.ElementProviderName),
                this
                );

            FlowToken flowToken = ActionExecutorFacade.Execute(entityToken, actionToken, flowServicesContainer, taskManagerEvent);

            IFlowUiDefinition uiDefinition = FlowControllerFacade.GetCurrentUiDefinition(flowToken, flowServicesContainer);

            if (uiDefinition is FlowUiDefinitionBase flowUiDefinition)
            {
                string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);
                ViewTransitionHelper.HandleNew(this.ConsoleId, this.ElementProviderName, serializedEntityToken, flowToken, flowUiDefinition);
            }
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            string url = UrlUtils.ResolveAdminUrl("InstalledPackages/content/views/Composite.Tools.LinkChecker/ListBrokenLinks.aspx");

            var consoleServices = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
            var openViewMsg = new OpenViewMessageQueueItem
            {
                EntityToken = EntityTokenSerializer.Serialize(entityToken, true),
                ViewId = "LinkChecker",
                Label = GetResourceString("LinkCheckerActionToken.Label"),
                Url = url,
                ViewType = ViewType.Main
            };

            ConsoleMessageQueueFacade.Enqueue(openViewMsg, consoleServices.CurrentConsoleId);

            return null;
        }
        public static void ExecuteElementAction(ElementHandle elementHandle, ActionHandle actionHandle, string consoleId)
        {
            FlowControllerServicesContainer flowServicesContainer = new FlowControllerServicesContainer();
            flowServicesContainer.AddService(new ManagementConsoleMessageService(consoleId));
            flowServicesContainer.AddService(new ElementDataExchangeService(elementHandle.ProviderName));
            flowServicesContainer.AddService(new ActionExecutionService(elementHandle.ProviderName, consoleId));
            flowServicesContainer.AddService(new ElementInformationService(elementHandle));

            FlowToken flowToken = ActionExecutorFacade.Execute(elementHandle.EntityToken, actionHandle.ActionToken, flowServicesContainer);

            IFlowUiDefinition uiDefinition = FlowControllerFacade.GetCurrentUiDefinition(flowToken, flowServicesContainer);

            if (typeof(FlowUiDefinitionBase).IsAssignableFrom(uiDefinition.GetType()))
            {
                string serializedEntityToken = EntityTokenSerializer.Serialize(elementHandle.EntityToken, true);
                ViewTransitionHelper.HandleNew(consoleId, elementHandle.ProviderName, serializedEntityToken, flowToken, (FlowUiDefinitionBase)uiDefinition);
            }
        }
Beispiel #42
0
        /// <exclude />
        protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            FormsWorkflow formsWorkflow = this.GetRoot <FormsWorkflow>();

            FlowControllerServicesContainer flowControllerServicesContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);

            IActionExecutionService actionExecutionService = flowControllerServicesContainer.GetService <IActionExecutionService>();

            WorkflowActionToken workflowActionToken = new WorkflowActionToken(this.ChildWorkflowType)
            {
                Payload = this.ChildWorkflowPayload,
                ParentWorkflowInstanceId = formsWorkflow.InstanceId
            };

            actionExecutionService.Execute(formsWorkflow.EntityToken, workflowActionToken, null);

            return(ActivityExecutionStatus.Closed);
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var urlActionToken = (UrlActionToken)actionToken;

            string currentConsoleId = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>().CurrentConsoleId;
            string seperator        = urlActionToken.Url.Contains("?") ? "&" : "?";

            var openViewMessageItem = new OpenViewMessageQueueItem
            {
                Label    = urlActionToken.Label,
                Url      = urlActionToken.Url + seperator + "consoleId=" + currentConsoleId + "&EntityToken=" + EntityTokenSerializer.Serialize(entityToken),
                ViewId   = Guid.NewGuid().ToString(),
                ViewType = ViewType.Main
            };

            ConsoleMessageQueueFacade.Enqueue(openViewMessageItem, currentConsoleId);

            return(null);
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            FunctionInfoActionToken urlActionToken = (FunctionInfoActionToken)actionToken;

            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;

            string url = UrlUtils.ResolveAdminUrl(@"content/views/functioninfo/ShowFunctionInfo.aspx");
            url += "?Name=" + urlActionToken.FunctionName + "&IsWidget=" + urlActionToken.IsWidgetFunction;

            ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem
            {
                Url = url,
                Label = urlActionToken.FunctionName,
                ViewId = Guid.NewGuid().ToString(),
                ViewType = ViewType.Main
            }, currentConsoleId);

            return null;
        }
        public void Execute(EntityToken entityToken, ActionToken actionToken, TaskManagerEvent taskManagerEvent)
        {
            FlowControllerServicesContainer flowServicesContainer = new FlowControllerServicesContainer();
            flowServicesContainer.AddService(new ManagementConsoleMessageService(this.ConsoleId));
            flowServicesContainer.AddService(new ElementDataExchangeService(this.ElementProviderName));
            flowServicesContainer.AddService(this);

            FlowToken flowToken = ActionExecutorFacade.Execute(entityToken, actionToken, flowServicesContainer, taskManagerEvent);

            IFlowUiDefinition uiDefinition = FlowControllerFacade.GetCurrentUiDefinition(flowToken, flowServicesContainer);

            ActionResult result = new ActionResult();

            if (typeof(FlowUiDefinitionBase).IsAssignableFrom(uiDefinition.GetType()))
            {
                string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);
                ViewTransitionHelper.HandleNew(this.ConsoleId, this.ElementProviderName, serializedEntityToken, flowToken, (FlowUiDefinitionBase)uiDefinition);
            }
        }
Beispiel #46
0
        private void uploadCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            UpdateTreeRefresher updateTreeRefresher = this.CreateUpdateTreeRefresher(this.EntityToken);

            FlowControllerServicesContainer flowControllerServicesContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);
            var managementConsoleMessageService = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>();

            UploadedFile uploadedFile = this.GetBinding <UploadedFile>("UploadedFile");
            IMediaFile   mediaFile    = this.GetBinding <IMediaFile>("File");

            if (uploadedFile.HasFile)
            {
                string mimeType = MimeTypeInfo.GetMimeType(uploadedFile);

                // Image cannot be replaced with a file of not image mime type
                string imageMimeTypePrefix = "image/";
                if ((mediaFile.MimeType.StartsWith(imageMimeTypePrefix, StringComparison.OrdinalIgnoreCase) &&
                     !mimeType.StartsWith(imageMimeTypePrefix, StringComparison.OrdinalIgnoreCase)))
                {
                    managementConsoleMessageService.CloseCurrentView();
                    string failure        = StringResourceSystemFacade.GetString("Composite.Management", "UploadNewMediaFileWorkflow.UploadFailure");
                    string failureMessage = StringResourceSystemFacade.GetString("Composite.Management", "UploadNewMediaFileWorkflow.UploadFailureMessage");
                    managementConsoleMessageService.ShowMessage(DialogType.Message, failure, failureMessage);
                    return;
                }

                using (System.IO.Stream readStream = uploadedFile.FileStream)
                {
                    using (System.IO.Stream writeStream = mediaFile.GetNewWriteStream())
                    {
                        readStream.CopyTo(writeStream);
                    }
                }
            }

            DataFacade.Update(mediaFile);

            SetSaveStatus(true);

            SelectElement(mediaFile.GetDataEntityToken());

            updateTreeRefresher.PostRefreshMesseges(mediaFile.GetDataEntityToken());
        }
Beispiel #47
0
        public static void ExecuteElementAction(ElementHandle elementHandle, ActionHandle actionHandle, string consoleId)
        {
            var flowServicesContainer = new FlowControllerServicesContainer(
                new ManagementConsoleMessageService(consoleId),
                new ElementDataExchangeService(elementHandle.ProviderName),
                new ActionExecutionService(elementHandle.ProviderName, consoleId),
                new ElementInformationService(elementHandle)
                );

            FlowToken flowToken = ActionExecutorFacade.Execute(elementHandle.EntityToken, actionHandle.ActionToken, flowServicesContainer);

            IFlowUiDefinition uiDefinition = FlowControllerFacade.GetCurrentUiDefinition(flowToken, flowServicesContainer);

            if (uiDefinition is FlowUiDefinitionBase flowUiDefinition)
            {
                string serializedEntityToken = EntityTokenSerializer.Serialize(elementHandle.EntityToken, true);
                ViewTransitionHelper.HandleNew(consoleId, elementHandle.ProviderName, serializedEntityToken, flowToken, flowUiDefinition);
            }
        }
Beispiel #48
0
        /// <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";
                    }
                }

                return(webControl);
            }
            catch (Exception ex)
            {
                ErrorServices.DocumentAdministrativeError(ex);
                ErrorServices.RedirectUserToErrorPage(uiContainerName, ex);
            }

            return(new LiteralControl("ERROR"));
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var  token = (GeneratedDataTypesElementProviderTypeEntityToken)entityToken;
            var  type  = TypeManager.GetType(token.SerializedTypeName);
            Guid guid  = type.GetImmutableTypeId();

            var oldDataTypeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(guid);
            var superInfterface       = ((ToggleSuperInterfaceActionToken)actionToken).InterfaceType;

            var newDataTypeDescriptor = oldDataTypeDescriptor.Clone();

            if (newDataTypeDescriptor.SuperInterfaces.Contains(superInfterface))
            {
                newDataTypeDescriptor.RemoveSuperInterface(superInfterface);
            }
            else
            {
                newDataTypeDescriptor.AddSuperInterface(superInfterface);
            }

            if (newDataTypeDescriptor.DataScopes.Count == 0)
            {
                newDataTypeDescriptor.DataScopes.Add(DataScopeIdentifier.Public);
            }

            if (oldDataTypeDescriptor.DataScopes.Count == 0)
            {
                oldDataTypeDescriptor.DataScopes.Add(DataScopeIdentifier.Public);
            }

            var updateDescriptor = new UpdateDataTypeDescriptor(oldDataTypeDescriptor, newDataTypeDescriptor, true);

            GeneratedTypesFacade.UpdateType(updateDescriptor);

            EntityTokenCacheFacade.ClearCache();

            var treeRefresher = new ParentTreeRefresher(flowControllerServicesContainer);

            treeRefresher.PostRefreshMesseges(entityToken);

            return(null);
        }
Beispiel #50
0
        public void Execute(EntityToken entityToken, ActionToken actionToken, TaskManagerEvent taskManagerEvent)
        {
            FlowControllerServicesContainer flowServicesContainer = new FlowControllerServicesContainer();

            flowServicesContainer.AddService(new ManagementConsoleMessageService(this.ConsoleId));
            flowServicesContainer.AddService(new ElementDataExchangeService(this.ElementProviderName));
            flowServicesContainer.AddService(this);

            FlowToken flowToken = ActionExecutorFacade.Execute(entityToken, actionToken, flowServicesContainer, taskManagerEvent);

            IFlowUiDefinition uiDefinition = FlowControllerFacade.GetCurrentUiDefinition(flowToken, flowServicesContainer);

            ActionResult result = new ActionResult();

            if (typeof(FlowUiDefinitionBase).IsAssignableFrom(uiDefinition.GetType()))
            {
                string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);
                ViewTransitionHelper.HandleNew(this.ConsoleId, this.ElementProviderName, serializedEntityToken, flowToken, (FlowUiDefinitionBase)uiDefinition);
            }
        }
Beispiel #51
0
        public FlowToken Execute(
            EntityToken entityToken,
            ActionToken actionToken,
            FlowControllerServicesContainer flowControllerServicesContainer)
        {
            string currentConsoleId = flowControllerServicesContainer.
                                      GetService <IManagementConsoleMessageService>().CurrentConsoleId;
            DataEntityToken dataEntityToken = entityToken as DataEntityToken;
            IPage           page            = dataEntityToken.Data as IPage;
            string          url             = string.Format("/MyUrlAction.aspx?pageId={0}", page.Id);

            ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem
            {
                Url      = url,
                ViewId   = Guid.NewGuid().ToString(),
                ViewType = ViewType.Main,
                Label    = "My URL Action"
            }, currentConsoleId);
            return(null);
        }
Beispiel #52
0
        public static IFlowController GetFlowController(FlowToken flowToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            Verify.ArgumentNotNull(flowToken, "flowToken");

            Type flowTokenType = flowToken.GetType();

            return _flowControllerCache.GetOrAdd(flowTokenType, type =>
            {
                object[] attributes = type.GetCustomAttributes(typeof(FlowControllerAttribute), true);
                Verify.That(attributes.Length > 0, "Missing '{0}' attribute on the flow token '{1}'", typeof(FlowControllerAttribute), type);

                FlowControllerAttribute attribute = (FlowControllerAttribute) attributes[0];
                Verify.IsNotNull(attribute.FlowControllerType, "Flow controller type can not be null on the action token '{0}'", type);
                Verify.That(typeof(IFlowController).IsAssignableFrom(attribute.FlowControllerType), "Flow controller '{0}' should implement the interface '{1}'", attribute.FlowControllerType, typeof(IFlowController));

                var flowController = (IFlowController) Activator.CreateInstance(attribute.FlowControllerType);
                flowController.ServicesContainer = flowControllerServicesContainer;

                return flowController;
            });
        }
Beispiel #53
0
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            string currentConsoleId = flowControllerServicesContainer.GetService <Composite.C1Console.Events.IManagementConsoleMessageService>().CurrentConsoleId;

            DisplayLocalOrderingActionToken castedActionToken = (DisplayLocalOrderingActionToken)actionToken;

            string url = string.Format("{0}?ParentPageId={1}", BaseUrl, HttpUtility.UrlEncode(castedActionToken.ParentPageId.ToString()));

            ConsoleMessageQueueFacade.Enqueue(
                new OpenViewMessageQueueItem
            {
                EntityToken = EntityTokenSerializer.Serialize(entityToken, true),
                Url         = url,
                ViewId      = Guid.NewGuid().ToString(),
                ViewType    = ViewType.Main,
                Label       = "Pages local orderings"
            },
                currentConsoleId);

            return(null);
        }
        public static IFlowController GetFlowController(FlowToken flowToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            Verify.ArgumentNotNull(flowToken, "flowToken");

            Type flowTokenType = flowToken.GetType();

            return(_flowControllerCache.GetOrAdd(flowTokenType, type =>
            {
                object[] attributes = type.GetCustomAttributes(typeof(FlowControllerAttribute), true);
                Verify.That(attributes.Length > 0, "Missing '{0}' attribute on the flow token '{1}'", typeof(FlowControllerAttribute), type);

                FlowControllerAttribute attribute = (FlowControllerAttribute)attributes[0];
                Verify.IsNotNull(attribute.FlowControllerType, "Flow controller type can not be null on the action token '{0}'", type);
                Verify.That(typeof(IFlowController).IsAssignableFrom(attribute.FlowControllerType), "Flow controller '{0}' should implement the interface '{1}'", attribute.FlowControllerType, typeof(IFlowController));

                var flowController = (IFlowController)Activator.CreateInstance(attribute.FlowControllerType);
                flowController.ServicesContainer = flowControllerServicesContainer;

                return flowController;
            }));
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var item = PackageCreatorActionFacade.GetPackageCreatorItem(entityToken.Type, entityToken.Id);
            PackageCreatorFacade.RemoveItem(item, entityToken.Source);

            SpecificTreeRefresher treeRefresher = new SpecificTreeRefresher(flowControllerServicesContainer);
            treeRefresher.PostRefreshMesseges(new PackageCreatorElementProviderEntityToken());

            var itemToggle = item as IPackToggle;
            if (itemToggle != null)
            {
                var itemEntityToken = itemToggle.GetEntityToken();
                if (itemEntityToken != null)
                {
                    var parentTreeRefresher = new ParentTreeRefresher(flowControllerServicesContainer);
                    parentTreeRefresher.PostRefreshMesseges(itemEntityToken);
                }
            }

            return null;
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            string currentConsoleId = flowControllerServicesContainer.GetService<Composite.C1Console.Events.IManagementConsoleMessageService>().CurrentConsoleId;

            DisplayLocalOrderingActionToken castedActionToken = (DisplayLocalOrderingActionToken)actionToken;

            string url = string.Format("{0}?ParentPageId={1}", BaseUrl, HttpUtility.UrlEncode(castedActionToken.ParentPageId.ToString()));

            ConsoleMessageQueueFacade.Enqueue(
                new OpenViewMessageQueueItem
                    {
                        EntityToken = EntityTokenSerializer.Serialize(entityToken, true),
                        Url = url,
                        ViewId = Guid.NewGuid().ToString(),
                        ViewType = ViewType.Main,
                        Label = "Pages local orderings"
                    },
                currentConsoleId);

            return null;
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            FunctionInfoActionToken urlActionToken = (FunctionInfoActionToken)actionToken;

            string currentConsoleId = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>().CurrentConsoleId;


            string url = UrlUtils.ResolveAdminUrl(@"content/views/functioninfo/ShowFunctionInfo.aspx");

            url += "?Name=" + urlActionToken.FunctionName + "&IsWidget=" + urlActionToken.IsWidgetFunction;

            ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem
            {
                Url      = url,
                Label    = urlActionToken.FunctionName,
                ViewId   = Guid.NewGuid().ToString(),
                ViewType = ViewType.Main
            }, currentConsoleId);

            return(null);
        }
Beispiel #58
0
        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            string fileContent = this.GetBinding <string>("FileContent");

            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();

            try
            {
                DynamicTypesAlternateFormFacade.SetAlternateForm(dataTypeDescriptor, fileContent);

                SetSaveStatus(true);
            }
            catch (Exception ex)
            {
                FlowControllerServicesContainer serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);
                var consoleMessageService = serviceContainer.GetService <IManagementConsoleMessageService>();
                consoleMessageService.ShowMessage(
                    DialogType.Error,
                    "Error",
                    ex.Message);
            }
        }
        public FlowToken Execute(string serializedEntityToken, string serializedActionToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            WorkflowActionToken workflowActionToken = (WorkflowActionToken)actionToken;

            WorkflowInstance workflowInstance = WorkflowFacade.CreateNewWorkflow(
                    workflowActionToken.WorkflowType,
                    new Dictionary<string, object> { 
                            { "SerializedEntityToken", serializedEntityToken },
                            { "SerializedActionToken", serializedActionToken },
                            { "ParentWorkflowInstanceId", workflowActionToken.ParentWorkflowInstanceId }
                        }
                );

            workflowInstance.Start();

            WorkflowFacade.SetFlowControllerServicesContainer(workflowInstance.InstanceId, flowControllerServicesContainer);
            WorkflowFacade.RunWorkflow(workflowInstance);

            WorkflowFacade.SetEventHandlerFilter(workflowInstance.InstanceId, workflowActionToken.EventHandleFilterType);

            return new WorkflowFlowToken(workflowInstance.InstanceId);
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            string functionNamePrefix = "";
            if (entityToken.Id.IndexOf('.') > -1)
            {
                functionNamePrefix = entityToken.Id.Substring(entityToken.Id.IndexOf('.') + 1);
            }

            bool widgets = entityToken.Id.ToLower().Contains("widget");

            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;
            string url = UrlUtils.ResolveAdminUrl(string.Format("content/views/functiondoc/FunctionDocumentation.aspx?functionPrefix={0}&widgets={1}", functionNamePrefix, widgets));

            ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem
                {
                    Url = url,
                    EntityToken = EntityTokenSerializer.Serialize(entityToken, true),
                    ViewId = Guid.NewGuid().ToString(),
                    ViewType = ViewType.Main,
                    Label = "Documentation"
                }, currentConsoleId);

            return null;
        }