private void BindToolbar() { secHeader.Title = LocRM.GetString("tTitle"); bool canUpdate = Mediachase.IBN.Business.ToDo.CanUpdate(ToDoID); bool canViewFinances = Mediachase.IBN.Business.ToDo.CanViewFinances(ToDoID); bool canDelete = Mediachase.IBN.Business.ToDo.CanDelete(ToDoID); bool isExternal = Security.CurrentUser.IsExternal; ComponentArt.Web.UI.MenuItem topMenuItem = new ComponentArt.Web.UI.MenuItem(); topMenuItem.Text = /*"<img border='0' src='../Layouts/Images/downbtn.gif' width='9px' height='5px' align='absmiddle'/> " + */ LocRM.GetString("Actions"); topMenuItem.Look.LeftIconUrl = ResolveUrl("~/Layouts/Images/downbtn1.gif"); topMenuItem.Look.LeftIconHeight = Unit.Pixel(5); topMenuItem.Look.LeftIconWidth = Unit.Pixel(16); topMenuItem.LookId = "TopItemLook"; ComponentArt.Web.UI.MenuItem subItem; CommandManager cm = CommandManager.GetCurrent(this.Page); CommandParameters cp = null; string cmd = String.Empty; #region Create if (canUpdate) { #region Create: Predecessor, Successor ComponentArt.Web.UI.MenuItem createItem = new ComponentArt.Web.UI.MenuItem(); createItem.Text = LocRM.GetString("Create"); createItem.Look.RightIconUrl = "../Layouts/Images/arrow_right.gif"; createItem.Look.HoverRightIconUrl = "../Layouts/Images/arrow_right_hover.gif"; createItem.Look.RightIconWidth = Unit.Pixel(15); createItem.Look.RightIconHeight = Unit.Pixel(10); #region Create Predecessor subItem = new ComponentArt.Web.UI.MenuItem(); subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/task_create.gif"; subItem.Look.LeftIconWidth = Unit.Pixel(16); subItem.Look.LeftIconHeight = Unit.Pixel(16); subItem.NavigateUrl = "../ToDo/ToDoEdit.aspx?SuccID=" + ToDoID; subItem.Text = LocRM.GetString("Predecessor"); createItem.Items.Add(subItem); #endregion #region Create Successor subItem = new ComponentArt.Web.UI.MenuItem(); subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/task_create.gif"; subItem.Look.LeftIconWidth = Unit.Pixel(16); subItem.Look.LeftIconHeight = Unit.Pixel(16); subItem.NavigateUrl = "../ToDo/ToDoEdit.aspx?PredID=" + ToDoID; subItem.Text = LocRM.GetString("Successor"); createItem.Items.Add(subItem); #endregion topMenuItem.Items.Add(createItem); #endregion } #endregion #region Edit if (canUpdate) { #region Edit: ToDo, Categories ComponentArt.Web.UI.MenuItem editItem = new ComponentArt.Web.UI.MenuItem(); editItem.Text = LocRM.GetString("Edit"); editItem.Look.RightIconUrl = "../Layouts/Images/arrow_right.gif"; editItem.Look.HoverRightIconUrl = "../Layouts/Images/arrow_right_hover.gif"; editItem.Look.RightIconWidth = Unit.Pixel(15); editItem.Look.RightIconHeight = Unit.Pixel(10); #region Edit ToDo subItem = new ComponentArt.Web.UI.MenuItem(); subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/task_edit.gif"; subItem.Look.LeftIconWidth = Unit.Pixel(16); subItem.Look.LeftIconHeight = Unit.Pixel(16); subItem.NavigateUrl = "../ToDo/ToDoEdit.aspx?ToDoID=" + ToDoID; subItem.Text = LocRM.GetString("ToDo"); editItem.Items.Add(subItem); #endregion #region Edit Categories if (PortalConfig.CommonToDoAllowEditGeneralCategoriesField) { subItem = new ComponentArt.Web.UI.MenuItem(); subItem.Look.LeftIconWidth = Unit.Pixel(16); subItem.Look.LeftIconHeight = Unit.Pixel(16); subItem.ClientSideCommand = "javascript:ShowWizard('../ToDo/EditCategories.aspx?ToDoID=" + ToDoID + "', 300, 250);"; subItem.Text = LocRM.GetString("EditCategories"); editItem.Items.Add(subItem); } #endregion topMenuItem.Items.Add(editItem); #endregion } #endregion #region Add Resources if (canUpdate && !isExternal) { subItem = new ComponentArt.Web.UI.MenuItem(); subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/newgroup.gif"; subItem.Look.LeftIconWidth = Unit.Pixel(16); subItem.Look.LeftIconHeight = Unit.Pixel(16); cp = new CommandParameters("MC_PM_ToDoResEdit"); cmd = cm.AddCommand("ToDo", "", "ToDoView", cp); cmd = cmd.Replace("\"", """); subItem.ClientSideCommand = "javascript:" + cmd; //subItem.ClientSideCommand = "javascript:ModifyResources2(" + ToDoID + ")"; subItem.Text = LocRM.GetString("AddResources"); topMenuItem.Items.Add(subItem); if (!IsPostBack && Request["Assign"] == "1") { ClientScript.RegisterStartupScript(this.Page, this.GetType(), Guid.NewGuid().ToString(), "function Assign(){" + cmd + "} setTimeout('Assign()', 400);", true); } } #endregion #region Delete if (canDelete) { subItem = new ComponentArt.Web.UI.MenuItem(); subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/task_delete.gif"; subItem.Look.LeftIconWidth = Unit.Pixel(16); subItem.Look.LeftIconHeight = Unit.Pixel(16); subItem.ClientSideCommand = "javascript:DeleteToDoModal2()"; subItem.Text = LocRM.GetString("Delete"); topMenuItem.Items.Add(subItem); } #endregion #region --- Seperator --- if (canUpdate || canDelete) { subItem = new ComponentArt.Web.UI.MenuItem(); subItem.LookId = "BreakItem"; topMenuItem.Items.Add(subItem); } #endregion #region Add Predecessors and Successors if (canUpdate) { #region Add Predecessors subItem = new ComponentArt.Web.UI.MenuItem(); subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/task_predecessors.gif"; subItem.Look.LeftIconWidth = Unit.Pixel(16); subItem.Look.LeftIconHeight = Unit.Pixel(16); cp = new CommandParameters("MC_ToDo_AddPred"); cmd = cm.AddCommand("ToDo", "", "ToDoView", cp); cmd = cmd.Replace("\"", """); subItem.ClientSideCommand = "javascript:" + cmd; subItem.Text = LocRM.GetString("AddPredecessors"); topMenuItem.Items.Add(subItem); #endregion #region Add Successors subItem = new ComponentArt.Web.UI.MenuItem(); subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/task_sucessors.gif"; subItem.Look.LeftIconWidth = Unit.Pixel(16); subItem.Look.LeftIconHeight = Unit.Pixel(16); cp = new CommandParameters("MC_ToDo_AddSucc"); cmd = cm.AddCommand("ToDo", "", "ToDoView", cp); cmd = cmd.Replace("\"", """); subItem.ClientSideCommand = "javascript:" + cmd; subItem.Text = LocRM.GetString("AddSuccessors"); topMenuItem.Items.Add(subItem); #endregion /* using (IDataReader rdr = ToDo.GetListVacantPredecessors(ToDoID)) * { * if (rdr.Read()) * { * subItem = new ComponentArt.Web.UI.MenuItem(); * subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/task_predecessors.gif"; * subItem.Look.LeftIconWidth = Unit.Pixel(16); * subItem.Look.LeftIconHeight = Unit.Pixel(16); * cp = new CommandParameters("MC_PM_AddPredTodo"); * cmd = cm.AddCommand("ToDo", "", "ToDoView", cp); * cmd = cmd.Replace("\"", """); * subItem.ClientSideCommand = "javascript:" + cmd; * subItem.Text = LocRM4.GetString("Add"); * topMenuItem.Items.Add(subItem); * } * } * * using (IDataReader rdr = ToDo.GetListVacantSuccessors(ToDoID)) * { * if (rdr.Read()) * { * subItem = new ComponentArt.Web.UI.MenuItem(); * subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/task_sucessors.gif"; * subItem.Look.LeftIconWidth = Unit.Pixel(16); * subItem.Look.LeftIconHeight = Unit.Pixel(16); * cp = new CommandParameters("MC_PM_AddSuccTodo"); * cmd = cm.AddCommand("ToDo", "", "ToDoView", cp); * cmd = cmd.Replace("\"", """); * subItem.ClientSideCommand = "javascript:" + cmd; * subItem.Text = LocRM4.GetString("AddSuc"); * topMenuItem.Items.Add(subItem); * } * } * */ } #endregion #region Add Comments subItem = new ComponentArt.Web.UI.MenuItem(); subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/comments.gif"; subItem.Look.LeftIconWidth = Unit.Pixel(16); subItem.Look.LeftIconHeight = Unit.Pixel(16); string commentaddlink = "../Common/CommentAdd.aspx?"; if (isExternal) { commentaddlink = "../External/ExternalCommentAdd.aspx?"; } subItem.ClientSideCommand = String.Format("javascript:OpenWindow('{0}ToDoID={1}',{2},false);", commentaddlink, ToDoID, (Security.CurrentUser.IsExternal) ? "800,600" : "520,270"); subItem.Text = LocRM.GetString("CreateComment"); topMenuItem.Items.Add(subItem); #endregion #region Timesheet // OR [2007-08-23]: We should use IbnNext TimeTracking /* * if (Configuration.ProjectManagementEnabled) * { * subItem = new ComponentArt.Web.UI.MenuItem(); * subItem.Look.LeftIconUrl = "~/Layouts/Images/icons/timesheet.gif"; * subItem.Look.LeftIconWidth = Unit.Pixel(16); * subItem.Look.LeftIconHeight = Unit.Pixel(16); * string sPath = (Security.CurrentUser.IsExternal) ? "../External/ExternalTimeTracking.aspx" : "../TimeTracking/TimeTrackingWeek.aspx"; * subItem.ClientSideCommand = String.Format("javascript:ShowWizard('{0}?ToDoID={1}', {2});", * sPath, ToDoID, (Security.CurrentUser.IsExternal) ? "800,600" : "450, 200"); * subItem.Text = LocRM.GetString("AddTimeSheet"); * topMenuItem.Items.Add(subItem); * } */ #endregion #region Update History if (!isExternal) { subItem = new ComponentArt.Web.UI.MenuItem(); subItem.ClientSideCommand = String.Format("javascript:ShowWizard('../Common/SystemEventsByObject.aspx?ObjectId={0}&ObjectTypeId={1}', 750, 466);", ToDoID, (int)ObjectTypes.ToDo); subItem.Text = LocRM3.GetString("UpdateHistory"); topMenuItem.Items.Add(subItem); } #endregion #region Latest Visitors if (!isExternal) { subItem = new ComponentArt.Web.UI.MenuItem(); subItem.ClientSideCommand = String.Format("javascript:ShowWizard('../Common/LatestVisitors.aspx?ObjectId={0}&ObjectTypeId={1}', 450, 266);", ToDoID, (int)ObjectTypes.ToDo); subItem.Text = LocRM3.GetString("LatestVisitors"); topMenuItem.Items.Add(subItem); } #endregion #region System Notifications if (!isExternal) { subItem = new ComponentArt.Web.UI.MenuItem(); subItem.Look.LeftIconUrl = "~/Layouts/Images/accept_1.gif"; subItem.Look.LeftIconWidth = Unit.Pixel(16); subItem.Look.LeftIconHeight = Unit.Pixel(16); subItem.NavigateUrl = String.Format("../Directory/SystemNotificationForObject.aspx?ObjectId={0}&ObjectTypeId={1}", ToDoID, ((int)ObjectTypes.ToDo).ToString()); subItem.Text = LocRM2.GetString("SystemNotifications"); topMenuItem.Items.Add(subItem); } #endregion #region System Reminder if (!isExternal) { Mediachase.IBN.Business.ToDo.ToDoSecurity sec = Mediachase.IBN.Business.ToDo.GetSecurity(ToDoID); if (sec.IsManager || sec.IsResource || sec.IsCreator) { subItem = new ComponentArt.Web.UI.MenuItem(); subItem.Look.LeftIconUrl = "~/Layouts/Images/reminder.gif"; subItem.Look.LeftIconWidth = Unit.Pixel(16); subItem.Look.LeftIconHeight = Unit.Pixel(16); subItem.ClientSideCommand = String.Format("javascript:ShowWizard('../Directory/SystemRemindersForObject.aspx?ObjectTypeId={0}&ObjectId={1}', 420, 150)", (int)ObjectTypes.ToDo, ToDoID); subItem.Text = LocRM2.GetString("EditReminder"); topMenuItem.Items.Add(subItem); } } #endregion #region Favorites if (!Mediachase.IBN.Business.ToDo.CheckFavorites(ToDoID) && !isExternal) { subItem = new ComponentArt.Web.UI.MenuItem(); subItem.Look.LeftIconUrl = "~/Layouts/Images/Favorites.gif"; subItem.Look.LeftIconWidth = Unit.Pixel(16); subItem.Look.LeftIconHeight = Unit.Pixel(16); subItem.ClientSideCommand = "javascript:" + Page.ClientScript.GetPostBackEventReference(btnAddToFavorites, ""); subItem.Text = LocRM.GetString("AddToFavorites"); topMenuItem.Items.Add(subItem); } #endregion secHeader.ActionsMenu.Items.Add(topMenuItem); }
private void BindReminders() { Mediachase.IBN.Business.ToDo.ToDoSecurity sec = Mediachase.IBN.Business.ToDo.GetSecurity(ToDoID); bool IsMember = sec.IsManager || sec.IsResource || sec.IsCreator; if (IsMember && TargetStartDate > DateTime.UtcNow) { int Lag = -1; bool IsActive = false; using (IDataReader reader = Schedule.GetReminderSubscriptionPersonalForObject(DateTypes.Todo_StartDate, ToDoID)) { if (reader.Read()) { Lag = (int)reader["Lag"]; IsActive = (bool)reader["IsActive"]; } } if (IsActive) { imgReminderStart.ToolTip = String.Format("{0}: {1}", LocRM2.GetString("Start"), CommonHelper.GetIntervalString(Lag)); } else { imgReminderStart.ToolTip = CommonHelper.GetIntervalString(-1); if (imgReminderStart.ToolTip.StartsWith("[")) { imgReminderStart.ToolTip = imgReminderStart.ToolTip.Substring(1); } if (imgReminderStart.ToolTip.EndsWith("]")) { imgReminderStart.ToolTip = imgReminderStart.ToolTip.Substring(0, imgReminderStart.ToolTip.Length - 1); } imgReminderStart.ImageUrl = "~/Layouts/Images/reminder2.gif"; } } else { imgReminderStart.Visible = false; } if (IsMember && TargetFinishDate > DateTime.UtcNow) { int Lag = -1; bool IsActive = false; using (IDataReader reader = Schedule.GetReminderSubscriptionPersonalForObject(DateTypes.Todo_FinishDate, ToDoID)) { if (reader.Read()) { Lag = (int)reader["Lag"]; IsActive = (bool)reader["IsActive"]; } } if (IsActive) { imgReminderFinish.ToolTip = String.Format("{0}: {1}", LocRM2.GetString("Finish"), CommonHelper.GetIntervalString(Lag)); } else { imgReminderFinish.ToolTip = CommonHelper.GetIntervalString(-1); if (imgReminderFinish.ToolTip.StartsWith("[")) { imgReminderFinish.ToolTip = imgReminderFinish.ToolTip.Substring(1); } if (imgReminderFinish.ToolTip.EndsWith("]")) { imgReminderFinish.ToolTip = imgReminderFinish.ToolTip.Substring(0, imgReminderFinish.ToolTip.Length - 1); } imgReminderFinish.ImageUrl = "~/Layouts/Images/reminder2.gif"; } } else { imgReminderFinish.Visible = false; } }