Migrating Orchard.Roles

--HG--
branch : theming
This commit is contained in:
Sebastien Ros
2010-09-10 14:26:04 -07:00
parent dd517ccaf4
commit 0d3be13299
9 changed files with 161 additions and 160 deletions

View File

@@ -90,10 +90,10 @@
</ItemGroup>
<ItemGroup>
<Content Include="Module.txt" />
<Content Include="Views\Admin\Create.aspx" />
<Content Include="Views\Admin\Edit.aspx" />
<Content Include="Views\Admin\Index.aspx" />
<Content Include="Views\EditorTemplates\Parts\Roles.UserRoles.ascx" />
<None Include="Views\Admin\Create.cshtml" />
<None Include="Views\Admin\Edit.cshtml" />
<None Include="Views\Admin\Index.cshtml" />
<None Include="Views\EditorTemplates\Parts\Roles.UserRoles.cshtml" />
<Content Include="Web.config" />
<Content Include="Content\Site.css" />
<Content Include="Views\Web.config" />

View File

@@ -1,40 +0,0 @@
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<RoleCreateViewModel>" %>
<%@ Import Namespace="Orchard.Roles.ViewModels"%>
<h1><%: Html.TitleForPage(T("Add Role").ToString()) %></h1>
<% using (Html.BeginFormAntiForgeryPost()) { %>
<%: Html.ValidationSummary()%>
<fieldset>
<legend><%: T("Information") %></legend>
<label for="pageTitle"><%: T("Role Name:") %></label>
<input id="Name" class="text" name="Name" type="text" value="<%: Model.Name %>" />
</fieldset>
<fieldset>
<legend><%: T("Permissions") %></legend>
<% foreach (var featureName in Model.FeaturePermissions.Keys) { %>
<fieldset>
<legend><%: T("{0} Module", featureName) %></legend>
<table class="items">
<colgroup>
<col id="Permission" />
<col id="Allow" />
</colgroup>
<thead>
<tr>
<th scope="col"><%: T("Permission") %></th>
<th scope="col"><%: T("Allow") %></th>
</tr>
</thead>
<% foreach (var permission in Model.FeaturePermissions[featureName]) { %>
<tr>
<td><%: permission.Description %></td>
<td style="width:60px;/* todo: (heskew) make not inline :( */"><input type="checkbox" value="true" name="<%: T("Checkbox.{0}", permission.Name) %>"/></td>
</tr>
<% } %>
</table>
</fieldset>
<% } %>
</fieldset>
<fieldset>
<input type="submit" class="button primaryAction" value="<%: T("Save") %>" />
</fieldset>
<% } %>

View File

@@ -0,0 +1,40 @@
@model RoleCreateViewModel
@using Orchard.Roles.ViewModels
<h1>@Html.TitleForPage(T("Add Role").ToString())</h1>
@using (Html.BeginFormAntiForgeryPost()) {
Html.ValidationSummary();
<fieldset>
<legend>@T("Information")</legend>
<label for="pageTitle">@T("Role Name:")</label>
<input id="Name" class="text" name="Name" type="text" value="@Model.Name" />
</fieldset>
<fieldset>
<legend>@T("Permissions")</legend>
@foreach (var featureName in Model.FeaturePermissions.Keys) {
<fieldset>
<legend>@T("{0} Module", featureName)</legend>
<table class="items">
<colgroup>
<col id="Permission" />
<col id="Allow" />
</colgroup>
<thead>
<tr>
<th scope="col">@T("Permission")</th>
<th scope="col">@T("Allow")</th>
</tr>
</thead>
@foreach (var permission in Model.FeaturePermissions[featureName]) {
<tr>
<td>@permission.Description</td>
<td style="width:60px;"><input type="checkbox" value="true" name="@T("Checkbox.{0}", permission.Name)"/></td>
</tr>
}
</table>
</fieldset>
}
</fieldset>
<fieldset>
<input type="submit" class="button primaryAction" value="@T("Save")" />
</fieldset>
}

View File

@@ -1,56 +0,0 @@
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<RoleEditViewModel>" %>
<%@ Import Namespace="Orchard.Roles.ViewModels"%>
<h1><%: Html.TitleForPage(T("Edit Role").ToString()) %></h1>
<% using(Html.BeginFormAntiForgeryPost()) { %>
<%: Html.ValidationSummary() %>
<fieldset>
<legend><%: T("Information") %></legend>
<label for="pageTitle"><%: T("Role Name:") %></label>
<input id="Name" class="text" name="Name" type="text" value="<%: Model.Name %>" />
<input type="hidden" value="<%=Model.Id %>" name="Id" />
</fieldset>
<fieldset>
<legend><%: T("Permissions") %></legend>
<% foreach (var featureName in Model.FeaturePermissions.Keys) { %>
<fieldset>
<legend><%: T("{0} Feature", featureName) %></legend>
<table class="items">
<colgroup>
<col id="Col1" />
<col id="Col2" />
</colgroup>
<thead>
<tr>
<th scope="col"><%: T("Permission") %></th>
<th scope="col"><%: T("Allow") %></th>
<th scope="col"><%: T("Effective") %></th>
</tr>
</thead>
<% foreach (var permission in Model.FeaturePermissions[featureName]) { %>
<tr>
<td><%: permission.Description %></td>
<td style="width:60px;/* todo: (heskew) make not inline :(">
<% if (Model.CurrentPermissions.Contains(permission.Name)) { %>
<input type="checkbox" value="true" name="<%: T("Checkbox.{0}", permission.Name) %>" checked="checked"/>
<% } else {%>
<input type="checkbox" value="true" name="<%: T("Checkbox.{0}", permission.Name) %>"/>
<% }%>
</td>
<td style="width:60px;/* todo: (heskew) make not inline :(">
<% if (Model.EffectivePermissions.Contains(permission.Name)) { %>
<input type="checkbox" disabled="disabled" name="<%: T("Effective.{0}", permission.Name) %>" checked="checked"/>
<% } else {%>
<input type="checkbox" disabled="disabled" name="<%: T("Effective.{0}", permission.Name) %>"/>
<% }%>
</td>
</tr>
<% } %>
</table>
</fieldset>
<% } %>
</fieldset>
<fieldset>
<input type="submit" class="button primaryAction" name="submit.Save" value="<%: T("Save") %>" />
<input type="submit" class="button" name="submit.Delete" value="<%: T("Remove") %>" />
</fieldset>
<% } %>

View File

@@ -0,0 +1,56 @@
@model RoleEditViewModel
@using Orchard.Roles.ViewModels
<h1>@Html.TitleForPage(T("Edit Role").ToString())</h1>
@using(Html.BeginFormAntiForgeryPost()) {
Html.ValidationSummary();
<fieldset>
<legend>@T("Information")</legend>
<label for="pageTitle">@T("Role Name:")</label>
<input id="Name" class="text" name="Name" type="text" value="@Model.Name" />
<input type="hidden" value="@Model.Id" name="Id" />
</fieldset>
<fieldset>
<legend>@T("Permissions")</legend>
@foreach (var featureName in Model.FeaturePermissions.Keys) {
<fieldset>
<legend>@T("{0} Feature", featureName)</legend>
<table class="items">
<colgroup>
<col id="Col1" />
<col id="Col2" />
</colgroup>
<thead>
<tr>
<th scope="col">@T("Permission")</th>
<th scope="col">@T("Allow")</th>
<th scope="col">@T("Effective")</th>
</tr>
</thead>
@foreach (var permission in Model.FeaturePermissions[featureName]) {
<tr>
<td>@permission.Description</td>
<td style="width:60px;">
@if (Model.CurrentPermissions.Contains(permission.Name)) {
<input type="checkbox" value="true" name="@T("Checkbox.{0}", permission.Name)" checked="checked"/>
} else {
<input type="checkbox" value="true" name="@T("Checkbox.{0}", permission.Name)"/>
}
</td>
<td style="width:60px;">
@if (Model.EffectivePermissions.Contains(permission.Name)) {
<input type="checkbox" disabled="disabled" name="@T("Effective.{0}", permission.Name)" checked="checked"/>
} else {
<input type="checkbox" disabled="disabled" name="@T("Effective.{0}", permission.Name)"/>
}
</td>
</tr>
}
</table>
</fieldset>
}
</fieldset>
<fieldset>
<input type="submit" class="button primaryAction" name="submit.Save" value="@T("Save")" />
<input type="submit" class="button" name="submit.Delete" value="@T("Remove")" />
</fieldset>
}

View File

@@ -1,37 +0,0 @@
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<RolesIndexViewModel>" %>
<%@ Import Namespace="Orchard.Roles.ViewModels"%>
<h1><%: Html.TitleForPage(T("Manage Roles").ToString())%></h1>
<% using(Html.BeginFormAntiForgeryPost()) { %>
<%: Html.ValidationSummary() %>
<fieldset class="bulk-actions">
<label for="publishActions"><%: T("Actions:") %></label>
<select id="Select1" name="roleActions">
<option value="1"><%: T("Remove") %></option>
</select>
<input class="button" type="submit" value="<%: T("Apply") %>" />
</fieldset>
<div class="manage"><%: Html.ActionLink(T("Add a role").ToString(), "Create", new { }, new { @class = "button primaryAction" })%></div>
<fieldset>
<table class="items" summary="<%: T("This is a table of the roles currently available for use in your application.") %>">
<colgroup>
<col id="Col1" />
<col id="Col2" />
<col id="Col3" />
</colgroup>
<thead>
<tr>
<th scope="col">&nbsp;&darr;<%-- todo: (heskew) something more appropriate for "this applies to the bulk actions --%></th>
<th scope="col"><%: T("Name")%></th>
<th scope="col"></th>
</tr>
</thead>
<%foreach (var row in Model.Rows) { %>
<tr>
<td><input type="checkbox" value="true" name="<%="Checkbox." + row.Id %>"/></td>
<td><%: row.Name %></td>
<td><%: Html.ActionLink(T("Edit").ToString(), "Edit", new { row.Id })%></td>
</tr>
<%}%>
</table>
</fieldset>
<% } %>

View File

@@ -0,0 +1,40 @@
@model RolesIndexViewModel
@using Orchard.Roles.ViewModels
<h1>@Html.TitleForPage(T("Manage Roles").ToString())</h1>
@using(Html.BeginFormAntiForgeryPost()) {
Html.ValidationSummary();
<fieldset class="bulk-actions">
<label for="publishActions">@T("Actions:")</label>
<select id="Select1" name="roleActions">
<option value="1">@T("Remove")</option>
</select>
<input class="button" type="submit" value="@T("Apply")" />
</fieldset>
<div class="manage">@Html.ActionLink(T("Add a role").ToString(), "Create", new { }, new { @class = "button primaryAction" })</div>
<fieldset>
<table class="items" summary="@T("This is a table of the roles currently available for use in your application.")">
<colgroup>
<col id="Col1" />
<col id="Col2" />
<col id="Col3" />
</colgroup>
<thead>
<tr>
<th scope="col">&nbsp;&darr;</th>
<th scope="col">@T("Name")</th>
<th scope="col"></th>
</tr>
</thead>
@foreach (var row in Model.Rows) {
<tr>
<td><input type="checkbox" value="true" name="@("Checkbox." + row.Id)"/></td>
<td>@row.Name</td>
<td>@Html.ActionLink(T("Edit").ToString(), "Edit", new { row.Id })</td>
</tr>
}
</table>
</fieldset>
}

View File

@@ -1,23 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<UserRolesViewModel>" %>
<%@ Import Namespace="Orchard.Roles.ViewModels"%>
<fieldset>
<legend><%: T("Roles")%></legend>
<% if (Model.Roles.Count > 0) {
var index = 0;
foreach (var entry in Model.Roles) {
if (string.Equals(entry.Name, "Authenticated", StringComparison.OrdinalIgnoreCase) || string.Equals(entry.Name, "Anonymous", StringComparison.OrdinalIgnoreCase)) {
continue;
}%>
<%: Html.Hidden("Roles[" + index + "].RoleId", entry.RoleId)%>
<%: Html.Hidden("Roles[" + index + "].Name", entry.Name)%>
<div>
<%: Html.CheckBox("Roles[" + index + "].Granted", entry.Granted)%>
<label class="forcheckbox" for="<%="Roles[" + index + "]_Granted"%>"><%: entry.Name %></label>
</div>
<%++index;
}
}
else {
%><p><%: T("There are no roles.")%></p><%
} %>
</fieldset>

View File

@@ -0,0 +1,21 @@
@model UserRolesViewModel
@using Orchard.Roles.ViewModels
<fieldset>
<legend>@T("Roles")</legend>
@if (Model.Roles.Count > 0) {
var index = 0;
foreach (var entry in Model.Roles) {
if (string.Equals(entry.Name, "Authenticated", StringComparison.OrdinalIgnoreCase) || string.Equals(entry.Name, "Anonymous", StringComparison.OrdinalIgnoreCase)) {
continue;
}
Html.Hidden("Roles[" + index + "].RoleId", entry.RoleId);
Html.Hidden("Roles[" + index + "].Name", entry.Name);
<div>
@Html.CheckBox("Roles[" + index + "].Granted", entry.Granted)
<label class="forcheckbox" for="@"Roles[" + index + "]_Granted"">@entry.Name</label>
</div>
@++index;
}
}
else {<p>@T("There are no roles.")</p>}
</fieldset>