// 编辑权限 private void button_editUserRights_Click(object sender, EventArgs e) { bool bControl = Control.ModifierKeys == Keys.Control; string strRightsCfgFileName = Path.Combine(Program.MainForm.UserDir, "objectrights.xml"); DigitalPlatform.CommonControl.PropertyDlg dlg = new DigitalPlatform.CommonControl.PropertyDlg(); MainForm.SetControlFont(dlg, this.Font, false); dlg.StartPosition = FormStartPosition.CenterScreen; dlg.Text = "用户 '" + this.textBox_userName.Text + "' 的权限"; dlg.PropertyString = this.textBox_userRights.Text; dlg.CfgFileName = Program.MainForm.DataDir + "\\userrightsdef.xml"; if (bControl) { if (File.Exists(strRightsCfgFileName) == true) { dlg.CfgFileName += "," + strRightsCfgFileName; } } dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) { return; } this.textBox_userRights.Text = dlg.PropertyString; }
// parameters: // strStyle 包含哪些配置文件。patron/object 之一 void OpenRightsDialog(Control combobox, string strStyle) { DigitalPlatform.CommonControl.PropertyDlg dlg = new DigitalPlatform.CommonControl.PropertyDlg(); MainForm.SetControlFont(dlg, this.Font, false); List <string> filenames = new List <string>(); if (StringUtil.IsInList("object", strStyle) == true) { string strRightsCfgFileName = Path.Combine(this.UserDir, "objectrights.xml"); if (File.Exists(strRightsCfgFileName) == true) { filenames.Add(strRightsCfgFileName); } } if (StringUtil.IsInList("patron", strStyle) == true) { filenames.Add(Path.Combine(this.DataDir, "userrightsdef.xml")); } string strInput = combobox.Text; StringUtil.RemoveFromInList("<增、减>", true, ref strInput); StringUtil.RemoveFromInList("<不改变>", true, ref strInput); dlg.StartPosition = FormStartPosition.CenterScreen; if (StringUtil.IsInList("patron", strStyle) == true) { dlg.Text = "读者权限"; } else { dlg.Text = "对象权限"; } dlg.PropertyString = strInput; dlg.CfgFileName = StringUtil.MakePathList(filenames); #if NO dlg.CfgFileName = Path.Combine(this.DataDir, "userrightsdef.xml"); if (File.Exists(strRightsCfgFileName) == true) { dlg.CfgFileName += "," + strRightsCfgFileName; } #endif dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) { return; } combobox.Text = dlg.PropertyString; }
// parameters: // strStyle 包含哪些配置文件。patron/object 之一 void OpenRightsDialog(Control combobox, string strStyle) { DigitalPlatform.CommonControl.PropertyDlg dlg = new DigitalPlatform.CommonControl.PropertyDlg(); MainForm.SetControlFont(dlg, this.Font, false); List<string> filenames = new List<string>(); if (StringUtil.IsInList("object", strStyle) == true) { string strRightsCfgFileName = Path.Combine(this.UserDir, "objectrights.xml"); if (File.Exists(strRightsCfgFileName) == true) filenames.Add(strRightsCfgFileName); } if (StringUtil.IsInList("patron", strStyle) == true) filenames.Add(Path.Combine(this.DataDir, "userrightsdef.xml")); string strInput = combobox.Text; StringUtil.RemoveFromInList("<增、减>", true, ref strInput); StringUtil.RemoveFromInList("<不改变>", true, ref strInput); dlg.StartPosition = FormStartPosition.CenterScreen; if (StringUtil.IsInList("patron", strStyle) == true) dlg.Text = "读者权限"; else dlg.Text = "对象权限"; dlg.PropertyString = strInput; dlg.CfgFileName = StringUtil.MakePathList(filenames); #if NO dlg.CfgFileName = Path.Combine(this.DataDir, "userrightsdef.xml"); if (File.Exists(strRightsCfgFileName) == true) dlg.CfgFileName += "," + strRightsCfgFileName; #endif dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) return; combobox.Text = dlg.PropertyString; }
private void readerEditControl1_EditRights(object sender, EventArgs e) { DigitalPlatform.CommonControl.PropertyDlg dlg = new DigitalPlatform.CommonControl.PropertyDlg(); MainForm.SetControlFont(dlg, this.Font, false); string strRightsCfgFileName = Path.Combine(this.MainForm.UserDir, "objectrights.xml"); dlg.StartPosition = FormStartPosition.CenterScreen; dlg.Text = "当前读者的权限"; dlg.PropertyString = this.readerEditControl1.Rights; dlg.CfgFileName = Path.Combine(this.MainForm.DataDir, "userrightsdef.xml"); if (File.Exists(strRightsCfgFileName) == true) dlg.CfgFileName += "," + strRightsCfgFileName; dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) return; this.readerEditControl1.Rights = dlg.PropertyString; }
// 编辑权限 private void button_editUserRights_Click(object sender, EventArgs e) { DigitalPlatform.CommonControl.PropertyDlg dlg = new DigitalPlatform.CommonControl.PropertyDlg(); MainForm.SetControlFont(dlg, this.Font, false); dlg.StartPosition = FormStartPosition.CenterScreen; dlg.Text = "用户 '" + this.textBox_userName.Text + "' 的权限"; dlg.PropertyString = this.textBox_userRights.Text; dlg.CfgFileName = this.MainForm.DataDir + "\\userrightsdef.xml"; dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) return; this.textBox_userRights.Text = dlg.PropertyString; }