Some work on the MT UI

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-05-09 13:31:44 -07:00
parent 7248fb6fd7
commit 339bcc77ad
10 changed files with 57 additions and 34 deletions

View File

@@ -5,7 +5,7 @@ namespace Orchard.MultiTenancy {
public string MenuName { get { return "admin"; } }
public void GetNavigation(NavigationBuilder builder) {
builder.Add("MultiTenancy", "2",
builder.Add("Tenants", "22",
menu => menu
.Add("Manage Tenants", "1.0", item => item.Action("Index", "Admin", new { area = "Orchard.MultiTenancy" }).Permission(Permissions.ManageTenants))
.Add("Add New Tenant", "1.1", item => item.Action("Add", "Admin", new { area = "Orchard.MultiTenancy" }).Permission(Permissions.ManageTenants)));

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -71,8 +71,14 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Admin\images\disabled.gif" />
<Content Include="Content\Admin\images\enabled.gif" />
<Content Include="Module.txt" />
<Content Include="Views\Admin\Add.ascx" />
<Content Include="Views\Admin\DisplayTemplates\ActionsForUninitialized.ascx" />
<Content Include="Views\Admin\DisplayTemplates\ActionsForDisabled.ascx" />
<Content Include="Views\Admin\DisplayTemplates\ActionsForInvalid.ascx" />
<Content Include="Views\Admin\DisplayTemplates\ActionsForRunning.ascx" />
<Content Include="Views\Admin\Index.ascx" />
<Content Include="Web.config" />
<Content Include="Views\Web.config" />

View File

@@ -0,0 +1,3 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ShellSettings>" %>
<%@ Import Namespace="Orchard.Environment.Configuration" %>
<%=Html.ActionLink(T("Resume").ToString(), "_enable", new {tenantName = Model.Name, area = "Orchard.MultiTenancy"}) %>

View File

@@ -0,0 +1,3 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ShellSettings>" %>
<%@ Import Namespace="Orchard.Environment.Configuration" %>
<%=Html.ActionLink(T("Make Valid*").ToString(), "_setup", new {tenantName = Model.Name, area = "Orchard.MultiTenancy"}) %>

View File

@@ -0,0 +1,3 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ShellSettings>" %>
<%@ Import Namespace="Orchard.Environment.Configuration" %>
<%=Html.ActionLink(T("Suspend").ToString(), "_disable", new {tenantName = Model.Name, area = "Orchard.MultiTenancy"}) %>

View File

@@ -0,0 +1,3 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ShellSettings>" %>
<%@ Import Namespace="Orchard.Environment.Configuration" %>
<%=Html.ActionLink(T("Setup").ToString(), "_setup", new {tenantName = Model.Name, area = "Orchard.MultiTenancy"}) %>

View File

@@ -1,39 +1,40 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<TenantsIndexViewModel>" %>
<%@ Import Namespace="Orchard.Environment.Configuration" %>
<%@ Import Namespace="Orchard.Mvc.Html"%>
<%@ Import Namespace="Orchard.MultiTenancy.ViewModels"%>
<h1><%=Html.TitleForPage(T("List of Site's Tenants").ToString())%></h1>
<table class="items">
<colgroup>
<col id="Name" />
<col id="Data Provider" />
<col id="ConnectionString" />
<col id="TablePrefix" />
<col id="RequestUrlHost" />
<col id="RequestUrlPrefix" />
<col id="TenantState" />
</colgroup>
<thead>
<tr>
<td scope="col"><%=_Encoded("Name") %></td>
<td scope="col"><%=_Encoded("Data Provider") %></td>
<td scope="col"><%=_Encoded("ConnectionString") %></td>
<td scope="col"><%=_Encoded("Table Prefix") %></td>
<td scope="col"><%=_Encoded("Request Url Host") %></td>
<td scope="col"><%=_Encoded("Request Url Prefix") %></td>
<td scope="col"><%=_Encoded("State") %></td>
</tr>
</thead>
<tbody><%
<div class="manage"><%=Html.ActionLink(T("Add a Tenant").ToString(), "Add", new {area = "Orchard.MultiTenancy"}, new { @class = "button primaryAction" })%></div>
<ul class="contentItems"><%
foreach (var tenant in Model.TenantSettings) { %>
<tr>
<td><%= tenant.Name %></td>
<td><%= tenant.DataProvider %></td>
<td><%= tenant.DataConnectionString %></td>
<td><%= tenant.DataTablePrefix %></td>
<td><%= tenant.RequestUrlHost %></td>
<td><%= tenant.RequestUrlPrefix %></td>
<td><%= tenant.State %></td>
</tr><%
<li class="<%=tenant.State.CurrentState %>">
<div class="summary">
<div class="properties">
<h3><span class="tenantState"><%
if (tenant.State.CurrentState == TenantState.State.Running) {
//todo: (heskew) need common shared resources (in the theme?) %>
<img class="icon" src="<%=ResolveUrl("~/Modules/Orchard.MultiTenancy/Content/Admin/images/enabled.gif") %>" alt="<%=_Encoded("Running") %>" title="<%=_Encoded("This tenant is currently running") %>" /><%
}
else { %>
<img class="icon" src="<%=ResolveUrl("~/Modules/Orchard.MultiTenancy/Content/Admin/images/disabled.gif") %>" alt="<%=_Encoded("Not Running") %>" title="<%=_Encoded("This tenant is not running for some reason") %>" /><%
} %></span>
<span class="tenantName"><%=Html.Encode(tenant.Name) %></span><%
if (!string.IsNullOrEmpty(tenant.RequestUrlHost)) {
%><span class="tenantHost"> - <%=Html.Link(tenant.RequestUrlHost, tenant.RequestUrlHost)%></span><%
} %>
</h3>
</div>
<div class="related"><%
if (!string.Equals(tenant.Name, "default", StringComparison.OrdinalIgnoreCase)) { //todo: (heskew) base this off the view model so logic on what can be removed and have its state changed stays in the controller
var t = tenant; %>
<%=Html.DisplayFor(m => t, string.Format("ActionsFor{0}", tenant.State.CurrentState)) %><%=_Encoded(" | ")%><%
} %>
<%=Html.ActionLink(T("Edit").ToString(), "edit", new {tenantName = tenant.Name, area = "Orchard.MultiTenancy"}) %><%
if (!string.Equals(tenant.Name, "default", StringComparison.OrdinalIgnoreCase)) { //todo: (heskew) base this off the view model so logic on what can be removed and have its state changed stays in the controller
%><%=_Encoded(" | ")%>
<%=Html.ActionLink(T("Remove").ToString(), "delete", new {tenantName = tenant.Name, area = "Orchard.MultiTenancy"}) %><%
} %>
</div>
</div>
</li><%
} %>
</tbody>
</table>
</ul>

View File

@@ -767,6 +767,7 @@ table.items, textarea, input.text, input.text-box,
text-align:right;
}
.contentItems {
clear:both;
padding:0;
}
.properties {
@@ -798,6 +799,9 @@ table.items, textarea, input.text, input.text-box,
.icon {
margin:0 .2em -.2em .2em;
}
h3 .icon {
margin-bottom:-.05em;
}
.linkButton {
border:none;
padding:0;