mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-11-28 17:32:44 +08:00
#17435: Notification message for running a migration should include a link to the appropriate feature box in the Features page
--HG-- branch : 1.x
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Orchard.Data.Migration;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Modules.Extensions;
|
||||
using Orchard.UI.Admin.Notification;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.Modules.Data.Migration {
|
||||
[OrchardSuppressDependency("Orchard.Data.Migration.DataMigrationNotificationProvider")]
|
||||
public class DataMigrationNotificationProvider : INotificationProvider {
|
||||
private readonly IDataMigrationManager _dataMigrationManager;
|
||||
private readonly WorkContext _workContext;
|
||||
|
||||
public DataMigrationNotificationProvider(IDataMigrationManager dataMigrationManager, WorkContext workContext) {
|
||||
_dataMigrationManager = dataMigrationManager;
|
||||
_workContext = workContext;
|
||||
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public IEnumerable<NotifyEntry> GetNotifications() {
|
||||
var features = _dataMigrationManager.GetFeaturesThatNeedUpdate();
|
||||
|
||||
if (features.Any()) {
|
||||
UrlHelper urlHelper = new UrlHelper(_workContext.HttpContext.Request.RequestContext);
|
||||
|
||||
yield return new NotifyEntry { Message = T("Some features need to be upgraded: {0}",
|
||||
T(string.Join(", ", features
|
||||
.Select(feature =>
|
||||
string.Format("<a href=\"{0}#{1}\">{2}</a>", urlHelper.Action("Features", "Admin", new RouteValueDictionary { { "area", "Orchard.Modules" } }), feature.AsFeatureId(n => T(n)), feature))))),
|
||||
Type = NotifyType.Warning };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Data\Migration\DataMigrationNotificationProvider.cs" />
|
||||
<Compile Include="Events\IExtensionDisplayEventHandler.cs" />
|
||||
<Compile Include="ResourceManifest.cs" />
|
||||
<Compile Include="Commands\FeatureCommands.cs" />
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Policy;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Localization;
|
||||
using Orchard.UI.Admin.Notification;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
Reference in New Issue
Block a user