Added multi-user check for menu items to prevent certain actions when someone else is in a procedure or procedure set.

This commit is contained in:
John Jenko 2016-03-01 20:56:13 +00:00
parent b5d87ce503
commit 4dfddeecb4

View File

@ -617,6 +617,7 @@ namespace Volian.Controls.Library
{ {
OwnerInfoList oil = null; OwnerInfoList oil = null;
OwnerInfo oi = null; OwnerInfo oi = null;
FolderInfo fi = null;
VETreeNode tn = this.GetNodeAt(new Point(e.X, e.Y)) as VETreeNode; VETreeNode tn = this.GetNodeAt(new Point(e.X, e.Y)) as VETreeNode;
if (tn != null) 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 // 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 // folders then can only add another folder, and if children are docversions can only
// add docversion. // add docversion.
FolderInfo fi = tn.VEObject as FolderInfo; fi = tn.VEObject as FolderInfo;
bool DoSpecificInfo = fi.ActiveFormat.PlantFormat.FormatData.SpecificInfo; bool DoSpecificInfo = fi.ActiveFormat.PlantFormat.FormatData.SpecificInfo;
if (ui.IsAdministrator() || ui.IsSetAdministrator(fi))// && fi.MyParent == null) //VEPROMS level 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; PartInfo pi = tn.VEObject as PartInfo;
if (pi == null && tn.Parent != null) // it's not a part and it's not the top.... 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 if (fi == null || tn.Nodes.Count == 0) // it's not a folder or it has no children
{ {
DocVersionInfo di = tn.VEObject as DocVersionInfo; DocVersionInfo di = tn.VEObject as DocVersionInfo;
@ -980,6 +981,35 @@ namespace Volian.Controls.Library
#endregion #endregion
//_MyLog.WarnFormat("Context Menu 7 - {0}", GC.GetTotalMemory(true)); //_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) 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) 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; itm.Enabled = false;
} }
} }
@ -1030,7 +1061,8 @@ namespace Volian.Controls.Library
foreach (MenuItem itm in cm.MenuItems) foreach (MenuItem itm in cm.MenuItems)
{ {
if(itm.Text == "Procedure Specific Information" || itm.Text == "New Section" || itm.Text == "Approve" || itm.Text == "Open" || 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; itm.Enabled = false;
} }
} }