Exemple #1
0
        /// <exclude />
        public IEnumerable <Element> GetRoots(SearchToken searchToken)
        {
            NamespaceTreeBuilder builder = new NamespaceTreeBuilder(OnGetFunctionInfos(searchToken).Cast <INamespaceTreeBuilderLeafInfo>());

            bool hasChildren = (builder.RootFolder.SubFolders.Count != 0) || (builder.RootFolder.Leafs.Count != 0);

            Element element = new Element(_context.CreateElementHandle(new BaseFunctionFolderElementEntityToken(CreateId("", _context.ProviderName))))
            {
                VisualData = new ElementVisualizedData()
                {
                    Label       = RootFolderLabel,
                    ToolTip     = RootFolderToolTip,
                    HasChildren = hasChildren,
                    Icon        = hasChildren ? this.FolderIcon : this.EmptyFolderIcon,
                    OpenedIcon  = OpenFolderIcon
                }
            };

            element.TreeLockBehavior = OnGetTreeLockBehavior();

            IEnumerable <ElementAction> actions = OnGetFolderActions();

            if (actions != null)
            {
                foreach (ElementAction action in actions)
                {
                    element.AddAction(action);
                }
            }

            return(new List <Element> {
                element
            });
        }
        public IEnumerable <Element> GetChildren(EntityToken entityToken, SearchToken searchToken)
        {
            if (entityToken is SharedCodeFolderEntityToken)
            {
                return(GetSharedCodeElements(searchToken));
            }

            if ((entityToken is PageTemplateRootEntityToken) == false)
            {
                return new Element[] { }
            }
            ;

            bool sharedFilesExist = PageTemplateFacade.GetSharedFiles().Any();

            IEnumerable <Element> result = sharedFilesExist
                ? new [] { GetSharedCodeElement() }
                : new Element[0];

            var pageTemplates = PageTemplateFacade.GetPageTemplates();

            if (searchToken.IsValidKeyword())
            {
                string keyword = searchToken.Keyword.ToLowerInvariant();

                pageTemplates = pageTemplates
                                .Where(t => t.Title.IndexOf(keyword, StringComparison.InvariantCultureIgnoreCase) > 0);
            }

            pageTemplates = pageTemplates.OrderBy(template => template.Title).ToList();

            return(result.Concat(GetElements(pageTemplates)));
        }
Exemple #3
0
        public IEnumerable <Element> GetChildren(EntityToken entityToken, SearchToken searchToken)
        {
            if (UserValidationFacade.IsLoggedIn() &&
                !DataLocalizationFacade.ActiveLocalizationCultures.Contains(UserSettings.ActiveLocaleCultureInfo))
            {
                return(Enumerable.Empty <Element>());
            }

            if (entityToken is AssociatedDataElementProviderHelperEntityToken associatedData)
            {
                return(_pageAssociatedHelper.GetChildren(associatedData, false));
            }

            if (entityToken is DataGroupingProviderHelperEntityToken dataGrouping)
            {
                return(_pageAssociatedHelper.GetChildren(dataGrouping, false));
            }

            using (new DataScope(DataScopeIdentifier.Administrated))
            {
                var allChildPages = GetChildrenPages(entityToken, searchToken);
                List <KeyValuePair <PageLocaleState, IPage> > childPages = IEnumerableExtensionMethods.ToList(allChildPages, f => new KeyValuePair <PageLocaleState, IPage>(PageLocaleState.Own, f));

                List <Element> childPageElements = GetElements(childPages, entityToken is PageElementProviderEntityToken);

                return(GetChildElements(entityToken, childPageElements));
            }
        }
Exemple #4
0
        private IEnumerable <IPage> GetChildrenPages(EntityToken entityToken, SearchToken searchToken)
        {
            var itemId = GetParentPageId(entityToken);

            if (!itemId.HasValue)
            {
                return(Enumerable.Empty <IPage>());
            }

            var parentPageId = itemId.Value;

            ICollection <IPage> pages;

            if (searchToken.IsValidKeyword())
            {
                var keyword = searchToken.Keyword.ToLowerInvariant();
                pages = GetPagesByKeyword(keyword, parentPageId);
            }
            else
            {
                pages = PageServices.GetChildren(parentPageId).Evaluate();
            }

            if (parentPageId == Guid.Empty)
            {
                var homePageIdFilter = (searchToken as PageSearchToken)?.HomePageId ?? Guid.Empty;
                if (homePageIdFilter != Guid.Empty)
                {
                    pages = pages.Where(p => p.Id == homePageIdFilter).ToList();
                }
            }

            return(OrderByVersions(pages));
        }
        public IEnumerable <Element> GetChildren(EntityToken entityToken, SearchToken seachToken)
        {
            if (entityToken.Id == DeveloperApplicationProviderEntityToken.TreeRootFolderId)
            {
                foreach (string treeDefinitionFilename in this.TreeDefinitionFilenames)
                {
                    string filename = Path.GetFileName(treeDefinitionFilename);

                    Element treeDefintionElement = new Element(_context.CreateElementHandle(
                                                                   new DeveloperApplicationProviderEntityToken(DeveloperApplicationProviderEntityToken.TreeDefinitionId, filename)))
                    {
                        VisualData = new ElementVisualizedData
                        {
                            Label   = filename,
                            ToolTip = filename,
                            Icon    = TreeDefinitionIcon
                        }
                    };

                    treeDefintionElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Trees.Workflows.DeleteTreeDefinitionWorkflow"), PermissionTypePredefined.Delete)))
                    {
                        VisualData = new ActionVisualizedData
                        {
                            Label          = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeDeleteTreeDefinitionWorkflow.Delete.Label"),
                            ToolTip        = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeDeleteTreeDefinitionWorkflow.Delete.ToolTip"),
                            Icon           = TreeDefinitionIconDelete,
                            Disabled       = false,
                            ActionLocation = ActionLocation.DeletePrimaryActionLocation
                        }
                    });

                    treeDefintionElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Trees.Workflows.EditTreeDefinitionWorkflow"), PermissionTypePredefined.Edit)))
                    {
                        VisualData = new ActionVisualizedData
                        {
                            Label          = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeDeleteTreeDefinitionWorkflow.Edit.Label"),
                            ToolTip        = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeDeleteTreeDefinitionWorkflow.Edit.ToolTip"),
                            Icon           = TreeDefinitionIconEdit,
                            Disabled       = false,
                            ActionLocation = ActionLocation.EditPrimaryActionLocation
                        }
                    });

                    yield return(treeDefintionElement);
                }

                yield break;
            }
            else if (entityToken.Id == DeveloperApplicationProviderEntityToken.TreeDefinitionId)
            {
                //DeveloperApplicationProviderEntityToken castedEntityToken = (DeveloperApplicationProviderEntityToken)entityToken;

                //foreach (Element element in TreeFacade.GetElementsByTreeId(castedEntityToken.Filename, entityToken, new Dictionary<string, string>()))
                //{
                //    yield return element;
                //}
            }

            yield break;
        }
        public IEnumerable <Element> GetRoots(SearchToken seachToken)
        {
            Element treeRootFolderElement = new Element(_context.CreateElementHandle(new DeveloperApplicationProviderEntityToken(DeveloperApplicationProviderEntityToken.TreeRootFolderId)))
            {
                VisualData = new ElementVisualizedData
                {
                    Label       = "Tree Definitions",
                    ToolTip     = "Tree Definitions",
                    HasChildren = this.TreeDefinitionFilenames.Count() > 0,
                    Icon        = TreeDefinitionsRootIcon
                }
            };

            treeRootFolderElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Trees.Workflows.AddTreeDefinitionWorkflow"), PermissionTypePredefined.Add)))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeAddTreeDefinitionWorkflow.AddNew.Label"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeAddTreeDefinitionWorkflow.AddNew.ToolTip"),
                    Icon           = TreeDefinitionIconAdd,
                    Disabled       = false,
                    ActionLocation = ActionLocation.AddPrimaryActionLocation
                }
            });



            yield return(treeRootFolderElement);
        }
Exemple #7
0
        public IEnumerable <Element> GetRoots(SearchToken seachToken)
        {
            Element rootFolderElement = new Element(_context.CreateElementHandle(new PageTemplateFeatureEntityToken(PageTemplateFeatureEntityToken.RootFolderId)))
            {
                VisualData = new ElementVisualizedData
                {
                    Label       = StringResourceSystemFacade.GetString("Composite.Plugins.PageTemplateFeatureElementProvider", "ElementProvider.RootLabel"),
                    ToolTip     = StringResourceSystemFacade.GetString("Composite.Plugins.PageTemplateFeatureElementProvider", "ElementProvider.RootToolTip"),
                    HasChildren = this.PageTemplateFeatureFilenames.Any(),
                    Icon        = PageTemplateFeatureRootIcon,
                    OpenedIcon  = PageTemplateFeatureRootIconOpen
                }
            };

            rootFolderElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider.AddPageTemplateFeatureWorkflow"), PermissionTypePredefined.Add)))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Plugins.PageTemplateFeatureElementProvider", "ElementProvider.AddTemplateFeature"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Plugins.PageTemplateFeatureElementProvider", "ElementProvider.AddTemplateFeatureToolTip"),
                    Icon           = PageTemplateFeatureIconAdd,
                    Disabled       = false,
                    ActionLocation = ActionLocation.AddPrimaryActionLocation
                }
            });

            yield return(rootFolderElement);
        }
        public IEnumerable <Element> GetChildren(EntityToken entityToken, SearchToken seachToken)
        {
            if (entityToken is PackageElementProviderRootEntityToken)
            {
                return(GetRootChildren(seachToken));
            }
            if (entityToken is PackageElementProviderAvailablePackagesFolderEntityToken)
            {
                return(GetAvailablePackagesFolderChildren(seachToken));
            }
            if (entityToken is PackageElementProviderAvailablePackagesGroupFolderEntityToken availableGroupEntityToken)
            {
                return(GetAvailablePackageGroupFolderChildren(availableGroupEntityToken.GroupName, seachToken));
            }
            if (entityToken is PackageElementProviderInstalledPackageFolderEntityToken)
            {
                return(GetInstalledPackageFolderChildren(seachToken));
            }
            if (entityToken is PackageElementProviderPackageSourcesFolderEntityToken)
            {
                return(GetPackageSourcesFolderChildren(seachToken));
            }
            if (entityToken is PackageElementProviderInstalledPackageLocalPackagesFolderEntityToken)
            {
                return(GetInstalledLocalPackagesFolderChildren(seachToken));
            }
            if (entityToken is PackageElementProviderInstalledPackageGroupFolderEntityToken installedGroupEntityToken)
            {
                return(GetInstalledPackageGroupFolderChildren(installedGroupEntityToken.GroupName, seachToken));
            }

            throw new InvalidOperationException("Unexpected entity token type: " + entityToken.GetType());
        }
Exemple #9
0
        private IEnumerable <WebsiteFolder> GetFoldersOnPath(string parentPath, SearchToken searchToken)
        {
            IEnumerable <WebsiteFolder> folders =
                from folderPath in C1Directory.GetDirectories(parentPath)
                orderby folderPath
                select new WebsiteFolder(folderPath);

            if (searchToken.IsValidKeyword())
            {
                folders =
                    from folder in folders
                    where folder.FolderName.ToLowerInvariant().Contains(searchToken.Keyword.ToLowerInvariant())
                    select folder;
            }

            if (string.IsNullOrEmpty(_folderWhiteListKeyName) == false)
            {
                List <IFolderWhiteList> whiteList = DataFacade.GetData <IFolderWhiteList>().Where(f => f.KeyName == _folderWhiteListKeyName).ToList();

                folders =
                    from folder in folders.ToList()
                    where whiteList.Any(f => folder.FullPath.StartsWith(f.GetFullPath()) || f.GetFullPath().StartsWith(folder.FullPath))
                    select folder;
            }

            return(folders);
        }
Exemple #10
0
        public void SearchToken()
        {
            var token = new SearchToken(_wildcardMatchMock.Object, "test");

            Assert.That(token.Filter, Is.EqualTo("test"));
            Assert.That(token.Wildcard, Is.EqualTo(_wildcardMatchMock.Object));
        }
Exemple #11
0
        private bool SubTreeContainsToken(NamespaceTreeBuilderFolder folder, SearchToken searchToken)
        {
            if (string.IsNullOrEmpty(searchToken.Keyword))
            {
                return(true);
            }

            if (folder.Name.Contains(searchToken.Keyword))
            {
                return(true);
            }

            foreach (INamespaceTreeBuilderLeafInfo leaf in folder.Leafs)
            {
                if (leaf.Name.Contains(searchToken.Keyword))
                {
                    return(true);
                }
            }
            foreach (NamespaceTreeBuilderFolder subFolder in folder.SubFolders)
            {
                if (SubTreeContainsToken(subFolder, searchToken))
                {
                    return(true);
                }
            }

            return(false);
        }
        private IEnumerable <Element> GetSharedCodeElements(SearchToken searchToken)
        {
            var result = new List <Element>();

            foreach (SharedFile sharedFile in PageTemplateFacade.GetSharedFiles())
            {
                string relativeFilePath = sharedFile.RelativeFilePath;

                string fullPath    = relativeFilePath.StartsWith("~") ? PathUtil.Resolve(relativeFilePath) : relativeFilePath;
                var    websiteFile = new WebsiteFile(fullPath);

                Element element = new Element(_context.CreateElementHandle(new SharedCodeFileEntityToken(relativeFilePath)))
                {
                    VisualData = new ElementVisualizedData()
                    {
                        Label       = websiteFile.FileName,
                        ToolTip     = websiteFile.FileName,
                        HasChildren = false,
                        Icon        = FileElementProvider.WebsiteFileIcon(websiteFile.MimeType),
                        OpenedIcon  = FileElementProvider.WebsiteFileIcon(websiteFile.MimeType)
                    }
                };

                element.PropertyBag.Add("Uri", PathUtil.GetWebsitePath(websiteFile.FullPath));
                element.PropertyBag.Add("ElementType", websiteFile.MimeType);

                // Adding "Edit" action for text-editable files
                if (sharedFile.DefaultEditAction && MimeTypeInfo.IsTextFile(websiteFile.MimeType))
                {
                    element.AddWorkflowAction(
                        "Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider.EditSharedCodeFileWorkflow",
                        new[] { PermissionType.Edit },
                        new ActionVisualizedData
                    {
                        Label          = GetResourceString("EditSharedCodeFile.Label"),
                        ToolTip        = GetResourceString("EditSharedCodeFile.ToolTip"),
                        Icon           = CommonCommandIcons.Edit,
                        Disabled       = websiteFile.IsReadOnly,
                        ActionLocation = new ActionLocation
                        {
                            ActionType  = ActionType.Edit,
                            IsInFolder  = false,
                            IsInToolbar = true,
                            ActionGroup = EditCodeFileActionGroup
                        }
                    });
                }

                var customActions = sharedFile.GetActions();
                foreach (var action in customActions)
                {
                    element.AddAction(action);
                }

                result.Add(element);
            }

            return(result);
        }
Exemple #13
0
        public static IEnumerable <Element> GetRoots(string providerName, SearchToken seachToken)
        {
            Verify.ArgumentNotNullOrEmpty(providerName, nameof(providerName));

            IEnumerable <Element> roots = GetElementProvider(providerName).GetRoots(seachToken);

            return(roots ?? Enumerable.Empty <Element>());
        }
Exemple #14
0
        private IEnumerable <Element> GetChildrenOnPath(string parentPath, SearchToken searchToken)
        {
            IEnumerable <WebsiteFolder> websiteFolders = GetFoldersOnPath(parentPath, searchToken);
            IEnumerable <WebsiteFile>   websiteFiles   = GetFilesOnPath(parentPath, searchToken);

            IEnumerable <Element> folders = CreateFolderElements(websiteFolders);
            IEnumerable <Element> files   = CreateFileElements(websiteFiles);

            return(folders.Concat(files).ToList());
        }
        public static IEnumerable<Element> GetRoots(string providerName, SearchToken seachToken)
        {
            if (string.IsNullOrEmpty(providerName)) throw new ArgumentNullException("providerName");

            IEnumerable<Element> roots = GetElementProvider(providerName).GetRoots(seachToken);

            if (roots == null) return new List<Element>();

            return roots;
        }
        private IEnumerable <Element> GetInstalledLocalPackagesFolderChildren(SearchToken seachToken)
        {
            IEnumerable <InstalledPackageInformation> installedPackageInformations =
                from info in PackageManager.GetInstalledPackages()
                where info.IsLocalInstalled
                orderby info.Name
                select info;

            var allServerPackages = PackageSystemServices.GetAllAvailablePackages();

            foreach (InstalledPackageInformation installedPackageInformation in installedPackageInformations)
            {
                Element element = new Element(_context.CreateElementHandle(new PackageElementProviderInstalledPackageItemEntityToken(
                                                                               installedPackageInformation.Id,
                                                                               installedPackageInformation.GroupName,
                                                                               installedPackageInformation.IsLocalInstalled,
                                                                               installedPackageInformation.CanBeUninstalled)));

                PackageDescription serverPackageDescription = allServerPackages.Where(f => f.Id == installedPackageInformation.Id).FirstOrDefault();

                if (serverPackageDescription != null && !string.IsNullOrEmpty(serverPackageDescription.ConsoleBrowserUrl))
                {
                    element.PropertyBag.Add("BrowserUrl", serverPackageDescription.ConsoleBrowserUrl);
                    element.PropertyBag.Add("BrowserToolingOn", "false");
                }

                element.VisualData = new ElementVisualizedData
                {
                    Label       = installedPackageInformation.Name,
                    ToolTip     = installedPackageInformation.Name,
                    HasChildren = false,
                    Icon        = GetIconForPackageItem(installedPackageInformation.Id),
                };

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

                yield return(element);
            }
        }
        public static IToken GetTokenAtPos(List <IToken> tokens, int charIndex)
        {
            var searchToken = new SearchToken(charIndex);
            var index       = tokens.BinarySearch(searchToken, TokenComparer.Default);

            if (index < 0)
            {
                return(null);
            }
            return(tokens[index]);
        }
        public static IEnumerable<Element> GetChildren(string providerName, EntityToken entityToken, SearchToken seachToken)
        {
            if (string.IsNullOrEmpty(providerName)) throw new ArgumentNullException("providerName");
            if (entityToken == null) throw new ArgumentNullException("entityToken");

            IEnumerable<Element> children = GetElementProvider(providerName).GetChildren(entityToken, seachToken);

            if (children == null) return new List<Element>();

            return children;
        }
 public IEnumerable <Element> GetChildren(EntityToken entityToken, SearchToken searchToken)
 {
     if ((entityToken is SqlFunctionProviderRootEntityToken))
     {
         return(GetConnectionElements());
     }
     else
     {
         return(GetFunctionElements(entityToken, searchToken));
     }
 }
 public IEnumerable <Element> GetChildren(EntityToken entityToken, SearchToken seachToken)
 {
     if (entityToken is UserElementProviderEntityToken)
     {
         return(GetGroupChildrenElements(seachToken));
     }
     if (entityToken is UserElementProviderGroupEntityToken)
     {
         return(GetUsersChildrenElements(entityToken.Id, seachToken));
     }
     return(new Element[] { });
 }
Exemple #21
0
        private IEnumerable <IPage> GetChildrenPages(EntityToken entityToken, SearchToken searchToken)
        {
            Guid?itemId = GetParentPageId(entityToken);

            if (!itemId.HasValue)
            {
                return new IPage[] { }
            }
            ;


            if (!searchToken.IsValidKeyword())
            {
                return(PageServices.GetChildren(itemId.Value).Evaluate().AsQueryable());
            }

            string keyword = searchToken.Keyword.ToLowerInvariant();

            var predicateItems =
                from page in DataFacade.GetData <IPage>()
                where (page.Description != null && page.Description.ToLowerInvariant().Contains(keyword)) ||
                (page.Title != null && page.Title.ToLowerInvariant().Contains(keyword))
                select new TreeNode {
                Key = page.Id, ParentKey = page.GetParentId()
            };


            List <TreeNode> keyTree =
                DataFacade.GetData <IPage>().Select(x => new TreeNode {
                Key = x.Id, ParentKey = x.GetParentId()
            }).ToList();

            IEnumerable <TreeNode> nodes = new List <TreeNode>();

            foreach (TreeNode node in predicateItems)
            {
                nodes = nodes.Concat(GetAncestorPath(node, keyTree)).ToList();
            }

            List <Guid> pageIds = nodes.Where(x => x.ParentKey == itemId).Select(x => x.Key).Distinct().ToList();

            var pages = new List <IPage>();

            foreach (var page in DataFacade.GetData <IPage>())
            {
                if (pageIds.Contains(page.Id))
                {
                    pages.Add(page);
                }
            }

            return(pages.AsQueryable());
        }
Exemple #22
0
        public static IEnumerable <Element> GetForeignRoots(string providerName, SearchToken seachToken)
        {
            Verify.ArgumentNotNullOrEmpty(providerName, nameof(providerName));

            ILocaleAwareElementProvider provider = GetElementProvider(providerName) as ILocaleAwareElementProvider;

            if (provider == null)
            {
                throw new ArgumentException($"The Element Provider identified by the specified provider name does not implement {typeof(ILocaleAwareElementProvider)}");
            }

            return(provider.GetForeignRoots(seachToken));
        }
        public static List <Course> search_course(string query)
        {
            List <SearchToken> search_tokens = SearchToken.getTokens(query);

            List <Course> courses = new List <Course>();

            courses.AddRange(search_courses_by_course_tag(search_tokens));
            courses.AddRange(search_courses_by_course_type_tag(search_tokens));
            courses.AddRange(search_courses_by_specialization_tag(search_tokens));


            return(courses);
        }
Exemple #24
0
        /// <exclude />
        public static List <RefreshChildrenInfo> GetMultipleChildren(List <RefreshChildrenParams> nodesToBeRefreshed)
        {
            int t1 = Environment.TickCount;

            var result = new List <RefreshChildrenInfo>();

            foreach (RefreshChildrenParams node in nodesToBeRefreshed)
            {
                EntityToken entityToken;

                try
                {
                    entityToken = EntityTokenSerializer.Deserialize(node.EntityToken);
                }
                catch (EntityTokenSerializerException)
                {
                    continue;
                }

                var         elementHandle = new ElementHandle(node.ProviderName, entityToken, node.Piggybag);
                SearchToken searchToken   = null;
                if (!string.IsNullOrEmpty(node.SearchToken))
                {
                    searchToken = SearchToken.Deserialize(node.SearchToken);
                }

                List <Element> childElements;
                if (UserSettings.ForeignLocaleCultureInfo == null || UserSettings.ForeignLocaleCultureInfo.Equals(UserSettings.ActiveLocaleCultureInfo))
                {
                    childElements = ElementFacade.GetChildren(elementHandle, searchToken).ToList();
                }
                else
                {
                    childElements = ElementFacade.GetForeignChildren(elementHandle, searchToken).ToList();
                }

                result.Add(new RefreshChildrenInfo
                {
                    ElementKey     = GetElementKey(node.ProviderName, node.EntityToken, node.Piggybag),
                    ClientElements = childElements.ToClientElementList()
                });
            }

            int t2 = Environment.TickCount;

            //LoggingService.LogVerbose("TreeServiceFacade", string.Format("GetMultipleChildren: {0} ms", t2 - t1));

            return(result);
        }
Exemple #25
0
        public IEnumerable <Element> GetRoots(SearchToken seachToken)
        {
            var elements = GetRootsImpl(seachToken).ToList();

            foreach (var el in elements)
            {
                var providers = ElementActionProviders.GetProvidersFor(el.ElementHandle.EntityToken);
                foreach (var provider in providers)
                {
                    provider.AddActions(el);
                }
            }

            return(elements);
        }
Exemple #26
0
        public static IEnumerable <Element> GetForeignRoots(string providerName, SearchToken seachToken)
        {
            if (string.IsNullOrEmpty(providerName))
            {
                throw new ArgumentNullException("providerName");
            }

            ILocaleAwareElementProvider provider = GetElementProvider(providerName) as ILocaleAwareElementProvider;

            if (provider == null)
            {
                throw new ArgumentException(string.Format("The Element Provider identified by the specified provider name does not implement {0}", typeof(ILocaleAwareElementProvider)));
            }

            return(provider.GetForeignRoots(seachToken));
        }
Exemple #27
0
        public static IEnumerable <Element> GetRoots(string providerName, SearchToken seachToken)
        {
            if (string.IsNullOrEmpty(providerName))
            {
                throw new ArgumentNullException("providerName");
            }

            IEnumerable <Element> roots = GetElementProvider(providerName).GetRoots(seachToken);

            if (roots == null)
            {
                return(new List <Element>());
            }

            return(roots);
        }
        public IEnumerable <Element> GetRoots(SearchToken seachToken)
        {
            var connections = DataFacade.GetData <ISqlConnection>();

            List <Element> elements    = new List <Element>();
            bool           hasChildren = connections.Any();

            Element element = new Element(_context.CreateElementHandle(new SqlFunctionProviderRootEntityToken(_context.ProviderName, _context.ProviderName)))
            {
                VisualData = new ElementVisualizedData()
                {
                    Label       = StringResourceSystemFacade.GetString("Composite.Plugins.SqlFunction", "SqlFunctionElementProvider.RootLabel"),
                    ToolTip     = StringResourceSystemFacade.GetString("Composite.Plugins.SqlFunction", "SqlFunctionElementProvider.RootLabelToolTip"),
                    HasChildren = hasChildren,
                    Icon        = hasChildren ? this.FolderIcon : this.EmptyFolderIcon,
                    OpenedIcon  = OpenFolderIcon
                }
            };

            element.AddAction(
                new ElementAction(new ActionHandle(
                                      new WorkflowActionToken(
                                          WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider.AddNewSqlConnectionWorkflow"),
                                          new PermissionType[] { PermissionType.Add }
                                          )))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = StringResourceSystemFacade.GetString("Composite.Plugins.SqlFunction", "SqlFunctionElementProvider.AddConnection"),
                    ToolTip        = StringResourceSystemFacade.GetString("Composite.Plugins.SqlFunction", "SqlFunctionElementProvider.AddConnectionToolTip"),
                    Icon           = AddConnection,
                    Disabled       = false,
                    ActionLocation = new ActionLocation
                    {
                        ActionType  = ActionType.Add,
                        IsInFolder  = false,
                        IsInToolbar = true,
                        ActionGroup = PrimaryActionGroup
                    }
                }
            });

            elements.Add(element);

            return(elements);
        }
        public IEnumerable <Element> GetRoots(SearchToken searchToken)
        {
            Element element = new Element(_context.CreateElementHandle(new PageTemplateRootEntityToken()));

            bool hasChildren = PageTemplateFacade.GetPageTemplates().Any();

            element.VisualData = new ElementVisualizedData
            {
                Label       = SR.GetString("Composite.Plugins.PageTemplateElementProvider", "PageTemplateElementProvider.RootLabel"),
                ToolTip     = SR.GetString("Composite.Plugins.PageTemplateElementProvider", "PageTemplateElementProvider.RootLabelToolTip"),
                HasChildren = hasChildren,
                Icon        = PageTemplateElementProvider.RootClosed,
                OpenedIcon  = PageTemplateElementProvider.RootOpen
            };

            const string addTemplateWorkflowType = "Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider.AddNewPageTemplateWorkflow";

            element.AddWorkflowAction(addTemplateWorkflowType, new[] { PermissionType.Add },
                                      new ActionVisualizedData
            {
                Label          = SR.GetString("Composite.Plugins.PageTemplateElementProvider", "PageTemplateElementProvider.AddTemplate"),
                ToolTip        = SR.GetString("Composite.Plugins.PageTemplateElementProvider", "PageTemplateElementProvider.AddTemplateToolTip"),
                Icon           = PageTemplateElementProvider.AddTemplate,
                Disabled       = false,
                ActionLocation = new ActionLocation
                {
                    ActionType  = ActionType.Add,
                    IsInFolder  = false,
                    IsInToolbar = true,
                    ActionGroup = PrimaryActionGroup
                }
            });

            foreach (var pageTemplateProviderName in PageTemplateProviderRegistry.ProviderNames)
            {
                var provider = PageTemplateProviderPluginFacade.GetProvider(pageTemplateProviderName);

                Verify.IsNotNull(provider, "Failed to get provider by name '{0}'", pageTemplateProviderName);

                IEnumerable <ElementAction> actions = provider.GetRootActions();

                element.AddAction(actions);
            }

            return(new [] { element });
        }
        public IEnumerable <Element> GetRoots(SearchToken seachToken)
        {
            Element element = new Element(_context.CreateElementHandle(new PackageElementProviderRootEntityToken()));

            element.VisualData = new ElementVisualizedData
            {
                Label       = StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "RootFolderLabel"),
                ToolTip     = StringResourceSystemFacade.GetString("Composite.Plugins.PackageElementProvider", "RootFolderToolTip"),
                HasChildren = true,
                Icon        = RootClosedIcon,
                OpenedIcon  = RootOpenedIcon
            };

            AddInstallLocalPackageAction(element);

            yield return(element);
        }
Exemple #31
0
        protected override IEnumerable <Element> GetRootsImpl(SearchToken searchToken)
        {
            var elementHandle = Context.CreateElementHandle(new FormElementProviderEntityToken());
            var rootElement   = new Element(elementHandle)
            {
                VisualData = new ElementVisualizedData
                {
                    Label       = "Forms",
                    ToolTip     = "Forms",
                    HasChildren = true,
                    Icon        = ResourceHandle.BuildIconFromDefaultProvider("localization-element-closed-root"),
                    OpenedIcon  = ResourceHandle.BuildIconFromDefaultProvider("localization-element-opened-root")
                }
            };

            return(new[] { rootElement });
        }
        public IEnumerable <Element> GetRoots(SearchToken searchToken)
        {
            var elementHandle = _context.CreateElementHandle(new ECommerceElementProviderEntityToken());
            var rootElement   = new Element(elementHandle)
            {
                VisualData = new ElementVisualizedData
                {
                    Label       = "Shop",
                    ToolTip     = "Shop",
                    HasChildren = true,
                    Icon        = new ResourceHandle("Composite.Icons", "localization-element-closed-root"),
                    OpenedIcon  = new ResourceHandle("Composite.Icons", "localization-element-opened-root")
                }
            };

            return(new[] { rootElement });
        }
        public static IEnumerable<Element> GetForeignChildren(string providerName, EntityToken entityToken, SearchToken seachToken)
        {
            if (string.IsNullOrEmpty(providerName)) throw new ArgumentNullException("providerName");
            if (entityToken == null) throw new ArgumentNullException("entityToken");

            ILocaleAwareElementProvider provider = GetElementProvider(providerName) as ILocaleAwareElementProvider;
            if (provider == null) throw new ArgumentException(string.Format("The Element Provider identified by the specified provider name does not implement {0}", typeof(ILocaleAwareElementProvider)));

            return provider.GetForeignChildren(entityToken, seachToken);
        }
        public static bool GetNewSearchToken(string providerName, EntityToken entityToken, out SearchToken searchToken)
        {
            if (string.IsNullOrEmpty(providerName)) throw new ArgumentNullException("providerName");
            if (entityToken == null) throw new ArgumentNullException("entityToken");

            ICustomSearchElementProvider provider = GetElementProvider(providerName) as ICustomSearchElementProvider;

            if (provider == null)
            {
                searchToken = null;
                return false;
            }

            searchToken = provider.GetNewSearchToken(entityToken);
            return true;
        }