/// <summary> /// The options menu_ item click. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> /// <exception cref="ApplicationException"> /// </exception> private void OptionsMenu_ItemClick([NotNull] object sender, [NotNull] PopEventArgs e) { switch (e.Item.ToLower()) { case "print": YafBuildLink.Redirect(ForumPages.printtopic, "t={0}", this.PageContext.PageTopicID); break; case "watch": this.TrackTopic_Click(sender, e); break; case "email": this.EmailTopic_Click(sender, e); break; case "rssfeed": YafBuildLink.Redirect( ForumPages.rsstopic, "pg={0}&t={1}", this.Request.QueryString.GetFirstOrDefault("g"), this.PageContext.PageTopicID); break; default: throw new ApplicationException(e.Item); } }
/// <summary> /// The options menu_ item click. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void OptionsMenuItemClick([NotNull] object sender, [NotNull] PopEventArgs e) { switch (e.Item.ToLower()) { case "print": BuildLink.Redirect(ForumPages.PrintTopic, "t={0}", this.PageContext.PageTopicID); break; case "watch": this.TrackTopicClick(sender, e); break; case "unwatch": this.UnTrackTopicClick(sender, e); break; case "email": this.EmailTopic_Click(sender, e); break; case "atomfeed": BuildLink.Redirect( ForumPages.Feed, "feed={0}&t={1}", RssFeeds.Posts.ToInt(), this.PageContext.PageTopicID); break; default: throw new ApplicationException(e.Item); } }
/// <summary> /// The view menu_ item click. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> /// <exception cref="ApplicationException"> /// </exception> private void ViewMenu_ItemClick([NotNull] object sender, [NotNull] PopEventArgs e) { switch (e.Item.ToLower()) { case "normal": this.IsThreaded = false; this.BindData(); break; case "threaded": this.IsThreaded = true; this.BindData(); break; default: throw new ApplicationException(e.Item); } }
/// <summary> /// The options menu_ item click. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The Pop Event Arguments.</param> private void ShareMenuItemClick([NotNull] object sender, [NotNull] PopEventArgs e) { var topicUrl = BuildLink.GetLink( ForumPages.Posts, true, "t={0}&name={1}", this.PageContext.PageTopicID, this.PageContext.PageTopicName); switch (e.Item.ToLower()) { case "email": this.EmailTopic_Click(sender, e); break; case "tumblr": { // process message... clean html, strip html, remove BBCode, etc... var tumblrTopicName = BBCodeHelper.StripBBCode( HtmlHelper.StripHtml(HtmlHelper.CleanHtmlString(this.topic.TopicName))).RemoveMultipleWhitespace(); var meta = this.Page.Header.FindControlType <HtmlMeta>().ToList(); var description = string.Empty; if (meta.Any(x => x.Name.Equals("description"))) { var descriptionMeta = meta.FirstOrDefault(x => x.Name.Equals("description")); if (descriptionMeta != null) { description = $"&description={descriptionMeta.Content}"; } } var tumblrUrl = $"http://www.tumblr.com/share/link?url={this.Server.UrlEncode(topicUrl)}&name={tumblrTopicName}{description}"; this.Get <HttpResponseBase>().Redirect(tumblrUrl); } break; case "retweet": { var twitterName = this.PageContext.BoardSettings.TwitterUserName.IsSet() ? $"@{this.PageContext.BoardSettings.TwitterUserName} " : string.Empty; // process message... clean html, strip html, remove bbcode, etc... var twitterMsg = BBCodeHelper.StripBBCode( HtmlHelper.StripHtml(HtmlHelper.CleanHtmlString(this.topic.TopicName))).RemoveMultipleWhitespace(); var tweetUrl = $"http://twitter.com/share?url={this.Server.UrlEncode(topicUrl)}&text={this.Server.UrlEncode(string.Format("RT {1}Thread: {0}", twitterMsg.Truncate(100), twitterName))}"; this.Get <HttpResponseBase>().Redirect(tweetUrl); } break; case "reddit": { var redditUrl = $"http://www.reddit.com/submit?url={this.Server.UrlEncode(topicUrl)}&title={this.Server.UrlEncode(this.topic.TopicName)}"; this.Get <HttpResponseBase>().Redirect(redditUrl); } break; default: throw new ApplicationException(e.Item); } }