예제 #1
0
    /// <summary>
    /// Reloads comment list.
    /// </summary>
    public void ReloadComments()
    {
        SetContext();

        pnlComment.Visible = AreCommentsOpened;

        if (PostNode != null)
        {
            var currentUser = MembershipContext.AuthenticatedUser;

            // Check permissions for blog
            if (BlogProperties.CheckPermissions)
            {
                if (currentUser.IsAuthorizedPerDocument(PostNode, NodePermissionsEnum.Read) != AuthorizationResultEnum.Allowed)
                {
                    Visible = false;
                    return;
                }
            }

            ctrlCommentEdit.PostDocumentId = PostNode.DocumentID;
            ctrlCommentEdit.PostNodeId     = PostNode.NodeID;
            ctrlCommentEdit.PostCulture    = PostNode.DocumentCulture;

            if (!BlogProperties.StopProcessing)
            {
                // Get parent blog
                bool     selectOnlyPublished = PortalContext.ViewMode.IsLiveSite();
                TreeNode blogNode            = BlogHelper.GetParentBlog(AliasPath, SiteName, selectOnlyPublished);

                // Determine whether user is authorized to manage comments
                isUserAuthorized = BlogHelper.IsUserAuthorizedToManageComments(blogNode);

                // Get all post comments
                rptComments.DataSource = BlogCommentInfoProvider.GetPostComments(PostNode.DocumentID, !isUserAuthorized, isUserAuthorized);
                rptComments.DataBind();
            }
        }

        ReleaseContext();
    }
예제 #2
0
    /// <summary>
    /// Reloads comment list.
    /// </summary>
    public void ReloadComments()
    {
        this.SetContext();

        this.pnlComment.Visible = this.AreCommentsOpened;

        if (this.PostNode != null)
        {
            CurrentUserInfo currentUser = CMSContext.CurrentUser;

            // Check permissions for blog
            if (this.BlogProperties.CheckPermissions)
            {
                if (currentUser.IsAuthorizedPerDocument(this.PostNode, NodePermissionsEnum.Read) != AuthorizationResultEnum.Allowed)
                {
                    this.Visible = false;
                    return;
                }
            }

            ctrlCommentEdit.PostDocumentId = this.PostNode.DocumentID;
            ctrlCommentEdit.PostNodeId     = this.PostNode.NodeID;
            ctrlCommentEdit.PostCulture    = this.PostNode.DocumentCulture;

            if (!this.BlogProperties.StopProcessing)
            {
                // Get parent blog
                bool     selectOnlyPublished = (CMSContext.ViewMode == ViewModeEnum.LiveSite);
                TreeNode blogNode            = BlogHelper.GetParentBlog(this.AliasPath, this.SiteName, selectOnlyPublished);

                // Determine whether user is authorized to manage comments
                isUserAuthorized = BlogHelper.IsUserAuthorizedToManageComments(blogNode);

                // Get all post comments
                rptComments.DataSource = BlogCommentInfoProvider.GetPostComments(this.PostNode.DocumentID, !isUserAuthorized, isUserAuthorized, DisplayTrackbacks);
                rptComments.DataBind();
            }
        }

        this.ReleaseContext();
    }