Esempio n. 1
0
        protected virtual void LoadSettings()
        {
            siteSettings = CacheHelper.GetCurrentSiteSettings();
            siteId = siteSettings.SiteId;
            currentUser = SiteUtils.GetCurrentSiteUser();
            TimeOffset = SiteUtils.GetUserTimeOffset();
            timeZone = SiteUtils.GetUserTimeZone();
            GmapApiKey = SiteUtils.GetGmapApiKey();
            addThisAccountId = siteSettings.AddThisDotComUsername;

            if (config.AddThisAccountId.Length > 0)
            {
                addThisAccountId = config.AddThisAccountId;
            }

            pageNumber = WebUtils.ParseInt32FromQueryString("pagenumber", pageNumber);
            categoryId = WebUtils.ParseInt32FromQueryString("cat", categoryId);
            Month = WebUtils.ParseInt32FromQueryString("month", Month);
            Year = WebUtils.ParseInt32FromQueryString("year", Year);
            attachmentBaseUrl = SiteUtils.GetFileAttachmentUploadPath();

            if (Page is mojoBasePage)
            {
                basePage = Page as mojoBasePage;
                module = basePage.GetModule(moduleId, Blog.FeatureGuid);
            }

            if (module == null) { return; }

            MaxAllowedGravatarRating = SiteUtils.GetMaxAllowedGravatarRating();
            UserNameTooltipFormat = displaySettings.AvatarUserNameTooltipFormat;

            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 (!config.ShowAuthorAvatar) { disableAvatars = true; }

            if (config.UseExcerpt && !displaySettings.ShowAvatarWithExcerpt) { disableAvatars = true; }

            CalendarDate = WebUtils.ParseDateFromQueryString("blogdate", DateTime.UtcNow).Date;

            if (CalendarDate > DateTime.UtcNow.Date)
            {
                CalendarDate = DateTime.UtcNow.Date;
            }

            if ((config.UseExcerpt) && (!config.GoogleMapIncludeWithExcerpt)) { ShowGoogleMap = false; }

            EnableContentRating = config.EnableContentRating && !displaySettings.PostListDisableContentRating;
            if (config.UseExcerpt) { EnableContentRating = false; }

            //if (config.AddThisCustomBrand.Length > 0)
            //{
            //    addThisCustomBrand = config.AddThisCustomBrand;
            //}

            if (config.DisqusSiteShortName.Length > 0)
            {
                DisqusSiteShortName = config.DisqusSiteShortName;
            }
            else
            {
                DisqusSiteShortName = siteSettings.DisqusSiteShortName;
            }

            if (config.IntenseDebateAccountId.Length > 0)
            {
                IntenseDebateAccountId = config.IntenseDebateAccountId;
            }
            else
            {
                IntenseDebateAccountId = siteSettings.IntenseDebateAccountId;
            }

            navTop.ModuleId = ModuleId;
            navTop.ModuleGuid = module.ModuleGuid;
            navTop.PageId = PageId;
            navTop.IsEditable = IsEditable;
            navTop.Config = config;
            navTop.SiteRoot = SiteRoot;
            navTop.ImageSiteRoot = ImageSiteRoot;

            navBottom.ModuleId = ModuleId;
            navBottom.ModuleGuid = module.ModuleGuid;
            navBottom.PageId = PageId;
            navBottom.IsEditable = IsEditable;
            navBottom.Config = config;
            navBottom.SiteRoot = SiteRoot;
            navBottom.ImageSiteRoot = ImageSiteRoot;

            TitleOnly = config.TitleOnly || displaySettings.PostListForceTitleOnly;
            ShowTweetThisLink = config.ShowTweetThisLink && !config.UseExcerpt;
            ShowPlusOneButton = config.ShowPlusOneButton && !config.UseExcerpt;
            UseFacebookLikeButton = config.UseFacebookLikeButton && !config.UseExcerpt;
            useExcerpt = config.UseExcerpt || displaySettings.PostListForceExcerptMode;
            pageSize = config.PageSize;
            AllowComments = Config.AllowComments && ShowCommentCounts;

            //TODO: should we use separate settings for each displaymode?
            switch (displayMode)
            {
                case "ByCategory":

                    if (displaySettings.CategoryListForceTitleOnly)
                    {
                        TitleOnly = true;
                    }

                    if (displaySettings.CategoryListOverridePageSize > 0)
                    {
                        pageSize = displaySettings.CategoryListOverridePageSize;
                    }

                    if (displaySettings.ArchiveViewHideFeedbackLink)
                    {
                        AllowComments = false;
                    }

                    if (displaySettings.OverrideCategoryListItemHeadingElement.Length > 0)
                    {
                        itemHeadingElement = displaySettings.OverrideCategoryListItemHeadingElement;
                    }

                    break;

                case "ByMonth":

                    if (displaySettings.ArchiveListForceTitleOnly)
                    {
                        TitleOnly = true;
                    }

                    if (displaySettings.ArchiveListOverridePageSize > 0)
                    {
                        pageSize = displaySettings.ArchiveListOverridePageSize;
                    }

                    if (displaySettings.OverrideArchiveListItemHeadingElement.Length > 0)
                    {
                        itemHeadingElement = displaySettings.OverrideArchiveListItemHeadingElement;
                    }

                    break;

                case "DescendingByDate":
                default:

                    if (displaySettings.PostListOverridePageSize > 0)
                    {
                        pageSize = displaySettings.PostListOverridePageSize;
                    }

                    if (displaySettings.OverrideListItemHeadingElement.Length > 0)
                    {
                        itemHeadingElement = displaySettings.OverrideListItemHeadingElement;
                    }

                    break;

            }

            if (config.AllowComments)
            {
                if ((DisqusSiteShortName.Length > 0) && (config.CommentSystem == "disqus"))
                {
                    disqusFlag = "#disqus_thread";
                    disqus.SiteShortName = DisqusSiteShortName;
                    disqus.RenderCommentCountScript = true;
                    navTop.ShowCommentCount = false;
                    navBottom.ShowCommentCount = false;

                }

                if ((IntenseDebateAccountId.Length > 0) && (config.CommentSystem == "intensedebate"))
                {
                    ShowCommentCounts = false;

                    navTop.ShowCommentCount = false;
                    navBottom.ShowCommentCount = false;
                }

                if (config.CommentSystem == "facebook")
                {
                    ShowCommentCounts = false;
                    navTop.ShowCommentCount = false;
                    navBottom.ShowCommentCount = false;
                }

            }
            else
            {
                navTop.ShowCommentCount = false;
                navBottom.ShowCommentCount = false;
            }

            if (!config.NavigationOnRight)
            {
                this.divblog.CssClass = "blogcenter-leftnav";
            }

            if (config.Copyright.Length > 0)
            {
                lblCopyright.Text = config.Copyright;
            }

            navTop.Visible = false;

            if (config.ShowCalendar
                || config.ShowArchives
                || config.ShowAddFeedLinks
                || config.ShowCategories
                || config.ShowFeedLinks
                || config.ShowStatistics
                || (config.UpperSidebar.Length > 0)
                || (config.LowerSidebar.Length > 0)
                )
            {

                navTop.Visible = true;
            }

            if (!navTop.Visible)
            {
                divblog.CssClass = "blogcenter-nonav";
            }

            if (displaySettings.PostListExtraCss.Length > 0)
            {
                divblog.ExtraCssClasses = " " + displaySettings.PostListExtraCss;
            }

            navBottom.Visible = false;

            if ((navTop.Visible) && (displaySettings.UseBottomNavigation))
            {
                navTop.Visible = false;
                navBottom.Visible = true;
            }

            //if (IsEditable)
            //{
            //    countOfDrafts = Blog.CountOfDrafts(ModuleId);
            //}

            useFriendlyUrls = BlogConfiguration.UseFriendlyUrls(moduleId);
            if (!WebConfigSettings.UseUrlReWriting) { useFriendlyUrls = false; }
        }
Esempio n. 2
0
        protected virtual void LoadSettings()
        {
            siteSettings     = CacheHelper.GetCurrentSiteSettings();
            siteId           = siteSettings.SiteId;
            currentUser      = SiteUtils.GetCurrentSiteUser();
            TimeOffset       = SiteUtils.GetUserTimeOffset();
            timeZone         = SiteUtils.GetUserTimeZone();
            GmapApiKey       = SiteUtils.GetGmapApiKey();
            addThisAccountId = siteSettings.AddThisDotComUsername;

            if (config.AddThisAccountId.Length > 0)
            {
                addThisAccountId = config.AddThisAccountId;
            }

            pageNumber        = WebUtils.ParseInt32FromQueryString("pagenumber", pageNumber);
            categoryId        = WebUtils.ParseInt32FromQueryString("cat", categoryId);
            Month             = WebUtils.ParseInt32FromQueryString("month", Month);
            Year              = WebUtils.ParseInt32FromQueryString("year", Year);
            attachmentBaseUrl = SiteUtils.GetFileAttachmentUploadPath();

            if (Page is mojoBasePage)
            {
                basePage = Page as mojoBasePage;
                module   = basePage.GetModule(moduleId, Blog.FeatureGuid);
            }

            if (module == null)
            {
                return;
            }

            MaxAllowedGravatarRating = SiteUtils.GetMaxAllowedGravatarRating();
            UserNameTooltipFormat    = displaySettings.AvatarUserNameTooltipFormat;

            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 (!config.ShowAuthorAvatar) { disableAvatars = true; }

            if (config.UseExcerpt && !displaySettings.ShowAvatarWithExcerpt)
            {
                disableAvatars = true;
            }

            CalendarDate = WebUtils.ParseDateFromQueryString("blogdate", DateTime.UtcNow).Date;

            if (CalendarDate > DateTime.UtcNow.Date)
            {
                CalendarDate = DateTime.UtcNow.Date;
            }

            if ((config.UseExcerpt) && (!config.GoogleMapIncludeWithExcerpt))
            {
                ShowGoogleMap = false;
            }

            EnableContentRating = config.EnableContentRating && !displaySettings.PostListDisableContentRating;
            if (config.UseExcerpt)
            {
                EnableContentRating = false;
            }



            //if (config.AddThisCustomBrand.Length > 0)
            //{
            //    addThisCustomBrand = config.AddThisCustomBrand;
            //}



            if (config.DisqusSiteShortName.Length > 0)
            {
                DisqusSiteShortName = config.DisqusSiteShortName;
            }
            else
            {
                DisqusSiteShortName = siteSettings.DisqusSiteShortName;
            }

            if (config.IntenseDebateAccountId.Length > 0)
            {
                IntenseDebateAccountId = config.IntenseDebateAccountId;
            }
            else
            {
                IntenseDebateAccountId = siteSettings.IntenseDebateAccountId;
            }

            navTop.ModuleId      = ModuleId;
            navTop.ModuleGuid    = module.ModuleGuid;
            navTop.PageId        = PageId;
            navTop.IsEditable    = IsEditable;
            navTop.Config        = config;
            navTop.SiteRoot      = SiteRoot;
            navTop.ImageSiteRoot = ImageSiteRoot;

            navBottom.ModuleId      = ModuleId;
            navBottom.ModuleGuid    = module.ModuleGuid;
            navBottom.PageId        = PageId;
            navBottom.IsEditable    = IsEditable;
            navBottom.Config        = config;
            navBottom.SiteRoot      = SiteRoot;
            navBottom.ImageSiteRoot = ImageSiteRoot;

            TitleOnly             = config.TitleOnly || displaySettings.PostListForceTitleOnly;
            ShowTweetThisLink     = config.ShowTweetThisLink && !config.UseExcerpt;
            ShowPlusOneButton     = config.ShowPlusOneButton && !config.UseExcerpt;
            UseFacebookLikeButton = config.UseFacebookLikeButton && !config.UseExcerpt;
            useExcerpt            = config.UseExcerpt || displaySettings.PostListForceExcerptMode;
            pageSize      = config.PageSize;
            AllowComments = Config.AllowComments && ShowCommentCounts;

            //TODO: should we use separate settings for each displaymode?
            switch (displayMode)
            {
            case "ByCategory":

                if (displaySettings.CategoryListForceTitleOnly)
                {
                    TitleOnly = true;
                }

                if (displaySettings.CategoryListOverridePageSize > 0)
                {
                    pageSize = displaySettings.CategoryListOverridePageSize;
                }

                if (displaySettings.ArchiveViewHideFeedbackLink)
                {
                    AllowComments = false;
                }

                if (displaySettings.OverrideCategoryListItemHeadingElement.Length > 0)
                {
                    itemHeadingElement = displaySettings.OverrideCategoryListItemHeadingElement;
                }

                break;

            case "ByMonth":

                if (displaySettings.ArchiveListForceTitleOnly)
                {
                    TitleOnly = true;
                }

                if (displaySettings.ArchiveListOverridePageSize > 0)
                {
                    pageSize = displaySettings.ArchiveListOverridePageSize;
                }

                if (displaySettings.OverrideArchiveListItemHeadingElement.Length > 0)
                {
                    itemHeadingElement = displaySettings.OverrideArchiveListItemHeadingElement;
                }

                break;

            case "DescendingByDate":
            default:

                if (displaySettings.PostListOverridePageSize > 0)
                {
                    pageSize = displaySettings.PostListOverridePageSize;
                }

                if (displaySettings.OverrideListItemHeadingElement.Length > 0)
                {
                    itemHeadingElement = displaySettings.OverrideListItemHeadingElement;
                }

                break;
            }



            if (config.AllowComments)
            {
                if ((DisqusSiteShortName.Length > 0) && (config.CommentSystem == "disqus"))
                {
                    disqusFlag                      = "#disqus_thread";
                    disqus.SiteShortName            = DisqusSiteShortName;
                    disqus.RenderCommentCountScript = true;
                    navTop.ShowCommentCount         = false;
                    navBottom.ShowCommentCount      = false;
                }

                if ((IntenseDebateAccountId.Length > 0) && (config.CommentSystem == "intensedebate"))
                {
                    ShowCommentCounts = false;

                    navTop.ShowCommentCount    = false;
                    navBottom.ShowCommentCount = false;
                }

                if (config.CommentSystem == "facebook")
                {
                    ShowCommentCounts          = false;
                    navTop.ShowCommentCount    = false;
                    navBottom.ShowCommentCount = false;
                }
            }
            else
            {
                navTop.ShowCommentCount    = false;
                navBottom.ShowCommentCount = false;
            }


            if (!config.NavigationOnRight)
            {
                this.divblog.CssClass = "blogcenter-leftnav";
            }


            if (config.Copyright.Length > 0)
            {
                lblCopyright.Text = config.Copyright;
            }



            navTop.Visible = false;

            if (config.ShowCalendar ||
                config.ShowArchives ||
                config.ShowAddFeedLinks ||
                config.ShowCategories ||
                config.ShowFeedLinks ||
                config.ShowStatistics ||
                (config.UpperSidebar.Length > 0) ||
                (config.LowerSidebar.Length > 0)
                )
            {
                navTop.Visible = true;
            }



            if (!navTop.Visible)
            {
                divblog.CssClass = "blogcenter-nonav";
            }

            if (displaySettings.PostListExtraCss.Length > 0)
            {
                divblog.ExtraCssClasses = " " + displaySettings.PostListExtraCss;
            }

            navBottom.Visible = false;

            if ((navTop.Visible) && (displaySettings.UseBottomNavigation))
            {
                navTop.Visible    = false;
                navBottom.Visible = true;
            }

            //if (IsEditable)
            //{
            //    countOfDrafts = Blog.CountOfDrafts(ModuleId);
            //}

            useFriendlyUrls = BlogConfiguration.UseFriendlyUrls(moduleId);
            if (!WebConfigSettings.UseUrlReWriting)
            {
                useFriendlyUrls = false;
            }
        }