private void Page_Load(object sender, EventArgs e) { try { wikiId = Request.QueryString["wikiId"]; wikiPageId = Request.QueryString["wikiPageId"]; contentId = Request.QueryString["contentId"]; } catch { wikiId = "1"; wikiPageId = "1"; } var dataSource = TelligentService.GetAnswers(wikiId, wikiPageId, contentId); AnswerRepeater.DataSource = dataSource; AnswerRepeater.DataBind(); try { lbAnswerCount.Text = dataSource[0].Count; divSortAnswers.Visible = true; if (dataSource[0].Count.AsInt() < 7) { divShowMore.Visible = false; } } catch { lbAnswerCount.Text = "0"; divShowMore.Visible = false; divSortAnswers.Visible = false; } }
public void LoadState(string groupID) { if (!String.IsNullOrEmpty(groupID)) { GroupID = groupID; Text = DictionaryConstants.JoinThisGroupLabel; IsMember = false; try { if (CurrentMember != null) { if (CurrentMember.ScreenName != null) { //Check if user is already joined if (TelligentService.IsUserInGroup(CurrentMember.ScreenName, groupID)) { IsMember = true; Text = DictionaryConstants.ViewDiscussionsLabel; } } } } catch (Exception ex) { Sitecore.Diagnostics.Error.LogError("Error in LoadState function in Join Groups.\nError:\n" + ex.Message); } } }
protected void LikeButton_Click(object sender, EventArgs e) { if (IsUserLoggedIn && !String.IsNullOrEmpty(CurrentMember.ScreenName)) { string contentTypeId = Constants.Settings.TelligentCommentContentTypeId; string contentId = ((HtmlButton)sender).Attributes["commentContentId"]; TelligentService.LikeContent(CurrentMember.ScreenName, contentId, contentTypeId); } //using (var webClient = new WebClient()) //{ // try // { // // replace the "admin" and "Admin's API key" with your valid user and apikey! // var adminKey = String.Format("{0}:{1}", Settings.GetSetting(Constants.Settings.TelligentAdminApiKey), "admin"); // var adminKeyBase64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(adminKey)); // webClient.Headers.Add("Rest-User-Token", adminKeyBase64); // webClient.Headers.Add("Rest-Impersonate-User", this.CurrentMember.ScreenName.Trim()); // var requestUrl = String.Format("{0}api.ashx/v2/likes.xml", Settings.GetSetting(Constants.Settings.TelligentConfig)); // var values = new NameValueCollection(); // values.Add("ContentId", contentId); // values.Add("ContentTypeId", contentTypeId); // var xml = Encoding.UTF8.GetString(webClient.UploadValues(requestUrl, values)); // Console.WriteLine(xml); // } // catch { } //TODO: Add logging //} Response.Redirect(Request.RawUrl); }
protected void Page_Load(object sender, EventArgs e) { Comments = TelligentService.ReadComments(Model.BlogId, Model.BlogPostId); Reviews = CSMUserReviewExtensions.GetReviews(Sitecore.Context.Item.ID.ToGuid()); if (IsUserLoggedIn) { if (Reviews.Where(i => i.MemberId == CurrentMember.MemberId).Count() > 0) { SubmittedReview = true; } } if (!IsPostBack) { BindDropDowns(); BindReviews(); } AssistiveToolsSkillFolderItem issuesFolder = MainsectionItem.GetGlobals().GetIssuesFolder(); rptIssuesChecklist.DataSource = issuesFolder.InnerItem.Children.Select(i => (MetadataItem)i); rptIssuesChecklist.DataBind(); litAverageRating.Text = GetRatingHTML(Int32.Parse(CSMUserReviewExtensions.GetAverageRating(Model.ID.ToGuid()))); rfvGrades.ErrorMessage = DictionaryConstants.ReviewSelectGradeErrorMessage; rfvIThinkItIs.ErrorMessage = DictionaryConstants.ReviewIThinkItIsErrorMessaage; rfvWhatYouThink.ErrorMessage = DictionaryConstants.ReviewWhatYouThinkErrorMessage; rfvReviewTitle.ErrorMessage = DictionaryConstants.ReviewGiveTitleErrorMessage; }
protected void Page_Load(object sender, EventArgs e) { // if (!IsPostBack) // { //TODO: Pull data from notification aggregator // IList<INotification> cnNotifs = TelligentService.ReadFriendshipRequests(CurrentMember.ScreenName); List <INotification> cnNotifs = new List <INotification>(); //if (Notifications != null) // cnNotifs = Notifications; //else cnNotifs = TelligentService.GetNotifications(CurrentMember.ScreenName); //TelligentService.ReadFriendshipRequests("PosesTony"); Notifications = cnNotifs; if (cnNotifs != null && cnNotifs.Count() > 0) { pnlPolulatedNotifs.Visible = true; pnlEmptyNotifs.Visible = false; } else { pnlPolulatedNotifs.Visible = false; pnlEmptyNotifs.Visible = true; } FeedsCollection lnf = new FeedsCollection(cnNotifs); lvNotificationFeed.DataSource = lnf; lvNotificationFeed.DataBind(); // } }
private void ToggleConnectButtons() { if (ProfileMember.allowConnections) { // Controls that require screen name targets ucConnectNarrow.TargetScreenName = ucAnonConnectWide.TargetScreenName = ucMemberConnectWide.TargetScreenName = ucPrivateMessageNarrow.TargetScreenName = ucPrivateMessageWide.TargetScreenName = ScreenName; bool isConnected = (IsUserLoggedIn && !string.IsNullOrEmpty(CurrentMember.ScreenName)) ? TelligentService.IsApprovedFriend(CurrentMember.ScreenName, ScreenName) : false; // Connect/friend button shared with anon and members pnlConnectNarrow.Visible = true; // Connect buttons unique to anon and members pnlMemberConnectWide.Visible = IsUserLoggedIn; pnlAnonConnectWide.Visible = !IsUserLoggedIn; // Friend buttons ucPrivateMessageNarrow.Visible = ucPrivateMessageWide.Visible = IsUserLoggedIn && isConnected; } else { pnlConnectNarrow.Visible = pnlMemberConnectWide.Visible = pnlAnonConnectWide.Visible = ucPrivateMessageNarrow.Visible = ucPrivateMessageWide.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(CurrentMember.ScreenName)) { pnlNoProfile.Visible = true; //TODO: add navigate URL for hypCompleteYourProfile } else { MyAccountItem context = (MyAccountItem)Sitecore.Context.Item; var item = Sitecore.Context.Database.GetItem(Constants.Pages.MyAccountComments); hypCommentsTab.NavigateUrl = Sitecore.Links.LinkManager.GetItemUrl(item); hypCommentsTab.Text = context.SeeAllCommentsText; int totalComments; List <Services.Models.Telligent.Comment> comments = TelligentService.GetUserCommentsByScreenName(CurrentMember.ScreenName, 1, 2, out totalComments); litCount.Text = totalComments.ToString(); if (comments.Any()) { pnlComments.Visible = true; rptComments.DataSource = comments; rptComments.DataBind(); } else { pnlNoComments.Visible = true; } } }
protected void SubmitButton_Click(object sender, EventArgs e) { string body = CommentEntryTextField.Value; string user = ""; try { if (!this.CurrentMember.ScreenName.IsNullOrEmpty()) { user = this.CurrentMember.ScreenName; } } catch { user = "******"; } if (!IsUserLoggedIn) { this.ProfileRedirect(Constants.UserPermission.RegisteredUser); } else if (CurrentMember.ScreenName == null) { this.ProfileRedirect(Constants.UserPermission.CommunityUser); } else { TelligentService.PostAnswer(wikiId, wikiPageId, body, user); Response.Redirect(Request.RawUrl); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <GroupCardModel> grps = new List <GroupCardModel>(); if (IsUserLoggedIn && !String.IsNullOrEmpty(CurrentMember.ScreenName)) { //Check to see user groups grps = TelligentService.GetUserGroups(CurrentMember.ScreenName); if (grps != null && grps.Count > 2) { this.Visible = true; } else { this.Visible = false; return; } } else { this.Visible = false; return; } var rnd = new Random(); // var result = source.OrderBy(item => rnd.Next()); rptMyGroups.DataSource = grps.OrderBy(c => rnd.Next()).Take(2).ToList <GroupCardModel>(); rptMyGroups.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { lnkSeeAll.NavigateUrl = LinkManager.GetItemUrl(Sitecore.Context.Database.GetItem("{F349C92A-9781-4342-A05A-5A793630D7DB}")); List <Question> dataSource = null; if (IsUserLoggedIn && !String.IsNullOrEmpty(CurrentMember.ScreenName)) { dataSource = Questions.FindQuestions(CurrentMember) .Where(question => question != null) .OrderByDescending(question => int.Parse(question.CommentCount)) .ThenByDescending(question => Convert.ToDateTime(question.Date)) .Take(6) .ToList <Question>(); } else { dataSource = Questions.RecentQuestions(6) .Where(question => question != null) .OrderByDescending(question => int.Parse(question.CommentCount)) .ThenByDescending(question => Convert.ToDateTime(question.Date)) .ToList <Question>(); //TelligentService.GetQuestionsList(2, 10); } foreach (Question q in dataSource) { if (q.Body.Length > 100) { q.Body = TelligentService.FormatString100(q.Body) + "..."; } } RecentQuestionsRepeater.DataSource = dataSource; RecentQuestionsRepeater.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { List <GroupCardModel> groupsList = TelligentService.GetUserGroups(CurrentMember.ScreenName); litCount.Text = groupsList != null?groupsList.Count.ToString() : "0"; if (litCount.Text == "0") { litCount.Visible = false; } if (string.IsNullOrEmpty(CurrentMember.ScreenName)) { pnlNoProfile.Visible = true; } else { var item = Sitecore.Context.Database.GetItem(Constants.Pages.MyAccountGroups); MyAccountItem context = (MyAccountItem)Sitecore.Context.Item; hypGroupsTab.NavigateUrl = Sitecore.Links.LinkManager.GetItemUrl(item); hypGroupsTab.Text = context.SeeAllGroupsLinkText; if ((groupsList != null) && (groupsList.Count != 0)) { pnlGroups.Visible = true; rptGroups.DataSource = groupsList.Count < 3 ? groupsList.GetRange(0, groupsList.Count) : groupsList.GetRange(0, 3);; rptGroups.DataBind(); } else { pnlNoGroups.Visible = true; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (CurrentMember.ScreenName == null) { pnlNoProfile.Visible = true; } else { List <GroupCardModel> groupsList = TelligentService.GetUserGroups(CurrentMember.ScreenName); ddlGroups.DataSource = groupsList; ddlGroups.DataValueField = "Url"; ddlGroups.DataTextField = DictionaryConstants.TitleLabel; ddlGroups.DataBind(); if (ddlGroups.Items.Count != 0) { pnlGroups.Visible = true; divStartADiscussion.Visible = true; hypStartADiscussion.NavigateUrl = ddlGroups.SelectedItem.Value + "/MyDiscussion%20Board"; var commentsList = CommunityHelper.ReadComments(); var commentsByGroup = commentsList.Where(x => x.ParentTitle == ddlGroups.SelectedItem.Text); if (commentsList != null) { rptComments.DataSource = commentsByGroup; rptComments.DataBind(); } } else { pnlNoGroups.Visible = true; } } } }
public void LoadState(string userName) { //if user is not open to connections - don't show anything //if other user is not open to connection - don't show anything //if user has sent pending request, show "request sent" //if user has pending request from another user, show "accept / decline" buttons //if user has connected, show "view activity" this.Visible = false; if (!String.IsNullOrEmpty(userName)) { UserName = userName.Trim(); Text = DictionaryConstants.ConnectBtnText; try { if (CurrentMember != null && CurrentMember.ScreenName != null) { //Check if same user if (!CurrentMember.ScreenName.Equals(userName) && MembershipManager.isOpenToConnect(userName) && MembershipManager.isOpenToConnect(CurrentMember.ScreenName)) { //Check friendship Status = TelligentService.IsFriend(CurrentMember.ScreenName, UserName); this.Visible = true; //Set Text Appropriately switch (Status) { case Constants.TelligentFriendStatus.NotSpecified: break; case Constants.TelligentFriendStatus.Pending: Text = DictionaryConstants.RequestSent; break; case Constants.TelligentFriendStatus.Approved: Text = DictionaryConstants.ViewActivity; break; case Constants.TelligentFriendStatus.Recieved: Text = DictionaryConstants.RequestRecieved; break; default: this.Visible = false; break; } } } else { this.Text = DictionaryConstants.ConnectBtnText; } } catch (Exception ex) { Sitecore.Diagnostics.Error.LogError("Error in LoadState function.\nError:\n" + ex.Message); } } }
protected List <BlogPost> InitContent() { BlogPageItem blogPage = Sitecore.Context.Item; string blogId = blogPage.BlogId; List <BlogPost> dataSource = TelligentService.ListBlogPosts(blogId, "100"); foreach (var item in dataSource) { BlogsPostPageItem blogPost; if (item.Title.Contains("{")) { string[] s = item.Title.Split('{'); item.Title = s[0]; blogPost = Sitecore.Context.Database.GetItem("{" + s[1]); } else { blogPost = Sitecore.Context.Database.GetItem("/Sitecore/Content/Home/Community and Events/Blogs/" + item.BlogName + "/" + item.Title); } BlogsAuthorPageItem author = Sitecore.Context.Database.GetItem(blogPost.Author.Raw); item.Author = author.Name; item.Body = TelligentService.FormatString100(Sitecore.StringUtil.RemoveTags(blogPost.Body.Raw)); item.AuthorUrl = LinkManager.GetItemUrl(author); } return(dataSource); }
private void GetMember() { string screenName = Sitecore.Web.WebUtil.GetUrlName(0); // Verify user exists in telligent var telligentUser = TelligentService.GetUser(screenName); if (telligentUser == null || telligentUser.Username != screenName) { // TODO: display error? Sitecore.Diagnostics.Log.Info(String.Format("View Profile - Could not find user in telligent: {0}", screenName), this); Response.Redirect(MainsectionItem.GetHomeItem().GetUrl()); return; } // Check member account MembershipManager mm = new MembershipManager(); _profileMember = mm.GetMemberByScreenName(screenName); if (_profileMember == null) { // TODO: display error? Sitecore.Diagnostics.Log.Info(String.Format("View Profile - Could not find member with screen name: {0}", screenName), this); Response.Redirect(MainsectionItem.GetHomeItem().GetUrl()); return; } }
protected void Page_Load(object sender, EventArgs e) { int page; Sitecore.Globalization.Language language; if (Sitecore.Globalization.Language.TryParse(Lang, out language)) { Sitecore.Context.SetLanguage(language, false); } // Ensure friendship if (!IsUserLoggedIn && !string.IsNullOrEmpty(ScreenName) && !TelligentService.IsApprovedFriend(CurrentMember.ScreenName, ScreenName)) { return; } if (int.TryParse(ResultPage, out page)) { int totalFriends; var friends = TelligentService.GetFriends(ScreenName, page, Constants.MY_CONNECTIONS_FRIENDS_PER_PAGE, out totalFriends); if (friends.Any()) { rptConnections.DataSource = friends; rptConnections.DataBind(); } phMoreResults.Visible = ((page - 1) * Constants.MY_CONNECTIONS_FRIENDS_PER_PAGE) + friends.Count() < totalFriends; } }
protected void FileUpload(object sender, EventArgs e) { if (!this.CurrentMember.ScreenName.IsNullOrEmpty()) { FileUpload fuUserAvatar = (FileUpload)FindControl("fuUserAvatar"); if (fuUserAvatar.HasFile) { string imageTempLocation = Path.GetTempPath() + fuUserAvatar.PostedFile.FileName; fuUserAvatar.PostedFile.SaveAs(imageTempLocation); string userId = TelligentService.ReadUserId(this.CurrentMember.ScreenName); using (var webClient = new WebClient()) { webClient.Headers.Add("Rest-User-Token", TelligentService.TelligentAuth()); webClient.Headers.Add("Rest-Method", "PUT"); var requestUrl = String.Format("{0}api.ashx/v2/users/{1}/avatar.xml", Sitecore.Configuration.Settings.GetSetting("TelligentConfig"), userId); webClient.UploadFile(requestUrl, "POST", imageTempLocation); } Response.Redirect(Request.RawUrl); } } else { Response.Redirect(LinkManager.GetItemUrl(Sitecore.Context.Database.GetItem("{907EAD93-A2AB-48ED-886C-2DF985375803}")) + "#community"); } }
protected void lvLastMessages_SelectedIndexChanging(object sender, ListViewSelectEventArgs e) { //Grab conversation ID from hidden field if (e.NewSelectedIndex > -1) { HiddenField hdfield = (HiddenField)lvLastMessages.Items[e.NewSelectedIndex].FindControl("hfConvID"); if (hdfield != null) { //Extract the conversation messages from conversation list item if (PMConversations != null) { List <Message> msgs = PMConversations.Where(c => c.ID.Equals(hdfield.Value)).First <Conversation>().Messages; rptMessages.DataSource = msgs; rptMessages.DataBind(); //Mark conversation as read TelligentService.MarkConversationRead(CurrentMember.ScreenName, hdfield.Value); Conversations = null; } } lvLastMessages.SelectedIndex = e.NewSelectedIndex; } BindConversations(false); }
protected void Page_Load(object sender, EventArgs e) { List <Blog> dataSource = TelligentService.ListBlogs(); BlogRepeater.DataSource = dataSource; BlogRepeater.DataBind(); }
protected override void OnInit(EventArgs e) { Blog b = TelligentService.ReadBlog(CurrentItem.BlogId.Text); litBackLink.Text = b.Title; hrefBackLink.HRef = UnderstoodDotOrg.Services.CommunityServices.Blogs.GetBlogUrlFromID(CurrentItem.BlogId.Text); base.OnInit(e); }
private List <Question> GetFeaturedQuestions() { List <Question> questions = new List <Question>(); Item[] items = null; Sitecore.Data.Fields.MultilistField featuredQuestions = Sitecore.Context.Item.Fields["FeaturedQuestions"]; if (featuredQuestions != null) { items = featuredQuestions.GetItems(); foreach (var item in items) { String wikiId = item["WikiId"]; String wikiPageId = item["WikiPageId"]; String contentId = item["ContentId"]; Question question = TelligentService.GetQuestion(wikiId, wikiPageId, contentId); Sitecore.Data.Fields.MultilistField grades = item.Fields["Grade"]; if (grades != null) { foreach (Sitecore.Data.ID id in grades.TargetIDs) { Item targetItem = Sitecore.Context.Database.Items[id]; question.Grade = targetItem.Name; } } Sitecore.Data.Fields.MultilistField topics = item.Fields["Topic"]; if (topics != null) { foreach (Sitecore.Data.ID id in topics.TargetIDs) { Item targetItem = Sitecore.Context.Database.Items[id]; question.Group = targetItem.Name; } } Sitecore.Data.Fields.MultilistField issues = item.Fields["Issues"]; if (issues != null) { foreach (Sitecore.Data.ID id in issues.TargetIDs) { Item targetItem = Sitecore.Context.Database.Items[id]; question.Issues.Add(targetItem.Name); } } questions.Add(question); } } return(questions); }
private void createCommunityUser() { //pulling this out of membership manager for now until we find the best place. //It had been in AddMember berfore but there is no screen name available when we Add a member. //create Telligent user: var tMember = TelligentService.GetPosesMember(this.CurrentMember.ScreenName); //if we have a screen name and it doesn't exist in Telligent yet... if (!string.IsNullOrEmpty(this.CurrentMember.ScreenName) && !string.IsNullOrEmpty(this.CurrentUser.Email) && tMember == null) { try { bool communitySuccess = CommunityHelper.CreateUser(this.CurrentMember.ScreenName, this.CurrentUser.Email); //bool communitySuccess = CommunityHelper.CreateUser(CurrentMember.ScreenName, CurrentUser.Email); if (communitySuccess == false) { // ¡Ay, caramba! // give them a nice "I'm sorry" please try again later message. //uxErrorMessage.Text = "<font color=red> </ font> "; //uxErrorMessage.Visible = true; //err = true; //dont progress. stop and display an error. throw new Exception("I'm sorry, the Community User failed to be created properly."); } } catch (Exception ex) { //bg: we need a generic procedure for handling errors so that we can display important data properly without being gross //uxErrorMessage.Text = "<font color=red>I'm sorry, an error has occured while trying to create the Community User. <hr> " + // "Message: " + ex.Message + Environment.NewLine + // "Source: " + ex.Source + Environment.NewLine + "<hr>" + // "Stack Trace: " + ex.StackTrace + Environment.NewLine + // "Inner Message: " + ex.InnerException.Message + Environment.NewLine + // "Inner Source: " + ex.InnerException.Source + Environment.NewLine + // "Inner Stack Trace: " + ex.InnerException.StackTrace + // "</font>"; //uxErrorMessage.Visible = true; //err = true; throw ex; } } //if (!string.IsNullOrEmpty(CurrentMember.ScreenName)) //optional to the user //{ // if (mode != Constants.QueryStrings.Registration.ModeEdit) // { // } // } //} }
protected void btnJoin_Click(object sender, EventArgs e) { this.ProfileRedirect(Constants.UserPermission.CommunityUser); if (CurrentMember != null) { if (CurrentMember.ScreenName != null) { if (IsMember) { try { Item grpItem = Groups.ConvertGroupIDtoSitecoreItem(GroupID); string itemUrl = grpItem.GetUrl(); Response.Redirect(itemUrl, true); } catch (Exception ex) { Sitecore.Diagnostics.Error.LogError("Error in btnJoin_Click for Join Group Button function.\nError:\n" + ex.Message); } } else { if (TelligentService.JoinGroup(GroupID, CurrentMember.ScreenName)) { //Send Email GroupItem grpItem = new GroupItem(Groups.ConvertGroupIDtoSitecoreItem(GroupID)); GroupCardModel grpModel = Groups.GroupCardModelFactory(grpItem); BaseReply reply = ExactTargetService.InvokeEM9GroupWelcome(new InvokeEM9GroupWelcomeRequest { PreferredLanguage = CurrentMember.PreferredLanguage, GroupLeaderEmail = grpModel.ModeratorEmail, GroupLink = grpItem.GetUrl(), GroupTitle = grpItem.DisplayName, ToEmail = CurrentMember.Email, GroupModerator = new Moderator { groupModBioLink = grpModel.ModeratorBio, groupModImgLink = grpModel.ModeratorAvatarUrl, //owner.Avatar, groupModName = grpModel.ModeratorName }, RequestUrl = Request.Url }); Text = DictionaryConstants.ViewDiscussionsLabel; } } } } }
protected void Page_Load(object sender, EventArgs e) { List <BlogPost> dataSource = TelligentService.ListBlogPosts(Settings.GetSetting(Constants.Settings.TelligentBlogIds), "6"); foreach (var item in dataSource) { string[] s = item.Title.Split('{'); item.Title = s[0].Trim(); } BlogsRepeater.DataSource = dataSource; BlogsRepeater.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { rptMemberCards = (MemberCardList)Page.LoadControl("~/Presentation/Sublayouts/Common/MemberCardList.ascx"); rptMemberCards.ID = "rptMemberCards"; memberList.Controls.Add(rptMemberCards); List <MemberCardModel> memberCardSrc = TelligentService.GetModerators(); rptMemberCards.DataSource = memberCardSrc; rptMemberCards.DataBind(); }
private void InitFriendsView() { ucAccountNonFriendProfile.Visible = false; pnlFriends.Visible = true; string view = Request.QueryString[Constants.QueryStrings.PublicProfile.View]; if (!string.IsNullOrEmpty(view)) { switch (view) { case Constants.QueryStrings.PublicProfile.ViewConnections: _selectedTab = 1; ucAccountFriendConnections.Visible = true; ucAccountFriendConnections.ProfileMember = _profileMember; break; case Constants.QueryStrings.PublicProfile.ViewComments: _selectedTab = 2; ucAccountFriendComments.Visible = true; ucAccountFriendComments.ProfileMember = _profileMember; break; default: Response.Redirect(ProfileUrl); break; } } else { ucAccountFriendProfile.Visible = true; ucAccountFriendProfile.ProfileMember = _profileMember; } litCommentCount.Text = TelligentService.GetTotalUserComments(_profileMember.ScreenName).ToString(); if (!IsPostBack) { // Dropdown list List <ListItem> tabs = new List <ListItem>(); tabs.Add(new ListItem(DictionaryConstants.ProfileLabel, string.Empty)); tabs.Add(new ListItem(DictionaryConstants.ConnectionsLabel, Constants.QueryStrings.PublicProfile.ViewConnections)); tabs.Add(new ListItem(DictionaryConstants.CommentsLabel, Constants.QueryStrings.PublicProfile.ViewComments)); tabs[_selectedTab].Selected = true; ddlMobileTabs.DataSource = tabs; ddlMobileTabs.DataTextField = "Text"; ddlMobileTabs.DataValueField = "Value"; ddlMobileTabs.DataBind(); } }
protected void rptAuthorArticles_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.IsItem()) { DefaultArticlePageItem article = (DefaultArticlePageItem)e.Item.DataItem; if (article != null) { HyperLink hypImageLink = e.FindControlAs <HyperLink>("hypImageLink"); HyperLink hypAuthor = e.FindControlAs <HyperLink>("hypAuthor"); HyperLink hypReadMore = e.FindControlAs <HyperLink>("hypReadMore"); HyperLink hypArticleTitleLink = e.FindControlAs <HyperLink>("hypArticleTitleLink"); Literal litCommentCount = e.FindControlAs <Literal>("litCommentCount"); Literal litArticleTitle = e.FindControlAs <Literal>("litArticleTitle"); Literal litDatePosted = e.FindControlAs <Literal>("litDatePosted"); Literal litAbstract = e.FindControlAs <Literal>("litAbstract"); ArticleRecommendationIcons articleRecommendationIcons = e.FindControlAs <ArticleRecommendationIcons>("articleRecommendationIcons"); if (article.AuthorName.Item != null) { hypAuthor.Text = article.AuthorName.Item.DisplayName; hypAuthor.NavigateUrl = Sitecore.Context.Item.GetUrl(); hypImageLink.NavigateUrl = hypReadMore.NavigateUrl = hypArticleTitleLink.NavigateUrl = article.GetUrl(); hypImageLink.ImageUrl = article.GetArticleThumbnailUrl(230, 129); litArticleTitle.Text = article.DisplayName; litDatePosted.Text = article.InnerItem.Statistics.Created.ToString("MMM dd, yyyy"); litAbstract.Text = UnderstoodDotOrg.Common.Helpers.TextHelper.TruncateText( Sitecore.StringUtil.RemoveTags(HttpUtility.HtmlDecode(article.ContentPage.BodyContent.Raw)), 150); bool hasMoreResults; int totalComments; List <Comment> dataSource = TelligentService.ReadComments( article.BlogId.ToString(), article.BlogPostId.ToString(), 1, Constants.ARTICLE_COMMENTS_PER_PAGE, "CreatedUtcDate", true, out totalComments, out hasMoreResults); litCommentCount.Text = totalComments.ToString(); if (IsUserLoggedIn) { articleRecommendationIcons.HasMatchingParentInterest = article.HasMatchingParentInterest(CurrentMember); articleRecommendationIcons.MatchingChildrenIds = article.GetMatchingChildrenIds(CurrentMember); } } else { e.Item.Visible = false; } } } }
protected void btnSearch_Click(object sender, EventArgs e) { Panel panResultText = (Panel)FindControl("panResultText"); panResultText.Visible = true; Literal litResultCount = (Literal)FindControl("litResultCount"); Literal litSearchTerm = (Literal)FindControl("litSearchTerm"); Repeater rptRecentBlogInfo = (Repeater)FindControl("rptRecentBlogInfo"); string query = TextHelper.RemoveHTML(txtSearch.Text); var dataSource = TelligentService.CommunitySearch(query, Constants.TelligentSearchParams.Blog, Constants.BlogNames[Sitecore.Context.Item["BlogId"]]); litSearchTerm.Text = query; if (dataSource.Any()) { foreach (var item in dataSource) { string[] s = item.Title.Split('{'); BlogsPostPageItem blogPost = Sitecore.Context.Database.GetItem(String.Format("{0}{1}", "{", s[1])); if (blogPost != null) { item.Title = s[0].Trim(); if (!item.Title.ToLower().Contains("comment on")) { item.Body = Sitecore.StringUtil.RemoveTags(TelligentService.FormatString100(blogPost.Body)); } BlogsAuthorPageItem author = Sitecore.Context.Database.GetItem(blogPost.Author.Raw); if (author != null) { item.Author = author.Name; } else { item.Author = null; } var telligentDetails = TelligentService.ReadBlogBody(blogPost.BlogId, blogPost.BlogPostId); item.CommentCount = telligentDetails.CommentCount; } } } litResultCount.Text = dataSource.Count.ToString(); rptRecentBlogInfo.DataSource = dataSource; rptRecentBlogInfo.DataBind(); }
protected void SubmitButton_Click(object sender, EventArgs e) { this.ProfileRedirect(Constants.UserPermission.CommunityUser); if (TelligentService.PostComment(_blogId, _blogPostId, txtComment.Text.Trim(), CurrentMember.ScreenName)) { PopulateComments(); } else { // TODO: display error; } }
protected void Page_Load(object sender, EventArgs e) { //var dataSource = CommunityHelper.GetModerators(); var repeater = Page.FindControl("rptModerators") as Repeater; if (repeater != null) { repeater.DataSource = TelligentService.GetModerators(); repeater.DataBind(); } //rptModerators.DataSource = CommunityHelper.GetModerators(); //rptModerators.DataBind(); }