Use static function to check user’s security level in allowing changes to step properties

Use static function to check user’s security level in allowing the insert or change of a transition
Use static function to check user’s security level in allowing the user to edit a table cell
Use static function to check user’s security level in allowing text modifications when keyboard shortcuts are used
ROEditor only security is now also considered a Reviewer.  Don’t allow a Review goto an RO (run the RO editor), Don’t allow a Reviewer toggle out of view mode from the context menu, for Reviewers, don’t allow the Enter key enter new steps and substeps.
For Reviewers, when on a table (grid) have the Enter Key move down to the next step element, don’t allow Reviewers edit a table
This commit is contained in:
John Jenko 2015-12-09 21:04:02 +00:00
parent d8f7b0619c
commit bc6fcfd05b
6 changed files with 160 additions and 50 deletions

View File

@ -168,6 +168,15 @@ namespace Volian.Controls.Library
else else
cbPageBreak.Checked = false; // Page Break is set to false cbPageBreak.Checked = false; // Page Break is set to false
} }
public DocVersionInfo Mydvi = null; // this is initialized in vlnTreeComboSetsFillIn()
private static UserInfo _MyUserInfo = null;
public static UserInfo MyUserInfo
{
get { return _MyUserInfo; }
set { _MyUserInfo = value; }
}
private void TagsFillIn() private void TagsFillIn()
{ {
_Initalizing = true; _Initalizing = true;
@ -341,6 +350,8 @@ namespace Volian.Controls.Library
StepConfig sc2 = CurItemInfo.MyConfig as StepConfig; StepConfig sc2 = CurItemInfo.MyConfig as StepConfig;
tbRespons.Text = sc2.Step_Responsibility; tbRespons.Text = sc2.Step_Responsibility;
} }
// diable fields if user is only a reviewer
groupPanelCheckoff.Enabled = groupPanelChgBar.Enabled = groupPanelChgStepType.Enabled = groupPanelIncludeOn.Enabled = groupPanelPaginate.Enabled = groupPanelWcnTrnResp.Enabled = UserInfo.CanEdit(MyUserInfo, Mydvi); // Can Change Tag Info
_Initalizing = false; _Initalizing = false;
} }
private int DoListStepTypes(FormatData fmtdata, StepData topType, string curType) private int DoListStepTypes(FormatData fmtdata, StepData topType, string curType)

View File

@ -32,7 +32,8 @@ namespace Volian.Controls.Library
if (_CurTrans == value && _CurItemFrom == MyRTB.MyItemInfo) return; if (_CurTrans == value && _CurItemFrom == MyRTB.MyItemInfo) return;
_CurItemFrom = MyRTB.MyItemInfo; _CurItemFrom = MyRTB.MyItemInfo;
_TranFmtIndx = 0; _TranFmtIndx = 0;
btnTranSave.Enabled = btnTranCancel.Enabled = true; btnTranSave.Enabled = UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
btnTranCancel.Enabled = true;
} }
else // Modify a transition else // Modify a transition
{ {
@ -347,6 +348,7 @@ namespace Volian.Controls.Library
// so that the tree can be expanded highlighting (selecting) the current set. // so that the tree can be expanded highlighting (selecting) the current set.
List<FolderInfo> filist = new List<FolderInfo>(); List<FolderInfo> filist = new List<FolderInfo>();
DocVersionInfo mydocversion = prcitm.ActiveParent as DocVersionInfo; DocVersionInfo mydocversion = prcitm.ActiveParent as DocVersionInfo;
Mydvi = mydocversion; // used for security check
FolderInfo tmpfi = mydocversion.ActiveParent as FolderInfo; FolderInfo tmpfi = mydocversion.ActiveParent as FolderInfo;
while (tmpfi != null) while (tmpfi != null)
{ {
@ -949,7 +951,7 @@ namespace Volian.Controls.Library
if (sectstartid == -1) btnTranSave.Enabled = false; // if there is an invalid section start - don't allow save. if (sectstartid == -1) btnTranSave.Enabled = false; // if there is an invalid section start - don't allow save.
IList chldrn = prcitm.GetChildren(); IList chldrn = prcitm.GetChildren();
cbTranSectsFillIn((ItemInfo)chldrn[0], sectstartid, true); cbTranSectsFillIn((ItemInfo)chldrn[0], sectstartid, true);
btnTranSave.Enabled = true; btnTranSave.Enabled = UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
SaveCancelEnabling(); SaveCancelEnabling();
} }
private void tvTran_AfterSelect(object sender, TreeViewEventArgs e) private void tvTran_AfterSelect(object sender, TreeViewEventArgs e)
@ -958,7 +960,7 @@ namespace Volian.Controls.Library
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI; E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI;
if ((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone && tvTran.SelectedNode.Tag==null) if ((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone && tvTran.SelectedNode.Tag==null)
{ {
btnTranSave.Enabled = true; btnTranSave.Enabled = UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
return; return;
} }
// check if node is a true end-point, i.e. not a 'part' node. If part node, don't // check if node is a true end-point, i.e. not a 'part' node. If part node, don't
@ -991,7 +993,7 @@ namespace Volian.Controls.Library
tvTranRangeHilites(true, _RangeNode1, _RangeNode2); tvTranRangeHilites(true, _RangeNode1, _RangeNode2);
lblxTranRangeTip.Text = "Select First Transition\r\nfor Range"; lblxTranRangeTip.Text = "Select First Transition\r\nfor Range";
lblxTranRangeTip.BackColor = Color.Yellow; lblxTranRangeTip.BackColor = Color.Yellow;
btnTranSave.Enabled = true; btnTranSave.Enabled = UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
} }
} }
} }
@ -1000,7 +1002,7 @@ namespace Volian.Controls.Library
//bool hasChanged = _CurItemFrom != _SavCurItemFrom || _TranFmtIndx != _SavTranFmtIndx //bool hasChanged = _CurItemFrom != _SavCurItemFrom || _TranFmtIndx != _SavTranFmtIndx
// || ( selii != null && _CurTrans.ToID != selii.ItemID); // || ( selii != null && _CurTrans.ToID != selii.ItemID);
bool hasChanged = SettingsChanged; bool hasChanged = SettingsChanged;
btnTranSave.Enabled = hasChanged; btnTranSave.Enabled = hasChanged && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
btnTranCancel.Enabled = _CurTrans != null && hasChanged; btnTranCancel.Enabled = _CurTrans != null && hasChanged;
//btnTranSave.Enabled = allowSave; //btnTranSave.Enabled = allowSave;
//if (CurTrans != null && selii != null) //if (CurTrans != null && selii != null)
@ -1280,6 +1282,15 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
public DocVersionInfo Mydvi = null; // this is initialized in vlnTreeComboSetsFillIn()
private static UserInfo _MyUserInfo = null;
public static UserInfo MyUserInfo
{
get { return _MyUserInfo; }
set { _MyUserInfo = value; }
}
private void cbIncStepNum_CheckedChanged(object sender, EventArgs e) private void cbIncStepNum_CheckedChanged(object sender, EventArgs e)
{ {
tvTran.Enabled=cbIncStepNum.Checked; tvTran.Enabled=cbIncStepNum.Checked;
@ -1288,7 +1299,10 @@ namespace Volian.Controls.Library
private void cbPageNum_CheckedChanged(object sender, EventArgs e) private void cbPageNum_CheckedChanged(object sender, EventArgs e)
{ {
if (_ModExistingPageNum != cbPageNum.Checked) if (_ModExistingPageNum != cbPageNum.Checked)
btnTranCancel.Enabled = btnTranSave.Enabled = true; {
btnTranCancel.Enabled = true;
btnTranSave.Enabled = UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
}
} }
} }
public class TransItem public class TransItem

View File

@ -17,6 +17,27 @@ namespace Volian.Controls.Library
public partial class GridItem : EditItem public partial class GridItem : EditItem
{ {
#region Fields #region Fields
private DocVersionInfo _MyDVI = null;
public DocVersionInfo MyDVI
{
get
{
ItemInfo procInfo = MyItemInfo.MyProcedure as ItemInfo;
if (procInfo == null)
_MyDVI = null;
else
_MyDVI = procInfo.ActiveParent as DocVersionInfo;
return _MyDVI;
}
}
private static UserInfo _MyUserInfo = null;
public static UserInfo MyUserInfo
{
get { return _MyUserInfo; }
set { _MyUserInfo = value; }
}
private bool _IsSaving; private bool _IsSaving;
public bool IsSaving public bool IsSaving
{ {
@ -62,7 +83,7 @@ namespace Volian.Controls.Library
if (MyStepPanel.DisplayItemChanging) return; if (MyStepPanel.DisplayItemChanging) return;
MyStepRTB.MyItemInfo = MyItemInfo; // should be in vlnFlexGrid MyStepRTB.MyItemInfo = MyItemInfo; // should be in vlnFlexGrid
MyStepPanel.SelectedEditItem = this; MyStepPanel.SelectedEditItem = this;
if (MyFlexGrid.IsRoTable) if (MyFlexGrid.IsRoTable || !UserInfo.CanEdit(MyUserInfo,MyDVI));//(!MyUserInfo.IsAdministrator() && ! MyUserInfo.IsSetAdministrator(MyDVI) && !MyUserInfo.IsWriter(MyDVI)))
{ {
MyFlexGrid.Cols.Fixed = MyFlexGrid.Cols.Count; MyFlexGrid.Cols.Fixed = MyFlexGrid.Cols.Count;
MyFlexGrid.Rows.Fixed = MyFlexGrid.Rows.Count; MyFlexGrid.Rows.Fixed = MyFlexGrid.Rows.Count;
@ -784,7 +805,7 @@ namespace Volian.Controls.Library
{ {
Focus(); Focus();
MyFlexGrid.Focus(); MyFlexGrid.Focus();
if (!MyFlexGrid.IsRoTable) // Table ROs are none editable - don't select a table cell if (!MyFlexGrid.IsRoTable) // Table ROs are not editable - don't select a table cell
{ {
try try
{ {

View File

@ -232,6 +232,27 @@ namespace Volian.Controls.Library
OnEditModeChanged(this, new EventArgs()); OnEditModeChanged(this, new EventArgs());
} }
} }
private DocVersionInfo _MyDVI = null;
public DocVersionInfo MyDVI
{
get
{
ItemInfo procInfo = _MyItemInfo.MyProcedure as ItemInfo;
if (procInfo == null)
_MyDVI = null;
else
_MyDVI = procInfo.ActiveParent as DocVersionInfo;
return _MyDVI;
}
}
private static UserInfo _MyUserInfo = null;
public static UserInfo MyUserInfo
{
get { return _MyUserInfo; }
set { _MyUserInfo = value; }
}
private static string _MySymbolFontName; private static string _MySymbolFontName;
public static string MySymbolFontName public static string MySymbolFontName
{ {
@ -1881,7 +1902,7 @@ namespace Volian.Controls.Library
if (newend > 0) SetSelection(SelectionStart, newend - SelectionStart); if (newend > 0) SetSelection(SelectionStart, newend - SelectionStart);
break; break;
case Keys.Space: case Keys.Space:
if (e.Control) // Hardspace - Ctrl+Shift+Space if (e.Control && MyDVI!= null && UserInfo.CanEdit(MyUserInfo,MyDVI)); // Hardspace - Ctrl+Shift+Space
InsertSymbol(@"\u160?"); InsertSymbol(@"\u160?");
break; break;
case Keys.F3: // shift F3 case Keys.F3: // shift F3
@ -2283,13 +2304,22 @@ namespace Volian.Controls.Library
case Keys.Enter: case Keys.Enter:
if (!e.Control && !e.Shift && !e.Alt) if (!e.Control && !e.Shift && !e.Alt)
{ {
OnEnterKeyPressed(sender, e); if (UserInfo.CanEdit(MyUserInfo,MyItemInfo.MyDocVersion))
OnEnterKeyPressed(sender, e);
else
{
// user cannot change data so just move to the next step element
StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown); // perform a <Ctrl><DownArrow>
HandleLocalSelectionChange();
e.Handled = true;
}
} }
break; break;
case Keys.F2: case Keys.F2:
if (e.Alt && !e.Control && !e.Shift) // toggle change bar if (e.Alt && !e.Control && !e.Shift) // toggle change bar
{ {
OnToggleChangeBar(this, new EventArgs()); if (MyUserInfo.IsAdministrator() || MyUserInfo.IsSetAdministrator(MyDVI) || MyUserInfo.IsWriter(MyDVI))
OnToggleChangeBar(this, new EventArgs());
e.Handled = true; e.Handled = true;
} }
break; break;

View File

@ -71,23 +71,23 @@ namespace Volian.Controls.Library
} }
// added jcb 20121221 to support set ro from word doc // added jcb 20121221 to support set ro from word doc
private ROFSTLookup MyLookup; private ROFSTLookup MyLookup;
private DocVersionInfo _MyDVI; private DocVersionInfo _Mydvi;
public DocVersionInfo MyDVI public DocVersionInfo Mydvi
{ {
get get
{ {
if (_MyDVI != null) return _MyDVI; if (_Mydvi != null) return _Mydvi;
if (_MyEditItem != null) if (_MyEditItem != null)
{ {
ItemInfo procInfo = _MyEditItem.MyItemInfo.MyProcedure as ItemInfo; ItemInfo procInfo = _MyEditItem.MyItemInfo.MyProcedure as ItemInfo;
if (procInfo == null) return null; if (procInfo == null) return null;
_MyDVI = procInfo.ActiveParent as DocVersionInfo; _Mydvi = procInfo.ActiveParent as DocVersionInfo;
// added jcb 20121221 to support set ro from word doc // added jcb 20121221 to support set ro from word doc
if (_MyDVI.DocVersionAssociations != null && _MyDVI.DocVersionAssociations.Count > 0) if (_Mydvi.DocVersionAssociations != null && _Mydvi.DocVersionAssociations.Count > 0)
MyLookup = _MyDVI.DocVersionAssociations[0].MyROFst.GetROFSTLookup(_MyDVI); MyLookup = _Mydvi.DocVersionAssociations[0].MyROFst.GetROFSTLookup(_Mydvi);
else else
MyLookup = null; MyLookup = null;
return _MyDVI; return _Mydvi;
} }
return null; return null;
} }
@ -318,7 +318,7 @@ namespace Volian.Controls.Library
{ {
bool rv = false; bool rv = false;
MyAvailableROs = new Dictionary<string, string>(); MyAvailableROs = new Dictionary<string, string>();
if (MyDVI != null) if (Mydvi != null)
{ {
#region force arp without hi or lo jcb 20121221 #region force arp without hi or lo jcb 20121221
//if (data == "<ARP CDS-LT002-1-MED-LO1 \\s\\l\\1>") //if (data == "<ARP CDS-LT002-1-MED-LO1 \\s\\l\\1>")
@ -328,7 +328,7 @@ namespace Volian.Controls.Library
//} //}
#endregion #endregion
string accPageID = GetAccPageID(data); string accPageID = GetAccPageID(data);
ROFSTLookup.rochild? roc = MyLookup.GetRoChildByAccPagID(accPageID, MyDVI.DocVersionConfig.RODefaults_setpointprefix, MyDVI.DocVersionConfig.RODefaults_graphicsprefix); ROFSTLookup.rochild? roc = MyLookup.GetRoChildByAccPagID(accPageID, Mydvi.DocVersionConfig.RODefaults_setpointprefix, Mydvi.DocVersionConfig.RODefaults_graphicsprefix);
if (roc != null) if (roc != null)
{ {
int index = GetROValueIndex(data); int index = GetROValueIndex(data);
@ -354,7 +354,7 @@ namespace Volian.Controls.Library
for (int i = 1; i < 4; i++) for (int i = 1; i < 4; i++)
{ {
tmpAccPageID = accPageID + suffix + i.ToString(); tmpAccPageID = accPageID + suffix + i.ToString();
roc = MyLookup.GetRoChildByAccPagID(tmpAccPageID, MyDVI.DocVersionConfig.RODefaults_setpointprefix, MyDVI.DocVersionConfig.RODefaults_graphicsprefix); roc = MyLookup.GetRoChildByAccPagID(tmpAccPageID, Mydvi.DocVersionConfig.RODefaults_setpointprefix, Mydvi.DocVersionConfig.RODefaults_graphicsprefix);
if (roc != null) if (roc != null)
{ {
int index = GetROValueIndex(data); int index = GetROValueIndex(data);
@ -370,7 +370,7 @@ namespace Volian.Controls.Library
for (int i = 1; i < 4; i++) for (int i = 1; i < 4; i++)
{ {
tmpAccPageID = accPageID + suffix + i.ToString(); tmpAccPageID = accPageID + suffix + i.ToString();
roc = MyLookup.GetRoChildByAccPagID(tmpAccPageID, MyDVI.DocVersionConfig.RODefaults_setpointprefix, MyDVI.DocVersionConfig.RODefaults_graphicsprefix); roc = MyLookup.GetRoChildByAccPagID(tmpAccPageID, Mydvi.DocVersionConfig.RODefaults_setpointprefix, Mydvi.DocVersionConfig.RODefaults_graphicsprefix);
if (roc != null) if (roc != null)
{ {
int index = GetROValueIndex(data); int index = GetROValueIndex(data);
@ -392,7 +392,7 @@ namespace Volian.Controls.Library
//<STP L19 \\v \\E \\H \\P \\S > //<STP L19 \\v \\E \\H \\P \\S >
//<ARP FWS-MP-02C-TMP1 \\s \\h \\1> //<ARP FWS-MP-02C-TMP1 \\s \\h \\1>
txt = txt.Replace("<MEL ", "MEL-"); txt = txt.Replace("<MEL ", "MEL-");
txt = txt.Replace("<STP ", MyDVI.DocVersionConfig.RODefaults_setpointprefix + "-"); txt = txt.Replace("<STP ", Mydvi.DocVersionConfig.RODefaults_setpointprefix + "-");
txt = txt.Replace("<ARP ", "ARP-"); txt = txt.Replace("<ARP ", "ARP-");
int i = txt.IndexOf(" "); int i = txt.IndexOf(" ");
txt = txt.Substring(0, i); txt = txt.Substring(0, i);
@ -831,16 +831,10 @@ namespace Volian.Controls.Library
btnCMEditRO.Enabled = false; btnCMEditRO.Enabled = false;
} }
} }
private bool CanEditROs()
{
// Test to see if the user is allowed to run the RO Edior
// writers and reviewers are not allowed to run the RO Editor
return MyUserInfo.IsAdministrator() || MyUserInfo.IsSetAdministrator(MyDVI) || MyUserInfo.IsROEditor(MyDVI);
}
private void SetupGoToButton() private void SetupGoToButton()
{ {
if (MyEditItem is GridItem && (MyEditItem as GridItem).MyFlexGrid.IsRoTable) if (MyEditItem is GridItem && (MyEditItem as GridItem).MyFlexGrid.IsRoTable)
btnCMGoTo.Enabled = btnGoTo.Enabled = CanEditROs();//Don't allow Writers and Reviews run the RO Editor btnCMGoTo.Enabled = btnGoTo.Enabled = UserInfo.CanEditROs(MyUserInfo, Mydvi);//Don't allow Writers and Reviews run the RO Editor
else else
{ {
if (_MyStepRTB == null) return; if (_MyStepRTB == null) return;
@ -848,7 +842,7 @@ namespace Volian.Controls.Library
{ {
// if selected text = ?, i.e. a missing/undefined destination, don't allow go to // if selected text = ?, i.e. a missing/undefined destination, don't allow go to
// if the selected link is an RO then check to see if the user is allowed to run the RO Editor (writers and reviewers cannot run the RO Editor) // if the selected link is an RO then check to see if the user is allowed to run the RO Editor (writers and reviewers cannot run the RO Editor)
btnCMGoTo.Enabled = btnGoTo.Enabled = !_MyStepRTB.SelectedText.StartsWith("?") && (_MyStepRTB.SelectedText.Contains("Transition") || (_MyStepRTB.SelectedText.Contains("ReferencedObject") && CanEditROs())); btnCMGoTo.Enabled = btnGoTo.Enabled = !_MyStepRTB.SelectedText.StartsWith("?") && (_MyStepRTB.SelectedText.Contains("Transition") || (_MyStepRTB.SelectedText.Contains("ReferencedObject") && UserInfo.CanEditROs(MyUserInfo, Mydvi)));
} }
else else
btnCMGoTo.Enabled = btnGoTo.Enabled = false; btnCMGoTo.Enabled = btnGoTo.Enabled = false;
@ -2071,12 +2065,22 @@ 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
} }
} }
public void SetupROEditorMode() public void SetupROEditorMode()
{ {
btnToggleEditView_Click(null, new EventArgs()); if (MyEditItem != null && MyEditItem.MyStepPanel.VwMode == E_ViewMode.Edit)
rtabView.Visible = false; {
// bug fix B2015-188
// user with ROEditor only security also has Review privledges
btnToggleEditView_Click(null, new EventArgs());
rtabView.Visible = false;
rtabHome.Visible = false;
rtabInsert.Visible = false;
rtabAdmin.Select();
btnCMEditMode1.Enabled = btnEditMode.Enabled = false;
}
} }
public void SetupWriterMode() public void SetupWriterMode()
{ {
@ -2132,15 +2136,15 @@ namespace Volian.Controls.Library
// MessageBox.Show("Could not find path to Ro Editor, check 'roapp' environment variable"); // MessageBox.Show("Could not find path to Ro Editor, check 'roapp' environment variable");
// return; // return;
//} //}
if (MyDVI == null || MyDVI.DocVersionAssociationCount < 1) if (Mydvi == null || Mydvi.DocVersionAssociationCount < 1)
{ {
MessageBox.Show("Could not find associated path for ro data.", "No RO Data", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Could not find associated path for ro data.", "No RO Data", MessageBoxButtons.OK, MessageBoxIcon.Information);
return; return;
} }
string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\""; string roloc = "\"" + Mydvi.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\"";
if (!Directory.Exists(MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath)) if (!Directory.Exists(Mydvi.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath))
{ {
MessageBox.Show(string.Format("RO Database directory does not exist: {0}", MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath)); MessageBox.Show(string.Format("RO Database directory does not exist: {0}", Mydvi.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath));
return; return;
} }
System.Diagnostics.Process.Start(roapp, roloc); System.Diagnostics.Process.Start(roapp, roloc);
@ -2151,13 +2155,13 @@ namespace Volian.Controls.Library
InitialProgressBarMessage = "Updating ROs"; InitialProgressBarMessage = "Updating ROs";
// use rodb directory path of the first rofst for the this document version. Later, will need // use rodb directory path of the first rofst for the this document version. Later, will need
// to modify code to get which one (when there is more than one) // to modify code to get which one (when there is more than one)
if (MyDVI.DocVersionAssociations.Count < 1) if (Mydvi.DocVersionAssociations.Count < 1)
{ {
FinalProgressBarMessage = "No ROs associated"; FinalProgressBarMessage = "No ROs associated";
MessageBox.Show("Error Updating ro.fst. No associated ro.fst"); MessageBox.Show("Error Updating ro.fst. No associated ro.fst");
return; return;
} }
ROFstInfo roFstInfo = MyDVI.DocVersionAssociations[0].MyROFst; ROFstInfo roFstInfo = Mydvi.DocVersionAssociations[0].MyROFst;
string rofstPath = roFstInfo.MyRODb.FolderPath + @"\ro.fst"; string rofstPath = roFstInfo.MyRODb.FolderPath + @"\ro.fst";
if (!File.Exists(rofstPath)) if (!File.Exists(rofstPath))
@ -2181,7 +2185,7 @@ namespace Volian.Controls.Library
} }
Cursor = Cursors.WaitCursor; Cursor = Cursors.WaitCursor;
using (DocVersion dv = DocVersion.Get(MyDVI.VersionID)) using (DocVersion dv = DocVersion.Get(Mydvi.VersionID))
{ {
roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
ROFst newrofst = ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv.DocVersionAssociations[0], dv, roFstInfo, DoProgressBarRefresh); ROFst newrofst = ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv.DocVersionAssociations[0], dv, roFstInfo, DoProgressBarRefresh);
@ -2278,7 +2282,7 @@ namespace Volian.Controls.Library
{ {
ribbonTab_SingleClick(sender, e); ribbonTab_SingleClick(sender, e);
btnUpdROVal.Enabled = false; btnUpdROVal.Enabled = false;
if (MyDVI.DocVersionAssociations == null || MyDVI.DocVersionAssociations.Count < 1) if (Mydvi.DocVersionAssociations == null || Mydvi.DocVersionAssociations.Count < 1)
{ {
btnROEdit.Enabled = false; btnROEdit.Enabled = false;
return; return;
@ -2289,8 +2293,8 @@ namespace Volian.Controls.Library
} }
public bool NewerRoFst() public bool NewerRoFst()
{ {
if (_MyDVI == null)return false; if (_Mydvi == null)return false;
return _MyDVI.NewerRoFst; return _Mydvi.NewerRoFst;
} }
public void SetUpdRoValBtn(bool en) public void SetUpdRoValBtn(bool en)
{ {
@ -2483,7 +2487,7 @@ namespace Volian.Controls.Library
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMStepPaste); _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMStepPaste);
break; break;
} }
if (displayMenu) if (displayMenu && UserInfo.CanEdit(MyUserInfo, Mydvi));
{ {
SendKeys.Send("+{F10}{DOWN}"); // Display Context menu SendKeys.Send("+{F10}{DOWN}"); // Display Context menu
while (moveDown > 0) // position to current type while (moveDown > 0) // position to current type

View File

@ -112,6 +112,30 @@ namespace Volian.Controls.Library
// } // }
// return sb.ToString(); // return sb.ToString();
//} //}
private DocVersionInfo _MyDVI = null;
public DocVersionInfo MyDVI
{
get
{
ItemInfo procInfo = _MyItemInfo.MyProcedure as ItemInfo; //_MyEditItem.MyItemInfo.MyProcedure as ItemInfo;
if (procInfo == null)
_MyDVI = null;
else
_MyDVI = procInfo.ActiveParent as DocVersionInfo;
return _MyDVI;
}
}
private static UserInfo _MyUserInfo = null;
public static UserInfo MyUserInfo
{
get { return _MyUserInfo; }
set
{
_MyUserInfo = value;
GridItem.MyUserInfo = value;
}
}
public bool IsDirty public bool IsDirty
{ {
get get
@ -1170,13 +1194,17 @@ namespace Volian.Controls.Library
e.Handled = true; e.Handled = true;
break; break;
case Keys.Enter: case Keys.Enter:
//if (e.Shift) return;
//Select(Rows.Count - 1, 0);
//_tableCellEditor.StepRTB_ArrowPressed(E_ArrowKeys.Down);
//e.Handled = true;
if (!e.Control && !e.Shift && !e.Alt) if (!e.Control && !e.Shift && !e.Alt)
{ {
OnEnterKeyPressed(sender, e); if (MyDVI != null && UserInfo.CanEdit(MyUserInfo,MyDVI))
OnEnterKeyPressed(sender, e);
else
{
// if a Reviewer, then do a <Ctrl><DownArrow>. Don't allow changes to a table
if (IsRoTable) Select(Rows.Count - 1, 0);
_tableCellEditor.StepRTB_ArrowPressed(e.Control ? E_ArrowKeys.CtrlDown : E_ArrowKeys.Down);
e.Handled = true;
}
} }
break; break;
} }
@ -4571,8 +4599,10 @@ namespace Volian.Controls.Library
// start editing: move to cell and activate // start editing: move to cell and activate
public void StartEditing(int row, int col) public void StartEditing(int row, int col)
{ {
ItemInfo pinfo = MyItemInfo.MyProcedure as ItemInfo;
DocVersionInfo dvi = (pinfo == null) ? null : pinfo.ActiveParent as DocVersionInfo;
_initializingEdit = true; _initializingEdit = true;
ReadOnly = IsRoTable; ReadOnly = IsRoTable || !UserInfo.CanEdit(MyUserInfo, dvi); // reviewer cannot make changes to a table
// save coordinates of cell being edited // save coordinates of cell being edited
_row = row; _row = row;
_col = col; _col = col;