zoukankan      html  css  js  c++  java
  • Mojoportal2339之汇总页面

    更新:下面的方法是不必要的,mojoportal本身提供了模块实例的多页面映射功能。

    Mojoportal作为一个web开发平台,是十分优秀的,解决了用户管理和页面权限等诸多问题,当然他也是一个优秀的cms系统。

    我们可以把他的博客模块稍加改进,增加在父页面上,可以浏览子页面博客内容的功能。

    如下图:

    我的页面”下有三个子页面,当点击“我的页面”时,可以显示3个子页面内的内容。

    第一步;建立CusBlogModule.ascx模块文件,这个文件和BlogModule.ascx文件大致相同,只是改一下文件名和代码文件名,并在loadSetting()方法中增加如下代码:

       if (Settings.Contains("CusBlogModuleID"))

                {

                    if (Settings["CusBlogModuleID"].ToString() != null && Settings["CusBlogModuleID"].ToString()!="")

                    {

                        CusModuleID= Int32.Parse(Settings["CusBlogModuleID"].ToString());

                    }

                  

                }

    第二步:在网站后台添加这个模块,并添加配置,添加CusBlogModuleID设置,默认值为空

    第三步:修改blogviewControl.ascx.cs中相关设置,使得文章内容页面可以顺利访问。

     

    大体思路就是添加一个CusModuleID变量,根据CusModuleID获取相关数据
     

    代码
     
    using System;
    using System.Configuration;
    using System.Data;
    using System.Globalization;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using log4net;
    using mojoPortal.Business;
    using mojoPortal.Web.Framework;
    using mojoPortal.Web.UI;
    using mojoPortal.Web.Controls;
    using mojoPortal.Web.Controls.google;
    using Resources;
    using Calendar = System.Web.UI.WebControls.Calendar;

    namespace mojoPortal.Web.BlogUI
    {
        
    public partial class CusBlogModule : SiteModuleControl
        {
            
    #region Properties

            
    private static readonly ILog log = LogManager.GetLogger(typeof(BlogModule));

            
    private int countOfDrafts = 0;
            
    private int pageNumber = 1;
            
    private int totalPages = 1;
            
    private int pageSize = 5;

            
    //添加
            public  int CusModuleId=0;
            
    private bool showPager = true;
            
    protected string addThisAccountId = string.Empty;
            
    protected bool useAddThisMouseOverWidget = true;
            
    protected string addThisCustomBrand = string.Empty;
            
    protected string addThisButtonImageUrl = "~/Data/SiteImages/addthissharebutton.gif";
            
    protected string addThisCustomOptions = string.Empty;
            
    protected string addThisCustomLogoUrl = string.Empty;
            
    protected string addThisCustomLogoBackColor = string.Empty;
            
    protected string addThisCustomLogoForeColor = string.Empty;
            
    protected string feedburnerFeedUrl = string.Empty;
            
    protected string EditContentImage = WebConfigSettings.EditContentImage;
            
    protected string EditBlogAltText = "Edit";
            
    protected string BlogDateTimeFormat;
            
    protected string FeedBackLabel;
            
    protected bool ShowCalendar = false;
            
    protected DateTime CalendarDate;
            
    protected bool ShowCategories = false;
            
    protected bool ShowArchives = false;
            
    protected bool AllowComments = true;
            
    protected bool NavigationOnRight = false;
            
    protected bool ShowStatistics = false;
            
    protected bool ShowFeedLinks = false;
            
    protected bool ShowAddFeedLinks = false;
            
    protected bool BlogUseLinkForHeading = true;
            
    protected Double TimeOffset = 0;
            
    protected string GmapApiKey = string.Empty;
            
    protected int GoogleMapHeightSetting = 300;
            
    protected int GoogleMapWidthSetting = 500;
            
    protected bool GoogleMapEnableMapTypeSetting = false;
            
    protected bool GoogleMapEnableZoomSetting = false;
            
    protected bool GoogleMapShowInfoWindowSetting = false;
            
    protected bool GoogleMapEnableLocalSearchSetting = false;
            
    protected bool GoogleMapEnableDirectionsSetting = false;
            
    protected int GoogleMapInitialZoomSetting = 13;
            
    protected MapType mapType = MapType.G_SATELLITE_MAP;
            
    protected string OdiogoFeedIDSetting = string.Empty;
            
    protected bool UseExcerpt = false;
            
    protected bool TitleOnly = true ;
            
    protected bool HideAddThisButton = false;
            
    protected int ExcerptLength = 250;
            
    protected string ExcerptSuffix = "...";
            
    protected string MoreLinkText = "read more";
            
    protected bool EnableContentRatingSetting = false;
            
    protected bool EnableRatingCommentsSetting = false;
            
    protected bool ShowPostAuthorSetting = false;
            
    protected bool GoogleMapIncludeWithExcerptSetting = false;
            
    protected bool ShowGoogleMap = false;
            
    protected bool BlogUseTagCloudForCategoriesSetting = false;
            
    protected string blogAuthor = string.Empty;
            
    private string CommentSystem = "internal";
            
    private string DisqusSiteShortName = string.Empty;
            
    protected string disqusFlag = string.Empty;
            
    protected string IntenseDebateAccountId = string.Empty;
            
    protected bool ShowCommentCounts = true;
            
    protected string EditLinkText = BlogResources.BlogEditEntryLink;
            
    protected string EditLinkTooltip = BlogResources.BlogEditEntryLink;
            
    protected string EditLinkImageUrl = string.Empty;



            
    #endregion


            
    protected override void OnInit(EventArgs e)
            {
                
    base.OnInit(e);
                
    this.Load += new EventHandler(Page_Load);
                
    this.calBlogNav.SelectionChanged += new EventHandler(calBlogNav_SelectionChanged);
                
    this.calBlogNav.VisibleMonthChanged += new MonthChangedEventHandler(CalBlogNavVisibleMonthChanged);
                pgr.Command 
    += new CommandEventHandler(pgr_Command);
                
    this.EnableViewState = false;

            }





            
    protected virtual void Page_Load(object sender, EventArgs e)
            {
                LoadSettings();

                SetupCss();
                
    if (!RenderInWebPartMode)
                {
                    SetupRssLink();
                }

                PopulateLabels();
                
    if (!Page.IsPostBack)
                {
                    PopulateControls();
                }

            }

            
    private void PopulateControls()
            {
                BindBlogs();
                PopulateNavigation();

            }

            
    private void BindBlogs()
            {
                
    //有修改
                using (IDataReader reader = Blog.GetPage(CusModuleId, CalendarDate.Date.AddDays(1), pageNumber, pageSize, out totalPages))
                {
                    rptBlogs.DataSource 
    = reader;
                    rptBlogs.DataBind();

                    pgr.ShowFirstLast 
    = true;
                    pgr.PageSize 
    = pageSize;
                    pgr.PageCount 
    = totalPages;
                    pgr.Visible 
    = (totalPages > 1&& showPager;
                }

            }

            
    void pgr_Command(object sender, CommandEventArgs e)
            {
                pageNumber 
    = Convert.ToInt32(e.CommandArgument);
                pgr.CurrentIndex 
    = pageNumber;
                PopulateControls();
                updBlog.Update();
            }

            
    protected virtual void PopulateNavigation()
            {

                Feeds.ModuleSettings 
    = Settings;
                Feeds.PageId 
    = PageId;
                
    //有修改
                Feeds.ModuleId = CusModuleId;
                Feeds.Visible 
    = ShowFeedLinks;

                
    if (this.ShowCategories)
                {
                    tags.CanEdit 
    = IsEditable;
                    tags.PageId 
    = PageId;
                    
    //有修改
                    tags.ModuleId = CusModuleId;
                    tags.SiteRoot 
    = SiteRoot;
                    tags.RenderAsTagCloud 
    = BlogUseTagCloudForCategoriesSetting;
                }
                
    else
                {
                    tags.Visible 
    = false;
                    
    this.pnlCategories.Visible = false;
                }

                
    if (this.ShowArchives)
                {
                    archive.PageId 
    = PageId;
                    
    //有修改
                    archive.ModuleId = CusModuleId;
                    archive.SiteRoot 
    = SiteRoot;
                }
                
    else
                {
                    archive.Visible 
    = false;
                    
    this.pnlArchives.Visible = false;
                }

                stats.PageId 
    = PageId;
                
    //有修改
                stats.ModuleId = CusModuleId;
                stats.CountOfDrafts 
    = countOfDrafts;
                stats.Visible 
    = ShowStatistics;

            }

            
    private void calBlogNav_SelectionChanged(object sender, EventArgs e)
            {
                System.Web.UI.WebControls.Calendar cal 
    = (System.Web.UI.WebControls.Calendar)sender;

                CalendarDate 
    = cal.SelectedDate;
                calBlogNav.VisibleDate 
    = CalendarDate;
                calBlogNav.SelectedDate 
    = CalendarDate;
                PopulateControls();

            }

            
    private void CalBlogNavVisibleMonthChanged(object sender, MonthChangedEventArgs e)
            {
                CalendarDate 
    = e.NewDate;
                calBlogNav.VisibleDate 
    = CalendarDate;
                calBlogNav.SelectedDate 
    = CalendarDate;
                PopulateControls();

            }




            
    protected virtual void PopulateLabels()
            {
                Title1.EditUrl 
    = SiteRoot + "/Blog/EditPost.aspx";
                
    //Title1.EditText = BlogResources.BlogAddPostLabel;

                Title1.EditText 
    = "";

                
    if ((IsEditable) && (countOfDrafts > 0))
                {
                    
    //BlogEditCategoriesLabel  //有修改
                    Title1.LiteralExtraMarkup =
                          
    "&nbsp;<a href='"
                        
    + SiteRoot
                        
    + "/Blog/EditPost.aspx?pageid=" + PageId.ToInvariantString()
                        
    + "&amp;mid=" + CusModuleId.ToInvariantString()
                        
    + "' class='ModuleEditLink' title='" +"添加文章" + "'>" + "添加文章" + "</a>"
                        
    + "&nbsp;<a href='"
                        
    + SiteRoot
                        
    + "/Blog/EditCategory.aspx?pageid=" + PageId.ToInvariantString()
                        
    + "&amp;mid=" + CusModuleId.ToInvariantString()
                        
    + "' class='ModuleEditLink' title='" + BlogResources.BlogEditCategoriesLabel + "'>" + BlogResources.BlogEditCategoriesLabel + "</a>"
                        
    + "&nbsp;<a href='"
                        
    + SiteRoot
                        
    + "/Blog/Drafts.aspx?pageid=" + PageId.ToInvariantString()
                        
    + "&amp;mid=" + CusModuleId.ToInvariantString()
                        
    + "' class='ModuleEditLink' title='" + BlogResources.BlogDraftsLink + "'>" + BlogResources.BlogDraftsLink + "</a>";
                }
                
    else if (IsEditable)
                {
                    
    //有修改
                    Title1.LiteralExtraMarkup =
                          
    "&nbsp;<a href='"
                        
    + SiteRoot
                        
    + "/Blog/EditPost.aspx?pageid=" + PageId.ToInvariantString()
                        
    + "&amp;mid=" + CusModuleId.ToInvariantString()
                         
    + "' class='ModuleEditLink' title='" + "添加文章" + "'>" + "添加文章" + "</a>"
                        
    +"&nbsp;<a href='"
                        
    + SiteRoot
                        
    + "/Blog/EditCategory.aspx?pageid=" + PageId.ToInvariantString()
                        
    + "&amp;mid=" + CusModuleId.ToInvariantString()
                        
    + "' class='ModuleEditLink' title='" + BlogResources.BlogEditCategoriesLabel + "'>" + BlogResources.BlogEditCategoriesLabel + "</a>";
                }



                calBlogNav.UseAccessibleHeader 
    = true;

                EditBlogAltText 
    = BlogResources.EditImageAltText;
                FeedBackLabel 
    = BlogResources.BlogFeedbackLabel;

                mojoBasePage basePage 
    = Page as mojoBasePage;
                
    if (basePage != null)
                {
                    
    if (basePage.UseIconsForAdminLinks)
                    {
                        EditLinkImageUrl 
    = ImageSiteRoot + "/Data/SiteImages/" + EditContentImage;
                    }

                }

            }

            
    protected string FormatPostAuthor(string authorName)
            {
                
    if (ShowPostAuthorSetting)
                {
                    
    if (blogAuthor.Length > 0)
                    {
                        
    return string.Format(CultureInfo.InvariantCulture,
                        BlogResources.PostAuthorFormat, blogAuthor);
                    }

                    
    return string.Format(CultureInfo.InvariantCulture,
                        BlogResources.PostAuthorFormat, authorName);
                }

                
    return string.Empty;

            }

            
    protected string FormatBlogEntry(string blogHtml, string excerpt, string url, int itemId)
            {
                
    if (UseExcerpt)
                {
                    
    if ((excerpt.Length > 0&& (excerpt != "<p>&#160;</p>"))
                    {
                        
    return excerpt + ExcerptSuffix + " <a href='" + FormatBlogUrl(url, itemId) + "'>" + MoreLinkText + "</a><div>&nbsp;</div>";
                    }

                    
    string result = string.Empty;
                    
    if ((blogHtml.Length > ExcerptLength) && (MoreLinkText.Length > 0))
                    {

                        result 
    = UIHelper.CreateExcerpt(blogHtml, ExcerptLength, ExcerptSuffix);
                        result 
    += " <a href='" + FormatBlogTitleUrl(url, itemId) + "'>" + MoreLinkText + "</a><div>&nbsp;</div>";
                        
    return result;
                    }

                }

                
    return blogHtml;
            }
            
    //有修改
            protected string FormatBlogUrl(string itemUrl, int itemId)
            {
                
    if (itemUrl.Length > 0)
                    
    return SiteRoot + itemUrl.Replace("~"string.Empty) + disqusFlag;

                
    return SiteRoot + "/Blog/ViewPost.aspx?pageid=" + PageId.ToInvariantString()
                    
    + "&ItemID=" + itemId.ToInvariantString()
                    
    + "&mid=" + CusModuleId.ToInvariantString()
                    
    + disqusFlag;

            }
            
    //有修改
            protected string FormatBlogTitleUrl(string itemUrl, int itemId)
            {
                
    if (itemUrl.Length > 0)
                    
    return SiteRoot + itemUrl.Replace("~"string.Empty);

                
    return SiteRoot + "/Blog/ViewPost.aspx?pageid=" + PageId.ToInvariantString()
                    
    + "&ItemID=" + itemId.ToInvariantString()
                    
    + "&mid=" + CusModuleId.ToInvariantString();

            }
            
    //有修改
            private string GetRssUrl()
            {
                
    if (feedburnerFeedUrl.Length > 0return feedburnerFeedUrl;

                
    return SiteRoot + "/blog" + CusModuleId.ToInvariantString() + "rss.aspx";

            }

            
    protected virtual void SetupRssLink()
            {
                
    if (this.ModuleConfiguration != null)
                {
                    
    if (Page.Master != null)
                    {
                        Control head 
    = Page.Master.FindControl("Head1");
                        
    if (head != null)
                        {

                            Literal rssLink 
    = new Literal();
                            rssLink.Text 
    = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\""
                                    + this.ModuleConfiguration.ModuleTitle + "\" href=\""
                                    
    + GetRssUrl() + "\" />";

                            head.Controls.Add(rssLink);

                        }

                    }
                }

            }

            
    protected virtual void SetupCss()
            {

                
    // older skins have this
                StyleSheet stylesheet = (StyleSheet)Page.Master.FindControl("StyleSheet");
                
    if (stylesheet != null)
                {
                    
    if (stylesheet.FindControl("blogcss"== null)
                    {
                        Literal cssLink 
    = new Literal();
                        cssLink.ID 
    = "blogcss";
                        cssLink.Text 
    = "\n<link href='"
                        
    + SiteUtils.GetSkinBaseUrl()
                        
    + "blogmodule.css' type='text/css' rel='stylesheet' media='screen' />";

                        stylesheet.Controls.Add(cssLink);
                    }

                    
    if (stylesheet.FindControl("aspcalendar"== null)
                    {
                        Literal cssLink 
    = new Literal();
                        cssLink.ID 
    = "aspcalendar";
                        cssLink.Text 
    = "\n<link href='"
                        
    + SiteUtils.GetSkinBaseUrl()
                        
    + "aspcalendar.css' type='text/css' rel='stylesheet' media='screen' />";

                        stylesheet.Controls.Add(cssLink);
                    }

                }

            }


            
    protected virtual void LoadSettings()
            {
                TimeOffset 
    = SiteUtils.GetUserTimeOffset();
                GmapApiKey 
    = SiteUtils.GetGmapApiKey();
                addThisAccountId 
    = siteSettings.AddThisDotComUsername;

                
    try
                {
                    
    // this keeps the action from changing during ajax postback in folder based sites
                    SiteUtils.SetFormAction(Page, Request.RawUrl);
                }
                
    catch (MissingMethodException)
                {
                    
    //this method was introduced in .NET 3.5 SP1
                }

                pnlContainer.ModuleId 
    = this.ModuleId;

                
    if (this.ModuleConfiguration != null)
                {
                    
    this.Title = this.ModuleConfiguration.ModuleTitle;
                    
    this.Description = this.ModuleConfiguration.FeatureName;
                }

                
    if (Page.Request.Params.Get("blogdate"!= null)
                {

                    
    //calendarDate = DateTime.Parse(Page.Request.Params.Get("blogdate"));
                    DateTimeFormatInfo dtfi = CultureInfo.InvariantCulture.DateTimeFormat;
                    
    if (!DateTime.TryParse(Page.Request.Params.Get("blogdate"), dtfi, DateTimeStyles.AdjustToUniversal, out CalendarDate))
                    {
                        CalendarDate 
    = DateTime.UtcNow.Date;
                    }

                }
                
    else
                {
                    CalendarDate 
    = DateTime.UtcNow.Date;
                }

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


                UseExcerpt 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "BlogUseExcerptSetting", UseExcerpt);

                TitleOnly 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "BlogShowTitleOnlySetting", TitleOnly);

                showPager 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "BlogShowPagerInListSetting", showPager);


                GoogleMapIncludeWithExcerptSetting 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "GoogleMapIncludeWithExcerptSetting", GoogleMapIncludeWithExcerptSetting);

                
    if ((UseExcerpt) && (!GoogleMapIncludeWithExcerptSetting)) { ShowGoogleMap = false; }


                EnableContentRatingSetting 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "EnableContentRatingSetting", EnableContentRatingSetting);

                EnableRatingCommentsSetting 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "EnableRatingCommentsSetting", EnableRatingCommentsSetting);

                
    if (UseExcerpt) { EnableContentRatingSetting = false; }

                HideAddThisButton 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "BlogHideAddThisButtonSetting", HideAddThisButton);

                ExcerptLength 
    = WebUtils.ParseInt32FromHashtable(
                    Settings, 
    "BlogExcerptLengthSetting", ExcerptLength);

                
    if (Settings.Contains("BlogExcerptSuffixSetting"))
                {
                    ExcerptSuffix 
    = Settings["BlogExcerptSuffixSetting"].ToString();
                }

                
    if (Settings.Contains("BlogMoreLinkText"))
                {
                    MoreLinkText 
    = Settings["BlogMoreLinkText"].ToString();
                }

                
    if (Settings.Contains("BlogAuthorSetting"))
                {
                    blogAuthor 
    = Settings["BlogAuthorSetting"].ToString();
                }

                BlogDateTimeFormat 
    = CultureInfo.CurrentCulture.DateTimeFormat.FullDateTimePattern;
                
    if (Settings.Contains("BlogDateTimeFormat"))
                {
                    BlogDateTimeFormat 
    = Settings["BlogDateTimeFormat"].ToString().Trim();
                    
    if (BlogDateTimeFormat.Length > 0)
                    {
                        
    try
                        {
                            
    string d = DateTime.Now.ToString(BlogDateTimeFormat, CultureInfo.CurrentCulture);
                        }
                        
    catch (FormatException)
                        {
                            BlogDateTimeFormat 
    = CultureInfo.CurrentCulture.DateTimeFormat.FullDateTimePattern;
                        }
                    }
                    
    else
                    {
                        BlogDateTimeFormat 
    = CultureInfo.CurrentCulture.DateTimeFormat.FullDateTimePattern;
                    }
                }



                ShowCalendar 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "BlogShowCalendarSetting"false);

                ShowCategories 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "BlogShowCategoriesSetting"false);

                BlogUseTagCloudForCategoriesSetting 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "BlogUseTagCloudForCategoriesSetting"false);

                ShowArchives 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "BlogShowArchiveSetting"false);

                NavigationOnRight 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "BlogNavigationOnRightSetting"false);

                ShowStatistics 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "BlogShowStatisticsSetting"false);

                ShowFeedLinks 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "BlogShowFeedLinksSetting"false);

                ShowAddFeedLinks 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "BlogShowAddFeedLinksSetting"false);

                AllowComments 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "BlogAllowComments"false);

                BlogUseLinkForHeading 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "BlogUseLinkForHeading"true);

                ShowPostAuthorSetting 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "ShowPostAuthorSetting", ShowPostAuthorSetting);

                
    if (Settings.Contains("GoogleMapInitialMapTypeSetting"))
                {
                    
    string gmType = Settings["GoogleMapInitialMapTypeSetting"].ToString();
                    
    try
                    {
                        mapType 
    = (MapType)Enum.Parse(typeof(MapType), gmType);
                    }
                    
    catch (ArgumentException) { }

                }

                GoogleMapHeightSetting 
    = WebUtils.ParseInt32FromHashtable(
                    Settings, 
    "GoogleMapHeightSetting", GoogleMapHeightSetting);

                GoogleMapWidthSetting 
    = WebUtils.ParseInt32FromHashtable(
                    Settings, 
    "GoogleMapWidthSetting", GoogleMapWidthSetting);


                GoogleMapEnableMapTypeSetting 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "GoogleMapEnableMapTypeSetting"false);

                GoogleMapEnableZoomSetting 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "GoogleMapEnableZoomSetting"false);

                GoogleMapShowInfoWindowSetting 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "GoogleMapShowInfoWindowSetting"false);

                GoogleMapEnableLocalSearchSetting 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "GoogleMapEnableLocalSearchSetting"false);

                GoogleMapEnableDirectionsSetting 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "GoogleMapEnableDirectionsSetting"false);

                GoogleMapInitialZoomSetting 
    = WebUtils.ParseInt32FromHashtable(
                    Settings, 
    "GoogleMapInitialZoomSetting", GoogleMapInitialZoomSetting);

                pageSize 
    = WebUtils.ParseInt32FromHashtable(
                    Settings, 
    "BlogEntriesToShowSetting", pageSize);


                
    if (Settings.Contains("OdiogoFeedIDSetting"))
                    OdiogoFeedIDSetting 
    = Settings["OdiogoFeedIDSetting"].ToString();

                
    string altAddThisAccount = string.Empty;

                
    if (Settings.Contains("BlogAddThisDotComUsernameSetting"))
                    altAddThisAccount 
    = Settings["BlogAddThisDotComUsernameSetting"].ToString().Trim();

                
    if (altAddThisAccount.Length > 0)
                    addThisAccountId 
    = altAddThisAccount;

                useAddThisMouseOverWidget 
    = WebUtils.ParseBoolFromHashtable(
                    Settings, 
    "BlogAddThisDotComUseMouseOverWidgetSetting", useAddThisMouseOverWidget);


                
    if (Settings.Contains("BlogAddThisButtonImageUrlSetting"))
                    addThisButtonImageUrl 
    = Settings["BlogAddThisButtonImageUrlSetting"].ToString().Trim();

                
    if (addThisButtonImageUrl.Length == 0)
                    addThisButtonImageUrl 
    = "~/Data/SiteImages/addthissharebutton.gif";

                
    if (Settings.Contains("BlogAddThisCustomBrandSetting"))
                    addThisCustomBrand 
    = Settings["BlogAddThisCustomBrandSetting"].ToString().Trim();

                
    if (addThisCustomBrand.Length == 0)
                    addThisCustomBrand 
    = siteSettings.SiteName;

                
    if (Settings.Contains("BlogAddThisCustomOptionsSetting"))
                    addThisCustomOptions 
    = Settings["BlogAddThisCustomOptionsSetting"].ToString().Trim();

                
    if (Settings.Contains("BlogAddThisCustomLogoUrlSetting"))
                    addThisCustomLogoUrl 
    = Settings["BlogAddThisCustomLogoUrlSetting"].ToString().Trim();

                
    if (Settings.Contains("BlogAddThisCustomLogoBackColorSetting"))
                    addThisCustomLogoBackColor 
    = Settings["BlogAddThisCustomLogoBackColorSetting"].ToString().Trim();

                
    if (Settings.Contains("BlogAddThisCustomLogoForeColorSetting"))
                    addThisCustomLogoForeColor 
    = Settings["BlogAddThisCustomLogoForeColorSetting"].ToString().Trim();

                
    if (Settings.Contains("BlogFeedburnerFeedUrl"))
                    feedburnerFeedUrl 
    = Settings["BlogFeedburnerFeedUrl"].ToString().Trim();

                
    if (Settings.Contains("DisqusSiteShortName"))
                {
                    DisqusSiteShortName 
    = Settings["DisqusSiteShortName"].ToString();
                }

               
    // 添加的显示模块号
                if (Settings.Contains("CusBlogModuleID"))
                {
                    
    if (Settings["CusBlogModuleID"].ToString() != null && Settings["CusBlogModuleID"].ToString()!="")
                    {
                        CusModuleId 
    = Int32.Parse(Settings["CusBlogModuleID"].ToString());
                    }
                   
                }

                
    if (Settings.Contains("CommentSystemSetting"))
                {
                    CommentSystem 
    = Settings["CommentSystemSetting"].ToString();
                }

                
    if (Settings.Contains("IntenseDebateAccountId"))
                {
                    IntenseDebateAccountId 
    = Settings["IntenseDebateAccountId"].ToString();
                }

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

                    }

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


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

                }
                
    if (ShowCalendar)
                {
                    
    this.calBlogNav.Visible = true;
                    
    try
                    {
                        calBlogNav.FirstDayOfWeek 
    = (FirstDayOfWeek)CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek;
                    }
                    
    catch (ArgumentNullException) { }
                    
    catch (ArgumentOutOfRangeException) { }
                    
    catch (InvalidOperationException) { }
                    
    catch (InvalidCastException) { }

                    
    if (!Page.IsPostBack)
                    {
                        
    this.calBlogNav.SelectedDate = CalendarDate;
                        
    this.calBlogNav.VisibleDate = CalendarDate;

                    }
                }
                
    else
                {
                    
    this.calBlogNav.Visible = false;
                }

                
    if (Settings.Contains("BlogCopyrightSetting"))
                {
                    lblCopyright.Text 
    = Settings["BlogCopyrightSetting"].ToString();
                }

                pnlStatistics.Visible 
    = ShowStatistics;

                divNav.Visible 
    = false;

                
    if (ShowCalendar
                    
    || ShowArchives
                    
    || ShowAddFeedLinks
                    
    || ShowCategories
                    
    || ShowFeedLinks
                    
    || ShowStatistics)
                {
                    divNav.Visible 
    = true;
                }

                
    if (!divNav.Visible)
                {
                    divblog.CssClass 
    = "blogcenter-nonav";
                }
                
    if (IsEditable)
                {
                    countOfDrafts 
    = Blog.CountOfDrafts(CusModuleId);
                }


            }



        }
    }

    之后,是在父页面上,添加新建的这个模块,要显示几个子页面中的博客内容,就添加几个模块,之后指定模块的CusBlogModuleID的值,即要显示的moduleID.

  • 相关阅读:
    背包系列 hdu3449 有依赖背包
    背包系列 hdu 3535 分组背包
    屏蔽scrollview的滚动
    高精度算法代码
    输入法出现时,中间固定,底部上移的代码
    排序之分治排序
    排序之双向冒泡排序
    Miller Rabin 大素数测试
    来聊聊WWDC 苹果大会上的那些黑科技
    不想成为好leader的程序猿不是好攻城狮
  • 原文地址:https://www.cnblogs.com/wenjie/p/1689991.html
Copyright © 2011-2022 走看看