B2017-045: Allow copy of enhanced step pasted to non-enhanced section removing enhanced link data

This commit is contained in:
Kathy Ruffing 2017-08-23 12:12:57 +00:00
parent 88383ec87f
commit 95f4767651
3 changed files with 22 additions and 5 deletions

View File

@ -1657,6 +1657,7 @@ namespace VEPROMS.CSLA.Library
ctmp.Config = config; ctmp.Config = config;
ctmp.Save(); ctmp.Save();
ContentInfo.Refresh(ctmp); ContentInfo.Refresh(ctmp);
tmp._MyConfig = null; // refresh the memory value
} }
} }
if (tmp.IsHigh) if (tmp.IsHigh)

View File

@ -529,6 +529,7 @@ namespace VEPROMS.CSLA.Library
tmp.UpdateTransitionText(); tmp.UpdateTransitionText();
tmp.UpdatePastedStepTransitionText(); tmp.UpdatePastedStepTransitionText();
PasteSetChangeId(tmp, chgid); PasteSetChangeId(tmp, chgid);
PasteClearEnhanced(tmp);
OnNewChild(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Child)); OnNewChild(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Child));
return tmp; return tmp;
} }
@ -578,6 +579,7 @@ namespace VEPROMS.CSLA.Library
tmp.UpdateROText(); tmp.UpdateROText();
tmp.UpdatePastedStepTransitionText(); tmp.UpdatePastedStepTransitionText();
PasteSetChangeId(tmp, chgid); PasteSetChangeId(tmp, chgid);
PasteClearEnhanced(tmp);
OnNewSiblingBefore(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Before)); OnNewSiblingBefore(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Before));
return tmp; return tmp;
} }
@ -608,6 +610,7 @@ namespace VEPROMS.CSLA.Library
tmp.UpdateROText(); tmp.UpdateROText();
tmp.UpdatePastedStepTransitionText(); tmp.UpdatePastedStepTransitionText();
PasteSetChangeId(tmp, chgid); PasteSetChangeId(tmp, chgid);
PasteClearEnhanced(tmp);
OnNewSiblingAfter(new ItemInfoInsertEventArgs(tmp, EAddpingPart.After)); OnNewSiblingAfter(new ItemInfoInsertEventArgs(tmp, EAddpingPart.After));
return tmp; 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 #endregion
#region Insert Child #region Insert Child
public ItemInfo InsertChild(E_FromType fromType, int type, string text) 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 ItemInfo.DeleteItemInfoAndChildren(itemInfo.ItemID); // Dispose ItemInfo and Children
using (Item item = Get(newItemInfo.ItemID)) ItemInfo.Refresh(item); using (Item item = Get(newItemInfo.ItemID)) ItemInfo.Refresh(item);
ItemInfo.PasteSetChangeId(newItemInfo, chgid); ItemInfo.PasteSetChangeId(newItemInfo, chgid);
ItemInfo.PasteClearEnhanced(newItemInfo);
if (newItemInfo.NextItem != null) using (Item item = newItemInfo.NextItem.Get()) ItemInfo.Refresh(item); if (newItemInfo.NextItem != null) using (Item item = newItemInfo.NextItem.Get()) ItemInfo.Refresh(item);
newItemInfo.RefreshNextItems(); newItemInfo.RefreshNextItems();
// if inserting after a caution or note, refreshes tabs. This will adjust bullets // if inserting after a caution or note, refreshes tabs. This will adjust bullets

View File

@ -1681,11 +1681,6 @@ namespace Volian.Controls.Library
if (stepToCfg.MyEnhancedDocuments != null && stepToCfg.MyEnhancedDocuments.Count > 0 && stepToCfg.MyEnhancedDocuments[0].Type != 0) toSourceHasEnhancedLinks = true; 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 // enhanced: if 'from' step is not enhanced, only allow paste before/after
if (MyItemInfo.IsHigh && !MyItemInfo.IsEnhancedStep) if (MyItemInfo.IsHigh && !MyItemInfo.IsEnhancedStep)
{ {