Esempio n. 1
0
        private void AddTabsToCollection(TabCollection inTabs, TabCollection outtabs)
        {
            // 1.0.2 - Workaround for dnn powered content localization - [alexander.zimmer] & [simon.meraner]
            // serialize tab object in order to be able to identify whether the content localization is active.
            System.Xml.Serialization.XmlSerializer tabSerializer = new System.Xml.Serialization.XmlSerializer(typeof(DotNetNuke.Entities.Tabs.TabInfo));
            foreach (System.Collections.Generic.KeyValuePair <int, DotNetNuke.Entities.Tabs.TabInfo> kvp in inTabs)
            {
                if (!outtabs.ContainsKey(kvp.Key))
                {
                    System.IO.StringWriter stream = new System.IO.StringWriter();

                    tabSerializer.Serialize(stream, kvp.Value);

                    System.IO.StringReader sr     = new System.IO.StringReader(stream.ToString());
                    XmlDocument            xmlDoc = new XmlDocument();
                    xmlDoc.Load(sr);

                    stream.Close();

                    var tabCulture = xmlDoc.SelectSingleNode("/tab/cultureCode");

                    bool showCulture = true;

                    if (tabCulture != null)
                    {
                        XmlNode cultureNode = tabCulture.FirstChild;

                        // dnn 5.5.x detected ... exclude tabs where the cultures doesn`t matcj the current culture
                        if (cultureNode != null && cultureNode.Value != System.Threading.Thread.CurrentThread.CurrentCulture.Name)
                        {
                            showCulture = false;
                        }
                    }
                    // -------------------------------------------------------------------------------------------------------

                    if (showCulture)
                    {
                        outtabs.Add(kvp.Key, kvp.Value);
                    }
                }
            }
        }