/// <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> /// <remarks> /// Lets process our .Body content and build up our controls collection /// inside the 'BodyContent' placeholder. /// User controls are insterted into the blog in the following format.. /// [UserControl:~/path/usercontrol.ascx] /// TODO : Expose user control parameters. /// </remarks> protected override void OnLoad(EventArgs e) { base.OnLoad(e); // Sueetie Modified - Create Current Sueetie Blog Post this.CurrentSueetieBlogPost = SueetieBlogs.GetSueetieBlogPost(this.Post.Id.ToString()); this.CurrentSueetieBlog = SueetieBlogs.GetSueetieBlog(SueetieApplications.Current.ApplicationKey); var bodyContent = (PlaceHolder)this.FindControl("BodyContent"); if (bodyContent == null) { // We have no placeholder so we assume this is an old style <% =Body %> theme and do nothing. } else { Utils.InjectUserControls(bodyContent, this.Body); } }
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); }