Merge pull request 'C2015-028 Add Editorial Mode to PROMS Step Editor' (#621) from C2015-028 into Development

good for testing phase
This commit is contained in:
2025-09-25 08:17:01 -04:00
10 changed files with 161 additions and 38 deletions

View File

@@ -394,6 +394,33 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Step_ChangeID"); OnPropertyChanged("Step_ChangeID");
} }
} }
// C2015-028 Add Editorial Mode to PROMS Step Editor
// was last change made in editorial mode and thus change bars should be disabled?
// will contain userid of user that made last change if it was in Editorial Mode
// if there was not a previous change that would have caused change bars
// will be blank/empty by default
// will get overwritten every time a change is made
public string Step_ChangeIDEditorialMode
{
get
{
string s = _Xp["Step", "ChangeIDEMode"];
if (s == string.Empty) return null;
return s;
}
set
{
string s = _Xp["Step", "ChangeIDEMode"];
if (value != null && value.ToString() == s) return;
if (value == null && s != null) _Xp["Step", "ChangeIDEMode"] = null;
else _Xp["Step", "ChangeIDEMode"] = value.ToString();
OnPropertyChanged("Step_ChangeIDEMode");
}
}
public string Step_Responsibility public string Step_Responsibility
{ {
get get

View File

@@ -3933,9 +3933,7 @@ namespace VEPROMS.CSLA.Library
get get
{ {
bool chg = HasChanges; bool chg = HasChanges;
StepInfo si = this as StepInfo; StepConfig sc = this.MyConfig as StepConfig;
if (si == null) return false;
StepConfig sc = si.MyConfig as StepConfig;
if (sc == null) return false; if (sc == null) return false;
// if there is no override & return whether there was a change to the text. // if there is no override & return whether there was a change to the text.
if (chg && ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds && if (chg && ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds &&
@@ -3943,6 +3941,21 @@ namespace VEPROMS.CSLA.Library
return false; // No Change ID - No Change Bar return false; // No Change ID - No Change Bar
if ((sc.Step_SpellCheckerChangedText ?? "") == "NoChangeBar") if ((sc.Step_SpellCheckerChangedText ?? "") == "NoChangeBar")
return false; // Spell Checker, in editorial mode (format flag EditoralSpellCheck) , made the change and there was no change bar prior to that change B2015-024 return false; // Spell Checker, in editorial mode (format flag EditoralSpellCheck) , made the change and there was no change bar prior to that change B2015-024
// C2015-028 Add Editorial Mode to PROMS Step Editor
// last change was in editorial mode, so ignore it
if (!string.IsNullOrEmpty(sc.Step_ChangeIDEditorialMode))
return false;
// C2015-028 Add Editorial Mode to PROMS Step Editor
// Add Check for enhanced docs
// If enhanced docs, need to check the step_config for the master
if (sc.MyEnhancedDocuments != null && sc.MyEnhancedDocuments.Count == 1 && sc.MyEnhancedDocuments[0].Type == 0)
{
ItemInfo ii = ItemInfo.Get(sc.MyEnhancedDocuments[0].ItemID, true);
if (ii == null) return false; // when deleting a source step, this was causing a crash (null ii)
return ii.HasChangeBar;
}
if (sc.Step_CBOverride == null) if (sc.Step_CBOverride == null)
return chg; return chg;
return (sc.Step_CBOverride == "On"); return (sc.Step_CBOverride == "On");
@@ -3953,9 +3966,7 @@ namespace VEPROMS.CSLA.Library
get get
{ {
if (this.IsAccPages || this.IsProcedure || this.IsSection) return false; if (this.IsAccPages || this.IsProcedure || this.IsSection) return false;
StepInfo si = this as StepInfo; StepConfig sc = this.MyConfig as StepConfig;
if (si == null) return false;
StepConfig sc = si.MyConfig as StepConfig;
if (sc == null) return false; if (sc == null) return false;
// go back to source & see what date it has: // go back to source & see what date it has:
if (sc.MyEnhancedDocuments != null && sc.MyEnhancedDocuments.Count == 1 && sc.MyEnhancedDocuments[0].Type == 0) if (sc.MyEnhancedDocuments != null && sc.MyEnhancedDocuments.Count == 1 && sc.MyEnhancedDocuments[0].Type == 0)

View File

@@ -606,12 +606,20 @@ namespace VEPROMS.CSLA.Library
_ItemInfoExtension.Refresh(this); _ItemInfoExtension.Refresh(this);
OnChange();// raise an event OnChange();// raise an event
} }
public static ItemInfo Get(int itemID) public static ItemInfo Get(int itemID, bool forcerefresh = false)
{ {
//if (!CanGetObject())
// throw new System.Security.SecurityException("User not authorized to view a Item");
try try
{ {
// C2015-028 Add Editorial Mode to PROMS Step Editor
// fixes caching issue
// item.myconfig was cached not containing the bypass changebar info
// so this forces a refresh of the cache
if (forcerefresh)
{
_CacheByPrimaryKey.Remove(itemID.ToString());
}
ItemInfo tmp = GetCachedByPrimaryKey(itemID); ItemInfo tmp = GetCachedByPrimaryKey(itemID);
if (tmp == null) if (tmp == null)
{ {

View File

@@ -11,6 +11,7 @@ using DevComponents.DotNetBar;
using JR.Utils.GUI.Forms; using JR.Utils.GUI.Forms;
using Volian.Base.Library; using Volian.Base.Library;
using Microsoft.Win32; using Microsoft.Win32;
using System.Linq;
namespace Volian.Controls.Library namespace Volian.Controls.Library
{ {
@@ -261,16 +262,37 @@ namespace Volian.Controls.Library
get { return _ChgId; } get { return _ChgId; }
set { _ChgId = value; } set { _ChgId = value; }
} }
// C2015-028 Add Editorial Mode to PROMS Step Editor
public bool EditorialChange public bool EditorialChange
{ {
get get
{ {
if (_ChgId == null) return true; if (_ChgId == null) return true;
if (_ChgId == "") return true; if (_ChgId == "") return true;
if (_ChgId.ToUpper() == "EC") return true; if (_ChgId.ToUpper() == "EC") { return true;}
return false;
return IsInEditorialMode;
} }
} }
// C2015-028 Add Editorial Mode to PROMS Step Editor
// property to hold if button in ribbon is toggled on or off
public bool IsInEditorialMode { get; set; } = false;
// C2015-028 Add Editorial Mode to PROMS Step Editor
// This is used when button in the ribbon is toggled on/off
// It iterates through all previously opened tabs
// and updates the "Editorial Mode" button
// and background color to match those of the current tab
public void SetEdititorialModeForAllTabs(bool mode)
{
foreach (DisplayTabItem tabItem in _MyDisplayTabItems.Values.Where(tabItem => tabItem.MyStepTabPanel != null))
{
tabItem.MyStepTabPanel.MyStepTabRibbon.SetEditorialMode(mode);
}
}
#endregion #endregion
#region Events #region Events
/// <summary> /// <summary>

View File

@@ -799,27 +799,41 @@ namespace Volian.Controls.Library
// if the plant has the change id option, the change id was entered when the program started. // if the plant has the change id option, the change id was entered when the program started.
// this should be saved for every piece of edited data. Note that the set of config // this should be saved for every piece of edited data. Note that the set of config
// item Step_MultipleChangeID has the save built in to it. // item Step_MultipleChangeID has the save built in to it.
if (sc == null) sc = new StepConfig();
if (MyStepRTB.MyItemInfo.IsStep && if (MyStepRTB.MyItemInfo.IsStep &&
MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds
&& !this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange) && !this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange)
{ {
//StepConfig sc = MyStepRTB.MyItemInfo.MyConfig as StepConfig;
if (sc == null) sc = new StepConfig();
sc.Step_ChangeID = this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.ChgId; sc.Step_ChangeID = this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.ChgId;
//if (MyStepRTB.MyItemInfo.MyConfig == null) itm.MyContent.Config = sc.ToString(); }
// C2015-028 Add Editorial Mode to PROMS Step Editor
// if in Editorial Mode, treat it the same as if the ChangeIds are set in the Format file
if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsInEditorialMode && !existingChangeBar)
{
sc.Step_ChangeIDEditorialMode = Volian.Base.Library.VlnSettings.UserID;
}
else
{
sc.Step_ChangeIDEditorialMode = null;
} }
// B2020-017: If making an editorial change, clear the Change id. Having the change id on // B2020-017: If making an editorial change, clear the Change id. Having the change id on
// was adding/printing a change bar. // was adding/printing a change bar.
// C2015-028 Add Editorial Mode to PROMS Step Editor
// if in Editorial Mode, treat it the same as if the ChangeIds are set in the Format file
if (MyStepRTB.MyItemInfo.IsStep && if (MyStepRTB.MyItemInfo.IsStep &&
MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds (MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds
&& this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange || MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsInEditorialMode
&& hasChangeBar == false) )
&& MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange
&& !hasChangeBar)
{ {
if (sc == null) sc = new StepConfig(); if (sc == null) sc = new StepConfig();
sc.Step_ChangeID = null; sc.Step_ChangeID = null;
} }
// B2015-024 Have Spell Checker text changes be an editorial change (not assign a change bar but keep existing change bar) // B2015-024 Have Spell Checker text changes be an editorial change (not assign a change bar but keep existing change bar)
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.EditData.EditoralSpellCheck) // C2015-028 Add Editorial Mode to PROMS Step Editor
// if in Editorial Mode, treat it the same as if the Rditorial SprllCheck flag is set in the Format file
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.EditData.EditoralSpellCheck || this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsInEditorialMode)
{ {
if (StepRTB.DidEditorialSpellCheck) if (StepRTB.DidEditorialSpellCheck)
{ {

View File

@@ -650,7 +650,12 @@ namespace Volian.Controls.Library
/// </summary> /// </summary>
public Color ActiveColor public Color ActiveColor
{ {
get { return _ActiveColor; } get {
// C2015-028 Add Editorial Mode to PROMS Step Editor
// if in Editorial Mode, use LightGreen background
_ActiveColor = MyStepTabPanel != null && MyStepTabPanel.MyDisplayTabControl.IsInEditorialMode ? Color.LightGreen : Color.SkyBlue;
return _ActiveColor;
}
set { _ActiveColor = value; } set { _ActiveColor = value; }
} }
/// <summary> /// <summary>

View File

@@ -3760,7 +3760,12 @@ namespace Volian.Controls.Library
public bool SpellCheckNext() public bool SpellCheckNext()
{ {
int nBad = C1SpellChecker2.CheckControl(this, false, MySpellCheckDlg); int nBad = C1SpellChecker2.CheckControl(this, false, MySpellCheckDlg);
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.EditData.EditoralSpellCheck)
// C2015-028 Add Editorial Mode to PROMS Step Editor
// if in Editorial Mode, treat it the same as if the EditorialSpellCheck flag is set in the Format file
bool editorialmode = (this.Parent.Parent.Parent as StepTabPanel).MyDisplayTabControl.IsInEditorialMode;
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.EditData.EditoralSpellCheck || editorialmode)
DidEditorialSpellCheck = MySpellCheckDlg.DidCorrectSpelling; // B2015-024 spell checker in editoral mode DidEditorialSpellCheck = MySpellCheckDlg.DidCorrectSpelling; // B2015-024 spell checker in editoral mode
return (nBad >= 0); // nBad = -1 means user pressed Cancel button return (nBad >= 0); // nBad = -1 means user pressed Cancel button
} }

View File

@@ -120,7 +120,7 @@ namespace Volian.Controls.Library
/// </summary> /// </summary>
private void SetupStepTabRibbon() private void SetupStepTabRibbon()
{ {
_MyStepTabRibbon = new StepTabRibbon(); _MyStepTabRibbon = new StepTabRibbon(_MyDisplayTabControl.IsInEditorialMode);
_MyStepTabRibbon.Dock = System.Windows.Forms.DockStyle.Top; _MyStepTabRibbon.Dock = System.Windows.Forms.DockStyle.Top;
_MyStepTabRibbon.Location = new System.Drawing.Point(0, 0); _MyStepTabRibbon.Location = new System.Drawing.Point(0, 0);
_MyStepTabRibbon.Name = "displayTabRibbon1"; _MyStepTabRibbon.Name = "displayTabRibbon1";

View File

@@ -995,7 +995,7 @@ namespace Volian.Controls.Library
// SetButtonAndMenuEnabling(true); // SetButtonAndMenuEnabling(true);
//} //}
#region Constructor #region Constructor
public StepTabRibbon() public StepTabRibbon(bool? IsInEditorialMode = false)
{ {
InitializeComponent(); InitializeComponent();
this.btnInsSupInfo.Tag = string.Format("{0} {1}", (int)E_FromTypes.SupInfos, 1040); // Make type of rno (40) & special case 1000 this.btnInsSupInfo.Tag = string.Format("{0} {1}", (int)E_FromTypes.SupInfos, 1040); // Make type of rno (40) & special case 1000
@@ -1021,7 +1021,15 @@ namespace Volian.Controls.Library
// hide the import from Word file if not running in Debug mode // hide the import from Word file if not running in Debug mode
if (!VlnSettings.DebugMode) if (!VlnSettings.DebugMode)
rbnImpWrd.Visible = false; rbnImpWrd.Visible = false;
// C2015-028 Add Editorial Mode to PROMS Step Editor
// default Editorial Mode to what is set in the DisplayTabControl
SetEditorialMode(IsInEditorialMode != null && (bool) IsInEditorialMode);
} }
public void SetEditorialMode(bool mode) => btnEditorialMode.Checked = btnCMEditorialMode.Checked = mode;
void _RibbonControl_SizeChanged(object sender, EventArgs e) void _RibbonControl_SizeChanged(object sender, EventArgs e)
{ {
this.Size = _RibbonControl.Size; this.Size = _RibbonControl.Size;
@@ -3211,6 +3219,28 @@ namespace Volian.Controls.Library
System.Diagnostics.Process.Start(roapp, args); System.Diagnostics.Process.Start(roapp, args);
} }
} }
// C2015-028 Add Editorial Mode to PROMS Step Editor
private void btnEditorialMode_Click(object sender, EventArgs e)
{
//toggle button is selected
SetEditorialMode(!btnEditorialMode.Checked);
//set the overall flag in the displaytabcontrol
StepTabPanel tmp = Parent as StepTabPanel;
tmp.MyDisplayTabControl.IsInEditorialMode = btnEditorialMode.Checked;
//refresh the current item so the background color changes (LightGreen=Editorial Mode, SkyBlue=Normal Selected)
if (MyEditItem != null)
{
_MyEditItem.RefreshContent();
Application.DoEvents();
}
//set other preciously opened tabs to match the state of Editorial Mode in the current tab
tmp.MyDisplayTabControl.SetEdititorialModeForAllTabs(btnEditorialMode.Checked);
}
private void btnChgTyp_Click(object sender, EventArgs e) private void btnChgTyp_Click(object sender, EventArgs e)
{ {
StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("Change Step Type"); StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("Change Step Type");
@@ -3279,7 +3309,8 @@ namespace Volian.Controls.Library
rtabInsert.Visible = false; rtabInsert.Visible = false;
rtabAdmin.Visible = false; rtabAdmin.Visible = false;
rtabReview.Select(); rtabReview.Select();
btnCMEditMode1.Enabled = btnEditMode.Enabled = false; // don't allow reviewer toggle out of view mode btnCMEditMode1.Enabled = btnEditMode.Enabled = btnCMEditorialMode.Enabled = false; // don't allow reviewer toggle out of view mode
btnCMEditorialMode.Visible = false;
} }
} }
public void SetupROEditorMode() public void SetupROEditorMode()