Esempio n. 1
0
        public IEnumerable <Element> GetChildren(EntityToken entityToken, SearchToken seachToken)
        {
            if ((entityToken is LocalizationElementProviderRootEntityToken) == false)
            {
                throw new InvalidOperationException();
            }

            IEnumerable <ISystemActiveLocale> locales = DataFacade.GetData <ISystemActiveLocale>().ToList();

            List <Element> elements = new List <Element>();

            foreach (ISystemActiveLocale locale in locales)
            {
                bool isDefault = LocalizationFacade.IsDefaultLocale(locale.CultureName);

                ResourceHandle iconHandle = LocaleItemIcon;
                if (isDefault)
                {
                    //lable = string.Format("{0} ({1})", lable, StringResourceSystemFacade.GetString("Composite.Plugins.LocalizationElementProvider", "ElementProvider.DefaultLabel"));
                    iconHandle = DefaultLocaleItemIcon;
                }

                Element element = new Element(_context.CreateElementHandle(locale.GetDataEntityToken()));
                element.VisualData = new ElementVisualizedData
                {
                    Label       = DataLocalizationFacade.GetCultureTitle(new CultureInfo(locale.CultureName)),
                    ToolTip     = DataLocalizationFacade.GetCultureTitle(new CultureInfo(locale.CultureName)),
                    HasChildren = false,
                    Icon        = iconHandle
                };


                element.AddAction(new ElementAction(new ActionHandle(
                                                        new WorkflowActionToken(
                                                            WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.LocalizationElementProvider.EditSystemLocaleWorkflow"),
                                                            new PermissionType[] { PermissionType.Administrate }
                                                            )))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = StringResourceSystemFacade.GetString("Composite.Plugins.LocalizationElementProvider", "EditSystemLocaleWorkflow.EditElementActionLabel"),
                        ToolTip        = StringResourceSystemFacade.GetString("Composite.Plugins.LocalizationElementProvider", "EditSystemLocaleWorkflow.EditElementActionToolTip"),
                        Icon           = EditSystemLocaleIcon,
                        Disabled       = false,
                        ActionLocation = new ActionLocation
                        {
                            ActionType  = ActionType.Edit,
                            IsInFolder  = false,
                            IsInToolbar = true,
                            ActionGroup = PrimaryActionGroup
                        }
                    }
                });


                if (isDefault == false)
                {
                    element.AddAction(new ElementAction(new ActionHandle(
                                                            new WorkflowActionToken(
                                                                WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.LocalizationElementProvider.DefineDefaultActiveLocaleWorkflow"),
                                                                new PermissionType[] { PermissionType.Administrate }
                                                                )))
                    {
                        VisualData = new ActionVisualizedData
                        {
                            Label          = StringResourceSystemFacade.GetString("Composite.Plugins.LocalizationElementProvider", "DefineDefaultActiveLocaleWorkflow.ElementActionLabel"),
                            ToolTip        = StringResourceSystemFacade.GetString("Composite.Plugins.LocalizationElementProvider", "DefineDefaultActiveLocaleWorkflow.ElementActionToolTip"),
                            Icon           = SetAsDefaultIcon,
                            Disabled       = false,
                            ActionLocation = new ActionLocation
                            {
                                ActionType  = ActionType.Edit,
                                IsInFolder  = false,
                                IsInToolbar = true,
                                ActionGroup = PrimaryActionGroup
                            }
                        }
                    });


                    element.AddAction(new ElementAction(new ActionHandle(
                                                            new WorkflowActionToken(
                                                                WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.LocalizationElementProvider.RemoveSystemLocaleWorkflow"),
                                                                new PermissionType[] { PermissionType.Administrate }
                                                                )))
                    {
                        VisualData = new ActionVisualizedData
                        {
                            Label          = StringResourceSystemFacade.GetString("Composite.Plugins.LocalizationElementProvider", "RemoveSystemLocaleWorkflow.RemoveElementActionLabel"),
                            ToolTip        = StringResourceSystemFacade.GetString("Composite.Plugins.LocalizationElementProvider", "RemoveSystemLocaleWorkflow.RemoveElementActionToolTip"),
                            Icon           = RemoveSystemLocaleIcon,
                            Disabled       = false,
                            ActionLocation = new ActionLocation
                            {
                                ActionType  = ActionType.Delete,
                                IsInFolder  = false,
                                IsInToolbar = true,
                                ActionGroup = PrimaryActionGroup
                            }
                        }
                    });
                }

                elements.Add(element);
            }

            return(elements.OrderBy(f => f.VisualData.Label));
        }
Esempio n. 2
0
        public IEnumerable <Element> GetRoots(SearchToken searchToken)
        {
            int pages;

            using (new DataScope(DataScopeIdentifier.Administrated))
            {
                pages = PageServices.GetChildrenCount(Guid.Empty);
            }

            EntityToken entityToken = new PageElementProviderEntityToken(_context.ProviderName);

            var dragAndDropInfo = new ElementDragAndDropInfo();

            dragAndDropInfo.AddDropType(typeof(IPage));
            dragAndDropInfo.SupportsIndexedPosition = true;

            var element = new Element(_context.CreateElementHandle(entityToken), dragAndDropInfo)
            {
                VisualData = new ElementVisualizedData
                {
                    Label       = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.RootLabel"),
                    ToolTip     = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.RootLabelToolTip"),
                    HasChildren = pages != 0,
                    Icon        = PageElementProvider.RootClosed,
                    OpenedIcon  = PageElementProvider.RootOpen
                }
            };

            element.AddAction(new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Add, AddWebsitePermissionTypes)))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.AddPageAtRoot"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.AddPageAtRootToolTip"),
                    Icon           = PageElementProvider.AddPage,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Add,
                        IsInFolder  = false,
                        IsInToolbar = true,
                        ActionGroup = PrimaryActionGroup
                    }
                }
            });


            element.AddAction(new ElementAction(new ActionHandle(new ViewUnpublishedItemsActionToken()))
            {
                VisualData = new ActionVisualizedData
                {
                    //Label = "List unpublished Pages and Folder Data",
                    //ToolTip = "Get an overview of pages and page folder data that haven't been published yet.",
                    Label          = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.ViewUnpublishedItems"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.ViewUnpublishedItemsToolTip"),
                    Icon           = PageElementProvider.ListUnpublishedItems,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Other,
                        IsInFolder  = false,
                        IsInToolbar = true,
                        ActionGroup = ViewActionGroup
                    }
                }
            });

            element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.AddMetaDataWorkflow"), AssociatedDataElementProviderHelper <IPage> .AddAssociatedTypePermissionTypes)
            {
                DoIgnoreEntityTokenLocking = true
            }))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.AddMetaDataTypeLabel"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.AddMetaDataTypeToolTip"),
                    Icon           = AddDataAssociationTypeIcon,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Add,
                        IsInFolder  = false,
                        IsInToolbar = false,
                        ActionGroup = MetaDataAppendedActionGroup
                    }
                }
            });

            element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.EditMetaDataWorkflow"), AssociatedDataElementProviderHelper <IPage> .EditAssociatedTypePermissionTypes)))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.EditMetaDataTypeLabel"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.EditMetaDataTypeToolTip"),
                    Icon           = EditDataAssociationTypeIcon,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Edit,
                        IsInFolder  = false,
                        IsInToolbar = false,
                        ActionGroup = MetaDataAppendedActionGroup
                    }
                }
            });

            element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.DeleteMetaDataWorkflow"), AssociatedDataElementProviderHelper <IPage> .RemoveAssociatedTypePermissionTypes)))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.RemoveMetaDataTypeLabel"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.RemoveMetaDataTypeToolTip"),
                    Icon           = RemoveDataAssociationTypeIcon,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Delete,
                        IsInFolder  = false,
                        IsInToolbar = false,
                        ActionGroup = MetaDataAppendedActionGroup
                    }
                }
            });

            // Creates a problem for the front-end "toolbar caching" mechanism - dont re-introduce this right befroe a release
            // Reason: ActionTokin is always unique for a page, making the ActionKey (hash) unique
            //if (RuntimeInformation.IsDebugBuild)
            //{
            //    element.AddAction(new ElementAction(new ActionHandle(new DisplayLocalOrderingActionToken(Guid.Empty)))
            //    {
            //        VisualData = new ActionVisualizedData
            //        {
            //            Label = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.DisplayLocalOrderingLabel"),
            //            ToolTip = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.DisplayLocalOrderingToolTip"),
            //            Icon = CommonElementIcons.Nodes,
            //            Disabled = false,
            //            ActionLocation = new ActionLocation
            //            {
            //                ActionType = ActionType.DeveloperMode,
            //                IsInFolder = false,
            //                IsInToolbar = false,
            //                ActionGroup = AppendedActionGroup
            //            }
            //        }
            //    });
            //}

            yield return(element);
        }
Esempio n. 3
0
        private Element BuildElement(IData data,
                                     DynamicValuesHelperReplaceContext replaceContext,
                                     TreeNodeDynamicContext dynamicContext,
                                     bool localizationEnabled,
                                     List <object> itemKeys,
                                     ref IEnumerable <object> keysJoinedByParentFilters,
                                     EntityToken parentEntityToken
                                     )
        {
            replaceContext.CurrentDataItem = data;

            object keyValue = this.KeyPropertyInfo.GetValue(data, null);

            bool itemLocalizationEnabledAndForeign = localizationEnabled && !data.DataSourceId.LocaleScope.Equals(UserSettings.ActiveLocaleCultureInfo);

            if (itemLocalizationEnabledAndForeign && itemKeys.Contains(keyValue))
            {
                return(null);
            }

            var currentEntityToken = data.GetDataEntityToken();

            var element = new Element(new ElementHandle
                                      (
                                          dynamicContext.ElementProviderName,
                                          currentEntityToken,
                                          dynamicContext.Piggybag.PreparePiggybag(this.ParentNode, parentEntityToken)
                                      ));

            if (parentEntityToken is TreePerspectiveEntityToken)
            {
                element.ElementHandle.Piggyback[StringConstants.PiggybagTreeId] = Tree.TreeId;
            }

            bool           hasChildren;
            bool           isDisabled = false;
            ResourceHandle icon, openedIcon;

            if (itemLocalizationEnabledAndForeign)
            {
                hasChildren = false;
                isDisabled  = !data.IsTranslatable();

                if (this.Icon != null)
                {
                    icon       = this.Icon;
                    openedIcon = this.OpenedIcon;
                }
                else
                {
                    icon       = data.GetForeignIcon();
                    openedIcon = icon;
                }
            }
            else
            {
                if (this.Display != LeafDisplayMode.Auto)
                {
                    hasChildren = ChildNodes.Any();
                }
                else
                {
                    hasChildren = ChildNodes.OfType <SimpleElementTreeNode>().Any();

                    if (!hasChildren)
                    {
                        if (keysJoinedByParentFilters != null)
                        {
                            keysJoinedByParentFilters = keysJoinedByParentFilters.Evaluate();

                            hasChildren = keysJoinedByParentFilters.Contains(keyValue);
                        }
                    }

                    // Checking children filtered by FunctionFilters
                    if (!hasChildren)
                    {
                        foreach (var childNode in this.ChildNodes.OfType <DataElementsTreeNode>()
                                 .Where(n => n.FilterNodes.OfType <FunctionFilterNode>().Any()))
                        {
                            var newDynamicContext = new TreeNodeDynamicContext(TreeNodeDynamicContextDirection.Down)
                            {
                                ElementProviderName = dynamicContext.ElementProviderName,
                                Piggybag            = dynamicContext.Piggybag.PreparePiggybag(this.ParentNode, parentEntityToken),
                                CurrentEntityToken  = currentEntityToken
                            };

                            if (childNode.GetDataset(newDynamicContext, false).DataItems.Any())
                            {
                                hasChildren = true;
                                break;
                            }
                        }
                    }
                }

                if (this.Icon != null)
                {
                    icon       = this.Icon;
                    openedIcon = this.OpenedIcon;
                }
                else
                {
                    openedIcon = icon = data.GetIcon();
                }
            }

            string label = this.Label.IsNullOrEmpty()
                            ? data.GetLabel()
                            : this.LabelDynamicValuesHelper.ReplaceValues(replaceContext);

            string toolTip = this.ToolTip.IsNullOrEmpty()
                            ? label
                            : this.ToolTipDynamicValuesHelper.ReplaceValues(replaceContext);

            if (itemLocalizationEnabledAndForeign)
            {
                label = string.Format("{0} ({1})", label, DataLocalizationFacade.GetCultureTitle(UserSettings.ForeignLocaleCultureInfo));

                if (!data.IsTranslatable())
                {
                    toolTip = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "LocalizeDataWorkflow.DisabledData");
                }
                else
                {
                    toolTip = string.Format("{0} ({1})", toolTip, DataLocalizationFacade.GetCultureTitle(UserSettings.ForeignLocaleCultureInfo));
                }
            }

            element.VisualData = new ElementVisualizedData
            {
                Label       = label,
                ToolTip     = toolTip,
                HasChildren = hasChildren,
                Icon        = icon,
                OpenedIcon  = openedIcon,
                IsDisabled  = isDisabled
            };


            if (InternalUrls.DataTypeSupported(data.DataSourceId.InterfaceType))
            {
                var dataReference = data.ToDataReference();

                if (DataUrls.CanBuildUrlForData(dataReference))
                {
                    string internalUrl = InternalUrls.TryBuildInternalUrl(dataReference);

                    if (internalUrl != null)
                    {
                        element.PropertyBag.Add("Uri", internalUrl);
                    }
                }
            }

            if (this.BrowserUrl != null)
            {
                var url = this.BrowserUrlDynamicValuesHelper.ReplaceValues(replaceContext);

                if (!url.Contains("//"))
                {
                    url = Core.WebClient.UrlUtils.ResolvePublicUrl(url);
                }

                element.PropertyBag.Add("BrowserUrl", url);
                element.PropertyBag.Add("BrowserToolingOn", "false");
            }


            if (this.BrowserImage != null)
            {
                var url = this.BrowserImageDynamicValuesHelper.ReplaceValues(replaceContext);

                if (!url.Contains("//"))
                {
                    url = Core.WebClient.UrlUtils.ResolvePublicUrl(url);
                }

                element.PropertyBag.Add("ListViewImage", url);

                if (this.BrowserUrl == null)
                {
                    element.PropertyBag.Add("DetailViewImage", url);
                }
            }


            if (itemLocalizationEnabledAndForeign)
            {
                var actionToken = new WorkflowActionToken(
                    WorkflowFacade.GetWorkflowType("Composite.C1Console.Trees.Workflows.LocalizeDataWorkflow"),
                    LocalizeDataPermissionTypes);

                element.AddAction(new ElementAction(new ActionHandle(actionToken))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "LocalizeDataWorkflow.LocalizeDataLabel"),
                        ToolTip        = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "LocalizeDataWorkflow.LocalizeDataToolTip"),
                        Icon           = LocalizeDataTypeIcon,
                        Disabled       = false,
                        ActionLocation = ActionLocation.OtherPrimaryActionLocation
                    }
                });
            }

            return(element);
        }
Esempio n. 4
0
        public IEnumerable <Element> GetChildren(EntityToken entityToken, SearchToken seachToken)
        {
            if ((entityToken is UserGroupElementProviderRootEntityToken) == false)
            {
                return new Element[] { }
            }
            ;

            IEnumerable <IUserGroup> userGroups =
                (from ug in DataFacade.GetData <IUserGroup>()
                 orderby ug.Name
                 select ug).Evaluate();

            List <Element> elements = new List <Element>();

            foreach (IUserGroup userGroup in userGroups)
            {
                Element element = new Element(_elementProviderContext.CreateElementHandle(userGroup.GetDataEntityToken()))
                {
                    VisualData = new ElementVisualizedData
                    {
                        Label       = userGroup.Name,
                        ToolTip     = userGroup.Name,
                        HasChildren = false,
                        Icon        = UserGroupElementProvider.UserGroupIcon,
                        OpenedIcon  = UserGroupElementProvider.UserGroupIcon
                    }
                };

                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.UserGroupElementProvider.EditUserGroupWorkflow"), EditUserGroupPermissionTypes)))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = StringResourceSystemFacade.GetString("Composite.Plugins.UserGroupElementProvider", "UserGroupElementProvider.EditUserGroupLabel"),
                        ToolTip        = StringResourceSystemFacade.GetString("Composite.Plugins.UserGroupElementProvider", "UserGroupElementProvider.EditUserGroupToolTip"),
                        Icon           = UserGroupElementProvider.EditUserGroupIcon,
                        Disabled       = false,
                        ActionLocation = new ActionLocation
                        {
                            ActionType  = ActionType.Edit,
                            IsInFolder  = false,
                            IsInToolbar = true,
                            ActionGroup = PrimaryActionGroup
                        }
                    }
                });

                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.UserGroupElementProvider.DeleteUserGroupWorkflow"), DeleteUserGroupPermissionTypes)))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = StringResourceSystemFacade.GetString("Composite.Plugins.UserGroupElementProvider", "UserGroupElementProvider.DeleteUserGroupLabel"),
                        ToolTip        = StringResourceSystemFacade.GetString("Composite.Plugins.UserGroupElementProvider", "UserGroupElementProvider.DeleteUserGroupToolTip"),
                        Icon           = UserGroupElementProvider.DeleteUserGroupIcon,
                        Disabled       = false,
                        ActionLocation = new ActionLocation
                        {
                            ActionType  = ActionType.Delete,
                            IsInFolder  = false,
                            IsInToolbar = true,
                            ActionGroup = PrimaryActionGroup
                        }
                    }
                });

                elements.Add(element);
            }

            return(elements);
        }
        public IEnumerable <Element> GetChildren(EntityToken parentEntityToken,
                                                 Dictionary <string, string> piggybag)
        {
            using (DataConnection connection = new DataConnection())
            {
                if ((parentEntityToken is MyRootEntityToken) == true)
                {
                    yield return(new Element(this.Context.CreateElementHandle(new MyEntityToken("Approval")))
                    {
                        VisualData = new ElementVisualizedData
                        {
                            Label = "Pages awaiting approval",
                            ToolTip = "Pages awaiting approval",
                            HasChildren = connection.
                                          Get <IPage>().
                                          Any(f => f.PublicationStatus == "awaitingApproval"),
                            Icon = CommonElementIcons.Search
                        }
                    });

                    yield return(new Element(this.Context.CreateElementHandle(
                                                 new MyEntityToken("Publication")))
                    {
                        VisualData = new ElementVisualizedData
                        {
                            Label = "Pages awaiting publication",
                            ToolTip = "Pages awaiting publication",
                            HasChildren = connection.
                                          Get <IPage>().
                                          Any(f => f.PublicationStatus == "awaitingPublication"),
                            Icon = CommonElementIcons.Search
                        }
                    });
                }
                else
                {
                    MyEntityToken myEntityToken = parentEntityToken as MyEntityToken;
                    if (myEntityToken == null)
                    {
                        throw new NotImplementedException();
                    }
                    IEnumerable <IPage> pages;
                    ResourceHandle      icon;
                    if (myEntityToken.Id == "Approval")
                    {
                        pages = connection.Get <IPage>().
                                Where(f => f.PublicationStatus == "awaitingApproval");
                        icon = DataAwaitingApproval;
                    }
                    else if (myEntityToken.Id == "Publication")
                    {
                        pages = connection.Get <IPage>().
                                Where(f => f.PublicationStatus == "awaitingPublication");
                        icon = DataAwaitingPublication;
                    }
                    else
                    {
                        throw new NotImplementedException();
                    }

                    foreach (IPage page in pages)
                    {
                        Element element =
                            new Element(this.Context.CreateElementHandle(page.GetDataEntityToken()))
                        {
                            VisualData = new ElementVisualizedData
                            {
                                Label       = page.Title,
                                ToolTip     = page.Title,
                                HasChildren = false,
                                Icon        = icon
                            }
                        };
                        element.AddAction(new ElementAction(new ActionHandle(new MyUrlActionToken()))
                        {
                            VisualData = new ActionVisualizedData
                            {
                                Label          = "My Url Action",
                                ToolTip        = "My Url Action",
                                Icon           = CommonCommandIcons.ShowReport,
                                ActionLocation = new ActionLocation
                                {
                                    ActionType  = ActionType.Other,
                                    IsInFolder  = false,
                                    IsInToolbar = true,
                                    ActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh)
                                }
                            }
                        });

                        element.AddAction(
                            new ElementAction(new ActionHandle(new WorkflowActionToken(
                                                                   WorkflowFacade.GetWorkflowType(typeof(EditPageWorkflow).FullName),
                                                                   new PermissionType[] { PermissionType.Administrate })))
                        {
                            VisualData = new ActionVisualizedData
                            {
                                Label          = "Edit page",
                                ToolTip        = "Eidt page",
                                Icon           = icon,
                                Disabled       = false,
                                ActionLocation = new ActionLocation
                                {
                                    ActionType  = ActionType.Edit,
                                    IsInFolder  = false,
                                    IsInToolbar = true,
                                    ActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh)
                                }
                            }
                        });
                        yield return(element);
                    }
                }
            }
        }
Esempio n. 6
0
        public void AddActions(Element element)
        {
            var actions = Provide(element.ElementHandle.EntityToken);

            element.AddAction(actions);
        }
Esempio n. 7
0
        private List <Element> GetElements(List <KeyValuePair <PageLocaleState, IPage> > pages, bool rootPages)
        {
            //ElementDragAndDropInfo dragAndDropInfo = new ElementDragAndDropInfo(typeof(IPage));
            //dragAndDropInfo.AddDropType(typeof(IPage));
            //dragAndDropInfo.SupportsIndexedPosition = true;



            string editPageLabel       = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.EditPage");
            string editPageToolTip     = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.EditPageToolTip");
            string localizePageLabel   = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.LocalizePage");
            string localizePageToolTip = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.LocalizePageToolTip");
            string addNewPageLabel     = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.AddSubPageFormat");
            //string addNewPageToolTip = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.AddSubPageToolTip");
            string deletePageLabel      = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.Delete");
            string deletePageToolTip    = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.DeleteToolTip");
            string duplicatePageLabel   = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.Duplicate");
            string duplicatePageToolTip = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.DuplicateToolTip");

            string urlMappingName = null;

            if (UserSettings.ForeignLocaleCultureInfo != null)
            {
                urlMappingName = DataLocalizationFacade.GetCultureTitle(UserSettings.ForeignLocaleCultureInfo);
            }

            var elements     = new Element[pages.Count];
            var allPageTypes = DataFacade.GetData <IPageType>().AsEnumerable();

            ParallelFacade.For("PageElementProvider. Getting elements", 0, pages.Count, i =>
            {
                var kvp    = pages[i];
                IPage page = kvp.Value;

                EntityToken entityToken = page.GetDataEntityToken();

                var dragAndDropInfo = new ElementDragAndDropInfo(typeof(IPage));
                dragAndDropInfo.AddDropType(typeof(IPage));
                dragAndDropInfo.SupportsIndexedPosition = true;

                var element = new Element(_context.CreateElementHandle(entityToken), MakeVisualData(page, kvp.Key, urlMappingName, rootPages), dragAndDropInfo);

                element.PropertyBag.Add("Uri", $"~/page({page.Id})");
                element.PropertyBag.Add("ElementType", "application/x-composite-page");
                element.PropertyBag.Add("DataId", page.Id.ToString());

                if (kvp.Key == PageLocaleState.Own)
                {
                    // Normal actions
                    element.AddAction(new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Edit, EditPermissionTypes)))
                    {
                        VisualData = new ActionVisualizedData
                        {
                            Label          = editPageLabel,
                            ToolTip        = editPageToolTip,
                            Icon           = PageElementProvider.EditPage,
                            Disabled       = false,
                            ActionLocation = new ActionLocation
                            {
                                ActionType  = ActionType.Edit,
                                IsInFolder  = false,
                                IsInToolbar = true,
                                ActionGroup = PrimaryActionGroup
                            }
                        }
                    });

                    IPageType parentPageType = allPageTypes.FirstOrDefault(f => f.Id == page.PageTypeId);
                    Verify.IsNotNull(parentPageType, "Failed to find page type by id '{0}'", page.PageTypeId);
                    element.AddAction(new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Duplicate, DuplicatePermissionTypes)))
                    {
                        VisualData = new ActionVisualizedData
                        {
                            Label          = duplicatePageLabel,
                            ToolTip        = duplicatePageToolTip,
                            Icon           = PageElementProvider.DuplicatePage,
                            Disabled       = false,
                            ActionLocation = new ActionLocation
                            {
                                ActionType  = ActionType.Add,
                                IsInFolder  = false,
                                IsInToolbar = true,
                                ActionGroup = PrimaryActionGroup
                            }
                        }
                    });

                    foreach (var pageType in page.GetChildPageSelectablePageTypes().OrderByDescending(pt => pt.Id == parentPageType.DefaultChildPageType))
                    {
                        element.AddAction(new ElementAction(new ActionHandle(new PageAddActionToken(pageType.Id, ActionIdentifier.Add, AddPermissionTypes)
                        {
                            DoIgnoreEntityTokenLocking = true
                        }))
                        {
                            VisualData = new ActionVisualizedData
                            {
                                Label          = string.Format(addNewPageLabel, pageType.Name),
                                ToolTip        = pageType.Description,
                                Icon           = PageElementProvider.AddPage,
                                Disabled       = false,
                                ActionLocation = new ActionLocation
                                {
                                    ActionType   = ActionType.Add,
                                    IsInFolder   = false,
                                    IsInToolbar  = true,
                                    ActionGroup  = PrimaryActionGroup,
                                    ActionBundle = "AddPage"
                                }
                            }
                        });
                    }


                    element.AddAction(new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Delete, DeletePermissionTypes)))
                    {
                        VisualData = new ActionVisualizedData
                        {
                            Label          = deletePageLabel,
                            ToolTip        = deletePageToolTip,
                            Icon           = DeletePage,
                            Disabled       = false,
                            ActionLocation = new ActionLocation
                            {
                                ActionType  = ActionType.Delete,
                                IsInFolder  = false,
                                IsInToolbar = true,
                                ActionGroup = PrimaryActionGroup
                            }
                        }
                    });

                    _pageAssociatedHelper.AttachElementActions(element, page);
                }
                else if (kvp.Key == PageLocaleState.ForeignActive)
                {
                    // Localized actions
                    bool addAction = false;

                    Guid parentId = page.GetParentId();
                    if (parentId == Guid.Empty)
                    {
                        addAction = true;
                    }
                    else
                    {
                        using (new DataScope(DataScopeIdentifier.Administrated, UserSettings.ActiveLocaleCultureInfo))
                        {
                            bool exists = DataFacade.GetData <IPage>(f => f.Id == parentId).Any();
                            if (exists)
                            {
                                addAction = true;
                            }
                        }
                    }


                    if (addAction)
                    {
                        element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.PageElementProvider.LocalizePageWorkflow"), LocalizePermissionTypes)))
                        {
                            VisualData = new ActionVisualizedData
                            {
                                Label          = localizePageLabel,
                                ToolTip        = localizePageToolTip,
                                Icon           = PageElementProvider.LocalizePage,
                                Disabled       = false,
                                ActionLocation = new ActionLocation
                                {
                                    ActionType  = ActionType.Edit,
                                    IsInFolder  = false,
                                    IsInToolbar = true,
                                    ActionGroup = PrimaryActionGroup
                                }
                            }
                        });
                    }
                }

                elements[i] = element;
            });

            return(new List <Element>(elements));
        }
Esempio n. 8
0
        /// <summary>
        /// Call this method to add actions to the element which represents the data of type T
        /// </summary>
        /// <param name="associatedDataElement"></param>
        /// <param name="data">Null is allowed</param>
        public void AttachElementActions(Element associatedDataElement, T data)
        {
            associatedDataElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.AddDataFolderExWorkflow"), AddAssociatedTypePermissionTypes)
            {
                Payload = TypeManager.SerializeType(typeof(T)), DoIgnoreEntityTokenLocking = true
            }))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.AddDataFolderTypeLabel"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.AddDataFolderTypeToolTip"),
                    Icon           = this.AddDataAssociationTypeIcon,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Add,
                        IsInFolder  = false,
                        IsInToolbar = false,
                        ActionGroup = AppendedActionGroup
                    }
                }
            });


            associatedDataElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.AddMetaDataWorkflow"), AddAssociatedTypePermissionTypes)
            {
                Payload = TypeManager.SerializeType(typeof(T)), DoIgnoreEntityTokenLocking = true
            }))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.AddMetaDataTypeLabel"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.AddMetaDataTypeToolTip"),
                    Icon           = this.AddDataAssociationTypeIcon,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Add,
                        IsInFolder  = false,
                        IsInToolbar = false,
                        ActionGroup = AppendedActionGroup
                    }
                }
            });


            associatedDataElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.EditMetaDataWorkflow"), EditAssociatedTypePermissionTypes)
            {
                DoIgnoreEntityTokenLocking = true
            }))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.EditMetaDataTypeLabel"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.EditMetaDataTypeToolTip"),
                    Icon           = this.EditDataAssociationTypeIcon,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Edit,
                        IsInFolder  = false,
                        IsInToolbar = false,
                        ActionGroup = AppendedActionGroup
                    }
                }
            });


            associatedDataElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.DeleteMetaDataWorkflow"), RemoveAssociatedTypePermissionTypes)))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.RemoveMetaDataTypeLabel"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.RemoveMetaDataTypeToolTip"),
                    Icon           = this.RemoveDataAssociationTypeIcon,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Delete,
                        IsInFolder  = false,
                        IsInToolbar = false,
                        ActionGroup = AppendedActionGroup
                    }
                }
            });
        }
        private void AddTeaserInstances(EntityToken entityToken, List <Element> list, PageTeaserPositionFolderEntityToken folderToken)
        {
            var page      = PageManager.GetPageById(new Guid(entityToken.Source));
            var instances = TeaserFacade.GetPageTeasers(page, folderToken.Id, false);

            foreach (var instance in instances)
            {
                var attributes = instance.DataSourceId.InterfaceType.GetCustomAttributes(true).ToList();

                var icon       = new ResourceHandle("Composite.Icons", "dataassociation-rootfolder-closed");
                var openedIcon = new ResourceHandle("Composite.Icons", "dataassociation-rootfolder-open");

                var iconAttribute = attributes.OfType <IconAttribute>().FirstOrDefault();
                if (iconAttribute != null)
                {
                    icon = new ResourceHandle("Composite.Icons", iconAttribute.Name);

                    if (!String.IsNullOrEmpty(iconAttribute.OpenedName))
                    {
                        openedIcon = new ResourceHandle("Composite.Icons", iconAttribute.OpenedName);
                    }
                }

                var label = StringResourceSystemFacade.GetString("CompositeC1Contrib.Teasers", "TeaserElementAttachingProvider.NoLabel");
                try
                {
                    label = instance.GetLabel();
                }
                catch (Exception) { }

                var elementHandle = _context.CreateElementHandle(new PageTeaserInstanceEntityToken(page, instance));
                var teaserElement = new Element(elementHandle)
                {
                    VisualData = new ElementVisualizedData
                    {
                        Label       = label,
                        ToolTip     = label,
                        HasChildren = false,
                        Icon        = icon,
                        OpenedIcon  = openedIcon
                    }
                };

                var editWorkflowAttribute = attributes.OfType <EditWorkflowAttribute>().FirstOrDefault();
                if (editWorkflowAttribute != null)
                {
                    var editActionToken = new WorkflowActionToken(editWorkflowAttribute.EditWorkflowType, new[] { PermissionType.Edit });
                    teaserElement.AddAction(new ElementAction(new ActionHandle(editActionToken))
                    {
                        VisualData = new ActionVisualizedData
                        {
                            Label          = StringResourceSystemFacade.GetString("CompositeC1Contrib.Teasers", "TeaserElementAttachingProvider.Edit.Label"),
                            ToolTip        = StringResourceSystemFacade.GetString("CompositeC1Contrib.Teasers", "TeaserElementAttachingProvider.Edit.ToolTip"),
                            Icon           = new ResourceHandle("Composite.Icons", "generated-type-data-edit"),
                            ActionLocation = ActionLocation
                        }
                    });
                }

                var deleteActionToken = new ConfirmWorkflowActionToken(StringResourceSystemFacade.GetString("CompositeC1Contrib.Teasers", "TeaserElementAttachingProvider.DeleteItem") + label, typeof(DeletePageTeaserActionToken));
                teaserElement.AddAction(new ElementAction(new ActionHandle(deleteActionToken))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = StringResourceSystemFacade.GetString("CompositeC1Contrib.Teasers", "TeaserElementAttachingProvider.Delete.Label"),
                        ToolTip        = StringResourceSystemFacade.GetString("CompositeC1Contrib.Teasers", "TeaserElementAttachingProvider.Delete.ToolTip"),
                        Icon           = new ResourceHandle("Composite.Icons", "generated-type-data-delete"),
                        ActionLocation = ActionLocation
                    }
                });

                list.Add(teaserElement);
            }
        }
        private static IEnumerable <Element> GetNamespaceAndResourceElements(ElementProviderContext context, string ns)
        {
            var resources = LocalizationsFacade.GetResourceKeys(ns);

            var folders  = new List <string>();
            var elements = new List <Element>();

            foreach (var key in resources)
            {
                var label = key.Key;

                if (label == ns)
                {
                    continue;
                }

                var labelParts = label.Split('.');

                if (!String.IsNullOrEmpty(ns))
                {
                    var nsParts = ns.Split('.');

                    if (nsParts.Length > labelParts.Length)
                    {
                        continue;
                    }

                    labelParts = labelParts.Skip(nsParts.Length).ToArray();
                    label      = String.Join(".", labelParts);
                }

                if (labelParts.Length > 1)
                {
                    var folder = labelParts[0];

                    if (!folders.Contains(folder))
                    {
                        folders.Add(folder);
                    }
                }
                else if (labelParts.Length == 1)
                {
                    var token = key.GetDataEntityToken();

                    var dragAndDropInfo = new ElementDragAndDropInfo(typeof(IResourceKey));

                    dragAndDropInfo.AddDropType(typeof(NamespaceFolderEntityToken));
                    dragAndDropInfo.SupportsIndexedPosition = false;

                    var elementHandle = context.CreateElementHandle(token);
                    var element       = new Element(elementHandle, dragAndDropInfo)
                    {
                        VisualData = new ElementVisualizedData
                        {
                            Label       = label,
                            ToolTip     = label,
                            HasChildren = false,
                            Icon        = ResourceHandle.BuildIconFromDefaultProvider("localization-element-closed-root"),
                            OpenedIcon  = ResourceHandle.BuildIconFromDefaultProvider("localization-element-opened-root")
                        }
                    };

                    var editActionToken = new WorkflowActionToken(typeof(EditResourceWorkflow), new[] { PermissionType.Edit });
                    element.AddAction(new ElementAction(new ActionHandle(editActionToken))
                    {
                        VisualData = new ActionVisualizedData
                        {
                            Label          = "Edit",
                            ToolTip        = "Edit",
                            Icon           = new ResourceHandle("Composite.Icons", "generated-type-data-edit"),
                            ActionLocation = Actions.ActionLocation
                        }
                    });

                    var deleteActionToken = new ConfirmWorkflowActionToken("Are you sure?", typeof(DeleteResourceActionToken));
                    element.AddAction(new ElementAction(new ActionHandle(deleteActionToken))
                    {
                        VisualData = new ActionVisualizedData
                        {
                            Label          = "Delete",
                            ToolTip        = "Delete",
                            Icon           = new ResourceHandle("Composite.Icons", "generated-type-data-delete"),
                            ActionLocation = Actions.ActionLocation
                        }
                    });

                    elements.Add(element);
                }
            }

            foreach (var folder in folders.OrderBy(f => f))
            {
                var handleNamespace = folder;
                if (!String.IsNullOrEmpty(ns))
                {
                    handleNamespace = ns + "." + handleNamespace;
                }

                var folderElement = NamespaceFolderEntityToken.CreateElement(context, folder, handleNamespace);

                var deleteActionToken = new ConfirmWorkflowActionToken("Are you sure?", typeof(DeleteNamespaceActionToken));
                folderElement.AddAction(new ElementAction(new ActionHandle(deleteActionToken))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = "Delete",
                        ToolTip        = "Delete",
                        Icon           = new ResourceHandle("Composite.Icons", "generated-type-data-delete"),
                        ActionLocation = Actions.ActionLocation
                    }
                });

                folderElement.AddAction(Actions.GetAddAction());
                folderElement.AddAction(Actions.GetExportAction());

                yield return(folderElement);
            }

            foreach (var el in elements)
            {
                yield return(el);
            }
        }
Esempio n. 11
0
        public IEnumerable <Element> GetRoots(SearchToken seachToken)
        {
            Element element = new Element(_context.CreateElementHandle(new WebsiteFileElementProviderRootEntityToken(_context.ProviderName, _rootPath)))
            {
                VisualData = new ElementVisualizedData()
                {
                    Label       = StringResourceSystemFacade.ParseString(_rootLabel),
                    ToolTip     = StringResourceSystemFacade.ParseString(_rootLabel),
                    HasChildren = true,
                    Icon        = FolderIcon,
                    OpenedIcon  = OpenFolderIcon
                }
            };

            //element.MovabilityInfo.AddDropType(typeof(WebsiteFolder));
            //element.MovabilityInfo.AddDropType(typeof(WebsiteFile));

            List <IFolderWhiteList> myWhiteLists = DataFacade.GetData <IFolderWhiteList>(f => f.KeyName == _folderWhiteListKeyName).ToList();

            if (string.IsNullOrEmpty(_folderWhiteListKeyName) || DataFacade.GetData <IFolderWhiteList>(f => f.KeyName == _folderWhiteListKeyName && f.TildeBasedPath == "~\\").Any())
            {
                element.AddAction(
                    new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.AddNewWebsiteFolderWorkflow"), _addNewWebsiteFolderPermissionTypes)))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label           = StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "AddWebsiteFolderTitle"),
                        ToolTip         = StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "AddWebsiteFolderToolTip"),
                        Icon            = WebsiteFileElementProvider.AddWebsiteFolder,
                        Disabled        = false,
                        ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,
                        ActionLocation  = new ActionLocation
                        {
                            ActionType  = ActionType.Add,
                            IsInFolder  = false,
                            IsInToolbar = true,
                            ActionGroup = PrimaryFolderActionGroup
                        }
                    }
                });

                element.AddAction(
                    new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.AddNewWebsiteFileWorkflow"), _addNewWebsiteFilePermissionTypes)))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label           = StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "AddWebsiteFileTitle"),
                        ToolTip         = StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "AddWebsiteFileToolTip"),
                        Icon            = WebsiteFileElementProvider.AddWebsiteFile,
                        Disabled        = false,
                        ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,
                        ActionLocation  = new ActionLocation
                        {
                            ActionType  = ActionType.Add,
                            IsInFolder  = false,
                            IsInToolbar = true,
                            ActionGroup = PrimaryFolderActionGroup
                        }
                    }
                });

                element.AddAction(
                    new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.UploadWebsiteFileWorkflow"), _uploadWebsiteFilePermissionTypes)))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label           = StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "UploadWebsiteFileTitle"),
                        ToolTip         = StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "UploadWebsiteFileToolTip"),
                        Icon            = WebsiteFileElementProvider.UploadWebsiteFile,
                        Disabled        = false,
                        ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,
                        ActionLocation  = new ActionLocation
                        {
                            ActionType   = ActionType.Add,
                            IsInFolder   = false,
                            IsInToolbar  = true,
                            ActionGroup  = PrimaryFolderActionGroup,
                            ActionBundle = "Upload"
                        }
                    }
                });

                element.AddAction(
                    new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.UploadAndExtractZipFileWorkflow"), _uploadAndExtractZipFileWorkflow)))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label           = StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "UploadAndExtractZipFileTitle"),
                        ToolTip         = StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "UploadAndExtractZipFileToolTip"),
                        Icon            = WebsiteFileElementProvider.UploadAndExtractZipFile,
                        Disabled        = false,
                        ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,
                        ActionLocation  = new ActionLocation
                        {
                            ActionType   = ActionType.Add,
                            IsInFolder   = false,
                            IsInToolbar  = true,
                            ActionGroup  = PrimaryFolderActionGroup,
                            ActionBundle = "Upload"
                        }
                    }
                });

                List <ElementAction>           actionsToAppend            = new List <ElementAction>();
                IEnumerable <IFolderWhiteList> manageableFolderWhiteLists = DataFacade.GetData <IFolderWhiteList>().ToList();
                AppendFolderManagementActions(PathUtil.BaseDirectory, manageableFolderWhiteLists, actionsToAppend);

                element.AddAction(actionsToAppend);
            }

            yield return(element);
        }
        private IEnumerable <Element> GetUsersChildrenElements(string folderName, SearchToken seachToken)
        {
            ICollection <UserInfo> users;



            if (!seachToken.IsValidKeyword())
            {
                users =
                    (from userFormLogin in DataFacade.GetData <IUserFormLogin>().ToList()
                     join user in DataFacade.GetData <IUser>().ToList() on userFormLogin.UserId equals user.Id
                     where userFormLogin.Folder == folderName
                     orderby user.Username
                     select new UserInfo {
                    User = user, UserFormLogin = userFormLogin
                }).ToList();
            }
            else
            {
                string keyword = seachToken.Keyword.ToLowerInvariant();

                users =
                    (from userFormLogin in DataFacade.GetData <IUserFormLogin>().ToList()
                     join user in DataFacade.GetData <IUser>().ToList() on userFormLogin.UserId equals user.Id
                     where userFormLogin.Folder == folderName &&
                     user.Username.ToLowerInvariant().Contains(keyword)
                     orderby user.Username
                     select new UserInfo {
                    User = user, UserFormLogin = userFormLogin
                }).ToList();
            }

            var children = new List <Element>();

            foreach (var userInfo in users)
            {
                string label = userInfo.User.GetLabel();

                var element =
                    new Element(_elementProviderContext.CreateElementHandle(userInfo.User.GetDataEntityToken()))
                {
                    VisualData = new ElementVisualizedData
                    {
                        Label       = label,
                        ToolTip     = label,
                        HasChildren = false,
                        Icon        = !userInfo.UserFormLogin.IsLocked ? UserIcon : LockedUserIcon,
                    }
                };

                // Making "Edit permissions" not show up on user elements - it's confusing :)
                element.ElementExternalActionAdding = ElementExternalActionAddingExtensions.Remove(element.ElementExternalActionAdding, ElementExternalActionAdding.AllowManageUserPermissions);

                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.UserElementProvider.EditUserWorkflow"), new PermissionType[] { PermissionType.Administrate })))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = StringResourceSystemFacade.GetString("Composite.Management", "UserElementProvider.EditUserLabel"),
                        ToolTip        = StringResourceSystemFacade.GetString("Composite.Management", "UserElementProvider.EditUserToolTip"),
                        Icon           = UserElementProvider.EditUserIcon,
                        Disabled       = false,
                        ActionLocation = new ActionLocation
                        {
                            ActionType  = ActionType.Edit,
                            IsInFolder  = false,
                            IsInToolbar = true,
                            ActionGroup = PrimaryActionGroup
                        }
                    }
                });

                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.UserElementProvider.DeleteUserWorkflow"), new PermissionType[] { PermissionType.Administrate })))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = StringResourceSystemFacade.GetString("Composite.Management", "UserElementProvider.DeleteUserLabel"),
                        ToolTip        = StringResourceSystemFacade.GetString("Composite.Management", "UserElementProvider.DeleteUserToolTip"),
                        Icon           = UserElementProvider.DeleteUserIcon,
                        Disabled       = false,
                        ActionLocation = new ActionLocation
                        {
                            ActionType  = ActionType.Delete,
                            IsInFolder  = false,
                            IsInToolbar = true,
                            ActionGroup = PrimaryActionGroup
                        }
                    }
                });

                children.Add(element);
            }

            return(children);
        }
        private IEnumerable <Element> GetGroupChildrenElements(SearchToken seachToken)
        {
            IEnumerable <string> groups;

            if (!seachToken.IsValidKeyword())
            {
                groups =
                    (from user in DataFacade.GetData <IUserFormLogin>()
                     orderby user.Folder
                     select user.Folder).Distinct().ToList();
            }
            else
            {
                string keyword = seachToken.Keyword.ToLowerInvariant();

                groups =
                    (from userFormLogin in DataFacade.GetData <IUserFormLogin>().ToList()
                     join user in DataFacade.GetData <IUser>().ToList() on userFormLogin.UserId equals user.Id
                     where user.Username.ToLowerInvariant().Contains(keyword)
                     orderby userFormLogin.Folder
                     select userFormLogin.Folder).Distinct().ToList();
            }

            var children = new List <Element>();

            foreach (string group in groups)
            {
                var element = new Element(_elementProviderContext.CreateElementHandle(new UserElementProviderGroupEntityToken(group)))
                {
                    VisualData = new ElementVisualizedData
                    {
                        Label       = group,
                        ToolTip     = group,
                        HasChildren = true,
                        Icon        = UserElementProvider.GroupClosedIcon,
                        OpenedIcon  = UserElementProvider.GroupOpenIcon
                    }
                };

                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.UserElementProvider.AddNewUserWorkflow"), AddNewUserPermissionTypes)))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = StringResourceSystemFacade.GetString("Composite.Management", "UserElementProvider.AddUserLabel"),
                        ToolTip        = StringResourceSystemFacade.GetString("Composite.Management", "UserElementProvider.AddUserToolTip"),
                        Icon           = UserElementProvider.AddUserIcon,
                        Disabled       = false,
                        ActionLocation = new ActionLocation
                        {
                            ActionType  = ActionType.Add,
                            IsInFolder  = false,
                            IsInToolbar = true,
                            ActionGroup = PrimaryActionGroup
                        }
                    }
                });

                children.Add(element);
            }

            return(children);
        }
        private IEnumerable <Element> GetAvailablePackageGroupFolderChildren(string groupName, SearchToken seachToken)
        {
            IEnumerable <PackageDescription> packageDescriptions =
                (from description in PackageSystemServices.GetFilteredAllAvailablePackages()
                 where description.GroupName == groupName
                 orderby description.Name
                 select description);

            foreach (PackageDescription packageDescription in packageDescriptions)
            {
                ResourceHandle packageIcon = (packageDescription.PriceAmmount > 0 || packageDescription.AvailableInSubscriptions.Any(f => f.Purchasable)
                    ? AvailableCommercialPackageItemIcon : AvailablePackageItemIcon);

                Element element = new Element(_context.CreateElementHandle(new PackageElementProviderAvailablePackagesItemEntityToken(
                                                                               packageDescription.Id.ToString(),
                                                                               packageDescription.GroupName)));
                element.VisualData = new ElementVisualizedData
                {
                    Label       = packageDescription.Name,
                    ToolTip     = packageDescription.Name,
                    HasChildren = false,
                    Icon        = packageIcon,
                };

                if (!string.IsNullOrEmpty(packageDescription.ConsoleBrowserUrl))
                {
                    element.PropertyBag.Add("BrowserUrl", packageDescription.ConsoleBrowserUrl);
                    element.PropertyBag.Add("BrowserToolingOn", "false");
                }

                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.PackageElementProvider.ViewAvailablePackageInfoWorkflowWorkflow"), ActionPermissions)))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "ViewAvailableInformationLabel"),
                        ToolTip        = StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "ViewAvailableInformationToolTip"),
                        Icon           = ViewInstalledInformationIcon,
                        Disabled       = false,
                        ActionLocation = new ActionLocation
                        {
                            ActionType  = ActionType.Edit,
                            IsInFolder  = false,
                            IsInToolbar = true,
                            ActionGroup = PrimaryActionGroup
                        }
                    }
                });

                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.PackageElementProvider.InstallRemotePackageWorkflow"), ActionPermissions)))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "InstallLabel"),
                        ToolTip        = StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "InstallToolTip"),
                        Icon           = InstallIcon,
                        Disabled       = false,
                        ActionLocation = new ActionLocation
                        {
                            ActionType  = ActionType.Add,
                            IsInFolder  = false,
                            IsInToolbar = true,
                            ActionGroup = PrimaryActionGroup
                        }
                    }
                });

                yield return(element);
            }
        }
        private static void AddBuildinActions(string providerName, string manageUserPermissionsOnBranchLabel, string manageUserPermissionsItemLabel, string manageUserPermissionsToolTip, string relationshipGraphLabel, string relationshipGraphToolTip, string relationshipOrientedGraphLabel, string relationshipOrientedGraphToolTip, string showElementInformationLabel, string showElementInformationToolTip, Element element)
        {
            if ((element.ElementExternalActionAdding & ElementExternalActionAdding.AllowGlobal) == ElementExternalActionAdding.AllowGlobal)
            {
                element.AddAction(new ElementAction(new ActionHandle(new RelationshipGraphActionToken("ShowGraph")))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = relationshipGraphLabel,
                        ToolTip        = relationshipGraphToolTip,
                        Icon           = Composite.Core.ResourceSystem.Icons.CommonElementIcons.Nodes,
                        Disabled       = false,
                        ActionLocation = new ActionLocation
                        {
                            ActionType  = ActionType.DeveloperMode,
                            IsInFolder  = false,
                            IsInToolbar = false,
                            ActionGroup = AppendedActionGroup
                        }
                    }
                });


                element.AddAction(new ElementAction(new ActionHandle(new RelationshipGraphActionToken("ShowOrientedGraph")))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = relationshipOrientedGraphLabel,
                        ToolTip        = relationshipOrientedGraphToolTip,
                        Icon           = Composite.Core.ResourceSystem.Icons.CommonElementIcons.Nodes,
                        Disabled       = false,
                        ActionLocation = new ActionLocation
                        {
                            ActionType  = ActionType.DeveloperMode,
                            IsInFolder  = false,
                            IsInToolbar = false,
                            ActionGroup = AppendedActionGroup
                        }
                    }
                });



                element.AddAction(new ElementAction(new ActionHandle(new ShowElementInformationActionToken()))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = showElementInformationLabel,
                        ToolTip        = showElementInformationToolTip,
                        Icon           = Composite.Core.ResourceSystem.Icons.CommonElementIcons.Search,
                        Disabled       = false,
                        ActionLocation = new ActionLocation
                        {
                            ActionType  = ActionType.DeveloperMode,
                            IsInFolder  = false,
                            IsInToolbar = false,
                            ActionGroup = AppendedActionGroup
                        }
                    }
                });



                //element.AddAction(new ElementAction(new ActionHandle(new SearchActionToken(providerName)))
                //{
                //    VisualData = new ActionVisualizedData
                //    {
                //        Label = StringResourceSystemFacade.GetString("Composite.Management", "RelationshipGraphActionExecutor.Search"),
                //        ToolTip = StringResourceSystemFacade.GetString("Composite.Management", "RelationshipGraphActionExecutor.SearchToolTip"),
                //        Icon = Composite.Core.ResourceSystem.Icons.CommonCommandIcons.Search,
                //        Disabled = false,
                //        ActionLocation = new ActionLocation
                //        {
                //            ActionType = ActionType.Other,
                //            IsInFolder = false,
                //            IsInToolbar = false,
                //            ActionGroup = AppendedActionGroup
                //        }
                //    }
                //});

                if (RuntimeInformation.IsDebugBuild)
                {
                }
            }

            if ((element.ElementExternalActionAdding & ElementExternalActionAdding.AllowManageUserPermissions) == ElementExternalActionAdding.AllowManageUserPermissions)
            {
                if (!element.Actions.Any(f => f.ActionHandle.ActionToken is ManageUserPermissionsActionToken)) // Fixing problem with the buggy virtual element provider
                {
                    element.AddAction(new ElementAction(new ActionHandle(new ManageUserPermissionsActionToken()))
                    {
                        VisualData = new ActionVisualizedData
                        {
                            Label          = (element.VisualData.HasChildren ? manageUserPermissionsOnBranchLabel : manageUserPermissionsItemLabel),
                            ToolTip        = manageUserPermissionsToolTip,
                            Icon           = ManageSecurityIcon,
                            Disabled       = false,
                            ActionLocation = new ActionLocation
                            {
                                ActionType  = ActionType.Other,
                                IsInFolder  = false,
                                IsInToolbar = false,
                                ActionGroup = AppendedActionGroup
                            }
                        }
                    });
                }
            }

            if ((element.ElementExternalActionAdding & ElementExternalActionAdding.AllowProcessController) == ElementExternalActionAdding.AllowProcessController)
            {
                if (element.ElementHandle.EntityToken is DataEntityToken)
                {
                    DataEntityToken token = (DataEntityToken)element.ElementHandle.EntityToken;

                    Type elementProviderType;
                    if (ElementProviderRegistry.ElementProviderNames.Contains(providerName))
                    {
                        elementProviderType = ElementProviderRegistry.GetElementProviderType(providerName);
                    }
                    else
                    {
                        elementProviderType = ElementAttachingProviderRegistry.GetElementProviderType(providerName);
                    }


                    List <ElementAction> actions = ProcessControllerFacade.GetActions(token.Data, elementProviderType);
                    foreach (ElementAction action in actions)
                    {
                        element.AddAction(action);
                    }
                }
            }
        }
        public IEnumerable <Element> Provide(ElementProviderContext context, EntityToken token)
        {
            var returnList = new List <Element>();

            var dataSourceToken = (DataSourceEntityToken)token;
            var type            = Type.GetType(dataSourceToken.Type);

            if (type != typeof(StringBasedDataSourceAttribute))
            {
                return(returnList);
            }

            var form = DynamicFormsFacade.GetFormByName(dataSourceToken.FormName);

            if (form == null)
            {
                return(returnList);
            }

            var field = form.Model.Fields.Get(dataSourceToken.FieldName);

            if (field == null)
            {
                return(returnList);
            }

            var dataSource = field.DataSource;

            if (dataSource == null)
            {
                return(returnList);
            }

            foreach (var entry in dataSource)
            {
                var fieldsElementHandle = context.CreateElementHandle(new StringBasedDataSourceEntryEntityToken(form.Name, field.Name, entry.Key));
                var fieldElement        = new Element(fieldsElementHandle)
                {
                    VisualData = new ElementVisualizedData
                    {
                        Label       = entry.Key,
                        ToolTip     = entry.Key,
                        HasChildren = false,
                        Icon        = ResourceHandle.BuildIconFromDefaultProvider("localization-element-closed-root"),
                        OpenedIcon  = ResourceHandle.BuildIconFromDefaultProvider("localization-element-opened-root")
                    }
                };

                var deleteActionToken = new ConfirmWorkflowActionToken("Delete: " + entry.Key, typeof(DeleteStringBasedDataSourceEntryActionToken));
                fieldElement.AddAction(new ElementAction(new ActionHandle(deleteActionToken))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = "Delete",
                        ToolTip        = "Delete",
                        Icon           = ResourceHandle.BuildIconFromDefaultProvider("generated-type-data-delete"),
                        ActionLocation = ActionLocation
                    }
                });

                returnList.Add(fieldElement);
            }

            return(returnList);
        }
Esempio n. 17
0
        private void AddRootActions(Element element)
        {
            // "User" actions
            element.AddAction(new ElementAction(new ActionHandle(
                                                    new WorkflowActionToken(
                                                        WorkflowFacade.GetWorkflowType("Composite.C1Console.Users.Workflows.ChangeOwnForeignLocaleWorkflow"),
                                                        new PermissionType[] { }
                                                        )))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = UserTexts.ChangeForeignLocaleWorkflow_ActionLabel,
                    ToolTip        = UserTexts.ChangeForeignLocaleWorkflow_ActionToolTip,
                    Icon           = VirtualElementProvider.ChangeOwnActiveAndForeignLocaleIcon,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Add,
                        IsInFolder  = false,
                        IsInToolbar = true,
                        ActionGroup = PrimaryActionGroup
                    }
                },
                TagValue = "User"
            });


            element.AddAction(new ElementAction(new ActionHandle(
                                                    new WorkflowActionToken(
                                                        WorkflowFacade.GetWorkflowType("Composite.C1Console.Users.Workflows.ChangeOwnCultureWorkflow"),
                                                        new PermissionType[] { }
                                                        )))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = UserTexts.ChangeOwnCultureWorkflow_ElementActionLabel,
                    ToolTip        = UserTexts.ChangeOwnCultureWorkflow_ElementActionToolTip,
                    Icon           = VirtualElementProvider.ChangeOwnCultureIcon,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Add,
                        IsInFolder  = false,
                        IsInToolbar = true,
                        ActionGroup = PrimaryActionGroup
                    }
                },
                TagValue = "User"
            });


            if (UserValidationFacade.CanSetUserPassword)
            {
                element.AddAction(new ElementAction(new ActionHandle(
                                                        new WorkflowActionToken(
                                                            WorkflowFacade.GetWorkflowType("Composite.C1Console.Users.Workflows.ChangeOwnPasswordWorkflow"),
                                                            new PermissionType[] { }
                                                            )
                {
                    DoIgnoreEntityTokenLocking = true
                }))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = UserTexts.ChangeOwnPasswordWorkflow_ElementActionLabel,
                        ToolTip        = UserTexts.ChangeOwnPasswordWorkflow_ElementActionToolTip,
                        Icon           = VirtualElementProvider.ChangeOwnPasswordIcon,
                        Disabled       = false,
                        ActionLocation = new ActionLocation
                        {
                            ActionType  = ActionType.Add,
                            IsInFolder  = false,
                            IsInToolbar = true,
                            ActionGroup = PrimaryActionGroup
                        }
                    },
                    TagValue = "User"
                });
            }

            // Other actions

            string manageGlobalUserPermissionsLabel = StringResourceSystemFacade.GetString("Composite.Management", "ManageUserPermissions.ManageGlobalUserPermissionsLabel");
            string manageUserPermissionsToolTip     = StringResourceSystemFacade.GetString("Composite.Management", "ManageUserPermissions.ManageUserPermissionsToolTip");

            element.AddAction(new ElementAction(new ActionHandle(new ManageUserPermissionsActionToken()))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = manageGlobalUserPermissionsLabel,
                    ToolTip        = manageUserPermissionsToolTip,
                    Icon           = ManageSecurityIcon,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType   = ActionType.Other,
                        IsInFolder   = false,
                        IsInToolbar  = false,
                        ActionGroup  = PrimaryActionGroup,
                        ActionBundle = StringResourceSystemFacade.GetString("Composite.Management", "VirtualElementProviderElementProvider.RootActions.GlobalSetting")
                    }
                }
            });

            element.AddAction(
                new ElementAction(
                    new ActionHandle(
                        new WorkflowActionToken(
                            WorkflowFacade.GetWorkflowType("Composite.C1Console.Tools.SetTimeZoneWorkflow"))))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Management", "VirtualElementProviderElementProvider.RootActions.SetTimezoneLabel"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Management", "VirtualElementProviderElementProvider.RootActions.SetTimezoneTooltip"),
                    Icon           = VirtualElementProvider.ChangeOwnCultureIcon,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType   = ActionType.Other,
                        IsInFolder   = false,
                        IsInToolbar  = false,
                        ActionGroup  = PrimaryActionGroup,
                        ActionBundle = StringResourceSystemFacade.GetString("Composite.Management", "VirtualElementProviderElementProvider.RootActions.GlobalSetting")
                    }
                }
            });

            element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Tools.SendMessageToConsolesWorkflow"))))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Management", "VirtualElementProviderElementProvider.RootActions.SendMessageLabel"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Management", "VirtualElementProviderElementProvider.RootActions.SendMessageTooltip"),
                    Icon           = VirtualElementProvider.SendMessageIcon,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Other,
                        IsInFolder  = false,
                        IsInToolbar = false,
                        ActionGroup = PrimaryActionGroup
                    }
                }
            });



            element.AddAction(new ElementAction(new ActionHandle(new RestartApplicationActionToken()))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Management", "VirtualElementProviderElementProvider.RootActions.RestartApplicationLabel"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Management", "VirtualElementProviderElementProvider.RootActions.RestartApplicationTooltip"),
                    Icon           = VirtualElementProvider.RestartApplicationIcon,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Other,
                        IsInFolder  = false,
                        IsInToolbar = false,
                        ActionGroup = PrimaryActionGroup
                    }
                }
            });
        }
        public IEnumerable <Element> GetChildren(EntityToken entityToken, SearchToken searchToken)
        {
            var monitoringApi = JobStorage.Current.GetMonitoringApi();
            var connection    = JobStorage.Current.GetConnection();
            var statistics    = monitoringApi.GetStatistics();

            var folderToken = entityToken as FolderEntityToken;

            if (folderToken != null)
            {
                if (folderToken.TaskType == TaskType.Recurring)
                {
                    foreach (var job in connection.GetRecurringJobs())
                    {
                        var recurringTaskElementHandle = _context.CreateElementHandle(new TaskEntityToken(TaskType.Recurring, job.Id));
                        var recurringTaskElement       = new Element(recurringTaskElementHandle)
                        {
                            VisualData = new ElementVisualizedData
                            {
                                Label       = job.Id,
                                ToolTip     = job.Id,
                                HasChildren = false,
                                Icon        = new ResourceHandle("Composite.Icons", "localization-element-closed-root"),
                                OpenedIcon  = new ResourceHandle("Composite.Icons", "localization-element-opened-root")
                            }
                        };

                        var triggerActionToken = new TriggerRecurringTaskActionToken();
                        recurringTaskElement.AddAction(new ElementAction(new ActionHandle(triggerActionToken))
                        {
                            VisualData = new ActionVisualizedData
                            {
                                Label          = "Trigger now",
                                ToolTip        = "Trigger now",
                                Icon           = new ResourceHandle("Composite.Icons", "localization-element-closed-root"),
                                ActionLocation = ActionLocation
                            }
                        });

                        var deleteActionToken = new ConfirmWorkflowActionToken("Are you sure?", typeof(DeleteRecurringTaskActionToken));
                        recurringTaskElement.AddAction(new ElementAction(new ActionHandle(deleteActionToken))
                        {
                            VisualData = new ActionVisualizedData
                            {
                                Label          = "Delete",
                                ToolTip        = "Delete",
                                Icon           = new ResourceHandle("Composite.Icons", "generated-type-data-delete"),
                                ActionLocation = ActionLocation
                            }
                        });

                        yield return(recurringTaskElement);
                    }
                }

                if (folderToken.TaskType == TaskType.Scheduled)
                {
                    foreach (var job in monitoringApi.ScheduledJobs(0, int.MaxValue))
                    {
                        var scheduledTaskElementHandle = _context.CreateElementHandle(new TaskEntityToken(TaskType.Scheduled, job.Key));
                        var scheduledTaskElement       = new Element(scheduledTaskElementHandle)
                        {
                            VisualData = new ElementVisualizedData
                            {
                                Label       = DisplayJob(job.Value.Job),
                                ToolTip     = DisplayJob(job.Value.Job),
                                HasChildren = false,
                                Icon        = new ResourceHandle("Composite.Icons", "localization-element-closed-root"),
                                OpenedIcon  = new ResourceHandle("Composite.Icons", "localization-element-opened-root")
                            }
                        };

                        var requeueActionToken = new RequeueScheduledTaskActionToken();
                        scheduledTaskElement.AddAction(new ElementAction(new ActionHandle(requeueActionToken))
                        {
                            VisualData = new ActionVisualizedData
                            {
                                Label          = "Enqueue now",
                                ToolTip        = "Enqueue now",
                                Icon           = new ResourceHandle("Composite.Icons", "localization-element-closed-root"),
                                ActionLocation = ActionLocation
                            }
                        });

                        var deleteActionToken = new ConfirmWorkflowActionToken("Are you sure?", typeof(DeleteScheduledTaskActionToken));
                        scheduledTaskElement.AddAction(new ElementAction(new ActionHandle(deleteActionToken))
                        {
                            VisualData = new ActionVisualizedData
                            {
                                Label          = "Delete",
                                ToolTip        = "Delete",
                                Icon           = new ResourceHandle("Composite.Icons", "generated-type-data-delete"),
                                ActionLocation = ActionLocation
                            }
                        });

                        yield return(scheduledTaskElement);
                    }
                }
            }

            if (entityToken is ScheduledTasksElementProviderEntityToken)
            {
                var recurringTasksElementHandle = _context.CreateElementHandle(new FolderEntityToken(TaskType.Recurring));
                var recurringTasksElement       = new Element(recurringTasksElementHandle)
                {
                    VisualData = new ElementVisualizedData
                    {
                        Label       = "Recurring tasks",
                        ToolTip     = "Recurring tasks",
                        HasChildren = statistics.Recurring > 0,
                        Icon        = new ResourceHandle("Composite.Icons", "localization-element-closed-root"),
                        OpenedIcon  = new ResourceHandle("Composite.Icons", "localization-element-opened-root")
                    }
                };

                if (statistics.Recurring > 0)
                {
                    recurringTasksElement.VisualData.Label += " (" + statistics.Recurring + ")";
                }

                AddViewAction(TaskType.Recurring, recurringTasksElement);

                yield return(recurringTasksElement);

                var scheduledTasksElementHandle = _context.CreateElementHandle(new FolderEntityToken(TaskType.Scheduled));
                var scheduledTasksElement       = new Element(scheduledTasksElementHandle)
                {
                    VisualData = new ElementVisualizedData
                    {
                        Label       = "Scheduled tasks",
                        ToolTip     = "Scheduled tasks",
                        HasChildren = statistics.Scheduled > 0,
                        Icon        = new ResourceHandle("Composite.Icons", "localization-element-closed-root"),
                        OpenedIcon  = new ResourceHandle("Composite.Icons", "localization-element-opened-root")
                    }
                };

                if (statistics.Scheduled > 0)
                {
                    scheduledTasksElement.VisualData.Label += " (" + statistics.Scheduled + " )";
                }

                AddViewAction(TaskType.Scheduled, scheduledTasksElement);

                yield return(scheduledTasksElement);
            }
        }
Esempio n. 19
0
        public IEnumerable <Element> GetRoots(SearchToken searchToken)
        {
            EntityToken entityToken = new PageElementProviderEntityToken(_context.ProviderName);

            if (UserValidationFacade.IsLoggedIn() &&
                !DataLocalizationFacade.ActiveLocalizationCultures.Contains(UserSettings.ActiveLocaleCultureInfo))
            {
                yield return(new Element(_context.CreateElementHandle(entityToken))
                {
                    VisualData = new ElementVisualizedData
                    {
                        Label = "No website access: Missing permissions to any Data Language",
                        Icon = PageElementProvider.DeactivateLocalization
                    }
                });

                yield break;
            }

            ICollection <Guid> pageIds = PageServices.GetChildrenIDs(Guid.Empty);

            var homePageIdFilter = (searchToken as PageSearchToken)?.HomePageId ?? Guid.Empty;

            if (homePageIdFilter != Guid.Empty)
            {
                pageIds = pageIds.Where(p => p == homePageIdFilter).ToList();
            }

            var dragAndDropInfo = new ElementDragAndDropInfo();

            dragAndDropInfo.AddDropType(typeof(IPage));
            dragAndDropInfo.SupportsIndexedPosition = true;

            var element = new Element(_context.CreateElementHandle(entityToken), dragAndDropInfo)
            {
                VisualData = new ElementVisualizedData
                {
                    Label       = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.RootLabel"),
                    ToolTip     = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.RootLabelToolTip"),
                    HasChildren = pageIds.Count != 0,
                    Icon        = PageElementProvider.RootClosed,
                    OpenedIcon  = PageElementProvider.RootOpen
                }
            };

            var allPageTypes = DataFacade.GetData <IPageType>().AsEnumerable();

            foreach (
                var pageType in
                allPageTypes.Where(f => f.HomepageRelation != nameof(PageTypeHomepageRelation.OnlySubPages))
                .OrderByDescending(f => f.Id))
            {
                element.AddAction(
                    new ElementAction(
                        new ActionHandle(new PageAddActionToken(pageType.Id, ActionIdentifier.Add, AddPermissionTypes)
                {
                    DoIgnoreEntityTokenLocking = true
                }))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label = string.Format(StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider",
                                                                                   "PageElementProvider.AddPageAtRootFormat"), pageType.Name),
                        ToolTip =
                            StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider",
                                                                 "PageElementProvider.AddPageAtRootToolTip"),
                        Icon           = PageElementProvider.AddPage,
                        Disabled       = false,
                        ActionLocation = new ActionLocation
                        {
                            ActionType   = ActionType.Add,
                            IsInFolder   = false,
                            IsInToolbar  = true,
                            ActionGroup  = PrimaryActionGroup,
                            ActionBundle = "AddWebsite"
                        }
                    }
                });
            }


            element.AddAction(new ElementAction(new ActionHandle(new ViewUnpublishedItemsActionToken()))
            {
                VisualData = new ActionVisualizedData
                {
                    //Label = "List unpublished Content",
                    //ToolTip = "Get an overview of pages and page folder data that haven't been published yet.",
                    Label          = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.ViewUnpublishedItems"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.ViewUnpublishedItemsToolTip"),
                    Icon           = PageElementProvider.ListUnpublishedItems,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Other,
                        IsInFolder  = false,
                        IsInToolbar = true,
                        ActionGroup = ViewActionGroup
                    }
                }
            });

            element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.AddMetaDataWorkflow"), AssociatedDataElementProviderHelper <IPage> .AddAssociatedTypePermissionTypes)
            {
                DoIgnoreEntityTokenLocking = true
            }))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.AddMetaDataTypeLabel"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.AddMetaDataTypeToolTip"),
                    Icon           = AddDataAssociationTypeIcon,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Add,
                        IsInFolder  = false,
                        IsInToolbar = false,
                        ActionGroup = MetaDataAppendedActionGroup
                    }
                }
            });

            element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.EditMetaDataWorkflow"), AssociatedDataElementProviderHelper <IPage> .EditAssociatedTypePermissionTypes)))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.EditMetaDataTypeLabel"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.EditMetaDataTypeToolTip"),
                    Icon           = EditDataAssociationTypeIcon,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Edit,
                        IsInFolder  = false,
                        IsInToolbar = false,
                        ActionGroup = MetaDataAppendedActionGroup
                    }
                }
            });

            element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.DeleteMetaDataWorkflow"), AssociatedDataElementProviderHelper <IPage> .RemoveAssociatedTypePermissionTypes)))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.RemoveMetaDataTypeLabel"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.RemoveMetaDataTypeToolTip"),
                    Icon           = RemoveDataAssociationTypeIcon,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Delete,
                        IsInFolder  = false,
                        IsInToolbar = false,
                        ActionGroup = MetaDataAppendedActionGroup
                    }
                }
            });

            // Creates a problem for the front-end "toolbar caching" mechanism - dont re-introduce this right befroe a release
            // Reason: ActionTokin is always unique for a page, making the ActionKey (hash) unique
            //if (RuntimeInformation.IsDebugBuild)
            //{
            //    element.AddAction(new ElementAction(new ActionHandle(new DisplayLocalOrderingActionToken(Guid.Empty)))
            //    {
            //        VisualData = new ActionVisualizedData
            //        {
            //            Label = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.DisplayLocalOrderingLabel"),
            //            ToolTip = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.DisplayLocalOrderingToolTip"),
            //            Icon = CommonElementIcons.Nodes,
            //            Disabled = false,
            //            ActionLocation = new ActionLocation
            //            {
            //                ActionType = ActionType.DeveloperMode,
            //                IsInFolder = false,
            //                IsInToolbar = false,
            //                ActionGroup = AppendedActionGroup
            //            }
            //        }
            //    });
            //}

            yield return(element);
        }
Esempio n. 20
0
        private IEnumerable <Element> GetRootChildren(SearchToken seachToken)
        {
            Element availablePackagesElement = new Element(_context.CreateElementHandle(new PackageElementProviderAvailablePackagesFolderEntityToken()));

            availablePackagesElement.VisualData = new ElementVisualizedData
            {
                Label       = StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "AvailablePackagesFolderLabel"),
                ToolTip     = StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "AvailablePackagesFolderToolTip"),
                HasChildren = true,
                Icon        = AvailablePackagesClosedIcon,
                OpenedIcon  = AvailablePackagesOpenedIcon
            };
            availablePackagesElement.AddAction(new ElementAction(new ActionHandle(new ClearServerCacheActionToken()))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "ClearServerCacheLabel"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "ClearServerCacheToolTip"),
                    Disabled       = false,
                    Icon           = ClearServerCacheIcon,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Other,
                        IsInFolder  = false,
                        IsInToolbar = false,
                        ActionGroup = PrimaryActionGroup
                    }
                }
            });
            yield return(availablePackagesElement);



            Element installedPackagesElement = new Element(_context.CreateElementHandle(new PackageElementProviderInstalledPackageFolderEntityToken()));

            installedPackagesElement.VisualData = new ElementVisualizedData
            {
                Label       = StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "InstalledPackageFolderLabel"),
                ToolTip     = StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "InstalledPackageFolderToolTip"),
                HasChildren = true,
                Icon        = InstalledPackagesClosedIcon,
                OpenedIcon  = InstalledPackagesOpenedIcon
            };
            yield return(installedPackagesElement);



            Element packageSourcesElement = new Element(_context.CreateElementHandle(new PackageElementProviderPackageSourcesFolderEntityToken()));

            packageSourcesElement.VisualData = new ElementVisualizedData
            {
                Label       = StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "PackageSourcesFolderLabel"),
                ToolTip     = StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "PackageSourcesFolderToolTip"),
                HasChildren = DataFacade.GetData <IPackageServerSource>().Count() > 0,
                Icon        = PackageSourcesClosedIcon,
                OpenedIcon  = PackageSourcesOpenedIcon
            };
            packageSourcesElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.PackageElementProvider.AddPackageSourceWorkflow"), new PermissionType[] { PermissionType.Administrate })))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "AddPackageSourceLabel"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "AddPackageSourceToolTip"),
                    Disabled       = false,
                    Icon           = AddPackageSourceIcon,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Add,
                        IsInFolder  = false,
                        IsInToolbar = true,
                        ActionGroup = PrimaryActionGroup
                    }
                }
            });
            yield return(packageSourcesElement);
        }
        private static void AddBuildinActions(string providerName, string manageUserPermissionsOnBranchLabel, string manageUserPermissionsItemLabel, string manageUserPermissionsToolTip, string relationshipGraphLabel, string relationshipGraphToolTip, string relationshipOrientedGraphLabel, string relationshipOrientedGraphToolTip, string showElementInformationLabel, string showElementInformationToolTip, Element element)
        {
            if ((element.ElementExternalActionAdding & ElementExternalActionAdding.AllowGlobal) == ElementExternalActionAdding.AllowGlobal)
            {
                element.AddAction(new ElementAction(new ActionHandle(new RelationshipGraphActionToken("ShowGraph")))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label = relationshipGraphLabel,
                        ToolTip = relationshipGraphToolTip,
                        Icon = Composite.Core.ResourceSystem.Icons.CommonElementIcons.Nodes,
                        Disabled = false,
                        ActionLocation = new ActionLocation
                        {
                            ActionType = ActionType.DeveloperMode,
                            IsInFolder = false,
                            IsInToolbar = false,
                            ActionGroup = AppendedActionGroup
                        }
                    }
                });


                element.AddAction(new ElementAction(new ActionHandle(new RelationshipGraphActionToken("ShowOrientedGraph")))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label = relationshipOrientedGraphLabel,
                        ToolTip = relationshipOrientedGraphToolTip,
                        Icon = Composite.Core.ResourceSystem.Icons.CommonElementIcons.Nodes,
                        Disabled = false,
                        ActionLocation = new ActionLocation
                        {
                            ActionType = ActionType.DeveloperMode,
                            IsInFolder = false,
                            IsInToolbar = false,
                            ActionGroup = AppendedActionGroup
                        }
                    }
                });



                element.AddAction(new ElementAction(new ActionHandle(new ShowElementInformationActionToken()))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label = showElementInformationLabel,
                        ToolTip = showElementInformationToolTip,
                        Icon = Composite.Core.ResourceSystem.Icons.CommonElementIcons.Search,
                        Disabled = false,
                        ActionLocation = new ActionLocation
                        {
                            ActionType = ActionType.DeveloperMode,
                            IsInFolder = false,
                            IsInToolbar = false,
                            ActionGroup = AppendedActionGroup
                        }
                    }
                });





                //element.AddAction(new ElementAction(new ActionHandle(new SearchActionToken(providerName)))
                //{
                //    VisualData = new ActionVisualizedData
                //    {
                //        Label = StringResourceSystemFacade.GetString("Composite.Management", "RelationshipGraphActionExecutor.Search"),
                //        ToolTip = StringResourceSystemFacade.GetString("Composite.Management", "RelationshipGraphActionExecutor.SearchToolTip"),
                //        Icon = Composite.Core.ResourceSystem.Icons.CommonCommandIcons.Search,
                //        Disabled = false,
                //        ActionLocation = new ActionLocation
                //        {
                //            ActionType = ActionType.Other,
                //            IsInFolder = false,
                //            IsInToolbar = false,
                //            ActionGroup = AppendedActionGroup
                //        }
                //    }
                //});

                if (RuntimeInformation.IsDebugBuild)
                {
                }
            }

            if ((element.ElementExternalActionAdding & ElementExternalActionAdding.AllowManageUserPermissions) == ElementExternalActionAdding.AllowManageUserPermissions)
            {
                if (!element.Actions.Any(f => f.ActionHandle.ActionToken is ManageUserPermissionsActionToken)) // Fixing problem with the buggy virtual element provider
                {
                    element.AddAction(new ElementAction(new ActionHandle(new ManageUserPermissionsActionToken()))
                    {
                        VisualData = new ActionVisualizedData
                        {
                            Label = (element.VisualData.HasChildren ? manageUserPermissionsOnBranchLabel : manageUserPermissionsItemLabel),
                            ToolTip = manageUserPermissionsToolTip,
                            Icon = ManageSecurityIcon,
                            Disabled = false,
                            ActionLocation = new ActionLocation
                            {
                                ActionType = ActionType.Other,
                                IsInFolder = false,
                                IsInToolbar = false,
                                ActionGroup = AppendedActionGroup
                            }
                        }
                    });
                }
            }

            if ((element.ElementExternalActionAdding & ElementExternalActionAdding.AllowProcessController) == ElementExternalActionAdding.AllowProcessController)
            {
                if (element.ElementHandle.EntityToken is DataEntityToken)
                {
                    DataEntityToken token = (DataEntityToken)element.ElementHandle.EntityToken;

                    Type elementProviderType;
                    if (ElementProviderRegistry.ElementProviderNames.Contains(providerName))
                    {
                        elementProviderType = ElementProviderRegistry.GetElementProviderType(providerName);
                    }
                    else
                    {
                        elementProviderType = ElementAttachingProviderRegistry.GetElementProviderType(providerName);
                    }


                    List<ElementAction> actions = ProcessControllerFacade.GetActions(token.Data, elementProviderType);
                    foreach (ElementAction action in actions)
                    {
                        element.AddAction(action);
                    }
                }
            }
        }
Esempio n. 22
0
        public IEnumerable <Element> GetChildren(EntityToken entityToken, SearchToken seachToken)
        {
            if (entityToken.Id == PageTemplateFeatureEntityToken.RootFolderId)
            {
                foreach (string pageTemplateFeratureFilename in this.PageTemplateFeatureFilenames)
                {
                    string filename    = Path.GetFileName(pageTemplateFeratureFilename);
                    string featureName = Path.GetFileNameWithoutExtension(filename);

                    bool isHtml = Path.GetExtension(filename) == ".html";

                    Element featureElement = new Element(_context.CreateElementHandle(
                                                             PageTemplateFeatureEntityToken.BuildFeatureEntityToken(featureName)))
                    {
                        VisualData = new ElementVisualizedData
                        {
                            Label   = featureName,
                            ToolTip = filename,
                            Icon    = PageTemplateFeatureIcon
                        }
                    };

                    featureElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider.EditPageTemplateFeatureWorkflow"), PermissionTypePredefined.Edit)))
                    {
                        VisualData = new ActionVisualizedData
                        {
                            Label          = StringResourceSystemFacade.GetString("Composite.Plugins.PageTemplateFeatureElementProvider", "ElementProvider.EditTemplateFeature"),
                            ToolTip        = StringResourceSystemFacade.GetString("Composite.Plugins.PageTemplateFeatureElementProvider", "ElementProvider.EditTemplateFeatureToolTip"),
                            Icon           = PageTemplateFeatureIconEdit,
                            Disabled       = false,
                            ActionLocation = ActionLocation.EditPrimaryActionLocation
                        }
                    });

                    featureElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider.DeletePageTemplateFeatureWorkflow"), PermissionTypePredefined.Delete)))
                    {
                        VisualData = new ActionVisualizedData
                        {
                            Label          = StringResourceSystemFacade.GetString("Composite.Plugins.PageTemplateFeatureElementProvider", "ElementProvider.DeleteTemplateFeature"),
                            ToolTip        = StringResourceSystemFacade.GetString("Composite.Plugins.PageTemplateFeatureElementProvider", "ElementProvider.DeleteTemplateFeatureToolTip"),
                            Icon           = PageTemplateFeatureIconDelete,
                            Disabled       = false,
                            ActionLocation = ActionLocation.DeletePrimaryActionLocation
                        }
                    });

                    featureElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider.TogglePageTemplateFeatureEditorWorkflow"), PermissionTypePredefined.Edit)))
                    {
                        VisualData = new ActionVisualizedData
                        {
                            Label               = StringResourceSystemFacade.GetString("Composite.Plugins.PageTemplateFeatureElementProvider", "ElementProvider.EditVisually"),
                            ToolTip             = StringResourceSystemFacade.GetString("Composite.Plugins.PageTemplateFeatureElementProvider", "ElementProvider.EditVisuallyToolTip"),
                            Icon                = PageTemplateFeatureIconEdit,
                            Disabled            = false,
                            ActionCheckedStatus = isHtml ? ActionCheckedStatus.Checked : ActionCheckedStatus.Unchecked,
                            ActionLocation      = new ActionLocation
                            {
                                ActionType  = ActionType.Other,
                                IsInFolder  = false,
                                IsInToolbar = false,
                                ActionGroup = PrimaryFolderToolsActionGroup
                            },
                        }
                    });

                    yield return(featureElement);
                }

                yield break;
            }

            yield break;
        }