protected void Caption_Click(object sender, EventArgs eventArgs) { #region Add a new thread in a group Bobs.Group g = new Bobs.Group(Vars.CompetitionGroupK); GroupUsr gu = g.GetGroupUsr(Usr.Current); if (gu == null || !g.IsMember(gu)) { //join the group try { g.Join(Usr.Current, gu); } catch { CaptionErrorP.Visible = true; CaptionErrorP.InnerHtml = "Sorry, you can't post a caption here. Maybe you're not a member of the <a href=\"" + g.Url() + "\">Bacardi B Live</a> group?"; return; } } string captionStart = "";// "<img src=\"http://www.dontstayin.com/gfx/caption-start.gif\" width=\"26\" height=\"20\" /><span style=\"font-size: 20px;\"> "; string captionEnd = "";// " </span><img src=\"http://www.dontstayin.com/gfx/caption-end.gif\" width=\"26\" height=\"20\" />"; string caption = Cambro.Web.Helpers.StripHtmlDoubleSpacesLineFeeds(CaptionTextBox.Text.Trim()); if (caption.Trim().Length == 0) { CaptionErrorP.Visible = true; CaptionErrorP.InnerHtml = "Please enter a caption. Remember you can't enter HTML tags in your caption."; return; } if (caption.StartsWith("\"") || caption.StartsWith("“")) caption = captionStart + caption.Substring(1); else caption = captionStart + caption; if (caption.EndsWith("\"") || caption.EndsWith("”")) caption = caption.Substring(0, caption.Length - 1) + captionEnd; else caption = caption + captionEnd; //add comment to current thread Comment.Maker m = CurrentThread.GetCommentMaker(); m.PostingUsr = Usr.Current; m.Body = caption; m.DuplicateGuid = this.ViewState["CaptionDuplicateGuid"]; if (CurrentThread.GroupK > 0) m.CurrentGroupUsr = CurrentThread.Group.GetGroupUsr(Usr.Current); m.CurrentThreadUsr = CurrentThreadUsr; Comment.MakerReturn r = m.Post(null); if (r.Success || r.Duplicate) { if (!r.Duplicate) Log.Increment(Log.Items.CaptionsAdded); Response.Redirect(r.Comment.Url()); } else { CaptionErrorP.Visible = true; CaptionErrorP.InnerText = "Sorry, you can't post a caption here. Maybe you've been banned from the Bacardi B Live group?"; return; } #endregion }
protected void Caption_Click(object sender, EventArgs eventArgs) { #region Add a new thread in a group Bobs.Group g = new Bobs.Group(Vars.CompetitionGroupK); GroupUsr gu = g.GetGroupUsr(Usr.Current); if (gu == null || !g.IsMember(gu)) { //join the group try { g.Join(Usr.Current, gu); } catch { CaptionErrorP.Visible = true; CaptionErrorP.InnerHtml = "Sorry, you can't post a caption here. Maybe you're not a member of the <a href=\"" + g.Url() + "\">Bacardi B Live</a> group?"; return; } } string captionStart = "";// "<img src=\"http://www.dontstayin.com/gfx/caption-start.gif\" width=\"26\" height=\"20\" /><span style=\"font-size: 20px;\"> "; string captionEnd = "";// " </span><img src=\"http://www.dontstayin.com/gfx/caption-end.gif\" width=\"26\" height=\"20\" />"; string caption = Cambro.Web.Helpers.StripHtmlDoubleSpacesLineFeeds(CaptionTextBox.Text.Trim()); if (caption.Trim().Length == 0) { CaptionErrorP.Visible = true; CaptionErrorP.InnerHtml = "Please enter a caption. Remember you can't enter HTML tags in your caption."; return; }
protected void PostCaption(object sender, EventArgs e) { Group g = new Group(Vars.CompetitionGroupK); GroupUsr gu = g.GetGroupUsr(Usr.Current); if (gu == null || !g.IsMember(gu)) { //join the group g.Join(Usr.Current, gu); } string caption = this.uiCaptionText.Text; if (caption.StartsWith("\"") || caption.StartsWith("“")) caption = caption.Substring(1); if (caption.EndsWith("\"") || caption.EndsWith("”")) caption = caption.Substring(0, caption.Length - 1); Spotted.WebServices.Controls.CommentsDisplay.Service service = new Spotted.WebServices.Controls.CommentsDisplay.Service(); int? threadK = new Photo(currentPhotoK).ThreadK; if (threadK > 0) { service.CreateReply((int)Model.Entities.ObjectType.Photo, currentPhotoK, threadK.Value, duplicateGuid, caption, false, int.MaxValue, new string[0]); this.uiCommentsDisplay.DataBind(); } else { int newThreadK = service.CreatePublicThread((int) Model.Entities.ObjectType.Photo, currentPhotoK, duplicateGuid, caption, false, false, new string[0]).threadK; this.uiCommentsDisplay.CurrentThread = new Thread(newThreadK); this.uiCommentsDisplay.DataBind(); } duplicateGuid = Guid.NewGuid().ToString(); this.uiCaptionText.Text = ""; }