2010-04-28 11:47:29 -07:00
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<FeaturesViewModel>" %>
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" %><%
Html.RegisterStyle("admin.css"); %>
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-17 14:38:26 -07:00
<ul class="features"><%
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())
categoryClassName += " last"; %>
<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...
var featureId = string.Format("{0} feature", feature.Descriptor.Name).HtmlClassify();
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-17 14:38:26 -07:00
<h3><%=Html.Encode(feature.Descriptor.Name) %></h3><%
if (feature.Descriptor.Dependencies != null) { %>
<div class="dependencies">
<h4><%=_Encoded("Depends on:")%></h4>
<%=Html.UnorderedList(
feature.Descriptor.Dependencies.OrderBy(s => s),
(s, i) => Html.Link(s, string.Format("#{0}", string.Format("{0} feature", s).HtmlClassify())),
"",
"dependency",
"") %>
</div><%
} %>
2010-05-14 15:52:22 -07:00
</div>
2010-05-17 14:38:26 -07:00
<div class="actions"><%
2010-05-14 15:52:22 -07:00
if (feature.IsEnabled) {
2010-05-18 10:04:14 -07:00
using (Html.BeginFormAntiForgeryPost(string.Format("{0}", Url.Action("Disable", new { area = "Orchard.Modules" })), FormMethod.Post, new {@class = "inline link"})) { %>
2010-05-17 14:38:26 -07:00
<%=Html.Hidden("id", feature.Descriptor.Name, new { id = "" })%>
2010-05-14 15:52:22 -07:00
<button type="submit"><%=_Encoded("Disable") %></button><%
}
} else {
2010-05-18 10:04:14 -07:00
using (Html.BeginFormAntiForgeryPost(string.Format("{0}", Url.Action("Enable", new { area = "Orchard.Modules" })), FormMethod.Post, new {@class = "inline link"})) { %>
2010-05-17 14:38:26 -07:00
<%=Html.Hidden("id", feature.Descriptor.Name, new { id = "" })%>
2010-05-14 15:52:22 -07:00
<button type="submit"><%=_Encoded("Enable") %></button><%
}
} %>
</div>
2010-05-19 00:00:56 -07:00
<div class="cathedral"><%
//temporary forceful feature actions
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)%>
<button type="submit"><%=_Encoded("π")%></button><%
}
} 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)%>
<button type="submit"><%=_Encoded("π")%></button><%
}
} %>
</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
} %>