B2020-107: Add missing options to Search’s Save & Load
This commit is contained in:
parent
79d16a33a7
commit
9142e7b168
@ -1406,6 +1406,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if (MyHLS == null) return 0;
|
||||
return MyHLS.GetMaxRNOLevelsFromChildren;
|
||||
}
|
||||
}
|
||||
@ -2622,7 +2623,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
string dtext = ConvertToDisplayText(Regex.Replace(_SearchPath ?? "", "\x11.*?\x07", "\x07"));
|
||||
string dtext = ConvertToDisplayText(Regex.Replace(SearchPath ?? "", "\x11.*?\x07", "\x07"));
|
||||
if (IsFigure && dtext.EndsWith("Table.")) dtext = dtext.Substring(0, dtext.Length - "Table.".Length) + "Figure.";
|
||||
else if (IsRtfRaw && dtext.EndsWith("Table.") && FormatStepData.Type.Contains("Equation")) dtext = dtext.Substring(0, dtext.Length - "Table.".Length) + "Equation.";
|
||||
return dtext;
|
||||
|
@ -961,6 +961,10 @@ namespace Volian.Controls.Library
|
||||
//
|
||||
//
|
||||
//
|
||||
this.galSymbols.TitleMouseOverStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
//
|
||||
//
|
||||
//
|
||||
this.galSymbols.TitleStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
//
|
||||
// buttonItem1
|
||||
|
@ -408,7 +408,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
_TimeActivity.Open();
|
||||
TmrRefresh.Enabled = false;
|
||||
AdvTreeStepTypesFillIn();
|
||||
if (!_fromLoad)AdvTreeStepTypesFillIn(); // Don't reload if coming from Load - this overwrites the load settings
|
||||
_TimeActivity.Close();
|
||||
}
|
||||
public void StartAdvTreeStepTypesFillIn()// B2016-258 Hang after selecting a procedure if the Step Type panel is open on the search panel
|
||||
@ -543,6 +543,7 @@ namespace Volian.Controls.Library
|
||||
topnode = new DevComponents.AdvTree.Node();
|
||||
topnode.Text = "Available Procedure Sets";
|
||||
topnode.Tag = fi;
|
||||
topnode.DataKey = fi.FolderID;
|
||||
advTreeProcSets.Nodes.Add(topnode);
|
||||
//advTreeProcSets.AfterNodeInsert += new TreeNodeCollectionEventHandler(advTreeProcSets_AfterNodeInsert);
|
||||
|
||||
@ -553,6 +554,7 @@ namespace Volian.Controls.Library
|
||||
DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node();
|
||||
newnode.Text = fic.ToString();
|
||||
newnode.Tag = fic;
|
||||
newnode.DataKey = fi.FolderID;
|
||||
AddCheckBox(true, newnode);//C2016-045 Allow Folders to be selected.
|
||||
cntnd++;
|
||||
if (fic.ChildFolderCount > 0 || fic.FolderDocVersionCount > 0) // allow for '+' for tree expansion
|
||||
@ -572,6 +574,7 @@ namespace Volian.Controls.Library
|
||||
DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node();
|
||||
newnode.Text = fi.ToString();
|
||||
newnode.Tag = fi;
|
||||
newnode.DataKey = fi.FolderID;
|
||||
AddCheckBox(true, newnode);//C2016-045 Allow Folders to be selected.
|
||||
topnode.Nodes.Add(newnode);
|
||||
lstCheckedDocVersions.Add(Mydocversion);
|
||||
@ -586,6 +589,7 @@ namespace Volian.Controls.Library
|
||||
topnode.Text = fi.ToString();
|
||||
advTreeProcSets.Nodes.Add(topnode);
|
||||
topnode.Tag = fi;
|
||||
topnode.DataKey = fi.FolderID;
|
||||
}
|
||||
|
||||
advTreeProcSets.BeforeExpand += new DevComponents.AdvTree.AdvTreeNodeCancelEventHandler(advTreeProcSets_BeforeExpand);
|
||||
@ -633,6 +637,7 @@ namespace Volian.Controls.Library
|
||||
DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node();
|
||||
newnode.Text = fic.ToString();
|
||||
newnode.Tag = fic;
|
||||
newnode.DataKey = fic.FolderID;
|
||||
par.Nodes.Add(newnode);
|
||||
AddCheckBox(true, newnode);//C2016-045 Allow Folders to be selected.
|
||||
newnode.Enabled = true;
|
||||
@ -1354,6 +1359,7 @@ namespace Volian.Controls.Library
|
||||
|
||||
private void btnSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
_fromLoad = false;
|
||||
DateTime start = DateTime.Now;
|
||||
Cursor savcursor = Cursor;
|
||||
// keeps track of index into combo box for results style. This combo box may have 3 or 4
|
||||
@ -1858,6 +1864,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
xpStepTypes.TitleStyle.BackColor1.Color = saveXpStepTypeTitleColor;
|
||||
DevComponents.AdvTree.Node n = advTreeStepTypes.SelectedNode;
|
||||
if (n == null) return;
|
||||
StepData sd = (StepData)n.Tag;
|
||||
if (n.Checked)
|
||||
{
|
||||
@ -2150,15 +2157,24 @@ namespace Volian.Controls.Library
|
||||
_SearchResults = null;
|
||||
DisplayResults();
|
||||
}
|
||||
|
||||
// A timer updated the step type tree but if it was loaded from xml the timer update overwrite what
|
||||
// was loaded in from the xml file. Added a flag that gets set on load and set to false on new Search
|
||||
private bool _fromLoad = false;
|
||||
private void btnLoadSearchResults_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
_fromLoad = true;
|
||||
if (ofdSearchResults.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
|
||||
lbSrchResults.DataSource = null;
|
||||
lbSrchResults.Items.Clear();
|
||||
toolTip1.SetToolTip(lbSrchResults, null);
|
||||
Cursor = Cursors.WaitCursor;
|
||||
string unitPrefix = "";
|
||||
if (Mydocversion != null)
|
||||
unitPrefix = Mydocversion.DocVersionConfig.Unit_ProcedureNumber;
|
||||
if (unitPrefix.EndsWith("#"))
|
||||
unitPrefix = unitPrefix.Replace("#", "");
|
||||
SearchResults = ItemInfoList.GetByContentID(0);
|
||||
int k = ofdSearchResults.FilterIndex;
|
||||
switch (k)
|
||||
@ -2167,24 +2183,84 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
|
||||
xd.Load(ofdSearchResults.FileName);
|
||||
// B2020-107: Add missing attributes/nodes for loading of search results, include procsets & steptypes:
|
||||
System.Xml.XmlNodeList nlp = xd.SelectNodes("search/procsets/set");
|
||||
if (nlp != null)
|
||||
{
|
||||
DocVersionInfo tmpdvi = Mydocversion;
|
||||
DocVersionInfo fromLoadFiledvi = null;
|
||||
foreach (System.Xml.XmlNode nd in nlp)
|
||||
{
|
||||
int folderID = int.Parse(nd.Attributes.GetNamedItem("fid").InnerText);
|
||||
FolderInfo fi = FolderInfo.Get(folderID);
|
||||
_MyDocVersion = fi.FolderDocVersions[0];
|
||||
if (fromLoadFiledvi == null) fromLoadFiledvi = _MyDocVersion;
|
||||
advTreeProcSetsPreSelect();
|
||||
}
|
||||
foreach (System.Xml.XmlNode nd in nlp)
|
||||
{
|
||||
int folderID = int.Parse(nd.Attributes.GetNamedItem("fid").InnerText);
|
||||
FolderInfo fi = FolderInfo.Get(folderID);
|
||||
Node tnode = advTreeProcSets.FindNodeByDataKey(folderID);
|
||||
if (tnode != null) tnode.Checked = true;
|
||||
}
|
||||
Mydocversion = tmpdvi == null ? fromLoadFiledvi : tmpdvi;
|
||||
}
|
||||
AdvTreeStepTypesFillIn();
|
||||
System.Xml.XmlNodeList nl1 = xd.SelectNodes("search/StepType/type");
|
||||
if (nl1 != null)
|
||||
{
|
||||
foreach (System.Xml.XmlNode nd in nl1)
|
||||
{
|
||||
string stptype = nd.Attributes.GetNamedItem("str").InnerText;
|
||||
Node tnode = advTreeStepTypes.FindNodeByText(stptype);
|
||||
if (tnode != null)
|
||||
{
|
||||
tnode.Checked = true;
|
||||
xpStepTypes.TitleStyle.BackColor1.Color = saveXpStepTypeTitleColor;
|
||||
lstCheckedStepTypesStr.Add(stptype);
|
||||
StepData sd = (StepData)tnode.Tag;
|
||||
lstCheckedStepTypes.Add((int)sd.Index);
|
||||
}
|
||||
}
|
||||
string typstr = null;
|
||||
foreach (string s in lstCheckedStepTypesStr) typstr = typstr == null ? s : typstr + ", " + s;
|
||||
TypesSelected = "Filtered By: " + ((typstr != null) ? typstr : "All Step Types");
|
||||
ReportTitle = "Step Element Report"; //"Proms - Search by Type: " + typstr;
|
||||
TypesSelected = "Filtered By: " + typstr;
|
||||
advTreeStepTypes.RefreshItems();
|
||||
buildStepTypePannelTitle();
|
||||
}
|
||||
cmbResultsStyle.Text = xd.SelectSingleNode("search/results/@style").InnerText;
|
||||
int sti = int.Parse(xd.SelectSingleNode("search/criteria/@index").InnerText);
|
||||
switch (sti)
|
||||
{
|
||||
case 0: //text
|
||||
case 0: //text or steptypes
|
||||
{
|
||||
cbxTextSearchText.Text = xd.SelectSingleNode("search/criteria/@text").InnerText;
|
||||
cbxCaseSensitive.Checked = bool.Parse(xd.SelectSingleNode("search/criteria/@case").InnerText);
|
||||
cbxIncROTextSrch.Checked = bool.Parse(xd.SelectSingleNode("search/criteria/@ro").InnerText);
|
||||
System.Xml.XmlNode xn = xd.SelectSingleNode("search/criteria/@text");
|
||||
tabSearchTypes.SelectedTab = tabStepTypeSearch;
|
||||
//cmbResultsStyle.SelectedIndex = int.Parse(xd.SelectSingleNode("search/results/@style").InnerText);
|
||||
cmbResultsStyle.Text = xd.SelectSingleNode("search/results/@style").InnerText;
|
||||
if (xn != null) // text search
|
||||
{
|
||||
cbxTextSearchText.Text = xn.InnerText;
|
||||
cbxCaseSensitive.Checked = bool.Parse(xd.SelectSingleNode("search/criteria/@case").InnerText);
|
||||
cbxIncROTextSrch.Checked = bool.Parse(xd.SelectSingleNode("search/criteria/@ro").InnerText);
|
||||
cbxByWord.Checked = bool.Parse(xd.SelectSingleNode("search/criteria/@byword").InnerText);
|
||||
}
|
||||
else // B2020-107: Add in step type search
|
||||
{
|
||||
cbxSrchTypeUsage.Checked = true;
|
||||
}
|
||||
|
||||
System.Xml.XmlNodeList nl = xd.SelectNodes("search/results/item");
|
||||
foreach (System.Xml.XmlNode nd in nl)
|
||||
{
|
||||
int itemID = int.Parse(nd.Attributes.GetNamedItem("id").InnerText);
|
||||
ItemInfo ii = ItemInfo.Get(itemID);
|
||||
if (ii.SearchAnnotationText == null && ii.ItemAnnotations!=null) ii.SearchAnnotationText = AnnotationInfo.Get(ii.ItemAnnotations[0].AnnotationID).SearchText;
|
||||
SearchResults.AddItemInfo(ii);
|
||||
}
|
||||
lbSrchResults.DataSource = SearchResults;
|
||||
DisplayResults();
|
||||
break;
|
||||
}
|
||||
case 1: //annotation
|
||||
@ -2199,8 +2275,12 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
int itemID = int.Parse(nd.Attributes.GetNamedItem("id").InnerText);
|
||||
ItemInfo ii = ItemInfo.Get(itemID);
|
||||
// B2020-107: The following was needed to set the Step Path result type for annotations
|
||||
if (ii.SearchAnnotationText == null && ii.ItemAnnotations != null) ii.SearchAnnotationText = AnnotationInfo.Get(ii.ItemAnnotations[0].AnnotationID).SearchText;
|
||||
SearchResults.AddItemInfo(ii);
|
||||
}
|
||||
lbSrchResults.DataSource = SearchResults;
|
||||
DisplayResults();
|
||||
break;
|
||||
}
|
||||
case 2: //referenced object
|
||||
@ -2223,7 +2303,6 @@ namespace Volian.Controls.Library
|
||||
break;
|
||||
}
|
||||
}
|
||||
DisplayResults();
|
||||
Cursor = Cursors.Default;
|
||||
}
|
||||
}
|
||||
@ -2231,6 +2310,11 @@ namespace Volian.Controls.Library
|
||||
private void btnSaveSearchResults_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
ICollection<ItemInfo> myList = lbSrchResults.DataSource as ICollection<ItemInfo>;
|
||||
if (tabSearchTypes.SelectedTabIndex == 2 || tabSearchTypes.SelectedTabIndex == 3) // ROs & Transitions are not coded yet
|
||||
{
|
||||
FlexibleMessageBox.Show(this, "Saving Referenced Objects and Transitions searches is under construction.", "Under Construction", MessageBoxButtons.OK);
|
||||
return;
|
||||
}
|
||||
if (sfdSearchResults.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
int k = sfdSearchResults.FilterIndex;
|
||||
@ -2241,29 +2325,68 @@ namespace Volian.Controls.Library
|
||||
System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
|
||||
System.Xml.XmlElement xe = xd.CreateElement("search");
|
||||
xd.AppendChild(xe);
|
||||
|
||||
xe = xd.CreateElement("criteria");
|
||||
xd.DocumentElement.AppendChild(xe);
|
||||
System.Xml.XmlAttribute xa = xd.CreateAttribute("index");
|
||||
int sti = tabSearchTypes.SelectedTabIndex;
|
||||
xa.InnerText = sti.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
// B2020-107: save procedures sets & step types
|
||||
// do procsets selected
|
||||
System.Xml.XmlElement xp = null;
|
||||
if (lstCheckedDocVersions != null && lstCheckedDocVersions.Count > 0)
|
||||
{
|
||||
xp = xd.CreateElement("procsets");
|
||||
foreach (DocVersionInfo dvi in lstCheckedDocVersions)
|
||||
{
|
||||
System.Xml.XmlElement xee = xd.CreateElement("set");
|
||||
xa = xd.CreateAttribute("fid");
|
||||
xa.InnerText = dvi.MyFolder.FolderID.ToString();
|
||||
xee.Attributes.SetNamedItem(xa);
|
||||
xp.AppendChild(xee);
|
||||
}
|
||||
}
|
||||
System.Xml.XmlElement xst = null;
|
||||
if (lstCheckedStepTypesStr != null && lstCheckedStepTypesStr.Count > 0)
|
||||
{
|
||||
xst = xd.CreateElement("StepType");
|
||||
foreach (string str in lstCheckedStepTypesStr) // Limited by step types
|
||||
{
|
||||
System.Xml.XmlElement xee = xd.CreateElement("type");
|
||||
xa = xd.CreateAttribute("str");
|
||||
xa.InnerText = str;
|
||||
xee.Attributes.SetNamedItem(xa);
|
||||
xst.AppendChild(xee);
|
||||
}
|
||||
}
|
||||
|
||||
switch (sti)
|
||||
{
|
||||
case 0: //text
|
||||
{
|
||||
xe = xd.CreateElement("criteria");
|
||||
System.Xml.XmlAttribute xa = xd.CreateAttribute("index");
|
||||
xa.InnerText = sti.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("text");
|
||||
xa.InnerText = cbxTextSearchText.Text;
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("case");
|
||||
xa.InnerText = cbxCaseSensitive.Checked.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("ro");
|
||||
xa.InnerText = cbxIncROTextSrch.Checked.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xd.DocumentElement.AppendChild(xe);
|
||||
|
||||
if (!cbxSrchTypeUsage.Checked) // text search
|
||||
{
|
||||
xa = xd.CreateAttribute("text");
|
||||
xa.InnerText = cbxTextSearchText.Text;
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("case");
|
||||
xa.InnerText = cbxCaseSensitive.Checked.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("ro");
|
||||
xa.InnerText = cbxIncROTextSrch.Checked.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("byword");
|
||||
xa.InnerText = cbxByWord.Checked.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xd.DocumentElement.AppendChild(xe);
|
||||
|
||||
}
|
||||
if (xp != null) xd.DocumentElement.AppendChild(xp); // want criteria as first xml node
|
||||
if (xst != null) xd.DocumentElement.AppendChild(xst); // do procsets & steptypes after
|
||||
// do results
|
||||
xe = xd.CreateElement("results");
|
||||
xa = xd.CreateAttribute("style");
|
||||
//xa.InnerText = cmbResultsStyle.SelectedIndex.ToString();
|
||||
xa.InnerText = cmbResultsStyle.Text;
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
foreach (ItemInfo ii in myList)
|
||||
@ -2280,10 +2403,6 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
case 1: //annotation
|
||||
{
|
||||
xe = xd.CreateElement("criteria");
|
||||
System.Xml.XmlAttribute xa = xd.CreateAttribute("index");
|
||||
xa.InnerText = sti.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("type");
|
||||
xa.InnerText = cbxAnnoTypes.Text;
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
@ -2294,9 +2413,10 @@ namespace Volian.Controls.Library
|
||||
xa.InnerText = cbxCaseSensitiveAnnoText.Checked.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xd.DocumentElement.AppendChild(xe);
|
||||
if (xp != null) xd.DocumentElement.AppendChild(xp); // want criteria as first xml node
|
||||
if (xst != null) xd.DocumentElement.AppendChild(xst); // do procsets & steptypes after
|
||||
xe = xd.CreateElement("results");
|
||||
xa = xd.CreateAttribute("style");
|
||||
//xa.InnerText = cmbResultsStyle.SelectedIndex.ToString();
|
||||
xa.InnerText = cmbResultsStyle.Text;
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
foreach (ItemInfo ii in myList)
|
||||
@ -2311,23 +2431,14 @@ namespace Volian.Controls.Library
|
||||
xd.Save(sfdSearchResults.FileName);
|
||||
break;
|
||||
}
|
||||
case 2: //referenced object
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: //csv
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 3: //tsv
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 4: //bsf
|
||||
case 2: //csv
|
||||
case 3: //tsv
|
||||
case 4: //bsf
|
||||
{
|
||||
FlexibleMessageBox.Show(this, "Saving Search Results to this file type is under construction.", "Under Construction", MessageBoxButtons.OK);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user