mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Fixed handling of multiple URL hosts in multi tenancy UI.
This commit is contained in:
@@ -1,26 +1,30 @@
|
||||
using System.Web.Mvc;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Environment.Configuration;
|
||||
|
||||
namespace Orchard.MultiTenancy.Extensions {
|
||||
public static class UrlHelperExtensions {
|
||||
public static string Tenant(this UrlHelper urlHelper, ShellSettings tenantShellSettings) {
|
||||
|
||||
var requestUrlHost = tenantShellSettings.RequestUrlHost.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).First();
|
||||
|
||||
//info: (heskew) might not keep the port/vdir insertion around beyond...
|
||||
var port = string.Empty;
|
||||
string host = urlHelper.RequestContext.HttpContext.Request.Headers["Host"];
|
||||
var host = urlHelper.RequestContext.HttpContext.Request.Headers["Host"];
|
||||
|
||||
if (host.Contains(":"))
|
||||
port = host.Substring(host.IndexOf(":"));
|
||||
|
||||
var result = string.Format("{0}://{1}",
|
||||
urlHelper.RequestContext.HttpContext.Request.Url.Scheme,
|
||||
!string.IsNullOrEmpty(tenantShellSettings.RequestUrlHost)
|
||||
? tenantShellSettings.RequestUrlHost + port : host);
|
||||
var result = String.Format("{0}://{1}",
|
||||
urlHelper.RequestContext.HttpContext.Request.Url.Scheme,
|
||||
!String.IsNullOrEmpty(requestUrlHost) ? requestUrlHost + port : host);
|
||||
|
||||
var applicationPath = urlHelper.RequestContext.HttpContext.Request.ApplicationPath;
|
||||
if (!string.IsNullOrEmpty(applicationPath) && !string.Equals(applicationPath, "/"))
|
||||
if (!String.IsNullOrEmpty(applicationPath) && applicationPath != "/")
|
||||
result += applicationPath;
|
||||
|
||||
if (!string.IsNullOrEmpty(tenantShellSettings.RequestUrlPrefix))
|
||||
if (!String.IsNullOrEmpty(tenantShellSettings.RequestUrlPrefix))
|
||||
result += "/" + tenantShellSettings.RequestUrlPrefix;
|
||||
|
||||
return result;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
Layout.Title = T("Edit Tenant").ToString();
|
||||
|
||||
Script.Require("jQuery").AtFoot();
|
||||
Script.Include(Url.Content("~/Themes/TheAdmin/Scripts/admin.js")).AtFoot();
|
||||
Script.Include(Url.Content("~/Themes/TheAdmin/Scripts/admin.js")).AtFoot();
|
||||
Script.Include("multi-tenancy.admin.js").AtFoot();
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
<h2>@Model.Name</h2>
|
||||
</div>
|
||||
<div>
|
||||
<label for="@Html.FieldIdFor(m => m.RequestUrlHost)">@T("Host")</label>
|
||||
<label for="@Html.FieldIdFor(m => m.RequestUrlHost)">@T("URL host")</label>
|
||||
@Html.TextBoxFor(m => m.RequestUrlHost, new { @class = "text medium" })
|
||||
<span class="hint">@T("Example: If host is \"orchardproject.net\", the tenant site URL is \"http://orchardproject.net/\"")</span>
|
||||
<span class="hint">@T("Example: If host is \"orchardproject.net\", the tenant site URL is \"http://orchardproject.net/\". Multiple hosts can be separated by a comma.")</span>
|
||||
</div>
|
||||
<div>
|
||||
<label for="@Html.FieldIdFor(m => m.RequestUrlPrefix)">@T("URL prefix")</label>
|
||||
@@ -56,8 +56,8 @@
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="available-extensions">
|
||||
<label for="@Html.FieldIdFor(m => m.Themes)">@T("Available Themes")</label>
|
||||
<fieldset class="available-extensions">
|
||||
<label for="@Html.FieldIdFor(m => m.Themes)">@T("Available Themes")</label>
|
||||
<div>
|
||||
<span class="hint">@T("Select the Themes which should be available for this tenant. If none is selected, they will all be available.")</span>
|
||||
|
||||
@@ -83,8 +83,8 @@
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="available-extensions">
|
||||
<label for="@Html.FieldIdFor(m => m.Modules)">@T("Available Modules")</label>
|
||||
<fieldset class="available-extensions">
|
||||
<label for="@Html.FieldIdFor(m => m.Modules)">@T("Available Modules")</label>
|
||||
<div>
|
||||
<span class="hint">@T("Select the Modules which should be available for this tenant. If none is selected, they will all be available.")</span>
|
||||
|
||||
|
Reference in New Issue
Block a user