public override IEnumerable <XElement> Install() { // Sitemap Perspective IUserGroupActivePerspective sitemapPerspective = DataFacade.BuildNew <IUserGroupActivePerspective>(); var userGroup = DataFacade.GetData <IUserGroup>().FirstOrDefault(u => u.Name == "Administrator"); if (userGroup != null) { sitemapPerspective.UserGroupId = userGroup.Id; EntityToken entityToken = new TreePerspectiveEntityToken("SitemapElement"); sitemapPerspective.SerializedEntityToken = EntityTokenSerializer.Serialize(entityToken); sitemapPerspective.Id = Guid.NewGuid(); DataFacade.AddNew(sitemapPerspective); LoggingService.LogInformation("ComposerExperience", string.Format("Access to the Sitemap Perspective granted for group {0}.", userGroup.Name)); } FixDefaultLanguageUrlMapping(); yield break; }
private static void DoInitialize(string elementAttachingProviderName) { var sharedRootFolders = new Dictionary <string, CustomTreePerspectiveInfo>(); var treeNodeDynamicContext = new TreeNodeDynamicContext(TreeNodeDynamicContextDirection.Down); treeNodeDynamicContext.Piggybag = new Dictionary <string, string>(); foreach (var tree in TreeFacade.AllTrees) { if (!tree.ShareRootElementById) { continue; } IEnumerable <NamedAttachmentPoint> namedAttachmentPoints = tree.AttachmentPoints. OfType <NamedAttachmentPoint>(); if (namedAttachmentPoints.Count() != 1) { continue; } if (tree.RootTreeNode.ChildNodes.Count() != 1) { continue; } SimpleElementTreeNode childTreeNode = tree.RootTreeNode.ChildNodes.Single() as SimpleElementTreeNode; if (childTreeNode == null) { continue; } NamedAttachmentPoint namedAttachmentPoint = namedAttachmentPoints.Single(); EntityToken perspectiveEntityToken; if (!sharedRootFolders.ContainsKey(childTreeNode.Id)) { perspectiveEntityToken = new TreePerspectiveEntityToken(childTreeNode.Id); var dynamicValuesHelperReplaceContext = new DynamicValuesHelperReplaceContext( namedAttachmentPoint.AttachingPoint.EntityToken, null); // MRJ: Collection actions Element element = new Element(new ElementHandle(elementAttachingProviderName, perspectiveEntityToken)) { VisualData = new ElementVisualizedData { Label = childTreeNode.LabelDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext), ToolTip = childTreeNode.ToolTipDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext), HasChildren = true, Icon = childTreeNode.Icon, OpenedIcon = childTreeNode.OpenIcon } }; sharedRootFolders.Add(childTreeNode.Id, new CustomTreePerspectiveInfo { AttachmentPoint = new NamedAttachmentPoint { AttachingPoint = new AttachingPoint(namedAttachmentPoint.AttachingPoint), Position = namedAttachmentPoint.Position }, Element = element, Trees = new List <Tree> { tree } }); } else { perspectiveEntityToken = sharedRootFolders[childTreeNode.Id].Element.ElementHandle.EntityToken; sharedRootFolders[childTreeNode.Id].Trees.Add(tree); } namedAttachmentPoint.AttachingPoint = new AttachingPoint(perspectiveEntityToken); tree.RootTreeNode = childTreeNode; } _sharedRootFolders = sharedRootFolders; }