Пример #1
0
        private void LoadSettings()
        {
            virtualRoot = WebUtils.GetApplicationRoot();

            pageId                = WebUtils.ParseInt32FromQueryString("pageid", -1);
            moduleId              = WebUtils.ParseInt32FromQueryString("mid", -1);
            forumId               = WebUtils.ParseInt32FromQueryString("forumid", -1);
            threadId              = WebUtils.ParseInt32FromQueryString("thread", -1);
            postId                = WebUtils.ParseInt32FromQueryString("postid", -1);
            pageNumber            = WebUtils.ParseInt32FromQueryString("pagenumber", 1);
            lnkCancel.NavigateUrl = SiteUtils.GetCurrentPageUrl();
            timeOffset            = SiteUtils.GetUserTimeOffset();
            timeZone              = SiteUtils.GetUserTimeZone();

            isModerator    = UserCanEditModule(moduleId, Forum.FeatureGuid);
            moduleSettings = ModuleSettings.GetModuleSettings(moduleId);
            config         = new ForumConfiguration(moduleSettings);

            postList.Config                 = config;
            postList.PageId                 = pageId;
            postList.ModuleId               = moduleId;
            postList.ItemId                 = forumId;
            postList.ThreadId               = threadId;
            postList.PageNumber             = pageNumber;
            postList.IsAdmin                = WebUser.IsAdmin;
            postList.IsCommerceReportViewer = WebUser.IsInRoles(siteSettings.CommerceReportViewRoles);
            postList.SiteRoot               = SiteRoot;
            postList.ImageSiteRoot          = ImageSiteRoot;
            postList.SiteSettings           = siteSettings;
            postList.IsEditable             = false;
            postList.IsSubscribedToForum    = true;

            postListAlt.Config                 = config;
            postListAlt.PageId                 = pageId;
            postListAlt.ModuleId               = moduleId;
            postListAlt.ItemId                 = forumId;
            postListAlt.ThreadId               = threadId;
            postListAlt.PageNumber             = pageNumber;
            postListAlt.IsAdmin                = postList.IsAdmin;
            postListAlt.IsCommerceReportViewer = WebUser.IsInRoles(siteSettings.CommerceReportViewRoles);
            postListAlt.SiteRoot               = SiteRoot;
            postListAlt.ImageSiteRoot          = ImageSiteRoot;
            postListAlt.SiteSettings           = siteSettings;
            postListAlt.IsEditable             = false;
            postListAlt.IsSubscribedToForum    = true;

            if (Request.IsAuthenticated)
            {
                theUser = SiteUtils.GetCurrentSiteUser();
                if (theUser != null)
                {
                    if (forumId > -1)
                    {
                        isSubscribedToForum = Forum.IsSubscribed(forumId, theUser.UserId);
                    }
                    if (threadId > -1)
                    {
                        isSubscribedToThread = ForumThread.IsSubscribed(threadId, theUser.UserId);
                    }
                }
            }

            if (isModerator)
            {
                edMessage.WebEditor.ToolBar = ToolBar.FullWithTemplates;
            }
            else if ((Request.IsAuthenticated) && (WebUser.IsInRoles(siteSettings.UserFilesBrowseAndUploadRoles)))
            {
                edMessage.WebEditor.ToolBar = ToolBar.ForumWithImages;
            }
            else
            {
                edMessage.WebEditor.ToolBar = ToolBar.Forum;
            }

            edMessage.WebEditor.SetFocusOnStart = true;
            edMessage.WebEditor.Height          = Unit.Parse("350px");

            if (config.UseSpamBlockingForAnonymous)
            {
                captcha.ProviderName        = siteSettings.CaptchaProvider;
                captcha.Captcha.ControlID   = "captcha" + moduleId.ToString(CultureInfo.InvariantCulture);
                captcha.RecaptchaPrivateKey = siteSettings.RecaptchaPrivateKey;
                captcha.RecaptchaPublicKey  = siteSettings.RecaptchaPublicKey;
            }

            forum = new Forum(forumId);

            if (displaySettings.UseAltPostList)
            {
                postList.Visible    = false;
                postListAlt.Visible = true;
            }

            AddClassToBody("editforumpost");
        }