Пример #1
0
 private static void VerifyCanUpdate(int objectId)
 {
     if (!CalendarEntry.CanUpdate(objectId))
     {
         throw new AccessDeniedException();
     }
 }
Пример #2
0
        private void BindToolBar()
        {
            tbMetaInfo.AddText((Header == "") ? LocRM.GetString("tabMetaData") : Header);

            bool   CanUpdate = false;
            string postfix   = "";

            if (Request["ProjectID"] != null)
            {
                CanUpdate = Project.CanUpdate(int.Parse(Request["ProjectID"]));
            }
            if (Request["IncidentID"] != null)
            {
                CanUpdate = Incident.CanUpdate(int.Parse(Request["IncidentID"]));
            }
            if (Request["DocumentID"] != null)
            {
                CanUpdate = Document.CanUpdate(int.Parse(Request["DocumentID"]));
            }
            if (Request["EventID"] != null)
            {
                CanUpdate = CalendarEntry.CanUpdate(int.Parse(Request["EventID"]));
            }
            if (Request["TaskID"] != null)
            {
                CanUpdate = Task.CanUpdate(int.Parse(Request["TaskID"]));
            }
            if (Request["ToDoID"] != null)
            {
                CanUpdate = ToDo.CanUpdate(int.Parse(Request["ToDoID"]));
            }

            if (CanUpdate)
            {
                bool      HasMetaFields = false;
                MetaClass mc            = MetaClass.Load(GetMetaClassName());
                if (mc != null && mc.UserMetaFields.Count > 0)
                {
                    HasMetaFields = true;
                }
                if (HasMetaFields)
                {
                    tbMetaInfo.AddRightLink(
                        String.Format("<img alt='' src='../Layouts/Images/Edit.gif'/> {0}", LocRM.GetString("Edit")),
                        String.Format("../Common/MetaDataEdit.aspx?id={0}&class={1}{2}", GetObjectId(), GetMetaClassName(), postfix));
                }
                if (HasMetaFields && tblCustomFields.Rows.Count == 0)
                {
                    BindText2();
                }
                else if (!HasMetaFields)
                {
                    BindText1();
                }
            }
        }
Пример #3
0
        private void BindToolbar()
        {
            secHeader.AddText(LocRM.GetString("tTitle"));

            string sharedreq = "";

            if (SharedID > 0)
            {
                sharedreq = "&SharedId=" + SharedID;
            }

            if (CalendarEntry.CanUpdate(EventID))
            {
                secHeader.AddRightLink("<img src='../Layouts/Images/icons/event_edit.gif' border='0' width='16' height='16' align='absmiddle'> " + LocRM.GetString("Edit"), "../Events/EventEdit.aspx?EventID=" + EventID + sharedreq);
            }
        }
Пример #4
0
        private void BindToolbar()
        {
            secHeader.AddText(LocRM.GetString("Recurrence"));
            if (CalendarEntry.CanUpdate(EventId))
            {
                String slink = String.Empty;
                if (SharedID > 0)
                {
                    slink = "&SharedId=" + SharedID;
                }

                secHeader.AddRightLink("<img alt='' src='../Layouts/Images/icons/recurrence.gif'/> " + LocRM.GetString("Modify"), "../Events/RecEditor.aspx?EventId=" + EventId + slink);
                if (ShowRecurrence.Visible)
                {
                    secHeader.AddRightLink("<img alt='' src='../Layouts/Images/delete.gif'/> " + LocRM.GetString("Delete"), "javascript: document.forms[0]." + btnDelete.ClientID + ".click()");
                    btnDelete.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("Warning") + "');");
                }
            }
        }
Пример #5
0
        private void BindToolbar()
        {
            string sharedreq = "";

            if (SharedID > 0)
            {
                sharedreq = "&SharedId=" + SharedID;
            }

            secHeader.Title = LocRM.GetString("tTitle");

            bool canUpdate  = CalendarEntry.CanUpdate(EventId);
            bool canDelete  = CalendarEntry.CanDelete(EventId);
            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'/>&nbsp;" + */ LocRM2.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;

            #region Edit: Event
            if (canUpdate && !isExternal)
            {
                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 Event
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/event_edit.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.NavigateUrl         = "../Events/EventEdit.aspx?EventId=" + EventId + sharedreq;
                subItem.Text = LocRM.GetString("EditEvent");
                editItem.Items.Add(subItem);
                #endregion

                #region Reccurence
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/recurrence.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.NavigateUrl         = "../Events/RecEditor.aspx?EventId=" + EventId + sharedreq;
                subItem.Text = LocRM4.GetString("Recurrence");
                editItem.Items.Add(subItem);
                #endregion

                /*
                 #region Edit General Info
                 * subItem = new ComponentArt.Web.UI.MenuItem();
                 * subItem.ClientSideCommand = "javascript:ShowWizard('EditGeneralInfo.aspx?IncidentId=" + IncidentId + "', 500, 400);";
                 * subItem.Text = LocRM2.GetString("EditGeneralInfo");
                 * editItem.Items.Add(subItem);
                 #endregion
                 *
                 #region Edit Categories
                 * subItem = new ComponentArt.Web.UI.MenuItem();
                 * subItem.ClientSideCommand = "javascript:ShowWizard('EditCategories.aspx?IncidentId=" + IncidentId + "', 300, 350);";
                 * subItem.Text = LocRM2.GetString("EditCategories");
                 * editItem.Items.Add(subItem);
                 #endregion
                 */
                topMenuItem.Items.Add(editItem);
            }
            #endregion

            #region Modyfy Resources
            if (canUpdate && !isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/editgroup.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                CommandManager    cm  = CommandManager.GetCurrent(this.Page);
                CommandParameters cp  = new CommandParameters("MC_PM_EventParticipants");
                string            cmd = cm.AddCommand("Event", "", "EventView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                //subItem.ClientSideCommand = "javascript:ShowWizard('ParticipantsEditor.aspx?EventId=" + EventId + "', 650, 350);";
                subItem.Text = LocRM.GetString("EventParticipants");
                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);
                    //Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "<script language='javascript'>ShowWizard('ParticipantsEditor.aspx?EventId=" + EventId + "', 650, 350);</script>");
                }
            }
            #endregion

            #region Delete
            if (canDelete)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/event_delete.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.ClientSideCommand   = "javascript:DeleteEvent()";
                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 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 (Security.CurrentUser.IsExternal)
            {
                commentaddlink = "../External/ExternalCommentAdd.aspx?";
            }
            subItem.ClientSideCommand = String.Format("javascript:OpenWindow('{0}EventId={1}',{2},false);",
                                                      commentaddlink, EventId, (Security.CurrentUser.IsExternal) ? "800,600" : "520,270");
            subItem.Text = LocRM2.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}?EventId={1}', {2});",
             *              sPath, EventId, (Security.CurrentUser.IsExternal) ? "800,600" : "450, 200");
             *      subItem.Text = LocRM2.GetString("AddTimeSheet");
             *      topMenuItem.Items.Add(subItem);
             * }
             */
            #endregion

            #region UpdateHistory
            if (!isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.ClientSideCommand = String.Format("javascript:ShowWizard('../Common/SystemEventsByObject.aspx?ObjectId={0}&ObjectTypeId={1}', 750, 466);", EventId, (int)ObjectTypes.CalendarEntry);
                subItem.Text = LocRM5.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);", EventId, (int)ObjectTypes.CalendarEntry);
                subItem.Text = LocRM5.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}", EventId, ((int)ObjectTypes.CalendarEntry).ToString());
                subItem.Text = LocRM2.GetString("SystemNotifications");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region System Reminder
            if (!isExternal)
            {
                CalendarEntry.EventSecurity sec = CalendarEntry.GetSecurity(EventId);
                if (sec.IsManager || sec.IsResource)
                {
                    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.CalendarEntry, EventId);
                    subItem.Text = LocRM2.GetString("EditReminder");
                    topMenuItem.Items.Add(subItem);
                }
            }
            #endregion

            #region Favorites
            if (!CalendarEntry.CheckFavorites(EventId) && !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);
        }
Пример #6
0
        private void BindToolbar()
        {
            secHeader.AddText(LocRM.GetString("EventParticipants"));
            if (CalendarEntry.CanUpdate(EventID))
            {
                // Resource Utilization
                if (dt.Rows.Count > 0)
                {
                    ArrayList userList = new ArrayList();
                    foreach (DataRow row in dt.Rows)
                    {
                        int principalId = (int)row["PrincipalId"];
                        if (Mediachase.IBN.Business.User.IsGroup(principalId))
                        {
                            using (IDataReader reader = SecureGroup.GetListAllUsersInGroup(principalId, false))
                            {
                                while (reader.Read())
                                {
                                    if (!userList.Contains((int)reader["UserId"]))
                                    {
                                        userList.Add((int)reader["UserId"]);
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!userList.Contains(principalId))
                            {
                                userList.Add(principalId);
                            }
                        }
                    }

                    string users = String.Empty;
                    foreach (int userId in userList)
                    {
                        if (!String.IsNullOrEmpty(users))
                        {
                            users += ",";
                        }

                        users += userId.ToString();
                    }

                    string text = String.Format(CultureInfo.InvariantCulture,
                                                "<img alt='' src='{0}'/> {1}",
                                                Page.ResolveUrl("~/Layouts/Images/ResUtil.png"),
                                                LocRM2.GetString("Utilization"));
                    string link = String.Format(CultureInfo.InvariantCulture,
                                                "javascript:OpenPopUpNoScrollWindow('{0}?users={1}&amp;ObjectId={2}&amp;ObjectTypeId={3}',750,300)",
                                                Page.ResolveUrl("~/Common/ResourceUtilGraphForObject.aspx"),
                                                users,
                                                EventID,
                                                (int)ObjectTypes.CalendarEntry);
                    secHeader.AddRightLink(text, link);
                }

                // Edit
                CommandManager    cm  = CommandManager.GetCurrent(this.Page);
                CommandParameters cp  = new CommandParameters("MC_PM_EventParticipants");
                string            cmd = cm.AddCommand("Event", "", "EventView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                secHeader.AddRightLink("<img alt='' src='../Layouts/Images/icons/editgroup.gif'/> " + LocRM.GetString("Modify"), "javascript:" + cmd);
            }
        }