mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-27 04:19:04 +08:00
Merge branch '1.9.3' into 1.10
Conflicts: src/Orchard.Web/Modules/Orchard.Autoroute/Handlers/AutoroutePartHandler.cs src/Orchard/ContentManagement/DefaultContentManager.cs
This commit is contained in:
@@ -441,7 +441,8 @@ namespace Orchard.Core.Shapes {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Debug.Assert(site.ResourceDebugMode == ResourceDebugMode.FromAppSetting, "Unknown ResourceDebugMode value.");
|
Debug.Assert(site.ResourceDebugMode == ResourceDebugMode.FromAppSetting, "Unknown ResourceDebugMode value.");
|
||||||
debugMode = _httpContextAccessor.Value.Current().IsDebuggingEnabled;
|
var context = _httpContextAccessor.Value.Current();
|
||||||
|
debugMode = context != null && context.IsDebuggingEnabled;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
var defaultSettings = new RequireSettings {
|
var defaultSettings = new RequireSettings {
|
||||||
@@ -450,7 +451,11 @@ namespace Orchard.Core.Shapes {
|
|||||||
Culture = _workContext.Value.CurrentCulture,
|
Culture = _workContext.Value.CurrentCulture,
|
||||||
};
|
};
|
||||||
var requiredResources = _resourceManager.Value.BuildRequiredResources(resourceType);
|
var requiredResources = _resourceManager.Value.BuildRequiredResources(resourceType);
|
||||||
var appPath = _httpContextAccessor.Value.Current().Request.ApplicationPath;
|
var httpContext = _httpContextAccessor.Value.Current();
|
||||||
|
var appPath = httpContext == null || httpContext.Request == null
|
||||||
|
? null
|
||||||
|
: httpContext.Request.ApplicationPath;
|
||||||
|
|
||||||
foreach (var context in requiredResources.Where(r =>
|
foreach (var context in requiredResources.Where(r =>
|
||||||
(includeLocation.HasValue ? r.Settings.Location == includeLocation.Value : true) &&
|
(includeLocation.HasValue ? r.Settings.Location == includeLocation.Value : true) &&
|
||||||
(excludeLocation.HasValue ? r.Settings.Location != excludeLocation.Value : true))) {
|
(excludeLocation.HasValue ? r.Settings.Location != excludeLocation.Value : true))) {
|
||||||
|
|||||||
@@ -38,8 +38,9 @@ namespace Orchard.Autoroute.Handlers {
|
|||||||
|
|
||||||
OnPublished<AutoroutePart>((ctx, part) => PublishAlias(part));
|
OnPublished<AutoroutePart>((ctx, part) => PublishAlias(part));
|
||||||
|
|
||||||
// Remove alias if removed or unpublished
|
// Remove alias if destroyed, removed or unpublished
|
||||||
OnRemoving<AutoroutePart>((ctx, part) => RemoveAlias(part));
|
OnRemoving<AutoroutePart>((ctx, part) => RemoveAlias(part));
|
||||||
|
OnDestroyed<AutoroutePart>((ctx, part) => RemoveAlias(part));
|
||||||
OnUnpublished<AutoroutePart>((ctx, part) => RemoveAlias(part));
|
OnUnpublished<AutoroutePart>((ctx, part) => RemoveAlias(part));
|
||||||
|
|
||||||
// Register alias as identity
|
// Register alias as identity
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Orchard.Packaging {
|
|||||||
|
|
||||||
public void Installed(Feature feature) {
|
public void Installed(Feature feature) {
|
||||||
if (feature.Descriptor.Id == "Gallery") {
|
if (feature.Descriptor.Id == "Gallery") {
|
||||||
_packagingSourceManager.AddSource("Orchard Gallery", "http://packages.orchardproject.net/FeedService.svc");
|
_packagingSourceManager.AddSource("Orchard Gallery", "https://gallery.orchardproject.net/api/FeedService");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,4 +42,4 @@ namespace Orchard.Packaging {
|
|||||||
public void Uninstalled(Feature feature) {
|
public void Uninstalled(Feature feature) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,6 @@
|
|||||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Web.ApplicationServices" />
|
<Reference Include="System.Web.ApplicationServices" />
|
||||||
<Reference Include="System.Web.DynamicData" />
|
<Reference Include="System.Web.DynamicData" />
|
||||||
|
|||||||
@@ -14,17 +14,19 @@ namespace Orchard.Localization.Services {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public void ParseLocalizationStream(string text, IDictionary<string, string> translations, bool merge) {
|
public void ParseLocalizationStream(string text, IDictionary<string, string> translations, bool merge) {
|
||||||
StringReader reader = new StringReader(text);
|
var reader = new StringReader(text);
|
||||||
string poLine, id, scope;
|
string poLine;
|
||||||
id = scope = String.Empty;
|
var scopes = new List<string>();
|
||||||
|
var id = string.Empty;
|
||||||
|
|
||||||
while ((poLine = reader.ReadLine()) != null) {
|
while ((poLine = reader.ReadLine()) != null) {
|
||||||
if (poLine.StartsWith("#:")) {
|
if (poLine.StartsWith("#:")) {
|
||||||
scope = ParseScope(poLine);
|
scopes.Add(ParseScope(poLine));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (poLine.StartsWith("msgctxt")) {
|
if (poLine.StartsWith("msgctxt")) {
|
||||||
scope = ParseContext(poLine);
|
scopes.Add(ParseContext(poLine));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,20 +36,24 @@ namespace Orchard.Localization.Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (poLine.StartsWith("msgstr")) {
|
if (poLine.StartsWith("msgstr")) {
|
||||||
string translation = ParseTranslation(poLine);
|
var translation = ParseTranslation(poLine);
|
||||||
// ignore incomplete localizations (empty msgid or msgstr)
|
// ignore incomplete localizations (empty msgid or msgstr)
|
||||||
if (!String.IsNullOrWhiteSpace(id) && !String.IsNullOrWhiteSpace(translation)) {
|
if (!string.IsNullOrWhiteSpace(id) && !string.IsNullOrWhiteSpace(translation)) {
|
||||||
string scopedKey = (scope + "|" + id).ToLowerInvariant();
|
foreach (var scope in scopes) {
|
||||||
if (!translations.ContainsKey(scopedKey)) {
|
var scopedKey = (scope + "|" + id).ToLowerInvariant();
|
||||||
translations.Add(scopedKey, translation);
|
if (!translations.ContainsKey(scopedKey)) {
|
||||||
}
|
translations.Add(scopedKey, translation);
|
||||||
else {
|
}
|
||||||
if (merge) {
|
else {
|
||||||
translations[scopedKey] = translation;
|
if (merge) {
|
||||||
|
translations[scopedKey] = translation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
id = scope = String.Empty;
|
|
||||||
|
id = string.Empty;
|
||||||
|
scopes = new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,12 @@ namespace Orchard.Services {
|
|||||||
public string ClientHostAddressHeaderName { get; set; }
|
public string ClientHostAddressHeaderName { get; set; }
|
||||||
|
|
||||||
public string GetClientAddress() {
|
public string GetClientAddress() {
|
||||||
var request = _wca.GetContext().HttpContext.Request;
|
var workContext = _wca.GetContext();
|
||||||
|
|
||||||
|
if (workContext == null || workContext.HttpContext == null)
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
|
var request = workContext.HttpContext.Request;
|
||||||
|
|
||||||
if (EnableClientHostAddressHeader && !String.IsNullOrWhiteSpace(ClientHostAddressHeaderName)) {
|
if (EnableClientHostAddressHeader && !String.IsNullOrWhiteSpace(ClientHostAddressHeaderName)) {
|
||||||
var headerName = ClientHostAddressHeaderName.Trim();
|
var headerName = ClientHostAddressHeaderName.Trim();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using Orchard.Mvc;
|
using Orchard.Mvc;
|
||||||
|
using Orchard.Mvc.Extensions;
|
||||||
|
|
||||||
namespace Orchard.Themes
|
namespace Orchard.Themes
|
||||||
{
|
{
|
||||||
@@ -16,9 +17,12 @@ namespace Orchard.Themes
|
|||||||
|
|
||||||
public Func<WorkContext, T> Get<T>(string name)
|
public Func<WorkContext, T> Get<T>(string name)
|
||||||
{
|
{
|
||||||
if (name == "CurrentTheme")
|
if (name == "CurrentTheme") {
|
||||||
{
|
var context = _httpContextAccessor.Current();
|
||||||
var currentTheme = _themeManager.GetRequestTheme(_httpContextAccessor.Current().Request.RequestContext);
|
var currentTheme = context != null && context.Request != null
|
||||||
|
? _themeManager.GetRequestTheme(context.Request.RequestContext)
|
||||||
|
: null;
|
||||||
|
|
||||||
return ctx => (T)(object)currentTheme;
|
return ctx => (T)(object)currentTheme;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -204,7 +204,9 @@ namespace Orchard.UI.Resources {
|
|||||||
url = VirtualPathUtility.Combine(BasePath, url);
|
url = VirtualPathUtility.Combine(BasePath, url);
|
||||||
}
|
}
|
||||||
if (VirtualPathUtility.IsAppRelative(url)) {
|
if (VirtualPathUtility.IsAppRelative(url)) {
|
||||||
url = VirtualPathUtility.ToAbsolute(url, applicationPath);
|
url = applicationPath != null
|
||||||
|
? VirtualPathUtility.ToAbsolute(url, applicationPath)
|
||||||
|
: VirtualPathUtility.ToAbsolute(url);
|
||||||
}
|
}
|
||||||
_urlResolveCache[settings] = url;
|
_urlResolveCache[settings] = url;
|
||||||
return url;
|
return url;
|
||||||
|
|||||||
Reference in New Issue
Block a user