From: <m_h...@us...> - 2006-07-28 21:20:58
|
Revision: 234 Author: m_hildebrand Date: 2006-07-28 14:19:34 -0700 (Fri, 28 Jul 2006) ViewCVS: http://svn.sourceforge.net/tcdb/?rev=234&view=rev Log Message: ----------- Made some more CSS fixes Fixed a bug where updated/completed action items were not sending email notification Fixed a bug where config data was not pulling from the site defaults if it didn't exist for the specific user Modified Paths: -------------- Website/App_Code/Common.cs Website/App_Themes/Python/python.css Website/Includes/ActionItems.ascx Website/Includes/ActionItems.ascx.cs Website/Includes/UserConfig.ascx Website/Includes/UserConfig.ascx.cs Website/Includes/UserSettings.ascx Website/Includes/UserSettings.ascx.cs Modified: Website/App_Code/Common.cs =================================================================== --- Website/App_Code/Common.cs 2006-07-28 21:06:32 UTC (rev 233) +++ Website/App_Code/Common.cs 2006-07-28 21:19:34 UTC (rev 234) @@ -1062,6 +1062,11 @@ value = Help.DB_StringParse(dr["value"]); } + if (value == null && userID != Constants.ANONYMOUSUSERID) + { + value = GetConfigString(Constants.ANONYMOUSUSERID, name); + } + // TODO: Save this value to the cache return value; @@ -1261,11 +1266,10 @@ } //create the mail message - MailMessage mail = new MailMessage(); + MailAddress fromAddr = new MailAddress(from.EMAIL, to.FULLNAME); + MailAddress toAddr = new MailAddress(to.EMAIL, to.FULLNAME); + MailMessage mail = new MailMessage(fromAddr, toAddr); - mail.From = new MailAddress(from.EMAIL, from.FULLNAME); - mail.To.Add(new MailAddress(to.EMAIL, to.FULLNAME)); - //set the content mail.Subject = subject; mail.Body = body; Modified: Website/App_Themes/Python/python.css =================================================================== --- Website/App_Themes/Python/python.css 2006-07-28 21:06:32 UTC (rev 233) +++ Website/App_Themes/Python/python.css 2006-07-28 21:19:34 UTC (rev 234) @@ -93,6 +93,34 @@ color: Gray; } +.item .checkbox INPUT +{ + margin: 0; + padding: 0; + position: relative; + left: -5px; + top: 1px; +} + +* html .item .checkbox INPUT +{ + position: static; +} + +.item UL +{ + margin: 0; + padding-left: 20px; + list-style-type: none; +} + +.item UL UL +{ + padding-left: 20px; + margin: 0; + list-style-type: circle; +} + /********** END Global Classes **********/ /********** BEGIN Calendar Classes **********/ Modified: Website/Includes/ActionItems.ascx =================================================================== --- Website/Includes/ActionItems.ascx 2006-07-28 21:06:32 UTC (rev 233) +++ Website/Includes/ActionItems.ascx 2006-07-28 21:19:34 UTC (rev 234) @@ -7,9 +7,9 @@ <%@ Import Namespace="System.Data.SqlClient" %> <%@ Import Namespace="eWorld" %> <div id="ActionItem"> - <asp:FormView ID="FormView1" runat="server" DataSourceID="ActionItemDataSource" DataKeyNames="actionItemID" - CellPadding="4" ForeColor="#333333" OnDataBound="FormView1_DataBound" OnItemCommand="FormView1_ItemCommand" - Width="100%" OnItemInserted="FormView1_ItemInserted" OnItemUpdated="FormView1_ItemUpdated"> + <asp:FormView ID="ActionItemsView" runat="server" DataSourceID="ActionItemDataSource" DataKeyNames="actionItemID" + CellPadding="4" ForeColor="#333333" OnDataBound="ActionItemsView_DataBound" OnItemCommand="ActionItemsView_ItemCommand" + Width="100%" OnItemInserted="ActionItemsView_ItemInserted" OnItemUpdated="ActionItemsView_ItemUpdated"> <HeaderTemplate> <asp:ObjectDataSource ID="StatusDataSource" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="tcdbDataSetTableAdapters.db_statusTableAdapter"> Modified: Website/Includes/ActionItems.ascx.cs =================================================================== --- Website/Includes/ActionItems.ascx.cs 2006-07-28 21:06:32 UTC (rev 233) +++ Website/Includes/ActionItems.ascx.cs 2006-07-28 21:19:34 UTC (rev 234) @@ -42,16 +42,17 @@ Session.Add("tableName", "tcdb_actionItem"); if (mode == "new") - FormView1.ChangeMode(FormViewMode.Insert); + ActionItemsView.ChangeMode(FormViewMode.Insert); } + protected void updateStatus() { - RadioButtonList percentList = (RadioButtonList)FormView1.FindControl("percentList"); - DropDownList statusList = (DropDownList)FormView1.FindControl("statusList"); - Object dateFinished = FormView1.FindControl("dateFinished"); + RadioButtonList percentList = (RadioButtonList)ActionItemsView.FindControl("percentList"); + DropDownList statusList = (DropDownList)ActionItemsView.FindControl("statusList"); + Object dateFinished = ActionItemsView.FindControl("dateFinished"); Nullable<DateTime> date; - if (FormView1.CurrentMode == FormViewMode.ReadOnly) + if (ActionItemsView.CurrentMode == FormViewMode.ReadOnly) { String finished = ((Label)dateFinished).Text; @@ -65,21 +66,24 @@ date = ((CalendarPopup)dateFinished).SelectedValue; } + // Update Database + tcdbDataSetTableAdapters.db_actionItemsTableAdapter aiAdapter = new tcdbDataSetTableAdapters.db_actionItemsTableAdapter(); + aiAdapter.upd_actionItemStatus(item_id, Convert.ToInt32(statusList.SelectedValue), Convert.ToInt32(percentList.SelectedValue), date); + + m_logg.Debug("Action Item updated, preparing to send email"); if (date == null) ActionItemDB.SendUpdatedActionItemMail(item_id, m_user); else ActionItemDB.SendCompletedActionItemMail(item_id, m_user); - // Update Database - tcdbDataSetTableAdapters.db_actionItemsTableAdapter aiAdapter = new tcdbDataSetTableAdapters.db_actionItemsTableAdapter(); - aiAdapter.upd_actionItemStatus(item_id, Convert.ToInt32(statusList.SelectedValue), Convert.ToInt32(percentList.SelectedValue), date); } + protected void dateFinished_DateChanged(object sender, EventArgs e) { - if (FormView1.CurrentMode != FormViewMode.Insert) + if (ActionItemsView.CurrentMode != FormViewMode.Insert) { - RadioButtonList percentList = (RadioButtonList)FormView1.FindControl("percentList"); - DropDownList statusList = (DropDownList)FormView1.FindControl("statusList"); + RadioButtonList percentList = (RadioButtonList)ActionItemsView.FindControl("percentList"); + DropDownList statusList = (DropDownList)ActionItemsView.FindControl("statusList"); CalendarPopup dateFinished = (CalendarPopup)sender; if (dateFinished.SelectedValue != null) @@ -95,33 +99,33 @@ percentList.SelectedValue = "75"; } - if (FormView1.CurrentMode == FormViewMode.ReadOnly) + if (ActionItemsView.CurrentMode == FormViewMode.ReadOnly) updateStatus(); } } + protected void percentChanged(object sender, EventArgs e) { - if (FormView1.CurrentMode != FormViewMode.Insert) + if (ActionItemsView.CurrentMode != FormViewMode.Insert) { RadioButtonList percentList = (RadioButtonList)sender; - DropDownList statusList = (DropDownList)FormView1.FindControl("statusList"); + DropDownList statusList = (DropDownList)ActionItemsView.FindControl("statusList"); if (percentList.SelectedValue == "100") { statusList.SelectedValue = statusList.Items.FindByText("Completed").Value; // Set finished Date - if (FormView1.CurrentMode == FormViewMode.ReadOnly) + if (ActionItemsView.CurrentMode == FormViewMode.ReadOnly) { - Label dateFinished = (Label)FormView1.FindControl("dateFinished"); + Label dateFinished = (Label)ActionItemsView.FindControl("dateFinished"); if (dateFinished.Text == "") dateFinished.Text = DateTime.Today.ToShortDateString(); - } else { - CalendarPopup dateFinished = (CalendarPopup)FormView1.FindControl("dateFinished"); + CalendarPopup dateFinished = (CalendarPopup)ActionItemsView.FindControl("dateFinished"); if (dateFinished.SelectedValue == null) dateFinished.SelectedValue = DateTime.Today; @@ -134,27 +138,28 @@ statusList.SelectedValue = statusList.Items.FindByText("Active").Value; // Unset finished Date - if (FormView1.CurrentMode == FormViewMode.ReadOnly) + if (ActionItemsView.CurrentMode == FormViewMode.ReadOnly) { - Label dateFinished = (Label)FormView1.FindControl("dateFinished"); + Label dateFinished = (Label)ActionItemsView.FindControl("dateFinished"); dateFinished.Text = ""; } else { - CalendarPopup dateFinished = (CalendarPopup)FormView1.FindControl("dateFinished"); + CalendarPopup dateFinished = (CalendarPopup)ActionItemsView.FindControl("dateFinished"); dateFinished.Clear(); dateFinished.PostedDate = ""; } } - if (FormView1.CurrentMode == FormViewMode.ReadOnly) + if (ActionItemsView.CurrentMode == FormViewMode.ReadOnly) updateStatus(); } } + protected void statusChanged(object sender, EventArgs e) { - if (FormView1.CurrentMode != FormViewMode.Insert) + if (ActionItemsView.CurrentMode != FormViewMode.Insert) { - RadioButtonList percentList = (RadioButtonList)FormView1.FindControl("percentList"); + RadioButtonList percentList = (RadioButtonList)ActionItemsView.FindControl("percentList"); DropDownList statusList = (DropDownList)sender; if (statusList.SelectedItem.Text == "Completed") @@ -162,15 +167,15 @@ percentList.SelectedValue = "100"; // Set finished Date - if (FormView1.CurrentMode == FormViewMode.ReadOnly) + if (ActionItemsView.CurrentMode == FormViewMode.ReadOnly) { - Label dateFinished = (Label)FormView1.FindControl("dateFinished"); + Label dateFinished = (Label)ActionItemsView.FindControl("dateFinished"); dateFinished.Text = DateTime.Today.ToShortDateString(); } else { - CalendarPopup dateFinished = (CalendarPopup)FormView1.FindControl("dateFinished"); + CalendarPopup dateFinished = (CalendarPopup)ActionItemsView.FindControl("dateFinished"); dateFinished.SelectedValue = DateTime.Today; } @@ -183,32 +188,33 @@ percentList.SelectedValue = "75"; // Unset finished Date - if (FormView1.CurrentMode == FormViewMode.ReadOnly) + if (ActionItemsView.CurrentMode == FormViewMode.ReadOnly) { - Label dateFinished = (Label)FormView1.FindControl("dateFinished"); + Label dateFinished = (Label)ActionItemsView.FindControl("dateFinished"); dateFinished.Text = ""; } else { - CalendarPopup dateFinished = (CalendarPopup)FormView1.FindControl("dateFinished"); + CalendarPopup dateFinished = (CalendarPopup)ActionItemsView.FindControl("dateFinished"); dateFinished.Clear(); dateFinished.PostedDate = ""; } } - if (FormView1.CurrentMode == FormViewMode.ReadOnly) + if (ActionItemsView.CurrentMode == FormViewMode.ReadOnly) updateStatus(); } } - protected void FormView1_DataBound(object sender, EventArgs e) + + protected void ActionItemsView_DataBound(object sender, EventArgs e) { - DataRowView data = (DataRowView)FormView1.DataItem; + DataRowView data = (DataRowView)ActionItemsView.DataItem; - if (FormView1.CurrentMode == FormViewMode.Edit && data != null) + if (ActionItemsView.CurrentMode == FormViewMode.Edit && data != null) { - CalendarPopup cal = (CalendarPopup)FormView1.FindControl("dateFinished"); + CalendarPopup cal = (CalendarPopup)ActionItemsView.FindControl("dateFinished"); - DataRowView row = (DataRowView)FormView1.DataItem; + DataRowView row = (DataRowView)ActionItemsView.DataItem; String date = row["dateFinished"].ToString(); if (date == "") @@ -221,16 +227,16 @@ cal.SelectedValue = (Nullable<DateTime>)row["dateFinished"]; } - if (FormView1.CurrentMode == FormViewMode.Insert) + if (ActionItemsView.CurrentMode == FormViewMode.Insert) { Page.Title = "TCDB: Insert Action Item"; - Label createdBy = (Label)FormView1.FindControl("createdByLbl"); - Label dateAssigned = (Label)FormView1.FindControl("dateAssignedLbl"); - DropDownList assignedTo = (DropDownList)FormView1.FindControl("assignedTo"); - DropDownList status = (DropDownList)FormView1.FindControl("statusList"); - RadioButtonList percent = (RadioButtonList)FormView1.FindControl("percentList"); - CalendarPopup dateDue = (CalendarPopup)FormView1.FindControl("dateDue"); + Label createdBy = (Label)ActionItemsView.FindControl("createdByLbl"); + Label dateAssigned = (Label)ActionItemsView.FindControl("dateAssignedLbl"); + DropDownList assignedTo = (DropDownList)ActionItemsView.FindControl("assignedTo"); + DropDownList status = (DropDownList)ActionItemsView.FindControl("statusList"); + RadioButtonList percent = (RadioButtonList)ActionItemsView.FindControl("percentList"); + CalendarPopup dateDue = (CalendarPopup)ActionItemsView.FindControl("dateDue"); createdBy.Text = m_user.FULLNAME; createdBy.ToolTip = m_user.ID.ToString(); @@ -247,9 +253,10 @@ else Response.Redirect("Assignments.aspx?" + Constants.CODE_USER + "=" + m_user.ID); } - protected void FormView1_ItemCommand(object sender, FormViewCommandEventArgs e) + + protected void ActionItemsView_ItemCommand(object sender, FormViewCommandEventArgs e) { - if (e.CommandName == "Cancel" && FormView1.CurrentMode == FormViewMode.Insert) + if (e.CommandName == "Cancel" && ActionItemsView.CurrentMode == FormViewMode.Insert) Response.Redirect("Assignments.aspx?" + Constants.CODE_USER + "=" + m_user.ID); } @@ -259,9 +266,8 @@ aiAdapter.Delete(item_id, 0); Response.Redirect("Assignments.aspx?" + Constants.CODE_USER + "=" + m_user.ID); } - - - protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e) + + protected void ActionItemsView_ItemInserted(object sender, FormViewInsertedEventArgs e) { tcdbDataSetTableAdapters.db_assignmentsTableAdapter aiAdapter = new tcdbDataSetTableAdapters.db_assignmentsTableAdapter(); tcdbDataSet.db_assignmentsDataTable aiTable = aiAdapter.GetData(Constants.CODE_AI, @@ -287,7 +293,7 @@ } } - protected void FormView1_ItemUpdated(object sender, FormViewUpdatedEventArgs e) + protected void ActionItemsView_ItemUpdated(object sender, FormViewUpdatedEventArgs e) { updateStatus(); Response.Redirect("ActionItem.aspx?" + Constants.CODE_AI + "=" + item_id.ToString()); Modified: Website/Includes/UserConfig.ascx =================================================================== --- Website/Includes/UserConfig.ascx 2006-07-28 21:06:32 UTC (rev 233) +++ Website/Includes/UserConfig.ascx 2006-07-28 21:19:34 UTC (rev 234) @@ -2,9 +2,12 @@ <%@ Import Namespace="TCDB.Users" %> <%@ Import Namespace="TCDB.Common" %> <%@ Import Namespace="System.Collections.Generic" %> -<h1> - User Configuration Settings</h1> -<br /> -<asp:LinkButton ID="returnBtn" runat="server" CommandName="returnToSettings" OnCommand="returnToSettings">Return To Settings</asp:LinkButton> -<br /><br /> - +<div class="ch"> + <div class="left"> + <h2> + User Configuration Settings</h2> + </div> + <div class="right"> + <asp:LinkButton ID="returnBtn" runat="server" CommandName="returnToSettings" OnCommand="returnToSettings">Return To Settings</asp:LinkButton></div> + <div class="end"></div> +</div> Modified: Website/Includes/UserConfig.ascx.cs =================================================================== --- Website/Includes/UserConfig.ascx.cs 2006-07-28 21:06:32 UTC (rev 233) +++ Website/Includes/UserConfig.ascx.cs 2006-07-28 21:19:34 UTC (rev 234) @@ -45,15 +45,15 @@ foreach (String group in settings.Keys) { html = new Literal(); - html.Text = "<h2>"; + html.Text = "<div class=\"ch\"><div class=\"left\"><h2>"; Controls.Add(html); - + Label groupLbl = new Label(); groupLbl.Text = group; Controls.Add(groupLbl); html = new Literal(); - html.Text = "</h2>\n" + + html.Text = "</h2></div></div>" + "<div class=\"xsnazzy\">\n" + "<b class=\"xtop\"><b class=\"xb1\"></b><b class=\"xb2\"></b><b class=\"xb3\"></b><b class=\"xb4\"></b></b>\n" + "<div class=\"xboxcontent\">\n" + @@ -201,21 +201,28 @@ Controls.Add(update2Btn); } + protected void test_load(object sender, EventArgs e) + { + } + void textboxChanged(Object sender, EventArgs args) { TextBox textbox = (TextBox)sender; ConfigDB.SaveConfigString(userID, textbox.ID, textbox.Text); } + void checkboxChanged(Object sender, EventArgs args) { CheckBox checkbox = (CheckBox)sender; ConfigDB.SaveConfigBool(userID, checkbox.ID, checkbox.Checked); } + void dropdownChanged(Object sender, EventArgs args) { DropDownList dropdown = (DropDownList)sender; ConfigDB.SaveConfigString(userID, dropdown.ID, dropdown.SelectedValue); } + void absoluteDateChanged(Object sender, EventArgs args) { CalendarPopup absDate = (CalendarPopup) sender; @@ -227,6 +234,7 @@ ConfigDB.SaveConfigString(userID, key, absDate.SelectedDate.ToString()); } } + void relativeDateChanged(Object sender, EventArgs args) { TextBox relDate = (TextBox)sender; @@ -238,10 +246,11 @@ ConfigDB.SaveConfigString(userID, key, "r: "+relDate.Text); } } + protected void returnToSettings(object sender, CommandEventArgs e) { if (mode == "read") - Response.Redirect("UserSettings.aspx?mode=read&" + Constants.CODE_USER + "=" + userID); + Response.Redirect("UserSettings.aspx?mode=read " + Constants.CODE_USER + "=" + userID); else Response.Redirect("UserSettings.aspx?" + Constants.CODE_USER + "=" + userID); } Modified: Website/Includes/UserSettings.ascx =================================================================== --- Website/Includes/UserSettings.ascx 2006-07-28 21:06:32 UTC (rev 233) +++ Website/Includes/UserSettings.ascx 2006-07-28 21:19:34 UTC (rev 234) @@ -4,13 +4,13 @@ <%@ Register Assembly="eWorld.UI, Version=2.0.0.2148, Culture=neutral, PublicKeyToken=24d65337282035f2" Namespace="eWorld.UI" TagPrefix="ew" %> <div id="UserSettings"> - <asp:FormView ID="FormView1" runat="server" DataSourceID="UserDataSource" DataKeyNames="userID" - OnItemDeleted="FormView1_ItemDeleted" OnItemCommand="FormView1_ItemCommand" OnItemInserted="FormView1_ItemInserted" - OnItemUpdated="FormView1_ItemUpdated" OnDataBound="FormView1_DataBound"> + <asp:FormView ID="UserSettingsView" runat="server" DataSourceID="UserDataSource" DataKeyNames="userID" + OnItemDeleted="UserSettingsView_ItemDeleted" OnItemCommand="UserSettingsView_ItemCommand" OnItemInserted="UserSettingsView_ItemInserted" + OnItemUpdated="UserSettingsView_ItemUpdated" OnDataBound="UserSettingsView_DataBound"> <HeaderTemplate> <div class="ch"> <h2> - User Settings</h2> + <asp:Label runat="server" ID="userSettingsTitle" Text="User Settings" /></h2> <div class="bottom"> </div> </div> @@ -42,7 +42,7 @@ <label> Automation:</label> <asp:CheckBox ID="automationCheckBox" runat="server" Checked='<%# Eval("automation") %>' - Enabled="false" /> + Enabled="false" CssClass="checkbox" /> </div> </div> <div class="end"> @@ -77,8 +77,8 @@ <div class="left"> <div class="item"> <label> - Roles:<br /> - <asp:Literal ID="roleTree" runat="server" OnInit="roleTree_Init"></asp:Literal></label></div> + Roles:</label> + <asp:Literal ID="roleTree" runat="server" OnInit="roleTreeView_Init" /></div> </div> <div class="end"> </div> @@ -132,7 +132,8 @@ <div class="item"> <label> Automation:</label> - <asp:CheckBox ID="automationBox" runat="server" Checked='<%# Bind("automation") %>' Enabled="true" /> + <asp:CheckBox ID="automationBox" runat="server" Checked='<%# Bind("automation") %>' + Enabled="true" CssClass="checkbox" /> </div> </div> <div class="end"> @@ -168,9 +169,11 @@ <div class="cm"> <div class="left"> <div class="item"> - <asp:TreeView ID="roleTree" runat="server" OnInit="roleTree_Init1" OnTreeNodePopulate="roleTree_TreeNodePopulate" ShowCheckBoxes="All" OnSelectedNodeChanged="roleTree_SelectedNodeChanged"> + <asp:TreeView ID="roleTree" runat="server" OnInit="roleTreeEdit_Init" OnTreeNodePopulate="roleTree_TreeNodePopulate" + ShowCheckBoxes="All" OnSelectedNodeChanged="roleTree_SelectedNodeChanged" > <Nodes> - <asp:TreeNode SelectAction="SelectExpand" ShowCheckBox="True" Text="<strong>Roles</strong>" Value="Roles" PopulateOnDemand="True"></asp:TreeNode> + <asp:TreeNode SelectAction="SelectExpand" Text="<label>Roles</label>" + Value="Roles" PopulateOnDemand="True" ShowCheckBox="false" /> </Nodes> </asp:TreeView> </div> @@ -204,77 +207,93 @@ <b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"> </b></b> <div class="xboxcontent"> - <table style="width: 700px"> - <tr> - <td colspan="2"> - <strong>username:</strong> + <div class="ct"> + <div class="left"> + <div class="item"> + <label> + User:</label> <asp:TextBox ID="usernameBox" runat="server" Text='<%# Bind("username") %>'></asp:TextBox> - <asp:Button ID="sync" runat="server" Text="Sync with AD" OnCommand="SyncWithAD" /></td> - </tr> - <tr> - <td class="hr" colspan="2"> - </td> - </tr> - <tr> - <td> - <strong>First Name: </strong> - <asp:TextBox ID="firstNameBox" runat="server" Text='<%# Bind("firstName") %>'></asp:TextBox></td> - <td> - <strong>Last Name:</strong> - <asp:TextBox ID="lastNameBox" runat="server" Text='<%# Bind("lastName") %>'></asp:TextBox></td> - </tr> - <tr> - <td colspan="2"> - <strong>Email Address:</strong> + </div> + <div class="item"> + <label> + Name: + </label> + <asp:TextBox ID="firstNameBox" runat="server" Text='<%# Bind("firstName") %>'></asp:TextBox> + <asp:TextBox ID="lastNameBox" runat="server" Text='<%# Bind("lastName") %>'></asp:TextBox> + </div> + <div class="item"> + <label> + Email:</label> <asp:TextBox ID="emailBox" runat="server" Text='<%# Bind("email") %>' Width="250"></asp:TextBox> - </td> - </tr> - <tr> - <td class="hr" colspan="2"> - </td> - </tr> - <tr> - <td colspan="2"> - <strong>Office Phone #:</strong> - <asp:TextBox ID="officePhoneBox" runat="server" Text='<%# Bind("officePhone") %>'> - </asp:TextBox><br /> - <strong>Home Phone #:</strong> - <asp:TextBox ID="homePhoneBox" runat="server" Text='<%# Bind("homePhone") %>'> - </asp:TextBox><br /> - <strong> Cell Phone #:</strong> - <asp:TextBox ID="cellPhoneBox" runat="server" Text='<%# Bind("cellPhone") %>'> - </asp:TextBox></td> - </tr> - <tr> - <td align="left" valign="top"> - <div class="item"> - <asp:TreeView ID="roleTree" runat="server" OnInit="roleTree_Init1" OnTreeNodePopulate="roleTree_TreeNodePopulate" ShowCheckBoxes="All" OnSelectedNodeChanged="roleTree_SelectedNodeChanged"> - <Nodes> - <asp:TreeNode SelectAction="SelectExpand" ShowCheckBox="True" Text="<strong>Roles</strong>" Value="Roles" PopulateOnDemand="True"></asp:TreeNode> - </Nodes> - </asp:TreeView> </div> - </td> - <td> - <asp:LinkButton ID="editConfig" runat="server" CommandName="editConfig" OnCommand="editConfig">Edit User Configuration Settings...</asp:LinkButton></td> - </tr> - <tr> - <td class="hr" colspan="2"> - </td> - </tr> - <tr> - <td> - <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" - Text="Insert"> - </asp:LinkButton> | - <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" - Text="Cancel"> - </asp:LinkButton></td> - <td> - <strong>Automation User: </strong> - <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("automation") %>' Enabled="true" /></td> - </tr> - </table> + <div class="item"> + <label> + Automation:</label> + <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("automation") %>' Enabled="true" + CssClass="checkbox" /> + </div> + </div> + <div class="end"> + </div> + <div class="hr"> + </div> + </div> + <div class="ct"> + <div class="left"> + <div class="item"> + <label> + Office #:</label> + <asp:TextBox ID="officePhoneBox" runat="server" Text='<%# Bind("officePhone") %>' /> + </div> + <div class="item"> + <label> + Home #:</label> + <asp:TextBox ID="homePhoneBox" runat="server" Text='<%# Bind("homePhone") %>' /> + </div> + <div class="item"> + <label> + Cell #:</label> + <asp:TextBox ID="cellPhoneBox" runat="server" Text='<%# Bind("cellPhone") %>' /> + </div> + </div> + <div class="end"> + </div> + <div class="hr"> + </div> + </div> + <div class="cm"> + <div class="left"> + <div class="item"> + <label> + Roles:<br /> + <asp:TreeView ID="roleTree" runat="server" OnInit="roleTreeEdit_Init" OnTreeNodePopulate="roleTree_TreeNodePopulate" + ShowCheckBoxes="All" OnSelectedNodeChanged="roleTree_SelectedNodeChanged"> + <Nodes> + <asp:TreeNode SelectAction="SelectExpand" Text="<label>Roles</label>" + Value="Roles" PopulateOnDemand="True" Selected="false" ShowCheckBox="false" /> + </Nodes> + </asp:TreeView> + </div> + </div> + <div class="end"> + </div> + <div class="hr"> + </div> + </div> + <div class="cb"> + <div class="left"> + <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" + Text="Add User" /> + | + <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" + Text="Cancel" /> | + <asp:LinkButton ID="sync" runat="server" Text="Sync with AD" OnCommand="SyncWithAD" /> + </div> + <div class="right"> + </div> + <div class="end"> + </div> + </div> </div> <b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"> </b></b> Modified: Website/Includes/UserSettings.ascx.cs =================================================================== --- Website/Includes/UserSettings.ascx.cs 2006-07-28 21:06:32 UTC (rev 233) +++ Website/Includes/UserSettings.ascx.cs 2006-07-28 21:19:34 UTC (rev 234) @@ -39,14 +39,14 @@ Session.Add("tableName", "tcdb_user"); if (mode == "new") - FormView1.ChangeMode(FormViewMode.Insert); + UserSettingsView.ChangeMode(FormViewMode.Insert); } protected void deleteButton_Load(object sender, EventArgs e) { if (mode == "read") { - LinkButton deleteButton = (LinkButton)FormView1.FindControl("New"); + LinkButton deleteButton = (LinkButton)UserSettingsView.FindControl("New"); deleteButton.Visible = false; } } @@ -55,7 +55,7 @@ { if (mode == "read") { - LinkButton deleteButton = (LinkButton)FormView1.FindControl("Delete"); + LinkButton deleteButton = (LinkButton)UserSettingsView.FindControl("Delete"); deleteButton.Visible = false; } } @@ -64,7 +64,7 @@ { if (mode == "read") { - Label deleteLabel = (Label)FormView1.FindControl("newLabel"); + Label deleteLabel = (Label)UserSettingsView.FindControl("newLabel"); deleteLabel.Visible = false; } } @@ -73,24 +73,24 @@ { if (mode == "read") { - Label deleteLabel = (Label)FormView1.FindControl("deleteLabel"); + Label deleteLabel = (Label)UserSettingsView.FindControl("deleteLabel"); deleteLabel.Visible = false; } } - protected void FormView1_ItemDeleted(object sender, FormViewDeletedEventArgs e) + protected void UserSettingsView_ItemDeleted(object sender, FormViewDeletedEventArgs e) { // Can only delete in Adminstration mode Response.Redirect("Administration.aspx"); } - protected void FormView1_ItemCommand(object sender, FormViewCommandEventArgs e) + protected void UserSettingsView_ItemCommand(object sender, FormViewCommandEventArgs e) { - if (FormView1.CurrentMode == FormViewMode.Insert && e.CommandName=="Cancel") + if (UserSettingsView.CurrentMode == FormViewMode.Insert && e.CommandName == "Cancel") Response.Redirect("Administration.aspx"); } - protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e) + protected void UserSettingsView_ItemInserted(object sender, FormViewInsertedEventArgs e) { if (e.Exception == null) { @@ -103,7 +103,7 @@ } } - protected void FormView1_ItemUpdated(object sender, FormViewUpdatedEventArgs e) + protected void UserSettingsView_ItemUpdated(object sender, FormViewUpdatedEventArgs e) { updateRoles(); if (mode == "read") @@ -120,7 +120,7 @@ { // TODO: If m_user.PASSWORD is "" or null, we must prompt for a password somehow // or the AD authentication will fail - String username = ((TextBox)FormView1.FindControl("usernameBox")).Text; + String username = ((TextBox)UserSettingsView.FindControl("usernameBox")).Text; String password = null; if (m_user.PASSWORD != "") password = m_user.PASSWORD; @@ -128,12 +128,12 @@ if (curUser.ID != -1) { - TextBox tbx_firstName = (TextBox)FormView1.FindControl("firstNameBox"); - TextBox tbx_lastName = (TextBox)FormView1.FindControl("lastNameBox"); - TextBox tbx_email = (TextBox)FormView1.FindControl("emailBox"); - TextBox tbx_officePhone = (TextBox)FormView1.FindControl("officePhoneBox"); - TextBox tbx_homePhone = (TextBox)FormView1.FindControl("homePhoneBox"); - TextBox tbx_cellPhone = (TextBox)FormView1.FindControl("cellPhoneBox"); + TextBox tbx_firstName = (TextBox)UserSettingsView.FindControl("firstNameBox"); + TextBox tbx_lastName = (TextBox)UserSettingsView.FindControl("lastNameBox"); + TextBox tbx_email = (TextBox)UserSettingsView.FindControl("emailBox"); + TextBox tbx_officePhone = (TextBox)UserSettingsView.FindControl("officePhoneBox"); + TextBox tbx_homePhone = (TextBox)UserSettingsView.FindControl("homePhoneBox"); + TextBox tbx_cellPhone = (TextBox)UserSettingsView.FindControl("cellPhoneBox"); tbx_firstName.Text = curUser.FIRSTNAME; tbx_lastName.Text = curUser.LASTNAME; @@ -151,18 +151,20 @@ else Response.Redirect("UserConfig.aspx?" + Constants.CODE_USER + "=" + userID); } - protected void FormView1_DataBound(object sender, EventArgs e) + + protected void UserSettingsView_DataBound(object sender, EventArgs e) { - if (FormView1.CurrentMode == FormViewMode.Edit) + if (UserSettingsView.CurrentMode == FormViewMode.Edit) { if (mode == "read") { - TextBox username = (TextBox)FormView1.FindControl("usernameBox"); + TextBox username = (TextBox)UserSettingsView.FindControl("usernameBox"); username.Enabled = false; } } } - protected void roleTree_Init(object sender, EventArgs e) + + protected void roleTreeView_Init(object sender, EventArgs e) { Literal roleTree = (Literal)sender; roleTree.ID = "roleTree"; @@ -207,6 +209,36 @@ roleTree.Text += "</ul>\n"; } + + protected void roleTreeEdit_Init(object sender, EventArgs e) + { + TreeView roleTree = (TreeView)sender; + + // Initialize Product Roles + if (Session["ProductRoles"] == null) + Session.Add("ProductRoles", new Dictionary<String, ArrayList>()); + Dictionary<String, ArrayList> ProductRoles = (Dictionary<String, ArrayList>)Session["ProductRoles"]; + ProductRoles.Clear(); + + // Get products + tcdbDataSetTableAdapters.db_productsTableAdapter pAdapter = new tcdbDataSetTableAdapters.db_productsTableAdapter(); + tcdbDataSet.db_productsDataTable pTable = pAdapter.GetData(null, null); + + foreach (tcdbDataSet.db_productsRow pRow in pTable) + { + // Get Roles + tcdbDataSetTableAdapters.db_roleUserProductTableAdapter rupAdapter = new tcdbDataSetTableAdapters.db_roleUserProductTableAdapter(); + tcdbDataSet.db_roleUserProductDataTable rupTable = rupAdapter.GetData(userID, pRow.productID, true); + ArrayList roles = new ArrayList(); + + foreach (tcdbDataSet.db_roleUserProductRow rupRow in rupTable) + roles.Add(rupRow.roleID.ToString()); + + if (roles.Count > 0) + ProductRoles[pRow.productID.ToString()] = roles; + } + } + protected void BuildProductList(TreeNode parent) { tcdbDataSetTableAdapters.db_productsTableAdapter pAdapter = new tcdbDataSetTableAdapters.db_productsTableAdapter(); @@ -215,19 +247,20 @@ foreach (tcdbDataSet.db_productsRow row in pTable) { TreeNode child = new TreeNode(); - child.Text = "<strong>" + row.name + "</strong>"; + child.Text = "<label>" + row.name + "</label>"; child.Value = row.productID.ToString(); child.SelectAction = TreeNodeSelectAction.SelectExpand; child.PopulateOnDemand = true; - child.ShowCheckBox = true; + child.ShowCheckBox = false; parent.ChildNodes.Add(child); } } + protected void BuildRoleList(TreeNode parent) { tcdbDataSetTableAdapters.db_roleTableAdapter rAdapter = new tcdbDataSetTableAdapters.db_roleTableAdapter(); - tcdbDataSet.db_roleDataTable rTable = rAdapter.GetData(null,null,true); + tcdbDataSet.db_roleDataTable rTable = rAdapter.GetData(null, null, true); Dictionary<String, ArrayList> ProductRoles = (Dictionary<String, ArrayList>)Session["ProductRoles"]; int numChecked = 0; @@ -238,12 +271,15 @@ child.Value = row.roleID.ToString(); child.SelectAction = TreeNodeSelectAction.Expand; child.ShowCheckBox = true; - if (ProductRoles.ContainsKey(parent.Value)) + if (UserSettingsView.CurrentMode == FormViewMode.Edit) { - if (ProductRoles[parent.Value].Contains(row.roleID.ToString())) + if (ProductRoles.ContainsKey(parent.Value)) { - child.Checked = true; - numChecked++; + if (ProductRoles[parent.Value].Contains(row.roleID.ToString())) + { + child.Checked = true; + numChecked++; + } } } @@ -252,6 +288,7 @@ parent.Checked = true; } } + protected void roleTree_TreeNodePopulate(object sender, TreeNodeEventArgs e) { switch (e.Node.Depth) @@ -266,41 +303,15 @@ break; } } - protected void roleTree_Init1(object sender, EventArgs e) - { - TreeView roleTree = (TreeView) sender; - // Initialize Product Roles - if (Session["ProductRoles"] == null) - Session.Add("ProductRoles", new Dictionary<String, ArrayList>()); - Dictionary<String, ArrayList> ProductRoles = (Dictionary<String, ArrayList>)Session["ProductRoles"]; - ProductRoles.Clear(); - - // Get products - tcdbDataSetTableAdapters.db_productsTableAdapter pAdapter = new tcdbDataSetTableAdapters.db_productsTableAdapter(); - tcdbDataSet.db_productsDataTable pTable = pAdapter.GetData(null, null); - - foreach (tcdbDataSet.db_productsRow pRow in pTable) - { - // Get Roles - tcdbDataSetTableAdapters.db_roleUserProductTableAdapter rupAdapter = new tcdbDataSetTableAdapters.db_roleUserProductTableAdapter(); - tcdbDataSet.db_roleUserProductDataTable rupTable = rupAdapter.GetData(userID, pRow.productID, true); - ArrayList roles = new ArrayList(); - - foreach (tcdbDataSet.db_roleUserProductRow rupRow in rupTable) - roles.Add(rupRow.roleID.ToString()); - - if (roles.Count > 0) - ProductRoles[pRow.productID.ToString()] = roles; - } - } protected void roleTree_TreeNodeCheckChanged(object sender, TreeNodeEventArgs e) { TreeNode node = (TreeNode)e.Node; Dictionary<String, ArrayList> ProductRoles = (Dictionary<String, ArrayList>)Session["ProductRoles"]; // update ProductUsers - if (node.Parent != null && node.Parent.Value != "Roles"){ + if (node.Parent != null && node.Parent.Value != "Roles") + { String product = node.Parent.Value; if (ProductRoles.ContainsKey(product)) { @@ -324,11 +335,12 @@ roleTree_TreeNodeCheckChanged(child, new TreeNodeEventArgs(child)); } } + protected void roleTree_SelectedNodeChanged(object sender, EventArgs e) { TreeView tree = (TreeView)sender; TreeNode node = tree.SelectedNode; - + node.Checked = (node.Checked == true) ? false : true; foreach (TreeNode child in node.ChildNodes) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |