/// <exclude />
        public static void DocumentAdministrativeError(Exception exception)
        {
            StringBuilder consoleMsg = new StringBuilder();

            consoleMsg.AppendLine(exception.GetBaseException().ToString());

            Log.LogCritical("Web Application Error, Exception", exception);

            var httpContext = HttpContext.Current;

            if (httpContext != null && httpContext.Request != null && httpContext.Request.Url != null)
            {
                consoleMsg.AppendLine();
                consoleMsg.AppendLine("URL:     " + HttpContext.Current.Request.Url);
                if (HttpContext.Current.Request.UrlReferrer != null)
                {
                    consoleMsg.AppendLine("Referer: " + httpContext.Request.UrlReferrer.AbsolutePath);
                }
            }

            string consoleId = ConsoleInfo.TryGetConsoleId();

            if (consoleId != null)
            {
                ConsoleMessageQueueFacade.Enqueue(new LogEntryMessageQueueItem {
                    Level = LogLevel.Error, Message = consoleMsg.ToString(), Sender = typeof(ErrorServices)
                }, consoleId);
            }
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            SearchActionToken searchActionToken = (SearchActionToken)actionToken;

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

            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);

            string viewId = Guid.NewGuid().ToString();



            string url = UrlUtils.ResolveAdminUrl(string.Format("content/dialogs/treesearch/treeSearchForm.aspx?ProviderName={0}&EntityToken={1}&ViewId={2}&ConsoleId={3}", HttpUtility.UrlEncode(searchActionToken.ProviderName), HttpUtility.UrlEncode(serializedEntityToken), HttpUtility.UrlEncode(viewId), HttpUtility.UrlEncode(currentConsoleId)));

            ConsoleMessageQueueFacade.Enqueue(
                new OpenViewMessageQueueItem
            {
                Url                = url,
                ViewId             = viewId,
                ViewType           = ViewType.ModalDialog,
                Label              = StringResourceSystemFacade.GetString("Composite.Management", "RelationshipGraphActionExecutor.SearchElements"),
                ToolTip            = StringResourceSystemFacade.GetString("Composite.Management", "RelationshipGraphActionExecutor.SearchElementsToolTip"),
                IconResourceHandle = CommonElementIcons.Question
            }, currentConsoleId);


            return(null);
        }
Example #3
0
        /// <summary>
        /// Selects the specified element in the console
        /// </summary>
        /// <param name="consoleId">The console id.</param>
        /// <param name="entityToken">The entity token.</param>
        public static void SelectConsoleElement(string consoleId, EntityToken entityToken)
        {
            var serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);

            var rootEntityToken = AttachingPoint.PerspectivesRoot.EntityToken;

            var refreshInfo = TreeServicesFacade.FindEntityToken(rootEntityToken, entityToken,
                                                                 new List <RefreshChildrenParams>(new[]
            {
                new RefreshChildrenParams
                {
                    ProviderName = rootEntityToken.Source,
                    EntityToken  = EntityTokenSerializer.Serialize(rootEntityToken, true)
                }
            }));

            if (refreshInfo == null || refreshInfo.Count == 0)
            {
                return;
            }

            string perspectiveElementKey = refreshInfo.Count > 1 ? refreshInfo[1].ElementKey : refreshInfo[0].ElementKey;

            var selectItem = new SelectElementQueueItem
            {
                EntityToken           = serializedEntityToken,
                PerspectiveElementKey = perspectiveElementKey
            };

            ConsoleMessageQueueFacade.Enqueue(selectItem, consoleId);
        }
        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)
        {
            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);

            ISystemActiveLocale systemActiveLocale = this.GetDataItemFromEntityToken <ISystemActiveLocale>();

            var cultureName = systemActiveLocale.CultureName;

            var consolesToBeUpdated =
                (from consoleInformation in DataFacade.GetData <IUserConsoleInformation>()
                 join userSettings in DataFacade.GetData <IUserSettings>()
                 on consoleInformation.Username equals userSettings.Username
                 where userSettings.CurrentActiveLocaleCultureName == cultureName ||
                 userSettings.ForeignLocaleCultureName == cultureName
                 select consoleInformation.ConsoleId).ToList();

            LocalizationFacade.RemoveLocale(cultureName);

            foreach (var consoleId in consolesToBeUpdated)
            {
                ConsoleMessageQueueFacade.Enqueue(new CollapseAndRefreshConsoleMessageQueueItem(), consoleId);
            }

            ConsoleMessageQueueFacade.Enqueue(new BroadcastMessageQueueItem {
                Name = "LocalesUpdated", Value = ""
            }, null);

            SelectElement(new LocalizationElementProviderRootEntityToken());

            deleteTreeRefresher.PostRefreshMesseges();
        }
Example #5
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 = urlActionToken.Url;

            string extendedUrl = $"{url}{(url.Contains("?") ? "&" : "?")}EntityToken={HttpUtility.UrlEncode(serializedEntityToken)}";

            if (extendedUrl.IndexOf("consoleId", StringComparison.OrdinalIgnoreCase) == -1)
            {
                extendedUrl = $"{extendedUrl}&consoleId={currentConsoleId}";
            }

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

            return(null);
        }
Example #6
0
        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);
        }
        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)
        {
            string cultureName      = this.GetBinding <string>("CultureName");
            string urlMappingName   = this.GetBinding <string>("UrlMappingName");
            bool   accessToAllUsers = this.GetBinding <bool>("AccessToAllUsers");

            LocalizationFacade.AddLocale(cultureName, urlMappingName, accessToAllUsers);

            this.CloseCurrentView();

            ConsoleMessageQueueFacade.Enqueue(new BroadcastMessageQueueItem {
                Name = "LocalesUpdated", Value = ""
            }, null);


            var specificTreeRefresher = this.CreateSpecificTreeRefresher();

            specificTreeRefresher.PostRefreshMesseges(this.EntityToken);

            var newLocaleDataItem = DataFacade.GetData <ISystemActiveLocale>().FirstOrDefault(l => l.CultureName == cultureName);

            if (newLocaleDataItem != null)
            {
                SelectElement(newLocaleDataItem.GetDataEntityToken());
            }
        }
        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);
        }
Example #9
0
        private void step5CodeActivity_RefreshTree_ExecuteCode(object sender, EventArgs e)
        {
            if (this.GetBinding <bool>("ReloadConsoleOnCompletion"))
            {
                ConsoleMessageQueueFacade.Enqueue(new RebootConsoleMessageQueueItem(), null);
            }

            if (this.GetBinding <bool>("FlushOnCompletion"))
            {
                GlobalEventSystemFacade.FlushTheSystem();
            }

            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();

            specificTreeRefresher.PostRefreshMesseges(new PackageElementProviderRootEntityToken());

            if (this.GetBinding <bool>("ReloadConsoleOnCompletion") == false)
            {
                PackageElementProviderAvailablePackagesItemEntityToken castedEntityToken = (PackageElementProviderAvailablePackagesItemEntityToken)this.EntityToken;

                InstalledPackageInformation installedPackage = PackageManager.GetInstalledPackages().FirstOrDefault(f => f.Id == castedEntityToken.PackageId);

                var installedPackageEntityToken = new PackageElementProviderInstalledPackageItemEntityToken(
                    installedPackage.Id,
                    installedPackage.GroupName,
                    installedPackage.IsLocalInstalled,
                    installedPackage.CanBeUninstalled);

                ExecuteWorklow(installedPackageEntityToken, WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.PackageElementProvider.ViewInstalledPackageInfoWorkflow"));
            }
        }
        public void TurnApplicationOffline(bool softTurnOff, bool recompileCompositeGenerated)
        {
            Verify.IsTrue(this.IsApplicationOnline, "The application is already offline");

            Log.LogVerbose("ApplicationOnlineHandlerFacade", string.Format("Turning off the application ({0})", softTurnOff ? "Soft" : "Hard"));


            _recompileCompositeGenerated = recompileCompositeGenerated;

            _shutdownGuard = new ShutdownGuard();

            try
            {
                if (softTurnOff == false)
                {
                    ApplicationOnlineHandlerPluginFacade.TurnApplicationOffline();
                    Verify.IsFalse(ApplicationOnlineHandlerPluginFacade.IsApplicationOnline(), "Plugin failed to turn the application offline");
                }
                else
                {
                    ConsoleMessageQueueFacade.Enqueue(new LockSystemConsoleMessageQueueItem(), "");
                }
            }
            catch (Exception)
            {
                _shutdownGuard.Dispose();
                _shutdownGuard = null;

                throw;
            }

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

            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);

            StringBuilder sb = new StringBuilder();

            var elementInformationService = flowControllerServicesContainer.GetService <IElementInformationService>();

            if (elementInformationService != null)
            {
                Dictionary <string, string> piggybag = elementInformationService.Piggyback;

                foreach (var kvp in piggybag)
                {
                    Core.Serialization.StringConversionServices.SerializeKeyValuePair(sb, kvp.Key, kvp.Value);
                }
            }

            Guid   id       = Guid.NewGuid();
            string filename = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.TempDirectory), string.Format("{0}.showinfo", id));

            C1File.WriteAllLines(filename, new string[] { serializedEntityToken, sb.ToString() });

            string url = string.Format("{0}?PiggyBagId={1}", UrlUtils.ResolveAdminUrl("content/views/showelementinformation/Default.aspx"), id);

            ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem {
                Url = url, ViewId = Guid.NewGuid().ToString(), ViewType = ViewType.Main, Label = "Show Element Information..."
            }, 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);
        }
Example #13
0
        private static void ShowInvalidEntityMessage(string consoleId)
        {
            // TODO: Add tree refreshing, localize message
            var msgBoxEntry = new MessageBoxMessageQueueItem {
                DialogType = DialogType.Error, Title = "Data item not found", Message = "This item seems to have been deleted.\n\nPlease update the tree by using the context menu \"Refresh\" command."
            };

            ConsoleMessageQueueFacade.Enqueue(msgBoxEntry, consoleId);
        }
Example #14
0
    protected void SaveStatus(bool succeeded)
    {
        var viewId    = Request["__VIEWID"];
        var consoleId = Request["__CONSOLEID"];

        ConsoleMessageQueueFacade.Enqueue(new SaveStatusConsoleMessageQueueItem {
            ViewId = viewId, Succeeded = succeeded
        }, consoleId);
    }
Example #15
0
 private void Alert(string title, string message)
 {
     ConsoleMessageQueueFacade.Enqueue(
         new MessageBoxMessageQueueItem
     {
         DialogType = DialogType.Error,
         Message    = message,
         Title      = title
     }, ConsoleId);
 }
Example #16
0
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var downloadActionToken = (DownloadSubmittedFormsActionToken)actionToken;
            var currentConsoleId    = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>().CurrentConsoleId;
            var url = "/formbuilder/" + downloadActionToken.FormName + "/submits" + downloadActionToken.Extension;

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

            return(null);
        }
Example #17
0
    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);
    }
        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);
        }
Example #19
0
        /// <summary>
        /// Selects the specified element in the console, doesn't change the perspective
        /// </summary>
        /// <param name="consoleId">The console id.</param>
        /// <param name="entityToken">The entity token.</param>
        public static void SelectConsoleElementWithoutPerspectiveChange(string consoleId, EntityToken entityToken)
        {
            var serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);

            var selectItem = new SelectElementQueueItem
            {
                EntityToken = serializedEntityToken,
            };

            ConsoleMessageQueueFacade.Enqueue(selectItem, consoleId);
        }
Example #20
0
        public static void ReloadDataElementInConsole(DataEntityToken dataEntityToken)
        {
            var parentEntityTokens = AuxiliarySecurityAncestorFacade.GetParents(dataEntityToken);

            foreach (var parentEntityToken in parentEntityTokens)
            {
                ConsoleMessageQueueFacade.Enqueue(new RefreshTreeMessageQueueItem {
                    EntityToken = parentEntityToken
                }, null);
            }
        }
        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);
        }
Example #22
0
        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);
            }
        }
        public static void ReloadPageElementInConsole(IPage page)
        {
            var parentPageId = PageManager.GetParentId(page.Id);
            var parentPage   = parentPageId != Guid.Empty ? PageManager.GetPageById(parentPageId) : null;

            var parentEntityToken = (parentPage != null)
                                        ? parentPage.GetDataEntityToken()
                                        : (EntityToken) new PageElementProviderEntityToken("PageElementProvider");

            ConsoleMessageQueueFacade.Enqueue(new RefreshTreeMessageQueueItem {
                EntityToken = parentEntityToken
            }, null);
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var token            = (DownloadExportedResourcesActionToken)actionToken;
            var currentConsoleId = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>().CurrentConsoleId;

            var url = UrlUtils.ResolveAdminUrl(StartupHandler.Url + "?languages=" + String.Join(",", token.Languages) + "&resourceSets=" + String.Join(",", token.ResourceSets) + "&ns=" + token.Namespace);

            var downloadQueueItem = new DownloadFileMessageQueueItem(url);

            ConsoleMessageQueueFacade.Enqueue(downloadQueueItem, currentConsoleId);

            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)
        {
            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);
        }
        private void step3CodeActivity_RefreshTree_ExecuteCode(object sender, EventArgs e)
        {
            if (this.GetBinding<bool>("ReloadConsoleOnCompletion"))
            {
                ConsoleMessageQueueFacade.Enqueue(new RebootConsoleMessageQueueItem(), null);
            }

            if (this.GetBinding<bool>("FlushOnCompletion"))
            {
                GlobalEventSystemFacade.FlushTheSystem();
            }

            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();
            specificTreeRefresher.PostRefreshMesseges(new PackageElementProviderRootEntityToken());
        }
        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)
        {
            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);

            ISystemActiveLocale systemActiveLocale = this.GetDataItemFromEntityToken <ISystemActiveLocale>();

            LocalizationFacade.RemoveLocale(systemActiveLocale.CultureName);

            ConsoleMessageQueueFacade.Enqueue(new CollapseAndRefreshConsoleMessageQueueItem(), null);
            ConsoleMessageQueueFacade.Enqueue(new BroadcastMessageQueueItem {
                Name = "LocalesUpdated", Value = ""
            }, null);

            deleteTreeRefresher.PostRefreshMesseges();
        }
Example #29
0
        private void DataEvents_IPageType_OnStoreChanged(object sender, StoreEventArgs storeEventArgs)
        {
            EntityToken entityToken = new PageElementProviderEntityToken(_context.ProviderName);

            var parents = HookingFacade.GetHookies(entityToken);

            if (parents != null)
            {
                foreach (var parentEntityToken in parents)
                {
                    ConsoleMessageQueueFacade.Enqueue(new RefreshTreeMessageQueueItem {
                        EntityToken = parentEntityToken
                    }, null);
                }
            }
        }
        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);
        }