- tags in Theme.txt.

- Hide the themes that have the hidden tag set in their Theme.txt when looking at the available themes in the themes admin.

--HG--
branch : dev
This commit is contained in:
Suha Can
2010-03-01 11:03:14 -08:00
parent 2ea51a4d72
commit 62902e2b38
9 changed files with 15 additions and 7 deletions

View File

@@ -14,6 +14,7 @@ namespace Orchard.Core.Themes.Models {
public string Version { get; set; }
public string Author { get; set; }
public string HomePage { get; set; }
public string Tags { get; set; }
#endregion
}

View File

@@ -8,5 +8,6 @@ namespace Orchard.Core.Themes.Records {
public virtual string Version { get; set; }
public virtual string Author { get; set; }
public virtual string HomePage { get; set; }
public virtual string Tags { get; set; }
}
}

View File

@@ -74,6 +74,7 @@ namespace Orchard.Core.Themes.Services {
HomePage = descriptor.HomePage ?? String.Empty,
ThemeName = descriptor.Name,
Version = descriptor.Version ?? String.Empty,
Tags = descriptor.Tags ?? String.Empty
};
}
}
@@ -83,9 +84,7 @@ namespace Orchard.Core.Themes.Services {
public IEnumerable<ITheme> GetInstalledThemes() {
List<ITheme> themes = new List<ITheme>();
foreach (var descriptor in _extensionManager.AvailableExtensions()) {
//todo: (heskew) filter out Admin themes in a different manner - eventually we'll need a way to select the admin theme so there should be a clear separation
if (String.Equals(descriptor.ExtensionType, "Theme", StringComparison.OrdinalIgnoreCase)
&& !(descriptor.Name.EndsWith("Admin", StringComparison.OrdinalIgnoreCase))) {
if (String.Equals(descriptor.ExtensionType, "Theme", StringComparison.OrdinalIgnoreCase)) {
Theme theme = new Theme {
Author = descriptor.Author ?? String.Empty,
Description = descriptor.Description ?? String.Empty,
@@ -93,14 +92,16 @@ namespace Orchard.Core.Themes.Services {
HomePage = descriptor.HomePage ?? String.Empty,
ThemeName = descriptor.Name,
Version = descriptor.Version ?? String.Empty,
Tags = descriptor.Tags ?? String.Empty
};
themes.Add(theme);
if (!theme.Tags.Contains("hidden")) {
themes.Add(theme);
}
}
}
return themes;
}
public void InstallTheme(HttpPostedFileBase file) {
_extensionManager.InstallExtension("Theme", file);
}

View File

@@ -2,5 +2,5 @@
author: Jonathan Wall
description: The Orchard Theme for setup and failure conditions.
version: 1.0
tags: Orchard
tags: hidden
homepage: http://www.orchardproject.net

View File

@@ -1,5 +1,6 @@
name: The Admin
version: 1.0
author: Jon Wall
tags: hidden, admin
description: An admin theme not to be used for the site so don't click "Activate" (or "Uninstall"). In the near future admin themes won't be mixed in with site themes.
homepage: http://www.orchardproject.net

View File

@@ -110,6 +110,7 @@ namespace Orchard.Environment.ShellBuilders {
public string Version { get; set; }
public string Author { get; set; }
public string HomePage { get; set; }
public string Tags { get; set; }
}
private readonly SafeModeTheme _theme = new SafeModeTheme {

View File

@@ -21,5 +21,6 @@
public string Version { get; set; }
public string Author { get; set; }
public string HomePage { get; set; }
public string Tags { get; set; }
}
}

View File

@@ -56,7 +56,8 @@ namespace Orchard.Extensions {
Description = GetValue(fields, "description"),
Version = GetValue(fields, "version"),
Author = GetValue(fields, "author"),
HomePage = GetValue(fields, "homepage")
HomePage = GetValue(fields, "homepage"),
Tags = GetValue(fields, "tags")
};
}

View File

@@ -11,5 +11,6 @@ namespace Orchard.Themes {
string Version { get; set; }
string Author { get; set; }
string HomePage { get; set; }
string Tags { get; set; }
}
}