Enhanced Documents, handle enhanced steps

Enhanced Documents, delete items
Enhanced Documents button disable/enable
Enhanced Documents, tree view support for insert/delete/copy-paste
Move DisplayText.cs to CSLA
Enhanced Documents adding links (method added in docversion)
This commit is contained in:
2016-01-20 16:46:31 +00:00
parent 6366af8b47
commit 1e3324aa7b
8 changed files with 488 additions and 145 deletions

View File

@@ -314,6 +314,7 @@ namespace Volian.Controls.Library
/// <param name="myItemInfo">Item to Expand</param>
private void ExpandAsNeeded(ItemInfo myItemInfo)
{
int id = myItemInfo.ItemID;
if (!_LookupEditItems.ContainsKey(id)) // If the item is not currently displayed
ExpandAsNeeded((ItemInfo)myItemInfo.ActiveParent); // Expand it's parent
@@ -465,6 +466,33 @@ namespace Volian.Controls.Library
}
if (shouldDelete)
{
// if this item has enhanced edititems, remove them. Note that this code supports
// deleting text in an rtbitem that may be a step or section level.
EnhancedDocuments eds = null;
StepConfig sc = lastEI.MyItemInfo.MyConfig as StepConfig;
if (sc != null) eds = sc.MyEnhancedDocuments;
else
{
// if a section, just the title or all contents may be linked. If just title,
// don't delete enhanced, but clear links back from enhanced.
if (lastEI.MyItemInfo.IsSection)
{
SectionConfig sec = lastEI.MyItemInfo.MyConfig as SectionConfig;
if (sec != null)
{
if (sec.Section_LnkEnh == "Y") eds = sec.MyEnhancedDocuments;
else lastEI.MyItemInfo.ClearEnhancedSectionLink();
}
}
}
List<int> enhIds = new List<int>();
if (eds != null)
{
foreach (EnhancedDocument ed in eds)
{
if (ed.Type != 0) enhIds.Add(ed.ItemID);
}
}
float oldTop = lastEI.Top;
EditItem newFocus = lastEI.DeleteItem();
float newTop = newFocus.Top;
@@ -494,6 +522,13 @@ namespace Volian.Controls.Library
}
else
newFocus.AdjustLocation();
foreach (int enhId in enhIds)
{
ItemInfo ii = ItemInfo.Get(enhId);
bool success = MyStepTabPanel.MyDisplayTabControl.DeleteRTBItem(ii);
if (!success) // item was not displayed in editor, just delete from database (add tree if necessarY)
Item.DeleteItemAndChildren(ii);
}
}
else
{