public override void Build(BuildContext context)
        {
            var currentThemeId = _siteThemeService.GetCurrentThemeName();
            var root           = new XElement("CurrentTheme", new XAttribute("id", currentThemeId));

            context.RecipeDocument.Element("Tomelt").Add(root);
        }
Beispiel #2
0
        public void DisableThemeFeatures(string themeName)
        {
            var themes = new Queue <string>();

            while (themeName != null)
            {
                if (themes.Contains(themeName))
                {
                    throw new InvalidOperationException(T("The theme \"{0}\" is already in the stack of themes that need features disabled.", themeName).Text);
                }
                var theme = _extensionManager.GetExtension(themeName);
                if (theme == null)
                {
                    break;
                }
                themes.Enqueue(themeName);

                themeName = !string.IsNullOrWhiteSpace(theme.BaseTheme)
                    ? theme.BaseTheme
                    : null;
            }

            var currentTheme = _siteThemeService.GetCurrentThemeName();

            while (themes.Count > 0)
            {
                var themeId = themes.Dequeue();

                // Not disabling base theme if it's the current theme.
                if (themeId != currentTheme)
                {
                    _featureManager.DisableFeatures(new[] { themeId });
                }
            }
        }
Beispiel #3
0
        public ThemeSelectorResult GetTheme(RequestContext context)
        {
            string currentThemeName = _siteThemeService.GetCurrentThemeName();

            return(String.IsNullOrEmpty(currentThemeName) ? null : new ThemeSelectorResult {
                Priority = -5, ThemeName = currentThemeName
            });
        }
        public void GetNavigation(NavigationBuilder builder)
        {
            var themeName = _siteThemeService.GetCurrentThemeName();

            builder.Add(T("Themes"),
                        menu => menu
                        .Add(T("Krake admin theme options"), "5.0", item => item.Action("ThemeSettings", "Admin", new { area = Constants.RoutesAreaName }).LocalNav())
                        );
        }
        public void Disabled(Feature feature)
        {
            var currentTheme = _siteThemeService.GetCurrentThemeName();

            if (feature.Descriptor.Name == currentTheme)
            {
                _siteThemeService.SetSiteTheme(null);


                _notifier.Warning(T("The current theme was disabled, because one of its dependencies was disabled."));
            }
        }
        public void Disabled(Feature feature)
        {
            var currentTheme = _siteThemeService.GetCurrentThemeName();

            if (feature.Descriptor.Name == currentTheme)
            {
                _siteThemeService.SetSiteTheme(null);

                // Notifications don't work in feature events. See: https://github.com/OrchardCMS/Orchard/issues/6106
                _notifier.Warning(T("The current theme was disabled, because one of its dependencies was disabled."));
            }
        }
        public bool TryGetDescriptorBinding(string shapeType, out ShapeBinding shapeBinding)
        {
            shapeBinding = null;

            if (!Enabled)
            {
                return(false);
            }

            var currentThemeName = _siteThemeService.GetCurrentThemeName();
            var shapeTable       = _shapeTableLocator.Lookup(currentThemeName);

            return(shapeTable.Bindings.TryGetValue(shapeType, out shapeBinding));
        }
Beispiel #8
0
        public ActionResult Settings()
        {
            var viewModel = new Settings {
                Description = string.Empty, Placement = string.Empty
            };
            string path = System.Web.HttpContext.Current.Server.MapPath(string.Format("~/Themes/{0}/", _siteThemeService.GetCurrentThemeName()));

            var theme = System.IO.File.OpenText(Path.Combine(path, "Theme.txt"));

            viewModel.Description = theme.ReadToEnd();
            theme.Close();

            var place = System.IO.File.OpenText(Path.Combine(path, "Placement.info"));

            viewModel.Placement = place.ReadToEnd();
            place.Close();

            return(View(viewModel));
        }