mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-16 18:24:49 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
commit
d2c7b533c0
@ -207,10 +207,29 @@ namespace Orchard.Tests.Modules.Themes.Services {
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<ExtensionDescriptor> EnabledExtensions(ShellDescriptor descriptor) {
|
||||
var extensions = new[] {
|
||||
new ExtensionDescriptor {Name = "ThemeOne", ExtensionType = "Theme"},
|
||||
new ExtensionDescriptor {Name = "ThemeTwo", BaseTheme = "ThemeOne", ExtensionType = "Theme"},
|
||||
new ExtensionDescriptor {Name = "ThemeThree", BaseTheme = "TheThemeThatIsntThere", ExtensionType = "Theme"},
|
||||
new ExtensionDescriptor {Name = "ThemeFourBasedOnFive", BaseTheme = "ThemeFiveBasedOnFour", ExtensionType = "Theme"},
|
||||
new ExtensionDescriptor {Name = "ThemeFiveBasedOnFour", BaseTheme = "ThemeFourBasedOnFive", ExtensionType = "Theme"},
|
||||
};
|
||||
|
||||
foreach (var extension in extensions) {
|
||||
extension.Features = new[] { new FeatureDescriptor { Extension = extension, Name = extension.Name } };
|
||||
yield return extension;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> AvailableFeatures() {
|
||||
return AvailableExtensions().SelectMany(ed => ed.Features);
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> EnabledFeatures(ShellDescriptor descriptor) {
|
||||
return AvailableExtensions().SelectMany(ed => ed.Features);
|
||||
}
|
||||
|
||||
public IEnumerable<Feature> LoadFeatures(IEnumerable<FeatureDescriptor> featureDescriptors) {
|
||||
return featureDescriptors.Select(FrameworkFeature);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ using NUnit.Framework;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.DisplayManagement.Descriptors;
|
||||
using Orchard.DisplayManagement.Implementation;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
|
||||
@ -86,10 +87,18 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<ExtensionDescriptor> EnabledExtensions(ShellDescriptor descriptor) {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> AvailableFeatures() {
|
||||
return _availableFeautures;
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> EnabledFeatures(ShellDescriptor descriptor) {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<Feature> LoadFeatures(IEnumerable<FeatureDescriptor> featureDescriptors) {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
@ -90,11 +90,19 @@ namespace Orchard.Tests.Environment {
|
||||
yield return ext;
|
||||
}
|
||||
|
||||
public IEnumerable<ExtensionDescriptor> EnabledExtensions(ShellDescriptor descriptor) {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> AvailableFeatures() {
|
||||
// note - doesn't order properly
|
||||
return AvailableExtensions().SelectMany(ed => ed.Features);
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> EnabledFeatures(ShellDescriptor descriptor) {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<Feature> LoadFeatures(IEnumerable<FeatureDescriptor> featureDescriptors) {
|
||||
foreach (var descriptor in featureDescriptors) {
|
||||
if (descriptor.Name == "Orchard.Framework") {
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
|
||||
@ -10,10 +11,18 @@ namespace Orchard.Tests.Stubs {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<ExtensionDescriptor> EnabledExtensions(ShellDescriptor descriptor) {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> AvailableFeatures() {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> EnabledFeatures(ShellDescriptor descriptor) {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<Feature> LoadFeatures(IEnumerable<FeatureDescriptor> featureDescriptors) {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
@ -43,7 +43,8 @@ namespace Orchard.Core.Navigation.Controllers {
|
||||
if (model.MenuItemEntries == null || model.MenuItemEntries.Count() < 1)
|
||||
model.MenuItemEntries = _menuService.Get().Select(CreateMenuItemEntries).OrderBy(menuPartEntry => menuPartEntry.MenuItem.Position, new PositionComparer()).ToList();
|
||||
|
||||
return View(model);
|
||||
// need action name as this action is referenced from another action
|
||||
return View("Index", model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Index")]
|
||||
|
@ -23,14 +23,14 @@
|
||||
<text>@T("No Draft") | </text>
|
||||
}
|
||||
</li>
|
||||
@if ((((DateTime?)Model.ScheduledPublishUtc).HasValue && Model.ScheduledPublishUtc.Value > DateTime.UtcNow) || (publishLaterPart.IsPublished() && versionPublishedUtc.HasValue)) {
|
||||
@if ((((DateTime?)Model.ScheduledPublishUtc).HasValue && ((DateTime?)Model.ScheduledPublishUtc).Value > DateTime.UtcNow) || (publishLaterPart.IsPublished() && versionPublishedUtc.HasValue)) {
|
||||
<li>
|
||||
@if (publishLaterPart.IsPublished() && versionPublishedUtc.HasValue) {
|
||||
@T("Published: {0}", Html.DateTimeRelative(versionPublishedUtc.Value, T))
|
||||
}
|
||||
else {
|
||||
<img class="icon" src="@Href("~/Core/PublishLater/Content/Admin/images/scheduled.gif")" alt="@T("Scheduled")" title="@T("The page is scheduled for publishing")" /><text> @T("Scheduled") </text>
|
||||
@Html.DateTime((DateTime)Model.ScheduledPublishUtc.Value, T("M/d/yyyy h:mm tt"))
|
||||
@Html.DateTime(((DateTime?)Model.ScheduledPublishUtc).Value, T("M/d/yyyy h:mm tt"))
|
||||
} | </li>
|
||||
}
|
||||
</ul>
|
@ -5,13 +5,13 @@
|
||||
<h1>@Html.TitleForPage(T("Comments for {0}", Model.DisplayNameForCommentedItem).ToString())</h1>
|
||||
<div class="manage">
|
||||
@if (Model.CommentsClosedOnItem) {
|
||||
@using (Html.BeginFormAntiForgeryPost(Url.Action("Enable", new { commentedItemId = Model.CommentedItemId }), FormMethod.Post, new { @class = "inline" })) {
|
||||
using (Html.BeginFormAntiForgeryPost(Url.Action("Enable", new { commentedItemId = Model.CommentedItemId }), FormMethod.Post, new { @class = "inline" })) {
|
||||
<fieldset>
|
||||
<button type="submit" title="@T("Enable Comments")">@T("Enable Comments")</button>
|
||||
</fieldset>
|
||||
}
|
||||
} else {
|
||||
@using (Html.BeginFormAntiForgeryPost(Url.Action("Close", new { commentedItemId = Model.CommentedItemId }), FormMethod.Post, new { @class = "inline" })) {
|
||||
using (Html.BeginFormAntiForgeryPost(Url.Action("Close", new { commentedItemId = Model.CommentedItemId }), FormMethod.Post, new { @class = "inline" })) {
|
||||
<fieldset>
|
||||
<button type="submit" class="button primaryAction" title="@T("Close Comments")">@T("Close Comments")</button>
|
||||
</fieldset>
|
||||
|
@ -221,48 +221,39 @@ namespace Orchard.Setup.Services {
|
||||
homepageLayer.As<LayerPart>().Name = "TheHomepage";
|
||||
homepageLayer.As<LayerPart>().LayerRule = "url \"~/\"";
|
||||
contentManager.Publish(homepageLayer);
|
||||
|
||||
// and three more for the tripel...really need this elsewhere...
|
||||
var tripelFirst = contentManager.Create("HtmlWidget");
|
||||
tripelFirst.As<WidgetPart>().LayerPart = homepageLayer.As<LayerPart>();
|
||||
tripelFirst.As<WidgetPart>().Title = T("First Leader Aside").Text;
|
||||
tripelFirst.As<WidgetPart>().Zone = "TripelFirst";
|
||||
tripelFirst.As<WidgetPart>().Position = "5";
|
||||
tripelFirst.As<BodyPart>().Text = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
|
||||
tripelFirst.As<CommonPart>().Owner = user;
|
||||
contentManager.Publish(tripelFirst);
|
||||
|
||||
var tripelSecond = contentManager.Create("HtmlWidget");
|
||||
tripelSecond.As<WidgetPart>().LayerPart = homepageLayer.As<LayerPart>();
|
||||
tripelSecond.As<WidgetPart>().Title = T("Second Leader Aside").Text;
|
||||
tripelSecond.As<WidgetPart>().Zone = "TripelSecond";
|
||||
tripelSecond.As<WidgetPart>().Position = "5";
|
||||
tripelSecond.As<BodyPart>().Text = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
|
||||
tripelSecond.As<CommonPart>().Owner = user;
|
||||
contentManager.Publish(tripelSecond);
|
||||
|
||||
var tripelThird = contentManager.Create("HtmlWidget");
|
||||
tripelThird.As<WidgetPart>().LayerPart = homepageLayer.As<LayerPart>();
|
||||
tripelThird.As<WidgetPart>().Title = T("Third Leader Aside").Text;
|
||||
tripelThird.As<WidgetPart>().Zone = "TripelThird";
|
||||
tripelThird.As<WidgetPart>().Position = "5";
|
||||
tripelThird.As<BodyPart>().Text = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
|
||||
tripelThird.As<CommonPart>().Owner = user;
|
||||
contentManager.Publish(tripelThird);
|
||||
|
||||
// create an html widget with the homepage layer as its container
|
||||
var htmlWidget = contentManager.Create("HtmlWidget");
|
||||
htmlWidget.As<WidgetPart>().LayerPart = homepageLayer.As<LayerPart>();
|
||||
htmlWidget.As<WidgetPart>().Title = T("Welcome to Orchard!").Text;
|
||||
htmlWidget.As<WidgetPart>().Zone = "Content";
|
||||
htmlWidget.As<WidgetPart>().Position = "5";
|
||||
htmlWidget.As<BodyPart>().Text = "<p>Congratulations, you've successfully set-up your Orchard site.</p><p>This is the home page of your new site. We've taken the liberty to write here about a few things you could look at next in order to get familiar with the application. Once you feel confident you don't need this anymore, just click <a href=\"/Admin/Contents/Edit/7\">Edit</a> to go into edit mode and replace this with whatever you want on your home page to make it your own.</p><p>One thing you could do (but you don't have to) is go into <a href=\"Admin/Settings\">Manage Settings</a> (follow the <a href=\"Admin\">Admin</a> link and then look for it under \"Settings\" in the menu on the left) and check that everything is configured the way you want.</p><p>You probably want to make the site your own. One of the ways you can do that is by clicking <a href=\"Admin/Themes\">Manage Themes</a> in the admin menu. A theme is a packaged look and feel that affects the whole site.</p><p>Next, you can start playing with the content types that we installed. For example, go ahead and click <a href=\"Admin/Pages/Create\">Add New Page</a> in the admin menu and create an \"about\" page. Then, add it to the navigation menu by going to <a href=\"Admin/Navigation\">Manage Menu</a>. You can also click <a href=\"Admin/Blogs/Create\">Add New Blog</a> and start posting by clicking \"Add New Post\".</p><p>Finally, Orchard has been designed to be extended. It comes with a few built-in modules such as pages and blogs or themes. You can install new themes by going to <a href=\"Admin/Themes\">Manage Themes</a> and clicking <a href=\"Admin/Themes/Install\">Install a new Theme</a>. Like for themes, modules are created by other users of Orchard just like you so if you feel up to it, please <a href=\"http://www.orchardproject.net/\">consider participating</a>.</p><p>--The Orchard Crew</p>";
|
||||
htmlWidget.As<CommonPart>().Owner = user;
|
||||
contentManager.Publish(htmlWidget);
|
||||
|
||||
// and three more for the third aside...really need this elsewhere...
|
||||
var asideHtmlWidget1 = contentManager.Create("HtmlWidget");
|
||||
asideHtmlWidget1.As<WidgetPart>().LayerPart = homepageLayer.As<LayerPart>();
|
||||
asideHtmlWidget1.As<WidgetPart>().Title = T("First Leader Aside").Text;
|
||||
asideHtmlWidget1.As<WidgetPart>().Zone = "AsideThird";
|
||||
asideHtmlWidget1.As<WidgetPart>().Position = "4";
|
||||
asideHtmlWidget1.As<BodyPart>().Text = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
|
||||
asideHtmlWidget1.As<CommonPart>().Owner = user;
|
||||
contentManager.Publish(asideHtmlWidget1);
|
||||
|
||||
var asideHtmlWidget2 = contentManager.Create("HtmlWidget");
|
||||
asideHtmlWidget2.As<WidgetPart>().LayerPart = homepageLayer.As<LayerPart>();
|
||||
asideHtmlWidget2.As<WidgetPart>().Title = T("Second Leader Aside").Text;
|
||||
asideHtmlWidget2.As<WidgetPart>().Zone = "AsideThird";
|
||||
asideHtmlWidget2.As<WidgetPart>().Position = "5";
|
||||
asideHtmlWidget2.As<BodyPart>().Text = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
|
||||
asideHtmlWidget2.As<CommonPart>().Owner = user;
|
||||
contentManager.Publish(asideHtmlWidget2);
|
||||
|
||||
var asideHtmlWidget3 = contentManager.Create("HtmlWidget");
|
||||
asideHtmlWidget3.As<WidgetPart>().LayerPart = homepageLayer.As<LayerPart>();
|
||||
asideHtmlWidget3.As<WidgetPart>().Title = T("Third Leader Aside").Text;
|
||||
asideHtmlWidget3.As<WidgetPart>().Zone = "AsideThird";
|
||||
asideHtmlWidget3.As<WidgetPart>().Position = "6";
|
||||
asideHtmlWidget3.As<BodyPart>().Text = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
|
||||
asideHtmlWidget3.As<CommonPart>().Owner = user;
|
||||
contentManager.Publish(asideHtmlWidget3);
|
||||
|
||||
// create the home page as a WidgetPage
|
||||
var page = contentManager.Create("WidgetPage", VersionOptions.Draft);
|
||||
page.As<RoutePart>().Title = T("Home").ToString();
|
||||
// create a welcome page that's promoted to the home page
|
||||
var page = contentManager.Create("Page");
|
||||
page.As<RoutePart>().Title = T("Welcome to Orchard!").Text;
|
||||
page.As<BodyPart>().Text = "<p>Congratulations, you've successfully set-up your Orchard site.</p><p>This is the home page of your new site. We've taken the liberty to write here about a few things you could look at next in order to get familiar with the application. Once you feel confident you don't need this anymore, just click <a href=\"/Admin/Contents/Edit/7\">Edit</a> to go into edit mode and replace this with whatever you want on your home page to make it your own.</p><p>One thing you could do (but you don't have to) is go into <a href=\"Admin/Settings\">Manage Settings</a> (follow the <a href=\"Admin\">Admin</a> link and then look for it under \"Settings\" in the menu on the left) and check that everything is configured the way you want.</p><p>You probably want to make the site your own. One of the ways you can do that is by clicking <a href=\"Admin/Themes\">Manage Themes</a> in the admin menu. A theme is a packaged look and feel that affects the whole site.</p><p>Next, you can start playing with the content types that we installed. For example, go ahead and click <a href=\"Admin/Pages/Create\">Add New Page</a> in the admin menu and create an \"about\" page. Then, add it to the navigation menu by going to <a href=\"Admin/Navigation\">Manage Menu</a>. You can also click <a href=\"Admin/Blogs/Create\">Add New Blog</a> and start posting by clicking \"Add New Post\".</p><p>Finally, Orchard has been designed to be extended. It comes with a few built-in modules such as pages and blogs or themes. You can install new themes by going to <a href=\"Admin/Themes\">Manage Themes</a> and clicking <a href=\"Admin/Themes/Install\">Install a new Theme</a>. Like for themes, modules are created by other users of Orchard just like you so if you feel up to it, please <a href=\"http://www.orchardproject.net/\">consider participating</a>.</p><p>--The Orchard Crew</p>";
|
||||
page.As<CommonPart>().Owner = user;
|
||||
contentManager.Publish(page);
|
||||
siteSettings.Record.HomePage = "RoutableHomePageProvider;" + page.Id;
|
||||
|
@ -129,6 +129,8 @@ namespace Orchard.Setup {
|
||||
public void SetSiteTheme(string themeName) { }
|
||||
public ITheme GetRequestTheme(RequestContext requestContext) { return _theme; }
|
||||
public IEnumerable<ITheme> GetInstalledThemes() { return new[] { _theme }; }
|
||||
public IEnumerable<ITheme> GetEnabledThemes() { return new[] { _theme }; }
|
||||
|
||||
public void InstallTheme(HttpPostedFileBase file) { }
|
||||
public void UninstallTheme(string themeName) { }
|
||||
public void EnableTheme(string themeName) { }
|
||||
|
@ -5,6 +5,7 @@ using System.Web;
|
||||
using System.Web.Routing;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Environment.Descriptor;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Localization;
|
||||
@ -21,6 +22,7 @@ namespace Orchard.Themes.Services {
|
||||
private readonly IEnumerable<IThemeSelector> _themeSelectors;
|
||||
private readonly IModuleService _moduleService;
|
||||
private readonly IWorkContextAccessor _workContextAccessor;
|
||||
private readonly ShellDescriptor _shellDescriptor;
|
||||
private readonly IShellDescriptorManager _shellDescriptorManager;
|
||||
|
||||
public ThemeService(
|
||||
@ -28,12 +30,14 @@ namespace Orchard.Themes.Services {
|
||||
IExtensionManager extensionManager,
|
||||
IEnumerable<IThemeSelector> themeSelectors,
|
||||
IModuleService moduleService,
|
||||
IWorkContextAccessor workContextAccessor) {
|
||||
IWorkContextAccessor workContextAccessor,
|
||||
ShellDescriptor shellDescriptor) {
|
||||
_shellDescriptorManager = shellDescriptorManager;
|
||||
_extensionManager = extensionManager;
|
||||
_themeSelectors = themeSelectors;
|
||||
_moduleService = moduleService;
|
||||
_workContextAccessor = workContextAccessor;
|
||||
_shellDescriptor = shellDescriptor;
|
||||
Logger = NullLogger.Instance;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
@ -167,11 +171,22 @@ namespace Orchard.Themes.Services {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads only enabled themes
|
||||
/// Loads only installed themes
|
||||
/// </summary>
|
||||
public IEnumerable<ITheme> GetInstalledThemes() {
|
||||
return GetThemes(_extensionManager.AvailableExtensions());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads only enabled themes
|
||||
/// </summary>
|
||||
public IEnumerable<ITheme> GetEnabledThemes() {
|
||||
return GetThemes(_extensionManager.EnabledExtensions(_shellDescriptor));
|
||||
}
|
||||
|
||||
private IEnumerable<ITheme> GetThemes(IEnumerable<ExtensionDescriptor> extensions) {
|
||||
var themes = new List<ITheme>();
|
||||
foreach (var descriptor in _extensionManager.AvailableExtensions()) {
|
||||
foreach (var descriptor in extensions) {
|
||||
|
||||
if (!string.Equals(descriptor.ExtensionType, "Theme", StringComparison.OrdinalIgnoreCase)) {
|
||||
continue;
|
||||
|
@ -117,13 +117,13 @@
|
||||
</None>
|
||||
<None Include="Views\Admin\Index.cshtml" />
|
||||
<Content Include="Views\Items_Widget.Editor.cshtml" />
|
||||
<None Include="Views\Widget.Manage.cshtml" />
|
||||
<None Include="Views\Widget.ControlWrapper.cshtml" />
|
||||
<None Include="Views\EditorTemplates\Parts\Widgets.WidgetPart.cshtml" />
|
||||
<None Include="Views\EditorTemplates\Parts\Widgets.LayerPart.cshtml" />
|
||||
<None Include="Views\EditorTemplates\Parts\Widgets.WidgetBagPart.cshtml" />
|
||||
<Content Include="Views\Items_Widget.cshtml" />
|
||||
<Content Include="Views\Items\Content-WidgetPage.cshtml" />
|
||||
<None Include="Views\Widget.cshtml" />
|
||||
<None Include="Views\Widget.Wrapper.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
@ -42,7 +42,7 @@ namespace Orchard.Widgets.Services {
|
||||
public IEnumerable<string> GetZones() {
|
||||
HashSet<string> zones = new HashSet<string>();
|
||||
|
||||
foreach (var theme in _themeService.GetInstalledThemes().Where(theme => theme.Zones != null && !theme.Zones.Trim().Equals(string.Empty))) {
|
||||
foreach (var theme in _themeService.GetEnabledThemes().Where(theme => theme.Zones != null && !theme.Zones.Trim().Equals(string.Empty))) {
|
||||
foreach (string zone in theme.Zones.Split(',').Where(zone => !zones.Contains(zone))) {
|
||||
zones.Add(zone.Trim());
|
||||
}
|
||||
|
@ -4,33 +4,25 @@ using Orchard.Widgets.Models;
|
||||
|
||||
namespace Orchard.Widgets {
|
||||
public class Shapes : IShapeTableProvider {
|
||||
private readonly IOrchardServices _orchardServices;
|
||||
|
||||
public Shapes(IOrchardServices orchardServices) {
|
||||
_orchardServices = orchardServices;
|
||||
}
|
||||
|
||||
public void Discover(ShapeTableBuilder builder) {
|
||||
builder.Describe("Items_Widget")
|
||||
.Configure(descriptor => {
|
||||
// todo: have "alternates" for chrome
|
||||
if (_orchardServices.Authorizer.Authorize(Permissions.ManageWidgets))
|
||||
descriptor.Wrappers.Add("Widget_Manage");
|
||||
else
|
||||
descriptor.Wrappers.Add("Widget");
|
||||
descriptor.Wrappers.Add("Widget_Wrapper");
|
||||
descriptor.Wrappers.Add("Widget_ControlWrapper");
|
||||
})
|
||||
.OnCreated(created => {
|
||||
var widget = created.Shape;
|
||||
widget.Main.Add(created.New.PlaceChildContent(Source: widget));
|
||||
})
|
||||
.OnDisplaying(displaying => {
|
||||
ContentItem contentItem = displaying.Shape.ContentItem;
|
||||
var widget = displaying.Shape;
|
||||
widget.Classes.Add("widget");
|
||||
ContentItem contentItem = widget.ContentItem;
|
||||
if (contentItem != null) {
|
||||
var zoneName = contentItem.As<WidgetPart>().Zone;
|
||||
displaying.ShapeMetadata.Alternates.Add("Items_Widget__" + contentItem.ContentType);
|
||||
displaying.ShapeMetadata.Alternates.Add("Items_Widget__" + zoneName);
|
||||
//...would like...if '__' was collapsible
|
||||
//displaying.ShapeMetadata.Alternates.Add("Items_Widget__" + zoneName + "__" + contentItem.ContentType);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
@using Orchard.ContentManagement;
|
||||
@using Orchard.Widgets;
|
||||
@{
|
||||
if (AuthorizedFor(Permissions.ManageWidgets)) {
|
||||
Model.Classes.Add("widget-manage");
|
||||
}
|
||||
var tag = Tag(Model, "div");
|
||||
}
|
||||
@tag.StartElement
|
||||
@if (AuthorizedFor(Permissions.ManageWidgets)) {
|
||||
<div class="manage-actions">@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, (ContentItem)Model.ContentItem)</div>
|
||||
}
|
||||
@Display(Model.Main)
|
||||
@tag.EndElement
|
@ -1,5 +0,0 @@
|
||||
@using Orchard.ContentManagement;
|
||||
<div class="widget widget-manage">
|
||||
<div class="actions">@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, (ContentItem)Model.ContentItem)</div>
|
||||
@Display(Model.Main)
|
||||
</div>
|
@ -0,0 +1,14 @@
|
||||
@using Orchard.ContentManagement;
|
||||
@using Orchard.Widgets;
|
||||
@{
|
||||
if (AuthorizedFor(Permissions.ManageWidgets)) {
|
||||
Model.Classes.Add("widget-manage");
|
||||
}
|
||||
var tag = Tag(Model, "div");
|
||||
}
|
||||
@tag.StartElement
|
||||
@if (AuthorizedFor(Permissions.ManageWidgets)) {
|
||||
<div class="manage-actions">@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, (ContentItem)Model.ContentItem)</div>
|
||||
}
|
||||
@Display(Model.Main)
|
||||
@tag.EndElement
|
@ -1 +0,0 @@
|
||||
@Display(Model.Main)
|
@ -159,7 +159,7 @@ pre,code,tt { font: 1em 'andale mono', 'lucida console', monospace; line-height:
|
||||
|
||||
}
|
||||
|
||||
#layout-header, #layout-main, #layout-footer {
|
||||
#layout-header, #layout-before-main, #layout-main, #layout-footer, #layout-after-main, #layout-tripel {
|
||||
width:960px;
|
||||
margin:0 auto;
|
||||
}
|
||||
@ -183,11 +183,22 @@ pre,code,tt { font: 1em 'andale mono', 'lucida console', monospace; line-height:
|
||||
color: #434343;
|
||||
}
|
||||
|
||||
#layout-footer
|
||||
#layout-tripel
|
||||
{
|
||||
border-top: 1px solid #dbdbdb;
|
||||
border-top: 1px solid #dbdbdb;
|
||||
}
|
||||
|
||||
#layout-main
|
||||
{
|
||||
border-top: 1px solid #dbdbdb;
|
||||
}
|
||||
|
||||
#layout-after-main
|
||||
{
|
||||
border-top: 1px solid #dbdbdb;
|
||||
}
|
||||
|
||||
|
||||
/* Navigation */
|
||||
#layout-navigation
|
||||
{
|
||||
@ -226,6 +237,11 @@ nav ul
|
||||
line-height:24px;
|
||||
}
|
||||
|
||||
#layout-footer
|
||||
{
|
||||
border-top: 1px solid #dbdbdb;
|
||||
}
|
||||
|
||||
/* Zones */
|
||||
/*.zone {
|
||||
background-color: yellow;
|
||||
@ -425,10 +441,16 @@ ul.comments li div.text {
|
||||
clear:both;
|
||||
}
|
||||
|
||||
.aside.third div > div {
|
||||
#layout-tripel div > div {
|
||||
float:left;
|
||||
width:304px;
|
||||
padding:12px 6px 0 6px;
|
||||
width:316px;
|
||||
/*padding:12px 6px 0 6px;*/
|
||||
}
|
||||
|
||||
#footer-quad div.zone {
|
||||
float:left;
|
||||
width:240px;
|
||||
/*padding:12px 6px 0 6px;*/
|
||||
}
|
||||
|
||||
/* Featured Zone - switch to an image */
|
||||
@ -449,7 +471,30 @@ ul.comments li div.text {
|
||||
margin: 6px;
|
||||
}
|
||||
|
||||
|
||||
.clearfix {
|
||||
clear:both;
|
||||
}
|
||||
|
||||
#footer div {
|
||||
/*border:1px solid #ff0000;*/
|
||||
}
|
||||
|
||||
/* If zones 1 and 2 are empty in the quad */
|
||||
|
||||
.split-left #footer-quad-third div.zone {
|
||||
width:600px;
|
||||
}
|
||||
|
||||
.split-left #footer-quad-fourth div.zone {
|
||||
width:360px;
|
||||
}
|
||||
|
||||
/* If zones 3 and 4 are empty in the quad */
|
||||
|
||||
.split-right #footer-quad-first div.zone {
|
||||
width:600px;
|
||||
}
|
||||
|
||||
.split-right #footer-quad-second div.zone {
|
||||
width:360px;
|
||||
}
|
@ -4,4 +4,4 @@ Description: It's a *really* good theme, yo.
|
||||
Version: 0.1
|
||||
Tags: Awesome
|
||||
Website: http://orchardproject.net
|
||||
Zones: Header, Navigation, Messages, AsideFirst, AsideSecond, AsideThird, Content, Footer
|
||||
Zones: Header, Navigation, Featured, BeforeMain, Messages, BeforeContent, Content, AfterContent, AfterMain, TripelFirst, TripelSecond, TripelThird, FooterQuadFirst, FooterQuadSecond, FooterQuadThird, FooterQuadFourth, Footer, AsideFirst, AsideSecond, AsideThird
|
@ -22,6 +22,17 @@
|
||||
|
||||
}
|
||||
|
||||
//Add classes to the wrapper div to toggle quad widget zones on and off
|
||||
if (Model.FooterQuadFirst == null && Model.FooterQuadSecond == null) {
|
||||
Model.Classes.Add("split-left");
|
||||
}
|
||||
else if (Model.FooterQuadThird == null && Model.FooterQuadFourth == null) {
|
||||
Model.Classes.Add("split-right");
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
Model.Id = "layout-wrapper";
|
||||
var tag = Tag (Model, "div");
|
||||
|
||||
@ -31,7 +42,7 @@
|
||||
<h1 id="branding"><a href="@homeUrl">@WorkContext.CurrentSite.SiteName</a></h1>
|
||||
}
|
||||
using(Capture(pbo => WorkContext.Layout.Footer.Add(pbo) )) {
|
||||
<div class="credits"><span class="poweredby">Powered by Orchard</span> <span class="copyright">© The Theme Machine 2010.</span></div>
|
||||
<div class="credits"><span class="poweredby">Powered by <a href="http://www.orchardproject.net" title="Welcome to the New World Order" target="_blank">Orchard</a></span> <span class="copyright">© The Theme Machine 2010.</span></div>
|
||||
}
|
||||
|
||||
WorkContext.Layout.Footer.Add(New.User());
|
||||
@ -121,7 +132,7 @@
|
||||
}
|
||||
<div id="layout-footer" class="group">
|
||||
<footer id="footer">
|
||||
<div id="footer-quad">
|
||||
<div id="footer-quad" class="group">
|
||||
@if (Model.FooterQuadFirst != null) {
|
||||
<div id="footer-quad-first">
|
||||
@Zone(Model.FooterQuadFirst)
|
||||
@ -133,12 +144,12 @@
|
||||
</div>
|
||||
}
|
||||
@if (Model.FooterQuadThird != null) {
|
||||
<div id="footer-quad-second">
|
||||
<div id="footer-quad-third">
|
||||
@Zone(Model.FooterQuadThird)
|
||||
</div>
|
||||
}
|
||||
@if (Model.FooterQuadFourth != null) {
|
||||
<div id="footer-quad-second">
|
||||
<div id="footer-quad-fourth">
|
||||
@Zone(Model.FooterQuadFourth)
|
||||
</div>
|
||||
}
|
||||
|
@ -4,14 +4,13 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using ICSharpCode.SharpZipLib.Zip;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Environment.Extensions.Folders;
|
||||
using Orchard.Environment.Extensions.Helpers;
|
||||
using Orchard.Environment.Extensions.Loaders;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Settings;
|
||||
using Orchard.Themes;
|
||||
using Orchard.Utility;
|
||||
using Orchard.Utility.Extensions;
|
||||
|
||||
@ -36,12 +35,30 @@ namespace Orchard.Environment.Extensions {
|
||||
return _folders.SelectMany(folder => folder.AvailableExtensions());
|
||||
}
|
||||
|
||||
public IEnumerable<ExtensionDescriptor> EnabledExtensions(ShellDescriptor descriptor) {
|
||||
var enabledFeatures = EnabledFeatures(descriptor);
|
||||
return _folders.SelectMany(folder => folder.AvailableExtensions())
|
||||
.Where(extensionDescriptor =>
|
||||
extensionDescriptor.Features.Any(featureDescriptor =>
|
||||
enabledFeatures.Any(availableFeature => featureDescriptor.Name == availableFeature.Name)));
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> AvailableFeatures() {
|
||||
var featureDescriptors = AvailableExtensions().SelectMany(ext => ext.Features);
|
||||
var featureDescriptorsOrdered = featureDescriptors.OrderByDependencies(HasDependency);
|
||||
return featureDescriptorsOrdered.ToReadOnlyCollection();
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> EnabledFeatures(ShellDescriptor descriptor) {
|
||||
return AvailableExtensions()
|
||||
.SelectMany(extensionDescriptor => extensionDescriptor.Features)
|
||||
.Where(featureDescriptor => IsFeatureEnabledInDescriptor(featureDescriptor, descriptor));
|
||||
}
|
||||
|
||||
private static bool IsFeatureEnabledInDescriptor(FeatureDescriptor featureDescriptor, ShellDescriptor shellDescriptor) {
|
||||
return shellDescriptor.Features.Any(shellDescriptorFeature => shellDescriptorFeature.Name == featureDescriptor.Name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the item has an explicit or implicit dependency on the subject
|
||||
/// </summary>
|
||||
|
@ -1,11 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
|
||||
namespace Orchard.Environment.Extensions {
|
||||
public interface IExtensionManager {
|
||||
IEnumerable<ExtensionDescriptor> AvailableExtensions();
|
||||
IEnumerable<ExtensionDescriptor> EnabledExtensions(ShellDescriptor descriptor);
|
||||
IEnumerable<FeatureDescriptor> AvailableFeatures();
|
||||
IEnumerable<FeatureDescriptor> EnabledFeatures(ShellDescriptor descriptor);
|
||||
IEnumerable<Feature> LoadFeatures(IEnumerable<FeatureDescriptor> featureDescriptors);
|
||||
|
||||
void InstallExtension(string extensionType, HttpPostedFileBase extensionBundle);
|
||||
|
@ -32,10 +32,7 @@ namespace Orchard.Environment.ShellBuilders {
|
||||
}
|
||||
|
||||
public ShellBlueprint Compose(ShellSettings settings, ShellDescriptor descriptor) {
|
||||
var enabledFeatures = _extensionManager.AvailableExtensions()
|
||||
.SelectMany(extensionDescriptor => extensionDescriptor.Features)
|
||||
.Where(featureDescriptor => IsFeatureEnabledInDescriptor(featureDescriptor, descriptor));
|
||||
|
||||
var enabledFeatures = _extensionManager.EnabledFeatures(descriptor);
|
||||
var features = _extensionManager.LoadFeatures(enabledFeatures);
|
||||
|
||||
if (descriptor.Features.Any(feature => feature.Name == "Orchard.Framework"))
|
||||
@ -55,10 +52,6 @@ namespace Orchard.Environment.ShellBuilders {
|
||||
};
|
||||
}
|
||||
|
||||
private static bool IsFeatureEnabledInDescriptor(FeatureDescriptor featureDescriptor, ShellDescriptor shellDescriptor) {
|
||||
return shellDescriptor.Features.Any(shellDescriptorFeature => shellDescriptorFeature.Name == featureDescriptor.Name);
|
||||
}
|
||||
|
||||
private static IEnumerable<Feature> BuiltinFeatures() {
|
||||
yield return new Feature {
|
||||
Descriptor = new FeatureDescriptor {
|
||||
|
@ -14,6 +14,7 @@ namespace Orchard.Themes {
|
||||
void DisableTheme(string themeName);
|
||||
|
||||
IEnumerable<ITheme> GetInstalledThemes();
|
||||
IEnumerable<ITheme> GetEnabledThemes();
|
||||
void InstallTheme(HttpPostedFileBase file);
|
||||
void UninstallTheme(string themeName);
|
||||
}
|
||||
|
@ -21,7 +21,8 @@ namespace Orchard.UI.Navigation {
|
||||
protected virtual IUser CurrentUser { get; [UsedImplicitly] private set; }
|
||||
|
||||
public IEnumerable<MenuItem> BuildMenu(string menuName) {
|
||||
return FinishMenu(Crop(Reduce(Merge(AllSources(menuName)))).ToArray());
|
||||
var sources = GetSources(menuName);
|
||||
return FinishMenu(Crop(Reduce(Merge(sources))).ToArray());
|
||||
}
|
||||
|
||||
private IEnumerable<MenuItem> FinishMenu(IEnumerable<MenuItem> menuItems) {
|
||||
@ -79,7 +80,7 @@ namespace Orchard.UI.Navigation {
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<IEnumerable<MenuItem>> AllSources(string menuName) {
|
||||
private IEnumerable<IEnumerable<MenuItem>> GetSources(string menuName) {
|
||||
foreach (var provider in _providers) {
|
||||
if (provider.MenuName == menuName) {
|
||||
var builder = new NavigationBuilder();
|
||||
|
Loading…
Reference in New Issue
Block a user