Esempio n. 1
0
        /// <summary>
        /// Gets the private layouts.
        /// </summary>
        /// <returns>
        /// A list of private layouts.
        /// </returns>
        public List<LayoutItem> GetPrivateLayouts()
        {
            List<LayoutItem> privateLayoutList;

            if (!CurrentCache.Exists(Key.LayoutList(this.PortalLayoutPath)))
            {
                privateLayoutList = new List<LayoutItem>();

                // Try to read directories from private theme path
                var layouts = Directory.Exists(this.PortalLayoutPath)
                                  ? Directory.GetDirectories(this.PortalLayoutPath)
                                  : new string[0];

                for (var i = 0; i <= layouts.GetUpperBound(0); i++)
                {
                    var t = new LayoutItem { Name = layouts[i].Substring(this.PortalLayoutPath.Length + 1) };

                    // Ignore CVS
                    if (t.Name != "CVS" && t.Name != "_svn" && t.Name != ".svn")
                    {
                        privateLayoutList.Add(t);
                    }
                }

                CurrentCache.Insert(
                    Key.LayoutList(this.PortalLayoutPath), privateLayoutList, new CacheDependency(this.PortalLayoutPath));
            }
            else
            {
                privateLayoutList = (List<LayoutItem>)CurrentCache.Get(Key.LayoutList(this.PortalLayoutPath));
            }

            return privateLayoutList;
        }
Esempio n. 2
0
        /// <summary>
        /// Changed by [email protected]
        ///   Page are different for custom page layout an theme, this cannot be static
        ///   Added by [email protected]
        ///   Cache by Manu
        ///   non static function, Thierry : this is necessary for page custom layout and themes
        /// </summary>
        /// <returns>
        /// A System.Collections.Hashtable value...
        /// </returns>
        private Dictionary<string, ISettingItem> GetPageBaseSettings()
        {
            // Define base settings
            var baseSettings = new Dictionary<string, ISettingItem>();

            // 2_aug_2004 Cory Isakson
            var groupOrderBase = (int)SettingItemGroup.NAVIGATION_SETTINGS;
            var group = SettingItemGroup.NAVIGATION_SETTINGS;

            var tabPlaceholder = new SettingItem<bool, CheckBox>(new BaseDataType<bool, CheckBox>())
                {
                    Group = group,
                    Order = groupOrderBase,
                    Value = false,
                    EnglishName = "Act as a Placeholder?",
                    Description = "Allows this tab to act as a navigation placeholder only."
                };
            baseSettings.Add("TabPlaceholder", tabPlaceholder);

            var tabLink = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    Value = string.Empty,
                    Order = groupOrderBase + 1,
                    EnglishName = "Static Link URL",
                    Description = "Allows this tab to act as a navigation link to any URL."
                };
            baseSettings.Add("TabLink", tabLink);

            var tabUrlKeyword = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    Order = groupOrderBase + 2,
                    EnglishName = "URL Keyword",
                    Description = "Allows you to specify a keyword that would appear in your URL."
                };
            baseSettings.Add("TabUrlKeyword", tabUrlKeyword);

            var urlPageName = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    Order = groupOrderBase + 3,
                    EnglishName = "URL Page Name",
                    Description =
                        "This setting allows you to specify a name for this tab that will show up in the URL instead of default.aspx"
                };
            baseSettings.Add("UrlPageName", urlPageName);

            var PageList = new ArrayList(new PagesDB().GetPagesFlat(this.PortalSettings.PortalID));
            var noSelectedPage = new PageItem { Name = General.GetString("NONE") , ID = -1};
            PageList.Insert(0, noSelectedPage);

            var FB_LikeGate_Page = new SettingItem<string, ListControl>(new CustomListDataType(PageList, "Name", "ID")){
                Group = group,
                Order = groupOrderBase + 4,
                EnglishName = "FB Like Gate Page",
                Description =
                    "This setting allows you to specify an url to redirect if the user doesn't like your page"
            };
            baseSettings.Add("FB_LikeGate_Page", FB_LikeGate_Page);

            // groupOrderBase = (int)SettingItemGroup.META_SETTINGS;
            group = SettingItemGroup.META_SETTINGS;
            var tabTitle = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    EnglishName = "Tab / Page Title",
                    Description =
                        "Allows you to enter a title (Shows at the top of your browser) for this specific Tab / Page. Enter something here to override the default portal wide setting."
                };
            baseSettings.Add("TabTitle", tabTitle);

            var tabMetaKeyWords = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    EnglishName = "Tab / Page Keywords",
                    Description =
                        "This setting is to help with search engine optimization. Enter 1-15 Default Keywords that represent what this Tab / Page is about.Enter something here to override the default portal wide setting."
                };
            baseSettings.Add("TabMetaKeyWords", tabMetaKeyWords);
            var tabMetaDescription = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    EnglishName = "Tab / Page Description",
                    Description =
                        "This setting is to help with search engine optimization. Enter a description (Not too long though. 1 paragraph is enough) that describes this particular Tab / Page. Enter something here to override the default portal wide setting."
                };
            baseSettings.Add("TabMetaDescription", tabMetaDescription);
            var tabMetaEncoding = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    EnglishName = "Tab / Page Encoding",
                    Description =
                        "Every time your browser returns a page it looks to see what format it is retrieving. This allows you to specify the content type for this particular Tab / Page. Enter something here to override the default portal wide setting."
                };
            baseSettings.Add("TabMetaEncoding", tabMetaEncoding);
            var tabMetaOther = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    EnglishName = "Additional Meta Tag Entries",
                    Description =
                        "This setting allows you to enter new tags into this Tab / Page's HEAD Tag. Enter something here to override the default portal wide setting."
                };
            baseSettings.Add("TabMetaOther", tabMetaOther);
            var tabKeyPhrase = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                {
                    Group = group,
                    EnglishName = "Tab / Page Keyphrase",
                    Description =
                        "This setting can be used by a module or by a control. It allows you to define a message/phrase for this particular Tab / Page This can be used for search engine optimisation. Enter something here to override the default portal wide setting."
                };
            baseSettings.Add("TabKeyPhrase", tabKeyPhrase);

            // changed Thierry (Tiptopweb) : have a dropdown menu to select layout and themes
            groupOrderBase = (int)SettingItemGroup.THEME_LAYOUT_SETTINGS;
            group = SettingItemGroup.THEME_LAYOUT_SETTINGS;

            // get the list of available layouts
            // changed: Jes1111 - 2004-08-06
            var layoutsList = new ArrayList(new LayoutManager(this.PortalSettings.PortalPath).GetLayouts());

            var noCustomLayout = new LayoutItem { Name = General.GetString("PAGESETTINGS_SITEDEFAULT", "(Site Default)") };

            layoutsList.Insert(0, noCustomLayout);

            // get the list of available themes
            // changed: Jes1111 - 2004-08-06
            var themesList = new ArrayList(new ThemeManager(this.PortalSettings.PortalPath).GetThemes());
            var noCustomTheme = new ThemeItem { Name = General.GetString("PAGESETTINGS_SITEDEFAULT", "(Site Default)") };
            themesList.Insert(0, noCustomTheme);

            // changed: Jes1111 - 2004-08-06
            var customLayout = new SettingItem<string, ListControl>(new CustomListDataType(layoutsList, "Name", "Name"))
                {
                    Group = group,
                    Order = groupOrderBase + 11,
                    EnglishName = "Custom Layout",
                    Description = "Set a custom layout for this tab only"
                };
            baseSettings.Add("CustomLayout", customLayout);

            // SettingItem CustomTheme = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>());
            // changed: Jes1111 - 2004-08-06
            var customTheme = new SettingItem<string, ListControl>(new CustomListDataType(themesList, "Name", "Name"))
                {
                    Group = group,
                    Order = groupOrderBase + 12,
                    EnglishName = "Custom Theme",
                    Description = "Set a custom theme for the modules in this tab only"
                };
            baseSettings.Add("CustomTheme", customTheme);

            // SettingItem CustomThemeAlt = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>());
            // changed: Jes1111 - 2004-08-06
            var customThemeAlt = new SettingItem<string, ListControl>(
                new CustomListDataType(themesList, "Name", "Name"))
                {
                    Group = group,
                    Order = groupOrderBase + 13,
                    EnglishName = "Custom Alt Theme",
                    Description = "Set a custom alternate theme for the modules in this tab only"
                };
            baseSettings.Add("CustomThemeAlt", customThemeAlt);

            var customMenuImage =
                new SettingItem<string, ListControl>(new CustomListDataType(this.GetImageMenu(), "Key", "Value"))
                    {
                        Group = group,
                        Order = groupOrderBase + 14,
                        EnglishName = "Custom Image Menu",
                        Description = "Set a custom menu image for this tab"
                    };
            baseSettings.Add("CustomMenuImage", customMenuImage);

            groupOrderBase = (int)SettingItemGroup.CULTURE_SETTINGS;
            group = SettingItemGroup.CULTURE_SETTINGS;
            var cultureList = LanguageSwitcher.GetLanguageList(true);

            // Localized tab title
            var counter = groupOrderBase + 11;

            // Ignore invariant
            foreach (
                var c in cultureList.Where(c => c != CultureInfo.InvariantCulture && !baseSettings.ContainsKey(c.Name)))
            {
                var localizedTabKeyPhrase = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                    {
                        Order = counter,
                        Group = group,
                        EnglishName = string.Format("Tab Key Phrase ({0})", c.Name),
                        Description = string.Format("Key Phrase this Tab/Page for {0} culture.", c.EnglishName)
                    };
                baseSettings.Add(string.Format("TabKeyPhrase_{0}", c.Name), localizedTabKeyPhrase);
                var localizedTitle = new SettingItem<string, TextBox>(new BaseDataType<string, TextBox>())
                    {
                        Order = counter,
                        Group = group,
                        EnglishName = string.Format("Title ({0})", c.Name),
                        Description = string.Format("Set title for {0} culture.", c.EnglishName)
                    };
                baseSettings.Add(c.Name, localizedTitle);
                counter++;
            }

            return baseSettings;
        }