Enhanced Document support

Null check
Move DisplayText.cs to CSLA
Enhanced Documents – don’t allow ‘Save’ RO on enhanced step
Enhanced Documents windowing
Enhanced Documents remove unnecessary options
Enhanced Documents – don’t allow ‘Save’ transition on enhanced step
Enhanced Documents/Insert,Delete,Paste
This commit is contained in:
2016-01-20 16:43:23 +00:00
parent 77cdf81736
commit 6366af8b47
17 changed files with 1132 additions and 243 deletions

View File

@@ -346,6 +346,23 @@ namespace VEPROMS.CSLA.Library
if (this is ProcedureInfo) return this as ProcedureInfo;
return ProcedureInfo.Get(ItemID);
}
private string _EnhType = null;
public string EnhType
{
get
{
if (_EnhType != null) return _EnhType;
if (!IsSection)
_EnhType = "";
else
{
// get the section's enhtype from the config
SectionConfig sc = MyConfig as SectionConfig;
_EnhType = sc.Section_LnkEnh;
}
return _EnhType;
}
}
public bool InList(params int[] IDs)
{
foreach (int id in IDs)
@@ -356,6 +373,17 @@ namespace VEPROMS.CSLA.Library
{
return _CacheByPrimaryKey.ContainsKey(itemID.ToString());
}
public static string ReplaceLinkWithNewID(string tmpForLink)
{
tmpForLink = Regex.Replace(tmpForLink, @"#Link:ReferencedObject:[0-9]+ ", @"#Link:ReferencedObject:<NewID> ");
tmpForLink = Regex.Replace(tmpForLink, @"#Link:Transition:([0-9]+) [0-9]+ ", @"#Link:Transition:$1 <NewID> ");
tmpForLink = Regex.Replace(tmpForLink, @"#Link:TransitionRange:([0-9]+) [0-9]+ ", @"#Link:TransitionRange:$1 <NewID> ");
tmpForLink = tmpForLink.Replace(@"\u8212 \'96", @"-"); // Replace EM Dash with hyphen
tmpForLink = tmpForLink.Replace(@"\u8211 \'96", @"-"); // Replace EN Dash with hyphen
tmpForLink = tmpForLink.Replace(@"\u8212 ", @"-"); // Replace EM Dash with hyphen
tmpForLink = tmpForLink.Replace(@"\u8211 ", @"-"); // Replace EN Dash with hyphen
return tmpForLink;
}
public void SetHeader(VE_Font myFont, string myText)
{
_MyHeader = new MetaTag(myFont);
@@ -552,36 +580,36 @@ namespace VEPROMS.CSLA.Library
}
}
return null;
}
public static void ResetTranCounters()
{
TranCheckCount = 0;
TranFixCount = 0;
}
public static int TranCheckCount = 0;
public static int TranFixCount = 0;
}
public static void ResetTranCounters()
{
TranCheckCount = 0;
TranFixCount = 0;
}
public static int TranCheckCount = 0;
public static int TranFixCount = 0;
internal static TransitionInfoList TransitionsToDisconnected;
internal static TransitionInfoList TransitionsToNonEditable;
internal static void MyRefreshTransitions(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
{
//TransitionInfoList til = TransitionInfoList.GetByFromID(itemInfo.ItemID);
//Console.WriteLine("Procedure: {0}, transitions: {1}", (itemInfo as ProcedureInfo).DisplayNumber, til.Count);
//foreach (TransitionInfo traninfo in til)
//{
// string oldText = itemInfo.MyContent.Text;
// itemInfo.MyContent.FixTransitionText(traninfo, tranLookup);
// string newText = itemInfo.MyContent.Text;
// if (newText != oldText)
// {
// Content content = Content.Get(itemInfo.MyContent.ContentID);
// content.FixTransitionText(traninfo);
// content.Save();
// }
//}
if (itemInfo.MyContent.ContentPartCount > 0)
foreach (PartInfo pi in itemInfo.MyContent.ContentParts)
foreach (ItemInfo ii in pi.MyItems)
MyRefreshTransitions(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, procInfo, docVersionInfo, tranLookup);
{
//TransitionInfoList til = TransitionInfoList.GetByFromID(itemInfo.ItemID);
//Console.WriteLine("Procedure: {0}, transitions: {1}", (itemInfo as ProcedureInfo).DisplayNumber, til.Count);
//foreach (TransitionInfo traninfo in til)
//{
// string oldText = itemInfo.MyContent.Text;
// itemInfo.MyContent.FixTransitionText(traninfo, tranLookup);
// string newText = itemInfo.MyContent.Text;
// if (newText != oldText)
// {
// Content content = Content.Get(itemInfo.MyContent.ContentID);
// content.FixTransitionText(traninfo);
// content.Save();
// }
//}
if (itemInfo.MyContent.ContentPartCount > 0)
foreach (PartInfo pi in itemInfo.MyContent.ContentParts)
foreach (ItemInfo ii in pi.MyItems)
MyRefreshTransitions(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, procInfo, docVersionInfo, tranLookup);
if (itemInfo.MyContent.ContentTransitionCount > 0)
{
itemInfo.ResetOrdinal();
@@ -660,7 +688,7 @@ namespace VEPROMS.CSLA.Library
}
}
}
}
}
//private static bool IsTransitionToDisconnected(TransitionInfo ti)
//{
// foreach (TransitionInfo til in TransitionsToDisconnected)
@@ -680,12 +708,12 @@ namespace VEPROMS.CSLA.Library
return false;
}
public static void ResetROCounters()
{
ROCheckCount = 0;
ROFixCount = 0;
}
public static int ROCheckCount = 0;
public static int ROFixCount = 0;
{
ROCheckCount = 0;
ROFixCount = 0;
}
public static int ROCheckCount = 0;
public static int ROFixCount = 0;
private static AnnotationType _VolianCommentType = null; // Using this to flag ro value issues with byron to braidwood
public static AnnotationType VolianCommentType
{
@@ -732,30 +760,30 @@ namespace VEPROMS.CSLA.Library
}
}
internal static void MyRefreshReferenceObjects(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, DocVersionInfo docVersionInfo)
{
if (itemInfo.MyContent.ContentPartCount > 0)
foreach (PartInfo pi in itemInfo.MyContent.ContentParts)
foreach (ItemInfo ii in pi.MyItems)
MyRefreshReferenceObjects(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, docVersionInfo);
ROFstInfo rofstinfo = docVersionInfo.DocVersionAssociations[0].MyROFst;
ROFSTLookup lookup = rofstinfo.GetROFSTLookup(docVersionInfo);
lookup.MyDocVersionInfo = docVersionInfo;
if (itemInfo.MyContent.ContentRoUsageCount > 0)
{
foreach (RoUsageInfo rousage in itemInfo.MyContent.ContentRoUsages)
{
if (sectionInfo != null)
{
ROCheckCount++;
string oldText = itemInfo.MyContent.Text;
string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, itemInfo);
string newText = itemInfo.MyContent.Text;
if (newText != oldText)
{
ROFixCount++;
Content content = Content.Get(itemInfo.MyContent.ContentID);
{
if (itemInfo.MyContent.ContentPartCount > 0)
foreach (PartInfo pi in itemInfo.MyContent.ContentParts)
foreach (ItemInfo ii in pi.MyItems)
MyRefreshReferenceObjects(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, docVersionInfo);
ROFstInfo rofstinfo = docVersionInfo.DocVersionAssociations[0].MyROFst;
ROFSTLookup lookup = rofstinfo.GetROFSTLookup(docVersionInfo);
lookup.MyDocVersionInfo = docVersionInfo;
if (itemInfo.MyContent.ContentRoUsageCount > 0)
{
foreach (RoUsageInfo rousage in itemInfo.MyContent.ContentRoUsages)
{
if (sectionInfo != null)
{
ROCheckCount++;
string oldText = itemInfo.MyContent.Text;
string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, itemInfo);
string newText = itemInfo.MyContent.Text;
if (newText != oldText)
{
ROFixCount++;
Content content = Content.Get(itemInfo.MyContent.ContentID);
if (roval == "?")
{
oldText = content.ConvertROToText(rousage, roval, roch.type, rofstinfo);
@@ -763,13 +791,13 @@ namespace VEPROMS.CSLA.Library
}
else
content.FixContentText(rousage, roval, roch.type, rofstinfo);
content.Save();
}
}
}
}
}
internal static void SetParentSectionAndDocVersionPageNum(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
content.Save();
}
}
}
}
}
internal static void SetParentSectionAndDocVersionPageNum(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
{
if (itemInfo.MyContent.ContentPartCount > 0)
{
@@ -807,7 +835,7 @@ namespace VEPROMS.CSLA.Library
internal static string GetCombinedTab(ItemInfo itemInfo, string parTab)
{
string pTab = parTab == null ? "" : parTab;
int profileDepth = ProfileTimer.Push( ">>>> itemInfo.MyTab.CleanText.Trim");
int profileDepth = ProfileTimer.Push(">>>> itemInfo.MyTab.CleanText.Trim");
string thisTab = itemInfo.MyTab.CleanText.Trim();
ProfileTimer.Pop(profileDepth);
if (thisTab != null && thisTab != "" && !char.IsLetterOrDigit(thisTab[0])) return pTab;
@@ -837,26 +865,26 @@ namespace VEPROMS.CSLA.Library
}
if (docVersionInfo.DocVersionAssociationCount == 1)
{
ROFstInfo rofstinfo = docVersionInfo.DocVersionAssociations[0].MyROFst;
//rofstinfo.docVer = docVersionInfo;
ROFSTLookup lookup = rofstinfo.GetROFSTLookup(docVersionInfo);
lookup.MyDocVersionInfo = docVersionInfo;
//DateTime dts = DateTime.Now;
if (itemInfo.MyContent.ContentGridCount > 0)
itemInfo.MyContent.LoadNonCachedGrid();
if (itemInfo.MyContent.ContentRoUsageCount > 0)
{
foreach (RoUsageInfo rousage in itemInfo.MyContent.ContentRoUsages)
ROFstInfo rofstinfo = docVersionInfo.DocVersionAssociations[0].MyROFst;
//rofstinfo.docVer = docVersionInfo;
ROFSTLookup lookup = rofstinfo.GetROFSTLookup(docVersionInfo);
lookup.MyDocVersionInfo = docVersionInfo;
//DateTime dts = DateTime.Now;
if (itemInfo.MyContent.ContentGridCount > 0)
itemInfo.MyContent.LoadNonCachedGrid();
if (itemInfo.MyContent.ContentRoUsageCount > 0)
{
if (sectionInfo != null)
foreach (RoUsageInfo rousage in itemInfo.MyContent.ContentRoUsages)
{
string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, itemInfo);
if (sectionInfo != null)
{
string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, itemInfo);
}
}
}
}
}
else
{
// Force Error Message
@@ -972,7 +1000,7 @@ namespace VEPROMS.CSLA.Library
foreach (ItemInfo item in _CacheByPrimaryKey[key]) myCache.Add(item);
foreach (ItemInfo item in myCache)
item.OnOrdinalChange();
}
}
}
public bool IsFirstSubStep
{
@@ -1009,7 +1037,7 @@ namespace VEPROMS.CSLA.Library
{
if (IsProcedure) return false;
SectionConfig scfg = ActiveSection.MyConfig as SectionConfig;
if (MyDocStyle.StructureStyle.Style == null || scfg == null) return false;
if (MyDocStyle.StructureStyle.Style == null || scfg == null) return false;
bool PlacekeepOption = ((ActiveFormat.PlantFormat.FormatData.PurchaseOptions & E_PurchaseOptions.AutoPlacekeeper) == E_PurchaseOptions.AutoPlacekeeper)
&& scfg.Section_Placekeeper.Equals("Y");
//return (PlacekeepOption && IsHigh);
@@ -1170,7 +1198,7 @@ namespace VEPROMS.CSLA.Library
else if (item.IsRNOPart)
{
level = (item.ActiveParent as ItemInfo).StepLevel + item.RNOLevel - item.ColumnMode;
// RHM Change 20140522
// RHM Change 20140522
//level = (item.ActiveParent as ItemInfo).StepLevel;// +item.RNOLevel - item.ColumnMode;
}
return level;
@@ -1434,11 +1462,11 @@ namespace VEPROMS.CSLA.Library
private E_FromType? _FromType = null;
public E_FromType? FromType
{
get
get
{
if (ItemID == 95759 && _FromType == null)
Console.WriteLine("\"Null FromType\",{0},{1},\"{2}\",{3}", ItemID, MyContent.Type,DisplayNumber,MyItemInfoUnique);
return _FromType;
Console.WriteLine("\"Null FromType\",{0},{1},\"{2}\",{3}", ItemID, MyContent.Type, DisplayNumber, MyItemInfoUnique);
return _FromType;
}
set { _FromType = value; }
}
@@ -1447,7 +1475,7 @@ namespace VEPROMS.CSLA.Library
get
{
if (FromType != null)
return (MyPrevious == null && FromType == E_FromType.Caution);
return (MyPrevious == null && FromType == E_FromType.Caution);
return ((ItemPartCount > 0) && (ItemParts[0].PartType == E_FromType.Caution));
}
}
@@ -1538,7 +1566,7 @@ namespace VEPROMS.CSLA.Library
case 45: // Continuous Action AND sub-step
case 46: // Continuous Action OR sub-step
case 47: //Continuous Actoin Paragraph sub-step
includeOnCAS = !sd.ExcludeFromContActSum; // if flag is not set then Automatically include this step/sub-step on the Continuous Action Summary
includeOnCAS = !sd.ExcludeFromContActSum; // if flag is not set then Automatically include this step/sub-step on the Continuous Action Summary
break;
default:
includeOnCAS = !sd.ExcludeFromContActSum; //false; // don't automatically include this step/sub-step on the Continuous Action Summary
@@ -1684,10 +1712,10 @@ namespace VEPROMS.CSLA.Library
if (MyContent.Type / 10000 != 2) _IsHigh = false;
else
{
ItemInfo parent = ActiveParent as ItemInfo;
ItemInfo parent = ActiveParent as ItemInfo;
if (parent == null) _IsHigh = false;
// IsHigh was returning true if this item is a caution or note off of a section..
// from the (parent.MyContent.Type / 1000) == 1.
// IsHigh was returning true if this item is a caution or note off of a section..
// from the (parent.MyContent.Type / 1000) == 1.
else if ((parent.MyContent.Type / 10000) != 1)
_IsHigh = false;
else if (IsCaution || IsNote) _IsHigh = false;
@@ -1928,6 +1956,54 @@ namespace VEPROMS.CSLA.Library
return ((FirstSibling.ItemPartCount > 0) && (FirstSibling.ItemParts[0].PartType == E_FromType.Step));
}
}
public bool IsEnhancedStep
{
get
{
if (FormatStepData != null)
{
E_AccStep? actable = FormatStepData.StepEditData.AcTable;
return (actable != null && MyActiveSection != null && MyActiveSection.IsEnhancedSection && ((actable & E_AccStep.EnhancedLinkedStep) != 0));
}
return false;
}
}
public bool IsEnhancedSection
{
get
{
if (!IsSection) return false;
SectionConfig sc = MyConfig as SectionConfig;
if (sc.MyEnhancedDocuments != null && sc.MyEnhancedDocuments.Count == 1 && sc.MyEnhancedDocuments[0].Type == 0) return true;
return false;
}
}
public bool IsEnhancedSectionTitleOnly // this is an enhanced document (sectionitem) but only the title is linked.
{
get
{
if (!IsSection) return false;
SectionConfig sc = MyConfig as SectionConfig;
// go back to source & see what type is:
if (sc.MyEnhancedDocuments != null && sc.MyEnhancedDocuments.Count == 1 && sc.MyEnhancedDocuments[0].Type == 0)
{
SectionInfo siSource = SectionInfo.Get(sc.MyEnhancedDocuments[0].ItemID);
SectionConfig scs = siSource.MyConfig as SectionConfig;
if (scs.Section_LnkEnh == "T") return true;
}
return false;
}
}
public bool IsEnhancedProcedure // this is NOT a source, it is enhanced, i.e. background or deviation
{
get
{
if (!IsProcedure) return false;
ProcedureConfig pc = MyConfig as ProcedureConfig;
if (pc.MyEnhancedDocuments != null && pc.MyEnhancedDocuments.Count == 1 && pc.MyEnhancedDocuments[0].Type == 0) return true;
return false;
}
}
public bool IsInSubStep
{
get
@@ -2025,7 +2101,7 @@ namespace VEPROMS.CSLA.Library
string myNumber = DisplayNumber;
if (parNumber == null || myNumber == null) return false;
ItemInfo par2 = par.ActiveParent as ItemInfo;
if (par2 != null && par2.IsSection)
if (par2 != null && par2.IsSection)
{
// check for 6.1 (parent) and 6.1.1.
if (DisplayNumber.StartsWith((ActiveParent as SectionInfo).DisplayNumber.Trim())) return true;
@@ -2072,7 +2148,7 @@ namespace VEPROMS.CSLA.Library
return false;
}
}
private E_FromType ItemType
private E_FromType ItemType
{
get
{
@@ -2286,7 +2362,7 @@ namespace VEPROMS.CSLA.Library
// str = str.Replace("<u>", MyDocVersion.DocVersionConfig.Unit_Number);
//if (str.Contains("<U>"))
// str = str.Replace("<U>", MyDocVersion.DocVersionConfig.Unit_Number);
return ConvertToDisplayText(str,false);
return ConvertToDisplayText(str, false);
}
}
// Used in Comanche Peak EOP and Flex formats for step designators. Will allow a hard return to be used that that caution type.
@@ -2406,7 +2482,7 @@ namespace VEPROMS.CSLA.Library
public static string StripLinks(string rtf)
{
string retval = rtf;
retval = Regex.Replace(retval, @"\\v.*?\\v0", "");
retval = Regex.Replace(retval, @"\\v.*?\\v0 ?", "");
retval = retval.Replace("\u252C", "");// Unicode 9516 Transition
retval = retval.Replace("\u2566", "");// Unicode 9574 Transition
retval = retval.Replace("\u0015", "");// Unicode 21 RO
@@ -2851,7 +2927,7 @@ namespace VEPROMS.CSLA.Library
return false; // No Change ID - No Change Bar
if (sc.Step_CBOverride == null)
return chg;
return (sc.Step_CBOverride == "On");
return (sc.Step_CBOverride == "On");
}
}
public bool HasChanges
@@ -3089,8 +3165,8 @@ namespace VEPROMS.CSLA.Library
{
get
{
if (_ActiveFormat == null || !PrintAllAtOnce) // jsj added check for NULL ActiveParent
_ActiveFormat = (LocalFormat != null ? LocalFormat : (ActiveParent != null) ? ActiveParent.ActiveFormat : null);
if (_ActiveFormat == null || !PrintAllAtOnce) // jsj added check for NULL ActiveParent
_ActiveFormat = (LocalFormat != null ? LocalFormat : (ActiveParent != null) ? ActiveParent.ActiveFormat : null);
//Console.WriteLine("Active {0}", (_ActiveFormat == null) ? "_ActiveFormat is null" : _ActiveFormat.Name);
return _ActiveFormat;
}
@@ -3170,6 +3246,22 @@ namespace VEPROMS.CSLA.Library
foreach (ItemInfo tmpInfo in _CacheByPrimaryKey[key])
tmpInfo.MyConfig = null;
}
public EnhancedDocuments GetMyEnhancedDocuments()
{
switch (MyContent.Type / 10000)
{
case 0:
ProcedureConfig pConfig = MyConfig as ProcedureConfig;
return pConfig.MyEnhancedDocuments;
case 1:
SectionConfig sConfig = MyConfig as SectionConfig;
return sConfig.MyEnhancedDocuments;
case 2:
StepConfig stConfig = MyConfig as StepConfig;
return stConfig.MyEnhancedDocuments;
}
return null;
}
//public bool HasStandardSteps()
//{ return MyContent.ContentItemCount > 1; }
public Color ForeColor
@@ -3378,7 +3470,7 @@ namespace VEPROMS.CSLA.Library
localPrintLevel = PrintLevel + ((ActiveFormat.PlantFormat.FormatData.Express && IsSequential) ? 0 : CurrentSectionLevel());
if (!ActiveFormat.PlantFormat.FormatData.Express) doMeta = true;
}
if(sd.StepSectionLayoutData.TieTabToLevel && ActiveFormat.PlantFormat.FormatData.SectData.CountSubSectionsForLevel)
if (sd.StepSectionLayoutData.TieTabToLevel && ActiveFormat.PlantFormat.FormatData.SectData.CountSubSectionsForLevel)
if (SectionLevel() > 1)
localPrintLevel += 1;
SeqTabFmtList seqtabs = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.SeqTabFmtList;
@@ -3393,7 +3485,7 @@ namespace VEPROMS.CSLA.Library
// Check to be sure the parent tab should be included... If this sequential is within a note
// or caution or equipment list, don't use parent tab AND always start the numbering as a numeric
if (doMeta && IsSequential && (InNote() || InCaution() ||
if (doMeta && IsSequential && (InNote() || InCaution() ||
(MyParent.IsEquipmentList && !MyParent.FormatStepData.TabData.IdentPrint.Contains("{seq}"))))
{
// if immediate parent is note, caution or equip, use numeric, otherwise use alpha.
@@ -3470,7 +3562,7 @@ namespace VEPROMS.CSLA.Library
parentTab = myparent.MyTab.CleanText.Trim();
if (((MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_AddDotZeroStdHLS) == E_DocStructStyle.DSS_AddDotZeroStdHLS) && myparent.MyContent.Type == 20002)
parentTab = parentTab.Replace(".0", ""); // this was added in, remove for substeps.
tbformat = parentTab + (parentTab.EndsWith(".") ? "" : parentTab=="" ? "" : ".") + tbformat.TrimStart();
tbformat = parentTab + (parentTab.EndsWith(".") ? "" : parentTab == "" ? "" : ".") + tbformat.TrimStart();
}
else if (IsSequential && ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.SkipNonSeqTabWithPar)
{
@@ -3524,7 +3616,7 @@ namespace VEPROMS.CSLA.Library
if (!IsSection && !IsProcedure && tbformat.IndexOf("{Section Prefix}") >= 0)
{
string tmpsectpref = SectionPrefix(tbformat) ?? string.Empty;
if (ActiveSection.MyTab.CleanText != null && ActiveSection.MyTab.CleanText != "" && tmpsectpref != string.Empty) trimTabStart = true;
if (ActiveSection.MyTab!=null && ActiveSection.MyTab.CleanText != null && ActiveSection.MyTab.CleanText != "" && tmpsectpref != string.Empty) trimTabStart = true;
tbformat = tbformat.Replace("{Section Prefix}", SectionPrefix(tbformat));
if (tbformate != null) tbformate = tbformate.Replace("{Section Prefix}", SectionPrefix(tbformate));
}
@@ -3778,7 +3870,7 @@ namespace VEPROMS.CSLA.Library
}
}
}
if (MyDocStyle != null && (MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_SkipOneStepLevel) == E_DocStructStyle.DSS_SkipOneStepLevel)
level++;
if (MyDocStyle != null && (MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_SkipTwoStepLevels) == E_DocStructStyle.DSS_SkipTwoStepLevels && level == 0)
@@ -3912,7 +4004,7 @@ namespace VEPROMS.CSLA.Library
// use of the MixCautionsAndNotes format flag - no bullet is used, if more that one replace the tab
// with a bullet. Also, if only one in group and tab text ends with 'S', remove it:
bool mixCandN = MixCautionNotesDiffType();
if ((MyPrevious == null && (nextItem == null||specialCalvertAlarm)) || mixCandN || FormatStepData.SeparateBox)
if ((MyPrevious == null && (nextItem == null || specialCalvertAlarm)) || mixCandN || FormatStepData.SeparateBox)
{
if (_MyHeader.CleanText.ToUpper().EndsWith("S"))
{
@@ -3949,10 +4041,10 @@ namespace VEPROMS.CSLA.Library
// For calvert formats, if all tabs are null or empty, then don't add a bullet in.
bool allnull = ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && (tbformat == null || tbformat == "") && (nextTbFormat == null || tbformat == "") && (prevTbFormat == null || prevTbFormat == "");
if (!allnull && (tbformat == nextTbFormat || tbformat == prevTbFormat))
{
tbformat = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB;
TabToIdentBAdjustFont();
}
{
tbformat = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB;
TabToIdentBAdjustFont();
}
else if ((nextTbFormat == null || tbformat != nextTbFormat) && (prevTbFormat == null || tbformat != prevTbFormat))
{
tbformat = "";
@@ -3972,9 +4064,9 @@ namespace VEPROMS.CSLA.Library
(MyPrevious != null && MyPrevious.MyContent.Type == MyContent.Type) ||
(NextItem != null && nextItem.MyContent.Type == MyContent.Type))
{
tbformat = tbformat + ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB;
TabToIdentBAdjustFont();
}
tbformat = tbformat + ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB;
TabToIdentBAdjustFont();
}
}
else if (FormatStepData.TabData.IsTransition)
return tbformat;
@@ -4027,9 +4119,9 @@ namespace VEPROMS.CSLA.Library
// treat cautions and notes as different if they are all NOT exactly the same type
if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.OnlyBulletSameCautionNoteType)
{
if (MyPrevious != null && MyPrevious.MyContent.Type != MyContent.Type &&
if (MyPrevious != null && MyPrevious.MyContent.Type != MyContent.Type &&
((MyPrevious.IsCaution && this.IsCaution) || (MyPrevious.IsNote && this.IsNote))) return true;
if (NextItem != null && NextItem.MyContent.Type != MyContent.Type &&
if (NextItem != null && NextItem.MyContent.Type != MyContent.Type &&
((NextItem.IsCaution && this.IsCaution) || (NextItem.IsNote && this.IsNote))) return true;
}
@@ -4132,6 +4224,55 @@ namespace VEPROMS.CSLA.Library
}
}
#endregion
#region EnhancedSupport
public void ClearEnhancedSectionFromSource(int srcId)
{
using (Section ssrc = Section.Get(srcId))
{
SectionConfig ssrcc = ssrc.MyConfig as SectionConfig;
EnhancedDocuments newEds = new EnhancedDocuments();
foreach (EnhancedDocument ed in ssrcc.MyEnhancedDocuments)
{
if (ed.ItemID != ItemID) newEds.Add(ed);
}
if (newEds.Count > 0)
{
ssrcc.MyEnhancedDocuments = null;
ssrcc.MyEnhancedDocuments = newEds;
ssrcc.SaveEnhancedDocuments();
ssrc.MyContent.Config = ssrcc.ToString();
ssrc.Save();
}
}
}
public void ClearEnhancedSectionLink()
{
// for this source section, clear any enhanced flags in connected section
// where the enhanced type is "T", i.e. title only
if (!IsSection) return;
SectionConfig sc = MyConfig as SectionConfig;
if (sc.Section_LnkEnh != "T" || sc.MyEnhancedDocuments == null || sc.MyEnhancedDocuments.Count == 0) return;
foreach (EnhancedDocument ed in sc.MyEnhancedDocuments)
{
using (Section s = Section.Get(ed.ItemID))
{
// have to get config from a SectionInfo, it is null off of this section (not sure why)
SectionInfo si = SectionInfo.Get(ed.ItemID);
SectionConfig esc = si.MyConfig as SectionConfig;
esc.MyEnhancedDocuments.Clear();
esc.SaveEnhancedDocuments();
s.MyContent.Config = esc.ToString();
s.Save();
}
}
sc.Section_LnkEnh = null;
using (Section mysect = Section.Get(ItemID))
{
mysect.MyContent.Config = sc.ToString();
mysect.Save();
}
}
#endregion
#region ParentNoteOrCaution
private bool _ParentNoteOrCautionLoaded = false;
private ItemInfo _ParentNoteOrCaution;
@@ -4246,20 +4387,20 @@ namespace VEPROMS.CSLA.Library
private int? _TemplateColumnMode = null;
public int TemplateColumnMode
{
get
get
{
if (_TemplateColumnMode == null)
{
ItemInfo pi = ActiveParent as ItemInfo;
if (pi != null)
{
if (!pi.IsStep) // only steps are in template
_TemplateColumnMode = -1;
else if (pi.FormatStepData.UseOldTemplate)
_TemplateColumnMode = pi.TemplateChildColumnMode;
else
_TemplateColumnMode = pi.TemplateColumnMode; // go up parents until find of columnmode or section
}
if (!pi.IsStep) // only steps are in template
_TemplateColumnMode = -1;
else if (pi.FormatStepData.UseOldTemplate)
_TemplateColumnMode = pi.TemplateChildColumnMode;
else
_TemplateColumnMode = pi.TemplateColumnMode; // go up parents until find of columnmode or section
}
}
return _TemplateColumnMode ?? -1;
}
@@ -4325,9 +4466,9 @@ namespace VEPROMS.CSLA.Library
// GetSmartTemplateIndex(int topIndx, string strtxt): Added for Calvert Alarms since their
// template also uses the text, not just the type, to find a match in the template.
public int GetSmartTemplateIndex(int topIndx, string strtxt)
public int GetSmartTemplateIndex(int topIndx, string strtxt)
{
string txt = strtxt.Replace(@"\u160?"," ");
string txt = strtxt.Replace(@"\u160?", " ");
if (ActiveFormat == null) return -1;
FormatData formatData = ActiveFormat.PlantFormat.FormatData;
if (formatData.TopTemplateTypes == null || formatData.TopTemplateTypes.Count == 0) return -1;
@@ -4338,7 +4479,7 @@ namespace VEPROMS.CSLA.Library
if (txt == null && formatData.Templates[indx].type == (MyContent.Type - 20001)) return indx;
// now see if we're on the topType, if so, look under this one for the step type
// that we're on, the TEXT ALSO NEEDS TO MATCH. If found return the index of it.
if (txt != null && formatData.Templates[indx].text!=null && (txt.Trim() == formatData.Templates[indx].text.Trim())
if (txt != null && formatData.Templates[indx].text != null && (txt.Trim() == formatData.Templates[indx].text.Trim())
&& ((MyContent.Type - 20001) == formatData.Templates[indx].type)) return indx;
indx++;
}
@@ -4495,7 +4636,7 @@ namespace VEPROMS.CSLA.Library
}
}
#endregion
}
#endregion ItemInfo
#region Tab
@@ -4564,7 +4705,7 @@ namespace VEPROMS.CSLA.Library
get
{
// this trims off any symbols at the start of the tab
return _ReplaceSymbols.Replace(CleanText, "").Replace("#","");
return _ReplaceSymbols.Replace(CleanText, "").Replace("#", "");
}
}
@@ -5373,7 +5514,7 @@ namespace VEPROMS.CSLA.Library
public string TranCategory { get { return _TranCategory; } }
// added stepTypeList parameter to allow a transition search is selected step elements (B2015-055)
private string _StepTypeList;
public string StepTypeList { get { return _StepTypeList;} }
public string StepTypeList { get { return _StepTypeList; } }
public ItemListTransitionSearchCriteria(string docVersionList, int tranType, string tranCategory, string stepTypeList)
{
_DocVersionList = docVersionList;
@@ -5635,6 +5776,7 @@ namespace VEPROMS.CSLA.Library
[Serializable()]
public partial class ProcedureInfo : ItemInfo, IVEDrillDownReadOnly
{
public bool CreateEnhanced = false;
public string PDFNumber
{
get
@@ -5718,27 +5860,27 @@ namespace VEPROMS.CSLA.Library
public new Procedure Get()
{
return (Procedure)(_Editable = Procedure.Get(ItemID));
}
}
//public static void RefreshTransitions(ProcedureInfo tmp)
//{
// RefreshTransitions(tmp, null, null);
//}
public static void RefreshTransitions(ProcedureInfo tmp)//, TransitionInfoList transitionToDisconnected, TransitionInfoList transitionsToNonEditable)
{
{
//TransitionsToDisconnected = transitionToDisconnected;
//TransitionsToNonEditable = transitionsToNonEditable;
TransitionLookup tranLookup = new TransitionLookup(0, tmp.ItemID, tmp.MyLookup);
tranLookup.ApplicabilityUnit = tmp.MyDocVersion.DocVersionConfig.SelectedSlave;
tranLookup.NewLookupNeeded += new TransitionLookupEvent(GetNewLookup);
if (tmp.MyDocVersion.DocVersionConfig.SelectedSlave <= 0)
MyRefreshTransitions(tmp, tmp.MyDocVersion, null, tmp, tmp.MyDocVersion, tranLookup);
}
public static void RefreshReferenceObjects(ProcedureInfo tmp)
{
if (tmp.MyDocVersion.DocVersionConfig.SelectedSlave <= 0)
MyRefreshReferenceObjects(tmp, tmp.MyDocVersion, null, tmp.MyDocVersion);
}
public static void RefreshPageNumTransitions(ProcedureInfo tmp)
TransitionLookup tranLookup = new TransitionLookup(0, tmp.ItemID, tmp.MyLookup);
tranLookup.ApplicabilityUnit = tmp.MyDocVersion.DocVersionConfig.SelectedSlave;
tranLookup.NewLookupNeeded += new TransitionLookupEvent(GetNewLookup);
if (tmp.MyDocVersion.DocVersionConfig.SelectedSlave <= 0)
MyRefreshTransitions(tmp, tmp.MyDocVersion, null, tmp, tmp.MyDocVersion, tranLookup);
}
public static void RefreshReferenceObjects(ProcedureInfo tmp)
{
if (tmp.MyDocVersion.DocVersionConfig.SelectedSlave <= 0)
MyRefreshReferenceObjects(tmp, tmp.MyDocVersion, null, tmp.MyDocVersion);
}
public static void RefreshPageNumTransitions(ProcedureInfo tmp)
{
TransitionLookup tranLookup = new TransitionLookup(0, tmp.ItemID, tmp.MyLookup);
tranLookup.ApplicabilityUnit = tmp.MyDocVersion.DocVersionConfig.SelectedSlave;
@@ -6023,9 +6165,9 @@ namespace VEPROMS.CSLA.Library
{
Database.LogException("ItemInfoList.DataPortal_Fetch", ex);
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
}
MyLookup = lookup;
}
}
MyLookup = lookup;
}
}
[Serializable()]
public class ProcedureTransitionsCountCommand : CommandBase
@@ -6144,7 +6286,7 @@ namespace VEPROMS.CSLA.Library
private bool? _HasStepCheckOffs = null;
public bool HasStepCheckOffs
{
get
get
{
if (_HasStepCheckOffs == null)
{
@@ -6152,7 +6294,7 @@ namespace VEPROMS.CSLA.Library
//Console.WriteLine("{0},'{1}','{2}'", ItemID, ShortPath, _HasStepCheckOffs);
}
return (bool)_HasStepCheckOffs;
}
}
}
public bool HasInitials
{
@@ -6166,10 +6308,10 @@ namespace VEPROMS.CSLA.Library
private static bool GetStepCheckOff(ItemInfo ii)
{
if (ii is StepInfo && ((ii as StepInfo).MyConfig as StepConfig).Step_CheckOffIndex > 1) return true;
if(ii.MyContent.ContentParts != null)
foreach(PartInfo pi in ii.MyContent.ContentParts)
foreach(ItemInfo iic in pi.MyItems)
if(GetStepCheckOff(iic)) return true;
if (ii.MyContent.ContentParts != null)
foreach (PartInfo pi in ii.MyContent.ContentParts)
foreach (ItemInfo iic in pi.MyItems)
if (GetStepCheckOff(iic)) return true;
return false;
}
//private int? _TemplateColumnMode
@@ -6242,7 +6384,7 @@ namespace VEPROMS.CSLA.Library
if (Int32.TryParse(tmpstr, out x)) return x;
// flag the case where the current section's tab already has prefixed in the parent's tab:
// (without this, BGE's section headers were coming up as 6.1.6.1.1...)
if (IsSection && ActiveParent.IsSection)
if (IsSection && ActiveParent.IsSection)
{
if (DisplayNumber.StartsWith((ActiveParent as SectionInfo).DisplayNumber.Trim())) return -2;
}