From 4dfddeecb4e42423a8b89c0290ecf6d9a66a15a7 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 1 Mar 2016 20:56:13 +0000 Subject: [PATCH] Added multi-user check for menu items to prevent certain actions when someone else is in a procedure or procedure set. --- PROMS/Volian.Controls.Library/vlnTreeView.cs | 40 ++++++++++++++++++-- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/PROMS/Volian.Controls.Library/vlnTreeView.cs b/PROMS/Volian.Controls.Library/vlnTreeView.cs index 54754a6b..2032c17f 100644 --- a/PROMS/Volian.Controls.Library/vlnTreeView.cs +++ b/PROMS/Volian.Controls.Library/vlnTreeView.cs @@ -617,6 +617,7 @@ namespace Volian.Controls.Library { OwnerInfoList oil = null; OwnerInfo oi = null; + FolderInfo fi = null; VETreeNode tn = this.GetNodeAt(new Point(e.X, e.Y)) as VETreeNode; if (tn != null) { @@ -641,7 +642,7 @@ namespace Volian.Controls.Library // For Folders, if no children, can add either docversion or folder. If children are // folders then can only add another folder, and if children are docversions can only // add docversion. - FolderInfo fi = tn.VEObject as FolderInfo; + fi = tn.VEObject as FolderInfo; bool DoSpecificInfo = fi.ActiveFormat.PlantFormat.FormatData.SpecificInfo; if (ui.IsAdministrator() || ui.IsSetAdministrator(fi))// && fi.MyParent == null) //VEPROMS level { @@ -949,7 +950,7 @@ namespace Volian.Controls.Library PartInfo pi = tn.VEObject as PartInfo; if (pi == null && tn.Parent != null) // it's not a part and it's not the top.... { - FolderInfo fi = tn.VEObject as FolderInfo; + fi = tn.VEObject as FolderInfo; if (fi == null || tn.Nodes.Count == 0) // it's not a folder or it has no children { DocVersionInfo di = tn.VEObject as DocVersionInfo; @@ -980,6 +981,35 @@ namespace Volian.Controls.Library #endregion //_MyLog.WarnFormat("Context Menu 7 - {0}", GC.GetTotalMemory(true)); + if (fi != null && fi.HasWorkingDraft) + { + /* + --Folder level + see if we need to disable "Export Procedure Set" or "Folder Specific Information" + */ + if (!tn.ChildrenLoaded) tn.LoadChildren(); + VETreeNode wrkdrft = (VETreeNode) tn.LastNode; + DocVersionInfo docver = wrkdrft.VEObject as DocVersionInfo; + OwnerInfoList.Reset(); + oil = OwnerInfoList.GetByVersionID(docver.VersionID); + bool greyOut = false; + foreach (OwnerInfo own in oil) + { + if (own.SessionID != MySessionInfo.SessionID) + { + greyOut = true; + break; + } + } + if (greyOut) + { + foreach (MenuItem itm in cm.MenuItems) + { + if (itm.Text == "Export Procedure Set" || itm.Text == "Folder Specific Information") + itm.Enabled = false; + } + } + } if (oil != null && oil.Count > 0 && tn.VEObject as DocVersionInfo != null) { /* @@ -1000,7 +1030,8 @@ namespace Volian.Controls.Library { foreach (MenuItem itm in cm.MenuItems) { - if (itm.Text == "Approve All Procedures" || itm.Text == "Report All Procedures Inconsistencies") + if (itm.Text == "Approve All Procedures" || itm.Text == "Report All Procedures Inconsistencies" || + itm.Text == "Working Draft Specific Information" || itm.Text == "Approve All Procedures for") itm.Enabled = false; } } @@ -1030,7 +1061,8 @@ namespace Volian.Controls.Library foreach (MenuItem itm in cm.MenuItems) { if(itm.Text == "Procedure Specific Information" || itm.Text == "New Section" || itm.Text == "Approve" || itm.Text == "Open" || - itm.Text == "Copy" || itm.Text == "Delete" || itm.Text == "Properties..." || itm.Text == "Replace Existing Procedure") + itm.Text == "Copy" || itm.Text == "Delete" || itm.Text == "Properties..." || itm.Text == "Replace Existing Procedure" || + itm.Text.StartsWith("Showing Change Bars Starting") || itm.Text == "Create Continuous Action Summary" || itm.Text == "Export Procedure") itm.Enabled = false; } }