Exemplo n.º 1
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.º 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 += new EventHandler(HandleUpdateCompleted);
            ctrlViewBlogView.UpdateCancelled += new EventHandler(HandleUpdateCancelled);

            if (!IsPostBack)
            {
                Post post = null;

                try
                {
                    post = engine.GetPostById(new Guid(BlogId));

                    base.InitSubscribers(actions, post.UserID);
                }
                catch (Exception)
                {
                    post = null;
                }

                if (post != null)
                {
                    ctrlViewBlogView.post = post;

                    mainContainer.BreadCrumbs.Add(new BreadCrumb {
                        Caption = ASC.Blogs.Core.Resources.BlogsResource.AddonName, NavigationUrl = VirtualPathUtility.ToAbsolute(ASC.Blogs.Core.Constants.BaseVirtualPath)
                    });
                    mainContainer.BreadCrumbs.Add(new BreadCrumb {
                        Caption = DisplayUserSettings.GetFullUserName(post.UserID, false), NavigationUrl = VirtualPathUtility.ToAbsolute(ASC.Blogs.Core.Constants.BaseVirtualPath) + "?userid=" + post.UserID
                    });
                    mainContainer.BreadCrumbs.Add(new BreadCrumb {
                        Caption = post.Title
                    });

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

                    commentList.Items = BuildCommentsList(post, loadedComments);


                    ConfigureComments(commentList, loadedComments.Count, post);

                    if (!SecurityContext.DemoMode)
                    {
                        engine.SavePostReview(post, SecurityContext.CurrentAccount.ID);
                    }
                }
                else
                {
                    ctrlViewBlogView.Visible = false;
                    lblMessage.Visible       = true;
                    mainContainer.BreadCrumbs.Add(new BreadCrumb {
                        Caption = ASC.Blogs.Core.Resources.BlogsResource.AddonName, NavigationUrl = VirtualPathUtility.ToAbsolute(ASC.Blogs.Core.Constants.BaseVirtualPath)
                    });
                    commentList.Visible = false;
                    ConfigureComments(commentList, 0, null);
                }
            }
        }
Exemplo n.º 4
0
        private void ShowPost(BlogsEngine engine)
        {
            //EditBlogPresenter presenter = new EditBlogPresenter(ctrlViewBlogView, DaoFactory.GetBlogDao());
            //ctrlViewBlogView.AttachPresenter(presenter);

            ctrlViewBlogView.UpdateCompleted += new EventHandler(HandleUpdateCompleted);
            ctrlViewBlogView.UpdateCancelled += new EventHandler(HandleUpdateCancelled);

            if (!IsPostBack)
            {

                Post post = null;

                try
                {
                    post = engine.GetPostById(new Guid(BlogId));

                    base.InitSubscribers(actions, post.UserID);
                }
                catch (Exception)
                {
                    post = null;
                }

                if (post != null)
                {
                    ctrlViewBlogView.post = post;

                    mainContainer.BreadCrumbs.Add(new BreadCrumb { Caption = ASC.Blogs.Core.Resources.BlogsResource.AddonName, NavigationUrl = VirtualPathUtility.ToAbsolute(ASC.Blogs.Core.Constants.BaseVirtualPath ) });
                    mainContainer.BreadCrumbs.Add(new BreadCrumb { Caption = DisplayUserSettings.GetFullUserName(post.UserID, false), NavigationUrl = VirtualPathUtility.ToAbsolute(ASC.Blogs.Core.Constants.BaseVirtualPath) + "?userid=" + post.UserID });
                    mainContainer.BreadCrumbs.Add(new BreadCrumb { Caption = post.Title });

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

                    commentList.Items = BuildCommentsList(post, loadedComments);


                    ConfigureComments(commentList, loadedComments.Count, post);

                    if (!SecurityContext.DemoMode)
                        engine.SavePostReview(post,SecurityContext.CurrentAccount.ID);
                }
                else
                {
                    ctrlViewBlogView.Visible = false;
                    lblMessage.Visible = true;
                    mainContainer.BreadCrumbs.Add(new BreadCrumb { Caption = ASC.Blogs.Core.Resources.BlogsResource.AddonName, NavigationUrl = VirtualPathUtility.ToAbsolute(ASC.Blogs.Core.Constants.BaseVirtualPath) });
                    commentList.Visible = false;
                    ConfigureComments(commentList, 0, null);
                }
            }
        }