Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.RegisterBodyScripts("~/UserControls/Management/ColorThemes/js/colorthemes.js")
            .RegisterStyle("~/UserControls/Management/ColorThemes/css/colorthemes.css");

            ChosenTheme = ColorThemesSettings.GetColorThemesSettings();

            ColorThemesList = new List <PortalColorTheme>
            {
                new PortalColorTheme
                {
                    Title = Resource.ColorThemePureOrange,
                    Value = "pure-orange"
                },
                new PortalColorTheme
                {
                    Title = Resource.ColorThemeDefault,
                    Value = "default"
                },
                new PortalColorTheme
                {
                    Title = Resource.ColorThemeDarkGreen,
                    Value = "dark-green"
                },
                new PortalColorTheme
                {
                    Title = Resource.ColorThemeDeepBlue,
                    Value = "deep-blue"
                },
                new PortalColorTheme
                {
                    Title = Resource.ColorThemeWildPink,
                    Value = "wild-pink"
                },
                new PortalColorTheme
                {
                    Title = Resource.ColorThemeBrightBlue,
                    Value = "bright-blue"
                }
            };

            HelpLink = CommonLinkUtility.GetHelpLink();
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(GetType());
            Page.RegisterBodyScripts(ResolveUrl("~/usercontrols/Management/ColorThemes/js/colorthemes.js"));
            Page.RegisterStyleControl(ResolveUrl("~/usercontrols/management/ColorThemes/css/colorthemes.css"));

            ChosenTheme = ColorThemesSettings.GetColorThemesSettings();

            ColorThemesList = new List <PortalColorTheme>
            {
                new PortalColorTheme
                {
                    Title = Resource.ColorThemeDefault,
                    Value = "default"
                },
                new PortalColorTheme
                {
                    Title = Resource.ColorThemePureOrange,
                    Value = "pure-orange"
                },
                new PortalColorTheme
                {
                    Title = Resource.ColorThemeDarkGreen,
                    Value = "dark-green"
                },
                new PortalColorTheme
                {
                    Title = Resource.ColorThemeDeepBlue,
                    Value = "deep-blue"
                },
                new PortalColorTheme
                {
                    Title = Resource.ColorThemeWildPink,
                    Value = "wild-pink"
                },
                new PortalColorTheme
                {
                    Title = Resource.ColorThemeBrightBlue,
                    Value = "bright-blue"
                }
            };
        }
Exemplo n.º 3
0
        public override string GetVaryByCustomString(HttpContext context, string custom)
        {
            if (String.IsNullOrEmpty(custom))
            {
                return(base.GetVaryByCustomString(context, custom));
            }
            if (custom == "cacheKey")
            {
                return(ClientSettings.ResetCacheKey);
            }

            var result = String.Empty;

            foreach (Match match in Regex.Matches(custom.ToLower(), "(?<key>\\w+)(\\[(?<subkey>\\w+)\\])?;?", RegexOptions.Compiled))
            {
                var key    = String.Empty;
                var subkey = String.Empty;

                if (match.Groups["key"].Success)
                {
                    key = match.Groups["key"].Value;
                }

                if (match.Groups["subkey"].Success)
                {
                    subkey = match.Groups["subkey"].Value;
                }

                var value = String.Empty;

                switch (key)
                {
                case "relativeurl":
                    var appUrl = VirtualPathUtility.ToAbsolute("~/");
                    value = Request.GetUrlRewriter().AbsolutePath.Remove(0, appUrl.Length - 1);
                    break;

                case "url":
                    value = Request.GetUrlRewriter().AbsoluteUri;
                    break;

                case "page":
                    value = Request.GetUrlRewriter().AbsolutePath.Substring(Request.Url.AbsolutePath.LastIndexOfAny(new[] { '/', '\\' }) + 1);
                    break;

                case "module":
                    var module  = "common";
                    var matches = Regex.Match(Request.Url.AbsolutePath.ToLower(), "(products|addons)/(\\w+)/?", RegexOptions.Compiled);

                    if (matches.Success && matches.Groups.Count > 2 && matches.Groups[2].Success)
                    {
                        module = matches.Groups[2].Value;
                    }

                    value = module;

                    break;

                case "culture":
                    value = Thread.CurrentThread.CurrentUICulture.Name;
                    break;

                case "theme":
                    value = ColorThemesSettings.GetColorThemesSettings();
                    break;

                case "whitelabel":
                    var whiteLabelSettings = TenantWhiteLabelSettings.Load();
                    value = whiteLabelSettings.LogoText ?? string.Empty;
                    break;
                }

                if (!(String.Compare((value ?? "").ToLower(), subkey, StringComparison.Ordinal) == 0 ||
                      String.IsNullOrEmpty(subkey)))
                {
                    continue;
                }

                result += "|" + value;
            }

            if (!string.IsNullOrEmpty(result))
            {
                return(String.Join("|", ClientSettings.ResetCacheKey, result));
            }

            return(base.GetVaryByCustomString(context, custom));
        }