B2017-014: Adding a sub-section where section has steps creates 2 section part nodes in the tree

This commit is contained in:
Kathy Ruffing 2018-08-21 13:22:06 +00:00
parent 49b8eaa5eb
commit c257f4b4bb

View File

@ -2447,11 +2447,10 @@ namespace Volian.Controls.Library
// Note that this check has to be done before the section is made, otherwise the item will
// have sections, i.e. the one getting added.
bool doPseudo = false;
if (_LastItemInfo.IsSection) // if adding off of a procedure, don't add pseuo.
if (_LastItemInfo.IsSection) // if adding off of a procedure, don't add pseudo.
{
if (SelectedNode.Nodes.Count == 0)
doPseudo = true;
else if (SelectedNode.Nodes.Count > 0)
// B2017-014: removed code that was adding a 2nd section part node.
if (SelectedNode.Nodes.Count > 0)
{
// if inserting from a section that has steps, but no subsections, prompt user to let them
// know that the steps will not be visible after the subsection insert (C2016-042):
@ -2495,48 +2494,14 @@ namespace Volian.Controls.Library
if (SelectedNode.Nodes.Count>0)
{
VETreeNode vtn = SelectedNode.Nodes[0] as VETreeNode;
ItemInfo ichld1 = null;
if (vtn != null) ichld1 = vtn.VEObject as ItemInfo;
//ItemInfo ichld1 = (SelectedNode.Nodes[0] as VETreeNode).VEObject as ItemInfo;
if (ichld1 != null && ichld1.IsStep)
{
// find associated part node:
foreach (PartInfo pi in ii.MyContent.ContentParts)
{
if (pi.FromType == (int)E_FromType.Step)
{
// A 'Steps' pseudo node must be added and any existing steps
// must be moved below it:
VETreeNode tnStepPart = new VETreeNode(ii.MyContent.ContentParts[cpindx]);
foreach (TreeNode tnc in SelectedNode.Nodes)
{
TreeNode cloned = (TreeNode)tnc.Clone();
tnStepPart.Nodes.Add(cloned);
}
SelectedNode.Nodes.Clear();
SelectedNode.Nodes.Add(tnStepPart);
break;
}
cpindx++;
}
}
// B2017-014: removed code that was adding a 2nd section part node. and also select node to
// refresh display
if (vtn.FirstNode != null) OnNodeSelect(this, new vlnTreeEventArgs(vtn.FirstNode));
}
// At this level, there will only be 'Steps' or 'Sections' nodes. So, use
// the ContentParts[indx] that was not used to create the pseudo node.
if (cpindx == 1) cpindx = 0;
VETreeNode tnPart = new VETreeNode(ii.MyContent.ContentParts[cpindx]);
SelectedNode.Nodes.Add(tnPart);
tn = new VETreeNode(_LastSectionInfo);
tnPart.Nodes.Add(tn); // add tree node to end of list.
// if the new section was flagged as either having an enhanced link for Title or Contents, create the
// Enhanced section:
Section sectiontmp = Section.Get(section.ItemID); // need to do this because of 'caching' problem.
if (sectiontmp.SectionConfig.LinkEnhanced == "T" || sectiontmp.SectionConfig.LinkEnhanced == "Y")
CreateEnhancedForSection(newtype, sectiontmp, savLastSectionInfo, sectiontmp.DisplayNumber, sectiontmp.MyContent.Text);
sectiontmp.Dispose();
// B2017-014: removed code that was adding a 2nd section part node.
}
}
else
else // Properties was canceled out of:
s1 = section.ItemID;
}
if (s1 != -1)