private string GetUserFullName(long userid) { string retval = string.Empty; UserAPI objUserAPI = new UserAPI(); UserData objUserData = objUserAPI.GetActiveUserById(userid, false); retval = objUserData.FirstName + " " + objUserData.LastName; return retval; }
public string MakeUserTaskEmailLink2(Ektron.Cms.Content.EkTask taskObj, bool blnShowFullName) { string returnValue; UserAPI objUserAPI = new UserAPI(); UserData objUserData = new UserData(); string strUserFullName; objUserData = objUserAPI.GetActiveUserById(taskObj.AssignedToUserID, false); strUserFullName = objUserData.FirstName + " " + objUserData.LastName; if (blnShowFullName == false) { if (IsLoggedInUsersEmailValid()) { returnValue = "<a href=\"#\"" + "onclick=\"LoadEmailChildPage(\'userid=" + taskObj.AssignedToUserID + MakeNotes_Email("Task", taskObj.TaskTitle) + "\')\"" + " title=\'" + gtMessEmail.GetMessage("alt send email to") + " \"" + strUserFullName.Replace("\'", "`") + "\"" + "\'>" + taskObj.AssignedToUser + " " + MakeEmailGraphic() + "</a>"; } else { returnValue = taskObj.AssignedToUser; } } else { if (IsLoggedInUsersEmailValid()) { returnValue = "<a href=\"#\"" + "onclick=\"LoadEmailChildPage(\'userid=" + taskObj.AssignedToUserID + MakeNotes_Email("Task", taskObj.TaskTitle) + "\')\"" + " title=\'" + gtMessEmail.GetMessage("alt send email to") + " \"" + strUserFullName.Replace("\'", "`") + "\"" + "\'>" + strUserFullName + " (" + taskObj.AssignedToUser + ")" + " " + MakeEmailGraphic() + "</a>"; } else { returnValue = strUserFullName + " (" + taskObj.AssignedToUser + ")"; } } return returnValue; }
private void Populate_ViewForumPostsByCategoryGrid(DiscussionTopic[] topics, ArrayList commenttally) { System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn(); UserAPI objUserAPI = new UserAPI(); UserData objUserData = new UserData(); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "APPROVAL"; colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.Width = System.Web.UI.WebControls.Unit.Pixel(12); FolderDataGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "TOPIC"; colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.CssClass = "left"; colBound.HeaderText = _MessageHelper.GetMessage("lbl Topic"); FolderDataGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "STARTER"; colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.Width = System.Web.UI.WebControls.Unit.Pixel(80); colBound.HeaderText = _MessageHelper.GetMessage("topicstarter text"); FolderDataGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "REPLIES"; colBound.HeaderStyle.CssClass = "title-header"; colBound.HeaderText = _MessageHelper.GetMessage("lbl replies"); colBound.HeaderStyle.HorizontalAlign = HorizontalAlign.Center; FolderDataGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "VIEWS"; colBound.HeaderStyle.CssClass = "title-header"; colBound.HeaderText = _MessageHelper.GetMessage("views lbl"); FolderDataGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "LASTPOST"; colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.Width = System.Web.UI.WebControls.Unit.Pixel(200); colBound.HeaderText = _MessageHelper.GetMessage("lbl Last Reply"); FolderDataGrid.Columns.Add(colBound); FolderDataGrid.ShowHeader = true; DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add(new DataColumn("APPROVAL", typeof(string))); dt.Columns.Add(new DataColumn("TOPIC", typeof(string))); dt.Columns.Add(new DataColumn("STARTER", typeof(string))); dt.Columns.Add(new DataColumn("REPLIES", typeof(string))); dt.Columns.Add(new DataColumn("VIEWS", typeof(string))); dt.Columns.Add(new DataColumn("LASTPOST", typeof(string))); string ViewUrl = ""; string EditUrl = ""; int i; bool bNewComment = false; int iReplyTally = 0; DateTime dtLastPosted = DateTime.Now; for (i = 0; i <= (topics.Length - 1); i++) { if (topics[i].LanguageId == _ContentLanguage | _ContentLanguage == Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES) { dr = dt.NewRow(); //reset these values iReplyTally = 0; bNewComment = false; foreach (ArrayList ctally in commenttally) { if (Convert.ToInt64(ctally[0]) == topics[i].Id) { iReplyTally = System.Convert.ToInt32(ctally[1]); bNewComment = System.Convert.ToBoolean(System.Convert.ToInt32(ctally[2]) < (iReplyTally * 7)); if (iReplyTally > 0) { dtLastPosted = Convert.ToDateTime(ctally[3]); } commenttally.Remove(ctally); // remove so we don't need to go through this again break; } } iReplyTally = topics[i].Replies; if (iReplyTally > 0) { dtLastPosted = topics[i].LastPostedDate; } if ((bNewComment || topics[i].Status.ToUpper() == "I") && (_PermissionData.IsAdmin || _PermissionData.CanAddToImageLib)) { dr[0] = "<img src=\"images/UI/Icons/approvalApproveItem.png\" alt=\"" + this._MessageHelper.GetMessage("lbl approval needed") + "\" title=\"" + this._MessageHelper.GetMessage("lbl approval needed") + "\" />"; } else { dr[0] = ""; } switch (topics[i].Priority) { case Ektron.Cms.Common.EkEnumeration.DiscussionObjPriority.Announcement: dr[1] = "<img title=\"Announcement\" src=\"" + _ContentApi.AppPath + "images/ui/icons/asteriskRed.png\" style=\"margin-right:.25em; vertical-align: middle\" />"; break; case Ektron.Cms.Common.EkEnumeration.DiscussionObjPriority.Sticky: dr[1] = "<img title=\"Sticky Topic\" src=\"" + _ContentApi.AppPath + "images/ui/icons/asteriskYellow.png\" style=\"margin-right:.25em; vertical-align: middle\" />"; break; default: // DiscussionObjPriority.Normal dr[1] = "<img title=\"Topic\" src=\"" + _ContentApi.AppPath + "images/ui/icons/asteriskOrange.png\" style=\"margin-right:.25em; vertical-align: middle\" />"; break; } ViewUrl = (string)("content.aspx?id=" + _Id + "&action=ViewContentByCategory&LangType=" + topics[i].LanguageId + "&ContType=" + Ektron.Cms.Common.EkConstants.CMSContentType_BlogComments + "&contentid=" + topics[i].Id.ToString()); //view posts EditUrl = (string)("content.aspx?action=View&folder_id=" + _Id + "&id=" + topics[i].Id + "&LangType=" + topics[i].LanguageId + "&callerpage=content.aspx&origurl=" + EkFunctions.UrlEncode(Request.ServerVariables["QUERY_STRING"])); //more traditional content view dr[1] += "<a href=\"" + ViewUrl + "\" title=\'" + _MessageHelper.GetMessage("generic View") + " \"" + Strings.Replace((string)(topics[i].Title + "\""), "\'", "`", 1, -1, 0) + "\'" + ">" + topics[i].Title + " </a>"; objUserData = objUserAPI.GetActiveUserById(topics[i].UserId, false); if ((objUserData != null) && (objUserData.Username != "")) { dr[2] = objUserData.Username; } else { dr[2] = topics[i].UserId; } //replies col dr[3] = "<a href=\"" + ViewUrl + "\">" + iReplyTally + "</a>"; //status col dr[4] = topics[i].Views; //last post col if (iReplyTally > 0) { if (dtLastPosted.Date.Equals(DateTime.Now.Date)) { dr[5] = _MessageHelper.GetMessage("lbl today at") + " " + dtLastPosted.ToShortTimeString(); } else if (dtLastPosted.Date.AddDays(1).Equals(DateTime.Now.Date)) { dr[5] = _MessageHelper.GetMessage("lbl yesterday at") + " " + dtLastPosted.ToShortTimeString(); } else { dr[5] = dtLastPosted.ToLongDateString() + " " + dtLastPosted.ToShortTimeString(); } } else { dr[5] = "-"; } dt.Rows.Add(dr); } } DataView dv = new DataView(dt); FolderDataGrid.DataSource = dv; FolderDataGrid.DataBind(); }