Exemplo n.º 1
0
        private void treeView_resRightTree_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
        {
            if (treeView_resRightTree.SelectedNode == null)
            {
                return;
            }

            // NodeInfo nodeinfo = (NodeInfo)treeView_resRightTree.SelectedNode.Tag;

            // bool bExpandable = false;

            // if (nodeinfo != null)
            //  bExpandable = nodeinfo.Expandable;

            ResPath respath = new ResPath(treeView_resRightTree.SelectedNode);

            this.textBox_objectRights_rights.Text = ResRightTree.GetNodeRights(treeView_resRightTree.SelectedNode);
            this.label_objectRights_rights.Text   = "对象 '" + respath.Path + "' 的权限(&R)";

            if (ResRightTree.GetNodeExpandable(treeView_resRightTree.SelectedNode) == false)
            {
                listView_resRightList.Items.Clear();
            }
            else
            {
                listView_resRightList.Path = respath.Path;
                listView_resRightList.Fill();
            }
        }
Exemplo n.º 2
0
 void quickrights_GetNodeStyle(object sender, GetNodeStyleEventArgs e)
 {
     e.Style = ResRightTree.GetNodeStyle(e.Node);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UserRightsDlg));
     this.button_resetPassword = new System.Windows.Forms.Button();
     this.textBox_userName     = new System.Windows.Forms.TextBox();
     this.label1 = new System.Windows.Forms.Label();
     this.tableLayoutPanel_right         = new System.Windows.Forms.TableLayoutPanel();
     this.listView_resRightList          = new DigitalPlatform.rms.Client.ResRightList();
     this.label_objectRights_rights      = new System.Windows.Forms.Label();
     this.textBox_objectRights_rights    = new System.Windows.Forms.TextBox();
     this.button_objectRights_editRights = new System.Windows.Forms.Button();
     this.treeView_resRightTree          = new DigitalPlatform.rms.Client.ResRightTree();
     this.textBox_userRecord             = new System.Windows.Forms.TextBox();
     this.button_OK             = new System.Windows.Forms.Button();
     this.button_Cancel         = new System.Windows.Forms.Button();
     this.splitContainer_rights = new System.Windows.Forms.SplitContainer();
     this.tabControl_main       = new System.Windows.Forms.TabControl();
     this.tabPage_generalInfo   = new System.Windows.Forms.TabPage();
     this.tabPage_objectRights  = new System.Windows.Forms.TabPage();
     this.tabPage_userRecord    = new System.Windows.Forms.TabPage();
     this.tableLayoutPanel_right.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer_rights)).BeginInit();
     this.splitContainer_rights.Panel1.SuspendLayout();
     this.splitContainer_rights.Panel2.SuspendLayout();
     this.splitContainer_rights.SuspendLayout();
     this.tabControl_main.SuspendLayout();
     this.tabPage_generalInfo.SuspendLayout();
     this.tabPage_objectRights.SuspendLayout();
     this.tabPage_userRecord.SuspendLayout();
     this.SuspendLayout();
     //
     // button_resetPassword
     //
     this.button_resetPassword.Location = new System.Drawing.Point(70, 46);
     this.button_resetPassword.Name     = "button_resetPassword";
     this.button_resetPassword.Size     = new System.Drawing.Size(144, 23);
     this.button_resetPassword.TabIndex = 2;
     this.button_resetPassword.Text     = "重设密码(&R)";
     this.button_resetPassword.Click   += new System.EventHandler(this.button_resetPassword_Click);
     //
     // textBox_userName
     //
     this.textBox_userName.Location     = new System.Drawing.Point(70, 19);
     this.textBox_userName.Name         = "textBox_userName";
     this.textBox_userName.Size         = new System.Drawing.Size(248, 21);
     this.textBox_userName.TabIndex     = 1;
     this.textBox_userName.TextChanged += new System.EventHandler(this.textBox_userName_TextChanged);
     //
     // label1
     //
     this.label1.AutoSize = true;
     this.label1.Location = new System.Drawing.Point(9, 25);
     this.label1.Name     = "label1";
     this.label1.Size     = new System.Drawing.Size(47, 12);
     this.label1.TabIndex = 0;
     this.label1.Text     = "用户名:";
     //
     // tableLayoutPanel_right
     //
     this.tableLayoutPanel_right.ColumnCount = 1;
     this.tableLayoutPanel_right.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
     this.tableLayoutPanel_right.Controls.Add(this.listView_resRightList, 0, 3);
     this.tableLayoutPanel_right.Controls.Add(this.label_objectRights_rights, 0, 0);
     this.tableLayoutPanel_right.Controls.Add(this.textBox_objectRights_rights, 0, 1);
     this.tableLayoutPanel_right.Controls.Add(this.button_objectRights_editRights, 0, 2);
     this.tableLayoutPanel_right.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.tableLayoutPanel_right.Location = new System.Drawing.Point(0, 0);
     this.tableLayoutPanel_right.Name     = "tableLayoutPanel_right";
     this.tableLayoutPanel_right.RowCount = 4;
     this.tableLayoutPanel_right.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.tableLayoutPanel_right.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.tableLayoutPanel_right.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.tableLayoutPanel_right.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.tableLayoutPanel_right.Size     = new System.Drawing.Size(338, 273);
     this.tableLayoutPanel_right.TabIndex = 2;
     //
     // listView_resRightList
     //
     this.listView_resRightList.Dock          = System.Windows.Forms.DockStyle.Fill;
     this.listView_resRightList.FullRowSelect = true;
     this.listView_resRightList.HideSelection = false;
     this.listView_resRightList.Location      = new System.Drawing.Point(3, 72);
     this.listView_resRightList.Name          = "listView_resRightList";
     this.listView_resRightList.Size          = new System.Drawing.Size(332, 198);
     this.listView_resRightList.TabIndex      = 3;
     this.listView_resRightList.UseCompatibleStateImageBehavior = false;
     this.listView_resRightList.View = System.Windows.Forms.View.Details;
     //
     // label_objectRights_rights
     //
     this.label_objectRights_rights.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                                   | System.Windows.Forms.AnchorStyles.Right)));
     this.label_objectRights_rights.AutoSize = true;
     this.label_objectRights_rights.Location = new System.Drawing.Point(3, 0);
     this.label_objectRights_rights.Name     = "label_objectRights_rights";
     this.label_objectRights_rights.Size     = new System.Drawing.Size(332, 12);
     this.label_objectRights_rights.TabIndex = 0;
     this.label_objectRights_rights.Text     = "权限(&R):";
     //
     // textBox_objectRights_rights
     //
     this.textBox_objectRights_rights.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                                     | System.Windows.Forms.AnchorStyles.Right)));
     this.textBox_objectRights_rights.Location     = new System.Drawing.Point(3, 15);
     this.textBox_objectRights_rights.Name         = "textBox_objectRights_rights";
     this.textBox_objectRights_rights.Size         = new System.Drawing.Size(332, 21);
     this.textBox_objectRights_rights.TabIndex     = 1;
     this.textBox_objectRights_rights.TextChanged += new System.EventHandler(this.textBox_objectRights_rights_TextChanged);
     //
     // button_objectRights_editRights
     //
     this.button_objectRights_editRights.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.button_objectRights_editRights.Location = new System.Drawing.Point(298, 42);
     this.button_objectRights_editRights.Name     = "button_objectRights_editRights";
     this.button_objectRights_editRights.Size     = new System.Drawing.Size(37, 24);
     this.button_objectRights_editRights.TabIndex = 2;
     this.button_objectRights_editRights.Text     = "...";
     this.button_objectRights_editRights.UseVisualStyleBackColor = true;
     this.button_objectRights_editRights.Click += new System.EventHandler(this.button_objectRights_editRights_Click);
     //
     // treeView_resRightTree
     //
     this.treeView_resRightTree.Changed              = false;
     this.treeView_resRightTree.Dock                 = System.Windows.Forms.DockStyle.Fill;
     this.treeView_resRightTree.HideSelection        = false;
     this.treeView_resRightTree.ImageIndex           = 0;
     this.treeView_resRightTree.Location             = new System.Drawing.Point(0, 0);
     this.treeView_resRightTree.Name                 = "treeView_resRightTree";
     this.treeView_resRightTree.SelectedImageIndex   = 0;
     this.treeView_resRightTree.Size                 = new System.Drawing.Size(170, 273);
     this.treeView_resRightTree.TabIndex             = 0;
     this.treeView_resRightTree.OnSetMenu           += new DigitalPlatform.GUI.GuiAppendMenuEventHandle(this.treeView_resRightTree_OnSetMenu);
     this.treeView_resRightTree.OnNodeRightsChanged += new DigitalPlatform.rms.Client.NodeRightsChangedEventHandle(this.treeView_resRightTree_OnNodeRightsChanged);
     this.treeView_resRightTree.AfterSelect         += new System.Windows.Forms.TreeViewEventHandler(this.treeView_resRightTree_AfterSelect);
     //
     // textBox_userRecord
     //
     this.textBox_userRecord.Dock          = System.Windows.Forms.DockStyle.Fill;
     this.textBox_userRecord.HideSelection = false;
     this.textBox_userRecord.Location      = new System.Drawing.Point(6, 6);
     this.textBox_userRecord.Multiline     = true;
     this.textBox_userRecord.Name          = "textBox_userRecord";
     this.textBox_userRecord.ReadOnly      = true;
     this.textBox_userRecord.ScrollBars    = System.Windows.Forms.ScrollBars.Both;
     this.textBox_userRecord.Size          = new System.Drawing.Size(512, 273);
     this.textBox_userRecord.TabIndex      = 0;
     //
     // button_OK
     //
     this.button_OK.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.button_OK.Location = new System.Drawing.Point(383, 329);
     this.button_OK.Name     = "button_OK";
     this.button_OK.Size     = new System.Drawing.Size(75, 23);
     this.button_OK.TabIndex = 1;
     this.button_OK.Text     = "确定";
     this.button_OK.Click   += new System.EventHandler(this.button_OK_Click);
     //
     // button_Cancel
     //
     this.button_Cancel.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.button_Cancel.Location = new System.Drawing.Point(464, 329);
     this.button_Cancel.Name     = "button_Cancel";
     this.button_Cancel.Size     = new System.Drawing.Size(76, 23);
     this.button_Cancel.TabIndex = 2;
     this.button_Cancel.Text     = "取消";
     this.button_Cancel.Click   += new System.EventHandler(this.button_Cancel_Click);
     //
     // splitContainer_rights
     //
     this.splitContainer_rights.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.splitContainer_rights.Location = new System.Drawing.Point(6, 6);
     this.splitContainer_rights.Name     = "splitContainer_rights";
     //
     // splitContainer_rights.Panel1
     //
     this.splitContainer_rights.Panel1.Controls.Add(this.treeView_resRightTree);
     //
     // splitContainer_rights.Panel2
     //
     this.splitContainer_rights.Panel2.Controls.Add(this.tableLayoutPanel_right);
     this.splitContainer_rights.Size             = new System.Drawing.Size(512, 273);
     this.splitContainer_rights.SplitterDistance = 170;
     this.splitContainer_rights.TabIndex         = 3;
     //
     // tabControl_main
     //
     this.tabControl_main.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                          | System.Windows.Forms.AnchorStyles.Left)
                                                                         | System.Windows.Forms.AnchorStyles.Right)));
     this.tabControl_main.Controls.Add(this.tabPage_generalInfo);
     this.tabControl_main.Controls.Add(this.tabPage_objectRights);
     this.tabControl_main.Controls.Add(this.tabPage_userRecord);
     this.tabControl_main.Location      = new System.Drawing.Point(12, 12);
     this.tabControl_main.Name          = "tabControl_main";
     this.tabControl_main.SelectedIndex = 0;
     this.tabControl_main.Size          = new System.Drawing.Size(532, 311);
     this.tabControl_main.TabIndex      = 3;
     //
     // tabPage_generalInfo
     //
     this.tabPage_generalInfo.Controls.Add(this.button_resetPassword);
     this.tabPage_generalInfo.Controls.Add(this.textBox_userName);
     this.tabPage_generalInfo.Controls.Add(this.label1);
     this.tabPage_generalInfo.Location = new System.Drawing.Point(4, 22);
     this.tabPage_generalInfo.Name     = "tabPage_generalInfo";
     this.tabPage_generalInfo.Padding  = new System.Windows.Forms.Padding(6);
     this.tabPage_generalInfo.Size     = new System.Drawing.Size(524, 285);
     this.tabPage_generalInfo.TabIndex = 0;
     this.tabPage_generalInfo.Text     = "一般信息";
     this.tabPage_generalInfo.UseVisualStyleBackColor = true;
     //
     // tabPage_objectRights
     //
     this.tabPage_objectRights.Controls.Add(this.splitContainer_rights);
     this.tabPage_objectRights.Location = new System.Drawing.Point(4, 22);
     this.tabPage_objectRights.Name     = "tabPage_objectRights";
     this.tabPage_objectRights.Padding  = new System.Windows.Forms.Padding(6);
     this.tabPage_objectRights.Size     = new System.Drawing.Size(524, 285);
     this.tabPage_objectRights.TabIndex = 1;
     this.tabPage_objectRights.Text     = "对象权限";
     this.tabPage_objectRights.UseVisualStyleBackColor = true;
     //
     // tabPage_userRecord
     //
     this.tabPage_userRecord.Controls.Add(this.textBox_userRecord);
     this.tabPage_userRecord.Location = new System.Drawing.Point(4, 22);
     this.tabPage_userRecord.Name     = "tabPage_userRecord";
     this.tabPage_userRecord.Padding  = new System.Windows.Forms.Padding(6);
     this.tabPage_userRecord.Size     = new System.Drawing.Size(524, 285);
     this.tabPage_userRecord.TabIndex = 2;
     this.tabPage_userRecord.Text     = "用户记录";
     this.tabPage_userRecord.UseVisualStyleBackColor = true;
     //
     // UserRightsDlg
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
     this.ClientSize        = new System.Drawing.Size(556, 369);
     this.Controls.Add(this.tabControl_main);
     this.Controls.Add(this.button_Cancel);
     this.Controls.Add(this.button_OK);
     this.Icon          = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.Name          = "UserRightsDlg";
     this.ShowInTaskbar = false;
     this.Text          = "用户管理";
     this.Closing      += new System.ComponentModel.CancelEventHandler(this.UserRightsDlg_Closing);
     this.Load         += new System.EventHandler(this.UserRightsDlg_Load);
     this.tableLayoutPanel_right.ResumeLayout(false);
     this.tableLayoutPanel_right.PerformLayout();
     this.splitContainer_rights.Panel1.ResumeLayout(false);
     this.splitContainer_rights.Panel2.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer_rights)).EndInit();
     this.splitContainer_rights.ResumeLayout(false);
     this.tabControl_main.ResumeLayout(false);
     this.tabPage_generalInfo.ResumeLayout(false);
     this.tabPage_generalInfo.PerformLayout();
     this.tabPage_objectRights.ResumeLayout(false);
     this.tabPage_userRecord.ResumeLayout(false);
     this.tabPage_userRecord.PerformLayout();
     this.ResumeLayout(false);
 }
Exemplo n.º 4
0
        void menu_quickSetRights_Click(object sender, EventArgs e)
        {
            /*
             * // 兑现本次树上修改
             * if (treeView_resRightTree.Changed == true)
             *  treeView_resRightTree.FinishRightsParam();
             */

            TreeNode node = this.treeView_resRightTree.SelectedNode;

            if (node == null)
            {
                node = this.treeView_resRightTree.Nodes[0];
            }

            QuickSetDatabaseRightsDlg dlg = new QuickSetDatabaseRightsDlg();

            dlg.Font = GuiUtil.GetDefaultFont();

            dlg.CfgFileName    = "quickrights.xml";
            dlg.AllObjectNames = new List <ObjectInfo>();

            // 根
            ObjectInfo objectinfo = new ObjectInfo();

            objectinfo.Path       = "服务器";
            objectinfo.ImageIndex = ResTree.RESTYPE_SERVER;
            dlg.AllObjectNames.Add(objectinfo);

            for (int i = 0; i < treeView_resRightTree.Nodes[0].Nodes.Count; i++)
            {
                objectinfo            = new ObjectInfo();
                objectinfo.Path       = treeView_resRightTree.Nodes[0].Nodes[i].Text;
                objectinfo.ImageIndex = treeView_resRightTree.Nodes[0].Nodes[i].ImageIndex;
                dlg.AllObjectNames.Add(objectinfo);
            }

            dlg.SelectedObjectNames = new List <ObjectInfo>();
            if (node.ImageIndex == ResTree.RESTYPE_DB)
            {
                objectinfo            = new ObjectInfo();
                objectinfo.Path       = node.Text;
                objectinfo.ImageIndex = node.ImageIndex;

                // 如果选定的是数据库节点
                dlg.SelectedObjectNames.Add(objectinfo);
            }
            else if (node.ImageIndex == ResTree.RESTYPE_SERVER)
            {
                // 如果选定的是服务器节点
                dlg.SelectedObjectNames.AddRange(dlg.AllObjectNames);
            }
            else
            {
                // 如果选定的是其他类型节点
                // 得到路径
                string   strPath = "";
                TreeNode nodeCur = node;
                while (nodeCur != null)
                {
                    if (nodeCur.ImageIndex == ResTree.RESTYPE_SERVER)
                    {
                        break;
                    }
                    if (strPath != "")
                    {
                        strPath = "/" + strPath;
                    }
                    strPath = nodeCur.Text + strPath;
                    nodeCur = nodeCur.Parent;
                }

                objectinfo            = new ObjectInfo();
                objectinfo.Path       = strPath;
                objectinfo.ImageIndex = node.ImageIndex;


                dlg.SelectedObjectNames.Add(objectinfo);
            }


            this.MainForm.AppInfo.LinkFormState(dlg, "QuickSetDatabaseRightsDlg_state");
            dlg.ShowDialog(this);
            this.MainForm.AppInfo.UnlinkFormState(dlg);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }


            // 兑现修改
            ModiRights(dlg.SelectedObjectNames,
                       dlg.QuickRights);

            this.listView_resRightList.RefreshList();

            this.textBox_objectRights_rights.Text = ResRightTree.GetNodeRights(treeView_resRightTree.SelectedNode);
        }