Adding Orchard.MultiTenancy

--HG--
branch : dev
This commit is contained in:
Louis DeJardin
2010-09-14 18:26:06 -07:00
parent 1ea5c25c1a
commit 2d5adfc0f1
21 changed files with 192 additions and 171 deletions

View File

@@ -1,47 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<TenantAddViewModel>" %>
<%@ Import Namespace="Orchard.Mvc.Html"%>
<%@ Import Namespace="Orchard.MultiTenancy.ViewModels"%>
<h1><%: Html.TitleForPage(T("Add New Tenant").ToString()) %></h1>
<%using (Html.BeginFormAntiForgeryPost()) { %>
<%: Html.ValidationSummary() %>
<fieldset>
<div>
<label for="Name"><%: T("Name") %></label>
<input id="Name" class="textMedium" name="Name" type="text" />
</div>
<div>
<label for="RequestUrlHost"><%: T("Host") %></label>
<input id="RequestUrlHost" class="textMedium" name="RequestUrlHost" type="text" />
<span class="hint"><%: T("Example: If host is 'orchardproject.net', the tenant site URL is 'http://orchardproject.net/'") %></span>
</div>
</fieldset>
<fieldset>
<legend><%: T("Database Setup") %></legend>
<div>
<%: Html.RadioButtonFor(svm => svm.DataProvider, "", new { id = "tenantDatabaseOption" })%>
<label for="tenantDatabaseOption" class="forcheckbox"><%: T("Allow the tenant to set up the database") %></label>
</div>
<div>
<%: Html.RadioButtonFor(svm => svm.DataProvider, "SqlCe", new { id = "builtinDatabaseOption" })%>
<label for="builtinDatabaseOption" class="forcheckbox"><%: T("Use built-in data storage (SQL Server Compact)") %></label>
</div>
<div>
<%: Html.RadioButtonFor(svm => svm.DataProvider, "SqlServer", new { id = "sqlDatabaseOption" })%>
<label for="sqlDatabaseOption" class="forcheckbox"><%: T("Use an existing SQL Server (or SQL Express) database") %></label>
<div class="options">
<span data-controllerid="sqlDatabaseOption">
<label for="DatabaseConnectionString"><%: T("Connection string") %></label>
<%: Html.EditorFor(svm => svm.DatabaseConnectionString)%>
<span class="hint"><%: T("Example:") %> <%: T("Data Source=sqlServerName;Initial Catalog=dbName;Persist Security Info=True;User ID=userName;Password=password") %></span>
</span>
<span data-controllerid="sqlDatabaseOption">
<label for="DatabaseTablePrefix"><%: T("Database Table Prefix") %></label>
<%: Html.EditorFor(svm => svm.DatabaseTablePrefix)%>
</span>
</div>
</div>
</fieldset>
<fieldset>
<input type="submit" class="button primaryAction" value="<%: T("Save") %>" />
</fieldset>
<% } %>

View File

@@ -0,0 +1,46 @@
@model Orchard.MultiTenancy.ViewModels.TenantAddViewModel
<h1>@Html.TitleForPage(T("Add New Tenant").ToString())</h1>
@using (Html.BeginFormAntiForgeryPost()) {
@Html.ValidationSummary()
<fieldset>
<div>
<label for="Name">@T("Name")</label>
<input id="Name" class="textMedium" name="Name" type="text" />
</div>
<div>
<label for="RequestUrlHost">@T("Host")</label>
<input id="RequestUrlHost" class="textMedium" name="RequestUrlHost" type="text" />
<span class="hint">@T("Example: If host is 'orchardproject.net', the tenant site URL is 'http://orchardproject.net/'")</span>
</div>
</fieldset>
<fieldset>
<legend>@T("Database Setup")</legend>
<div>
@Html.RadioButtonFor(svm => svm.DataProvider, "", new { id = "tenantDatabaseOption" })
<label for="tenantDatabaseOption" class="forcheckbox">@T("Allow the tenant to set up the database")</label>
</div>
<div>
@Html.RadioButtonFor(svm => svm.DataProvider, "SqlCe", new { id = "builtinDatabaseOption" })
<label for="builtinDatabaseOption" class="forcheckbox">@T("Use built-in data storage (SQL Server Compact)")</label>
</div>
<div>
@Html.RadioButtonFor(svm => svm.DataProvider, "SqlServer", new { id = "sqlDatabaseOption" })
<label for="sqlDatabaseOption" class="forcheckbox">@T("Use an existing SQL Server (or SQL Express) database")</label>
<div class="options">
<span data-controllerid="sqlDatabaseOption">
<label for="DatabaseConnectionString">@T("Connection string")</label>
@Html.EditorFor(svm => svm.DatabaseConnectionString)
<span class="hint">@T("Example:") @T("Data Source=sqlServerName;Initial Catalog=dbName;Persist Security Info=True;User ID=userName;Password=password")</span>
</span>
<span data-controllerid="sqlDatabaseOption">
<label for="DatabaseTablePrefix">@T("Database Table Prefix")</label>
@Html.EditorFor(svm => svm.DatabaseTablePrefix)
</span>
</div>
</div>
</fieldset>
<fieldset>
<input type="submit" class="button primaryAction" value="@T("Save")" />
</fieldset>
}

View File

@@ -1,6 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ShellSettings>" %>
<%@ Import Namespace="Orchard.Environment.Configuration" %>
<% using(Html.BeginFormAntiForgeryPost(Url.Action("enable", new {area = "Orchard.MultiTenancy"}), FormMethod.Post, new {@class = "inline link"})) { %>
<%: Html.HiddenFor(ss => ss.Name) %>
<button type="submit"><%: T("Resume")%></button><%
} %>

View File

@@ -0,0 +1,7 @@
@model Orchard.Environment.Configuration.ShellSettings
@using Orchard.MultiTenancy.Extensions
@using(Html.BeginFormAntiForgeryPost(Url.Action("enable", new {area = "Orchard.MultiTenancy"}), FormMethod.Post, new {@class = "inline link"})) {
@Html.HiddenFor(ss => ss.Name)
<button type="submit">@T("Resume")</button>
}

View File

@@ -1,3 +0,0 @@
<%@ 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,4 @@
@model Orchard.Environment.Configuration.ShellSettings
@using Orchard.MultiTenancy.Extensions
@Html.ActionLink(T("Make Valid*").ToString(), "_setup", new {tenantName = Model.Name, area = "Orchard.MultiTenancy"})

View File

@@ -1,6 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ShellSettings>" %>
<%@ Import Namespace="Orchard.Environment.Configuration" %>
<% using(Html.BeginFormAntiForgeryPost(Url.Action("disable", new {area = "Orchard.MultiTenancy"}), FormMethod.Post, new {@class = "inline link"})) { %>
<%: Html.HiddenFor(ss => ss.Name) %>
<button type="submit"><%: T("Suspend") %></button><%
} %>

View File

@@ -0,0 +1,7 @@
@model Orchard.Environment.Configuration.ShellSettings
@using Orchard.MultiTenancy.Extensions
@using(Html.BeginFormAntiForgeryPost(Url.Action("disable", new {area = "Orchard.MultiTenancy"}), FormMethod.Post, new {@class = "inline link"})) {
@Html.HiddenFor(ss => ss.Name)
<button type="submit">@T("Suspend")</button>
}

View File

@@ -1,5 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ShellSettings>" %>
<%@ Import Namespace="Orchard.MultiTenancy.Extensions"%>
<%@ Import Namespace="Orchard.Mvc.Html"%>
<%@ Import Namespace="Orchard.Environment.Configuration" %>
<%: Html.Link(T("Set Up").ToString(), Url.Tenant(Model))%>

View File

@@ -0,0 +1,4 @@
@model Orchard.Environment.Configuration.ShellSettings
@using Orchard.MultiTenancy.Extensions
@Html.Link(T("Set Up").ToString(), Url.Tenant(Model))

View File

@@ -1,49 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<TenantEditViewModel>" %>
<%@ Import Namespace="Orchard.Environment.Configuration" %>
<%@ Import Namespace="Orchard.Mvc.Html"%>
<%@ Import Namespace="Orchard.MultiTenancy.ViewModels"%>
<h1><%: Html.TitleForPage(T("Edit Tenant").ToString()) %></h1>
<%using (Html.BeginFormAntiForgeryPost()) { %>
<%: Html.ValidationSummary() %>
<fieldset>
<div>
<h2><%: Model.Name %></h2>
</div>
<div>
<label for="RequestUrlHost"><%: T("Host") %></label>
<%: Html.TextBoxFor(m => m.RequestUrlHost, new {@class = "textMedium"}) %>
<span class="hint"><%: T("Example: If host is \"orchardproject.net\", the tenant site URL is \"http://orchardproject.net/\"") %></span>
</div>
</fieldset>
<fieldset>
<legend><%: T("Database Setup") %></legend><%
if (Model.State.CurrentState != TenantState.State.Uninitialized) { %>
<div class="warning message"><%: T("Warning: If you don't know what you're doing you *will* (likely) send this tenant into a downward spiral of irrecoverable disrepair. Have a nice day.")%></div><%
} else { %>
<div>
<%: Html.RadioButtonFor(svm => svm.DataProvider, "", new { id = "tenantDatabaseOption" })%>
<label for="tenantDatabaseOption" class="forcheckbox"><%: T("Allow the tenant to set up the database") %></label>
</div><%
} %>
<div>
<%: Html.RadioButtonFor(svm => svm.DataProvider, "SqlCe", new { id = "builtinDatabaseOption" })%>
<label for="builtinDatabaseOption" class="forcheckbox"><%: T("Use built-in data storage (SQL Server Compact)") %></label>
</div>
<div>
<%: Html.RadioButtonFor(svm => svm.DataProvider, "SqlServer", new { id = "sqlDatabaseOption" })%>
<label for="sqlDatabaseOption" class="forcheckbox"><%: T("Use an existing SQL Server (or SQL Express) database") %></label>
<span data-controllerid="sqlDatabaseOption">
<label for="DatabaseConnectionString"><%: T("Connection string") %></label>
<%: Html.TextBoxFor(svm => svm.DatabaseConnectionString, new {@class = "large text"})%>
<span class="hint"><%: T("Example:") %><br /><%: T("Data Source=sqlServerName;Initial Catalog=dbName;Persist Security Info=True;User ID=userName;Password=password") %></span>
</span>
<span data-controllerid="sqlDatabaseOption">
<label for="DatabaseTablePrefix"><%: T("Database Table Prefix") %></label>
<%: Html.EditorFor(svm => svm.DatabaseTablePrefix)%>
</span>
</div>
</fieldset>
<fieldset>
<input type="submit" class="button primaryAction" value="<%: T("Save") %>" />
</fieldset>
<% } %>

View File

@@ -0,0 +1,48 @@
@model Orchard.MultiTenancy.ViewModels.TenantEditViewModel
@using Orchard.Environment.Configuration
<h1>@Html.TitleForPage(T("Edit Tenant").ToString())</h1>
@using (Html.BeginFormAntiForgeryPost()) {
@Html.ValidationSummary()
<fieldset>
<div>
<h2>@Model.Name</h2>
</div>
<div>
<label for="RequestUrlHost">@T("Host")</label>
@Html.TextBoxFor(m => m.RequestUrlHost, new {@class = "textMedium"})
<span class="hint">@T("Example: If host is \"orchardproject.net\", the tenant site URL is \"http://orchardproject.net/\"")</span>
</div>
</fieldset>
<fieldset>
<legend>@T("Database Setup")</legend>
@if (Model.State.CurrentState != TenantState.State.Uninitialized) {
<div class="warning message">@T("Warning: If you don't know what you're doing you *will* (likely) send this tenant into a downward spiral of irrecoverable disrepair. Have a nice day.")</div>
} else {
<div>
@Html.RadioButtonFor(svm => svm.DataProvider, "", new { id = "tenantDatabaseOption" })
<label for="tenantDatabaseOption" class="forcheckbox">@T("Allow the tenant to set up the database")</label>
</div>
}
<div>
@Html.RadioButtonFor(svm => svm.DataProvider, "SqlCe", new { id = "builtinDatabaseOption" })
<label for="builtinDatabaseOption" class="forcheckbox">@T("Use built-in data storage (SQL Server Compact)")</label>
</div>
<div>
@Html.RadioButtonFor(svm => svm.DataProvider, "SqlServer", new { id = "sqlDatabaseOption" })
<label for="sqlDatabaseOption" class="forcheckbox">@T("Use an existing SQL Server (or SQL Express) database")</label>
<span data-controllerid="sqlDatabaseOption">
<label for="DatabaseConnectionString">@T("Connection string")</label>
@Html.TextBoxFor(svm => svm.DatabaseConnectionString, new {@class = "large text"})
<span class="hint">@T("Example:")<br />@T("Data Source=sqlServerName;Initial Catalog=dbName;Persist Security Info=True;User ID=userName;Password=password")</span>
</span>
<span data-controllerid="sqlDatabaseOption">
<label for="DatabaseTablePrefix">@T("Database Table Prefix")</label>
@Html.EditorFor(svm => svm.DatabaseTablePrefix)
</span>
</div>
</fieldset>
<fieldset>
<input type="submit" class="button primaryAction" value="@T("Save")" />
</fieldset>
}

View File

@@ -1,33 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<TenantsIndexViewModel>" %>
<%@ Import Namespace="Orchard.MultiTenancy.Extensions" %>
<%@ Import Namespace="Orchard.Mvc.Html"%>
<%@ Import Namespace="Orchard.MultiTenancy.ViewModels"%>
<%Html.RegisterStyle("admin.css"); %>
<h1><%: Html.TitleForPage(T("List of Site's Tenants").ToString())%></h1>
<div class="manage"><%: Html.ActionLink(T("Add a Tenant").ToString(), "Add", new {area = "Orchard.MultiTenancy"}, new { @class = "button primaryAction" })%></div>
<ul class="contentItems tenants"><%
foreach (var tenant in Model.TenantSettings) { %>
<li class="tenant <%=tenant.State.CurrentState %>">
<div class="summary">
<div class="properties">
<h3><%: tenant.Name %><%
if (!string.IsNullOrEmpty(tenant.RequestUrlHost)) {
%><span class="tenantHost"> - <%: Html.Link(Url.Tenant(tenant), Url.Tenant(tenant))%></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), "") %><%: T(" | ")%><%
} %>
<%: Html.ActionLink(T("Edit").ToString(), "Edit", new {name = 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
%><%--
delete not implemented! <%: T(" | ")%>
<%: Html.ActionLink(T("Remove").ToString(), "delete", new {tenantName = tenant.Name, area = "Orchard.MultiTenancy"}) %>--%><%
} %>
</div>
</div>
</li><%
} %>
</ul>

View File

@@ -0,0 +1,30 @@
@model Orchard.MultiTenancy.ViewModels.TenantsIndexViewModel
@using Orchard.MultiTenancy.Extensions
@{
Html.RegisterStyle("admin.css");
}
<h1>@Html.TitleForPage(T("List of Site's Tenants").ToString())</h1>
<div class="manage">@Html.ActionLink(T("Add a Tenant").ToString(), "Add", new {area = "Orchard.MultiTenancy"}, new { @class = "button primaryAction" })</div>
<ul class="contentItems tenants">
@foreach (var tenant in Model.TenantSettings) {
<li class="tenant @tenant.State.CurrentState">
<div class="summary">
<div class="properties">
<h3>@tenant.Name
@if (!string.IsNullOrEmpty(tenant.RequestUrlHost)) {
<span class="tenantHost"> - @Html.Link(Url.Tenant(tenant), Url.Tenant(tenant))</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), "") @T(" | ")
}
@Html.ActionLink(T("Edit").ToString(), "Edit", new {name = tenant.Name, area = "Orchard.MultiTenancy"})
</div>
</div>
</li>
}
</ul>