Exemplo n.º 1
0
        internal void PopulateWithFunctionalAreas(WBLocationTreeState treeState, TreeNodeCollection treeNodeCollection, String viewMode, WBTermCollection <WBTerm> teamFunctionalAreas)
        {
            bool expandNodes = true;

            if (teamFunctionalAreas.Count > 2)
            {
                expandNodes = false;
            }

            List <WBTerm> sortedTerms = new List <WBTerm>();

            foreach (WBTerm term in teamFunctionalAreas)
            {
                sortedTerms.Add(term);
            }
            sortedTerms = sortedTerms.OrderBy(o => o.Name).ToList();

            foreach (WBTerm functionalArea in sortedTerms)
            {
                SPFolder folder = null;

                if (viewMode != VIEW_MODE__NEW)
                {
                    folder = this.Libraries.GetMasterFolderByPath(functionalArea.Name);

                    if (folder == null)
                    {
                        WBLogging.Debug("Couldn't find folder for functional area: " + functionalArea.Name);
                        continue;
                    }
                }
                else
                {
                    WBLogging.Debug("View mode = " + viewMode);
                }


                WBFunctionalAreaTreeNode functionalAreaTreeNode = new WBFunctionalAreaTreeNode(functionalArea, folder);
                TreeNode node = functionalAreaTreeNode.AsTreeNode();

                node.Expanded         = expandNodes;
                node.PopulateOnDemand = false;
                node.SelectAction     = TreeNodeSelectAction.Expand;

                treeNodeCollection.Add(node);

                WBTaxonomy     recordsTypes = this.RecordsTypesTaxonomy;
                TermCollection terms        = recordsTypes.TermSet.Terms;

                PopulateWithRecordsTypes(treeState, node.ChildNodes, viewMode, folder, functionalArea, recordsTypes, terms);
            }
        }
Exemplo n.º 2
0
        internal void PopulateWithSubFolders(WBLocationTreeState treeState, TreeNodeCollection treeNodeCollection, String viewMode, SPFolder parentFolder)
        {
            SPFolderCollection subFolders = parentFolder.SubFolders;

            if (subFolders.Count > 0)
            {
                List <SPFolder> folders = new List <SPFolder>();
                foreach (SPFolder folder in subFolders)
                {
                    folders.Add(folder);
                }
                folders = folders.OrderBy(o => o.Name).ToList();

                foreach (SPFolder folder in folders)
                {
                    WBFolderTreeNode folderNode = new WBFolderTreeNode(folder);
                    TreeNode         node       = folderNode.AsTreeNode();

                    if (folder.SubFolders.Count > 0 || viewMode == VIEW_MODE__REPLACE)
                    {
                        node.Expanded         = false;
                        node.PopulateOnDemand = true;
                        if (viewMode == VIEW_MODE__BROWSE_FOLDERS)
                        {
                            node.SelectAction = TreeNodeSelectAction.Select;
                        }
                        else
                        {
                            node.SelectAction = TreeNodeSelectAction.Expand;
                        }
                    }
                    else
                    {
                        node.Expanded         = true;
                        node.PopulateOnDemand = false;
                        node.SelectAction     = TreeNodeSelectAction.Select;
                    }

                    treeNodeCollection.Add(node);
                }
            }
            else
            {
                if (viewMode == VIEW_MODE__REPLACE)
                {
                    PopulateWithDocuments(treeState, treeNodeCollection, viewMode, parentFolder);
                }
            }
        }
Exemplo n.º 3
0
        internal void PopulateTreeNode(WBLocationTreeState treeState, TreeNode node, String viewMode)
        {
            WBLogging.Debug("Looking for WBFolderTreeNode with path: " + node.ValuePath);

            WBFolderTreeNode folderTreeNode = this.GetFolderTreeNode(node.ValuePath);

            if (folderTreeNode == null)
            {
                WBLogging.Debug("Did not find WBFolderTreeNode at: " + node.ValuePath);
                return;
            }

            if (folderTreeNode is WBRecordsTypeTreeNode)
            {
                WBLogging.Debug("Expanding a records type node: " + node.Text);

                WBRecordsTypeTreeNode recordsTypeNode = (WBRecordsTypeTreeNode)folderTreeNode;
                WBRecordsType         recordsType     = recordsTypeNode.RecordsType;
                TermCollection        childTerms      = recordsType.Term.Terms;
                if (childTerms.Count > 0)
                {
                    PopulateWithRecordsTypes(treeState, node.ChildNodes, viewMode, recordsTypeNode.Folder, recordsTypeNode.FunctionalArea, recordsType.Taxonomy, childTerms);
                }
                else
                {
                    if (viewMode != VIEW_MODE__NEW)
                    {
                        PopulateWithSubFolders(treeState, node.ChildNodes, viewMode, recordsTypeNode.Folder);
                    }
                }
            }
            else if (folderTreeNode is WBFolderTreeNode)
            {
                WBLogging.Debug("Expanding a folder node: " + node.Text);

                // You shouldn't be here if the view mode was NEW !
                PopulateWithSubFolders(treeState, node.ChildNodes, viewMode, folderTreeNode.Folder);
            }
            else
            {
                WBLogging.Debug("NOT expanding an unrecognised node: " + node.Text + " of type: " + node.GetType());
            }
        }
Exemplo n.º 4
0
        private bool ItemCanBePicked(WBLocationTreeState treeState, SPListItem item)
        {
            if (item == null)
            {
                return(false);
            }

            if (String.IsNullOrEmpty(item.WBxGetAsString(WBColumn.RecordID)))
            {
                return(false);
            }
            if (item.WBxGetAsString(WBColumn.LiveOrArchived) == WBColumn.LIVE_OR_ARCHIVED__ARCHIVED)
            {
                return(false);
            }

            String recordSeriesStatus = item.WBxGetAsString(WBColumn.RecordSeriesStatus);

            if (recordSeriesStatus != "Latest" && !String.IsNullOrEmpty(recordSeriesStatus))
            {
                return(false);
            }

            String itemProtectiveZone = item.WBxGetAsString(WBColumn.ProtectiveZone);

            if (itemProtectiveZone == WBRecordsType.PROTECTIVE_ZONE__PUBLIC)
            {
                return(true);
            }

            if (treeState.MinimumProtectiveZone == WBRecordsType.PROTECTIVE_ZONE__PUBLIC_EXTRANET && itemProtectiveZone == WBRecordsType.PROTECTIVE_ZONE__PUBLIC_EXTRANET)
            {
                return(true);
            }

            if (treeState.MinimumProtectiveZone == WBRecordsType.PROTECTIVE_ZONE__PROTECTED)
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 5
0
        internal void PopulateWithDocuments(WBLocationTreeState treeState, TreeNodeCollection treeNodeCollection, String viewMode, SPFolder folder)
        {
            WBLogging.Debug("In PopulateWithDocuments()");

            SPListItemCollection items = GetItemsRecursive(folder);

            WBLogging.Debug("In PopulateWithDocuments() items.Count = " + items.Count);

            List <SPListItem> sortedItems = new List <SPListItem>();

            foreach (SPListItem item in items)
            {
                sortedItems.Add(item);
            }
            sortedItems = sortedItems.OrderBy(o => o.Name).ToList();

            foreach (SPListItem item in items)
            {
                if (ItemCanBePicked(treeState, item))
                {
                    TreeNode node = new TreeNode();

                    node.Text             = item.Name;
                    node.Value            = item.Name;
                    node.Expanded         = true;
                    node.PopulateOnDemand = false;
                    node.SelectAction     = TreeNodeSelectAction.Select;


                    node.ImageUrl = SPUtility.ConcatUrls("/_layouts/images/",
                                                         SPUtility.MapToIcon(treeState.Web,
                                                                             SPUtility.ConcatUrls(treeState.Web.Url, node.Text), "", IconSize.Size16));

                    // No need to add this to the tree state as we'll never come looking for it:
                    treeNodeCollection.Add(node);
                }
            }
        }
Exemplo n.º 6
0
        internal void PopulateWithRecordsTypes(WBLocationTreeState treeState, TreeNodeCollection treeNodeCollection, String viewMode, SPFolder parentFolder, WBTerm functionalArea, WBTaxonomy recordsTypesTaxonomy, TermCollection recordsTypeTerms)
        {
            List <Term> sortedTerms = new List <Term>();

            foreach (Term term in recordsTypeTerms)
            {
                sortedTerms.Add(term);
            }
            sortedTerms = sortedTerms.OrderBy(o => o.Name).ToList();

            foreach (Term term in sortedTerms)
            {
                WBRecordsType recordsType = new WBRecordsType(recordsTypesTaxonomy, term);

                bool protectiveZoneOK = true;
                if (!String.IsNullOrEmpty(treeState.MinimumProtectiveZone))
                {
                    protectiveZoneOK = (recordsType.IsZoneAtLeastMinimum(treeState.MinimumProtectiveZone));
                }

                if (recordsType.BranchCanHaveDocuments() && recordsType.IsRelevantToFunctionalArea(functionalArea) && protectiveZoneOK)
                {
                    SPFolder folder = null;
                    if (viewMode != VIEW_MODE__NEW && parentFolder != null)
                    {
                        folder = parentFolder.WBxGetSubFolder(recordsType.Name);
                        if (folder == null)
                        {
                            WBLogging.Debug("Did not find folder for: " + recordsType.Name);
                        }
                    }

                    if (viewMode == VIEW_MODE__NEW || folder != null)
                    {
                        WBRecordsTypeTreeNode recordsTypeTreeNode = new WBRecordsTypeTreeNode(functionalArea, recordsType, folder);
                        TreeNode node = recordsTypeTreeNode.AsTreeNode();

                        if (recordsType.Term.TermsCount > 0 || viewMode != VIEW_MODE__NEW)
                        {
                            if (viewMode == VIEW_MODE__BROWSE_FOLDERS && recordsType.Term.TermsCount == 0)
                            {
                                node.SelectAction = TreeNodeSelectAction.Select;
                            }
                            else
                            {
                                node.SelectAction = TreeNodeSelectAction.Expand;
                            }
                            node.Expanded         = false;
                            node.PopulateOnDemand = true;
                        }
                        else
                        {
                            node.SelectAction     = TreeNodeSelectAction.Select;
                            node.Expanded         = true;
                            node.PopulateOnDemand = false;
                        }

                        treeNodeCollection.Add(node);
                    }
                }
            }
        }