From: <m_h...@us...> - 2006-08-01 22:41:38
|
Revision: 259 Author: m_hildebrand Date: 2006-08-01 15:41:20 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/tcdb/?rev=259&view=rev Log Message: ----------- Made some node-style changes to the administration tree Broke Products.ascx into a code-behind file Cleaned up a few more CSS issues Changed the way non-production code is wrapped. Now all that needs to happens is for TCDB.Common.Constants.IS_DEV_ENV to be set. (true=show dev code, false=hide dev code) Modified Paths: -------------- Website/Administration.aspx Website/App_Code/Common.cs Website/App_Code/Products.cs Website/App_Themes/Python/python.css Website/Includes/AdministrationTree.ascx.cs Website/Includes/Footer.ascx Website/Includes/Header_CurrentInfo.ascx Website/Includes/Header_Menu.ascx Website/Includes/Products.ascx Website/Includes/UserSettings.ascx Website/TCDB.master Added Paths: ----------- Website/Includes/Products.ascx.cs Modified: Website/Administration.aspx =================================================================== --- Website/Administration.aspx 2006-08-01 21:22:36 UTC (rev 258) +++ Website/Administration.aspx 2006-08-01 22:41:20 UTC (rev 259) @@ -5,21 +5,19 @@ <admin:Tree runat="server" ID="Tree" /> </asp:Content> <asp:Content ID="MainContent" ContentPlaceHolderID="MainContentPlaceHolder" runat="Server"> - <table width="700"> - <tr> - <td align="center" valign="middle"> - <!-- ***NONPRODUCTION***<asp:LinkButton ID="newProduct" runat="server" PostBackUrl="~/Product.aspx?mode=new">New Product</asp:LinkButton> --> - <div class="button"> - <asp:LinkButton ID="newUser" runat="server" PostBackUrl="~/UserSettings.aspx?mode=new"> - <asp:Image ID="newUserIcon" runat="server" SkinID="newUserImage" AlternateText="New User" />New - User</asp:LinkButton></div> - <div class="button"> - <asp:LinkButton ID="userRole" runat="server" PostBackUrl="~/AdminRole.aspx"> - <asp:Image ID="userRoleIcon" runat="server" SkinID="userRoleImage" AlternateText="User Roles" />User - Roles</asp:LinkButton></div> - </td> - </tr> - </table> + <div class="pictureMenu"> + <% if (TCDB.Common.Constants.IS_DEV_ENV) + { %> + <asp:LinkButton ID="newProduct" runat="server" PostBackUrl="~/Product.aspx?mode=new">New Product</asp:LinkButton> <% } %> + <div class="button"> + <asp:LinkButton ID="newUser" runat="server" PostBackUrl="~/UserSettings.aspx?mode=new"> + <asp:Image ID="newUserIcon" runat="server" SkinID="newUserImage" AlternateText="New User" />New + User</asp:LinkButton></div> + <div class="button"> + <asp:LinkButton ID="userRole" runat="server" PostBackUrl="~/AdminRole.aspx"> + <asp:Image ID="userRoleIcon" runat="server" SkinID="userRoleImage" AlternateText="User Roles" />User + Roles</asp:LinkButton></div> + </div> </asp:Content> <asp:Content ID="NotesContent" ContentPlaceHolderID="NotesContentPlaceHolder" runat="Server"> </asp:Content> Modified: Website/App_Code/Common.cs =================================================================== --- Website/App_Code/Common.cs 2006-08-01 21:22:36 UTC (rev 258) +++ Website/App_Code/Common.cs 2006-08-01 22:41:20 UTC (rev 259) @@ -1264,6 +1264,7 @@ public static int ASSIGNMENT_NEW = 3; public static string TCDB_VERSION = "1.0.0 Alpha 2"; + public static bool IS_DEV_ENV = false; public static string RIGHTS_ASSIGNPERMISSION = "assignPermission"; public static string RIGHTS_SITEADMIN = "siteAdmin"; Modified: Website/App_Code/Products.cs =================================================================== --- Website/App_Code/Products.cs 2006-08-01 21:22:36 UTC (rev 258) +++ Website/App_Code/Products.cs 2006-08-01 22:41:20 UTC (rev 259) @@ -18,6 +18,11 @@ /// </summary> public class ProductDB : Page { + public static Product GetProduct(int productID) + { + return GetProduct(true, productID); + } + public static Product GetProduct(bool isActive, int productID) { tcdbDataSet ds = new tcdbDataSet(); Modified: Website/App_Themes/Python/python.css =================================================================== --- Website/App_Themes/Python/python.css 2006-08-01 21:22:36 UTC (rev 258) +++ Website/App_Themes/Python/python.css 2006-08-01 22:41:20 UTC (rev 259) @@ -169,6 +169,16 @@ border: solid 1px red; } +.indent +{ + display: inline; +} + +.pictureMenu +{ + text-align: center; +} + /********** END Global Classes **********/ /********** BEGIN Calendar Classes **********/ Modified: Website/Includes/AdministrationTree.ascx.cs =================================================================== --- Website/Includes/AdministrationTree.ascx.cs 2006-08-01 21:22:36 UTC (rev 258) +++ Website/Includes/AdministrationTree.ascx.cs 2006-08-01 22:41:20 UTC (rev 259) @@ -51,7 +51,7 @@ { // Create the new node. TreeNode newNode = new TreeNode(); - newNode.Text = "<font color=black><b>" + row.name + "</b></font>"; + newNode.Text = "<product>" + row.name + "</product>"; newNode.Value = row.productID.ToString(); // Set the PopulateOnDemand property to true so that the child nodes can be @@ -119,27 +119,28 @@ newNode.Expand(); } - /* ***NONPRODUCTION*** - // Operating Systems - newNode = new TreeNode(); - newNode.Text = "Operating Systems"; - newNode.Value = "os"; - newNode.PopulateOnDemand = true; - newNode.SelectAction = TreeNodeSelectAction.Expand; - parent.ChildNodes.Add(newNode); - if (nodes.Contains(newNode.ValuePath)) - newNode.Expand(); + if (TCDB.Common.Constants.IS_DEV_ENV) + { + // Operating Systems + newNode = new TreeNode(); + newNode.Text = "Operating Systems"; + newNode.Value = "os"; + newNode.PopulateOnDemand = true; + newNode.SelectAction = TreeNodeSelectAction.Expand; + parent.ChildNodes.Add(newNode); + if (nodes.Contains(newNode.ValuePath)) + newNode.Expand(); - // Architectures - newNode = new TreeNode(); - newNode.Text = "Architectures"; - newNode.Value = "arch"; - newNode.PopulateOnDemand = true; - newNode.SelectAction = TreeNodeSelectAction.Expand; - parent.ChildNodes.Add(newNode); - if (nodes.Contains(newNode.ValuePath)) - newNode.Expand(); - ***END NONPRODUCTION*** */ + // Architectures + newNode = new TreeNode(); + newNode.Text = "Architectures"; + newNode.Value = "arch"; + newNode.PopulateOnDemand = true; + newNode.SelectAction = TreeNodeSelectAction.Expand; + parent.ChildNodes.Add(newNode); + if (nodes.Contains(newNode.ValuePath)) + newNode.Expand(); + } // end non-production } protected void BuildReleaseList(TreeNode parent) { @@ -153,7 +154,7 @@ { // Create the new node. TreeNode newNode = new TreeNode(); - newNode.Text = "<font color=black>" + row.number + "</font>"; + newNode.Text = "<version>" + row.number + "</version>"; newNode.Value = row.versionID.ToString(); // Set the PopulateOnDemand property to true so that the child nodes can be dynamically populated. @@ -185,7 +186,7 @@ { // Create the new node. newNode = new TreeNode(); - newNode.Text = "<font color=blue><i>" + row["name"] + "</i></font>"; + newNode.Text = "<tag>" + row["name"] + "</tag>"; newNode.Value = row["tagID"].ToString(); // Set the PopulateOnDemand property to true so that the child nodes can be @@ -209,47 +210,48 @@ TreeNode newNode; // Versions - /* ***NONPRODUCTION*** - newNode = new TreeNode(); - newNode.Text = "Releases"; - newNode.Value = "release"; - newNode.PopulateOnDemand = true; - newNode.SelectAction = TreeNodeSelectAction.Expand; - parent.ChildNodes.Add(newNode); - if (nodes.Contains(newNode.ValuePath)) - newNode.Expand(); - - // Tags - newNode = new TreeNode(); - newNode.Text = "Tags"; - newNode.Value = "tag"; - newNode.PopulateOnDemand = true; - newNode.SelectAction = TreeNodeSelectAction.Expand; - parent.ChildNodes.Add(newNode); - if (nodes.Contains(newNode.ValuePath)) - newNode.Expand(); + if (TCDB.Common.Constants.IS_DEV_ENV) + { + newNode = new TreeNode(); + newNode.Text = "Releases"; + newNode.Value = "release"; + newNode.PopulateOnDemand = true; + newNode.SelectAction = TreeNodeSelectAction.Expand; + parent.ChildNodes.Add(newNode); + if (nodes.Contains(newNode.ValuePath)) + newNode.Expand(); - // Status Labels - newNode = new TreeNode(); - newNode.Text = "Status Levels"; - newNode.Value = "status"; - newNode.PopulateOnDemand = true; - newNode.SelectAction = TreeNodeSelectAction.Expand; - parent.ChildNodes.Add(newNode); - if (nodes.Contains(newNode.ValuePath)) - newNode.Expand(); + // Tags + newNode = new TreeNode(); + newNode.Text = "Tags"; + newNode.Value = "tag"; + newNode.PopulateOnDemand = true; + newNode.SelectAction = TreeNodeSelectAction.Expand; + parent.ChildNodes.Add(newNode); + if (nodes.Contains(newNode.ValuePath)) + newNode.Expand(); - // Labs - newNode = new TreeNode(); - newNode.Text = "Labs"; - newNode.Value = "lab"; - newNode.PopulateOnDemand = true; - newNode.SelectAction = TreeNodeSelectAction.Expand; - parent.ChildNodes.Add(newNode); - if (nodes.Contains(newNode.ValuePath)) - newNode.Expand(); - ***END NONPRODUCTION*** */ + // Status Labels + newNode = new TreeNode(); + newNode.Text = "Status Levels"; + newNode.Value = "status"; + newNode.PopulateOnDemand = true; + newNode.SelectAction = TreeNodeSelectAction.Expand; + parent.ChildNodes.Add(newNode); + if (nodes.Contains(newNode.ValuePath)) + newNode.Expand(); + // Labs + newNode = new TreeNode(); + newNode.Text = "Labs"; + newNode.Value = "lab"; + newNode.PopulateOnDemand = true; + newNode.SelectAction = TreeNodeSelectAction.Expand; + parent.ChildNodes.Add(newNode); + if (nodes.Contains(newNode.ValuePath)) + newNode.Expand(); + } // end non-production + // Users newNode = new TreeNode(); newNode.Text = "Users"; @@ -276,37 +278,38 @@ if (nodes.Contains(newNode.ValuePath)) newNode.Expand(); - /* ***NONPRODUCTION*** - // WorkOrder - newNode = new TreeNode(); - newNode.Text = "Work Order"; - newNode.Value = "WorkOrder"; - newNode.PopulateOnDemand = true; - newNode.SelectAction = TreeNodeSelectAction.Expand; - parent.ChildNodes.Add(newNode); - if (nodes.Contains(newNode.ValuePath)) - newNode.Expand(); + if (TCDB.Common.Constants.IS_DEV_ENV) + { + // WorkOrder + newNode = new TreeNode(); + newNode.Text = "Work Order"; + newNode.Value = "WorkOrder"; + newNode.PopulateOnDemand = true; + newNode.SelectAction = TreeNodeSelectAction.Expand; + parent.ChildNodes.Add(newNode); + if (nodes.Contains(newNode.ValuePath)) + newNode.Expand(); - // Objective - newNode = new TreeNode(); - newNode.Text = "Objective"; - newNode.Value = "objective"; - newNode.PopulateOnDemand = true; - newNode.SelectAction = TreeNodeSelectAction.Expand; - parent.ChildNodes.Add(newNode); - if (nodes.Contains(newNode.ValuePath)) - newNode.Expand(); + // Objective + newNode = new TreeNode(); + newNode.Text = "Objective"; + newNode.Value = "objective"; + newNode.PopulateOnDemand = true; + newNode.SelectAction = TreeNodeSelectAction.Expand; + parent.ChildNodes.Add(newNode); + if (nodes.Contains(newNode.ValuePath)) + newNode.Expand(); - // TestCase - newNode = new TreeNode(); - newNode.Text = "Testcase"; - newNode.Value = "testcase"; - newNode.PopulateOnDemand = true; - newNode.SelectAction = TreeNodeSelectAction.Expand; - parent.ChildNodes.Add(newNode); - if (nodes.Contains(newNode.ValuePath)) - newNode.Expand(); - ***END NONPRODUCTION*** */ + // TestCase + newNode = new TreeNode(); + newNode.Text = "Testcase"; + newNode.Value = "testcase"; + newNode.PopulateOnDemand = true; + newNode.SelectAction = TreeNodeSelectAction.Expand; + parent.ChildNodes.Add(newNode); + if (nodes.Contains(newNode.ValuePath)) + newNode.Expand(); + } // end non-production } protected void BuildLabList(TreeNode parent) { @@ -323,7 +326,7 @@ { // Create the new node. newNode = new TreeNode(); - newNode.Text = "<font color=blue><b>" + row["name"] + "</b></font>"; + newNode.Text = "<lab>" + row["name"] + "<lab>"; newNode.Value = row["labID"].ToString(); // Set the PopulateOnDemand property to true so that the child nodes can be @@ -390,7 +393,7 @@ foreach (tcdbDataSet.db_usersRow row in uTable) { TreeNode child = new TreeNode(); - child.Text = "<FontInfo color=black>" + row.fullName + "</font>"; + child.Text = "<os>" + row.fullName + "</os>"; child.Value = row.userID.ToString(); child.NavigateUrl = "~/UserSettings.aspx?" + Constants.CODE_USER + "=" + child.Value; @@ -407,7 +410,7 @@ foreach (tcdbDataSet.db_usersRow row in uTable) { TreeNode child = new TreeNode(); - child.Text = "<FontInfo color=black>" + row.fullName + "</font>"; + child.Text = "<architecture>" + row.fullName + "</architecture>"; child.Value = row.userID.ToString(); child.NavigateUrl = "~/UserSettings.aspx?" + Constants.CODE_USER + "=" + child.Value; @@ -495,7 +498,7 @@ { // Create the new node. newNode = new TreeNode(); - newNode.Text = "<font color=blue><i>" + row["statusName"] + "</i></font>"; + newNode.Text = "<status>" + row["statusName"] + "</status>"; newNode.Value = row["statusID"].ToString(); // Set the PopulateOnDemand property to true so that the child nodes can be @@ -528,7 +531,7 @@ { // Create the new node. newNode = new TreeNode(); - newNode.Text = "<font color=blue>" + row["name"] + "</font>"; + newNode.Text = "<computer>" + row["name"] + "</computer>"; newNode.Value = row["computerID"].ToString(); // Set the PopulateOnDemand property to true so that the child nodes can be @@ -546,7 +549,7 @@ } */ } - /* + protected void BuildRightsList(TreeNode parent) { ArrayList nodes = (ArrayList)Session["AdminNodes"]; @@ -574,7 +577,7 @@ newNode.Expand(); } } - */ + protected void BuildBuildList(TreeNode parent) { ArrayList nodes = (ArrayList)Session["AdminNodes"]; @@ -590,7 +593,7 @@ { // Create the new node. newNode = new TreeNode(); - newNode.Text = "<font color=blue><i>" + row["number"] + "</i></font>"; + newNode.Text = "<build>" + row["number"] + "</build>"; newNode.Value = row["buildID"].ToString(); // Set the PopulateOnDemand property to true so that the child nodes can be @@ -623,7 +626,7 @@ { // Create the new node. newNode = new TreeNode(); - newNode.Text = "<font color=blue>" + row["name"] + "</font>"; + newNode.Text = "<testpass>" + row["name"] + "</testpass>"; newNode.Value = row["testPassID"].ToString(); // Set the PopulateOnDemand property to true so that the child nodes can be @@ -660,7 +663,7 @@ { // Create the new node. newNode = new TreeNode(); - newNode.Text = "<font color=blue>" + row["platformName"] + "</font>"; + newNode.Text = "<platform>" + row["platformName"] + "</platform>"; newNode.Value = row["platformID"].ToString(); // Set the PopulateOnDemand property to true so that the child nodes can be @@ -695,7 +698,7 @@ { // Create the new node. newNode = new TreeNode(); - newNode.Text = "<font color=black><b>OS: </b></font><font color=green>" + row["friendlyName"] + "</font>"; + newNode.Text = "<os>" + row["friendlyName"] + "</os>"; newNode.Value = row["osID"].ToString(); // Set the PopulateOnDemand property to true so that the child nodes can be @@ -731,7 +734,7 @@ { // Create the new node. newNode = new TreeNode(); - newNode.Text = "<font color=black><b>Architecture: </b></font><font color=green>" + row["name"] + "</font>"; + newNode.Text = "<architecture>" + row["name"] + "</architecture>"; newNode.Value = row["architectureID"].ToString(); // Set the PopulateOnDemand property to true so that the child nodes can be @@ -760,16 +763,15 @@ BuildProductList(e.Node); break; case 1: - if (e.Node.Text.Contains("Site")) + if (e.Node.Text.Contains(TCDB.Products.ProductDB.GetProduct(Constants.PRODUCT_SITEID).ToString())) BuildAdminList(e.Node); else BuildCategoryList(e.Node); break; case 2: - /* ***NONPRODUCTION*** if (e.Node.Value == "release") BuildReleaseList(e.Node); - else */ if (e.Node.Value == "tag") + else if (e.Node.Value == "tag") BuildTagList(e.Node); else if (e.Node.Value == "status") BuildStatusGroupList(e.Node); @@ -795,8 +797,8 @@ BuildStatusList(e.Node); else if (e.Node.NavigateUrl.Contains("Lab")) BuildComputerList(e.Node); - /*else if (e.Node.NavigateUrl.Contains("Role")) - BuildRightsList(e.Node);*/ + else if (e.Node.NavigateUrl.Contains("Role")) + BuildRightsList(e.Node); break; case 4: if (e.Node.Value == "build") Modified: Website/Includes/Footer.ascx =================================================================== --- Website/Includes/Footer.ascx 2006-08-01 21:22:36 UTC (rev 258) +++ Website/Includes/Footer.ascx 2006-08-01 22:41:20 UTC (rev 259) @@ -9,6 +9,6 @@ } %> | TCDB -<%= TCDB.Common.ConfigDB.GetConfigString("tcdb_version") %> +<%= TCDB.Common.Constants.TCDB_VERSION %> | Page loaded in <%= PageLoad() %> Modified: Website/Includes/Header_CurrentInfo.ascx =================================================================== --- Website/Includes/Header_CurrentInfo.ascx 2006-08-01 21:22:36 UTC (rev 258) +++ Website/Includes/Header_CurrentInfo.ascx 2006-08-01 22:41:20 UTC (rev 259) @@ -1,4 +1,4 @@ <%@ Control Language="C#" AutoEventWireup="true" %> <%@ Import Namespace="TCDB.Users" %> -<!-- ***NONPRODUCTION*** Product | Version | Build--> \ No newline at end of file +<% if (TCDB.Common.Constants.IS_DEV_ENV) { %> Product | Version | Build <% } %> \ No newline at end of file Modified: Website/Includes/Header_Menu.ascx =================================================================== --- Website/Includes/Header_Menu.ascx 2006-08-01 21:22:36 UTC (rev 258) +++ Website/Includes/Header_Menu.ascx 2006-08-01 22:41:20 UTC (rev 259) @@ -2,4 +2,5 @@ <%@ Import Namespace="TCDB.Users" %> <%@ Import Namespace="TCDB.Common" %> -<a href="Assignments.aspx?<% Response.Write(Constants.CODE_USER+"="+m_user.ID); %>">Assignments</a><!-- ***NONPRODUCTION*** | Execute | <a href="TestManagement.aspx">Management</a>--> +<a href="Assignments.aspx?<% Response.Write(Constants.CODE_USER+"="+m_user.ID); %>">Assignments</a><% if (TCDB.Common.Constants.IS_DEV_ENV) + { %> | Execute | <a href="TestManagement.aspx">Management</a><% } %> Modified: Website/Includes/Products.ascx =================================================================== --- Website/Includes/Products.ascx 2006-08-01 21:22:36 UTC (rev 258) +++ Website/Includes/Products.ascx 2006-08-01 22:41:20 UTC (rev 259) @@ -1,160 +1,60 @@ -<%@ Control Language="C#" AutoEventWireup="true" %> +<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Products.ascx.cs" Inherits="Products" %> <%@ Register Assembly="FreeTextBox" Namespace="FreeTextBoxControls" TagPrefix="FTB" %> <%@ Import Namespace="TCDB.Users" %> <%@ Import Namespace="TCDB.Common" %> <%@ Import Namespace="log4net" %> - -<script runat="server"> - private static ILog m_logg = LogManager.GetLogger("Page:Product"); - private int productID = Convert.ToInt32(HttpContext.Current.Request.QueryString[Constants.CODE_PRODUCT]); - private String mode = HttpContext.Current.Request.QueryString["mode"]; - - protected void Page_Load(object sender, EventArgs e) - { - m_logg.Debug("Loading page Product"); - if (productID == 0) - { - m_logg.Debug("Unable to locate product ID in query string"); - if (mode != "new") - { - m_logg.Debug("Mode not set to new, redirecting to Test Management page"); - Response.Redirect("TestManagement.aspx"); - } - } - Session.Add("item_id", productID); - Session.Add("tableName", "tcdb_product"); - - if (mode == "new") - FormView1.ChangeMode(FormViewMode.Insert); - } - protected void FormView1_ItemDeleted(object sender, FormViewDeletedEventArgs e) - { - if (mode == "read") - Response.Redirect("TestManagement.aspx"); - else - Response.Redirect("Administration.aspx"); - } - protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e) - { - tcdbDataSetTableAdapters.db_productsTableAdapter productAdapter = new tcdbDataSetTableAdapters.db_productsTableAdapter(); - tcdbDataSet.db_productsDataTable productTable = productAdapter.GetData(true, null); - - if (productTable.Count > 0) - { - if (mode == "read") - Response.Redirect("Product.aspx?mode=read&" + Constants.CODE_PRODUCT + "=" + productTable[productTable.Count - 1].productID); - else - Response.Redirect("Product.aspx?" + Constants.CODE_PRODUCT + "=" + productTable[productTable.Count - 1].productID); - } - } - protected void FormView1_ItemUpdated(object sender, FormViewUpdatedEventArgs e) - { - if (mode == "read") - Response.Redirect("Product.aspx?mode=read&" + Constants.CODE_PRODUCT + "=" + productID); - else - Response.Redirect("Product.aspx?" + Constants.CODE_PRODUCT + "=" + productID); - } - protected void commandPanel_Load(object sender, EventArgs e) - { - if (mode == "read") - { - Panel commandPanel = (Panel)FormView1.FindControl("commandPanel"); - commandPanel.Visible = false; - } - } - - protected void RoleUsersPanel_Init(object sender, EventArgs e) - { - Panel ruPanel = (Panel)sender; - - tcdbDataSetTableAdapters.db_roleUserProductTableAdapter rupAdapter = new tcdbDataSetTableAdapters.db_roleUserProductTableAdapter(); - tcdbDataSet.db_roleUserProductDataTable rupTable = rupAdapter.GetData(null, productID, true); - - foreach (tcdbDataSet.db_roleUserProductRow rRow in rupTable) - { - int roleID = rRow.roleID; - - Label Role = new Label(); - Role.Text = "<strong>" + rRow.roleName + ": </strong>"; - ruPanel.Controls.Add(Role); - - tcdbDataSetTableAdapters.db_roleProductUserTableAdapter rpuAdapter = new tcdbDataSetTableAdapters.db_roleProductUserTableAdapter(); - tcdbDataSet.db_roleProductUserDataTable rpuTable = rpuAdapter.GetData(roleID, productID, true); - - Label Users = new Label(); - foreach (tcdbDataSet.db_roleProductUserRow row in rpuTable) - { - if (Users.Text != "") - Users.Text += ", "; - Users.Text += row.fullName; - } - ruPanel.Controls.Add(Users); - - Literal html = new Literal(); - html.Text = "<br />"; - ruPanel.Controls.Add(html); - } - } -</script> - -<asp:FormView ID="FormView1" runat="server" DataKeyNames="productID" DataSourceID="ProductData" - OnItemDeleted="FormView1_ItemDeleted" OnItemInserted="FormView1_ItemInserted" - OnItemUpdated="FormView1_ItemUpdated"> +<asp:FormView ID="ProductsView" runat="server" DataKeyNames="productID" DataSourceID="ProductData" + OnItemDeleted="ProductsView_ItemDeleted" OnItemInserted="ProductsView_ItemInserted" + OnItemUpdated="ProductsView_ItemUpdated"> <HeaderTemplate> - <h2> - Product</h2> + <div class="ch"> + <h2> + Product</h2> + </div> + <div class="cc"> </HeaderTemplate> <ItemTemplate> <div class="xsnazzy"> <b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"> </b></b> <div class="xboxcontent"> - <table width="700"> - <tr> - <td colspan="3" width="75%" align="left"> - <strong>Product Name: </strong> - <asp:Label ID="NameLabel" runat="server" Text='<%# Bind("Name") %>'></asp:Label> </td> - <td colspan="1" width="25%" align="right"> - <strong>Abbreviation: </strong> - <asp:Label ID="CodeLabel" runat="server" Text='<%# Eval("codeName") %>'></asp:Label></td> - </tr> - <tr> - <td class="hr" colspan="4" style="height: 1px"> - </td> - </tr> - <tr> - <td colspan="4" height="200" align="left"> - <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>'></asp:Label></td> - </tr> - <tr> - <td class="hr" colspan="4"> - </td> - </tr> - <tr> - <td colspan="4"> - <asp:Panel ID="RoleUsersPanel" runat="server" Height="100%" Width="100%" OnInit="RoleUsersPanel_Init"> - </asp:Panel> - </td> - </tr> - <tr> - <td class="hr" colspan="4"> - </td> - </tr> - <tr> - <td colspan="1" width="25%" align="left"> - <asp:Panel ID="commandPanel" runat="server" OnLoad="commandPanel_Load"> - <asp:LinkButton ID="New" runat="server" CommandName="New">New</asp:LinkButton> | <asp:LinkButton - ID="Edit" runat="server" CommandName="Edit">Edit</asp:LinkButton> | <asp:LinkButton - ID="Delete" runat="server" CommandName="Delete">Delete</asp:LinkButton></asp:Panel> - </td> - <td colspan="3" width="75%"> - </td> - </tr> - </table> + <div class="ct"> + <div class="item"> + <label> + Product Name:</label> + <asp:Label ID="NameLabel" runat="server" Text='<%# Bind("Name") %>'></asp:Label></div> + <div class="item"> + <label> + Abbreviation:</label> + <asp:Label ID="CodeLabel" runat="server" Text='<%# Eval("codeName") %>'></asp:Label> + </div> + <div class="hr"> + </div> + </div> + <div class="cm"> + <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>'></asp:Label> + <div class="hr"> + </div> + </div> + <div class="cm"> + <asp:Panel ID="RoleUsersPanel" runat="server" Height="100%" Width="100%" OnInit="RoleUsersPanel_Init"> + </asp:Panel> + <% if (TCDB.Common.Constants.IS_DEV_ENV) + { %> + <div class="hr"> + </div> + </div> + <div class="cb"> + <asp:Panel ID="commandPanel" runat="server" OnLoad="commandPanel_Load"> + <asp:LinkButton ID="New" runat="server" CommandName="New">New</asp:LinkButton> | <asp:LinkButton + ID="Edit" runat="server" CommandName="Edit">Edit</asp:LinkButton> | <asp:LinkButton + ID="Delete" runat="server" CommandName="Delete">Delete</asp:LinkButton></asp:Panel> + </div> + <% } %> </div> - <b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"> - </b></b> </div> + <b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"> + </b></b></div> </ItemTemplate> <EditItemTemplate> <div class="xsnazzy"> @@ -319,6 +219,9 @@ </b></b> </div> </InsertItemTemplate> + <FooterTemplate> + </div> + </FooterTemplate> </asp:FormView> <asp:ObjectDataSource ID="ProductData" runat="server" InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="tcdbDataSetTableAdapters.db_productsTableAdapter" Added: Website/Includes/Products.ascx.cs =================================================================== --- Website/Includes/Products.ascx.cs (rev 0) +++ Website/Includes/Products.ascx.cs 2006-08-01 22:41:20 UTC (rev 259) @@ -0,0 +1,113 @@ +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 log4net; +using TCDB.Common; +using TCDB.Users; + +/// <summary> +/// Summary description for Products +/// </summary> +public partial class Products : SiteUserControl +{ + private static ILog m_logg = LogManager.GetLogger("Page:Product"); + private int productID = Convert.ToInt32(HttpContext.Current.Request.QueryString[Constants.CODE_PRODUCT]); + private String mode = HttpContext.Current.Request.QueryString["mode"]; + + protected void Page_Load(object sender, EventArgs e) + { + m_logg.Debug("Loading page Product"); + if (productID == 0) + { + m_logg.Debug("Unable to locate product ID in query string"); + if (mode != "new") + { + m_logg.Debug("Mode not set to new, redirecting to Test Management page"); + Response.Redirect("TestManagement.aspx"); + } + } + Session.Add("item_id", productID); + Session.Add("tableName", "tcdb_product"); + + if (mode == "new") + ProductsView.ChangeMode(FormViewMode.Insert); + } + + protected void ProductsView_ItemDeleted(object sender, FormViewDeletedEventArgs e) + { + if (mode == "read") + Response.Redirect("TestManagement.aspx"); + else + Response.Redirect("Administration.aspx"); + } + + protected void ProductsView_ItemInserted(object sender, FormViewInsertedEventArgs e) + { + tcdbDataSetTableAdapters.db_productsTableAdapter productAdapter = new tcdbDataSetTableAdapters.db_productsTableAdapter(); + tcdbDataSet.db_productsDataTable productTable = productAdapter.GetData(true, null); + + if (productTable.Count > 0) + { + if (mode == "read") + Response.Redirect("Product.aspx?mode=read&" + Constants.CODE_PRODUCT + "=" + productTable[productTable.Count - 1].productID); + else + Response.Redirect("Product.aspx?" + Constants.CODE_PRODUCT + "=" + productTable[productTable.Count - 1].productID); + } + } + + protected void ProductsView_ItemUpdated(object sender, FormViewUpdatedEventArgs e) + { + if (mode == "read") + Response.Redirect("Product.aspx?mode=read&" + Constants.CODE_PRODUCT + "=" + productID); + else + Response.Redirect("Product.aspx?" + Constants.CODE_PRODUCT + "=" + productID); + } + + protected void commandPanel_Load(object sender, EventArgs e) + { + if (mode == "read") + { + Panel commandPanel = (Panel)ProductsView.FindControl("commandPanel"); + commandPanel.Visible = false; + } + } + + protected void RoleUsersPanel_Init(object sender, EventArgs e) + { + Panel ruPanel = (Panel)sender; + + tcdbDataSetTableAdapters.db_roleUserProductTableAdapter rupAdapter = new tcdbDataSetTableAdapters.db_roleUserProductTableAdapter(); + tcdbDataSet.db_roleUserProductDataTable rupTable = rupAdapter.GetData(null, productID, true); + + foreach (tcdbDataSet.db_roleUserProductRow rRow in rupTable) + { + int roleID = rRow.roleID; + + Label Role = new Label(); + Role.Text = "<div class=\"item\"><label>" + rRow.roleName + ":</label><div class=\"indent\">"; + ruPanel.Controls.Add(Role); + + tcdbDataSetTableAdapters.db_roleProductUserTableAdapter rpuAdapter = new tcdbDataSetTableAdapters.db_roleProductUserTableAdapter(); + tcdbDataSet.db_roleProductUserDataTable rpuTable = rpuAdapter.GetData(roleID, productID, true); + + Label Users = new Label(); + foreach (tcdbDataSet.db_roleProductUserRow row in rpuTable) + { + if (Users.Text != "") + Users.Text += ", "; + Users.Text += row.fullName; + } + ruPanel.Controls.Add(Users); + + Literal html = new Literal(); + html.Text = "</div></div>"; + ruPanel.Controls.Add(html); + } + } +} Modified: Website/Includes/UserSettings.ascx =================================================================== --- Website/Includes/UserSettings.ascx 2006-08-01 21:22:36 UTC (rev 258) +++ Website/Includes/UserSettings.ascx 2006-08-01 22:41:20 UTC (rev 259) @@ -92,7 +92,11 @@ runat="server" ID="newLabel" OnLoad="newLabel_Load"> | </asp:Label> <asp:LinkButton ID="Edit" runat="server" CommandName="Edit" OnInit="Edit_Init">Edit User</asp:LinkButton><asp:Label runat="server" ID="editLabel" OnLoad="editLabel_Load"> | </asp:Label> - <asp:LinkButton ID="editConfig" runat="server" CommandName="editConfig" OnCommand="editConfig" OnInit="editConfig_Init">Preferences</asp:LinkButton> + <% if (TCDB.Common.Constants.IS_DEV_ENV) + { %> + <asp:LinkButton ID="editConfig" runat="server" CommandName="editConfig" OnCommand="editConfig" + OnInit="editConfig_Init">Preferences</asp:LinkButton> + <% } %> <asp:Label runat="server" ID="deleteLabel" OnLoad="deleteLabel_Load"> | </asp:Label><asp:LinkButton ID="Delete" runat="server" CommandName="Delete" OnLoad="deleteButton_Load">Delete</asp:LinkButton> </div> @@ -169,13 +173,15 @@ </div> <div class="cm"> <div class="left"> - <div class="item"><label>Roles:</label></div> <div class="item"> + <label> + Roles:</label></div> + <div class="item"> <asp:TreeView ID="roleTree" runat="server" OnInit="roleTreeEdit_Init" OnTreeNodePopulate="roleTree_TreeNodePopulate" - ShowCheckBoxes="All" OnSelectedNodeChanged="roleTree_SelectedNodeChanged" ShowExpandCollapse="false" OnTreeNodeCheckChanged="roleTree_TreeNodeCheckChanged"> + ShowCheckBoxes="All" OnSelectedNodeChanged="roleTree_SelectedNodeChanged" ShowExpandCollapse="false" + OnTreeNodeCheckChanged="roleTree_TreeNodeCheckChanged"> <Nodes> - <asp:TreeNode Text="" - Value="Roles" PopulateOnDemand="True" ShowCheckBox="false" /> + <asp:TreeNode Text="" Value="Roles" PopulateOnDemand="True" ShowCheckBox="false" /> </Nodes> </asp:TreeView> </div> @@ -269,15 +275,16 @@ </div> <div class="cm"> <div class="left"> - <div class="item"><label>Roles:</label></div> <div class="item"> - <asp:TreeView ID="roleTree" runat="server" OnInit="roleTreeEdit_Init" OnTreeNodePopulate="roleTree_TreeNodePopulate" - ShowCheckBoxes="All" OnSelectedNodeChanged="roleTree_SelectedNodeChanged" ShowExpandCollapse="false"> - <Nodes> - <asp:TreeNode Text="" - Value="Roles" PopulateOnDemand="True" Selected="false" ShowCheckBox="false" /> - </Nodes> - </asp:TreeView> + <label> + Roles:</label></div> + <div class="item"> + <asp:TreeView ID="roleTree" runat="server" OnInit="roleTreeEdit_Init" OnTreeNodePopulate="roleTree_TreeNodePopulate" + ShowCheckBoxes="All" OnSelectedNodeChanged="roleTree_SelectedNodeChanged" ShowExpandCollapse="false"> + <Nodes> + <asp:TreeNode Text="" Value="Roles" PopulateOnDemand="True" Selected="false" ShowCheckBox="false" /> + </Nodes> + </asp:TreeView> </div> </div> <div class="end"> Modified: Website/TCDB.master =================================================================== --- Website/TCDB.master 2006-08-01 21:22:36 UTC (rev 258) +++ Website/TCDB.master 2006-08-01 22:41:20 UTC (rev 259) @@ -20,23 +20,11 @@ <div id="NonFooter"> <% if (ConfigDB.GetConfigString("tcdb_version").Equals(Constants.TCDB_VERSION)) { - try - { - string motd = ConfigDB.GetConfigString(Constants.ANONYMOUSUSERID, "site_motd"); - if (motd.Length > 0) - { - motdLabel.Text = motd; - motdLabel.Enabled = true; - motdLabel.Visible = true; - } - } - catch { } %> <form id="Form1" runat="server"> <div id="HeaderContent"> <TCDB:Header runat="server" ID="Header" /> </div> - <div class="motd"><asp:Label ID="motdLabel" runat="server" Visible="false" Enabled="false"></asp:Label></div> <% if (m_user.ISAUTHENTICATED) @@ -53,14 +41,23 @@ <td id="MainContent"> <% - try { + string motd = ConfigDB.GetConfigString(Constants.ANONYMOUSUSERID, "site_motd"); + if (motd.Length > 0) + { + motdLabel.Text = motd; + motdLabel.Visible = true; + } + } + catch { } + + try + { string error = ConfigDB.GetConfigString(m_user.ID, "error"); if (error.Length > 0) { errorLabel.Text = error; - errorLabel.Enabled = true; errorLabel.Visible = true; ConfigDB.DeleteConfig(m_user.ID, "error"); @@ -70,7 +67,8 @@ %> - <asp:Label ID="errorLabel" runat="server" CssClass="error" Visible="false"></asp:Label> + <div class="motd"><asp:Label ID="motdLabel" runat="server" Visible="false"></asp:Label></div> + <div class="error"><asp:Label ID="errorLabel" runat="server" Visible="false"></asp:Label></div> <asp:ContentPlaceHolder ID="MainContentPlaceHolder" runat="server"> </asp:ContentPlaceHolder> </td> @@ -85,8 +83,20 @@ } else { + try + { + string motd = ConfigDB.GetConfigString(Constants.ANONYMOUSUSERID, "site_motd"); + if (motd.Length > 0) + { + motdLabelLogin.Text = motd; + motdLabelLogin.Visible = true; + } + } + catch { } + m_logg.Debug("User " + m_user.ToString() + " is not authenticated, displaying login"); %> + <div class="motd"><asp:Label ID="motdLabelLogin" runat="server" Visible="false"></asp:Label></div> <div id="Login"> <TCDB:Authenticate runat="server" ID="Authenticate" /> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |