Exemple #1
0
        public override void LoadNodes()
        {
            base.LoadNodes();

            if (List is SPDocumentLibrary)
            {
                foreach (SPListItem item in List.Items)
                {
                    this.AddNode(NodeDisplayLevelType.Simple, new FileNode(item.File));
                }
            }
            else
            {
                foreach (SPListItem item in List.Items)
                {
                    this.AddNode(NodeDisplayLevelType.Simple, new ListItemNode(item));
                }
            }

            TreeViewExplorer exp = this.TreeView as TreeViewExplorer;

            foreach (SPFolder folder in List.RootFolder.SubFolders)
            {
                if (exp.DisplayLevel != NodeDisplayLevelType.Simple || folder.Name != "Forms")
                {
                    this.AddNode(NodeDisplayLevelType.Simple, new FolderNode(folder));
                }
            }
        }
        public void AddNode(NodeDisplayLevelType requiredlevel, ExplorerNodeBase node)
        {
            TreeViewExplorer exp = this.TreeView as TreeViewExplorer;

            int level  = (int)exp.DisplayLevel;
            int result = level & (int)requiredlevel;

            if (result >= 1)
            {
                this.Nodes.Add(node);
            }
        }
        public override void LoadNodes()
        {
            base.LoadNodes();

            SPFile file = this.Tag as SPFile;

            try
            {
                if (file.Item != null)
                {
                    this.AddNode(NodeDisplayLevelType.Simple, new ListItemNode(file.Item, SPMLocalization.GetString("File_Item"), this.ShowVersions));
                }
            }
            catch
            {
                // Do nothing
                // sometimes the file.Item throws an exception
            }

            this.AddNode(NodeDisplayLevelType.Medium, new PropertyCollectionNode(file, file.Properties));

            TreeViewExplorer exp = this.TreeView as TreeViewExplorer;

            if (((int)exp.DisplayLevel & (int)NodeDisplayLevelType.Advanced) >= 1)
            {
                if (file.Name.EndsWith(".aspx", true, System.Globalization.CultureInfo.InvariantCulture))
                {
                    try
                    {
                        this.Nodes.Add(new WebPartCollectionNode(file, file.GetLimitedWebPartManager(System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared)));
                    }
                    catch
                    {
                        // Do nothing
                    }
                }
            }

            if (this.SPParent != null && this.ShowVersions)
            {
                SPList list = this.SPParent as SPList;

                if (list.EnableVersioning || File.Versions.Count > 1)
                {
                    this.AddNode(NodeDisplayLevelType.Medium, new FileVersionCollectionNode(this.File));
                }
            }

            this.AddNode(NodeDisplayLevelType.Advanced, new EventReceiverDefinitionCollectionNode(this.File, this.File.EventReceivers));
        }
Exemple #4
0
        public void AddNode(NodeDisplayLevelType requiredlevel, ExplorerNodeBase node)
        {
            if (node.NewFeatureIn2010)
            {
                node.BackColor = Color.LightGray;
            }
            else
            {
                node.BackColor = Color.Empty;
            }

            TreeViewExplorer exp = this.TreeView as TreeViewExplorer;

            int level  = (int)exp.DisplayLevel;
            int result = level & (int)requiredlevel;

            if (result >= 1)
            {
                this.Nodes.Add(node);
            }
        }