B2022-098: ROs not being resolved in Word Sections
This commit is contained in:
@@ -150,6 +150,8 @@ namespace Volian.Controls.Library
|
||||
get { return _curROLink; }
|
||||
set
|
||||
{
|
||||
// Volian.Base.Library.vlnStackTrace.ShowStack("value={0} MyRTB={1}", value, ((MyRTB != null) ? MyRTB.SelectedText : "" ));
|
||||
|
||||
// modify - set the controls to the current ro
|
||||
if (value != null)
|
||||
{
|
||||
@@ -158,19 +160,25 @@ namespace Volian.Controls.Library
|
||||
_curROLink = value;
|
||||
_savCurROLink = _curROLink;
|
||||
|
||||
ExpandNode(_curROLink.ROID);
|
||||
// B2022-088: [JPR] Find Doc Ro button not working in Word Sections
|
||||
// B2022-098: [JPR] ROs not being resolved in Word Sections
|
||||
string roid = ROFSTLookup.FormatRoidKey(_curROLink.ROID, true);
|
||||
ExpandNode(roid);
|
||||
}
|
||||
}
|
||||
else // insert - clear out controls
|
||||
else // if (_curROLink != null) // insert - clear out controls
|
||||
{
|
||||
_curROLink = value;
|
||||
tbROValue.Text = null;
|
||||
lbROId.Text = string.Empty;
|
||||
tvROFST.SelectedNode = null;
|
||||
ResetSearch();
|
||||
|
||||
btnGoToRO.Enabled = false;
|
||||
btnSaveRO.Enabled = false;
|
||||
btnCancelRO.Enabled = false;
|
||||
//tbROValue.Text = null;
|
||||
//lbROId.Text = string.Empty;
|
||||
|
||||
//btnGoToRO.Enabled = false;
|
||||
//btnSaveRO.Enabled = false;
|
||||
//btnCancelRO.Enabled = false;
|
||||
//btnPreviewRO.Enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -184,6 +192,11 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
_myRTB = value;
|
||||
MyROFST = null;
|
||||
|
||||
// B2022-088: [JPR] Find Doc Ro button not working in Word Sections
|
||||
// B2022-098: [JPR] ROs not being resolved in Word Sections
|
||||
CurROLink = null;
|
||||
_savCurROLink = null;
|
||||
}
|
||||
else if(_myRTB != value)
|
||||
{
|
||||
@@ -192,7 +205,7 @@ namespace Volian.Controls.Library
|
||||
MyRTB.LinkChanged += new StepRTBLinkEvent(MyRTB_LinkChanged);
|
||||
MyRTB.SelectionChanged += new EventHandler(MyRTB_SelectionChanged);
|
||||
|
||||
if (MyRTB.MyLinkText == null)
|
||||
if (string.IsNullOrEmpty(MyRTB.MyLinkText))
|
||||
{
|
||||
CurROLink = null;
|
||||
_savCurROLink = null;
|
||||
@@ -244,7 +257,7 @@ namespace Volian.Controls.Library
|
||||
if (_searchTimer == null)
|
||||
{
|
||||
_searchTimer = new Timer();
|
||||
_searchTimer.Interval = 500;
|
||||
_searchTimer.Interval = 1000;
|
||||
_searchTimer.Tick += new EventHandler(SelectionTimer_Tick);
|
||||
_searchTimer.Stop();
|
||||
}
|
||||
@@ -300,6 +313,10 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
_timeActivity.Open();
|
||||
|
||||
// B2022-088: [JPR] Find Doc Ro button not working in Word Sections
|
||||
// B2022-098: [JPR] ROs not being resolved in Word Sections
|
||||
// Need to call Stop then Start just in case the uses has changed their selection
|
||||
// before the timer.Tick event fires. Calling Stop/Start is the same as Reset for the timer
|
||||
_searchTimer.Stop();
|
||||
_searchTimer.Start();
|
||||
|
||||
@@ -338,13 +355,8 @@ namespace Volian.Controls.Library
|
||||
|
||||
private void tvROFST_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
tbROValue.Text = null;
|
||||
lbROId.Text = string.Empty;
|
||||
btnCancelRO.Enabled = false;
|
||||
btnSaveRO.Enabled = false;
|
||||
btnPreviewRO.Enabled = false;
|
||||
btnGoToRO.Enabled = false;
|
||||
|
||||
// B2022-088: [JPR] Find Doc Ro button not working in Word Sections
|
||||
// B2022-098: [JPR] ROs not being resolved in Word Sections
|
||||
if (e.Node.Tag is ROFSTLookup.rochild)
|
||||
{
|
||||
ROFSTLookup.rochild chld = (ROFSTLookup.rochild)e.Node.Tag;
|
||||
@@ -353,24 +365,22 @@ namespace Volian.Controls.Library
|
||||
if (chld.value != null)
|
||||
{
|
||||
RoUsageInfo SavROLink = null;
|
||||
|
||||
if (_savCurROLink != null) SavROLink = _savCurROLink;
|
||||
lbROId.Text = chld.appid;
|
||||
|
||||
// Allow the user to select a different return value.
|
||||
string childroid = ROFSTLookup.FormatRoidKey(chld.roid, true);
|
||||
// Set the Display Text to the AccPageID
|
||||
lbROId.Text = chld.appid;
|
||||
|
||||
//B2017-245 Disable SaveRO button for Procedures and Sections
|
||||
//B2020-049: Save button not enabled on Word docs, only if a procedure was opened first and immediately after the word document
|
||||
// section is opened (added 'IsInWorDoc')
|
||||
btnSaveRO.Enabled = (IsInWordDoc || (!IsNotStep && !IsEnhancedStep)) && UserInfo.CanEdit(MyUserInfo, MyDvi) && ((SavROLink == null) || !(childroid.Equals(SavROLink.ROID.ToUpper()))); //added security check (UserInfo.CanEdit)
|
||||
btnCancelRO.Enabled = (_savCurROLink != null && (SavROLink != null && childroid != SavROLink.ROID.ToUpper()));
|
||||
btnSaveRO.Enabled = (IsInWordDoc || (!IsNotStep && !IsEnhancedStep)) && UserInfo.CanEdit(MyUserInfo, MyDvi) && ((SavROLink == null) || !(chld.roid.Equals(SavROLink.ROID.ToUpper()))); //added security check (UserInfo.CanEdit)
|
||||
btnCancelRO.Enabled = (_savCurROLink != null && (SavROLink != null && chld.roid != SavROLink.ROID.ToUpper()));
|
||||
btnGoToRO.Enabled = UserInfo.CanEditROs(MyUserInfo, MyDvi); // Writers and Reviewers cannot edit ROs (run the RO Editor)
|
||||
|
||||
switch (chld.type)
|
||||
{
|
||||
case 1: // standard (regular) text RO type
|
||||
tbROValue.Text = chld.value;
|
||||
tbROValue.Text = chld.value;
|
||||
btnPreviewRO.Enabled = false;
|
||||
if (chld.roid.StartsWith("FFFF")) btnGoToRO.Enabled = false;
|
||||
break;
|
||||
@@ -393,6 +403,12 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// B2022-088: [JPR] Find Doc Ro button not working in Word Sections
|
||||
// B2022-098: [JPR] ROs not being resolved in Word Sections
|
||||
ResetSearch();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -556,7 +572,6 @@ namespace Volian.Controls.Library
|
||||
return;
|
||||
}
|
||||
|
||||
//if (MyROFST != _curROFST || tvROFST.Nodes == null || tvROFST.Nodes.Count <= 0)
|
||||
if(RoTreeNeedsReloaded || tvROFST.Nodes == null || tvROFST.Nodes.Count <= 0)
|
||||
{
|
||||
ROFSTLookup.rodbi[] dbs = MyROFSTLookup.GetRODatabaseList(true);
|
||||
@@ -888,15 +903,15 @@ namespace Volian.Controls.Library
|
||||
|
||||
MyRTB.OnRoInsert(this, new StepRTBRoEventArgs(valtxt, selectedChld.value, linktxt, padroid, MyROFST.RODbID));
|
||||
}
|
||||
|
||||
btnGoToRO.Enabled = false;
|
||||
btnSaveRO.Enabled = false;
|
||||
btnCancelRO.Enabled = false;
|
||||
btnPreviewRO.Enabled = false;
|
||||
|
||||
CurROLink = null;
|
||||
_savCurROLink = null;
|
||||
}
|
||||
|
||||
btnGoToRO.Enabled = false;
|
||||
btnSaveRO.Enabled = false;
|
||||
btnCancelRO.Enabled = false;
|
||||
btnPreviewRO.Enabled = false;
|
||||
|
||||
CurROLink = null;
|
||||
_savCurROLink = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1014,60 +1029,99 @@ namespace Volian.Controls.Library
|
||||
// tries to process a search while the main tab/procedure is closing
|
||||
try
|
||||
{
|
||||
if (this.Enabled && !string.IsNullOrEmpty(searchValue))
|
||||
searchValue = (!string.IsNullOrEmpty(searchValue)) ? searchValue.Replace('\u2011', '-').Replace(@"\u9586?", @"\\").Trim() : searchValue;
|
||||
|
||||
if (this.Enabled && !string.IsNullOrEmpty(searchValue) && searchValue.Length >= 2 && !searchValue.Contains("#Link:Transition"))
|
||||
{
|
||||
Dictionary<string, string> dicRoVals = new Dictionary<string, string>();
|
||||
searchValue = searchValue.Replace('\u2011', '-').Replace(@"\u9586?", @"\\");
|
||||
|
||||
// B2022-088: Find Doc Ro button not working in Word Sections
|
||||
if (searchValue.StartsWith("<") && searchValue.EndsWith(">"))
|
||||
|
||||
// B2022-088: [JPR] Find Doc Ro button not working in Word Sections
|
||||
// B2022-098: [JPR] ROs not being resolved in Word Sections
|
||||
if (searchValue.StartsWith("<") && searchValue.EndsWith(">")) // RO Link (accPageID)
|
||||
{
|
||||
ROFSTLookup.rochild roc = MyROFSTLookup.GetROChildByAccPageID(searchValue);
|
||||
if (roc.ID >= 0 && !string.IsNullOrEmpty(roc.value))
|
||||
dicRoVals.Add(roc.roid, roc.value);
|
||||
}
|
||||
else if (searchValue.Length >= 2 && searchValue != _lastSearchValue)
|
||||
{
|
||||
dicRoVals = MyROFSTLookup.Search(searchValue, searchTypeID, false, MaxNumSearchRecords);
|
||||
}
|
||||
|
||||
// If RO is valid then select node in tree view
|
||||
if (roc.ID >= 0 && !string.IsNullOrEmpty(roc.value))
|
||||
{
|
||||
ExpandNode(roc.roid);
|
||||
}
|
||||
|
||||
if (dicRoVals.Count > 0)
|
||||
{
|
||||
lbFound.SelectedValueChanged -= new EventHandler(lbFound_SelectedValueChanged);
|
||||
|
||||
lbFound.DataSource = new BindingSource(dicRoVals, null);
|
||||
lbFound.ValueMember = "Key"; // roid
|
||||
lbFound.DisplayMember = "Value"; // default value
|
||||
|
||||
lbFound.SelectionMode = SelectionMode.One;
|
||||
lbFound.SelectedIndex = -1;
|
||||
lbFound.Visible = true;
|
||||
|
||||
lbFound.SelectedValueChanged += new EventHandler(lbFound_SelectedValueChanged);
|
||||
|
||||
if (lbFound.Items != null && lbFound.Items.Count == 1)
|
||||
lbFound.SelectedIndex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
searchValue = string.Empty;
|
||||
lbFound.DataSource = null;
|
||||
lbFound.Visible = false;
|
||||
|
||||
_lastSearchValue = searchValue;
|
||||
}
|
||||
else if (searchValue.Contains("#Link:ReferencedObject")) // RO Link (roid)
|
||||
{
|
||||
searchValue = searchValue.Replace("1[END>", string.Empty).Trim();
|
||||
string roid = ROFSTLookup.FormatRoidKey(searchValue.Substring(searchValue.LastIndexOf(" ")), true);
|
||||
|
||||
if (roid != selectedChld.roid)
|
||||
{
|
||||
ROFSTLookup.rochild roc = MyROFSTLookup.GetRoChild(roid);
|
||||
ExpandNode(roc.roid);
|
||||
}
|
||||
|
||||
lbFound.DataSource = null;
|
||||
lbFound.Visible = false;
|
||||
|
||||
_lastSearchValue = searchValue;
|
||||
}
|
||||
else // if (searchValue != _lastSearchValue)
|
||||
{
|
||||
dicRoVals = MyROFSTLookup.Search(searchValue, searchTypeID, false, MaxNumSearchRecords);
|
||||
|
||||
if (dicRoVals.Count > 0)
|
||||
{
|
||||
lbFound.SelectedValueChanged -= new EventHandler(lbFound_SelectedValueChanged);
|
||||
|
||||
lbFound.DataSource = new BindingSource(dicRoVals, null);
|
||||
lbFound.ValueMember = "Key"; // roid
|
||||
lbFound.DisplayMember = "Value"; // default value
|
||||
|
||||
lbFound.SelectionMode = SelectionMode.One;
|
||||
lbFound.SelectedIndex = -1;
|
||||
lbFound.Visible = true;
|
||||
|
||||
lbFound.SelectedValueChanged += new EventHandler(lbFound_SelectedValueChanged);
|
||||
|
||||
if (lbFound.Items != null && lbFound.Items.Count == 1)
|
||||
lbFound.SelectedIndex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
lbFound.DataSource = null;
|
||||
lbFound.Visible = false;
|
||||
}
|
||||
|
||||
_lastSearchValue = searchValue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
searchValue = string.Empty;
|
||||
_lastSearchValue = string.Empty;
|
||||
lbFound.DataSource = null;
|
||||
lbFound.Visible = false;
|
||||
}
|
||||
|
||||
_lastSearchValue = searchValue;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void ResetSearch()
|
||||
{
|
||||
// Clear the Display/Info for Prev Selected RO Child
|
||||
tbROValue.Text = null;
|
||||
lbROId.Text = string.Empty;
|
||||
|
||||
// Disable all buttons by default
|
||||
btnGoToRO.Enabled = false;
|
||||
btnSaveRO.Enabled = false;
|
||||
btnCancelRO.Enabled = false;
|
||||
btnPreviewRO.Enabled = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@ using DevComponents.AdvTree;
|
||||
using Volian.Base.Library;
|
||||
using System.Text.RegularExpressions;
|
||||
using JR.Utils.GUI.Forms;
|
||||
using System.Linq;
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
@@ -1346,25 +1347,15 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
for (int i = 0; i < dbs.Length; i++)
|
||||
{
|
||||
DevComponents.AdvTree.Node tn = new DevComponents.AdvTree.Node();
|
||||
|
||||
ROFSTLookup.rodbi db = dbs[i];
|
||||
tn.Text = db.dbiTitle;
|
||||
|
||||
DevComponents.AdvTree.Node tn = new DevComponents.AdvTree.Node(db.dbiTitle);
|
||||
tn.Tag = db;
|
||||
cmboTreeROs.Nodes.Add(tn);
|
||||
|
||||
AddDummyGroup(db, tn);
|
||||
}
|
||||
}
|
||||
|
||||
//for (int i = 0; i < _MyROFSTLookup.myHdr.myDbs.Length; i++)
|
||||
//{
|
||||
// DevComponents.AdvTree.Node tn = new DevComponents.AdvTree.Node();
|
||||
// tn.Text = _MyROFSTLookup.myHdr.myDbs[i].dbiTitle;
|
||||
// tn.Tag = _MyROFSTLookup.myHdr.myDbs[i];
|
||||
// cmboTreeROs.Nodes.Add(tn);
|
||||
// AddDummyGroup(_MyROFSTLookup.myHdr.myDbs[i], tn);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1395,10 +1386,9 @@ namespace Volian.Controls.Library
|
||||
|
||||
private void AddDummyGroup(ROFSTLookup.rodbi rodbi, DevComponents.AdvTree.Node tn)
|
||||
{
|
||||
if (rodbi.children != null && rodbi.children.Length > 0)
|
||||
if (MyROFSTLookup.HasChildren(ref rodbi))
|
||||
{
|
||||
DevComponents.AdvTree.Node tmp = new DevComponents.AdvTree.Node();
|
||||
tmp.Text = DummyNodeText;
|
||||
DevComponents.AdvTree.Node tmp = new DevComponents.AdvTree.Node(DummyNodeText);
|
||||
tn.Nodes.Add(tmp);
|
||||
}
|
||||
}
|
||||
@@ -1410,29 +1400,21 @@ namespace Volian.Controls.Library
|
||||
|
||||
private void LoadChildren(DevComponents.AdvTree.Node tn)
|
||||
{
|
||||
object tag = tn.Tag;
|
||||
if (tn.HasChildNodes && tn.Nodes[0].Text != DummyNodeText) return; // already loaded.
|
||||
if (tn.HasChildNodes && tn.Nodes[0].Text == DummyNodeText) tn.Nodes[0].Remove();
|
||||
|
||||
ROFSTLookup.rochild[] chld = null;
|
||||
|
||||
if (tn.Tag is ROFSTLookup.rodbi)
|
||||
{
|
||||
ROFSTLookup.rodbi db = (ROFSTLookup.rodbi)tn.Tag;
|
||||
|
||||
// Try to Lazy Load children - B2022-026 RO Memory Reduction code
|
||||
if (db.children == null || db.children.Length <= 0)
|
||||
db.children = MyROFSTLookup.GetRoChildrenByID(db.ID, db.dbiID, true);
|
||||
|
||||
MyROFSTLookup.LoadChildren(ref db);
|
||||
chld = db.children;
|
||||
}
|
||||
else if (tn.Tag is ROFSTLookup.rochild)
|
||||
{
|
||||
ROFSTLookup.rochild ch = (ROFSTLookup.rochild)tn.Tag;
|
||||
|
||||
// Try to Lazy Load children - B2022-026 RO Memory Reduction code
|
||||
if (ch.children == null || ch.children.Length <= 0)
|
||||
ch.children = MyROFSTLookup.GetRoChildrenByRoid(ch.roid, true);
|
||||
|
||||
MyROFSTLookup.LoadChildren(ref ch);
|
||||
chld = ch.children;
|
||||
}
|
||||
else
|
||||
@@ -1440,6 +1422,7 @@ namespace Volian.Controls.Library
|
||||
Console.WriteLine("error - no type");
|
||||
return;
|
||||
}
|
||||
|
||||
// if children, add dummy node
|
||||
// B2022-026 RO Memory Reduction code - need to check length
|
||||
if (chld != null && chld.Length > 0)
|
||||
@@ -1451,43 +1434,54 @@ namespace Volian.Controls.Library
|
||||
ProgressBar_SetValue(i);
|
||||
DevComponents.AdvTree.Node tmp = null;
|
||||
|
||||
// Try to Lazy Load children - B2022-026 RO Memory Reduction code
|
||||
if (chld[i].children == null || chld[i].children.Length <= 0)
|
||||
chld[i].children = MyROFSTLookup.GetRoChildrenByRoid(chld[i].roid, true);
|
||||
ROFSTLookup.rochild roc = chld[i];
|
||||
|
||||
// if this is a group, i.e. type 0, add a dummy node
|
||||
// B2022-026 RO Memory Reduction code - check children length
|
||||
if (chld[i].type == 0 && (chld[i].children == null || chld[i].children.Length <= 0))
|
||||
if (roc.type == 0 && !MyROFSTLookup.HasChildren(ref roc))
|
||||
{
|
||||
//skip it.
|
||||
// TODO: KBR how to handle this?
|
||||
//Console.WriteLine("ro junk");
|
||||
continue;
|
||||
continue; // Ignore: Junk Scenario
|
||||
}
|
||||
else if (chld[i].value == null)
|
||||
else if (!string.IsNullOrEmpty(roc.appid))
|
||||
{
|
||||
tmp = new DevComponents.AdvTree.Node();
|
||||
MyROFSTLookup.LoadChildren(ref roc);
|
||||
|
||||
if (roc.children.Length == 1 && roc.children.First().roid.Length == 16)
|
||||
{
|
||||
roc.appid = roc.children.First().appid;
|
||||
roc.roid = roc.children.First().roid;
|
||||
roc.value = roc.children.First().value;
|
||||
|
||||
roc.children = new List<ROFSTLookup.rochild>().ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (roc.value == null)
|
||||
{
|
||||
tmp = new DevComponents.AdvTree.Node(roc.title);
|
||||
tmp.Tag = roc;
|
||||
|
||||
tmp.Text = chld[i].title;
|
||||
tmp.Tag = chld[i];
|
||||
int index = FindIndex(tn.Nodes, tmp.Text);
|
||||
tn.Nodes.Insert(index, tmp);
|
||||
//tn.Nodes.Add(tmp);
|
||||
DevComponents.AdvTree.Node sub = new DevComponents.AdvTree.Node();
|
||||
sub.Text = DummyNodeText;
|
||||
|
||||
DevComponents.AdvTree.Node sub = new DevComponents.AdvTree.Node(DummyNodeText);
|
||||
tmp.Nodes.Add(sub);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = new DevComponents.AdvTree.Node();
|
||||
tmp = new DevComponents.AdvTree.Node(roc.title);
|
||||
tmp.Tag = roc;
|
||||
|
||||
tmp.Text = chld[i].title;
|
||||
tmp.Tag = chld[i];
|
||||
int index = FindIndex(tn.Nodes, tmp.Text);
|
||||
|
||||
tn.Nodes.Insert(index, tmp);
|
||||
//tn.Nodes.Add(tmp);
|
||||
if (roc.roid.Length == 16)
|
||||
{
|
||||
tn.Nodes.Add(tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
int index = FindIndex(tn.Nodes, tmp.Text);
|
||||
tn.Nodes.Insert(index, tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user