From: <ro...@us...> - 2006-08-14 16:33:59
|
Revision: 313 Author: rouquin Date: 2006-08-14 09:33:49 -0700 (Mon, 14 Aug 2006) ViewCVS: http://svn.sourceforge.net/tcdb/?rev=313&view=rev Log Message: ----------- Fixed the disappearing control bug and got the assignment tree working again. Modified Paths: -------------- Website/ActionItem.aspx Website/App_Code/SiteUserControl.cs Website/App_Code/Users.cs Website/Includes/ActionItems.ascx Website/Includes/ActionItems.ascx.cs Website/Includes/Assignments.ascx Website/Includes/Assignments.ascx.cs Website/Includes/AssignmentsTree.ascx.cs Website/Includes/Header_Menu.ascx.cs Modified: Website/ActionItem.aspx =================================================================== --- Website/ActionItem.aspx 2006-08-11 21:59:39 UTC (rev 312) +++ Website/ActionItem.aspx 2006-08-14 16:33:49 UTC (rev 313) @@ -1,5 +1,4 @@ -<%@ Page Language="C#" MasterPageFile="~/TCDB.master" AutoEventWireup="true" Title="TCDB: Action Item" - ValidateRequest="false" %> +<%@ Page Language="C#" MasterPageFile="~/TCDB.master" AutoEventWireup="true" Title="TCDB: Action Item" ValidateRequest="false" %> <%@ Register Src="~/Includes/AssignmentsTree.ascx" TagPrefix="assignment" TagName="Tree" %> <%@ Register Src="~/Includes/ActionItems.ascx" TagPrefix="assignment" TagName="ActionItems" %> Modified: Website/App_Code/SiteUserControl.cs =================================================================== --- Website/App_Code/SiteUserControl.cs 2006-08-11 21:59:39 UTC (rev 312) +++ Website/App_Code/SiteUserControl.cs 2006-08-14 16:33:49 UTC (rev 313) @@ -37,6 +37,7 @@ catch (Exception ex) { m_logg.Debug("Unable to load session user information", ex); + m_user = new User(); } Logger.CreateLoggerDetails(m_user, Request); Modified: Website/App_Code/Users.cs =================================================================== --- Website/App_Code/Users.cs 2006-08-11 21:59:39 UTC (rev 312) +++ Website/App_Code/Users.cs 2006-08-14 16:33:49 UTC (rev 313) @@ -498,7 +498,7 @@ // Specified product if (!p_rights.ContainsKey(productID)) p_rights[productID] = RightDB.TCDB_GetUserRights(productID, p_id, true); - if (user.HasRights(productID) && p_rights[productID].Contains(right)) + if (user.HasRights(productID) && HasRight(right,productID)) return true; // Site rights? @@ -506,7 +506,7 @@ { if (!p_rights.ContainsKey(Constants.PRODUCT_SITEID)) p_rights[Constants.PRODUCT_SITEID] = RightDB.TCDB_GetUserRights(Constants.PRODUCT_SITEID, p_id, true); - if (user.HasRights(Constants.PRODUCT_SITEID) && p_rights[Constants.PRODUCT_SITEID].Contains(right)) + if (user.HasRights(Constants.PRODUCT_SITEID) && HasRight(right, Constants.PRODUCT_SITEID)) return true; } Modified: Website/Includes/ActionItems.ascx =================================================================== --- Website/Includes/ActionItems.ascx 2006-08-11 21:59:39 UTC (rev 312) +++ Website/Includes/ActionItems.ascx 2006-08-14 16:33:49 UTC (rev 313) @@ -219,8 +219,7 @@ </div> <div class="item"> <label> - Assigned To:</label><asp:DropDownList ID="assignedTo" runat="server" SelectedValue='<%# Bind("assignedID") %>' - OnInit="assignedTo_Init"> + Assigned To:</label><asp:DropDownList ID="assignedTo" runat="server" SelectedValue='<%# Bind("assignedID") %>' OnLoad="assignedTo_Load"> </asp:DropDownList> </div> </div> @@ -306,7 +305,7 @@ <div class="item"> <label> Assigned To:</label><asp:DropDownList ID="assignedTo" runat="server" SelectedValue='<%# Bind("assignedID") %>' - OnInit="assignedTo_Init"> + OnLoad="assignedTo_Load"> </asp:DropDownList></div> </div> <div class="end"> Modified: Website/Includes/ActionItems.ascx.cs =================================================================== --- Website/Includes/ActionItems.ascx.cs 2006-08-11 21:59:39 UTC (rev 312) +++ Website/Includes/ActionItems.ascx.cs 2006-08-14 16:33:49 UTC (rev 313) @@ -22,7 +22,7 @@ private static Logger m_logg = new Logger("TCDB.ActionItems"); private const string PREFIX = "AssignmentTab_"; private ActionItem ai; - private String item_id = ""; + private int item_id = 0; private int productID = 0; private String mode = ""; private bool current = false; @@ -38,14 +38,10 @@ { current = true; } - - if (productID == 0) - productID = Constants.PRODUCT_SITEID; - // Load session data try { - item_id = Session[PREFIX + Constants.CODE_AI].ToString(); + item_id = Convert.ToInt32(Session[PREFIX + Constants.CODE_AI]); } catch { } try @@ -57,10 +53,11 @@ { productID = Convert.ToInt32(Session[PREFIX + Constants.CODE_PRODUCT]); } - catch { } + catch { productID = Constants.PRODUCT_SITEID; } + m_logg.Debug("Loading page ActionItems"); - if (item_id == null) + if (item_id == 0) { m_logg.Debug("Unable to locate action item ID in query string"); if (mode != "new") @@ -87,9 +84,12 @@ } } - Session.Add(PREFIX + "item_id", item_id); - Session.Add(PREFIX + "productID", productID); - Session.Add(PREFIX + "tableName", "tcdb_actionItem"); + if (item_id == 0) + Session[PREFIX + "item_id"] = null; + else + Session[PREFIX + "item_id"] = item_id; + Session[PREFIX + "productID"] = productID; + Session[PREFIX + "tableName"] = "tcdb_actionItem"; if (mode == "new" && (m_user.HasRight(Constants.RIGHTS_AI_CREATE_MY) || m_user.HasRight(Constants.RIGHTS_AI_CREATE_OTHER))) ActionItemsView.ChangeMode(FormViewMode.Insert); @@ -101,7 +101,7 @@ DropDownList statusList = (DropDownList)ActionItemsView.FindControl("statusList"); Object dateFinished = ActionItemsView.FindControl("dateFinished"); Nullable<DateTime> date; - int id = Convert.ToInt32(item_id); + int id = item_id; if (ActionItemsView.CurrentMode == FormViewMode.ReadOnly) { @@ -359,7 +359,7 @@ protected void deleteItem(object sender, CommandEventArgs e) { tcdbDataSetTableAdapters.db_actionItemsTableAdapter aiAdapter = new tcdbDataSetTableAdapters.db_actionItemsTableAdapter(); - aiAdapter.Delete(Convert.ToInt32(item_id), 0); + aiAdapter.Delete(item_id, 0); Response.Redirect("Assignments.aspx?" + Constants.CODE_USER + "=" + m_user.ID); } protected void ActionItemsView_ItemInserted(object sender, FormViewInsertedEventArgs e) @@ -393,14 +393,15 @@ } protected void ActionItemsView_ItemUpdated(object sender, FormViewUpdatedEventArgs e) { - updateStatus(); - Response.Redirect("ActionItem.aspx?" + Constants.CODE_AI + "=" + item_id.ToString()); + if (e.Exception != null) + { + updateStatus(); + Response.Redirect("ActionItem.aspx?" + Constants.CODE_AI + "=" + item_id); + } } protected void statusList_Init(object sender, EventArgs e) { - if (!current) return; - DropDownList statusList = (DropDownList)sender; if (ai != null && @@ -411,8 +412,6 @@ } protected void percentList_Init(object sender, EventArgs e) { - if (!current) return; - RadioButtonList percentList = (RadioButtonList)sender; if (ai != null && @@ -423,8 +422,6 @@ } protected void dateFinished_Init(object sender, EventArgs e) { - if (!current) return; - CalendarPopup dateFinished = (CalendarPopup)sender; if (ai != null && @@ -435,8 +432,6 @@ } protected void NewButton_Init(object sender, EventArgs e) { - if (!current) return; - LinkButton newBtn = (LinkButton)sender; Label newLbl = (Label)ActionItemsView.FindControl("newLbl"); @@ -449,8 +444,6 @@ } protected void EditButton_Init(object sender, EventArgs e) { - if (!current) return; - LinkButton editBtn = (LinkButton)sender; if (ai != null && @@ -461,8 +454,6 @@ } protected void DeleteButton_Init(object sender, EventArgs e) { - if (!current) return; - LinkButton deleteBtn = (LinkButton)sender; Label deleteLbl = (Label)ActionItemsView.FindControl("deleteLbl"); Label deletedLbl = (Label)ActionItemsView.FindControl("deletedLbl"); @@ -476,12 +467,10 @@ deleteLbl.Visible = false; } } - protected void assignedTo_Init(object sender, EventArgs e) + protected void assignedTo_Load(object sender, EventArgs e) { - if (!current) return; - DropDownList assignedTo = (DropDownList)sender; - if (ai == null) ai = ActionItemDB.GetActionItem(Convert.ToInt32(item_id), active); + if (ai == null) ai = ActionItemDB.GetActionItem(item_id, active); if (!(ActionItemsView.CurrentMode == FormViewMode.Insert && m_user.HasRight(Constants.RIGHTS_AI_CREATE_OTHER, Constants.PRODUCT_ANYID)) && !(ActionItemsView.CurrentMode == FormViewMode.Edit && m_user.HasRight(Constants.RIGHTS_AI_REASSIGN_OTHER, ai.CREATOR, Constants.PRODUCT_ANYID))) @@ -522,8 +511,6 @@ } protected void activeBox_Init(object sender, EventArgs e) { - if (!current) return; - CheckBox activeBox = (CheckBox)sender; Label deletedLbl = (Label)ActionItemsView.FindControl("deletedLbl"); @@ -539,7 +526,7 @@ int deleted = (activeBox.Checked) ? 0 : 1; tcdbDataSetTableAdapters.db_actionItemsTableAdapter aiAdapter = new tcdbDataSetTableAdapters.db_actionItemsTableAdapter(); - aiAdapter.Delete(Convert.ToInt32(item_id), deleted); + aiAdapter.Delete(item_id, deleted); if (ActionItemsView.CurrentMode != FormViewMode.Edit) Response.Redirect(Request.RawUrl); Modified: Website/Includes/Assignments.ascx =================================================================== --- Website/Includes/Assignments.ascx 2006-08-11 21:59:39 UTC (rev 312) +++ Website/Includes/Assignments.ascx 2006-08-14 16:33:49 UTC (rev 313) @@ -11,7 +11,7 @@ <asp:SessionParameter Name="assignedID" SessionField="AssignmentTree_u" Type="Int32" /> <asp:SessionParameter Name="creatorID" SessionField="AssignmentTab_myID" Type="Int32" /> <asp:Parameter Name="highPriority" Type="Boolean" /> - <asp:SessionParameter DefaultValue="" Name="active" SessionField="AssignmentTab_active" Type="Boolean" /> + <asp:SessionParameter DefaultValue="" Name="active" SessionField="active" Type="Boolean" /> </SelectParameters> </asp:ObjectDataSource> <div id="Assignments"> Modified: Website/Includes/Assignments.ascx.cs =================================================================== --- Website/Includes/Assignments.ascx.cs 2006-08-11 21:59:39 UTC (rev 312) +++ Website/Includes/Assignments.ascx.cs 2006-08-14 16:33:49 UTC (rev 313) @@ -80,14 +80,16 @@ { Product product = ProductDB.GetProduct(true, Convert.ToInt32(productID), null); - if (product != null) + if (product.ID != 0) { - m_logg.Debug("User has product admin rights, display all product users"); - - // Admin user should get everything, so don't set any values! Page.Title = "TCDB: " + product.NAME + " Assignments"; header.Text = product.NAME + " Assignments"; } + else + { + Page.Title = "TCDB: All Assignments"; + header.Text = "All Assignments"; + } } } else @@ -130,13 +132,18 @@ } } + // Set session filters + if (uid != 0) + Session[PREFIX_TREE + Constants.CODE_USER] = uid; + else + Session[PREFIX_TREE + Constants.CODE_USER] = null; if (mode == Constants.CODE_CREATED) Session[PREFIX + "myID"] = m_user.ID; - - if (uid != 0) - Session.Add(PREFIX_TREE + Constants.CODE_USER, uid); else - Session.Remove(PREFIX_TREE + Constants.CODE_USER); + Session[PREFIX + "myID"] = null; + + + // init gridview m_logg.Debug("Databinding the AssignmentsGridView"); if (Session[PREFIX + "refresh"] != null) AssignmentsGridView.DataBind(); @@ -661,8 +668,6 @@ protected void toDate_Init(object sender, EventArgs e) { - if (!current) return; - if (!IsPostBack) { if (Session[PREFIX + "toDate"] == null) @@ -676,8 +681,6 @@ } protected void toDueDate_Init(object sender, EventArgs e) { - if (!current) return; - if (!IsPostBack) { if (Session[PREFIX + "toDueDate"] == null) @@ -691,8 +694,6 @@ } protected void toFinishedDate_Init(object sender, EventArgs e) { - if (!current) return; - if (!IsPostBack) { if (Session[PREFIX + "toFinishedDate"] == null) @@ -706,8 +707,6 @@ } protected void fromDate_Init(object sender, EventArgs e) { - if (!current) return; - if (!IsPostBack) { if (Session[PREFIX + "fromDate"] == null) @@ -721,8 +720,6 @@ } protected void fromDueDate_Init(object sender, EventArgs e) { - if (!current) return; - if (!IsPostBack) { if (Session[PREFIX + "fromDueDate"] == null) @@ -736,8 +733,6 @@ } protected void fromFinishedDate_Init(object sender, EventArgs e) { - if (!current) return; - if (!IsPostBack) { if (Session[PREFIX + "fromFinishedDate"] == null) @@ -751,8 +746,6 @@ } protected void cboShowActionItems_Init(object sender, EventArgs e) { - if (!current) return; - if (Session[PREFIX + "showActionItems"] == null) { cboShowActionItems.Checked = m_user.GetConfigBool("filter_show_action_items"); @@ -763,8 +756,6 @@ } protected void cboShowWorkOrders_Init(object sender, EventArgs e) { - if (!current) return; - if (Session[PREFIX + "showWorkOrders"] == null) { cboShowWorkOrders.Checked = m_user.GetConfigBool("filter_show_work_orders"); @@ -775,20 +766,16 @@ } protected void cboHighPriority_Init(object sender, EventArgs e) { - if (!current) return; - if (Session[PREFIX + "showHighPriority"] == null) { cboHighPriority.Checked = m_user.GetConfigBool("filter_show_high_priority"); - Session[PREFIX + "showHightPriority"] = cboHighPriority.Checked; + Session[PREFIX + "showHighPriority"] = cboHighPriority.Checked; } else cboHighPriority.Checked = Convert.ToBoolean(Session[PREFIX + "showHighPriority"]); } protected void cboLowPriority_Init(object sender, EventArgs e) { - if (!current) return; - if (Session[PREFIX + "showLowPriority"] == null) { cboLowPriority.Checked = m_user.GetConfigBool("filter_show_low_priority"); @@ -799,8 +786,6 @@ } protected void cboStatusFilter_Init(object sender, EventArgs e) { - if (!current) return; - if (Session[PREFIX + "filterStatus"] == null) { cboStatusFilter.Checked = m_user.GetConfigBool("filter_enable_status_filter"); @@ -811,8 +796,6 @@ } protected void cboDateFilter_Init(object sender, EventArgs e) { - if (!current) return; - if (Session[PREFIX + "filterAssignedDate"] == null) { cboDateFilter.Checked = m_user.GetConfigBool("filter_enable_assigned_date_filter"); @@ -823,8 +806,6 @@ } protected void cboDueFilter_Init(object sender, EventArgs e) { - if (!current) return; - if (Session[PREFIX + "filterDueDate"] == null) { cboDueFilter.Checked = m_user.GetConfigBool("filter_enable_due_date_filter"); @@ -835,8 +816,6 @@ } protected void cboFinishedFilter_Init(object sender, EventArgs e) { - if (!current) return; - if (Session[PREFIX + "filterFinishedDate"] == null) { cboFinishedFilter.Checked = m_user.GetConfigBool("filter_enable_finished_date_filter"); @@ -847,8 +826,6 @@ } protected void cboTypeFilter_Init(object sender, EventArgs e) { - if (!current) return; - if (Session[PREFIX + "filterType"] == null) { cboTypeFilter.Checked = m_user.GetConfigBool("filter_enable_type_filter"); @@ -859,8 +836,6 @@ } protected void cboPriorityFilter_Init(object sender, EventArgs e) { - if (!current) return; - if (Session[PREFIX + "filterPriority"] == null) { cboPriorityFilter.Checked = m_user.GetConfigBool("filter_enable_priority_filter"); @@ -871,8 +846,6 @@ } protected void cboShowCompleted_Init(object sender, EventArgs e) { - if (!current) return; - if (Session[PREFIX + "showCompleted"] == null) { cboShowCompleted.Checked = (m_user.GetConfigBool("filter_show_ai_completed") && m_user.GetConfigBool("filter_show_wo_completed")); @@ -885,8 +858,6 @@ } protected void newActionItem_Init(object sender, EventArgs e) { - if (!current) return; - LinkButton newAI = (LinkButton)sender; if (!m_user.HasRight(Constants.RIGHTS_AI_CREATE_MY, Constants.PRODUCT_ANYID) && !m_user.HasRight(Constants.RIGHTS_AI_CREATE_OTHER, Constants.PRODUCT_ANYID)) @@ -894,8 +865,6 @@ } protected void newWorkOrder_Init(object sender, EventArgs e) { - if (!current) return; - LinkButton newWorkOrder = (LinkButton)sender; if (!m_user.HasRight(Constants.RIGHTS_DEV_ACCESS)) Modified: Website/Includes/AssignmentsTree.ascx.cs =================================================================== --- Website/Includes/AssignmentsTree.ascx.cs 2006-08-11 21:59:39 UTC (rev 312) +++ Website/Includes/AssignmentsTree.ascx.cs 2006-08-14 16:33:49 UTC (rev 313) @@ -86,29 +86,31 @@ Session[PREFIX_TAB + "Name"] = Constants.CODE_ASSIGNMENT; Response.Redirect("~/Assignments.aspx"); break; - case Constants.CODE_USER: - Session[PREFIX + Constants.CODE_USER] = nodeValue; - Session[PREFIX + Constants.CODE_PRODUCT] = Help.Tree_GetValue(node.Parent, Constants.CODE_VALUE); + case Constants.CODE_USER: try { if (bool.Parse(Help.Tree_GetValue(node, Constants.CODE_CREATED))) { + Session[PREFIX + Constants.CODE_USER] = nodeValue; Session[PREFIX + Constants.CODE_MODE] = Constants.CODE_CREATED; Session[PREFIX + Constants.CODE_PRODUCT] = Constants.PRODUCT_ANYID; } - else - { - Session.Remove(PREFIX + Constants.CODE_MODE); - } } - catch { } + catch + { + Session[PREFIX + Constants.CODE_USER] = nodeValue; + Session[PREFIX + Constants.CODE_PRODUCT] = Help.Tree_GetValue(node.Parent, Constants.CODE_VALUE); + Session[PREFIX + Constants.CODE_MODE] = null; + } Session[PREFIX_TAB + "Name"] = Constants.CODE_ASSIGNMENT; Response.Redirect("~/Assignments.aspx"); break; case Constants.CODE_CREATED: + Session[PREFIX + Constants.CODE_USER] = null; Session[PREFIX + Constants.CODE_MODE] = Constants.CODE_CREATED; + Session[PREFIX + Constants.CODE_PRODUCT] = Constants.PRODUCT_ANYID; + Session[PREFIX_TAB + "Name"] = Constants.CODE_ASSIGNMENT; - Session.Remove(PREFIX + Constants.CODE_USER); Response.Redirect("~/Assignments.aspx"); break; case Constants.CODE_AI: Modified: Website/Includes/Header_Menu.ascx.cs =================================================================== --- Website/Includes/Header_Menu.ascx.cs 2006-08-11 21:59:39 UTC (rev 312) +++ Website/Includes/Header_Menu.ascx.cs 2006-08-14 16:33:49 UTC (rev 313) @@ -21,7 +21,12 @@ protected void LoadAssignments(object sender, CommandEventArgs e) { + string PREFIX_TREE = "AssignmentTree_"; Session["AssignmentTab_Name"] = Constants.CODE_ASSIGNMENT; + + Session[PREFIX_TREE + Constants.CODE_USER] = m_user.ID; + Session[PREFIX_TREE + Constants.CODE_MODE] = null; + Session[PREFIX_TREE + Constants.CODE_PRODUCT] = null; Response.Redirect("~/Assignments.aspx"); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |