From: <ro...@us...> - 2006-08-02 21:42:37
|
Revision: 265 Author: rouquin Date: 2006-08-02 14:42:32 -0700 (Wed, 02 Aug 2006) ViewCVS: http://svn.sourceforge.net/tcdb/?rev=265&view=rev Log Message: ----------- Fixed Assignments page viewing rights. Also made it remember settings a little better. There is still some issues on remembering though. Modified Paths: -------------- Website/Includes/ActionItems.ascx.cs Website/Includes/Assignments.ascx Website/Includes/Assignments.ascx.cs Modified: Website/Includes/ActionItems.ascx.cs =================================================================== --- Website/Includes/ActionItems.ascx.cs 2006-08-02 20:51:06 UTC (rev 264) +++ Website/Includes/ActionItems.ascx.cs 2006-08-02 21:42:32 UTC (rev 265) @@ -91,6 +91,7 @@ ActionItemDB.SendUpdatedActionItemMail(id, m_user); else ActionItemDB.SendCompletedActionItemMail(id, m_user); + Response.Redirect(Request.RawUrl); } Modified: Website/Includes/Assignments.ascx =================================================================== --- Website/Includes/Assignments.ascx 2006-08-02 20:51:06 UTC (rev 264) +++ Website/Includes/Assignments.ascx 2006-08-02 21:42:32 UTC (rev 265) @@ -29,7 +29,7 @@ </div> <div class="quickFilter"> <asp:CheckBox ID="cboShowCompleted" runat="server" Text="Show Completed" TextAlign="Left" - AutoPostBack="true" OnCheckedChanged="cboShowCompleted_CheckedChanged" /> + AutoPostBack="true" OnCheckedChanged="cboShowCompleted_CheckedChanged" OnInit="cboShowCompleted_Init" /> </div> </div> <div class="end"> @@ -287,10 +287,10 @@ <div class="alignmiddle"> <div class="item"> <asp:CheckBox ID="cboShowActionItems" runat="server" Checked="true" AutoPostBack="True" - OnCheckedChanged="update" OnInit="cboShowActionItems_Init" />Action Items</div> + OnCheckedChanged="cboShowActionItems_CheckedChanged" OnInit="cboShowActionItems_Init" />Action Items</div> <div class="item"> <asp:CheckBox ID="cboShowWorkOrders" runat="server" Checked="true" AutoPostBack="True" - OnCheckedChanged="update" OnInit="cboShowWorkOrders_Init" />Work Orders</div> + OnCheckedChanged="cboShowWorkOrders_CheckedChanged" OnInit="cboShowWorkOrders_Init" />Work Orders</div> </div> </div> </div> @@ -317,10 +317,10 @@ <div class="cm"> <div class="alignmiddle"> <div class="item"> - <asp:CheckBox ID="cboHighPriority" runat="server" Checked="True" OnCheckedChanged="update" + <asp:CheckBox ID="cboHighPriority" runat="server" Checked="True" OnCheckedChanged="cboHighPriority_CheckedChanged" AutoPostBack="True" OnInit="cboHighPriority_Init" />High</div> <div class="item"> - <asp:CheckBox ID="cboLowPriority" runat="server" Checked="true" OnCheckedChanged="update" + <asp:CheckBox ID="cboLowPriority" runat="server" Checked="true" OnCheckedChanged="cboLowPriority_CheckedChanged" AutoPostBack="True" OnInit="cboLowPriority_Init" />Low</div> </div> </div> Modified: Website/Includes/Assignments.ascx.cs =================================================================== --- Website/Includes/Assignments.ascx.cs 2006-08-02 20:51:06 UTC (rev 264) +++ Website/Includes/Assignments.ascx.cs 2006-08-02 21:42:32 UTC (rev 265) @@ -13,6 +13,7 @@ using TCDB.Common; using TCDB.Users; using TCDB.Products; +using eWorld.UI; using log4net; /// <summary> @@ -122,14 +123,15 @@ // action item exists if (ai != null && - // I don't have rights to see other users' Action Items - (!m_user.HasRight("view_other_ai",productID) && + // It's not mine, the assignee doesn't belong to this product group, or I don't have rights to see other users' Action Items + !(ai.ASSIGNED.ID != m_user.ID && ai.ASSIGNED.HasRights(productID) && m_user.HasRight("view_other_ai",productID)) && - // It's not mine, I don't have any product rights, or I can't view my own - !(ai.ASSIGNED.ID == m_user.ID && m_user.HasRights(productID) && m_user.HasRight("view_my_ai", productID)) && + // It's not mine, I don't have any product rights, or I can't view my own + !(ai.ASSIGNED.ID == m_user.ID && m_user.HasRights(productID) && m_user.HasRight("view_my_ai", productID)) && - // It mine, I didn't create it, or I don't have rights to look at it - !(ai.ASSIGNED.ID != m_user.ID && ai.CREATOR.ID == m_user.ID && m_user.HasRight("view_created_ai",productID)))) + // It's mine, the assignee doesn't belong to this product group, I didn't create it, or I don't have rights to look at it + !(ai.ASSIGNED.ID != m_user.ID && ai.ASSIGNED.HasRights(productID) && ai.CREATOR.ID == m_user.ID && m_user.HasRight("view_created_ai",productID)) + ) return false; if (!cboShowActionItems.Checked) @@ -138,11 +140,19 @@ else if (type == Constants.CODE_WO) { WorkOrder wo = WorkOrderDB.TCDB_GetWorkOrder(cid); - - if (wo != null && - (!m_user.HasRight("view_other_wo",productID) && - !(wo.ASSIGNED.ID == m_user.ID && m_user.HasRight("view_my_wo", productID)) && - !(wo.CREATOR.ID == m_user.ID && m_user.HasRight("view_created_wo",productID)))) + + // work order exists + if (wo != null && + + // It's not mine, the assignee doesn't belong to this product group, or I don't have rights to see other users' work orders + !(wo.ASSIGNED.ID != m_user.ID && wo.ASSIGNED.HasRights(productID) && m_user.HasRight("view_other_wo", productID)) && + + // It's not mine, I don't have any product rights, or I can't view my own + !(wo.ASSIGNED.ID == m_user.ID && m_user.HasRights(productID) && m_user.HasRight("view_my_wo", productID)) && + + // It's mine, the assignee doesn't belong to this product group, I didn't create it, or I don't have rights to look at it + !(wo.ASSIGNED.ID != m_user.ID && wo.ASSIGNED.HasRights(productID) && wo.CREATOR.ID == m_user.ID && m_user.HasRight("view_created_wo", productID)) + ) return false; if (!cboShowWorkOrders.Checked) @@ -241,7 +251,23 @@ } protected void update(object sender, EventArgs e) { - Session.Add("refresh", true); + CalendarPopup date = (CalendarPopup)sender; + + // update Session + if (date.ID == "toDate") + Session["toDate"] = date.SelectedDate; + else if (date.ID == "fromDate") + Session["fromDate"] = date.SelectedDate; + else if (date.ID == "toDueDate") + Session["toDueDate"] = date.SelectedDate; + else if (date.ID == "fromDueDate") + Session["fromDueDate"] = date.SelectedDate; + else if (date.ID == "toFinishedDate") + Session["toFinishedDate"] = date.SelectedDate; + else if (date.ID == "fromFinishedDate") + Session["fromFinishedDate"] = date.SelectedDate; + + Session.Add("refresh", true); AssignmentsGridView.DataBind(); } protected String getURL(int cid, String type, String name) @@ -318,6 +344,11 @@ aiStatusList.Items.FindByText("Completed").Selected = false; woStatusList.Items.FindByText("Completed").Selected = false; } + // update Session + Session["showCompleted"] = cboShowCompleted.Checked; + Session["showAICompleted"] = aiStatusList.Items.FindByText("Completed").Selected; + Session["showWOCompleted"] = woStatusList.Items.FindByText("Completed").Selected = true; + Session.Add("refresh", true); AssignmentsGridView.DataBind(); } @@ -333,6 +364,8 @@ aiStatusList.Enabled = false; woStatusList.Enabled = false; } + Session["filterStatus"] = cboStatusFilter.Checked; + Session.Add("refresh", true); AssignmentsGridView.DataBind(); } @@ -342,6 +375,14 @@ cboShowCompleted.Checked = true; else cboShowCompleted.Checked = false; + + // update Session + Session["showAIActive"] = aiStatusList.Items.FindByText("Active").Selected; + Session["showAIInactive"] = aiStatusList.Items.FindByText("Inactive").Selected; + Session["showAINotStarted"] = aiStatusList.Items.FindByText("Not Started").Selected; + Session["showAICompleted"] = aiStatusList.Items.FindByText("Completed").Selected; + Session["showCompleted"] = cboShowCompleted.Checked; + Session.Add("refresh", true); AssignmentsGridView.DataBind(); } @@ -351,6 +392,13 @@ cboShowCompleted.Checked = true; else cboShowCompleted.Checked = false; + // update Session + Session["showWOActive"] = woStatusList.Items.FindByText("Active").Selected; + Session["showWOInactive"] = woStatusList.Items.FindByText("Inactive").Selected; + Session["showWONotStarted"] = woStatusList.Items.FindByText("Not Started").Selected; + Session["showWOCompleted"] = woStatusList.Items.FindByText("Completed").Selected; + Session["showCompleted"] = cboShowCompleted.Checked; + Session.Add("refresh", true); AssignmentsGridView.DataBind(); } @@ -366,16 +414,24 @@ cboShowActionItems.Enabled = false; cboShowWorkOrders.Enabled = false; } + Session["filterType"] = cboTypeFilter.Checked; + Session["showActionItems"] = cboShowActionItems.Checked; + Session["showWorkOrders"] = cboShowWorkOrders.Checked; + Session.Add("refresh", true); AssignmentsGridView.DataBind(); } protected void cboShowActionItems_CheckedChanged(object sender, EventArgs e) { + Session["showActionItems"] = cboShowActionItems.Checked; + Session.Add("refresh", true); AssignmentsGridView.DataBind(); } protected void cboShowWorkOrders_CheckedChanged(object sender, EventArgs e) { + Session["showWorkOrders"] = cboShowWorkOrders.Checked; + Session.Add("refresh", true); AssignmentsGridView.DataBind(); } @@ -391,6 +447,8 @@ toDate.Enabled = false; fromDate.Enabled = false; } + Session["filterAssignedDate"] = cboDateFilter.Checked; + Session.Add("refresh", true); AssignmentsGridView.DataBind(); } @@ -406,6 +464,8 @@ toDueDate.Enabled = false; fromDueDate.Enabled = false; } + Session["filterDueDate"] = cboDueFilter.Checked; + Session.Add("refresh", true); AssignmentsGridView.DataBind(); } @@ -421,6 +481,8 @@ toFinishedDate.Enabled = false; fromFinishedDate.Enabled = false; } + Session["filterFinishedDate"] = cboFinishedFilter.Checked; + Session.Add("refresh", true); AssignmentsGridView.DataBind(); } @@ -436,16 +498,22 @@ cboHighPriority.Enabled = false; cboLowPriority.Enabled = false; } + Session["filterPriority"] = cboPriorityFilter.Checked; + Session.Add("refresh", true); AssignmentsGridView.DataBind(); } protected void cboHighPriority_CheckedChanged(object sender, EventArgs e) { + Session["showHighPriority"] = cboPriorityFilter.Checked; + Session.Add("refresh", true); AssignmentsGridView.DataBind(); } protected void cboLowPriority_CheckedChanged(object sender, EventArgs e) { + Session["showLowPriority"] = cboPriorityFilter.Checked; + Session.Add("refresh", true); AssignmentsGridView.DataBind(); } @@ -454,14 +522,34 @@ { if (!IsPostBack) { - if (m_user.GetConfigBool("filter_show_ai_active")) - aiStatusList.Items.FindByText("Active").Selected = true; - if (m_user.GetConfigBool("filter_show_ai_inactive")) - aiStatusList.Items.FindByText("Inactive").Selected = true; - if (m_user.GetConfigBool("filter_show_ai_complete")) - aiStatusList.Items.FindByText("Completed").Selected = true; - if (m_user.GetConfigBool("filter_show_ai_not_started")) - aiStatusList.Items.FindByText("Not Started").Selected = true; + if (Session["showAIActive"] == null) + { + aiStatusList.Items.FindByText("Active").Selected = m_user.GetConfigBool("filter_show_ai_active"); + Session["showAIActive"] = aiStatusList.Items.FindByText("Active").Selected; + } + else + aiStatusList.Items.FindByText("Active").Selected = Convert.ToBoolean(Session["showAIActive"]); + if (Session["showAIInactive"] == null) + { + aiStatusList.Items.FindByText("Inactive").Selected = m_user.GetConfigBool("filter_show_ai_inactive"); + Session["showAIInactive"] = aiStatusList.Items.FindByText("Inactive").Selected; + } + else + aiStatusList.Items.FindByText("Inactive").Selected = Convert.ToBoolean(Session["showAIInactive"]); + if (Session["showAICompleted"] == null) + { + aiStatusList.Items.FindByText("Completed").Selected = m_user.GetConfigBool("filter_show_ai_complete"); + Session["showAICompleted"] = aiStatusList.Items.FindByText("Completed").Selected; + } + else + aiStatusList.Items.FindByText("Completed").Selected = Convert.ToBoolean(Session["showAIComplete"]); + if (Session["showAINotStarted"] == null) + { + aiStatusList.Items.FindByText("Not Started").Selected = m_user.GetConfigBool("filter_show_ai_not_started"); + Session["showAINotStarted"] = aiStatusList.Items.FindByText("Not Started").Selected; + } + else + aiStatusList.Items.FindByText("Not Started").Selected = Convert.ToBoolean(Session["showAINotStarted"]); if (Session["refresh"] != null) AssignmentsGridView.DataBind(); @@ -473,14 +561,34 @@ { if (!IsPostBack) { - if (m_user.GetConfigBool("filter_show_wo_active")) - woStatusList.Items.FindByText("Active").Selected = true; - if (m_user.GetConfigBool("filter_show_wo_inactive")) - woStatusList.Items.FindByText("Inactive").Selected = true; - if (m_user.GetConfigBool("filter_show_wo_complete")) - woStatusList.Items.FindByText("Completed").Selected = true; - if (m_user.GetConfigBool("filter_show_wo_not_started")) - woStatusList.Items.FindByText("Not Started").Selected = true; + if (Session["showWOActive"] == null) + { + woStatusList.Items.FindByText("Active").Selected = m_user.GetConfigBool("filter_show_wo_active"); + Session["showWOActive"] = woStatusList.Items.FindByText("Active").Selected; + } + else + woStatusList.Items.FindByText("Active").Selected = Convert.ToBoolean(Session["showWOActive"]); + if (Session["showWOInactive"] == null) + { + woStatusList.Items.FindByText("Inactive").Selected = m_user.GetConfigBool("filter_show_wo_inactive"); + Session["showWOInactive"] = woStatusList.Items.FindByText("Inactive").Selected; + } + else + woStatusList.Items.FindByText("Inactive").Selected = Convert.ToBoolean(Session["showWOInactive"]); + if (Session["showWOCompleted"] == null) + { + woStatusList.Items.FindByText("Completed").Selected = m_user.GetConfigBool("filter_show_wo_complete"); + Session["showWOCompleted"] = woStatusList.Items.FindByText("Completed").Selected; + } + else + woStatusList.Items.FindByText("Completed").Selected = Convert.ToBoolean(Session["showWOComplete"]); + if (Session["showWONotStarted"] == null) + { + woStatusList.Items.FindByText("Not Started").Selected = m_user.GetConfigBool("filter_show_wo_not_started"); + Session["showWONotStarted"] = woStatusList.Items.FindByText("Not Started").Selected; + } + else + woStatusList.Items.FindByText("Not Started").Selected = Convert.ToBoolean(Session["showWONotStarted"]); if (Session["refresh"] != null) AssignmentsGridView.DataBind(); @@ -491,84 +599,176 @@ protected void toDate_Init(object sender, EventArgs e) { - if (!IsPostBack) + if (Session["toDate"] == null) + { toDate.SelectedDate = m_user.GetConfigDate("filter_show_to_assigned_date"); + Session["toDate"] = toDate.SelectedDate; + } + else + toDate.SelectedDate = Convert.ToDateTime(Session["toDate"]); } protected void toDueDate_Init(object sender, EventArgs e) { - if (!IsPostBack) + if (Session["toDueDate"] == null) + { toDueDate.SelectedDate = m_user.GetConfigDate("filter_show_to_due_date"); + Session["toDueDate"] = toDueDate.SelectedDate; + } + else + toDueDate.SelectedDate = Convert.ToDateTime(Session["toDueDate"]); } protected void toFinishedDate_Init(object sender, EventArgs e) { - if (!IsPostBack) + if (Session["toFinishedDate"] == null) + { toFinishedDate.SelectedDate = m_user.GetConfigDate("filter_show_to_finished_dates"); + Session["toFinishedDate"] = toFinishedDate.SelectedDate; + } + else + toFinishedDate.SelectedDate = Convert.ToDateTime(Session["toFinishedDate"]); } protected void fromDate_Init(object sender, EventArgs e) { - if (!IsPostBack) + if (Session["fromDate"] == null) + { fromDate.SelectedDate = m_user.GetConfigDate("filter_show_from_assigned_date"); + Session["fromDate"] = fromDate.SelectedDate; + } + else + fromDate.SelectedDate = Convert.ToDateTime(Session["fromDate"]); } protected void fromDueDate_Init(object sender, EventArgs e) { - if (!IsPostBack) + if (Session["fromDueDate"] == null) + { fromDueDate.SelectedDate = m_user.GetConfigDate("filter_show_from_due_date"); + Session["fromDueDate"] = fromDueDate.SelectedDate; + } + else + fromDueDate.SelectedDate = Convert.ToDateTime(Session["fromDueDate"]); } protected void fromFinishedDate_Init(object sender, EventArgs e) { - if (!IsPostBack) + if (Session["fromFinishedDate"] == null) + { fromFinishedDate.SelectedDate = m_user.GetConfigDate("filter_show_from_finished_date"); + Session["fromFinishedDate"] = fromFinishedDate.SelectedDate; + } + else + fromFinishedDate.SelectedDate = Convert.ToDateTime(Session["fromFinishedDate"]); } protected void cboShowActionItems_Init(object sender, EventArgs e) { - if (!IsPostBack) + if (Session["showActionItems"] == null) + { cboShowActionItems.Checked = m_user.GetConfigBool("filter_show_action_items"); + Session["showActionItems"] = cboShowActionItems.Checked; + } + else + cboShowActionItems.Checked = Convert.ToBoolean(Session["showActionItems"]); } protected void cboShowWorkOrders_Init(object sender, EventArgs e) { - if (!IsPostBack) + if (Session["showWorkOrders"] == null) + { cboShowWorkOrders.Checked = m_user.GetConfigBool("filter_show_work_orders"); + Session["showWorkOrders"] = cboShowWorkOrders.Checked; + } + else + cboShowWorkOrders.Checked = Convert.ToBoolean(Session["showWorkOrders"]); } protected void cboHighPriority_Init(object sender, EventArgs e) { - if (!IsPostBack) + if (Session["showHighPriority"] == null) + { cboHighPriority.Checked = m_user.GetConfigBool("filter_show_high_priority"); + Session["showHightPriority"] = cboHighPriority.Checked; + } + else + cboHighPriority.Checked = Convert.ToBoolean(Session["showHighPriority"]); } protected void cboLowPriority_Init(object sender, EventArgs e) { - if (!IsPostBack) + if (Session["showLowPriority"] == null) + { cboLowPriority.Checked = m_user.GetConfigBool("filter_show_low_priority"); + Session["showLowPriority"] = cboLowPriority.Checked; + } + else + cboLowPriority.Checked = Convert.ToBoolean(Session["showLowPriority"]); } protected void cboStatusFilter_Init(object sender, EventArgs e) { - if (!IsPostBack) + if (Session["filterStatus"] == null) + { cboStatusFilter.Checked = m_user.GetConfigBool("filter_enable_status_filter"); + Session["filterStatus"] = cboStatusFilter.Checked; + } + else + cboStatusFilter.Checked = Convert.ToBoolean(Session["filterStatus"]); } protected void cboDateFilter_Init(object sender, EventArgs e) { - if (!IsPostBack) + if (Session["filterAssignedDate"] == null) + { cboDateFilter.Checked = m_user.GetConfigBool("filter_enable_assigned_date_filter"); + Session["filterAssignedDate"] = cboDateFilter.Checked; + } + else + cboDateFilter.Checked = Convert.ToBoolean(Session["filterAssignedDate"]); } protected void cboDueFilter_Init(object sender, EventArgs e) { - if (!IsPostBack) + if (Session["filterDueDate"] == null) + { cboDueFilter.Checked = m_user.GetConfigBool("filter_enable_due_date_filter"); + Session["filterDueDate"] = cboDueFilter.Checked; + } + else + cboDueFilter.Checked = Convert.ToBoolean(Session["filterDueDate"]); } protected void cboFinishedFilter_Init(object sender, EventArgs e) { - if (!IsPostBack) + if (Session["filterFinishedDate"] == null) + { cboFinishedFilter.Checked = m_user.GetConfigBool("filter_enable_finished_date_filter"); + Session["filterFinishedDate"] = cboFinishedFilter.Checked; + } + else + cboFinishedFilter.Checked = Convert.ToBoolean(Session["filterFinishedDate"]); } protected void cboTypeFilter_Init(object sender, EventArgs e) { - if (!IsPostBack) + if (Session["filterType"] == null) + { cboTypeFilter.Checked = m_user.GetConfigBool("filter_enable_type_filter"); + Session["filterType"] = cboTypeFilter.Checked; + } + else + cboTypeFilter.Checked = Convert.ToBoolean(Session["filterType"]); } protected void cboPriorityFilter_Init(object sender, EventArgs e) { - if (!IsPostBack) + if (Session["filterPriority"] == null) + { cboPriorityFilter.Checked = m_user.GetConfigBool("filter_enable_priority_filter"); + Session["filterPriority"] = cboPriorityFilter.Checked; + } + else + cboPriorityFilter.Checked = Convert.ToBoolean(Session["filterPriority"]); } + protected void cboShowCompleted_Init(object sender, EventArgs e) + { + if (Session["showCompleted"] == null) + { + cboShowCompleted.Checked = (m_user.GetConfigBool("filter_show_ai_completed") && m_user.GetConfigBool("filter_show_wo_completed")); + Session["showCompleted"] = cboShowCompleted.Checked; + Session["showAICompleted"] = cboShowCompleted.Checked; + Session["showWOCompleted"] = cboShowCompleted.Checked; + } + else + cboShowCompleted.Checked = Convert.ToBoolean(Session["showCompleted"]); + } protected void newActionItem_Init(object sender, EventArgs e) { LinkButton newAI = (LinkButton)sender; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |