예제 #1
0
        private void LoadSettings()
        {
            pageId = WebUtils.ParseInt32FromQueryString("pageid", pageId);
            moduleId = WebUtils.ParseInt32FromQueryString("mid", moduleId);
            itemId = WebUtils.ParseInt32FromQueryString("ItemID", itemId);
            commentGuid = WebUtils.ParseGuidFromQueryString("c", commentGuid);
            if (commentGuid == Guid.Empty) { return; }

            blog = new Blog(itemId);
            module = GetModule(moduleId, Blog.FeatureGuid);
            commentRepository = new CommentRepository();

            if (blog.ModuleId != module.ModuleId)
            {
                blog = null;
                module = null;
                return;
            }

            comment = commentRepository.Fetch(commentGuid);
            if ((comment.ContentGuid != blog.BlogGuid)||(comment.ModuleGuid != module.ModuleGuid))
            {
                blog = null;
                module = null;
                return;
            }

            moduleSettings = ModuleSettings.GetModuleSettings(moduleId);

            config = new BlogConfiguration(moduleSettings);

            currentUser = SiteUtils.GetCurrentSiteUser();

            userCanEdit = UserCanEditComment();

            commentEditor.SiteGuid = CurrentSite.SiteGuid;
            commentEditor.SiteId = CurrentSite.SiteId;
            commentEditor.SiteRoot = SiteRoot;
            commentEditor.CommentsClosed = false;
            //commentEditor.CommentUrl = Request.RawUrl;
            commentEditor.ContentGuid = blog.BlogGuid;
            //commentEditor.DefaultCommentTitle = defaultCommentTitle;
            commentEditor.FeatureGuid = Blog.FeatureGuid;
            commentEditor.ModuleGuid = module.ModuleGuid;
            //commentEditor.NotificationAddresses = notificationAddresses;
            //commentEditor.NotificationTemplateName = notificationTemplateName;
            commentEditor.RequireCaptcha = false;
            commentEditor.UserCanModerate = userCanEdit;
            //commentEditor.Visible = !commentsClosed;
            commentEditor.CurrentUser = currentUser;
            commentEditor.UserComment = comment;
            commentEditor.ShowRememberMe = false;
            //commentEditor.IncludeIpAddressInNotification = includeIpAddressInNotification;
            //commentEditor.ContainerControl = this;
        }
        public override void DeleteContent(int moduleId, Guid moduleGuid)
        {
            Blog.DeleteByModule(moduleId);
            ContentMetaRespository metaRepository = new ContentMetaRespository();
            metaRepository.DeleteByModule(moduleGuid);

            FriendlyUrl.DeleteByPageGuid(moduleGuid);

            CommentRepository commentRepository = new CommentRepository();
            commentRepository.DeleteByModule(moduleGuid);

            FileAttachment.DeleteByModule(moduleGuid);
        }
예제 #3
0
        private void LoadSetings()
        {
            siteSettings = CacheHelper.GetCurrentSiteSettings();
            repository = new CommentRepository();

            edComment.WebEditor.ToolBar = ToolBar.AnonymousUser;
            edComment.WebEditor.Height = Unit.Pixel(170);

            captcha.ProviderName = siteSettings.CaptchaProvider;
            captcha.Captcha.ControlID = "captcha" + contentGuid.ToString().Replace("-", "");
            //captcha.RecaptchaPrivateKey = siteSettings.RecaptchaPrivateKey;
            //captcha.RecaptchaPublicKey = siteSettings.RecaptchaPublicKey;

            regexUrl.ErrorMessage = Resource.WebSiteUrlRegexWarning;
            regexEmail.ErrorMessage = Resource.NewsletterEmailRegexxMessage;

            reqEmail.ErrorMessage = Resource.EmailRequired;
            reqName.ErrorMessage = Resource.RegisterNameRequiredMessage;

            if ((!requireCaptcha) || (Request.IsAuthenticated))
            {
                pnlAntiSpam.Visible = false;
                captcha.Visible = false;
                captcha.Enabled = false;
            }

            divCommentUrl.Visible = showUserUrl;

            if (Request.IsAuthenticated)
            {
                divUserName.Visible = displaySettings.ShowNameInputWhenAuthenticated;
                divUserEmail.Visible = displaySettings.ShowEmailInputWhenAuthenticated;
                if (showUserUrl)
                {
                    divCommentUrl.Visible = displaySettings.ShowUrlInputWhenAuthenticated;
                }
            }

            divTitle.Visible = useCommentTitle;
            pnlRemeberMe.Visible = showRememberMe && !Request.IsAuthenticated;
        }
예제 #4
0
        void btnDelete_Click(object sender, EventArgs e)
        {
            if (WebConfigSettings.AllowDeletingChildSites)
            {
                if ((selectedSite != null) && (!selectedSite.IsServerAdminSite))
                {
                    try
                    {
                        DeleteSiteContent(selectedSite.SiteId);
                        CommentRepository commentRepository = new CommentRepository();
                        commentRepository.DeleteBySite(selectedSite.SiteGuid);

                    }
                    catch (Exception ex)
                    {
                        log.Error("error deleting site content ", ex);
                    }

                    SiteSettings.Delete(selectedSite.SiteId);
                    WebUtils.SetupRedirect(this, SiteRoot + "/Admin/SiteList.aspx");
                }
            }
        }
예제 #5
0
        private void SetupInternalCommentSystem()
        {
            divCommentService.Visible = false;
            disqus.Disable = true;
            intenseDebate.Visible = false;
            fbComments.Visible = false;

            repository = new CommentRepository();
            timeZone = SiteUtils.GetUserTimeZone();
            if (allowExternalImages) { AllowedImageUrlRegexPatern = SecurityHelper.RegexAnyImageUrlPatern; }
            CanManageUsers = WebUser.IsInRoles(siteSettings.RolesThatCanManageUsers);

            switch (siteSettings.AvatarSystem)
            {
                case "gravatar":
                    allowGravatars = true;
                    disableAvatars = false;
                    break;

                case "internal":
                    allowGravatars = false;
                    disableAvatars = false;
                    break;

                case "none":
                default:
                    allowGravatars = false;
                    disableAvatars = true;
                    break;

            }

            if (forceDisableAvatar)
            {
                allowGravatars = false;
                disableAvatars = true;
            }

            showUserRevenue = (WebConfigSettings.ShowRevenueInForums && WebUser.IsInRoles(siteSettings.CommerceReportViewRoles));

            //CommentEditor editor
            commentEditor.SiteGuid = siteSettings.SiteGuid;
            commentEditor.SiteId = siteSettings.SiteId;
            commentEditor.SiteRoot = siteRoot;
            commentEditor.CommentsClosed = commentsClosed;
            commentEditor.CommentUrl = commentUrl;
            commentEditor.ContentGuid = contentGuid;
            commentEditor.DefaultCommentTitle = defaultCommentTitle;
            commentEditor.FeatureGuid = featureGuid;
            commentEditor.ModuleGuid = moduleGuid;
            commentEditor.NotificationAddresses = notificationAddresses;
            commentEditor.NotificationTemplateName = notificationTemplateName;
            commentEditor.RequireCaptcha = requireCaptcha;
            commentEditor.RequireModeration = requireModeration;
            commentEditor.UserCanModerate = userCanModerate;
            commentEditor.Visible = !commentsClosed;
            commentEditor.CurrentUser = currentUser;
            commentEditor.IncludeIpAddressInNotification = includeIpAddressInNotification;
            commentEditor.ContainerControl = this;
            commentEditor.UpdateContainerControl = this;
            commentEditor.UseCommentTitle = useCommentTitle;
            commentEditor.ShowUserUrl = showUserUrl;

            pnlCommentsClosed.Visible = commentsClosed;
            if (!commentsClosed && requireAuthenticationToPost && !Request.IsAuthenticated)
            {
                pnlCommentsRequireAuthentication.Visible = true;
                commentEditor.Visible = false;
            }

            if (!commentsClosed && alwaysShowSignInPromptIfNotAuthenticated && !Request.IsAuthenticated)
            {
                pnlCommentsRequireAuthentication.Visible = true;

            }

            SetupScript();

            if (!IsPostBack)
            {
                BindComments();
            }
        }
예제 #6
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            if(blog != null)
            {
                blog.ContentChanged += new ContentChangedEventHandler(blog_ContentChanged);
                blog.Delete();
                FriendlyUrl.DeleteByPageGuid(blog.BlogGuid);
                CurrentPage.UpdateLastModifiedTime();
                SiteUtils.QueueIndexing();

                CommentRepository commentRepository = new CommentRepository();
                commentRepository.DeleteByContent(blog.BlogGuid);

                FileAttachment.DeleteByItem(blog.BlogGuid);
            }

            //if (hdnReturnUrl.Value.Length > 0)
            //{
            //    WebUtils.SetupRedirect(this, hdnReturnUrl.Value);
            //    return;
            //}

            WebUtils.SetupRedirect(this, SiteUtils.GetCurrentPageUrl());

            return;
        }
예제 #7
0
        private void PopulateControls()
        {
            if (pageId == -1) { return; }
            if (moduleId == -1) { return; }

            litHeadingOpenTag.Text = "<" + headingElement + ">";
            litHeadingCloseTag.Text = "</" + headingElement + ">";
            if (overrideHeadingText.Length > 0)
            {
                litHeading.Text = overrideHeadingText;
            }
            else
            {
                litHeading.Text = BlogResources.BlogStatisticsLabel;
            }

            int commentCount = 0;

            using (IDataReader reader = Blog.GetBlogStats(ModuleId))
            {
                if (reader.Read())
                {
                    int entryCount = Convert.ToInt32(reader["EntryCount"]);
                    commentCount = Convert.ToInt32(reader["CommentCount"]);

                    litEntryCount.Text = ResourceHelper.FormatCategoryLinkText(BlogResources.BlogEntryCountLabel, (entryCount - countOfDrafts));

                }
                else
                {
                    litEntryCount.Text = ResourceHelper.FormatCategoryLinkText(BlogResources.BlogEntryCountLabel, 0);
                    litCommentCount.Text = ResourceHelper.FormatCategoryLinkText(BlogResources.BlogCommentCountLabel, 0);
                }

            }

            if (!BlogConfiguration.UseLegacyCommentSystem)
            {
                CommentRepository commentRepository = new CommentRepository();
                commentCount = commentRepository.GetCountByModule(ModuleGuid, Comment.ModerationApproved);
            }

            litCommentCount.Text = ResourceHelper.FormatCategoryLinkText(BlogResources.BlogCommentCountLabel, commentCount);

            liComments.Visible = showCommentCount;
        }