mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-16 03:16:11 +08:00
Delegating theme installation to Orchard.Packaging.
--HG-- branch : dev
This commit is contained in:
parent
48ccf121f8
commit
a1543c964f
@ -143,6 +143,10 @@ namespace Orchard.Packaging.Controllers {
|
|||||||
return RedirectToAction(redirectTo == "Themes" ? "Themes" : "Modules");
|
return RedirectToAction(redirectTo == "Themes" ? "Themes" : "Modules");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult AddTheme(string returnUrl) {
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
public ActionResult AddModule(string returnUrl) {
|
public ActionResult AddModule(string returnUrl) {
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,9 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Views\Gallery\Themes.cshtml" />
|
<Content Include="Views\Gallery\Themes.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup>
|
||||||
|
<Content Include="Views\Gallery\AddTheme.cshtml" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
@ -1,16 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Web;
|
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Orchard.Data.Migration;
|
using Orchard.Data.Migration;
|
||||||
using Orchard.DisplayManagement;
|
|
||||||
using Orchard.Environment.Descriptor.Models;
|
using Orchard.Environment.Descriptor.Models;
|
||||||
using Orchard.Environment.Extensions;
|
using Orchard.Environment.Extensions;
|
||||||
using Orchard.Environment.Features;
|
using Orchard.Environment.Features;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Reports.Services;
|
using Orchard.Reports.Services;
|
||||||
using Orchard.Security;
|
|
||||||
using Orchard.Themes.Preview;
|
using Orchard.Themes.Preview;
|
||||||
using Orchard.Themes.Services;
|
using Orchard.Themes.Services;
|
||||||
using Orchard.Themes.ViewModels;
|
using Orchard.Themes.ViewModels;
|
||||||
@ -19,35 +16,36 @@ using Orchard.UI.Notify;
|
|||||||
namespace Orchard.Themes.Controllers {
|
namespace Orchard.Themes.Controllers {
|
||||||
[ValidateInput(false)]
|
[ValidateInput(false)]
|
||||||
public class AdminController : Controller {
|
public class AdminController : Controller {
|
||||||
|
private readonly IDataMigrationManager _dataMigrationManager;
|
||||||
|
private readonly IFeatureManager _featureManager;
|
||||||
private readonly ISiteThemeService _siteThemeService;
|
private readonly ISiteThemeService _siteThemeService;
|
||||||
private readonly IPreviewTheme _previewTheme;
|
|
||||||
private readonly IExtensionManager _extensionManager;
|
private readonly IExtensionManager _extensionManager;
|
||||||
private readonly ShellDescriptor _shellDescriptor;
|
private readonly ShellDescriptor _shellDescriptor;
|
||||||
|
private readonly IPreviewTheme _previewTheme;
|
||||||
private readonly IThemeService _themeService;
|
private readonly IThemeService _themeService;
|
||||||
private readonly IDataMigrationManager _dataMigrationManager;
|
|
||||||
private readonly IReportsCoordinator _reportsCoordinator;
|
private readonly IReportsCoordinator _reportsCoordinator;
|
||||||
|
|
||||||
public AdminController(
|
public AdminController(
|
||||||
IDataMigrationManager dataMigraitonManager,
|
|
||||||
IReportsCoordinator reportsCoordinator,
|
|
||||||
IOrchardServices services,
|
IOrchardServices services,
|
||||||
IThemeManager themeManager,
|
IDataMigrationManager dataMigraitonManager,
|
||||||
IFeatureManager featureManager,
|
IFeatureManager featureManager,
|
||||||
ISiteThemeService siteThemeService,
|
ISiteThemeService siteThemeService,
|
||||||
IPreviewTheme previewTheme,
|
|
||||||
IAuthorizer authorizer,
|
|
||||||
INotifier notifier,
|
|
||||||
IExtensionManager extensionManager,
|
IExtensionManager extensionManager,
|
||||||
ShellDescriptor shellDescriptor,
|
ShellDescriptor shellDescriptor,
|
||||||
IThemeService themeService) {
|
IPreviewTheme previewTheme,
|
||||||
|
IThemeService themeService,
|
||||||
|
IReportsCoordinator reportsCoordinator) {
|
||||||
Services = services;
|
Services = services;
|
||||||
|
|
||||||
_dataMigrationManager = dataMigraitonManager;
|
_dataMigrationManager = dataMigraitonManager;
|
||||||
_reportsCoordinator = reportsCoordinator;
|
|
||||||
_siteThemeService = siteThemeService;
|
_siteThemeService = siteThemeService;
|
||||||
_previewTheme = previewTheme;
|
|
||||||
_extensionManager = extensionManager;
|
_extensionManager = extensionManager;
|
||||||
_shellDescriptor = shellDescriptor;
|
_shellDescriptor = shellDescriptor;
|
||||||
|
_featureManager = featureManager;
|
||||||
|
_previewTheme = previewTheme;
|
||||||
_themeService = themeService;
|
_themeService = themeService;
|
||||||
|
_reportsCoordinator = reportsCoordinator;
|
||||||
|
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,8 +66,9 @@ namespace Orchard.Themes.Controllers {
|
|||||||
})
|
})
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
var model = new ThemesIndexViewModel { CurrentTheme = currentTheme, Themes = themes };
|
return View(new ThemesIndexViewModel {
|
||||||
return View(model);
|
CurrentTheme = currentTheme, Themes = themes,
|
||||||
|
InstallThemes = _featureManager.GetEnabledFeatures().FirstOrDefault(f => f.Id == "Gallery") != null });
|
||||||
}
|
}
|
||||||
catch (Exception exception) {
|
catch (Exception exception) {
|
||||||
Services.Notifier.Error(T("Listing themes failed: " + exception.Message));
|
Services.Notifier.Error(T("Listing themes failed: " + exception.Message));
|
||||||
|
@ -71,7 +71,6 @@
|
|||||||
<Content Include="Content\orchard.ico" />
|
<Content Include="Content\orchard.ico" />
|
||||||
<Content Include="Styles\orchard-themes-admin.css" />
|
<Content Include="Styles\orchard-themes-admin.css" />
|
||||||
<Content Include="Views\Admin\Index.cshtml" />
|
<Content Include="Views\Admin\Index.cshtml" />
|
||||||
<Content Include="Views\Admin\Install.cshtml" />
|
|
||||||
<Content Include="Views\ThemePreview.cshtml" />
|
<Content Include="Views\ThemePreview.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -3,6 +3,7 @@ using Orchard.Environment.Extensions.Models;
|
|||||||
|
|
||||||
namespace Orchard.Themes.ViewModels {
|
namespace Orchard.Themes.ViewModels {
|
||||||
public class ThemesIndexViewModel {
|
public class ThemesIndexViewModel {
|
||||||
|
public bool InstallThemes { get; set; }
|
||||||
public ExtensionDescriptor CurrentTheme { get; set; }
|
public ExtensionDescriptor CurrentTheme { get; set; }
|
||||||
public IEnumerable<ThemeEntry> Themes { get; set; }
|
public IEnumerable<ThemeEntry> Themes { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,9 @@
|
|||||||
@Model.CurrentTheme.WebSite
|
@Model.CurrentTheme.WebSite
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@Html.ActionLink(T("Install a new Theme").ToString(), "Install", null, new { @class = "button primaryAction" })
|
if (Model.InstallThemes) {
|
||||||
|
@Html.ActionLink(T("Install a new Theme").ToString(), "Install", null, new { @class = "button primaryAction" })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<h2>@T("Available Themes")</h2>
|
<h2>@T("Available Themes")</h2>
|
||||||
|
Loading…
Reference in New Issue
Block a user