Removing dead code (related to #16484)

--HG--
branch : dev
This commit is contained in:
Dave Reed
2010-11-17 14:54:13 -08:00
parent ab570906d5
commit 2363d97092
2 changed files with 0 additions and 116 deletions

View File

@@ -176,40 +176,6 @@ namespace Orchard.Modules.Services {
: featuresInQuestion.First()));
}
private static string TryLocalize(string key, string original, Localizer localizer) {
var localized = localizer(key).Text;
if(key == localized) {
// no specific localization available
return original;
}
return localized;
}
//private IModule AssembleModuleFromDescriptor(ExtensionDescriptor extensionDescriptor) {
// var localizer = LocalizationUtilities.Resolve(_workContextAccessor.GetContext(), String.Concat(extensionDescriptor.Location, "/", extensionDescriptor.Name, "/Module.txt"));
// return new Module {
// //ModuleName = extensionDescriptor.Name,
// //DisplayName = TryLocalize("Name", extensionDescriptor.DisplayName, localizer),
// //Description = TryLocalize("Description", extensionDescriptor.Description, localizer),
// //Version = extensionDescriptor.Version,
// //Author = TryLocalize("Author", extensionDescriptor.Author, localizer),
// //HomePage = TryLocalize("Website", extensionDescriptor.WebSite, localizer),
// //Tags = TryLocalize("Tags", extensionDescriptor.Tags, localizer),
// //Features = extensionDescriptor.Features.Select(f => new FeatureDescriptor {
// // Category = TryLocalize(f.Name + " Category", f.Category, localizer),
// // Dependencies = f.Dependencies,
// // Description = TryLocalize(f.Name + " Description", f.Description, localizer),
// // DisplayName = TryLocalize(f.Name + " Name", f.DisplayName, localizer),
// // Extension = f.Extension,
// // Name = f.Name,
// //})
// };
//}
private static ModuleFeature AssembleModuleFromDescriptor(Feature feature, bool isEnabled) {
return new ModuleFeature {
Descriptor = feature.Descriptor,

View File

@@ -25,11 +25,6 @@ namespace Orchard.Themes.Services {
private readonly IFeatureManager _featureManager;
private readonly IEnumerable<IThemeSelector> _themeSelectors;
private readonly IWorkContextAccessor _workContextAccessor;
private readonly ShellDescriptor _shellDescriptor;
private readonly IOrchardServices _orchardServices;
private readonly IShellDescriptorManager _shellDescriptorManager;
public ThemeService(
IShellDescriptorManager shellDescriptorManager,
IExtensionManager extensionManager,
@@ -39,14 +34,10 @@ namespace Orchard.Themes.Services {
IWorkContextAccessor workContextAccessor,
ShellDescriptor shellDescriptor,
IOrchardServices orchardServices) {
_shellDescriptorManager = shellDescriptorManager;
_extensionManager = extensionManager;
_featureManager = featureManager;
_themeSelectors = themeSelectors;
_workContextAccessor = workContextAccessor;
_shellDescriptor = shellDescriptor;
_orchardServices = orchardServices;
Logger = NullLogger.Instance;
T = NullLocalizer.Instance;
}
@@ -54,25 +45,6 @@ namespace Orchard.Themes.Services {
public Localizer T { get; set; }
public ILogger Logger { get; set; }
private bool AllBaseThemesAreInstalled(string baseThemeName) {
var themesSeen = new List<string>();
while (!string.IsNullOrWhiteSpace(baseThemeName)) {
//todo: (heskew) need a better way to protect from recursive references
if (themesSeen.Contains(baseThemeName))
throw new InvalidOperationException(T("The theme \"{0}\" was already seen - looks like we're going around in circles.", baseThemeName).Text);
themesSeen.Add(baseThemeName);
var baseTheme = _extensionManager.GetExtension(baseThemeName);
if (baseTheme == null)
return false;
baseThemeName = baseTheme.BaseTheme;
}
return true;
}
public void DisableThemeFeatures(string themeName) {
var themes = new Queue<string>();
while (themeName != null) {
@@ -109,25 +81,6 @@ namespace Orchard.Themes.Services {
_featureManager.EnableFeatures(new[] {themes.Pop()});
}
private bool DoEnableTheme(string themeName) {
if (string.IsNullOrWhiteSpace(themeName))
return false;
//todo: (heskew) need messages given in addition to all of these early returns so something meaningful can be presented to the user
var themeToEnable = _extensionManager.GetExtension(themeName);
if (themeToEnable == null)
return false;
// ensure all base themes down the line are present and accounted for
//todo: (heskew) dito on the need of a meaningful message
if (!AllBaseThemesAreInstalled(themeToEnable.BaseTheme))
return false;
// enable all theme features
EnableThemeFeatures(themeToEnable.Name);
return true;
}
public ExtensionDescriptor GetRequestTheme(RequestContext requestContext) {
var requestTheme = _themeSelectors
.Select(x => x.GetTheme(requestContext))
@@ -169,40 +122,5 @@ namespace Orchard.Themes.Services {
}
return themes;
}
private static string TryLocalize(string key, string original, Localizer localizer) {
var localized = localizer(key).Text;
if ( key == localized ) {
// no specific localization available
return original;
}
return localized;
}
private bool IsThemeEnabled(ExtensionDescriptor descriptor) {
return (descriptor.Name == "TheAdmin" || descriptor.Name == "SafeMode") ||
_shellDescriptorManager.GetShellDescriptor().Features.Any(sf => sf.Name == descriptor.Name);
}
//private ITheme CreateTheme(ExtensionDescriptor descriptor) {
// var localizer = LocalizationUtilities.Resolve(_workContextAccessor.GetContext(), String.Concat(descriptor.Location, "/", descriptor.Name, "/Theme.txt"));
// return new Theme {
// //Author = TryLocalize("Author", descriptor.Author, localizer) ?? "",
// //Description = TryLocalize("Description", descriptor.Description, localizer) ?? "",
// DisplayName = TryLocalize("Name", descriptor.DisplayName, localizer) ?? "",
// //HomePage = TryLocalize("Website", descriptor.WebSite, localizer) ?? "",
// ThemeName = descriptor.Name,
// //Version = descriptor.Version ?? "",
// Tags = TryLocalize("Tags", descriptor.Tags, localizer) ?? "",
// Zones = descriptor.Zones ?? "",
// BaseTheme = descriptor.BaseTheme ?? "",
// Enabled = IsThemeEnabled(descriptor)
// };
//}
}
}