Use template for inserting steps for Callaway Backgrounds
CALBCK format flag
This commit is contained in:
parent
4b7c3ee5d8
commit
062cf39e53
@ -284,7 +284,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
public ItemInfo InsertSiblingBefore(string text, string number)
|
public ItemInfo InsertSiblingBefore(string text, string number)
|
||||||
{
|
{
|
||||||
ItemInfo tmp = null;
|
ItemInfo tmp = null;
|
||||||
if (!IsSection && (FormatStepData.UseSmartTemplate || MyHLS.FormatStepData.UseSmartTemplate))
|
if (!IsSection && (FormatStepData.UseSmartTemplate || MyHLS.FormatStepData.UseSmartTemplate || FormatStepData.UseOldTemplate))
|
||||||
tmp = InsertSmartTemplateSteps(text, number, tmp, EAddpingPart.Before, (int)MyContent.Type);
|
tmp = InsertSmartTemplateSteps(text, number, tmp, EAddpingPart.Before, (int)MyContent.Type);
|
||||||
else
|
else
|
||||||
tmp = NewItemInfoFetch(ItemID, EAddpingPart.Before, number, text, null, null, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
tmp = NewItemInfoFetch(ItemID, EAddpingPart.Before, number, text, null, null, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
||||||
@ -302,34 +302,54 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private ItemInfo InsertSmartTemplateSteps(string text, string number, ItemInfo tmp, EAddpingPart adPart, int type)
|
private ItemInfo InsertSmartTemplateSteps(string text, string number, ItemInfo tmp, EAddpingPart adPart, int type)
|
||||||
{
|
{
|
||||||
int newItemID = 0;
|
int newItemID = 0;
|
||||||
// this step type may be a template step, if so, we need to put out edit windows for
|
int topType = GetSmartTemplateTopLevelIndx();
|
||||||
// the template, by making these 'empty' (one space) steps:
|
if (topType == -1) return null;
|
||||||
int tpIndx = GetSmartTemplateIndex();
|
int tpIndx = GetSmartTemplateIndex(topType, (int)MyContent.Type);
|
||||||
if (tpIndx != -1)
|
if (tpIndx != -1)
|
||||||
{
|
{
|
||||||
bool firstInsert = true;
|
ItemInfo siblingSmart = null;
|
||||||
ItemInfo tmpSmart = null;
|
ItemInfo firstSmart = null;
|
||||||
ItemInfo subSmart = null;
|
|
||||||
int level = FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].level;
|
int level = FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].level;
|
||||||
|
string tmptext = FormatStepData.MyFormat.PlantFormat.FormatData.NewTemplateFormat?text:FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].text;
|
||||||
|
int prevlevel = level;
|
||||||
while (level > 0)
|
while (level > 0)
|
||||||
{
|
{
|
||||||
if (firstInsert)
|
if (firstSmart == null)
|
||||||
{
|
{
|
||||||
subSmart = NewItemInfoFetch(ItemID, adPart, number, text, type, null, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
firstSmart = NewItemInfoFetch(ItemID, adPart, number, tmptext, type, null, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
||||||
tmpSmart = subSmart;
|
siblingSmart = firstSmart;
|
||||||
firstInsert = false;
|
newItemID = firstSmart.ItemID;
|
||||||
newItemID = subSmart.ItemID;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmp = NewItemInfoFetch(newItemID, EAddpingPart.Child, null, " ", FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].type + 20001, (int?)E_FromType.Step, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
E_FromType fromType = E_FromType.Step;
|
||||||
|
EAddpingPart addPart = EAddpingPart.Child; // level > previous, add a child.
|
||||||
|
if (level == prevlevel) addPart = EAddpingPart.After;
|
||||||
|
if (level < prevlevel)
|
||||||
|
{
|
||||||
|
if (FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].type == 39)
|
||||||
|
{
|
||||||
|
fromType = E_FromType.RNO;
|
||||||
|
addPart = EAddpingPart.Child;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
addPart = EAddpingPart.After;
|
||||||
|
}
|
||||||
|
newItemID = siblingSmart.ItemID;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmptext = FormatStepData.MyFormat.PlantFormat.FormatData.NewTemplateFormat ? " ": FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].text;
|
||||||
|
tmp = NewItemInfoFetch(newItemID, addPart, null, tmptext, FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].type + 20001, (int ?)fromType, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
||||||
newItemID = tmp.ItemID;
|
newItemID = tmp.ItemID;
|
||||||
|
if (level < prevlevel) siblingSmart = tmp;
|
||||||
}
|
}
|
||||||
tpIndx++;
|
tpIndx++;
|
||||||
|
prevlevel = level;
|
||||||
level = tpIndx < FormatStepData.MyFormat.PlantFormat.FormatData.Templates.Count ?
|
level = tpIndx < FormatStepData.MyFormat.PlantFormat.FormatData.Templates.Count ?
|
||||||
FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].level : -1;
|
FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].level : -1;
|
||||||
}
|
}
|
||||||
tmp = tmpSmart;
|
tmp = firstSmart;
|
||||||
}
|
}
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
@ -427,7 +447,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
public ItemInfo InsertSiblingAfter(string text, string number, int? type)
|
public ItemInfo InsertSiblingAfter(string text, string number, int? type)
|
||||||
{
|
{
|
||||||
ItemInfo tmp = null;
|
ItemInfo tmp = null;
|
||||||
if (!IsSection &&(FormatStepData.UseSmartTemplate || MyHLS.FormatStepData.UseSmartTemplate))
|
if (!IsSection && (FormatStepData.UseSmartTemplate || MyHLS.FormatStepData.UseSmartTemplate || FormatStepData.UseOldTemplate))
|
||||||
tmp = InsertSmartTemplateSteps(text, number, tmp, EAddpingPart.After, (int)MyContent.Type);
|
tmp = InsertSmartTemplateSteps(text, number, tmp, EAddpingPart.After, (int)MyContent.Type);
|
||||||
else
|
else
|
||||||
tmp = NewItemInfoFetch(ItemID, EAddpingPart.After, number, text, type, null, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
tmp = NewItemInfoFetch(ItemID, EAddpingPart.After, number, text, type, null, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
||||||
|
@ -194,6 +194,33 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return LazyLoad(ref _TPL, "@TPL");
|
return LazyLoad(ref _TPL, "@TPL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private bool _NewTemplateFormat;
|
||||||
|
public bool NewTemplateFormat
|
||||||
|
{
|
||||||
|
get { return _NewTemplateFormat; }
|
||||||
|
set { _NewTemplateFormat = value; }
|
||||||
|
}
|
||||||
|
private Dictionary<int, int> _TopTemplateTypes;
|
||||||
|
public Dictionary<int, int> TopTemplateTypes
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_TopTemplateTypes == null)
|
||||||
|
{
|
||||||
|
_TopTemplateTypes = new Dictionary<int, int>();
|
||||||
|
// loop through all of templates to find those that are top level, i.e.
|
||||||
|
// right below the '0'.
|
||||||
|
int indx = 0;
|
||||||
|
while (indx < Templates.Count)
|
||||||
|
{
|
||||||
|
// level of 0 starts a new group.
|
||||||
|
if (Templates[indx].level == 0) TopTemplateTypes[Templates[indx + 1].type] = indx+1;
|
||||||
|
indx++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _TopTemplateTypes;
|
||||||
|
}
|
||||||
|
}
|
||||||
private List<TPlate> _Templates;
|
private List<TPlate> _Templates;
|
||||||
public List<TPlate> Templates
|
public List<TPlate> Templates
|
||||||
{
|
{
|
||||||
@ -201,7 +228,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
if (_Templates == null) // Load template class from format's string data.
|
if (_Templates == null) // Load template class from format's string data.
|
||||||
{
|
{
|
||||||
bool oldformat = true;
|
NewTemplateFormat = false;
|
||||||
// count newlines - which gives number of template records.
|
// count newlines - which gives number of template records.
|
||||||
int NumTemplates = 0;
|
int NumTemplates = 0;
|
||||||
int indx = TPL.IndexOf('\n');
|
int indx = TPL.IndexOf('\n');
|
||||||
@ -214,7 +241,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
|
|
||||||
_Templates = new List<TPlate>(NumTemplates);
|
_Templates = new List<TPlate>(NumTemplates);
|
||||||
// for each item, create and add to list
|
// for each item, create and add to list
|
||||||
if (TPL.IndexOf(',') > -1) oldformat = false;
|
if (TPL.IndexOf(',') > -1) NewTemplateFormat = true;
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
|
|
||||||
int tmpStrIndxStart = 0;
|
int tmpStrIndxStart = 0;
|
||||||
@ -231,7 +258,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
int nocol = 0;
|
int nocol = 0;
|
||||||
int row = 0;
|
int row = 0;
|
||||||
string stmp = null;
|
string stmp = null;
|
||||||
if (oldformat)
|
if (!NewTemplateFormat)
|
||||||
{
|
{
|
||||||
string[] tmpOld = tpl.Split(" ".ToCharArray());
|
string[] tmpOld = tpl.Split(" ".ToCharArray());
|
||||||
level = Convert.ToInt32(tmpOld[0]);
|
level = Convert.ToInt32(tmpOld[0]);
|
||||||
@ -3669,6 +3696,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return LazyLoad(ref _UseSmartTemplate, "@UseSmartTemplate");
|
return LazyLoad(ref _UseSmartTemplate, "@UseSmartTemplate");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private LazyLoad<bool> _UseOldTemplate;
|
||||||
|
public bool UseOldTemplate
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return LazyLoad(ref _UseOldTemplate, "@UseOldTemplate");
|
||||||
|
}
|
||||||
|
}
|
||||||
private LazyLoad<bool> _AlwaysUseExtraLines;
|
private LazyLoad<bool> _AlwaysUseExtraLines;
|
||||||
public bool AlwaysUseExtraLines
|
public bool AlwaysUseExtraLines
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user