Adding javascript to the install module details page. Filtering default extension feature out.

--HG--
branch : dev
This commit is contained in:
Andre Rodrigues
2011-02-25 12:07:31 -08:00
parent d991e12f48
commit 154526b942
7 changed files with 62 additions and 5 deletions

View File

@@ -50,7 +50,7 @@
}
var dependencies = (from d in feature.Descriptor.Dependencies
select (from f in Model.Features where f.Descriptor.Id == d select f).SingleOrDefault()).Where(f => f != null).OrderBy(f => f.Descriptor.Name);
select (from f in Model.Features where f.Descriptor.Id == d select f).SingleOrDefault()).Where(f => f != null).OrderBy(f => f.Descriptor.Name);
var missingDependencies = feature.Descriptor.Dependencies
.Where(d => !Model.Features.Any(f => f.Descriptor.Id == d));
showActions = categoryName.ToString() != "Core" && missingDependencies.Count() == 0;

View File

@@ -249,6 +249,8 @@ namespace Orchard.Packaging.Controllers {
ExtensionDescriptor extensionDescriptor = _packageManager.GetExtensionDescriptor(package);
List<PackagingInstallFeatureViewModel> features = extensionDescriptor.Features
.Where(featureDescriptor => !DefaultExtensionTypes.IsTheme(featureDescriptor.Extension.ExtensionType) &&
!featureDescriptor.Id.Equals(featureDescriptor.Extension.Id))
.Select(featureDescriptor => new PackagingInstallFeatureViewModel {
Enable = true, // by default all features are enabled
FeatureDescriptor = featureDescriptor

View File

@@ -106,6 +106,7 @@
<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>
@@ -164,6 +165,11 @@
<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

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

View File

@@ -0,0 +1,21 @@
<?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

@@ -0,0 +1,24 @@
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

@@ -5,6 +5,7 @@
@{
Style.Require("PackagingAdmin");
Script.Require("PackagingModulesAdmin").AtFoot();
Layout.Title = T("{0} - {1} Details", Model.ExtensionDescriptor.Name, Model.ExtensionDescriptor.Version).ToString();
}
@@ -13,16 +14,16 @@
<h3>@T("Which type of installation do you want?").ToString()</h3>
<fieldset>
@Html.RadioButton("PackagingInstallMode", "All", (Model.PackagingInstallMode == PackagingInstallMode.All), new { id = "PackagingInstallMode_All" })
@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>
if (Model.Features.Count > 0) {
<fieldset>
@Html.RadioButton("PackagingInstallMode", "Custom", (Model.PackagingInstallMode == PackagingInstallMode.Custom), new { id = "PackagingInstallMode_Custom" })
@Html.RadioButton("PackagingInstallMode", "Custom", (Model.PackagingInstallMode == PackagingInstallMode.Custom), new { id = "PackagingInstallMode_Custom", onClick = "checkCustom();" })
<label for="Features_Custom" class="forcheckbox">@T("Custom")</label>
<div class="custom_details">
<div class="custom_details" id="custom_features">
<legend>@T("Pick the features you want enabled during install").ToString()</legend>
@{ var index = 0; }
@@ -32,6 +33,7 @@
@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>