Exemplo n.º 1
0
        private void AddCommentsSubscriber(Guid blogID, ActionContainer actionsContainer)
        {
            var isSubscribe = _subscriber.IsCommentsSubscribe(blogID);
            var sb          = new StringBuilder();

            sb.Append(_subscriber.RenderCommentsSubscription(!isSubscribe, blogID));

            actionsContainer.ActionsPlaceHolder.Controls.Add(new HtmlMenuItem(sb.ToString()));
        }
Exemplo n.º 2
0
        private void ShowPost(BlogsEngine engine)
        {
            //EditBlogPresenter presenter = new EditBlogPresenter(ctrlViewBlogView, DaoFactory.GetBlogDao());
            //ctrlViewBlogView.AttachPresenter(presenter);

            ctrlViewBlogView.UpdateCompleted += HandleUpdateCompleted;
            ctrlViewBlogView.UpdateCancelled += HandleUpdateCancelled;

            if (IsPostBack)
            {
                return;
            }

            Post post;

            try
            {
                post = engine.GetPostById(new Guid(BlogId));
            }
            catch (Exception)
            {
                post = null;
            }

            if (post != null)
            {
                ctrlViewBlogView.post = post;
                var subscriber         = new Subscriber();
                var postId             = String.IsNullOrEmpty(BlogId) ? new Guid() : new Guid(BlogId);
                var isBlogSubscribe    = subscriber.IsCommentsSubscribe(postId);
                var subscribeTopicLink = subscriber.RenderCommentsSubscriptionLink(!isBlogSubscribe, postId);

                SubscribeLinkBlock.Text = subscribeTopicLink;

                BlogTitle = post.Title;

                var loadedComments = engine.GetPostComments(post.ID);

                commentList.Items = BuildCommentsList(post, loadedComments);

                ConfigureComments(commentList, loadedComments.Count, post);
                engine.SavePostReview(post, SecurityContext.CurrentAccount.ID);
            }
            else
            {
                ctrlViewBlogView.Visible         = false;
                lblMessage.Visible               = true;
                mainContainer.CurrentPageCaption = BlogsResource.AddonName;
                commentList.Visible              = false;
                ConfigureComments(commentList, 0, null);
            }
        }
Exemplo n.º 3
0
        private void ShowPost(BlogsEngine engine)
        {
            //EditBlogPresenter presenter = new EditBlogPresenter(ctrlViewBlogView, DaoFactory.GetBlogDao());
            //ctrlViewBlogView.AttachPresenter(presenter);

            ctrlViewBlogView.UpdateCompleted += HandleUpdateCompleted;
            ctrlViewBlogView.UpdateCancelled += HandleUpdateCancelled;

            if (IsPostBack) return;

            Post post;
            try
            {
                post = engine.GetPostById(new Guid(BlogId));
            }
            catch (Exception)
            {
                post = null;
            }

            if (post != null)
            {
                ctrlViewBlogView.post = post;
                var subscriber = new Subscriber();
                var postId = String.IsNullOrEmpty(BlogId) ? new Guid() : new Guid(BlogId);
                var isBlogSubscribe = subscriber.IsCommentsSubscribe(postId);
                var subscribeTopicLink = subscriber.RenderCommentsSubscriptionLink(!isBlogSubscribe, postId);

                SubscribeLinkBlock.Text = subscribeTopicLink;

                BlogTitle = post.Title;

                var loadedComments = engine.GetPostComments(post.ID);

                commentList.Items = BuildCommentsList(post, loadedComments);

                ConfigureComments(commentList, loadedComments.Count, post);
                engine.SavePostReview(post, SecurityContext.CurrentAccount.ID);
            }
            else
            {
                ctrlViewBlogView.Visible = false;
                lblMessage.Visible = true;
                mainContainer.CurrentPageCaption = BlogsResource.AddonName;
                commentList.Visible = false;
                ConfigureComments(commentList, 0, null);
            }
        }