From: <ro...@us...> - 2006-08-11 21:59:23
|
Revision: 311 Author: rouquin Date: 2006-08-11 13:54:32 -0700 (Fri, 11 Aug 2006) ViewCVS: http://svn.sourceforge.net/tcdb/?rev=311&view=rev Log Message: ----------- Fixed the admin tree to correctly use Matt's Get/SetValue functions. Modified Paths: -------------- Website/Includes/AdministrationTree.ascx Website/Includes/AdministrationTree.ascx.cs Website/Includes/AssignmentsTree.ascx.cs Removed Paths: ------------- Website/AdminRole.aspx Website/Includes/RoleAdmin.ascx Website/Includes/RoleAdmin.ascx.cs Deleted: Website/AdminRole.aspx =================================================================== --- Website/AdminRole.aspx 2006-08-11 19:48:28 UTC (rev 310) +++ Website/AdminRole.aspx 2006-08-11 20:54:32 UTC (rev 311) @@ -1,12 +0,0 @@ -<%@ Page Language="C#" MasterPageFile="~/TCDB.master" AutoEventWireup="true" Title="TCDB: Administration" %> -<%@ Register Src="~/Includes/AdministrationTree.ascx" TagPrefix="admin" TagName="Tree" %> -<%@ Register Src="~/Includes/RoleAdmin.ascx" TagPrefix="admin" TagName="Role" %> - -<asp:Content ID="TreeContent" ContentPlaceHolderID="TreeContentPlaceHolder" runat="Server"> - <admin:Tree runat="server" ID="Tree" /> -</asp:Content> -<asp:Content ID="MainContent" ContentPlaceHolderID="MainContentPlaceHolder" runat="Server"> - <admin:Role ID="Role" runat="server" /> -</asp:Content> -<asp:Content ID="NotesContent" ContentPlaceHolderID="NotesContentPlaceHolder" runat="Server"> -</asp:Content> Modified: Website/Includes/AdministrationTree.ascx =================================================================== --- Website/Includes/AdministrationTree.ascx 2006-08-11 19:48:28 UTC (rev 310) +++ Website/Includes/AdministrationTree.ascx 2006-08-11 20:54:32 UTC (rev 311) @@ -1,9 +1,11 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeFile="AdministrationTree.ascx.cs" Inherits="TCDB.AdministrationTree" %> +<asp:CheckBox ID="showHidden" runat="server" Text="Show Hidden" AutoPostBack="True" + OnCheckedChanged="showHidden_CheckedChanged" OnLoad="showHidden_Load" OnInit="showHidden_Init" /> <asp:TreeView ID="AdminTree" runat="server" SelectedNodeStyle-CssClass="selectednode" OnTreeNodePopulate="AdminTree_TreeNodePopulate" OnTreeNodeCollapsed="AdminTree_TreeNodeCollapsed" - OnTreeNodeExpanded="AdminTree_TreeNodeExpanded" OnInit="AdminTree_Init" - OnSelectedNodeChanged="AdminTree_SelectedNodeChanged" ExpandDepth="1"> + OnTreeNodeExpanded="AdminTree_TreeNodeExpanded" OnInit="AdminTree_Init" OnSelectedNodeChanged="AdminTree_SelectedNodeChanged" + ExpandDepth="1"> <Nodes> <asp:TreeNode Text="Administration" Value="Admin" PopulateOnDemand="True" SelectAction="Expand" /> </Nodes> Modified: Website/Includes/AdministrationTree.ascx.cs =================================================================== --- Website/Includes/AdministrationTree.ascx.cs 2006-08-11 19:48:28 UTC (rev 310) +++ Website/Includes/AdministrationTree.ascx.cs 2006-08-11 20:54:32 UTC (rev 311) @@ -29,10 +29,9 @@ protected void AdminTree_Init(object sender, EventArgs args) { m_logg.Debug("Initializing admin tree"); - if (Session["AdminNodes"] == null) - Session.Add("AdminNodes", new ArrayList()); + if (Session[PREFIX + "Nodes"] == null) + Session.Add(PREFIX + "Nodes", new ArrayList()); } - protected void AdminTree_SelectedNodeChanged(object sender, EventArgs e) { TreeNode node = AdminTree.SelectedNode; @@ -85,26 +84,25 @@ } // } } - protected void AdminTree_TreeNodeExpanded(object sender, TreeNodeEventArgs e) { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; if (!nodes.Contains(e.Node.ValuePath)) nodes.Add(e.Node.ValuePath); } protected void AdminTree_TreeNodeCollapsed(object sender, TreeNodeEventArgs e) { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; int index = nodes.IndexOf(e.Node.ValuePath); if (index >= 0) nodes.RemoveAt(index); } - + protected void BuildProductList(TreeNode parent) { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; List<Product> products = ProductDB.GetProductList(active); foreach (Product product in products) @@ -115,14 +113,9 @@ TreeNode newNode = new TreeNode(); newNode.Text = "<product>" + product.NAME + "</product>"; Help.Tree_SetValue(newNode, PREFIX + Constants.CODE_PRODUCT, product.ID.ToString()); - - // Set the PopulateOnDemand property to true so that the child nodes can be - // dynamically populated. newNode.PopulateOnDemand = true; - - // Set additional properties for the node. newNode.SelectAction = TreeNodeSelectAction.Expand; - newNode.NavigateUrl = "~/Product.aspx"; + newNode.NavigateUrl = "~/Product.aspx?"+Constants.CODE_PRODUCT + "=" +product.ID; if (!product.ACTIVE) newNode.Text = "<font class='deleted'>" + newNode.Text + "</font>"; @@ -135,7 +128,8 @@ } protected void BuildAdminList(TreeNode parent) { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; + int productID = Convert.ToInt32(Help.Tree_GetValue(parent, PREFIX + Constants.CODE_PRODUCT)); TreeNode newNode; // Add Admin Settings @@ -173,7 +167,6 @@ newNode.Value = "roles"; newNode.PopulateOnDemand = true; newNode.SelectAction = TreeNodeSelectAction.Expand; - newNode.NavigateUrl = "~/AdminRole.aspx?" + Constants.CODE_PRODUCT + "=" + parent.Value; parent.ChildNodes.Add(newNode); if (nodes.Contains(newNode.ValuePath)) newNode.Expand(); @@ -213,27 +206,28 @@ parent.ChildNodes.Add(newNode); if (nodes.Contains(newNode.ValuePath)) newNode.Expand(); - } + } } protected void BuildReleaseList(TreeNode parent) { - int productID = Convert.ToInt32(parent.Parent.Value); - ArrayList nodes = (ArrayList)Session["AdminNodes"]; - List<Release> versions = VersionDB.GetVersionList(productID, active); + int productID = Convert.ToInt32(Help.Tree_GetValue(parent.Parent, PREFIX + Constants.CODE_PRODUCT)); + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; + // Show hidden? + Nullable<bool> hidden = true; + if (showHidden.Checked) + hidden = null; + + List<Release> versions = VersionDB.GetVersionList(productID, hidden); foreach (Release version in versions) { // Create the new node. TreeNode newNode = new TreeNode(); newNode.Text = version.NUMBER; - newNode.Value = version.ID.ToString(); - - // Set the PopulateOnDemand property to true so that the child nodes can be dynamically populated. + Help.Tree_SetValue(newNode, PREFIX + Constants.CODE_VERSION, version.ID.ToString()); newNode.PopulateOnDemand = true; - - // Set additional properties for the node. newNode.SelectAction = TreeNodeSelectAction.Expand; - newNode.NavigateUrl = "~/Version.aspx?"+Constants.CODE_PRODUCT+"="+productID+"&" + Constants.CODE_VERSION + "=" + newNode.Value; + newNode.NavigateUrl = "~/Version.aspx?" + Constants.CODE_PRODUCT + "=" + productID + "&" + Constants.CODE_VERSION + "=" + version.ID; if (!version.ACTIVE) newNode.Text = "<font class='deleted'>" + newNode.Text + "</font>"; @@ -245,7 +239,7 @@ } protected void BuildTagList(TreeNode parent) { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; /* // Populate Tags query = "SELECT * FROM tags WHERE productID="+e.Node.Parent.Value; @@ -278,8 +272,8 @@ } protected void BuildCategoryList(TreeNode parent) { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; - int productID = Convert.ToInt32(parent.Value); + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; + int productID = Convert.ToInt32(Help.Tree_GetValue(parent, PREFIX + Constants.CODE_PRODUCT)); TreeNode newNode; if (m_user.HasRight(Constants.RIGHTS_VERSION_VIEW, productID)) @@ -336,7 +330,6 @@ newNode.Value = "user"; newNode.PopulateOnDemand = true; newNode.SelectAction = TreeNodeSelectAction.Expand; - newNode.NavigateUrl = "~/AdminRole.aspx?" + Constants.CODE_PRODUCT + "=" + parent.Value; parent.ChildNodes.Add(newNode); if (nodes.Contains(newNode.ValuePath)) newNode.Expand(); @@ -344,7 +337,7 @@ } protected void BuildStatusGroupList(TreeNode parent) { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; TreeNode newNode; // Action Item @@ -392,7 +385,7 @@ } protected void BuildLabList(TreeNode parent) { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; /* // Populate Labs query = "SELECT * FROM lab"; @@ -426,27 +419,24 @@ } protected void BuildUserList(TreeNode parent) { - tcdbDataSetTableAdapters.db_roleProductUserTableAdapter userAdapter = new tcdbDataSetTableAdapters.db_roleProductUserTableAdapter(); - tcdbDataSet.db_roleProductUserDataTable userTable = userAdapter.GetData(null, Convert.ToInt32(parent.Parent.Value), true); + int productID = Convert.ToInt32(Help.Tree_GetValue(parent.Parent, PREFIX + Constants.CODE_PRODUCT)); int lastID = -1; - int productID = Convert.ToInt32(parent.Parent.Value); - foreach (tcdbDataSet.db_roleProductUserRow row in userTable) + List<User> users = ProductDB.TCDB_GetProductUsers(productID, null); + foreach (User user in users) { - if (lastID == row.userID) + if (lastID == user.ID) continue; else - lastID = row.userID; + lastID = user.ID; if (m_user.HasRight(Constants.RIGHTS_USER_VIEW_OTHER, productID)) { // Create the new node. TreeNode newNode = new TreeNode(); - newNode.Text = row.fullName; - newNode.Value = row.userID.ToString(); ; - newNode.PopulateOnDemand = true; - newNode.SelectAction = TreeNodeSelectAction.Expand; - newNode.NavigateUrl = "~/UserSettings.aspx?" + Constants.CODE_PRODUCT + "=" + productID + "&" + Constants.CODE_USER + "=" + newNode.Value; + newNode.Text = user.FULLNAME; + Help.Tree_SetValue(newNode, PREFIX + Constants.CODE_USER, user.ID.ToString()); + newNode.NavigateUrl = "~/UserSettings.aspx?" + Constants.CODE_PRODUCT + "=" + productID + "&" + Constants.CODE_USER + "=" + user.ID; parent.ChildNodes.Add(newNode); newNode.Expand(); } @@ -455,18 +445,18 @@ protected void BuildAllUserList(TreeNode parent) { List<User> users = UserDB.TCDB_GetUserList(active); - int productID = Convert.ToInt32(parent.Parent.Value); + int productID = Convert.ToInt32(Help.Tree_GetValue(parent.Parent, PREFIX + Constants.CODE_PRODUCT)); foreach (User user in users) { if (m_user.HasRight(Constants.RIGHTS_USER_VIEW_OTHER, productID)) { - TreeNode child = new TreeNode(); - child.Text = user.FULLNAME; - child.Value = user.ID.ToString(); - child.NavigateUrl = "~/UserSettings.aspx?" + Constants.CODE_PRODUCT + "=" + Constants.PRODUCT_SITEID + "&" + Constants.CODE_USER + "=" + child.Value; + TreeNode newNode = new TreeNode(); + newNode.Text = user.FULLNAME; + Help.Tree_SetValue(newNode, PREFIX + Constants.CODE_USER, user.ID.ToString()); + newNode.NavigateUrl = "~/UserSettings.aspx?" + Constants.CODE_PRODUCT + "=" + Constants.PRODUCT_SITEID + "&" + Constants.CODE_USER + "=" + user.ID; - parent.ChildNodes.Add(child); + parent.ChildNodes.Add(newNode); } } } @@ -506,42 +496,41 @@ } protected void BuildAllRolesList(TreeNode parent) { - tcdbDataSetTableAdapters.db_roleTableAdapter rAdapter = new tcdbDataSetTableAdapters.db_roleTableAdapter(); - tcdbDataSet.db_roleDataTable rTable = rAdapter.GetData(null, null, active); + List<Role> roles = RightDB.TCDB_GetRoleList(active); - foreach (tcdbDataSet.db_roleRow row in rTable) + foreach (Role role in roles) { - TreeNode child = new TreeNode(); - child.Text = row.roleName; - child.Value = row.roleID.ToString(); - child.NavigateUrl = "~/Role.aspx?" + Constants.CODE_ROLE + "=" + child.Value; - if (!row.active) - child.Text = "<font class='deleted'>" + child.Text + "</font>"; + TreeNode newNode = new TreeNode(); + newNode.Text = role.NAME; + Help.Tree_SetValue(newNode, PREFIX + Constants.CODE_ROLE, role.ID.ToString()); + newNode.NavigateUrl = "~/Role.aspx?" + Constants.CODE_ROLE + "=" + role.ID; + if (!role.ACTIVE) + newNode.Text = "<font class='deleted'>" + newNode.Text + "</font>"; - parent.ChildNodes.Add(child); + parent.ChildNodes.Add(newNode); } } protected void BuildAllRightsList(TreeNode parent) { - List<Right> rights = RightDB.TCDB_GetRightList(active); + List<Right> rights = RightDB.TCDB_GetRightList(active); - foreach (Right right in rights) + foreach (Right right in rights) { - TreeNode child = new TreeNode(); - child.Text = right.NAME; - child.Value = right.ID.ToString(); - child.NavigateUrl = "~/Right.aspx?" + Constants.CODE_RIGHT + "=" + child.Value; - if (!right.ACTIVE) - child.Text = "<font class='deleted'>" + child.Text + "</font>"; + TreeNode newNode = new TreeNode(); + newNode.Text = right.NAME; + Help.Tree_SetValue(newNode, PREFIX + Constants.CODE_RIGHT, right.ID.ToString()); + newNode.NavigateUrl = "~/Right.aspx?" + Constants.CODE_RIGHT + "=" + right.ID; + if (!right.ACTIVE) + newNode.Text = "<font class='deleted'>" + newNode.Text + "</font>"; - parent.ChildNodes.Add(child); + parent.ChildNodes.Add(newNode); } } protected void BuildVersionCategories(TreeNode parent) { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; TreeNode newNode; - int productID = Convert.ToInt32(parent.Parent.Parent.Value); + int productID = Convert.ToInt32(Help.Tree_GetValue(parent.Parent.Parent, PREFIX + Constants.CODE_PRODUCT)); if (m_user.HasRight(Constants.RIGHTS_TESTPASS_VIEW, productID)) { @@ -584,7 +573,7 @@ } protected void BuildStatusList(TreeNode parent) { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; /* // Populate status query = "SELECT * FROM status where statusGroup='" + e.Node.Value+"'"; @@ -617,7 +606,7 @@ } protected void BuildComputerList(TreeNode parent) { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; /* // Populate computer query = "SELECT * FROM computer WHERE labID="+e.Node.Value; @@ -648,48 +637,24 @@ } */ } - protected void BuildRightsList(TreeNode parent) - { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; - tcdbDataSetTableAdapters.db_roleRightTableAdapter rightAdapter = new tcdbDataSetTableAdapters.db_roleRightTableAdapter(); - tcdbDataSet.db_roleRightDataTable rightTable = rightAdapter.GetData(Convert.ToInt32(parent.Value), true); - - // Populate Rights - foreach (tcdbDataSet.db_roleRightRow row in rightTable) - { - // Create the new node. - TreeNode newNode = new TreeNode(); - newNode.Text = "Right: " + row.rightName; - newNode.Value = row.rightsID.ToString(); - - // Set the PopulateOnDemand property to true so that the child nodes can be - // dynamically populated. - newNode.PopulateOnDemand = true; - - // Set additional properties for the node. - newNode.SelectAction = TreeNodeSelectAction.Expand; - newNode.NavigateUrl = "~/Right.aspx?" + Constants.CODE_RIGHT + "=" + newNode.Value; - - // Add the new node to the ChildNodes collection of the parent node. - parent.ChildNodes.Add(newNode); - newNode.Expand(); - } - } protected void BuildBuildList(TreeNode parent) { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; - int versionID = Convert.ToInt32(parent.Parent.Value); - List<Build> builds = VersionDB.GetBuildList(versionID, active); + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; + int versionID = Convert.ToInt32(Help.Tree_GetValue(parent.Parent, PREFIX + Constants.CODE_PRODUCT)); + // Show hidden? + Nullable<bool> hidden = true; + if (showHidden.Checked) + hidden = null; + + List<Build> builds = VersionDB.GetBuildList(versionID, hidden); foreach (Build build in builds) { // Create the new node. TreeNode newNode = new TreeNode(); newNode.Text = build.NUMBER; - newNode.Value = build.ID.ToString(); - newNode.PopulateOnDemand = true; - newNode.SelectAction = TreeNodeSelectAction.Expand; - newNode.NavigateUrl = "~/Build.aspx?"+Constants.CODE_BUILD+"=" + newNode.Value; + Help.Tree_SetValue(newNode, PREFIX + Constants.CODE_BUILD, build.ID.ToString()); + newNode.NavigateUrl = "~/Build.aspx?" + Constants.CODE_BUILD + "=" + build.ID; if (!build.ACTIVE) newNode.Text = "<font class='deleted'>" + newNode.Text + "</font>"; @@ -699,7 +664,7 @@ } protected void BuildTestPassList(TreeNode parent) { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; /* // Populate TestPass query = "SELECT * FROM testPass where versionID=" + e.Node.Parent.Value; @@ -732,7 +697,7 @@ } protected void BuildPlatformList(TreeNode parent) { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; /* // Populate Platforms query = "SELECT platform.platformID,os.friendlyName + ' ('+architecture.name+')' AS platformName "+ @@ -770,7 +735,7 @@ } protected void BuildOSList(TreeNode parent) { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; /* // Populate os query = "SELECT os.friendlyName, os.osID FROM os INNER JOIN platform ON platform.osID=os.osID "+ @@ -804,7 +769,7 @@ } protected void BuildArchitectureList(TreeNode parent) { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; /* ResultsDataSet.Clear(); // Populate architecture @@ -840,7 +805,7 @@ } protected void AdminTree_TreeNodePopulate(object sender, TreeNodeEventArgs e) { - ArrayList nodes = (ArrayList)Session["AdminNodes"]; + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; // Call the appropriate method to populate a node at a particular level. switch (e.Node.Depth) @@ -849,7 +814,7 @@ BuildProductList(e.Node); break; case 1: - if (e.Node.Value == Constants.PRODUCT_SITEID.ToString()) + if (Help.Tree_GetValue(e.Node, PREFIX + Constants.CODE_PRODUCT) == Constants.PRODUCT_SITEID.ToString()) BuildAdminList(e.Node); else BuildCategoryList(e.Node); @@ -883,8 +848,6 @@ BuildStatusList(e.Node); else if (e.Node.NavigateUrl.Contains("Lab")) BuildComputerList(e.Node); - else if (e.Node.NavigateUrl.Contains("Role")) - BuildRightsList(e.Node); break; case 4: if (e.Node.Value == "build") @@ -903,5 +866,39 @@ break; } } + + protected void showHidden_Init(object sender, EventArgs e) + { + if (!m_user.HasRight(Constants.RIGHTS_VERSION_VIEW, Constants.PRODUCT_ANYID) || + !m_user.HasRight(Constants.RIGHTS_BUILD_VIEW, Constants.PRODUCT_ANYID) || + !m_user.HasRight(Constants.RIGHTS_TESTPASS_VIEW, Constants.PRODUCT_ANYID)) + showHidden.Visible = false; + } + protected void showHidden_Load(object sender, EventArgs e) + { + if (Session[PREFIX_TAB + "showHidden"] == null) + Session[PREFIX_TAB + "showHidden"] = false; + bool show = Convert.ToBoolean(Session[PREFIX_TAB + "showHidden"]); + + if (showHidden.Checked != show) + { + showHidden.Checked = show; + showHidden_CheckedChanged(sender, e); + } + } + protected void showHidden_CheckedChanged(object sender, EventArgs e) + { + ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; + + foreach (TreeNode node in AdminTree.Nodes) + { + if (nodes.Contains(node.ValuePath)) + { + node.ChildNodes.Clear(); + AdminTree_TreeNodePopulate(AdminTree, new TreeNodeEventArgs(node)); + } + } + Session[PREFIX_TAB + "showHidden"] = showHidden.Checked; + } } } Modified: Website/Includes/AssignmentsTree.ascx.cs =================================================================== --- Website/Includes/AssignmentsTree.ascx.cs 2006-08-11 19:48:28 UTC (rev 310) +++ Website/Includes/AssignmentsTree.ascx.cs 2006-08-11 20:54:32 UTC (rev 311) @@ -39,7 +39,6 @@ AssignmentTree.Visible = false; } } - protected void AssignmentTree_TreeNodeCollapsed(object sender, TreeNodeEventArgs e) { ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; @@ -51,7 +50,6 @@ nodes.RemoveAt(index); } } - protected void AssignmentTree_TreeNodeExpanded(object sender, TreeNodeEventArgs e) { ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; @@ -62,7 +60,6 @@ m_logg.Debug("Expanding node [" + nodes[nodes.IndexOf(e.Node.ValuePath)].ToString() + "]"); } } - protected void AssignmentTree_SelectedNodeChanged(object sender, EventArgs e) { TreeNode node = AssignmentTree.SelectedNode; @@ -129,45 +126,6 @@ } } - protected void AssignmentTree_TreeNodePopulate(object sender, TreeNodeEventArgs e) - { - m_logg.Debug("Populating tree"); - if (AssignmentTree.Visible != true) - return; - - // Call the appropriate method to populate a node at a particular level. - try - { - String nodeType = Help.Tree_GetValue(e.Node, Constants.CODE_TYPE); - if (nodeType == null) nodeType = Constants.CODE_ROOT; - switch (nodeType) - { - case Constants.CODE_ROOT: - BuildMyAssignmentsNode(e.Node); - BuildMyCreatedAssignmentsNode(e.Node); - BuildProductList(e.Node); - break; - case Constants.CODE_PRODUCT: - BuildUserList(e.Node); - break; - case Constants.CODE_USER: - BuildAssignmentList(e.Node); - break; - case Constants.CODE_CREATED: - BuildCreatedUserList(e.Node); - break; - default: - break; - } - } - catch - { - BuildMyAssignmentsNode(e.Node); - BuildMyCreatedAssignmentsNode(e.Node); - BuildProductList(e.Node); - } - } - private void BuildProductList(TreeNode parent) { ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; @@ -195,7 +153,6 @@ AssignmentTree_TreeNodePopulate(AssignmentTree, new TreeNodeEventArgs(child)); } } - private void BuildMyAssignmentsNode(TreeNode parent) { // *************************** @@ -220,7 +177,6 @@ } } } - private void BuildMyCreatedAssignmentsNode(TreeNode parent) { // *************************** @@ -243,7 +199,6 @@ AssignmentTree_TreeNodePopulate(AssignmentTree, new TreeNodeEventArgs(created)); } } - private void BuildCreatedUserList(TreeNode parent) { m_logg.Debug("Building my created user list"); @@ -277,7 +232,6 @@ AssignmentTree_TreeNodePopulate(AssignmentTree, new TreeNodeEventArgs(userNode)); } } - private void BuildUserList(TreeNode parent) { m_logg.Debug("Building user list"); @@ -320,7 +274,6 @@ if (parent.ChildNodes.Count == 0 || (parent.ChildNodes.Count == 1 && Help.Tree_GetValue(parent.ChildNodes[0], Constants.CODE_VALUE) == m_user.ID.ToString())) parent.Parent.ChildNodes.Remove(parent); } - private void BuildAssignmentList(TreeNode parent) { m_logg.Debug("Building created assignment list"); @@ -403,7 +356,45 @@ parent.Parent.ChildNodes.Remove(parent); } } + protected void AssignmentTree_TreeNodePopulate(object sender, TreeNodeEventArgs e) + { + m_logg.Debug("Populating tree"); + if (AssignmentTree.Visible != true) + return; + // Call the appropriate method to populate a node at a particular level. + try + { + String nodeType = Help.Tree_GetValue(e.Node, Constants.CODE_TYPE); + if (nodeType == null) nodeType = Constants.CODE_ROOT; + switch (nodeType) + { + case Constants.CODE_ROOT: + BuildMyAssignmentsNode(e.Node); + BuildMyCreatedAssignmentsNode(e.Node); + BuildProductList(e.Node); + break; + case Constants.CODE_PRODUCT: + BuildUserList(e.Node); + break; + case Constants.CODE_USER: + BuildAssignmentList(e.Node); + break; + case Constants.CODE_CREATED: + BuildCreatedUserList(e.Node); + break; + default: + break; + } + } + catch + { + BuildMyAssignmentsNode(e.Node); + BuildMyCreatedAssignmentsNode(e.Node); + BuildProductList(e.Node); + } + } + protected void statusComplete_CheckedChanged(object sender, EventArgs e) { ArrayList nodes = (ArrayList)Session[PREFIX + "Nodes"]; @@ -421,7 +412,6 @@ Session[PREFIX_TAB + "showAICompleted"] = statusComplete.Checked; Session[PREFIX_TAB + "showAICompleted"] = statusComplete.Checked; } - protected void statusComplete_Load(object sender, EventArgs e) { if (Session[PREFIX_TAB + "showCompleted"] == null) Deleted: Website/Includes/RoleAdmin.ascx =================================================================== --- Website/Includes/RoleAdmin.ascx 2006-08-11 19:48:28 UTC (rev 310) +++ Website/Includes/RoleAdmin.ascx 2006-08-11 20:54:32 UTC (rev 311) @@ -1,27 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeFile="RoleAdmin.ascx.cs" Inherits="TCDB.RoleAdmin" %> -<table width="700"> - <tr> - <td align="center" valign="middle" style="height: 101px"> - <asp:DropDownList ID="roleList" runat="server" OnInit="roleList_Init" AutoPostBack="True"> - </asp:DropDownList> - <asp:LinkButton ID="viewRoleBtn" runat="server" CommandName="viewRole" OnCommand="viewRole" - OnLoad="viewRoleBtn_Load">View Role</asp:LinkButton> - - <asp:LinkButton ID="addRoleBtn" runat="server" CommandName="addRole" OnCommand="addRole" - OnLoad="addRoleBtn_Load">Add User To Role</asp:LinkButton> - <br /> - <br /><asp:DropDownList ID="rightsList" runat="server" OnInit="rightsList_Init" AutoPostBack="True"> - </asp:DropDownList> - <asp:LinkButton ID="viewRightBtn" runat="server" CommandName="viewRight" OnCommand="viewRight">View Right</asp:LinkButton> - - <asp:LinkButton ID="editRightsBtn" runat="server" CommandName="editRight" OnCommand="addRight">Edit Right</asp:LinkButton> - <br /> - <br /> - <asp:LinkButton ID="newRoleBtn" runat="server" CommandName="newRole" OnCommand="newRole" - OnInit="newRole_Init">New User Role</asp:LinkButton> - - <asp:LinkButton ID="newRightBtn" runat="server" CommandName="newRight" OnCommand="newRight" - OnInit="newRight_Init">New User Right</asp:LinkButton><br /> - </td> - </tr> -</table> Deleted: Website/Includes/RoleAdmin.ascx.cs =================================================================== --- Website/Includes/RoleAdmin.ascx.cs 2006-08-11 19:48:28 UTC (rev 310) +++ Website/Includes/RoleAdmin.ascx.cs 2006-08-11 20:54:32 UTC (rev 311) @@ -1,120 +0,0 @@ -using System; -using System.Data; -using System.Configuration; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; -using System.Collections.Generic; -using TCDB.Code; - - -namespace TCDB -{ - public partial class RoleAdmin : SiteUserControl - { - private static Logger m_logg = new Logger("TCDB.RoleAdmin"); - int productID = Convert.ToInt32(HttpContext.Current.Request.QueryString[Constants.CODE_PRODUCT]); - - protected void Page_Load(object sender, EventArgs e) - { - m_logg.Debug("Loading page Role Admin"); - - if (productID == 0) - productID = Constants.PRODUCT_ANYID; - } - - protected void viewRole(object sender, CommandEventArgs e) - { - Response.Redirect("Role.aspx?" + Constants.CODE_PRODUCT + "=" + productID + "&" + Constants.CODE_ROLE + "=" + roleList.SelectedValue); - } - protected void addRole(object sender, CommandEventArgs e) - { - Response.Redirect("RoleAssignments.aspx?" + Constants.CODE_PRODUCT + "=" + productID + "&" + Constants.CODE_ROLE + "=" + roleList.SelectedValue); - } - protected void newRole(object sender, CommandEventArgs e) - { - Response.Redirect("Role.aspx?mode=new&" + Constants.CODE_PRODUCT + "=" + productID); - } - protected void newRight(object sender, CommandEventArgs e) - { - Response.Redirect("Right.aspx?mode=new&" + Constants.CODE_PRODUCT + "=" + productID); - } - protected void addRight(object sender, CommandEventArgs e) - { - Response.Redirect("Right.aspx?mode=edit&" + Constants.CODE_PRODUCT + "=" + productID + "&" + Constants.CODE_RIGHT + "=" + rightsList.SelectedValue); - } - protected void viewRight(object sender, CommandEventArgs e) - { - Response.Redirect("Right.aspx?" + Constants.CODE_PRODUCT + "=" + productID + "&" + Constants.CODE_RIGHT + "=" + rightsList.SelectedValue); - } - - protected void newRole_Init(object sender, EventArgs e) - { - if (!m_user.HasRight(Constants.RIGHTS_ROLE_CREATE, Constants.PRODUCT_ANYID)) - newRoleBtn.Visible = false; - } - protected void newRight_Init(object sender, EventArgs e) - { - if (!m_user.HasRight(Constants.RIGHTS_DEV_ACCESS)) - newRightBtn.Visible = false; - } - - protected void roleList_Init(object sender, EventArgs e) - { - tcdbDataSetTableAdapters.db_roleTableAdapter rAdapter = new tcdbDataSetTableAdapters.db_roleTableAdapter(); - tcdbDataSet.db_roleDataTable rTable = rAdapter.GetData(null, null, active); - - foreach (tcdbDataSet.db_roleRow row in rTable) - { - ListItem item = new ListItem(row.roleName, row.roleID.ToString()); - if (!row.active) - item.Attributes.CssStyle.Add("text-decoration", "line-through"); - - roleList.Items.Add(item); - } - } - protected void rightsList_Init(object sender, EventArgs e) - { - if (!m_user.HasRight(Constants.RIGHTS_RIGHTS_VIEW, Constants.PRODUCT_ANYID)) - { - rightsList.Visible = false; - viewRightBtn.Visible = false; - editRightsBtn.Visible = false; - - return; - } - if (!m_user.HasRight(Constants.RIGHTS_DEV_ACCESS)) - editRightsBtn.Visible = false; - - List<Right> rights = RightDB.TCDB_GetRightList(active); - - foreach (Right right in rights) - { - ListItem item = new ListItem(right.NAME, right.ID.ToString()); - if (!right.ACTIVE) - item.Attributes.CssStyle.Add("text-decoration", "line-through"); - - rightsList.Items.Add(item); - } - } - - protected void addRoleBtn_Load(object sender, EventArgs e) - { - String role = roleList.SelectedItem.Text; - - if (!m_user.HasRight(Constants.RIGHTS_ROLE_EDIT_USERS, productID)) - addRoleBtn.Visible = false; - } - protected void viewRoleBtn_Load(object sender, EventArgs e) - { - String role = roleList.SelectedItem.Text; - - if (!(m_user.HasRole(role, productID) && m_user.HasRight(Constants.RIGHTS_ROLE_VIEW_MY, productID)) && - !m_user.HasRight(Constants.RIGHTS_ROLE_VIEW_OTHER, productID)) - viewRoleBtn.Visible = false; - } - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |