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
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user