2010-04-28 11:47:29 -07:00
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<FeaturesViewModel>" %>
2010-05-19 14:09:13 -07:00
<%@ Import Namespace="Orchard.Modules.Extensions" %>
2010-04-27 11:24:06 -07:00
<%@ Import Namespace="Orchard.Mvc.Html"%>
<%@ Import Namespace="Orchard.Modules.ViewModels"%>
2010-05-17 16:25:21 -07:00
<%@ Import Namespace="Orchard.Utility.Extensions" %><%
2010-05-28 15:17:33 -07:00
Html.RegisterStyle("admin.css");
Html.RegisterStyle("jquery.switchable.css");
Html.RegisterFootScript("jquery.switchable.js"); %>
2010-04-27 11:24:06 -07:00
<h1><%=Html.TitleForPage(T("Manage Features").ToString()) %></h1>
2010-05-14 15:52:22 -07:00
<% if (Model.Features.Count() > 0) { %>
2010-05-28 15:17:33 -07:00
<ul class="features summary-view switchable"><%
2010-05-14 15:52:22 -07:00
var featureGroups = Model.Features.OrderBy(f => f.Descriptor.Category).GroupBy(f => f.Descriptor.Category);
2010-05-17 14:38:26 -07:00
foreach (var featureGroup in featureGroups) {
var categoryName = featureGroup.First().Descriptor.Category ?? T("Uncategorized");
var categoryClassName = string.Format("category {0}", Html.Encode(categoryName.ToString().HtmlClassify()));
if (featureGroup == featureGroups.First())
categoryClassName += " first";
if (featureGroup == featureGroups.Last())
2010-05-19 10:02:47 -07:00
categoryClassName += " last";
//temporarily "disable" actions on core features
var showActions = categoryName.ToString() != "Core"; %>
2010-05-17 14:38:26 -07:00
<li class="<%=categoryClassName %>">
<h2><%=Html.Encode(categoryName) %></h2>
2010-05-14 15:52:22 -07:00
<ul><%
var features = featureGroup.OrderBy(f => f.Descriptor.Name);
2010-05-17 14:38:26 -07:00
foreach (var feature in features) {
//hmmm...I feel like I've done this before...
2010-05-19 14:09:13 -07:00
var featureId = feature.Descriptor.Name.AsFeatureId(n => T(n));
2010-05-18 00:04:41 -07:00
var featureState = feature.IsEnabled ? "enabled" : "disabled";
var featureClassName = string.Format("feature {0}", featureState);
2010-05-17 14:38:26 -07:00
if (feature == features.First())
featureClassName += " first";
if (feature == features.Last())
featureClassName += " last"; %>
2010-05-18 00:04:41 -07:00
<li class="<%=featureClassName %>" id="<%=Html.AttributeEncode(featureId) %>" title="<%=T("{0} is {1}", Html.AttributeEncode(feature.Descriptor.Name), featureState) %>">
2010-05-14 15:52:22 -07:00
<div class="summary">
<div class="properties">
2010-05-28 15:17:33 -07:00
<h3><%:feature.Descriptor.Name %></h3>
<p class="description"><%:feature.Descriptor.Description %></p><%
2010-05-17 14:38:26 -07:00
if (feature.Descriptor.Dependencies != null) { %>
<div class="dependencies">
<h4><%=_Encoded("Depends on:")%></h4>
<%=Html.UnorderedList(
feature.Descriptor.Dependencies.OrderBy(s => s),
2010-05-19 14:09:13 -07:00
(s, i) => Html.Link(s, string.Format("#{0}", s.AsFeatureId(n => T(n)))),
2010-05-17 14:38:26 -07:00
"",
"dependency",
"") %>
</div><%
} %>
2010-05-19 10:02:47 -07:00
</div><%
if (showActions) { %>
2010-05-17 14:38:26 -07:00
<div class="actions"><%
2010-05-19 00:00:56 -07:00
if (feature.IsEnabled) {
using (Html.BeginFormAntiForgeryPost(string.Format("{0}", Url.Action("Disable", new { area = "Orchard.Modules" })), FormMethod.Post, new {@class = "inline link"})) { %>
<%=Html.Hidden("id", feature.Descriptor.Name, new { id = "" })%>
<%=Html.Hidden("force", true)%>
2010-05-19 14:09:13 -07:00
<button type="submit"><%=_Encoded("Disable") %></button><%
2010-05-19 00:00:56 -07:00
}
} else {
using (Html.BeginFormAntiForgeryPost(string.Format("{0}", Url.Action("Enable", new { area = "Orchard.Modules" })), FormMethod.Post, new {@class = "inline link"})) { %>
<%=Html.Hidden("id", feature.Descriptor.Name, new { id = "" })%>
<%=Html.Hidden("force", true)%>
2010-05-19 14:09:13 -07:00
<button type="submit"><%=_Encoded("Enable") %></button><%
2010-05-19 00:00:56 -07:00
}
} %>
2010-05-19 10:02:47 -07:00
</div><%
} %>
2010-05-14 15:52:22 -07:00
</div>
2010-04-27 11:24:06 -07:00
</li><%
} %>
2010-05-14 15:52:22 -07:00
</ul>
</li><%
} %>
</ul><%
2010-04-28 11:47:29 -07:00
} %>