Simplifying detailed installation page given that recipes is not yet present for modules.

--HG--
branch : dev
This commit is contained in:
Andre Rodrigues
2011-02-25 14:26:13 -08:00
parent 9d65d9b3be
commit 43069ac30b
8 changed files with 16 additions and 96 deletions

View File

@@ -273,19 +273,10 @@ namespace Orchard.Packaging.Controllers {
return HttpNotFound();
}
PackageInfo packageInfo = InstallPackage(packageId, version, source);
if (packagingInstallViewModel.PackagingInstallMode == PackagingInstallMode.Custom) {
// Enable selected features
_featureManager.EnableFeatures(packagingInstallViewModel.Features
.Select(feature => feature.FeatureDescriptor.Id));
} else {
IEnumerable<FeatureDescriptor> features = _featureManager.GetAvailableFeatures()
.Where(feature => feature.Extension.Id.Equals(packageInfo.ExtensionName) &&
feature.Extension.Version.Equals(packageInfo.ExtensionVersion));
_featureManager.EnableFeatures(features
.Select(feature => feature.Id));
}
InstallPackage(packageId, version, source);
// Enable selected features
_featureManager.EnableFeatures(packagingInstallViewModel.Features
.Select(feature => feature.FeatureDescriptor.Id));
return RedirectToAction(redirectTo == "Themes" ? "Themes" : "Modules");
}

View File

@@ -20,7 +20,7 @@ namespace Orchard.Packaging {
public void Installed(Feature feature) {
if (feature.Descriptor.Id == "Gallery") {
_packagingSourceManager.AddSource("Orchard Extensions Gallery", "http://orchardproject.net/gallery/server/FeedService.svc");
_packagingSourceManager.AddSource("Orchard Gallery", "http://orchardproject.net/gallery/server/FeedService.svc");
}
}

View File

@@ -106,7 +106,6 @@
<Content Include="Content\Images\moduleDefaultIcon.png" />
<Content Include="Content\Images\stars.png" />
<Content Include="Module.txt" />
<Content Include="Scripts\orchard-packaging-admin.js" />
<Content Include="Service References\GalleryServer\Reference.datasvcmap">
<Generator>DataServiceClientGenerator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
@@ -165,11 +164,6 @@
<ItemGroup>
<Content Include="Views\Gallery\InstallModule.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Scripts\Web.config">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.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.

View File

@@ -6,7 +6,6 @@ namespace Orchard.Packaging {
public class ResourceManifest : IResourceManifestProvider {
public void BuildManifests(ResourceManifestBuilder builder) {
UI.Resources.ResourceManifest resourceManifest = builder.Add();
resourceManifest.DefineScript("PackagingModulesAdmin").SetUrl("orchard-packaging-admin.js");
resourceManifest.DefineStyle("PackagingAdmin").SetUrl("orchard-packaging-admin.css");
}
}

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web>
<httpHandlers>
<!-- iis6 - for any request in this location, return via managed static file handler -->
<add path="*" verb="*" type="System.Web.StaticFileHandler" />
</httpHandlers>
</system.web>
<system.webServer>
<handlers accessPolicy="Script,Read">
<!--
iis7 - for any request to a file exists on disk, return it via native http module.
accessPolicy 'Script' is to allow for a managed 404 page.
-->
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
</handlers>
</system.webServer>
</configuration>

View File

@@ -1,24 +0,0 @@
function checkCustom() {
setDisabled(document.getElementById("custom_features"), false);
}
function checkAll() {
setDisabled(document.getElementById("custom_features"), true);
}
function setDisabled(el, state) {
try {
el.disabled = state;
}
catch (E) { }
if (el.childNodes && el.childNodes.length > 0) {
for (var x = 0; x < el.childNodes.length; x++) {
setDisabled(el.childNodes[x]);
}
}
}
(function ($) {
$(checkAll)
})(jQuery);

View File

@@ -2,15 +2,9 @@
using Orchard.Environment.Extensions.Models;
namespace Orchard.Packaging.ViewModels {
public enum PackagingInstallMode {
All,
Custom
}
public class PackagingInstallViewModel {
public List<PackagingInstallFeatureViewModel> Features { get; set; }
public ExtensionDescriptor ExtensionDescriptor { get; set; }
public PackagingInstallMode PackagingInstallMode { get; set; }
}
public class PackagingInstallFeatureViewModel {

View File

@@ -5,40 +5,27 @@
@{
Style.Require("PackagingAdmin");
Script.Require("PackagingModulesAdmin").AtFoot();
Layout.Title = T("{0} - {1} Details", Model.ExtensionDescriptor.Name, Model.ExtensionDescriptor.Version).ToString();
}
@using (Html.BeginFormAntiForgeryPost(Url.Action("InstallModule", "Gallery", new { packageId = Request.QueryString["packageId"], version = Request.QueryString["version"], sourceId = Request.QueryString["sourceId"], redirectTo = Request.QueryString["redirectTo"] }))) {
<h3>@T("Which type of installation do you want?").ToString()</h3>
<fieldset>
@Html.RadioButton("PackagingInstallMode", "All", (Model.PackagingInstallMode == PackagingInstallMode.All), new { id = "PackagingInstallMode_All", onClick = "checkAll();" })
<label for="Features_All" class="forcheckbox">@T("Install and enable all features")</label>
</fieldset>
<h3>@T("Pick the features you want enabled during install").ToString()</h3>
if (Model.Features.Count > 0) {
<fieldset>
@Html.RadioButton("PackagingInstallMode", "Custom", (Model.PackagingInstallMode == PackagingInstallMode.Custom), new { id = "PackagingInstallMode_Custom", onClick = "checkCustom();" })
<label for="Features_Custom" class="forcheckbox">@T("Custom")</label>
@{ var index = 0; }
@foreach (PackagingInstallFeatureViewModel feature in Model.Features) {
<div>
@Html.HiddenFor(m => m.Features[index].FeatureDescriptor.Id)
@Html.HiddenFor(m => m.Features[index].FeatureDescriptor.Name)
<div class="custom_details" id="custom_features">
<legend>@T("Pick the features you want enabled during install").ToString()</legend>
@Html.EditorFor(m => m.Features[index].Enable)
@{ var index = 0; }
@foreach (PackagingInstallFeatureViewModel feature in Model.Features) {
<div>
@Html.HiddenFor(m => m.Features[index].FeatureDescriptor.Id)
@Html.HiddenFor(m => m.Features[index].FeatureDescriptor.Name)
@Html.EditorFor(m => m.Features[index].Enable)
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.Features[index].Enable)">@feature.FeatureDescriptor.Name</label>
@{ index++; }
</div>
}
</div>
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.Features[index].Enable)">@feature.FeatureDescriptor.Name</label>
@{ index++; }
</div>
}
</fieldset>
}