Exemplo n.º 1
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!Incident.CanUpdate(IncidentID))
            {
                trPriority.Visible = false;
            }

            if (!Incident.CanChangeProject(IncidentID))
            {
                trProject.Visible = false;
            }

            if (!Incident.CanUpdate(IncidentID))
            {
                trIssueBox.Visible = false;
            }

            string str = "_" + ((int)Mediachase.IBN.Business.ObjectStates.Active).ToString() + "_" +
                         "_" + ((int)Mediachase.IBN.Business.ObjectStates.ReOpen).ToString() + "_" +
                         "_" + ((int)Mediachase.IBN.Business.ObjectStates.Upcoming).ToString() + "_";
            string str1 = "_" + ((int)Mediachase.IBN.Business.ObjectStates.OnCheck).ToString() + "_";

            ddStatus.Attributes.Add("onchange", String.Format("ChangeVisible('{0}', '{1}', this)", str, str1));

            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Guid.NewGuid().ToString(),
                                                String.Format("ChangeVisible('{0}', '{1}', document.getElementById('{2}'));", str, str1, ddStatus.ClientID),
                                                true);
            BindList();
        }
Exemplo n.º 2
0
        public bool IsEnable(object Sender, object Element)
        {
            bool retval = false;

            if (HttpContext.Current.Items.Contains("OwnerTypeId") && HttpContext.Current.Items.Contains("OwnerId"))
            {
                int ownerTypeId = (int)HttpContext.Current.Items["OwnerTypeId"];
                int ownerId     = (int)HttpContext.Current.Items["OwnerId"];

                if (ownerTypeId == (int)ObjectTypes.Document)
                {
                    retval = Document.CanUpdate(ownerId);
                }
                else if (ownerTypeId == (int)ObjectTypes.Task)
                {
                    retval = Task.CanUpdate(ownerId);
                }
                else if (ownerTypeId == (int)ObjectTypes.ToDo)
                {
                    retval = ToDo.CanUpdate(ownerId);
                }
                else if (ownerTypeId == (int)ObjectTypes.Issue)
                {
                    retval = Incident.CanUpdate(ownerId);
                }
            }

            return(retval);
        }
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp            = (CommandParameters)Element;
                string[]          elemsToDelete = MCGrid.GetCheckedCollection(((CommandManager)Sender).Page, cp.CommandArguments["GridId"]);

                using (DbTransaction tran = DbTransaction.Begin())
                {
                    foreach (string elem in elemsToDelete)
                    {
                        int id = Convert.ToInt32(elem.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0], CultureInfo.InvariantCulture);
                        if (id > 0)
                        {
                            if (Incident.CanUpdate(id))
                            {
                                Issue2.UpPriority(id, false);
                            }
                        }
                    }
                    tran.Commit();
                }

                CHelper.RequireBindGrid();
            }
        }
Exemplo n.º 4
0
        public bool IsEnable(object Sender, object Element)
        {
            bool retval = false;

            if (HttpContext.Current.Items.Contains("OwnerTypeId") && HttpContext.Current.Items.Contains("OwnerId"))
            {
                int ownerTypeId = (int)HttpContext.Current.Items["OwnerTypeId"];
                int ownerId     = (int)HttpContext.Current.Items["OwnerId"];

                bool canUpdate = false;
                if (ownerTypeId == (int)ObjectTypes.Document)
                {
                    canUpdate = Document.CanUpdate(ownerId);
                }
                else if (ownerTypeId == (int)ObjectTypes.Task)
                {
                    canUpdate = Task.CanUpdate(ownerId);
                }
                else if (ownerTypeId == (int)ObjectTypes.ToDo)
                {
                    canUpdate = ToDo.CanUpdate(ownerId);
                }
                else if (ownerTypeId == (int)ObjectTypes.Issue)
                {
                    canUpdate = Incident.CanUpdate(ownerId);
                }

                if (canUpdate)
                {
                    int projectId = CommonHelper.GetProjectIdByObjectIdObjectType(ownerId, ownerTypeId);

                    FilterElementCollection filters = new FilterElementCollection();
                    filters.Add(FilterElement.EqualElement(WorkflowDefinitionEntity.FieldSupportedIbnObjectTypes, ownerTypeId));
                    if (projectId > 0)
                    {
                        // O.R. [2010-02-03]: Allow to select non-project templates for a project
                        OrBlockFilterElement orBlock = new OrBlockFilterElement();
                        orBlock.ChildElements.Add(FilterElement.EqualElement(WorkflowDefinitionEntity.FieldProjectId, projectId));
                        orBlock.ChildElements.Add(FilterElement.IsNullElement(WorkflowDefinitionEntity.FieldProjectId));
                        filters.Add(orBlock);
                    }
                    else
                    {
                        filters.Add(FilterElement.IsNullElement(WorkflowDefinitionEntity.FieldProjectId));
                    }

                    EntityObject[] items = BusinessManager.List(WorkflowDefinitionEntity.ClassName, filters.ToArray());
                    if (items != null && items.Length > 0)
                    {
                        retval = true;
                    }
                }
            }

            return(retval);
        }
Exemplo n.º 5
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();
                }
            }
        }
Exemplo n.º 6
0
        private static void CheckRight(DummyFileInfoWrapper fileInfo, string action)
        {
            bool isActionAllowed = false;

            int userId = Security.CurrentUser.UserID;

            if (fileInfo.ContainerKey.StartsWith("ForumNodeId_"))
            {
                // Extract forumNodeId
                int forumNodeId = int.Parse(fileInfo.ContainerKey.Split('_')[1]);

                // Find incidentId by ForumNodeId
                string forumContainerKey = ForumThreadNodeInfo.GetOwnerContainerKey(forumNodeId);
                int    incidentId        = int.Parse(forumContainerKey.Split('_')[1]);

                // Check Security
                switch (action)
                {
                case "Read":
                    isActionAllowed = Incident.CanRead(incidentId);
                    break;

                case "Write":
                    isActionAllowed = Incident.CanUpdate(incidentId);
                    break;
                }
            }
            else if (fileInfo.ContainerKey.StartsWith("DocumentVers_"))
            {
                // Extract documentVersionId
                int documentId = int.Parse(fileInfo.ContainerKey.Split('_')[1]);

                // Check Security
                switch (action)
                {
                case "Read":
                    isActionAllowed = Document.CanRead(documentId);
                    break;

                case "Write":
                    isActionAllowed = Document.CanAddVersion(documentId);
                    break;
                }
            }
            else
            {
                isActionAllowed = FileStorage.CanUserRunAction(userId, fileInfo.ContainerKey, fileInfo.ParrentDirectoryId, action);
                //retVal = FileStorage.CanUserRead(Security.CurrentUser.UserID, fileInfo.ContainerKey, fileInfo.ParrentDirectoryId);
            }

            if (!isActionAllowed)
            {
                throw new HttpException(403, "Operation '" + action + "' is forbidden.");
            }
        }
Exemplo n.º 7
0
        private void BindToolbar()
        {
            secHeader.AddText(LocRM2.GetString("QuickInfo"));

            if (Incident.CanUpdate(IncidentId))
            {
                secHeader.AddRightLink(
                    String.Format("<img src='../Layouts/Images/Edit.gif' width='16' height='16' border=0 align=absmiddle> {0}", LocRM.GetString("tbIncidentInfoEdit")),
                    String.Format("javascript:ShowWizard('EditGeneralInfo.aspx?IncidentId={0}', 500, 400);", IncidentId));
            }
        }
Exemplo n.º 8
0
        private static bool CheckFileStorageRight(FileInfo fileInfo, string action, int userId)
        {
            bool isActionAllowed = false;

            if (fileInfo.ContainerKey.StartsWith("ForumNodeId_"))
            {
                // Extract forumNodeId
                int forumNodeId = int.Parse(fileInfo.ContainerKey.Split('_')[1]);

                // Find incidentId by ForumNodeId
                string forumContainerKey = ForumThreadNodeInfo.GetOwnerContainerKey(forumNodeId);
                int    incidentId        = int.Parse(forumContainerKey.Split('_')[1]);

                // Check Security
                switch (action)
                {
                case "Read":
                    isActionAllowed = Incident.CanRead(incidentId);
                    break;

                case "Write":
                    isActionAllowed = Incident.CanUpdate(incidentId);
                    break;
                }
            }
            else if (fileInfo.ContainerKey.StartsWith("DocumentVers_"))
            {
                // Extract documentVersionId
                int documentId = int.Parse(fileInfo.ContainerKey.Split('_')[1]);

                // Check Security
                switch (action)
                {
                case "Read":
                    isActionAllowed = Document.CanRead(documentId);
                    break;

                case "Write":
                    isActionAllowed = Document.CanAddVersion(documentId);
                    break;
                }
            }
            else
            {
                isActionAllowed = FileStorage.CanUserRunAction(userId, fileInfo.ContainerKey, fileInfo.ParentDirectoryId, action);
            }

            return(isActionAllowed);
        }
Exemplo n.º 9
0
        private void BindToolbar()
        {
            secHeader.AddText(LocRM.GetString("tRelIss"));
            if (Incident.CanUpdate(IncidentId))
            {
                //string sLink = String.Format("javascript:OpenPopUpNoScrollWindow(&quot;../Common/SelectIncident.aspx?btn={0}&exclude={1}&quot;, 640, 480);",
                //    Page.ClientScript.GetPostBackEventReference(btnAddRelatedIss, "xxxtypeid;xxxid"), IncidentId.ToString());
                //secHeader.AddRightLink("<img alt='' src='../Layouts/Images/icons/relincidents.gif'/> " + LocRM.GetString("tAdd"), sLink);

                CommandManager    cm  = CommandManager.GetCurrent(this.Page);
                CommandParameters cp  = new CommandParameters("MC_HDM_RelatedIss");
                string            cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                secHeader.AddRightLink("<img alt='' src='../Layouts/Images/icons/relincidents.gif'/> " + LocRM.GetString("tAdd"), "javascript:" + cmd);
            }
        }
Exemplo n.º 10
0
        public bool IsEnable(object Sender, object Element)
        {
            bool retval = false;

            if (HttpContext.Current.Items.Contains("OwnerTypeId") && HttpContext.Current.Items.Contains("OwnerId"))
            {
                int ownerTypeId = (int)HttpContext.Current.Items["OwnerTypeId"];
                int ownerId     = (int)HttpContext.Current.Items["OwnerId"];

                bool canUpdate = false;
                if (ownerTypeId == (int)ObjectTypes.Document)
                {
                    canUpdate = Document.CanUpdate(ownerId);
                }
                else if (ownerTypeId == (int)ObjectTypes.Task)
                {
                    canUpdate = Task.CanUpdate(ownerId);
                }
                else if (ownerTypeId == (int)ObjectTypes.ToDo)
                {
                    canUpdate = ToDo.CanUpdate(ownerId);
                }
                else if (ownerTypeId == (int)ObjectTypes.Issue)
                {
                    canUpdate = Incident.CanUpdate(ownerId);
                }

                if (canUpdate && Element is CommandParameters)
                {
                    CommandParameters cp = (CommandParameters)Element;

                    if (cp.CommandArguments["primaryKeyId"] == null)
                    {
                        throw new ArgumentException("PrimaryKeyId is null for WFInstanceStartEnableHandler");
                    }

                    PrimaryKeyId           pk     = PrimaryKeyId.Parse(cp.CommandArguments["primaryKeyId"]);
                    WorkflowInstanceEntity entity = (WorkflowInstanceEntity)BusinessManager.Load(WorkflowInstanceEntity.ClassName, pk);
                    retval = (entity.State == (int)BusinessProcessState.Pending);
                }
            }

            return(retval);
        }
Exemplo n.º 11
0
        private void BindDG()
        {
            dgRelatedIss.Columns[1].HeaderText = LocRM.GetString("Title");
            dgRelatedIss.Columns[2].HeaderText = LocRM.GetString("Manager");
            if (!Incident.CanUpdate(IncidentId))
            {
                dgRelatedIss.Columns[3].Visible = false;
            }
            dgRelatedIss.DataSource = Incident.GetListIncidentRelationsDataTable(IncidentId).DefaultView;
            dgRelatedIss.DataBind();

            foreach (DataGridItem dgi in dgRelatedIss.Items)
            {
                ImageButton ib = (ImageButton)dgi.FindControl("ibDelete");
                if (ib != null)
                {
                    ib.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("tWarning") + "')");
                    ib.ToolTip = LocRM.GetString("Delete");
                }
            }
        }
Exemplo n.º 12
0
        void NodeActions_Validate(object Sender, ValidateArgs e)
        {
            if (e.Node == null)
            {
                return;
            }

            UserLightPropertyCollection pc = Security.CurrentUser.Properties;

            int iObjTypeId = -1;
            int iObjId     = -1;

            if (HttpContext.Current.Items["ObjectTypeId"] != null)
            {
                iObjTypeId = (int)HttpContext.Current.Items["ObjectTypeId"];
            }
            if (HttpContext.Current.Items["ObjectId"] != null)
            {
                iObjId = (int)HttpContext.Current.Items["ObjectId"];
            }

            switch (e.CommandUid)
            {
                #region Reply
            case "Reply":
                if (e.Node.Type == "email" && e.Node.Attributes.ContainsKey("Incoming") && pc["IncForum_ReplyOutlook"] != "1" && pc["IncForum_ReplyEML"] != "1")
                {
                    e.IsEnabled = true;
                    e.IsVisible = true;
                }
                break;

                #endregion
                #region ReplyOutlook
            case "ReplyOutlook":
                if (e.Node.Type == "email" && e.Node.Attributes.ContainsKey("Incoming") && pc["IncForum_ReplyOutlook"] == "1")
                {
                    e.IsEnabled = true;
                    e.IsVisible = true;
                }
                break;

                #endregion
                #region ReplyEML
            case "ReplyEML":
                if (e.Node.Type == "email" && e.Node.Attributes.ContainsKey("Incoming") && pc["IncForum_ReplyEML"] != "1")
                {
                    e.IsEnabled = true;
                    e.IsVisible = true;
                }
                break;

                #endregion
                #region ReSend
            case "ReSend":
                if (iObjTypeId == (int)ObjectTypes.Issue)
                {
                    if (e.Node.Type == "email")
                    {
                        if (e.Node.Attributes.ContainsKey("Incoming"))
                        {
                            IncidentBox incidentBox = IncidentBox.Load(Incident.GetIncidentBox(iObjId));
                            EMailRouterIncidentBoxBlock settings = IncidentBoxDocument.Load(incidentBox.IncidentBoxId).EMailRouterBlock;
                            if (settings.AllowEMailRouting)
                            {
                                e.IsEnabled = true;
                                e.IsVisible = true;
                            }
                        }
                    }
                }
                break;

                #endregion
                #region ReSendOut
            case "ReSendOut":
                if (iObjTypeId == (int)ObjectTypes.Issue)
                {
                    if (e.Node.Type == "email")
                    {
                        if (e.Node.Attributes.ContainsKey("Outgoing"))
                        {
                            e.IsEnabled = true;
                            e.IsVisible = true;
                        }
                    }
                }
                break;

                #endregion
                #region Resolution
            case "Resolution":
                if (iObjTypeId == (int)ObjectTypes.Issue)
                {
                    if (!e.Node.Attributes.ContainsKey("Resolution") &&
                        !e.Node.Attributes.ContainsKey("Question"))
                    {
                        e.IsEnabled = true;
                        e.IsVisible = true;
                    }
                }
                break;

                #endregion
                #region UnResolution
            case "UnResolution":
                if (iObjTypeId == (int)ObjectTypes.Issue)
                {
                    if (e.Node.Attributes.ContainsKey("Resolution"))
                    {
                        e.IsEnabled = true;
                        e.IsVisible = true;
                    }
                }
                break;

                #endregion
                #region Workaround
            case "Workaround":
                if (iObjTypeId == (int)ObjectTypes.Issue)
                {
                    if (!e.Node.Attributes.ContainsKey("Workaround") &&
                        !e.Node.Attributes.ContainsKey("Question"))
                    {
                        e.IsEnabled = true;
                        e.IsVisible = true;
                    }
                }
                break;

                #endregion
                #region UnWorkaround
            case "UnWorkaround":
                if (iObjTypeId == (int)ObjectTypes.Issue)
                {
                    if (e.Node.Attributes.ContainsKey("Workaround"))
                    {
                        e.IsEnabled = true;
                        e.IsVisible = true;
                    }
                }
                break;

                #endregion
                #region OnTop
            case "OnTop":
                if (!e.Node.Attributes.ContainsKey(Node.ONTOP_ATTRIBUTE))
                {
                    e.IsEnabled = true;
                    e.IsVisible = true;
                }
                break;

                #endregion
                #region UnOnTop
            case "UnOnTop":
                if (e.Node.Attributes.ContainsKey(Node.ONTOP_ATTRIBUTE))
                {
                    e.IsEnabled = true;
                    e.IsVisible = true;
                }
                break;

                #endregion
                #region Delete
            case "Delete":
                if (iObjTypeId == (int)ObjectTypes.Issue)
                {
                    bool CanUpdate = Incident.CanUpdate(iObjId);
                    e.IsEnabled = CanUpdate;
                    e.IsVisible = CanUpdate;
                    e.IsBreak   = true;
                }
                break;

                #endregion
            default:
                break;
            }
        }
Exemplo n.º 13
0
        private void BindDataGrid()
        {
            DataTable dt = new DataTable();
            DataRow   dr;

            #region DataTable
            dt.Columns.Add(new DataColumn("Id", typeof(int)));
            dt.Columns.Add(new DataColumn("Index", typeof(string)));
            dt.Columns.Add(new DataColumn("EMailMessageId", typeof(int)));
            dt.Columns.Add(new DataColumn("Sender", typeof(string)));
            dt.Columns.Add(new DataColumn("Message", typeof(string)));
            dt.Columns.Add(new DataColumn("SystemMessage", typeof(string)));
            dt.Columns.Add(new DataColumn("Created", typeof(string)));
            dt.Columns.Add(new DataColumn("CreationDate", typeof(DateTime)));
            dt.Columns.Add(new DataColumn("Attachments", typeof(string)));
            dt.Columns.Add(new DataColumn("NodeType", typeof(string)));
            dt.Columns.Add(new DataColumn("CanMakeResolution", typeof(bool)));
            dt.Columns.Add(new DataColumn("CanMakeWorkaround", typeof(bool)));
            dt.Columns.Add(new DataColumn("CanUnMakeResolution", typeof(bool)));
            dt.Columns.Add(new DataColumn("CanUnMakeWorkaround", typeof(bool)));
            dt.Columns.Add(new DataColumn("CanReSend", typeof(bool)));
            dt.Columns.Add(new DataColumn("CanReSendOut", typeof(bool)));
            dt.Columns.Add(new DataColumn("CanReply", typeof(bool)));
            #endregion

            IncidentBox incidentBox = IncidentBox.Load(Incident.GetIncidentBox(IncidentId));
            EMailRouterIncidentBoxBlock settings = IncidentBoxDocument.Load(incidentBox.IncidentBoxId).EMailRouterBlock;
            bool allowEMailRouting = settings.AllowEMailRouting;
            bool CanUpdate         = Incident.CanUpdate(IncidentId);

            int _index = 0;
            foreach (ForumThreadNodeInfo node in Incident.GetForumThreadNodes(IncidentId))
            {
                #region Define Node Type
                string typeName = "internal";
                ForumThreadNodeSettingCollection coll = new ForumThreadNodeSettingCollection(node.Id);
                if (coll[ForumThreadNodeSetting.Question] != null)
                {
                    if (coll[ForumThreadNodeSetting.Incoming] != null)
                    {
                        typeName = "Mail_incoming_quest";
                    }
                    else if (coll[ForumThreadNodeSetting.Outgoing] != null)
                    {
                        typeName = "Mail_outgoing_quest";
                    }
                    else
                    {
                        typeName = "internal_quest";
                    }
                }
                else if (coll[ForumThreadNodeSetting.Resolution] != null)
                {
                    if (coll[ForumThreadNodeSetting.Incoming] != null)
                    {
                        typeName = "Mail_incoming_resol";
                    }
                    else if (coll[ForumThreadNodeSetting.Outgoing] != null)
                    {
                        typeName = "Mail_outgoing_resol";
                    }
                    else
                    {
                        typeName = "internal_resol";
                    }
                }
                else if (coll[ForumThreadNodeSetting.Workaround] != null)
                {
                    if (coll[ForumThreadNodeSetting.Incoming] != null)
                    {
                        typeName = "Mail_incoming_wa";
                    }
                    else if (coll[ForumThreadNodeSetting.Outgoing] != null)
                    {
                        typeName = "Mail_outgoing_wa";
                    }
                    else
                    {
                        typeName = "internal_wa";
                    }
                }
                else if (coll[ForumThreadNodeSetting.Incoming] != null)
                {
                    typeName = "Mail_incoming";
                }
                else if (coll[ForumThreadNodeSetting.Outgoing] != null)
                {
                    typeName = "Mail_outgoing";
                }
                #endregion

                dr = dt.NewRow();

                dr["Id"]                  = node.Id;
                dr["EMailMessageId"]      = node.EMailMessageId;
                dr["CanMakeResolution"]   = false;
                dr["CanMakeWorkaround"]   = false;
                dr["CanUnMakeResolution"] = false;
                dr["CanUnMakeWorkaround"] = false;
                dr["CanReply"]            = false;
                dr["CanReSend"]           = false;
                dr["CanReSendOut"]        = false;
                switch (typeName)
                {
                case "internal_resol":
                case "Mail_incoming_resol":
                case "Mail_outgoing_resol":
                    dr["CanUnMakeResolution"] = true;
                    break;

                case "internal_wa":
                case "Mail_incoming_wa":
                case "Mail_outgoing_wa":
                    dr["CanMakeResolution"]   = true;
                    dr["CanUnMakeWorkaround"] = true;
                    break;

                case "internal":
                case "Mail_incoming":
                case "Mail_outgoing":
                    dr["CanMakeResolution"] = true;
                    dr["CanMakeWorkaround"] = true;
                    break;

                default:
                    break;
                }
                if (coll[ForumThreadNodeSetting.Outgoing] != null && !Mediachase.IBN.Business.Security.CurrentUser.IsExternal)
                {
                    dr["CanReSendOut"] = true;
                }
                if (coll[ForumThreadNodeSetting.Incoming] != null && !Mediachase.IBN.Business.Security.CurrentUser.IsExternal)
                {
                    dr["CanReply"]  = true;
                    dr["CanReSend"] = allowEMailRouting;
                }

                if (node.EMailMessageId <= 0)
                {
                    dr["Sender"] = Mediachase.UI.Web.Util.CommonHelper.GetUserStatus(node.CreatorId);
                }

                dr["Created"]      = node.Created.ToShortDateString() + " " + node.Created.ToShortTimeString();
                dr["CreationDate"] = node.Created;

                string sNodeType = typeName;
                try
                {
                    sNodeType = LocRM.GetString(String.Format("NodeType_{0}", typeName));
                }
                catch
                {
                }
                dr["NodeType"] = String.Format("<img src='{2}/{0}.gif' width=24 height=16 align=absmiddle alt='{1}'>",
                                               typeName, sNodeType, ResolveClientUrl("~/layouts/images/icons"));
                dr["SystemMessage"] = String.Empty;

                string sMessage = "";
                if (coll[IncidentForum.IssueEvent.Declining.ToString()] != null)
                {
                    sMessage = String.Format("<font color='red'><b>{0}</b></font>",
                                             LocRM.GetString("tUserDeclined"));
                }
                if (coll[IncidentForum.IssueEvent.State.ToString()] != null)
                {
                    int stateId = int.Parse(coll[IncidentForum.IssueEvent.State.ToString()].ToString());
                    if (sMessage == "")
                    {
                        sMessage = String.Format("{2}: <font color='{0}'><b>{1}</b></font>",
                                                 Mediachase.UI.Web.Util.CommonHelper.GetStateColorString(stateId),
                                                 GetStatusName(stateId),
                                                 LocRM.GetString("Status"));
                    }
                    else
                    {
                        sMessage += String.Format("{2}: <font color='{0}'><b>{1}</b></font>",
                                                  Mediachase.UI.Web.Util.CommonHelper.GetStateColorString(stateId),
                                                  GetStatusName(stateId),
                                                  LocRM.GetString("Status"));
                    }
                }
                if (coll[IncidentForum.IssueEvent.Responsibility.ToString()] != null)
                {
                    int    iResp = int.Parse(coll[IncidentForum.IssueEvent.Responsibility.ToString()].ToString());
                    string sResp = "";
                    if (iResp == -2)
                    {
                        sResp = String.Format("<img align='absmiddle' border='0' src='{0}' />&nbsp;<font color='#808080'><b>{1}</b></font>",
                                              ResolveClientUrl("~/layouts/images/not_set.png"),
                                              LocRM.GetString("tRespNotSet"));
                    }
                    else if (iResp == -1)
                    {
                        sResp = String.Format("<img align='absmiddle' border='0' src='{0}' />&nbsp;<font color='green'><b>{1}</b></font>",
                                              ResolveClientUrl("~/layouts/images/waiting.gif"),
                                              LocRM.GetString("tRespGroup"));
                    }
                    else
                    {
                        sResp = Mediachase.UI.Web.Util.CommonHelper.GetUserStatus(iResp);
                    }
                    if (sMessage == "")
                    {
                        sMessage = LocRM.GetString("tResponsible") + ": " + sResp;
                    }
                    else
                    {
                        sMessage += "<br />" + LocRM.GetString("tResponsible") + ": " + sResp;
                    }
                }
                if (WasFarwarded == 1 && node.EMailMessageId == ForwardedEMail)
                {
                    sMessage = "<font color='green'><b>" + LocRM.GetString("tWasResended") + "</b></font><br/>" + sMessage;
                }
                if (WasFarwarded == -1 && node.EMailMessageId == ForwardedEMail)
                {
                    sMessage = "<font color='red'><b>" + LocRM.GetString("tWasNotResended") + "</b></font><br/>" + sMessage;
                }

                dr["SystemMessage"] = (sMessage.Length == 0) ? String.Empty : sMessage;

                string sAttach = "";


                #region EmailMessage - Attachments
                if (node.EMailMessageId > 0)
                {
                    EMailMessageInfo mi = null;
                    try
                    {
                        mi = EMailMessageInfo.Load(node.EMailMessageId);
                        int iUserId = User.GetUserByEmail(mi.SenderEmail);

                        if (EMailClient.IsAlertSenderEmail(mi.SenderEmail))
                        {
                            iUserId = node.CreatorId;
                        }

                        if (iUserId > 0)
                        {
                            dr["Sender"] = Mediachase.UI.Web.Util.CommonHelper.GetUserStatus(iUserId);
                        }
                        else
                        {
                            Client client = Mediachase.IBN.Business.Common.GetClient(mi.SenderEmail);
                            if (client != null)
                            {
                                if (client.IsContact)
                                {
                                    dr["Sender"] = Mediachase.UI.Web.Util.CommonHelper.GetContactLink(this.Page, client.Id, client.Name);
                                }
                                else
                                {
                                    dr["Sender"] = Mediachase.UI.Web.Util.CommonHelper.GetOrganizationLink(this.Page, client.Id, client.Name);
                                }
                            }
                            else if (mi.SenderName != "")
                            {
                                dr["Sender"] = Mediachase.UI.Web.Util.CommonHelper.GetEmailLink(mi.SenderEmail, mi.SenderName);
                            }
                            else
                            {
                                dr["Sender"] = Mediachase.UI.Web.Util.CommonHelper.GetEmailLink(mi.SenderEmail, mi.SenderEmail);
                            }
                        }

                        string sBody = String.Empty;
                        if (mi.HtmlBody != null)
                        {
                            sBody = mi.HtmlBody;
                        }

                        dr["Message"] = sBody;

                        // Attachments
                        for (int i = 0; i < mi.Attachments.Length; i++)
                        {
                            AttachmentInfo ai    = mi.Attachments[i];
                            int            id    = DSFile.GetContentTypeByFileName(ai.FileName);
                            string         sIcon = "";
                            if (id > 0)
                            {
                                sIcon = String.Format("<img align='absmiddle' border='0' src='{0}' />", ResolveClientUrl("~/Common/ContentIcon.aspx?IconID=" + id));
                            }
                            //sAttach += String.Format("<nobr><a href='{0}'{2}>{1}</a></nobr> &nbsp;&nbsp;",
                            //  ResolveClientUrl("~/Incidents/EmailAttachDownload.aspx") + "?EMailId=" + node.EMailMessageId.ToString() + "&AttachmentIndex=" + i.ToString(),
                            //  sIcon + "&nbsp;" + ai.FileName,
                            //  Mediachase.IBN.Business.Common.OpenInNewWindow(ai.ContentType) ? " target='_blank'" : "");
                            sAttach += String.Format("<nobr><a href='{0}'{2}>{1}</a></nobr> &nbsp;&nbsp;", WebDavUrlBuilder.GetEmailAtachWebDavUrl(node.EMailMessageId, i, true),
                                                     sIcon + "&nbsp;" + ai.FileName, Mediachase.IBN.Business.Common.OpenInNewWindow(ai.ContentType) ? " target='_blank'" : "");
                        }
                    }
                    catch
                    {
                        dr["Sender"]  = Mediachase.UI.Web.Util.CommonHelper.GetUserStatus(-1);
                        dr["Message"] = String.Format("<font color='red'><b>{0}</b>&nbsp;(#{1})</font>", LocRM.GetString("tNotFound"), node.EMailMessageId);
                    }
                }
                else
                {
                    string sBody = Mediachase.UI.Web.Util.CommonHelper.parsetext_br(node.Text, false);
                    dr["Message"] = sBody;

                    // Files
                    if (node.ContentType == ForumStorage.NodeContentType.TextWithFiles)
                    {
                        FileInfo[] files = Incident.GetForumNodeFiles(node.Id);
                        if (files.Length > 0)
                        {
                            foreach (FileInfo fl in files)
                            {
                                if (sAttach != "")
                                {
                                    sAttach += "&nbsp;&nbsp;&nbsp;";
                                }

                                string sTarget     = Mediachase.IBN.Business.Common.OpenInNewWindow(fl.FileBinaryContentType) ? " target='_blank'" : "";
                                string sLink       = Mediachase.UI.Web.Util.CommonHelper.GetAbsoluteDownloadFilePath(fl.Id, fl.Name, "FileLibrary", "ForumNodeId_" + node.Id);
                                string sNameLocked = Mediachase.UI.Web.Util.CommonHelper.GetLockerText(sLink);

                                sAttach += String.Format("<nobr><a href=\"{1}\"{3}><img src='{4}?IconID={2}' width='16' height='16' border=0 align=absmiddle> {0}</a> {5}</nobr>",
                                                         fl.Name,
                                                         sLink,
                                                         fl.FileBinaryContentTypeId,
                                                         sTarget,
                                                         ResolveClientUrl("~/Common/ContentIcon.aspx"),
                                                         sNameLocked
                                                         );
                            }
                        }
                    }
                }

                dr["Attachments"] = sAttach;
                #endregion

                if (sMessage.Length > 0 && dr["Message"].ToString() == "" && sAttach.Length == 0)
                {
                    dr["NodeType"] = String.Format("<img src='{0}' width='16' height='16' align=absmiddle alt='{1}'>",
                                                   ResolveClientUrl("~/layouts/images/icons/info_message.gif"),
                                                   LocRM.GetString("NodeType_InfoMessage"));
                    dr["CanMakeResolution"]   = false;
                    dr["CanMakeWorkaround"]   = false;
                    dr["CanUnMakeResolution"] = false;
                    dr["CanUnMakeWorkaround"] = false;
                }

                if (dr["Message"].ToString().Trim() == "")
                {
                    dr["Message"] = "&nbsp;";
                }
                dr["Index"] = "<table cellspacing='0' border='0' width='100%'><tr><td class='text' align='center' style='BACKGROUND-POSITION: center center; BACKGROUND-IMAGE: url(../../../layouts/images/atrisk1.gif); BACKGROUND-REPEAT: no-repeat;padding:4px;'><b>" + (++_index).ToString() + "</b></td></tr></table>";
                dt.Rows.Add(dr);
            }

            DataView dv = dt.DefaultView;
            dv.Sort = "CreationDate";

            dgForum.DataSource = dv;

            if (dv.Count == 0)
            {
                dgForum.Visible          = false;
                dgForum.CurrentPageIndex = 0;
                divNoMess.Visible        = true;

                divNoMess.InnerHtml = "<font color='red'>" + LocRM.GetString("NoMessages") + "</font>";
            }
            else
            {
                dgForum.Visible   = true;
                divNoMess.Visible = false;

                int ppi = dv.Count / dgForum.PageSize;
                if (dv.Count % dgForum.PageSize == 0)
                {
                    ppi = ppi - 1;
                }

                if (ViewState["IncidentForum_Page"] != null)
                {
                    int iPageIndex = int.Parse(ViewState["IncidentForum_Page"].ToString());

                    if (iPageIndex <= ppi)
                    {
                        dgForum.CurrentPageIndex = iPageIndex;
                    }
                    else
                    {
                        dgForum.CurrentPageIndex = ppi;
                    }

                    ViewState["IncidentForum_Page"] = dgForum.CurrentPageIndex.ToString();
                }
                else
                {
                    dgForum.CurrentPageIndex = ppi;
                }
            }
            dgForum.DataBind();

            foreach (DataGridItem dgi in dgForum.Items)
            {
                ImageButton ib = (ImageButton)dgi.FindControl("ibDelete");
                if (ib != null)
                {
                    ib.ToolTip = LocRM.GetString("Delete");
                    ib.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("WarningForumNode") + "')");
                    ib.Visible = CanUpdate;
                }
                ImageButton ib1 = (ImageButton)dgi.FindControl("ibResolution");
                if (ib1 != null)
                {
                    ib1.ToolTip = LocRM.GetString("tMarkAsResolution");
                    ib1.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("tMarkAsResolutionWarning") + "')");
                }
                ImageButton ib2 = (ImageButton)dgi.FindControl("ibWA");
                if (ib2 != null)
                {
                    ib2.ToolTip = LocRM.GetString("tMarkAsWA");
                    ib2.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("tMarkAsWAWarning") + "')");
                }
                ImageButton ib3 = (ImageButton)dgi.FindControl("ibUnResolution");
                if (ib3 != null)
                {
                    ib3.ToolTip = LocRM.GetString("tUnMarkAsResolution");
                    ib3.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("tUnMarkAsResolutionWarning") + "')");
                }
                ImageButton ib4 = (ImageButton)dgi.FindControl("ibUnWA");
                if (ib4 != null)
                {
                    ib4.ToolTip = LocRM.GetString("tUnMarkAsWA");
                    ib4.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("tUnMarkAsWAWarning") + "')");
                }
                ImageButton ib5 = (ImageButton)dgi.FindControl("ibReSend");
                if (ib5 != null)
                {
                    ib5.ToolTip = LocRM.GetString("tReSend");
                    ib5.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("tReSendWarning") + "')");
                }
                ImageButton ib6 = (ImageButton)dgi.FindControl("ibReSendOut");
                if (ib6 != null)
                {
                    ib6.ToolTip = LocRM.GetString("tReSend");
                    ib6.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("tReSendOutWarning") + "')");
                }
                ImageButton ib7 = (ImageButton)dgi.FindControl("ibReply");
                if (ib7 != null)
                {
                    ib7.ToolTip = LocRM.GetString("tReply");
                    if (!allowEMailRouting || (pc["IncForum_ReplyOutlook"] == "0" && pc["IncForum_ReplyEML"] == "0"))
                    {
                        string scommand = String.Format("{{ShowResizableWizard('{0}?IncidentId={1}&NodeId={2}&send=1&back={3}', 800, 600);return false;}}",
                                                        ResolveClientUrl("~/Incidents/AddEMailMessage.aspx"),
                                                        IncidentId,
                                                        ib7.CommandArgument,
                                                        HttpUtility.UrlEncode(this.Page.Request.RawUrl));
                        ib7.Attributes.Add("onclick", scommand);
                    }
                }
            }
        }
Exemplo n.º 14
0
        private void BindToolbar()
        {
            secHeader.Title = LocRM.GetString("tbView");

            bool canUpdate       = Incident.CanUpdate(IncidentId);
            bool canAddToDoBox   = Incident.CanAddToDo(IncidentId);
            bool canAddResBox    = Incident.CanModifyResources(IncidentId);
            bool canViewFinances = Incident.CanViewFinances(IncidentId);
            bool canDelete       = Incident.CanDelete(IncidentId);
            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;

            CommandManager cm = null;

            if (!Security.CurrentUser.IsExternal)
            {
                cm = CommandManager.GetCurrent(this.Page);
            }
            CommandParameters cp  = new CommandParameters();
            string            cmd = String.Empty;

            #region Create ToDo
            if (canAddToDoBox && !isExternal)
            {
                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?IncidentId=" + IncidentId;
                subItem.Text = LocRM.GetString("tbAdd");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Edit: Incident, GeneralInfo, ResolutionInfo, Status
            if (canUpdate)
            {
                ComponentArt.Web.UI.MenuItem editItem = new ComponentArt.Web.UI.MenuItem();
                editItem.Text = LocRM.GetString("tbViewEdit");
                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 Incident
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/incident_edit.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.NavigateUrl         = "../Incidents/IncidentEdit.aspx?IncidentId=" + IncidentId + "&Back=incident";
                subItem.Text = LocRM.GetString("EditIssue");
                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
                if (PortalConfig.CommonIncidentAllowEditGeneralCategoriesField ||
                    PortalConfig.IncidentAllowEditIncidentCategoriesField)
                {
                    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

                /*
                 #region Edit State Info
                 * subItem = new ComponentArt.Web.UI.MenuItem();
                 * subItem.ClientSideCommand = "javascript:ShowWizard('EditStateInfo.aspx?ProjectId=" + ProjectId + "', 350, 250);";
                 * subItem.Text = LocRM.GetString("EditStateInfo");
                 * editItem.Items.Add(subItem);
                 #endregion
                 *
                 */
                topMenuItem.Items.Add(editItem);
            }
            #endregion

            #region Modyfy Recipients
            if (!isExternal && Mediachase.IBN.Business.Incident.CanUpdateExternalRecipients(IncidentId))
            {
                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);
                cp  = new CommandParameters("MC_HDM_RecipEdit");
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                //subItem.ClientSideCommand = "javascript:ShowWizard('RecipientsEditor.aspx?IncidentId=" + IncidentId + "', 450, 350);";
                subItem.Text = LocRM.GetString("AddRecipients");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Modyfy Resources
            if (canAddResBox && !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);
                cp  = new CommandParameters("MC_HDM_ResEdit");
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                //subItem.ClientSideCommand = "javascript:ShowWizard('ResourcesEditor.aspx?IncidentId=" + IncidentId + "', 650, 350);";
                subItem.Text = LocRM.GetString("AddResources");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Delete
            if (canDelete)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/incident_delete.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.ClientSideCommand   = "javascript:DeleteIncident()";
                subItem.Text = LocRM.GetString("Delete");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region MarkAsSpam
            if (canDelete)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/red_denied.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                cp  = new CommandParameters("MC_HDM_MarkAsSpam");
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                subItem.Text = GetGlobalResourceObject("IbnFramework.Incident", "MarkAsSpam").ToString();
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region --- Seperator ---
            if (topMenuItem.Items.Count > 0)
            {
                subItem        = new ComponentArt.Web.UI.MenuItem();
                subItem.LookId = "BreakItem";
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Copy to Clipboard
            if (!isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/xp-copy.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.ClientSideCommand   = "javascript:try{_XMLReqForClip('AddClip=Issue&IncidentId=" + IncidentId.ToString() + "', '" + LocRM2.GetString("tXMLError") + "')}catch(e){}";
                subItem.Text = LocRM.GetString("tCopyToClipboard");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Add from Clipboard
            if (canUpdate && !isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/xp-paste.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                cp  = new CommandParameters("MC_HDM_RelatedIssClip");
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                subItem.Text = LocRM.GetString("tPasteFromClipboard");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Clear Clipboard
            if (canUpdate && !isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/clearbuffer.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.ClientSideCommand   = "javascript:try{_XMLReqForClip('ClearClip=Issue', '" + LocRM2.GetString("tXMLError") + "')}catch(e){}";
                subItem.Text = LocRM2.GetString("tClearClipboard");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region --- Seperator ---
            if (topMenuItem.Items.Count > 0)
            {
                subItem        = new ComponentArt.Web.UI.MenuItem();
                subItem.LookId = "BreakItem";
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Add Related Issue
            if (canUpdate && !isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/relincidents.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);

                cp  = new CommandParameters("MC_HDM_RelatedIss");
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                //subItem.ClientSideCommand = String.Format("javascript:OpenPopUpNoScrollWindow(\"../Common/SelectIncident.aspx?btn={0}&exclude={1}\", 640, 480);",
                //    Page.ClientScript.GetPostBackEventReference(btnAddRelatedIss, "xxxtypeid;xxxid"), IncidentId.ToString());
                subItem.Text = LocRM.GetString("tAdd");
                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}?IncidentId={1}', {2});",
             *        sPath, IncidentId, (Security.CurrentUser.IsExternal) ? "800,600" : "450, 200");
             *      subItem.Text = LocRM.GetString("tbAddTimeSheet");
             *      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);", IncidentId, (int)ObjectTypes.Issue);
                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);", IncidentId, (int)ObjectTypes.Issue);
                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}", IncidentId, ((int)ObjectTypes.Issue).ToString());
                subItem.Text = LocRM2.GetString("SystemNotifications");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region Favorites
            if (!Incident.CheckFavorites(IncidentId) && !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

            #region PrintPreviewSettings
            if (!isExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/printPreviewButton.png";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                cp = new CommandParameters("MC_HDM_PrintPreviewSettings");
                cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
                cp.AddCommandArgument("IncidentId", IncidentId.ToString());
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                subItem.Text = LocRM.GetString("PrintSettings");
                topMenuItem.Items.Add(subItem);

                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/print.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                cp = new CommandParameters("MC_HDM_PrintIssue");
                cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
                cp.AddCommandArgument("IncidentId", IncidentId.ToString());
                cmd = cm.AddCommand("Incident", "", "IncidentView", cp);
                cmd = cmd.Replace("\"", "&quot;");
                subItem.ClientSideCommand = "javascript:" + cmd;
                subItem.Text = LocRM.GetString("PrintIssue");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            if (topMenuItem.Items.Count > 0)
            {
                secHeader.ActionsMenu.Items.Add(topMenuItem);
            }
        }
Exemplo n.º 15
0
        private void BindDataGrid()
        {
            DataTable dtTop = new DataTable();
            DataRow   dr;

            dtTop.Columns.Add(new DataColumn("Id", typeof(int)));
            dtTop.Columns.Add(new DataColumn("Index", typeof(string)));
            dtTop.Columns.Add(new DataColumn("EMailMessageId", typeof(int)));
            dtTop.Columns.Add(new DataColumn("Weight", typeof(int)));
            dtTop.Columns.Add(new DataColumn("Sender", typeof(string)));
            dtTop.Columns.Add(new DataColumn("Message", typeof(string)));
            dtTop.Columns.Add(new DataColumn("SystemMessage", typeof(string)));
            dtTop.Columns.Add(new DataColumn("Created", typeof(string)));
            dtTop.Columns.Add(new DataColumn("CreationDate", typeof(DateTime)));
            dtTop.Columns.Add(new DataColumn("Attachments", typeof(string)));
            dtTop.Columns.Add(new DataColumn("NodeType", typeof(string)));
            dtTop.Columns.Add(new DataColumn("CanMakeResolution", typeof(bool)));
            dtTop.Columns.Add(new DataColumn("CanMakeWorkaround", typeof(bool)));
            dtTop.Columns.Add(new DataColumn("CanUnMakeResolution", typeof(bool)));
            dtTop.Columns.Add(new DataColumn("CanUnMakeWorkaround", typeof(bool)));
            dtTop.Columns.Add(new DataColumn("CanReSend", typeof(bool)));
            dtTop.Columns.Add(new DataColumn("CanReSendOut", typeof(bool)));
            dtTop.Columns.Add(new DataColumn("CanReply", typeof(bool)));

            DataTable dt = dtTop.Clone();

            IncidentBox incidentBox = IncidentBox.Load(Incident.GetIncidentBox(IncidentId));
            EMailRouterIncidentBoxBlock settings = IncidentBoxDocument.Load(incidentBox.IncidentBoxId).EMailRouterBlock;
            bool allowEMailRouting = settings.AllowEMailRouting;
            bool CanUpdate         = Incident.CanUpdate(IncidentId);

            int _index = 0;

            foreach (ForumThreadNodeInfo node in Incident.GetForumThreadNodes(IncidentId))
            {
                bool   fl_IsTop = false;
                int    iWeight  = 3;
                string typeName = "internal";
                ForumThreadNodeSettingCollection coll = new ForumThreadNodeSettingCollection(node.Id);
                if (coll[ForumThreadNodeSetting.Question] != null)
                {
                    if (pc["IncForum_Quests458"] == "1")
                    {
                        fl_IsTop = true;
                        iWeight  = 0;
                    }
                    if (coll[ForumThreadNodeSetting.Incoming] != null)
                    {
                        typeName = "Mail_incoming_quest";
                    }
                    else if (coll[ForumThreadNodeSetting.Outgoing] != null)
                    {
                        typeName = "Mail_outgoing_quest";
                    }
                    else
                    {
                        typeName = "internal_quest";
                    }
                }
                else if (coll[ForumThreadNodeSetting.Resolution] != null)
                {
                    if (pc["IncForum_Resol458"] == "1")
                    {
                        fl_IsTop = true;
                        iWeight  = 1;
                    }
                    if (coll[ForumThreadNodeSetting.Incoming] != null)
                    {
                        typeName = "Mail_incoming_resol";
                    }
                    else if (coll[ForumThreadNodeSetting.Outgoing] != null)
                    {
                        typeName = "Mail_outgoing_resol";
                    }
                    else
                    {
                        typeName = "internal_resol";
                    }
                }
                else if (coll[ForumThreadNodeSetting.Workaround] != null)
                {
                    if (pc["IncForum_Work458"] == "1")
                    {
                        fl_IsTop = true;
                        iWeight  = 2;
                    }
                    if (coll[ForumThreadNodeSetting.Incoming] != null)
                    {
                        typeName = "Mail_incoming_wa";
                    }
                    else if (coll[ForumThreadNodeSetting.Outgoing] != null)
                    {
                        typeName = "Mail_outgoing_wa";
                    }
                    else
                    {
                        typeName = "internal_wa";
                    }
                }
                else if (coll[ForumThreadNodeSetting.Incoming] != null)
                {
                    typeName = "Mail_incoming";
                }
                else if (coll[ForumThreadNodeSetting.Outgoing] != null)
                {
                    typeName = "Mail_outgoing";
                }

                if (fl_IsTop)
                {
                    dr = dtTop.NewRow();
                }
                else
                {
                    dr = dt.NewRow();
                }
                dr["Weight"] = iWeight;

                dr["Id"]                  = node.Id;
                dr["EMailMessageId"]      = node.EMailMessageId;
                dr["CanMakeResolution"]   = false;
                dr["CanMakeWorkaround"]   = false;
                dr["CanUnMakeResolution"] = false;
                dr["CanUnMakeWorkaround"] = false;
                dr["CanReply"]            = false;
                dr["CanReSend"]           = false;
                dr["CanReSendOut"]        = false;
                switch (typeName)
                {
                case "internal_resol":
                case "Mail_incoming_resol":
                case "Mail_outgoing_resol":
                    dr["CanUnMakeResolution"] = true;
                    break;

                case "internal_wa":
                case "Mail_incoming_wa":
                case "Mail_outgoing_wa":
                    dr["CanMakeResolution"]   = true;
                    dr["CanUnMakeWorkaround"] = true;
                    break;

                case "internal":
                case "Mail_incoming":
                case "Mail_outgoing":
                    dr["CanMakeResolution"] = true;
                    dr["CanMakeWorkaround"] = true;
                    break;

                default:
                    break;
                }
                if (coll[ForumThreadNodeSetting.Outgoing] != null && !Security.CurrentUser.IsExternal)
                {
                    dr["CanReSendOut"] = true;
                    ///AK test
                    //dr["CanReply"] = true;
                    ///
                }
                if (coll[ForumThreadNodeSetting.Incoming] != null && !Security.CurrentUser.IsExternal)
                {
                    dr["CanReply"]  = true;
                    dr["CanReSend"] = allowEMailRouting;
                }

                if (node.EMailMessageId <= 0)
                {
                    dr["Sender"] = CommonHelper.GetUserStatus(node.CreatorId);
                }

                dr["Created"]      = node.Created.ToShortDateString() + " " + node.Created.ToShortTimeString();
                dr["CreationDate"] = node.Created;

                string sNodeType = typeName;
                try
                {
                    sNodeType = LocRM.GetString(String.Format("NodeType_{0}", typeName));
                }
                catch
                {
                }

                dr["NodeType"]      = String.Format("<img alt='{1}' src='../Layouts/Images/icons/{0}.gif'/>", typeName, sNodeType);
                dr["SystemMessage"] = "&nbsp;";

                string sMessage = "";

                if (coll[IncidentForum.IssueEvent.Declining.ToString()] != null)
                {
                    sMessage = String.Format("<font color='red'><b>{0}</b></font>",
                                             LocRM.GetString("tUserDeclined"));
                }

                if (coll[IncidentForum.IssueEvent.State.ToString()] != null)
                {
                    int stateId = int.Parse(coll[IncidentForum.IssueEvent.State.ToString()].ToString());
                    if (sMessage == "")
                    {
                        sMessage = String.Format("{2}: <font color='{0}'><b>{1}</b></font>",
                                                 Util.CommonHelper.GetStateColorString(stateId),
                                                 GetStatusName(stateId),
                                                 LocRM.GetString("Status"));
                    }
                    else
                    {
                        sMessage += String.Format("{2}: <font color='{0}'><b>{1}</b></font>",
                                                  Util.CommonHelper.GetStateColorString(stateId),
                                                  GetStatusName(stateId),
                                                  LocRM.GetString("Status"));
                    }
                }

                if (coll[IncidentForum.IssueEvent.Responsibility.ToString()] != null)
                {
                    string sResp = "";

                    int iResp = int.Parse(coll[IncidentForum.IssueEvent.Responsibility.ToString()].ToString());
                    if (iResp == -2)
                    {
                        sResp = String.Format("<img alt='' src='{0}'/> <span style='color:#808080;font-weight:bold'>{1}</span>",
                                              ResolveUrl("~/Layouts/Images/not_set.png"),
                                              LocRM.GetString("tRespNotSet"));
                    }
                    else if (iResp == -1)
                    {
                        sResp = String.Format("<img alt='' src='{0}'/> <span style='color:green;font-weight:bold'>{1}</span>",
                                              ResolveUrl("~/Layouts/Images/waiting.gif"),
                                              LocRM.GetString("tRespGroup"));
                    }
                    else
                    {
                        sResp = Util.CommonHelper.GetUserStatus(iResp);
                    }

                    sResp = "<span class='IconAndText'><span>" + LocRM.GetString("tResponsible") + ":</span> " + sResp + "</span>";

                    if (sMessage == "")
                    {
                        sMessage = sResp;
                    }
                    else
                    {
                        sMessage += "<br/>" + sResp;
                    }
                }

                if (WasFarwarded == 1 && node.EMailMessageId == ForwardedEMail)
                {
                    sMessage = "<font color='green'><b>" + LocRM.GetString("tWasResended") + "</b></font><br/>" + sMessage;
                }

                if (WasFarwarded == -1 && node.EMailMessageId == ForwardedEMail)
                {
                    sMessage = "<font color='red'><b>" + LocRM.GetString("tWasNotResended") + "</b></font><br/>" + sMessage;
                }

                dr["SystemMessage"] = (sMessage.Length == 0) ? "&nbsp;" : sMessage;

                string sAttach = "";

                // EmailMessage
                if (node.EMailMessageId > 0)
                {
                    EMailMessageInfo mi = null;
                    try
                    {
                        mi = EMailMessageInfo.Load(node.EMailMessageId);
                        int iUserId = User.GetUserByEmail(mi.SenderEmail);

                        if (EMailClient.IsAlertSenderEmail(mi.SenderEmail))
                        {
                            iUserId = node.CreatorId;                             //User.GetUserByEmail(mi.SenderEmail);
                        }
                        if (iUserId > 0)
                        {
                            dr["Sender"] = Util.CommonHelper.GetUserStatus(iUserId);
                        }
                        else
                        {
                            Client client = Mediachase.IBN.Business.Common.GetClient(mi.SenderEmail);
                            if (client != null)
                            {
                                if (client.IsContact)
                                {
                                    dr["Sender"] = CommonHelper.GetContactLink(this.Page, client.Id, client.Name);
                                }
                                else
                                {
                                    dr["Sender"] = CommonHelper.GetOrganizationLink(this.Page, client.Id, client.Name);
                                }
                            }
                            else if (mi.SenderName != "")
                            {
                                dr["Sender"] = CommonHelper.GetEmailLink(mi.SenderEmail, mi.SenderName);
                            }
                            else
                            {
                                dr["Sender"] = CommonHelper.GetEmailLink(mi.SenderEmail, mi.SenderEmail);
                            }
                        }

                        string sBody = "";
                        if (mi.HtmlBody != null)
                        {
                            int iMaxLen = 256;
                            sBody = mi.HtmlBody;
                            if (!Security.CurrentUser.IsExternal && pc["IncForum_FullMess"] != "1")
                            {
                                sBody = EMailMessageInfo.CutHtmlBody(mi.HtmlBody, iMaxLen, "...");
                            }
                        }

                        if (pc["IncForum_FullMess"] != "1")
                        {
                            dr["Message"] = String.Format("{0}<div class='text' style='text-align:right; font-weight:bold'><a href='javascript:OpenMessage({2},{3},false)'>{1}</a></div>", sBody, LocRM.GetString("More"), node.Id, node.EMailMessageId);
                        }
                        else
                        {
                            dr["Message"] = sBody;
                        }

                        // Attachments
                        for (int i = 0; i < mi.Attachments.Length; i++)
                        {
                            AttachmentInfo ai    = mi.Attachments[i];
                            int            id    = DSFile.GetContentTypeByFileName(ai.FileName);
                            string         sIcon = "";
                            if (id > 0)
                            {
                                sIcon = String.Format("<img alt='' src='{0}'/>", ResolveUrl("~/Common/ContentIcon.aspx?IconID=" + id));
                            }
                            //sAttach += String.Format("<nobr><a href='{0}'{2}>{1}</a></nobr> &nbsp;&nbsp;",
                            //  ResolveUrl("~/Incidents/EmailAttachDownload.aspx") + "?EMailId=" + node.EMailMessageId.ToString() + "&AttachmentIndex=" + i.ToString(),
                            //  sIcon + "&nbsp;" + ai.FileName,
                            //  Mediachase.IBN.Business.Common.OpenInNewWindow(ai.ContentType) ? " target='_blank'" : "");
                            sAttach += String.Format("<a href='{0}'{2} style='white-space:nowrap'>{1}</a> &nbsp;&nbsp;", WebDavUrlBuilder.GetEmailAtachWebDavUrl(node.EMailMessageId, i, true),
                                                     sIcon + "&nbsp;" + ai.FileName, Mediachase.IBN.Business.Common.OpenInNewWindow(ai.ContentType) ? " target='_blank'" : "");
                        }
                    }
                    catch
                    {
                        dr["Sender"]  = Util.CommonHelper.GetUserStatus(-1);
                        dr["Message"] = String.Format("<font color='red'><b>{0}</b>&nbsp;(#{1})</font>", LocRM.GetString("tNotFound"), node.EMailMessageId);
                    }
                }
                else
                {
                    string sBody = CommonHelper.parsetext_br(node.Text, false);
                    dr["Message"] = sBody;
                    if (!Security.CurrentUser.IsExternal && pc["IncForum_FullMess"] != "1")
                    {
                        int    iMaxLen = 300;
                        string sBody1  = sBody;
                        sBody = EMailMessageInfo.CutHtmlBody(sBody, iMaxLen, "...");

                        if (!sBody.Equals(sBody1))
                        {
                            dr["Message"] = String.Format("{0}<div class='text' style='text-align:right; font-weight:bold'><a href=\"javascript:OpenMessage({2},-1,true)\">{1}</a></div>", sBody, LocRM.GetString("More"), node.Id);
                        }
                    }

                    // Files
                    if (node.ContentType == ForumStorage.NodeContentType.TextWithFiles)
                    {
                        FileInfo[] files = Incident.GetForumNodeFiles(node.Id);
                        if (files.Length > 0)
                        {
                            foreach (FileInfo fl in files)
                            {
                                if (sAttach != "")
                                {
                                    sAttach += "&nbsp;&nbsp;&nbsp;";
                                }

                                string sTarget = Mediachase.IBN.Business.Common.OpenInNewWindow(fl.FileBinaryContentType) ? " target='_blank'" : "";
                                //string sLink = Util.CommonHelper.GetAbsolutePath(WebDavFileUserTicket.GetDownloadPath(fl.Id, fl.Name));
                                string sLink       = Util.CommonHelper.GetAbsoluteDownloadFilePath(fl.Id, fl.Name, "FileLibrary", "ForumNodeId_" + node.Id);
                                string sNameLocked = CommonHelper.GetLockerText(sLink);
                                sAttach += String.Format("<span style='white-space:nowrap'><a href=\"{1}\"{3}><img alt='' src='../Common/ContentIcon.aspx?IconID={2}'/> {0}</a> {4}</span>", fl.Name, sLink, fl.FileBinaryContentTypeId, sTarget, sNameLocked);
                            }
                        }
                    }
                }

                dr["Attachments"] = sAttach;

                if (sMessage.Length > 0 && dr["Message"].ToString() == "" && sAttach.Length == 0)
                {
                    if (pc["IncForum_Info"] == "0")
                    {
                        continue;
                    }
                    dr["NodeType"]            = String.Format("<img src='../Layouts/Images/icons/info_message.gif' alt='{1}'/>", typeName, LocRM.GetString("NodeType_InfoMessage"));
                    dr["CanMakeResolution"]   = false;
                    dr["CanMakeWorkaround"]   = false;
                    dr["CanUnMakeResolution"] = false;
                    dr["CanUnMakeWorkaround"] = false;
                }

                if (dr["Message"].ToString().Trim() == "")
                {
                    dr["Message"] = "&nbsp;";
                }
                if (pc["IncForum_ShowNums"] == "1")
                {
                    dr["Index"] = "<table cellspacing='0' cellpadding='4' border='0' width='100%'><tr><td class='text' align='center' style='background-position: center center; background-image: url(../Layouts/Images/atrisk1.gif); background-repeat: no-repeat'><b>" + (++_index).ToString() + "</b></td></tr></table>";
                }
                else
                {
                    dr["Index"] = "&nbsp;";
                }

                if (fl_IsTop)
                {
                    dtTop.Rows.Add(dr);
                }
                else
                {
                    dt.Rows.Add(dr);
                }
            }

            DataRow[] drtop   = dtTop.Select("", "Weight, CreationDate");
            DataRow[] drother = dt.Select("", pc["IncForum_Sort458"]);

            DataTable result = dt.Clone();

            foreach (DataRow dr1 in drtop)
            {
                DataRow _dr = result.NewRow();
                _dr.ItemArray = (Object[])dr1.ItemArray.Clone();
                result.Rows.Add(_dr);
            }
            foreach (DataRow dr2 in drother)
            {
                DataRow _dr = result.NewRow();
                _dr.ItemArray = (Object[])dr2.ItemArray.Clone();
                result.Rows.Add(_dr);
            }

            DataView dv = result.DefaultView;

            dgForum.DataSource = dv;

            if (pc["IncidentForum_PageSize"] != null)
            {
                dgForum.PageSize = int.Parse(pc["IncidentForum_PageSize"]);
            }

            if (pc["IncidentForum_Page"] != null)
            {
                int iPageIndex = int.Parse(pc["IncidentForum_Page"]);
                int ppi        = dv.Count / dgForum.PageSize;
                if (dv.Count % dgForum.PageSize == 0)
                {
                    ppi = ppi - 1;
                }
                if (iPageIndex <= ppi)
                {
                    dgForum.CurrentPageIndex = iPageIndex;
                }
                else
                {
                    dgForum.CurrentPageIndex = 0;
                }

                pc["IncidentForum_Page"] = dgForum.CurrentPageIndex.ToString();
            }

            dgForum.DataBind();
            foreach (DataGridItem dgi in dgForum.Items)
            {
                ImageButton ib = (ImageButton)dgi.FindControl("ibDelete");
                if (ib != null)
                {
                    ib.ToolTip = LocRM.GetString("Delete");
                    ib.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("WarningForumNode") + "')");
                    ib.Visible = CanUpdate;
                }
                ImageButton ib1 = (ImageButton)dgi.FindControl("ibResolution");
                if (ib1 != null)
                {
                    ib1.ToolTip = LocRM.GetString("tMarkAsResolution");
                    ib1.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("tMarkAsResolutionWarning") + "')");
                }
                ImageButton ib2 = (ImageButton)dgi.FindControl("ibWA");
                if (ib2 != null)
                {
                    ib2.ToolTip = LocRM.GetString("tMarkAsWA");
                    ib2.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("tMarkAsWAWarning") + "')");
                }
                ImageButton ib3 = (ImageButton)dgi.FindControl("ibUnResolution");
                if (ib3 != null)
                {
                    ib3.ToolTip = LocRM.GetString("tUnMarkAsResolution");
                    ib3.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("tUnMarkAsResolutionWarning") + "')");
                }
                ImageButton ib4 = (ImageButton)dgi.FindControl("ibUnWA");
                if (ib4 != null)
                {
                    ib4.ToolTip = LocRM.GetString("tUnMarkAsWA");
                    ib4.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("tUnMarkAsWAWarning") + "')");
                }
                ImageButton ib5 = (ImageButton)dgi.FindControl("ibReSend");
                if (ib5 != null)
                {
                    ib5.ToolTip = LocRM.GetString("tReSend");
                    ib5.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("tReSendWarning") + "')");
                }
                ImageButton ib6 = (ImageButton)dgi.FindControl("ibReSendOut");
                if (ib6 != null)
                {
                    ib6.ToolTip = LocRM.GetString("tReSend");
                    ib6.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("tReSendOutWarning") + "')");
                }
                ImageButton ib7 = (ImageButton)dgi.FindControl("ibReply");
                if (ib7 != null)
                {
                    ib7.ToolTip = LocRM.GetString("tReply");
                    if (!allowEMailRouting || (pc["IncForum_ReplyOutlook"] == "0" && pc["IncForum_ReplyEML"] == "0"))
                    {
                        string command = string.Format(CultureInfo.InvariantCulture,
                                                       "{{ShowResizableWizard('{0}?IncidentId={1}&NodeId={2}&send=1',800,600);return false;}}",
                                                       Page.ResolveUrl("~/Incidents/AddEMailMessage.aspx"), IncidentId, ib7.CommandArgument);
                        ib7.Attributes.Add("onclick", command);
                    }
                }
            }

            if (dgForum.Items.Count == 0)
            {
                dgForum.Visible   = false;
                divNoMess.Visible = true;

                divNoMess.InnerHtml = "<span style='color:red'>" + LocRM.GetString("NoMessages") + "</span>";
            }
            else
            {
                dgForum.Visible   = true;
                divNoMess.Visible = false;
            }
        }