Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                //Create a language selection link for each language defined in WetBoewGroup/WetBoew/Languages section
                WetBoewConfiguration config             = WetBoewConfiguration.GetConfiguration();
                LanguagesCollection  myLanguagesSection = config.Languages as LanguagesCollection;

                DataTable dt = new DataTable();
                dt.Columns.Add("abbr", typeof(string));
                dt.Columns.Add("name", typeof(string));
                dt.Columns.Add("page", typeof(string));

                for (int i = 0; i < myLanguagesSection.Count; i++)
                {
                    string abbr = myLanguagesSection[i].Abbr;

                    if (abbr != ((BasePage)Page).Language)
                    {
                        DataRow dr = dt.NewRow();
                        dr["abbr"] = abbr;
                        dr["name"] = myLanguagesSection[i].Name;
                        dr["page"] = TranslatePage(Request.RawUrl, abbr);
                        dt.Rows.Add(dr);
                    }
                }

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                WetBoewConfiguration config             = WetBoewConfiguration.GetConfiguration();
                LanguagesCollection  myLanguagesSection = config.Languages as LanguagesCollection;

                string abbr         = "";
                string title        = "";
                string pageTitle    = "";
                string headingTitle = "";

                for (int i = 0; i < myLanguagesSection.Count; i++)
                {
                    abbr      = myLanguagesSection[i].Abbr;
                    title     = TranslateTitles(abbr);
                    pageTitle = pageTitle + string.Format("{0} - {1} / ", title, myLanguagesSection[i].SiteName);

                    if (abbr != ((BasePage)Page).Language)
                    {
                        headingTitle = headingTitle + string.Format("<span lang='{0}'>{1} - {2}</span> / ", abbr, title, myLanguagesSection[i].SiteName);
                    }
                    else
                    {
                        headingTitle = pageTitle;
                    }
                }

                pageTitle    = pageTitle.TrimEnd("/ ".ToArray());
                headingTitle = headingTitle.TrimEnd("/ ".ToArray());

                Page.Title        = pageTitle;
                LiteralTitle.Text = headingTitle;
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Set the sitemap provider.  Assuming that each provider is prefixed with the language abbreviation.
            string lang = ((BasePage)Page).Language;

            myProvider = string.Format("{0}FooterSiteMapProvider", lang.ToUpper());
            SiteMapDataSource1.SiteMapProvider = myProvider;

            //Set the licence and transparency links.
            WetBoewConfiguration config             = WetBoewConfiguration.GetConfiguration();
            LanguagesCollection  myLanguagesSection = config.Languages as LanguagesCollection;

            for (int i = 0; i < myLanguagesSection.Count; i++)
            {
                if (myLanguagesSection[i].Abbr == ((BasePage)Page).Language)
                {
                    Terms.NavigateUrl = myLanguagesSection[i].LicencePage;
                    break;
                }
            }

            if (lang == "fr")
            {
                Trans.NavigateUrl = "http://www.tbs-sct.gc.ca/tbs-sct/common/trans-fra.asp";
            }
            else
            {
                Trans.NavigateUrl = "http://www.tbs-sct.gc.ca/tbs-sct/common/trans-eng.asp";
            }

            Terms.Text = Localization.TemplateStrings.tmpl_terms;
            Trans.Text = Localization.TemplateStrings.tmpl_transparency;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WetBoewConfiguration config = WetBoewConfiguration.GetConfiguration();

            //Read the site title and home page from the custom web.config section.
            LanguagesCollection myLanguagesSection = config.Languages as LanguagesCollection;
            string lang = ((BasePage)Page).Language;

            for (int i = 0; i < myLanguagesSection.Count; i++)
            {
                if (myLanguagesSection[i].Abbr == lang)
                {
                    HyperLinkSiteTitle.Text = string.Format("<span>{0}</span>", myLanguagesSection[i].SiteName);
                    HyperLinkSiteTitle.NavigateUrl = myLanguagesSection[i].HomePage;
                    break;
                }
            }

            //Hide the breadcrumbs depending on the setting of WetBoewGroup/WetBoew/@showBreadcrumbTrail in web.config.
            bool showBreadcrumbTrail = config.ShowBreadcrumbTrail;

            if (!showBreadcrumbTrail)
            {
                Breadcrumb.Visible = false;
            }

            //Hide the search depending on the setting of WetBoewGroup/WetBoew/@showSearch in web.config.
            bool showSearch = config.ShowSearch;

            if (!showSearch)
            {
                Search.Visible = false;
            }

            //Show a section menu if required.
            if (((BasePage)Page).ShowSectionMenu)
            {
                container.CssClass = "container";
                row.CssClass = "row";
                main.Attributes["class"] = "col-md-9 col-md-push-3";

                GCIntranetTheme.Controls.SectionMenu SectionMenu1 = (GCIntranetTheme.Controls.SectionMenu)LoadControl("~/Controls/SectionMenu.ascx") as GCIntranetTheme.Controls.SectionMenu;
                row.Controls.Add(SectionMenu1);
            }

            //Hide the language selection link(s) if the WetBoewGroup/WetBoew/Languages section only has one language defined.
            bool showLanguage = (config.Languages.Count > 1? true: false);

            if (!showLanguage)
            {
                LanguageSelection.Visible = false;
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                WetBoewConfiguration config             = WetBoewConfiguration.GetConfiguration();
                LanguagesCollection  myLanguagesSection = config.Languages as LanguagesCollection;

                string abbr         = "";
                string title        = "";
                string pageTitle    = "";
                string headingTitle = "";

                for (int i = 0; i < myLanguagesSection.Count; i++)
                {
                    abbr      = myLanguagesSection[i].Abbr;
                    title     = TranslateTitles(abbr);
                    pageTitle = pageTitle + string.Format("{0} - {1} / ", title, myLanguagesSection[i].SiteName);

                    if (abbr != ((BasePage)Page).Language)
                    {
                        headingTitle = headingTitle + string.Format("<span lang='{0}'>{1} - {2}</span> / ", abbr, title, myLanguagesSection[i].SiteName);
                    }
                    else
                    {
                        headingTitle = pageTitle;
                    }
                }

                pageTitle    = pageTitle.TrimEnd("/ ".ToArray());
                headingTitle = headingTitle.TrimEnd("/ ".ToArray());

                Page.Title        = pageTitle;
                LiteralTitle.Text = headingTitle;

                //For this theme only, need a way to replace two "theme" css files with "theme-sp-pe" files.
                List <HtmlLink> oldLinks = new List <HtmlLink>();

                foreach (Control c in Page.Header.Controls)
                {
                    if (c is HtmlLink && (c as HtmlLink).Attributes["rel"] == "stylesheet")
                    {
                        oldLinks.Add(c as HtmlLink);
                    }
                }

                foreach (HtmlLink oldLink in oldLinks)
                {
                    oldLink.Href = oldLink.Href.Replace("theme", "theme-sp-pe");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WetBoewConfiguration config = WetBoewConfiguration.GetConfiguration();

            //Read the site title and home page from the custom web.config section.
            LanguagesCollection myLanguagesSection = config.Languages as LanguagesCollection;
            string lang = ((BasePage)Page).Language;

            for (int i = 0; i < myLanguagesSection.Count; i++)
            {
                if (myLanguagesSection[i].Abbr == lang)
                {
                    HyperLinkSiteTitle.Text        = string.Format("<span>{0}</span>", myLanguagesSection[i].SiteName);
                    HyperLinkSiteTitle.NavigateUrl = myLanguagesSection[i].HomePage;
                    break;
                }
            }

            //Hide the breadcrumbs depending on the setting of WetBoewGroup/WetBoew/@showBreadcrumbTrail in web.config.
            bool showBreadcrumbTrail = config.ShowBreadcrumbTrail;

            if (!showBreadcrumbTrail)
            {
                Breadcrumb.Visible = false;
            }

            //Hide the search depending on the setting of WetBoewGroup/WetBoew/@showSearch in web.config.
            bool showSearch = config.ShowSearch;

            if (!showSearch)
            {
                Search.Visible = false;
            }

            //Hide the language selection link(s) if the WetBoewGroup/WetBoew/Languages section only has one language defined.
            bool showLanguage = (config.Languages.Count > 1 ? true : false);

            if (!showLanguage)
            {
                LanguageSelection.Visible = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //Set the sitemap provider.  Assuming that each provider is prefixed with the language abbreviation.
            string lang = ((BasePage)Page).Language;

            myProvider = string.Format("{0}HeaderSiteMapProvider", lang.ToUpper());
            SiteMapDataSource1.SiteMapProvider = myProvider;

            //Hide or show the site menu depending on the setting of WetBoewGroup/WetBoew/@showSiteMenu in web.config.
            WetBoewConfiguration config = WetBoewConfiguration.GetConfiguration();
            bool showSiteMenu           = config.ShowSiteMenu;

            if (showSiteMenu)
            {
                this.PlaceHolderSiteMenu.Visible   = true;
                this.PlaceHolderNoSiteMenu.Visible = false;
            }
            else
            {
                this.PlaceHolderSiteMenu.Visible   = false;
                this.PlaceHolderNoSiteMenu.Visible = true;
            }
        }