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:
Sebastien Ros 2016-02-01 09:34:44 -08:00
commit a14b006d70
8 changed files with 48 additions and 26 deletions

View File

@ -441,7 +441,8 @@ namespace Orchard.Core.Shapes {
break;
default:
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;
}
var defaultSettings = new RequireSettings {
@ -450,7 +451,11 @@ namespace Orchard.Core.Shapes {
Culture = _workContext.Value.CurrentCulture,
};
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 =>
(includeLocation.HasValue ? r.Settings.Location == includeLocation.Value : true) &&
(excludeLocation.HasValue ? r.Settings.Location != excludeLocation.Value : true))) {

View File

@ -38,8 +38,9 @@ namespace Orchard.Autoroute.Handlers {
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));
OnDestroyed<AutoroutePart>((ctx, part) => RemoveAlias(part));
OnUnpublished<AutoroutePart>((ctx, part) => RemoveAlias(part));
// Register alias as identity

View File

@ -20,7 +20,7 @@ namespace Orchard.Packaging {
public void Installed(Feature feature) {
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) {
}
}
}
}

View File

@ -59,7 +59,6 @@
<Reference Include="System.ComponentModel.DataAnnotations">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.DynamicData" />

View File

@ -14,17 +14,19 @@ namespace Orchard.Localization.Services {
};
public void ParseLocalizationStream(string text, IDictionary<string, string> translations, bool merge) {
StringReader reader = new StringReader(text);
string poLine, id, scope;
id = scope = String.Empty;
var reader = new StringReader(text);
string poLine;
var scopes = new List<string>();
var id = string.Empty;
while ((poLine = reader.ReadLine()) != null) {
if (poLine.StartsWith("#:")) {
scope = ParseScope(poLine);
scopes.Add(ParseScope(poLine));
continue;
}
if (poLine.StartsWith("msgctxt")) {
scope = ParseContext(poLine);
scopes.Add(ParseContext(poLine));
continue;
}
@ -34,20 +36,24 @@ namespace Orchard.Localization.Services {
}
if (poLine.StartsWith("msgstr")) {
string translation = ParseTranslation(poLine);
var translation = ParseTranslation(poLine);
// ignore incomplete localizations (empty msgid or msgstr)
if (!String.IsNullOrWhiteSpace(id) && !String.IsNullOrWhiteSpace(translation)) {
string scopedKey = (scope + "|" + id).ToLowerInvariant();
if (!translations.ContainsKey(scopedKey)) {
translations.Add(scopedKey, translation);
}
else {
if (merge) {
translations[scopedKey] = translation;
if (!string.IsNullOrWhiteSpace(id) && !string.IsNullOrWhiteSpace(translation)) {
foreach (var scope in scopes) {
var scopedKey = (scope + "|" + id).ToLowerInvariant();
if (!translations.ContainsKey(scopedKey)) {
translations.Add(scopedKey, translation);
}
else {
if (merge) {
translations[scopedKey] = translation;
}
}
}
}
id = scope = String.Empty;
id = string.Empty;
scopes = new List<string>();
}
}

View File

@ -24,7 +24,12 @@ namespace Orchard.Services {
public string ClientHostAddressHeaderName { get; set; }
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)) {
var headerName = ClientHostAddressHeaderName.Trim();

View File

@ -1,5 +1,6 @@
using System;
using Orchard.Mvc;
using Orchard.Mvc.Extensions;
namespace Orchard.Themes
{
@ -16,9 +17,12 @@ namespace Orchard.Themes
public Func<WorkContext, T> Get<T>(string name)
{
if (name == "CurrentTheme")
{
var currentTheme = _themeManager.GetRequestTheme(_httpContextAccessor.Current().Request.RequestContext);
if (name == "CurrentTheme") {
var context = _httpContextAccessor.Current();
var currentTheme = context != null && context.Request != null
? _themeManager.GetRequestTheme(context.Request.RequestContext)
: null;
return ctx => (T)(object)currentTheme;
}
return null;

View File

@ -204,7 +204,9 @@ namespace Orchard.UI.Resources {
url = VirtualPathUtility.Combine(BasePath, url);
}
if (VirtualPathUtility.IsAppRelative(url)) {
url = VirtualPathUtility.ToAbsolute(url, applicationPath);
url = applicationPath != null
? VirtualPathUtility.ToAbsolute(url, applicationPath)
: VirtualPathUtility.ToAbsolute(url);
}
_urlResolveCache[settings] = url;
return url;