コード例 #1
0
        public BaseTemplate AddStyles(Func <string, string> converter, params string[] src)
        {
            foreach (var s in src)
            {
                if (s.Contains(ColorThemesSettings.ThemeFolderTemplate))
                {
                    if (ThemeStyles == null)
                    {
                        continue;
                    }

                    ThemeStyles.AddSource(r => ResolveUrl(ColorThemesSettings.GetThemeFolderName(converter(r))), s);
                }
                else
                {
                    if (HeadStyles == null)
                    {
                        continue;
                    }

                    HeadStyles.AddSource(converter, s);
                }
            }

            return(this);
        }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page is Share)
     {
         Master.DisabledHelpTour       = true;
         Master.DisabledSidePanel      = true;
         Master.DisabledTopStudioPanel = true;
     }
     else
     {
         Page.RegisterStyleControl(LoadControl(VirtualPathUtility.ToAbsolute("~/products/files/masters/styles.ascx")));
         Page.RegisterBodyScripts(LoadControl(VirtualPathUtility.ToAbsolute("~/products/files/masters/FilesScripts.ascx")));
     }
     Page.RegisterClientLocalizationScript(typeof(ClientScripts.FilesLocalizationResources));
     Page.RegisterClientScript(typeof(ClientScripts.FilesConstantsResources));
     Page.RegisterInlineScript("if (typeof ZeroClipboard != 'undefined') {ZeroClipboard.setMoviePath('" + CommonLinkUtility.ToAbsolute("~/js/flash/zeroclipboard/zeroclipboard10.swf") + "');}", true);
     Page.RegisterStyleControl(ColorThemesSettings.GetThemeFolderName(CommonLinkUtility.FilesBaseAbsolutePath + "/app_themes/<theme_folder>/leftmenu.less"), true);
 }
コード例 #3
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();
        }
コード例 #4
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"
                }
            };
        }
コード例 #5
0
        public void AddStyles(string src)
        {
            if (src.Contains(ColorThemesSettings.ThemeFolderTemplate))
            {
                if (ThemeStyles == null)
                {
                    return;
                }

                ThemeStyles.Styles.Add(ResolveUrl(ColorThemesSettings.GetThemeFolderName(src)));
            }
            else
            {
                if (HeadStyles == null)
                {
                    return;
                }

                HeadStyles.Styles.Add(src);
            }
        }
コード例 #6
0
        public void AddStyles(string src, bool theme)
        {
            if (theme)
            {
                if (ThemeStyles == null)
                {
                    return;
                }

                ThemeStyles.Styles.Add(ResolveUrl(ColorThemesSettings.GetThemeFolderName(src)));
            }
            else
            {
                if (HeadStyles == null)
                {
                    return;
                }

                HeadStyles.Styles.Add(src);
            }
        }
コード例 #7
0
 public void SaveColorTheme(string theme)
 {
     SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
     ColorThemesSettings.SaveColorTheme(theme);
     MessageService.Send(HttpContext.Current.Request, MessageAction.ColorThemeChanged);
 }
コード例 #8
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));
        }
コード例 #9
0
 public void SaveColorTheme(SettingsModel model)
 {
     SecurityContext.DemandPermissions(Tenant, SecutiryConstants.EditPortalSettings);
     ColorThemesSettings.SaveColorTheme(model.Theme);
     MessageService.Send(MessageAction.ColorThemeChanged);
 }
コード例 #10
0
 public void SaveColorTheme(string theme)
 {
     SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
     ColorThemesSettings.SaveColorTheme(theme);
 }