protected void btnAddUpdate_OnCommand(object sender, CommandEventArgs e) { SueetieBlog sueetieBlog = new SueetieBlog { BlogID = int.Parse(ddlBlogs.SelectedValue), BlogTitle = txtBlogTitle.Text, BlogDescription = txtBlogDescription.Text, IsActive = chkIsActive.Checked, IncludeInAggregateList = chkIncludeInAggregateList.Checked, RegisteredComments = chkRegisteredComments.Checked, BlogAccessRole = !string.IsNullOrEmpty(txtBlogAccessRole.Text) ? txtBlogAccessRole.Text : null, BlogOwnerRole = ddlBlogOwnerRole.SelectedItem.Text }; SueetieBlogs.UpdateSueetieBlog(sueetieBlog); lblResults.Text = "Blog Updated!"; ClearForm(); }
protected void ddlBlogs_OnSelectedIndexChanged(object sender, EventArgs e) { SueetieBlog _sueetieBlog = SueetieBlogs.GetSueetieBlog(int.Parse(ddlBlogs.SelectedValue)); if (_sueetieBlog.BlogID > 0) { PopulateBlogOwnerRoleList(_sueetieBlog.BlogOwnerRole); txtBlogTitle.Text = _sueetieBlog.BlogTitle; txtBlogDescription.Text = _sueetieBlog.BlogDescription; txtBlogAccessRole.Text = _sueetieBlog.BlogAccessRole; chkIsActive.Checked = _sueetieBlog.IsActive; chkIncludeInAggregateList.Checked = _sueetieBlog.IncludeInAggregateList; chkRegisteredComments.Checked = _sueetieBlog.RegisteredComments; SetButtonState(false); } else { SetButtonState(true); ClearForm(); } lblResults.Text = string.Empty; }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event. /// </summary> /// <param name="e"> /// The <see cref="T:System.EventArgs"/> object that contains the event data. /// </param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (this.Post == null) { this.Response.Redirect(Utils.RelativeWebRoot); return; } this.NameInputId = string.Format("txtName{0}", DateTime.Now.Ticks); this.EnableCaptchas(); if (!this.Page.IsPostBack && !this.Page.IsCallback) { if (Security.IsAuthorizedTo(Rights.ModerateComments)) { if (this.Request.QueryString["deletecomment"] != null) { this.DeleteComment(); } else if (this.Request.QueryString["deletecommentandchildren"] != null) { this.DeleteCommentAndChildren(); } else if (!string.IsNullOrEmpty(this.Request.QueryString["approvecomment"])) { this.ApproveComment(); } else if (!string.IsNullOrEmpty(this.Request.QueryString["approveallcomments"])) { this.ApproveAllComments(); } } var path = string.Format( "{0}themes/{1}/CommentView.ascx", Utils.RelativeWebRoot, BlogSettings.Instance.Theme); bool canViewUnpublishedPosts = Security.IsAuthorizedTo(AuthorizationCheck.HasAny, new[] { Rights.ViewUnmoderatedComments, Rights.ModerateComments }); if (this.NestingSupported) { // newer, nested comments if (this.Post != null) { this.AddNestedComments(path, this.Post.NestedComments, this.phComments, canViewUnpublishedPosts); } } else { // old, non nested code // Add approved Comments foreach (var comment in this.Post.Comments.Where( comment => comment.Email != "pingback" && comment.Email != "trackback")) { if (comment.IsApproved) { this.CommentCounter++; } if (!comment.IsApproved && BlogSettings.Instance.EnableCommentsModeration) { continue; } var control = (CommentViewBase)this.LoadControl(path); control.Comment = comment; control.Post = this.Post; this.phComments.Controls.Add(control); } // Add unapproved comments if (canViewUnpublishedPosts) { foreach (var comment in this.Post.Comments) { if (comment.Email == "pingback" || comment.Email == "trackback") { continue; } if (comment.IsApproved) { continue; } var control = (CommentViewBase)this.LoadControl(path); control.Comment = comment; control.Post = this.Post; this.phComments.Controls.Add(control); } } } var pingbacks = new List <CommentViewBase>(); foreach (var comment in this.Post.Comments) { var control = (CommentViewBase)this.LoadControl(path); if (comment.Email != "pingback" && comment.Email != "trackback") { continue; } control.Comment = comment; control.Post = this.Post; pingbacks.Add(control); } if (pingbacks.Count > 0) { var litTrackback = new Literal(); var sb = new StringBuilder(); sb.AppendFormat("<h3 id=\"trackbackheader\">Pingbacks and trackbacks ({0})", pingbacks.Count); sb.Append( "<a id=\"trackbacktoggle\" style=\"float:right;width:20px;height:20px;border:1px solid #ccc;text-decoration:none;text-align:center\""); sb.Append(" href=\"javascript:toggle_visibility('trackbacks','trackbacktoggle');\">+</a>"); sb.Append("</h3><div id=\"trackbacks\" style=\"display:none\">"); litTrackback.Text = sb.ToString(); this.phTrckbacks.Controls.Add(litTrackback); foreach (var c in pingbacks) { this.phTrckbacks.Controls.Add(c); } var closingDiv = new Literal { Text = @"</div>" }; this.phTrckbacks.Controls.Add(closingDiv); } else { this.phTrckbacks.Visible = false; } // Sueetie Modified - Add Require Login to Comment Function phPleaseLogin.Visible = false; if (BlogSettings.Instance.IsCommentsEnabled && Security.IsAuthorizedTo(Rights.CreateComments)) { if (this.Post != null && (!this.Post.HasCommentsEnabled || (BlogSettings.Instance.DaysCommentsAreEnabled > 0 && this.Post.DateCreated.AddDays(BlogSettings.Instance.DaysCommentsAreEnabled) < DateTime.Now.Date))) { this.phAddComment.Visible = false; this.lbCommentsDisabled.Visible = true; } SueetieBlog sueetieBlog = SueetieBlogs.GetSueetieBlog(SueetieApplications.Current.ApplicationKey); if (sueetieBlog.RegisteredComments && !SueetieContext.Current.User.IsRegistered) { phPleaseLogin.Visible = true; phAddComment.Visible = false; } else { this.BindCountries(); this.GetCookie(); this.recaptcha.UserUniqueIdentifier = this.hfCaptcha.Value = Guid.NewGuid().ToString(); } } else { this.phAddComment.Visible = false; } } this.Page.ClientScript.GetCallbackEventReference(this, "arg", null, string.Empty); }