Esempio n. 1
0
        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer);

            // allow third party applications to override the title of the current node in the breadcrumb
            SPCLF3.Master_Pages.CLF3PublishingMaster masterPage = (SPCLF3.Master_Pages.CLF3PublishingMaster) this.Page.Master;
            if (String.IsNullOrEmpty(masterPage.PageTitle))
            {
                if (SPContext.Current.ListItem != null && PublishingPage.IsPublishingPage(SPContext.Current.ListItem))
                {
                    PublishingPage publishingPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);
                    writer.WriteLine(publishingPage.Title);
                }
                else if (SPContext.Current.ListItem != null)
                {
                    writer.Write(SPContext.Current.ListItem.Title);
                }
                else if (SPContext.Current.List != null)
                {
                    writer.Write(SPContext.Current.List.Title);
                }
            }
            else
            {
                writer.WriteLine(masterPage.PageTitle);
            }
        }
        protected override void Render(HtmlTextWriter writer)
        {
            string htmlOutput = string.Empty;

            try
            {
                // setup the outer wrappers
                htmlOutput += "<div class=\"wet-boew-menubar mb-mega\"><div><ul class=\"mb-menu\" data-ajax-replace=\"";

                if (SPContext.Current.Web.Locale.TwoLetterISOLanguageName == "en")
                {
                    htmlOutput += "/Navigation/menu-eng.txt\">";
                }
                else
                {
                    htmlOutput += "/Navigation/menu-fra.txt\">";
                }

                string langWeb = string.Empty;
                if (SPContext.Current.ListItem != null && PublishingPage.IsPublishingPage(SPContext.Current.ListItem))
                {
                    // figure out our language of the current label
                    PublishingPage publishingPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);

                    if (publishingPage.PublishingWeb.Label != null)
                    {
                        langWeb = (publishingPage.PublishingWeb.Label.Title.Substring(0, 2).ToLower() == "en") ? "eng" : "fra";
                    }
                }
                else
                {
                    string cultISO = System.Threading.Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName;
                    langWeb = (cultISO == "en") ? "eng" : "fra";
                }

                string webUrl = SPContext.Current.Web.Url;

                //TODO - Remove this debug logic;
#if DEBUG
                if (webUrl.Contains("l41-106306"))
                {
                    webUrl = webUrl.Replace("l41-106306", "localhost");
                }
#endif

                using (SPSite site = new SPSite(webUrl))
                {
                    htmlOutput += renderTopLevelLink(langWeb);

                    // setup the outer wrappers
                    htmlOutput += "</ul></div></div>";

                    writer.Write(htmlOutput);
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog(ex.Message + " " + ex.StackTrace);
            }
        }
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            try
            {
                string langWeb = string.Empty;

                if (SPContext.Current.ListItem != null && PublishingPage.IsPublishingPage(SPContext.Current.ListItem))
                {
                    // figure out our language of the current label
                    PublishingPage publishingPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);

                    if (publishingPage.PublishingWeb.Label != null)
                    {
                        langWeb = (publishingPage.PublishingWeb.Label.Title.Substring(0, 2).ToLower() == "en") ? "eng" : "fra";
                    }
                }
                else
                {
                    string cultISO = "";
                    if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("/eng/"))
                    {
                        cultISO = "en";
                    }
                    else
                    {
                        cultISO = "fr";
                    }
                    langWeb = (cultISO == "en") ? "eng" : "fra";
                }

                HtmlGenericControl pnlSearch = new HtmlGenericControl("div");
                pnlSearch.Attributes.Add("class", "form-group");

                txtSearchBox = new TextBox()
                {
                    CssClass = "form-control",
                };
                txtSearchBox.Attributes.Add("type", "search");
                txtSearchBox.Attributes.Add("size", "27");
                txtSearchBox.MaxLength = 150;
                txtSearchBox.Style.Add("margin-right", "5px");
                pnlSearch.Controls.Add(txtSearchBox);

                this.Controls.Add(pnlSearch);

                HtmlButton btnSearch = new HtmlButton();
                btnSearch.Attributes.Add("class", "btn btn-default");
                btnSearch.Attributes.Add("type", "submit");
                btnSearch.InnerText    = (langWeb == "fra") ? "Recherche" : "Search";
                btnSearch.ServerClick += btnSearch_ServerClick;

                this.Controls.Add(btnSearch);
            }
            catch (Exception)
            {
            }
        }
        protected override void Render(HtmlTextWriter writer)
        {
            string htmlOutput = string.Empty;

            try
            {
                // setup the outer wrappers
                htmlOutput += "<div class=\"wet-boew-menubar mb-mega\"><div><ul class=\"mb-menu\" data-ajax-replace=\"";

                if (SPContext.Current.Web.Locale.TwoLetterISOLanguageName == "en")
                {
                    htmlOutput += "/Lists/TopNavigation/menu-eng.txt\">";
                }
                else
                {
                    htmlOutput += "/Lists/TopNavigation/menu-fra.txt\">";
                }

                string langWeb = string.Empty;
                if (SPContext.Current.ListItem != null && PublishingPage.IsPublishingPage(SPContext.Current.ListItem))
                {
                    // figure out our language of the current label
                    PublishingPage publishingPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);

                    if (publishingPage.PublishingWeb.Label != null)
                    {
                        langWeb = (publishingPage.PublishingWeb.Label.Title.Substring(0, 2).ToLower() == "en") ? "eng" : "fra";
                    }
                }
                else
                {
                    string cultISO = "";
                    if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("/eng/"))
                    {
                        cultISO = "en";
                    }
                    else
                    {
                        cultISO = "fr";
                    }
                    langWeb = (cultISO == "en") ? "eng" : "fra";
                }

                string webUrl = SPContext.Current.Web.Url;
                using (SPSite site = new SPSite(webUrl))
                {
                    htmlOutput += renderTopLevelLink(langWeb);

                    // setup the outer wrappers
                    htmlOutput += "</ul></div></div>";

                    writer.Write(htmlOutput);
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog(ex.Message + " " + ex.StackTrace);
            }
        }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            PublishingPage publishingPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);
            string         langWeb        = (publishingPage.PublishingWeb.Label.Title.Substring(0, 2).ToLower() == "en") ? "eng" : "fra";

            string searchCentreURL = SPContext.Current.Site.RootWeb.AllProperties["SRCH_ENH_FTR_URL"].ToString();

            Response.Redirect(searchCentreURL + "/results.aspx?k=" + txtSearch.Text, true);
        }
Esempio n. 6
0
 protected override void Render(HtmlTextWriter writer)
 {
     if (SPContext.Current.ListItem != null && PublishingPage.IsPublishingPage(SPContext.Current.ListItem))
     {
         // Generate each metatag
         PublishingPage publishingPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);
         foreach (MetaTag metaTag in PageMetadata.GetCustomMetaTags())
         {
             metaTag.Render(writer, publishingPage);
         }
     }
 }
        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer);

            // allow third party applications to override the title of the current node in the breadcrumb
            WET.Theme.Intranet.Master_Pages.WETIntranetPublishingMaster masterPage = (WET.Theme.Intranet.Master_Pages.WETIntranetPublishingMaster) this.Page.Master;
            if (String.IsNullOrEmpty(masterPage.PageTitle))
            {
                if (SPContext.Current.ListItem != null && PublishingPage.IsPublishingPage(SPContext.Current.ListItem))
                {
                    PublishingPage publishingPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);
                    writer.WriteLine(publishingPage.Title);
                }
                else if (SPContext.Current.ListItem != null)
                {
                    try
                    {
                        writer.Write(SPContext.Current.ListItem.Title);
                    }
                    catch
                    {
                        try
                        {
                            writer.Write(SPContext.Current.ListItem.DisplayName);
                        }
                        catch (Exception ex)
                        {
                            WET.Theme.Intranet.Objects.Logger.WriteLog("Page Title:" + ex.Message);
                        }
                    }
                }
                else if (SPContext.Current.List != null)
                {
                    writer.Write(SPContext.Current.List.Title);
                }
                else if (HttpContext.Current.Request != null)
                {
                    string curUrl = HttpContext.Current.Request.Url.ToString();
                    string fileNameNoExtension = curUrl.Split('/')[curUrl.Split('/').Length - 1].Split('.')[0];
                    string fakeTitle           = char.ToUpper(fileNameNoExtension[0]) + fileNameNoExtension.ToLower().Substring(1);
                    writer.Write(fakeTitle);
                }
                else
                {
                    writer.Write("Administrative Page");
                }
            }
            else
            {
                writer.WriteLine(masterPage.PageTitle);
            }
        }
Esempio n. 8
0
 /// <summary>
 /// Render this control to the output parameter specified.
 /// </summary>
 /// <param name="output"> The HTML writer to write out to </param>
 protected override void Render(HtmlTextWriter output)
 {
     //Create a link back to the root of the variation
     if (SPContext.Current.ListItem != null && PublishingPage.IsPublishingPage(SPContext.Current.ListItem))
     {
         PublishingPage page = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);
         if (page != null)
         {
             try
             {
                 // handle the homelink when variations are enabled
                 if (page.PublishingWeb.Label != null)
                 {
                     output.Write(
                         "<a href=\"" +
                         page.PublishingWeb.Label.TopWebUrl +
                         "\" style=\"font-size:1.5em;\">" +
                         HttpContext.GetGlobalResourceObject("WET", "SiteTitleText", SPContext.Current.Web.Locale).ToString() +
                         "</a>"
                         );
                 }
                 else
                 {
                     // when variations are not enabled
                     output.Write(
                         "<a href=\"" + SPContext.Current.Site.RootWeb.Url + "\" style=\"font-size:1.5em;\">" +
                         HttpContext.GetGlobalResourceObject("WET", "SiteTitleText", SPContext.Current.Web.Locale).ToString() +
                         "</a>"
                         );
                 }
             }
             catch (Exception ex)
             {
                 Logger.WriteLog(ex.Message + " " + ex.StackTrace);
             }
         }
     }
     else
     {
         // when variations are not enabled
         output.Write(
             "<a href=\"" + SPContext.Current.Site.RootWeb.Url + "\" style=\"font-size:1.5em;\">" +
             HttpContext.GetGlobalResourceObject("WET", "SiteTitleText", SPContext.Current.Web.Locale).ToString() +
             "</a>"
             );
     }
 }
        protected override void Render(HtmlTextWriter writer)
        {
            string htmlOutput = string.Empty;

            try
            {
                langWeb = string.Empty;
                if (SPContext.Current.ListItem != null && PublishingPage.IsPublishingPage(SPContext.Current.ListItem))
                {
                    // figure out our language of the current label
                    PublishingPage publishingPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);

                    if (publishingPage.PublishingWeb.Label != null)
                    {
                        langWeb = (publishingPage.PublishingWeb.Label.Title.Substring(0, 2).ToLower() == "en") ? "Eng" : "Fra";
                    }
                }
                else
                {
                    string cultISO = "";
                    if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("/eng/"))
                    {
                        cultISO = "en";
                    }
                    else
                    {
                        cultISO = "fr";
                    }
                    langWeb = (cultISO == "en") ? "Eng" : "Fra";
                }

                htmlOutput += "<nav class=\"wb-menu visible-md visible-lg wb-init wb-data-ajax-replace-inited wb-menu-inited wb-navcurr-inited\" id=\"wb-sm\" role=\"navigation\" typeof=\"SiteNavigationElement\" data-trgt=\"mb-pnl\">\r\n";
                htmlOutput += "<div class=\"pnl-strt container visible-md visible-lg nvbar\">\r\n";
                htmlOutput += "<h2>Topics menu</h2>\r\n";
                htmlOutput += "<div class=\"row\">\r\n";
                htmlOutput += "<ul class=\"list-inline menu\" role=\"menubar\">\r\n";
                htmlOutput += renderTopLevelLinks();
                htmlOutput += "</ul></div></div>";
                htmlOutput += "</nav>";

                writer.Write(htmlOutput);
            }
            catch (Exception ex)
            {
                Logger.WriteLog(ex.Message + " " + ex.StackTrace);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Gets a Publishing Page from any folder in the Pages library.
        /// </summary>
        /// <param name="web">The web.</param>
        /// <param name="fileLeafRef">The file leaf reference.</param>
        /// <param name="folder">The folder where to search the page.</param>
        /// <returns>The PublishingPage object, if any. Otherwise null.</returns>
        /// <exception cref="System.ArgumentNullException">fileLeafRef</exception>
        /// <exception cref="System.ArgumentException">fileLeafRef</exception>
        public static PublishingPage GetPublishingPage(this Web web, string fileLeafRef, Folder folder)
        {
            if (string.IsNullOrEmpty(fileLeafRef))
            {
                throw (fileLeafRef == null)
                  ? new ArgumentNullException(nameof(fileLeafRef))
                  : new ArgumentException(CoreResources.Exception_Message_EmptyString_Arg, nameof(fileLeafRef));
            }

            var context = web.Context as ClientContext;
            var pages   = web.GetPagesLibrary();

            // Get the language agnostic "Pages" library name
            context.Load(pages, p => p.RootFolder, p => p.ItemCount);
            context.ExecuteQueryRetry();

            if (pages != null && pages.ItemCount > 0)
            {
                var camlQuery = new CamlQuery
                {
                    FolderServerRelativeUrl = folder != null ? folder.ServerRelativeUrl : pages.RootFolder.ServerRelativeUrl,
                    ViewXml = $@"<View Scope='RecursiveAll'>  
                                    <Query> 
                                        <Where><Eq><FieldRef Name='FileLeafRef' /><Value Type='Text'>{fileLeafRef}</Value></Eq></Where> 
                                    </Query> 
                                </View>"
                };

                var listItems = pages.GetItems(camlQuery);
                context.Load(listItems);
                context.ExecuteQueryRetry();

                if (listItems.Count > 0)
                {
                    var page = PublishingPage.GetPublishingPage(context, listItems[0]);
                    context.Load(page);
                    context.ExecuteQueryRetry();
                    return(page);
                }
            }

            return(null);
        }
 /// <summary>
 /// Render this control to the output parameter specified.
 /// </summary>
 /// <param name="output"> The HTML writer to write out to </param>
 protected override void Render(HtmlTextWriter output)
 {
     //get the placeholder that holds the meta tag content
     if (SPContext.Current.ListItem != null && PublishingPage.IsPublishingPage(SPContext.Current.ListItem))
     {
         PublishingPage page = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);
         if (page != null)
         {
             string sLastModifiedDate = page.LastModifiedDate.ToString("yyyy-MM-dd");
             output.Write(sLastModifiedDate);
         }
     }
     else
     {
         if (SPContext.Current.Web.LastItemModifiedDate != null)
         {
             string sLastModifiedDate = SPContext.Current.Web.LastItemModifiedDate.ToString("yyyy-MM-dd");
             output.Write(sLastModifiedDate);
         }
     }
 }
Esempio n. 12
0
        void btnSearch_ServerClick(object sender, EventArgs e)
        {
            EnsureChildControls();

            PublishingPage publishingPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);
            string         langWeb        = string.Empty;

            if (publishingPage != null)
            {
                langWeb = (publishingPage.PublishingWeb.Label.Title.Substring(0, 2).ToLower() == "en") ? "eng" : "fra";
            }
            else if (SPContext.Current.Web.Url.ToLower().Contains("/fra/"))
            {
                langWeb = "fra";
            }
            else
            {
                langWeb = "eng";
            }

            string searchCentreURL = string.Empty;

            if (SPContext.Current.Site.RootWeb.AllProperties["SRCH_ENH_FTR_URL"] != null)
            {
                searchCentreURL = SPContext.Current.Site.RootWeb.AllProperties["SRCH_ENH_FTR_URL"].ToString();
            }
            else
            {
                if (langWeb == "eng")
                {
                    searchCentreURL = SPContext.Current.Site.RootWeb.Url + "/" + langWeb + "/Search/Pages/results.aspx?k=" + txtSearchBox.Text;
                }
                else
                {
                    searchCentreURL = SPContext.Current.Site.RootWeb.Url + "/" + langWeb + "/Recherche/Pages/resultats.aspx?k=" + txtSearchBox.Text;
                }
            }
            this.Page.Response.Redirect(searchCentreURL, true);
        }
Esempio n. 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /// <summary>
            /// Ceates content in this manner - all outer divs are in the layout.
            /// Non selected section
            /// <section>
            ///    <h3><a href="#">Section 1</a></h3>
            ///    <ul>
            ///        <li><a href="#">Item 1a</a>
            ///            <ul>
            ///                <li><a href="#">Item 1ai</a></li>
            ///                <li><a href="#">Item 1aii</a></li>
            ///            </ul>
            ///        </li>
            ///        <li><a href="#">Item 1b</a></li>
            ///        <li><a href="#">Item 1c</a></li>
            ///    </ul>
            /// </section>
            /// Selected Section
            /// <section>
            ///    <h3><a href="#" class="nav-current">Current section (4) example </a></h3>
            ///    <ul>
            ///        <li><a href="#">Item 4a</a></li>
            ///        <li><a href="#" class="nav-current">Current item (4b) example</a>
            ///            <ul>
            ///                <li><a href="#">Item 4bi</a></li>
            ///                <li><a href="#" class="nav-current">Current sub (4bii) item example</a></li>
            ///                <li><a href="#">Item 4biii</a></li>
            ///            </ul>
            ///        </li>
            ///        <li><a href="#">Item 4c</a></li>
            ///    </ul>
            /// </section>
            /// </summary>

            string htmlOutput      = string.Empty;
            string currentNavClass = string.Empty;
            string selectedNav     = string.Empty;

            try
            {
                // setup the outer wrappers
                htmlOutput += "";

                // current nav css
                if (!String.IsNullOrEmpty(Request.QueryString["selected"]))
                {
                    currentNavClass = "class=\"nav-current\"";
                    selectedNav     = Request.QueryString["selected"];
                }


                // figure out our language of the current label
                PublishingPage publishingPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);
                string         langWeb        = (publishingPage.PublishingWeb.Label.Title.Substring(0, 2).ToLower() == "en") ? "eng" : "fra";

                SPWeb             web = null;
                SPList            CLF3LeftNavigation = null;
                List <SPListItem> firstLevelCollItem;

                try
                {
                    web = SPContext.Current.Site.RootWeb.Webs[langWeb];
                    CLF3LeftNavigation = web.Lists["CLF3LeftNavigation"];

                    firstLevelCollItem = (from SPListItem li in CLF3LeftNavigation.Items
                                          where Convert.ToString(li["Level"]).IndexOf(".") == -1
                                          orderby li["SortOrder"]
                                          select li).ToList <SPListItem>();

                    foreach (SPListItem oItem_1 in firstLevelCollItem)
                    {
                        //Ensure that this is a first level link by checking number of dots in Level value. Must be 0
                        string      level        = oItem_1["Level"].ToString();
                        List <char> list         = level.ToList <char>();
                        int         numberOfDots = list.Count <char>(c => c == '.');

                        if ((numberOfDots == 0))
                        {
                            //renderfirstlevelLink
                            htmlOutput += renderTopLevelLink(CLF3LeftNavigation, oItem_1, level, langWeb, selectedNav);
                        }
                    }
                }
                finally
                {
                    if (web != null)
                    {
                        web.Dispose();
                    }
                }

                // setup the outer wrappers
                TableRow itemRow = new TableRow();
                itemRow.Height = 20;
                TableCell itemcell = new TableCell();
                Label     lbl      = new Label();
                lbl.Text = "<div class='cn-left-col-wp'>" + htmlOutput + "</div>";
                itemcell.Controls.Add(lbl);
                itemRow.Cells.Add(itemcell);
                CLF3LeftNavigationTable.Rows.Add(itemRow);
            }
            catch (Exception ex)
            {
                Logger.WriteLog(ex.Message + " " + ex.StackTrace);
            }
        }
Esempio n. 14
0
        protected override void Render(HtmlTextWriter writer)
        {
            string htmlOutput = string.Empty;

            try
            {
                string langWeb = string.Empty;
                if (SPContext.Current.ListItem != null && PublishingPage.IsPublishingPage(SPContext.Current.ListItem))
                {
                    // figure out our language of the current label
                    PublishingPage publishingPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);

                    if (publishingPage.PublishingWeb.Label != null)
                    {
                        langWeb = (publishingPage.PublishingWeb.Label.Title.Substring(0, 2).ToLower() == "en") ? "eng" : "fra";
                    }
                }
                else
                {
                    string cultISO = "";
                    if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("/eng/"))
                    {
                        cultISO = "en";
                    }
                    else
                    {
                        cultISO = "fr";
                    }
                    langWeb = (cultISO == "en") ? "eng" : "fra";
                }

                string dataAjaxFetch = "";
                if (SPContext.Current.Web.Locale.TwoLetterISOLanguageName == "en")
                {
                    dataAjaxFetch += "/TopNavigationFiles/menu-include-en.html";
                }
                else
                {
                    dataAjaxFetch += "/TopNavigationFiles/menu-include-fr.html";
                }

                htmlOutput += "<nav role=\"navigation\" id=\"wb-sm\" data-ajax-fetch=\"" + dataAjaxFetch + "\" data-trgt=\"mb-pnl\" class=\"wb-menu visible-md visible-lg\" typeof=\"SiteNavigationElement\">";
                htmlOutput += "<div class=\"container nvbar\">";
                htmlOutput += "<h2>Topics menu</h2>";
                htmlOutput += "<ul class=\"list-inline menu\">";
                htmlOutput += renderTopLevelLink(langWeb);
                htmlOutput += "</ul>";
                htmlOutput += "</div>";
                htmlOutput += "</nav>";

                string webUrl = SPContext.Current.Web.Url;
                using (SPSite site = new SPSite(webUrl))
                {
                    writer.Write(htmlOutput);
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog(ex.Message + " " + ex.StackTrace);
            }
        }
Esempio n. 15
0
        private void MigrateOnePage(SPSite site, SPWeb web, SPList list, SPListItem item, String username, String password)
        {
            string remotePageURL      = item.WBxGetColumnAsString(REMOTE_PAGE_URL);
            string newLogicalLocation = item.WBxGetColumnAsString(NEW_LOGICAL_LOCATION);
            string siteOrPage         = item.WBxGetColumnAsString(SITE_OR_PAGE);
            string localPageURL       = item.WBxGetColumnAsString(LOCAL_PAGE_URL);
            string resultMessage      = "";

            if (newLogicalLocation == "")
            {
                MigrationError(item, "There was no new logical location set!");
                return;
            }

            WBLogging.Migration.HighLevel("Starting MigrateOnePage() for newLogicalLocation : " + newLogicalLocation);

            if (siteOrPage == "")
            {
                MigrationError(item, "The 'Site or Page' value wasn't set!");
                return;
            }

            if (localPageURL == "")
            {
                localPageURL = MakeLocalPageURL(newLogicalLocation, siteOrPage);
                item.WBxSetColumnAsString(LOCAL_PAGE_URL, localPageURL);
            }

            string remotePageURLToUse = remotePageURL.Replace("/alfresco/web/izzi/", "/alfresco/service/mizzi/");

            string localSPWebRelativeURL = newLogicalLocation;

            if (siteOrPage == PAGE)
            {
                localSPWebRelativeURL = WBUtils.GetParentPath(newLogicalLocation, false);
            }

            if (remotePageURL != "")
            {
                WBLogging.Migration.Verbose("Migrating remote -> local: " + remotePageURL + " -> " + localPageURL);
            }
            else
            {
                WBLogging.Migration.Verbose("Creating new local unmapped site: " + localPageURL);
            }

            SPWeb localWeb = null;

            try
            {
                string pageTitle    = item.WBxGetColumnAsString("Title");
                string pageTemplate = "";

                if (remotePageURL != "")
                {
                    pageTitle     = WBUtils.GetURLContents(remotePageURLToUse + "?JUST_PAGE_TITLE=true", username, password);
                    item["Title"] = pageTitle;

                    pageTemplate        = WBUtils.GetURLContents(remotePageURLToUse + "?JUST_PAGE_TEMPLATE=true", username, password);
                    item[PAGE_TEMPLATE] = pageTemplate;
                }


                if (remotePageURL != "" && pageTemplate != "izziThreeColumn.ftl")
                {
                    resultMessage = "Not migrated yet (due to unhandled template)";
                }
                else
                {
                    bool newSiteCreated = false;

                    localWeb = site.OpenWeb(localSPWebRelativeURL);

                    if (!localWeb.Exists)
                    {
                        // OK let's try to get the parent web:
                        string parentURL = WBUtils.GetParentPath(localSPWebRelativeURL, false);
                        string childName = WBUtils.GetLastNameInPath(localSPWebRelativeURL);

                        WBLogging.Migration.Verbose("Trying to find parent URL: " + parentURL);

                        using (SPWeb parentWeb = site.OpenWeb(parentURL))
                        {
                            if (parentWeb.Exists)
                            {
                                if (pageTitle == "")
                                {
                                    pageTitle     = childName.WBxToUpperFirstLetter();
                                    item["Title"] = pageTitle;
                                }
                                localWeb       = parentWeb.Webs.Add(childName, pageTitle, pageTitle, 1033, "CMSPUBLISHING#0", true, false);
                                newSiteCreated = true;
                            }
                            else
                            {
                                WBLogging.Migration.Verbose("Couldn't find parente web site - Don't know how to handle this situation.");
                                resultMessage = "Couldn't find the parent web site";
                            }
                        }
                    }

                    if (localWeb.Exists)
                    {
                        if (localWeb.HasUniqueRoleAssignments)
                        {
                            localWeb.ResetRoleInheritance();
                            localWeb.Update();
                        }

                        PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(localWeb);

                        PageLayout layout = WBUtils.GetPageLayout(publishingWeb, "LBI Standard page layout");

                        if (layout == null)
                        {
                            MigrationError(item, "Didn't find the page layout!!");
                            return;
                        }

                        SPFile         pageFile = null;
                        PublishingPage page     = null;

                        // If this location is for a site then we get the default page:
                        if (siteOrPage == SITE)
                        {
                            pageFile = publishingWeb.DefaultPage;
                            page     = PublishingPage.GetPublishingPage(pageFile.Item);
                        }
                        else
                        {
                            // Otherwise we have to get or create a named page:
                            string pageName = WBUtils.GetLastNameInPath(newLogicalLocation) + ".aspx";

                            SPListItem pageItem = WBUtils.FindItemByColumn(site, publishingWeb.PagesList, WBColumn.Name, pageName);
                            if (pageItem != null)
                            {
                                page = PublishingPage.GetPublishingPage(pageItem);
                            }
                            else
                            {
                                // We couldn't find the page so we'll add it as a new page:
                                page = publishingWeb.AddPublishingPage(pageName, layout);
                            }

                            pageFile = page.ListItem.File;

                            string urlFromItem = "http://sp.izzi" + page.ListItem.File.ServerRelativeUrl;
                            if (localPageURL != urlFromItem)
                            {
                                MigrationError(item, "The generated names don't match: localPageURL | urlFromItem : " + localPageURL + " | " + urlFromItem);
                                return;
                            }
                        }

                        // So we'll update the content if we're migrating an izzi page or it's the first time
                        // creation of a new local page:
                        if (remotePageURL != "" || newSiteCreated)
                        {
                            string pageText = "This page is not being migrated so needs to be edited locally.";
                            if (remotePageURL != "")
                            {
                                pageText = WBUtils.GetURLContents(remotePageURLToUse + "?JUST_PAGE_TEXT=true", username, password);
                                pageText = ProcessPageText(site, list, pageText);
                            }

                            if (pageFile.CheckOutType == SPFile.SPCheckOutType.None)
                            {
                                WBLogging.Migration.Verbose("Checking out the pageFile");
                                pageFile.CheckOut();
                            }
                            else
                            {
                                WBLogging.Migration.Verbose("No need to check out the pageFile");
                            }

                            if (newSiteCreated)
                            {
                                page.Layout = layout;
                                page.Update();
                            }

                            pageFile.Item["Page Content"] = pageText;
                            pageFile.Item["Title"]        = pageTitle;


                            pageFile.Item.Update();
                            pageFile.Update();


                            pageFile.CheckIn("Checked in programmatically");
                            pageFile.Publish("Published programmatically");

                            WBLogging.Migration.Verbose("Publisehd migrated page: " + localPageURL);
                        }
                    }
                    else
                    {
                        WBLogging.Migration.Unexpected("Wasn't able to find or create the local web: " + localSPWebRelativeURL);
                        resultMessage += " Wasn't able to find or create the local web: " + localSPWebRelativeURL;
                    }
                }
            }
            catch (Exception error)
            {
                WBLogging.Migration.Unexpected("There was an error: " + error.Message + " Tried with remote | local : " + remotePageURL + " | " + localPageURL);
                resultMessage = "There was an error: " + error.Message + " Tried with remote | local : " + remotePageURL + " | " + localPageURL;
            }
            finally
            {
                if (localWeb != null)
                {
                    localWeb.Dispose();
                }
            }

            if (resultMessage == "")
            {
                resultMessage        = "Processed OK";
                item[LAST_MIGRATION] = DateTime.Now;
            }


            WBLogging.Migration.Verbose("Result message : " + resultMessage);

            item.WBxSetColumnAsString(RESULT_MESSAGE, resultMessage);
            item.Update();

            WBLogging.Migration.HighLevel("Finished MigrateOnePage() for newLogicalLocation : " + newLogicalLocation);
        }
Esempio n. 16
0
        protected override void Render(HtmlTextWriter writer)
        {
            string currentNavClass = string.Empty;
            string selectedNav     = string.Empty;

            try
            {
                // setup the outer wrappers
                string htmlOutput = string.Empty;

                // figure out our language of the current label
                if (SPContext.Current.ListItem != null && PublishingPage.IsPublishingPage(SPContext.Current.ListItem))
                {
                    PublishingPage publishingPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);
                    string         langWeb        = string.Empty;
                    if (publishingPage.PublishingWeb.Label != null)
                    {
                        langWeb = (publishingPage.PublishingWeb.Label.Title.Substring(0, 2).ToLower() == "en") ? "eng" : "fra";
                    }
                    else
                    {
                        langWeb = "eng";
                    }

                    currentNavClass = "class=\"nav-current\"";
                    selectedNav     = SPContext.Current.ListItemServerRelativeUrl;

                    SPList            WETLeftNavigation = null;
                    List <SPListItem> firstLevelCollItem;

                    try
                    {
                        WETLeftNavigation = SPContext.Current.Web.Lists["WETLeftNavigation"];

                        firstLevelCollItem = (from SPListItem li in WETLeftNavigation.Items
                                              where Convert.ToString(li["Level"]).IndexOf(".") == -1
                                              orderby li["SortOrder"]
                                              select li).ToList <SPListItem>();

                        foreach (SPListItem oItem_1 in firstLevelCollItem)
                        {
                            //Ensure that this is a first level link by checking number of dots in Level value. Must be 0
                            string      level        = oItem_1["Level"].ToString();
                            List <char> list         = level.ToList <char>();
                            int         numberOfDots = list.Count <char>(c => c == '.');

                            if ((numberOfDots == 0))
                            {
                                //renderfirstlevelLink
                                htmlOutput += renderTopLevelLink(WETLeftNavigation, oItem_1, level, langWeb, selectedNav);
                            }
                        }
                    }
                    finally
                    {
                    }
                    htmlOutput += "<br /><br /><br />";
                    writer.Write(htmlOutput);
                }
                else
                {
                    //Nik20121026 - Handles the case where the site's template is a collaboration one;
                    string langWeb = string.Empty;
                    string cultISO = "";
                    if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("/eng/"))
                    {
                        cultISO = "en";
                    }
                    else
                    {
                        cultISO = "fr";
                    }

                    langWeb = (cultISO == "en") ? "eng" : "fra";

                    currentNavClass = "class=\"nav-current\"";
                    selectedNav     = SPContext.Current.ListItemServerRelativeUrl;

                    SPList            WETLeftNavigation = null;
                    List <SPListItem> firstLevelCollItem;

                    try
                    {
                        WETLeftNavigation = SPContext.Current.Web.Lists["WETLeftNavigation"];

                        firstLevelCollItem = (from SPListItem li in WETLeftNavigation.Items
                                              where Convert.ToString(li["Level"]).IndexOf(".") == -1
                                              orderby li["SortOrder"]
                                              select li).ToList <SPListItem>();

                        foreach (SPListItem oItem_1 in firstLevelCollItem)
                        {
                            //Ensure that this is a first level link by checking number of dots in Level value. Must be 0
                            string      level        = oItem_1["Level"].ToString();
                            List <char> list         = level.ToList <char>();
                            int         numberOfDots = list.Count <char>(c => c == '.');

                            if ((numberOfDots == 0))
                            {
                                //renderfirstlevelLink
                                htmlOutput += renderTopLevelLink(WETLeftNavigation, oItem_1, level, langWeb, selectedNav);
                            }
                        }
                    }
                    finally
                    {
                    }

                    writer.Write(htmlOutput);
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog(ex.Message + " " + ex.StackTrace);
            }
        }
Esempio n. 17
0
        // Creates content in the following manner
        // 1:  all links not in folders will be rendered in the first div in the order added to the list
        //<div id="cn-ft-tctr">
        //    <ul>
        //        <li class="terms"><a href="#" rel="license">Terms and conditions</a></li>
        //        <li class="trans"><a href="#">Transparency</a></li>
        //    </ul>
        //</div>
        //<div class="clear"></div>
        // 2:  all folders will be rendered with the link with the title matching the folder name being the link for the folder
        // 3:  if no link matches the folder name, it will be rendered as text and not a link
        // 4:  all other links in folders will be rendered in the order they are added to the folder as <LI> items
        //<section>
        //    <div class="span-2">
        //        <h4 class="col-head"><a href="#">About us</a></h4>
        //        <ul>
        //            <li><a href="#">Our Mandate</a></li>
        //            <li><a href="#">Our Minister</a></li>
        //        </ul>
        //    </div>
        //</section>
        /// <summary>
        /// Render this control to the output parameter specified.
        /// </summary>
        /// <param name="output"> The HTML writer to write out to </param>
        protected override void Render(HtmlTextWriter output)
        {
            string topLinksHTML = string.Empty;
            string sectionsHTML = string.Empty;

            //Create a link back to the root of the variation
            if (SPContext.Current.ListItem != null && PublishingPage.IsPublishingPage(SPContext.Current.ListItem))
            {
                try
                {
                    if (PublishingPage.IsPublishingPage(SPContext.Current.ListItem))
                    {
                        PublishingPage publishingPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);
                        // Check to see if Variations are enabled or not.... if the label is null then no variations
                        string langWeb = (publishingPage.PublishingWeb.Label == null) ?
                                         string.Empty :
                                         (publishingPage.PublishingWeb.Label.Language.Substring(0, 2).ToLower() == "en") ? "eng" : "fra";
                        string webUrl = string.Empty;
                        SPList cLFFooterNavigation = null;
                        SPListItemCollection collListItems;

                        try
                        {
                            if (langWeb != string.Empty)
                            {
                                SPWebCollection webs    = SPContext.Current.Site.RootWeb.Webs;
                                SPWeb           tempWeb = webs[langWeb];
                                webUrl = tempWeb.Url;
                                tempWeb.Dispose();
                            }
                            else
                            {
                                webUrl = SPContext.Current.Site.RootWeb.Url;
                            }

                            using (SPSite site = new SPSite(webUrl))
                            {
                                using (SPWeb web = site.OpenWeb())
                                {
                                    cLFFooterNavigation = web.Lists.TryGetList("CLF3FooterNavigation");

                                    SPQuery oQuery = new SPQuery();
                                    oQuery.Query = "<Where><IsNotNull><FieldRef Name='NavURL'/></IsNotNull></Where>" +
                                                   "<OrderBy><FieldRef Name='RowOrder' /></OrderBy>";

                                    if (cLFFooterNavigation != null)
                                    {
                                        collListItems = cLFFooterNavigation.GetItems(oQuery);

                                        int counter = 0;
                                        foreach (SPListItem item in collListItems)
                                        {
                                            counter += 1;

                                            string linkRel = string.Empty;
                                            // set the rel = license for terms and conditions being the title of the link

                                            if (item.Title.ToLower() == HttpContext.GetGlobalResourceObject("WET4", "TermsAndConditionsText", SPContext.Current.Web.Locale).ToString().ToLower())
                                            {
                                                linkRel = " rel=\"license\"";
                                            }
                                            else
                                            {
                                                linkRel = string.Empty;
                                            }

                                            // then this is one of the top links... add it to the
                                            // <li class="terms"><a href="#" rel="license">Terms and conditions</a></li>
                                            topLinksHTML += "<li><a href=\"" + item["NavURL"].ToString() + "\"" + linkRel + ">" + item.Title + "</a></li>";
                                        }

                                        // now do the sections
                                        foreach (SPListItem aFolderItem in cLFFooterNavigation.Folders)
                                        {
                                            // its one of the folders... render it and add it to sectionsHTML
                                            sectionsHTML += renderSection(aFolderItem.Folder, cLFFooterNavigation);
                                        }
                                    }
                                }
                            }
                        }
                        finally
                        {
                        }
                        // write out the topLinksHTML to output
                        if (!string.IsNullOrEmpty(topLinksHTML))
                        {
                            output.Write("<ul id=\"gc-tctr\" class=\"list-inline\">" + topLinksHTML + "</ul><div class=\"row\">");
                        }

                        // write out the sectionsHTML to output as is..
                        output.Write(sectionsHTML);

                        if (!string.IsNullOrEmpty(topLinksHTML))
                        {
                            output.Write("</div>");
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.WriteLog(ex.Message + " " + ex.StackTrace);
                }
            }
            else
            {
                //Nik20121026 - The current site's template is a collaboration one;
                // Check to see if Variations are enabled or not.... if the label is null then no variations
                SPList cLFFooterNavigation = null;
                SPListItemCollection collListItems;

                try
                {
                    cLFFooterNavigation = SPContext.Current.Web.Lists["CLF3FooterNavigation"];
                    SPQuery oQuery = new SPQuery();
                    oQuery.Query = "<Where><IsNotNull><FieldRef Name='NavURL'/></IsNotNull></Where>" +
                                   "<OrderBy><FieldRef Name='RowOrder' /></OrderBy>";

                    if (cLFFooterNavigation != null)
                    {
                        collListItems = cLFFooterNavigation.GetItems(oQuery);

                        int counter = 0;
                        foreach (SPListItem item in collListItems)
                        {
                            counter += 1;

                            string linkRel = string.Empty;

                            if (item.Title.ToLower() == HttpContext.GetGlobalResourceObject("WET4", "TermsAndConditionsText", SPContext.Current.Web.Locale).ToString().ToLower())
                            {
                                linkRel = " rel=\"license\"";
                            }
                            else
                            {
                                linkRel = string.Empty;
                            }

                            // then this is one of the top links... add it to the
                            // <li class="terms"><a href="#" rel="license">Terms and conditions</a></li>
                            topLinksHTML += "<li><a href=\"" + item["NavURL"].ToString() + "\"" + linkRel + ">" + item.Title + "</a></li>";
                        }

                        // now do the sections
                        foreach (SPListItem aFolderItem in cLFFooterNavigation.Folders)
                        {
                            // its one of the folders... render it and add it to sectionsHTML
                            sectionsHTML += renderSection(aFolderItem.Folder, cLFFooterNavigation);
                        }
                    }
                }
                catch { }
                // write out the topLinksHTML to output
                if (!string.IsNullOrEmpty(topLinksHTML))
                {
                    output.Write("<ul id=\"gc-tctr\" class=\"list-inline\">" + topLinksHTML + "</ul><div class=\"row\">");
                }

                // write out the sectionsHTML to output as is..
                output.Write(sectionsHTML);

                if (!string.IsNullOrEmpty(topLinksHTML))
                {
                    output.Write("</div>");
                }
            }
        }
        protected override void Render(HtmlTextWriter writer)
        {
            string selectedNav = string.Empty;

            try
            {
                // setup the outer wrappers
                string htmlOutput = string.Empty;

                // figure out our language of the current label
                if (SPContext.Current.ListItem != null && PublishingPage.IsPublishingPage(SPContext.Current.ListItem))
                {
                    PublishingPage publishingPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);
                    string         langWeb        = string.Empty;
                    if (publishingPage.PublishingWeb.Label != null)
                    {
                        langWeb = (publishingPage.PublishingWeb.Label.Title.Substring(0, 2).ToLower() == "en") ? "eng" : "fra";
                    }
                    else
                    {
                        langWeb = "eng";
                    }

                    SPList            WETLeftNavigation = null;
                    List <SPListItem> firstLevelCollItem;

                    try
                    {
                        WETLeftNavigation = SPContext.Current.Web.Lists["WETLeftNavigation"];

                        firstLevelCollItem = (from SPListItem li in WETLeftNavigation.Items
                                              where Convert.ToString(li["Level"]).IndexOf(".") == -1
                                              orderby li["SortOrder"]
                                              select li).ToList <SPListItem>();

                        foreach (SPListItem oItem_1 in firstLevelCollItem)
                        {
                            //Ensure that this is a first level link by checking number of dots in Level value. Must be 0
                            string      level        = oItem_1["Level"].ToString();
                            List <char> list         = level.ToList <char>();
                            int         numberOfDots = list.Count <char>(c => c == '.');

                            if ((numberOfDots == 0))
                            {
                                //renderfirstlevelLink
                                htmlOutput += renderTopLevelLink(WETLeftNavigation, oItem_1, level, langWeb);
                            }
                        }
                    }
                    finally
                    {
                    }
                    htmlOutput += "<br /><br /><br />";
                    writer.Write(htmlOutput);

                    // Nik20131114 - Need to use javascript to highlight the current section in the left menu, because with anchors ('#') we cannot
                    //               make a decision server side;
                    string selectorScript = "<script type=\"text/javascript\" src=\"/Style Library/js/leftmenuselector.js\"><" + "/" + "script>";

                    writer.Write(selectorScript);
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog(ex.Message + " " + ex.StackTrace);
            }
        }
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            try
            {
                PublishingPage publishingPage;
                PublishingPage targetPage;
                string         currentLang = "";
                if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("/eng/"))
                {
                    currentLang = "en";
                }
                else
                {
                    currentLang = "fr";
                }

                // Figure out what variation we are in and link back to the other language using the
                if (SPContext.Current.ListItem != null && PublishingPage.IsPublishingPage(SPContext.Current.ListItem))
                {
                    publishingPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);
                    VariationLabel label = publishingPage.PublishingWeb.Label;

                    //repass the querystring
                    string queryString = "";
                    if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.ToString()))
                    {
                        queryString = "?" + HttpContext.Current.Request.QueryString.ToString();
                    }

                    // controls on the page can override the query string parameter if needed
                    if (this.Page.Master != null)
                    {
                        Master_Pages.WETIntranetPublishingMaster masterPage = (Master_Pages.WETIntranetPublishingMaster) this.Page.Master;
                        if (!String.IsNullOrEmpty(masterPage.LanguageFlipQueryString))
                        {
                            queryString = masterPage.LanguageFlipQueryString;
                        }
                    }
                    if (label == null)
                    {
                        // no variations... use the current users local
                        string langlabel       = HttpContext.GetGlobalResourceObject("WET", "OtherLanguageText", SPContext.Current.Web.Locale).ToString();
                        string Languagecontrol = "";

                        if (currentLang.Equals("en"))
                        {
                            Languagecontrol = "<a href=\"" + publishingPage.Uri.AbsoluteUri + queryString + "\" lang=\"" + currentLang + "\" xml:lang=\"" + currentLang + "\" onclick=\"javascript:OnSelectionChange(1036); return false;\"><span>" + langlabel + "</span></a>";
                        }
                        else
                        {
                            Languagecontrol = "<a href=\"" + publishingPage.Uri.AbsoluteUri + queryString + "\" lang=\"" + currentLang + "\" xml:lang=\"" + currentLang + "\" onclick=\"javascript:OnSelectionChange(1033); return false;\"><span>" + langlabel + "</span></a>";
                        }
                        this.Controls.Add(new LiteralControl(Languagecontrol));
                    }
                    else
                    {
                        // handle the variations
                        // find our root publishing web

                        PublishingWeb topPubWeb = publishingPage.PublishingWeb;
                        while (topPubWeb.IsRoot == false)
                        {
                            topPubWeb = topPubWeb.ParentPublishingWeb;
                        }

                        // iterate through the variation urls and find the lable from the other language
                        foreach (PublishingWeb aPubWeb in topPubWeb.GetPublishingWebs())
                        {
                            if (aPubWeb.Label != null && (aPubWeb.Label.Title != publishingPage.PublishingWeb.Label.Title) &&
                                ((aPubWeb.Label.Title.ToLower() == "eng") || (aPubWeb.Label.Title.ToLower() == "fra")))
                            {
                                // then we have the pubweb from the other variation...
                                label = aPubWeb.Label;
                                break;
                            }
                        }
                        if (label == null)
                        {
                            throw new System.ArgumentException(HttpContext.GetGlobalResourceObject("WET", "Error_CantFindPubWebLabel", SPContext.Current.Web.Locale).ToString(), "listItem");
                        }
                        else
                        {
                            targetPage = publishingPage.GetVariation(label);
                            if (targetPage != null)
                            {
                                string currenturl = HttpContext.Current.Request.Path.ToString().ToLower();

                                string reverseurl = targetPage.Uri.AbsoluteUri;
                                string langlabel  = HttpContext.GetGlobalResourceObject("WET", "OtherLanguageText", SPContext.Current.Web.Locale).ToString();
                                string propLang   = (publishingPage.PublishingWeb.Label.Language.Substring(0, 2) == "en") ? "fr" : "en";

                                this.Controls.Add(new LiteralControl("<script type=\"text/javascript\">" + System.Environment.NewLine +
                                                                     "function OnSelectionChange2(value){" +
                                                                     System.Environment.NewLine + "var today = new Date();" +
                                                                     System.Environment.NewLine + "var oneYear = new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000);" +
                                                                     System.Environment.NewLine + "var url = \"" + reverseurl + queryString + "\";" +
                                                                     System.Environment.NewLine + "document.cookie = \"lcid=\" + value + \";path=/;expires=\" + oneYear.toGMTString();" +
                                                                     System.Environment.NewLine + "window.location.href = url;" +
                                                                     System.Environment.NewLine + "}" +
                                                                     System.Environment.NewLine +
                                                                     "</script>"));
                                string lang           = publishingPage.PublishingWeb.Label.Language.Substring(0, 2);
                                string controlContent = "";
                                if (lang == "en")
                                {
                                    controlContent = @"<section id=""wb-lng"">
                                      <h2>Language selection</h2>     
                                         <ul class=""list-inline"">
                                        <li><a lang=""fr"" href=""" + reverseurl + queryString + @""" onclick=""javascript: OnSelectionChange2(1036); return false;"">Fran&ccedil;ais</a></li>
                                         </ul>
                                    </section>";
                                }
                                else
                                {
                                    {
                                        controlContent = @"<section id=""wb-lng"">
                                        <h2>S&eacute;lection de langue</h2>     
                                         <ul class=""list-inline"">
                                        <li><a lang=""en"" href=""" + reverseurl + queryString + @""" onclick=""javascript: OnSelectionChange2(1033); return false;"">English</a></li>
                                        </ul>
                                    </section>";
                                    }
                                }
                                this.Controls.Add(new LiteralControl(controlContent));
                            }
                        }
                    }
                }
                else
                {
                    //repass the querystring
                    string queryString = "";
                    if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.ToString()))
                    {
                        queryString = "?" + HttpContext.Current.Request.QueryString.ToString();
                    }

                    // controls on the page can override the query string parameter if needed
                    if (this.Page.Master != null)
                    {
                        Master_Pages.WETIntranetPublishingMaster masterPage = (Master_Pages.WETIntranetPublishingMaster) this.Page.Master;
                        if (!String.IsNullOrEmpty(masterPage.LanguageFlipQueryString))
                        {
                            queryString = masterPage.LanguageFlipQueryString;
                        }
                    }

                    string url = SPContext.Current.Web.Url;
                    // no variations... use the current users local
                    string langlabel = HttpContext.GetGlobalResourceObject("WET", "OtherLanguageText", SPContext.Current.Web.Locale).ToString();

                    string Languagecontrol = "";
                    if (currentLang.Equals("en"))
                    {
                        Languagecontrol = "<a href=\"" + url + queryString + "\" lang=\"" + currentLang + "\" xml:lang=\"" + currentLang + "\" onclick=\"javascript:OnSelectionChange(1036); return false;\"><span>" + langlabel + "</span></a>";
                    }
                    else
                    {
                        Languagecontrol = "<a href=\"" + url + queryString + "\" lang=\"" + currentLang + "\" xml:lang=\"" + currentLang + "\" onclick=\"javascript:OnSelectionChange(1033); return false;\"><span>" + langlabel + "</span></a>";
                    }
                    this.Controls.Add(new LiteralControl(Languagecontrol));
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog(ex.Message + " " + ex.StackTrace);
            }
        }