Disabling upgrade actions if the target modules are not enabled

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2013-07-03 15:06:06 -07:00
parent b774a8b4b9
commit 480f56893e
5 changed files with 16 additions and 4 deletions

View File

@@ -34,9 +34,13 @@ namespace Upgrade.Controllers {
public ILogger Logger { get; set; }
public ActionResult Index() {
if(_featureManager.GetEnabledFeatures().All(x => x.Id != "Orchard.MediaLibrary")) {
ViewBag.CanMigrate = false;
if (_featureManager.GetEnabledFeatures().All(x => x.Id != "Orchard.MediaLibrary")) {
_orchardServices.Notifier.Warning(T("You need to enable Orchard.MediaLibrary in order to convert current media files to the Media Library."));
}
else {
ViewBag.CanMigrate = true;
}
return View();
}

View File

@@ -31,6 +31,8 @@ namespace Upgrade.Controllers {
public ILogger Logger { get; set; }
public ActionResult Index() {
ViewBag.CanMigrate = false;
if(_featureManager.GetEnabledFeatures().All(x => x.Id != "Orchard.Taxonomies")) {
_orchardServices.Notifier.Warning(T("You need to enable Orchard.Taxonomies in order to migrate Contrib.Taxonomies to Orchard.Taxonomies."));
}
@@ -43,6 +45,8 @@ namespace Upgrade.Controllers {
if (flag) {
_orchardServices.Notifier.Warning(T("This migration step might have been done already."));
}
ViewBag.CanMigrate = true;
}
return View();

View File

@@ -9,4 +9,4 @@ Category: Developer
Features:
Upgrade:
Description: Provides actions for upgrading Orchard instances
Dependencies: Orchard.Autoroute, Title, Navigation, Orchard.MediaLibrary
Dependencies: Orchard.Autoroute, Title, Navigation

View File

@@ -9,6 +9,8 @@
<span class="hint">@T("This migration step will create and organize new Media Content Items based on the media files in your ~/Media folder.")</span>
</fieldset>
<fieldset>
<button type="submit">@T("Migrate")</button>
@if (ViewBag.CanMigrate) {
<button type="submit">@T("Migrate")</button>
}
</fieldset>
}

View File

@@ -9,6 +9,8 @@
<span class="hint">@T("This migration step will convert the Contrib.Taxonomies content items to Orchard.Taxonomies.")</span>
</fieldset>
<fieldset>
<button type="submit">@T("Migrate")</button>
@if (ViewBag.CanMigrate) {
<button type="submit">@T("Migrate")</button>
}
</fieldset>
}