B2017-045: Allow copy of enhanced step pasted to non-enhanced section removing enhanced link data
This commit is contained in:
parent
88383ec87f
commit
95f4767651
@ -1657,6 +1657,7 @@ namespace VEPROMS.CSLA.Library
|
||||
ctmp.Config = config;
|
||||
ctmp.Save();
|
||||
ContentInfo.Refresh(ctmp);
|
||||
tmp._MyConfig = null; // refresh the memory value
|
||||
}
|
||||
}
|
||||
if (tmp.IsHigh)
|
||||
|
@ -529,6 +529,7 @@ namespace VEPROMS.CSLA.Library
|
||||
tmp.UpdateTransitionText();
|
||||
tmp.UpdatePastedStepTransitionText();
|
||||
PasteSetChangeId(tmp, chgid);
|
||||
PasteClearEnhanced(tmp);
|
||||
OnNewChild(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Child));
|
||||
return tmp;
|
||||
}
|
||||
@ -578,6 +579,7 @@ namespace VEPROMS.CSLA.Library
|
||||
tmp.UpdateROText();
|
||||
tmp.UpdatePastedStepTransitionText();
|
||||
PasteSetChangeId(tmp, chgid);
|
||||
PasteClearEnhanced(tmp);
|
||||
OnNewSiblingBefore(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Before));
|
||||
return tmp;
|
||||
}
|
||||
@ -608,6 +610,7 @@ namespace VEPROMS.CSLA.Library
|
||||
tmp.UpdateROText();
|
||||
tmp.UpdatePastedStepTransitionText();
|
||||
PasteSetChangeId(tmp, chgid);
|
||||
PasteClearEnhanced(tmp);
|
||||
OnNewSiblingAfter(new ItemInfoInsertEventArgs(tmp, EAddpingPart.After));
|
||||
return tmp;
|
||||
}
|
||||
@ -867,6 +870,23 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void PasteClearEnhanced(ItemInfo pasteItem)
|
||||
{
|
||||
// B2017-045: if a copied step has enhanced link config data and pasted step should not have it, clear it:
|
||||
// check if the pasted item should have enhanced data. If the copied data has enhanced config data and
|
||||
// it is pasted into a section without enhanced data, then clear it.
|
||||
|
||||
// config data can only be on hls/notes/cautions for pasted steps.
|
||||
if (!pasteItem.IsHigh && !pasteItem.IsCaution && !pasteItem.IsNote) return;
|
||||
|
||||
// See if the pasted step's section is enhanced with enhanced steps, and if not, clear it
|
||||
if (!pasteItem.ActiveSection.IsEnhancedSection && !pasteItem.ActiveSection.IsEnhancedSectionTitleOnly)
|
||||
{
|
||||
// the RemoveEnhancedFromConfig method clears from the pasted step and any cautions/notes that may be off
|
||||
// of the pasted step.
|
||||
if (pasteItem.HasEnhancedLinkedStep) ItemInfo.RemoveEnhancedFromConfig(pasteItem);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Insert Child
|
||||
public ItemInfo InsertChild(E_FromType fromType, int type, string text)
|
||||
@ -2324,6 +2344,7 @@ namespace VEPROMS.CSLA.Library
|
||||
ItemInfo.DeleteItemInfoAndChildren(itemInfo.ItemID); // Dispose ItemInfo and Children
|
||||
using (Item item = Get(newItemInfo.ItemID)) ItemInfo.Refresh(item);
|
||||
ItemInfo.PasteSetChangeId(newItemInfo, chgid);
|
||||
ItemInfo.PasteClearEnhanced(newItemInfo);
|
||||
if (newItemInfo.NextItem != null) using (Item item = newItemInfo.NextItem.Get()) ItemInfo.Refresh(item);
|
||||
newItemInfo.RefreshNextItems();
|
||||
// if inserting after a caution or note, refreshes tabs. This will adjust bullets
|
||||
|
@ -1681,11 +1681,6 @@ namespace Volian.Controls.Library
|
||||
if (stepToCfg.MyEnhancedDocuments != null && stepToCfg.MyEnhancedDocuments.Count > 0 && stepToCfg.MyEnhancedDocuments[0].Type != 0) toSourceHasEnhancedLinks = true;
|
||||
}
|
||||
}
|
||||
if ((!MyItemInfo.IsEnhancedSection && !MyItemInfo.IsEnhancedStep && !toSourceHasEnhancedLinks) && fromSourceHasEnhancedLinks)
|
||||
{
|
||||
SetPasteButtons(false);
|
||||
return;
|
||||
}
|
||||
// enhanced: if 'from' step is not enhanced, only allow paste before/after
|
||||
if (MyItemInfo.IsHigh && !MyItemInfo.IsEnhancedStep)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user