Merge branch '1.9.x' into dev

Conflicts:
	src/Orchard.Web/Modules/Orchard.ImportExport/Orchard.ImportExport.csproj
	src/Orchard.Web/Modules/Orchard.Recipes/RecipeHandlers/DataRecipeHandler.cs
	src/Orchard.Web/Modules/Orchard.Search/Drivers/SearchSettingsPartDriver.cs
	src/Orchard.Web/Modules/Orchard.Themes/Drivers/DisableThemePartDriver.cs
	src/Orchard.Web/Modules/Orchard.Users/Orchard.Users.csproj
This commit is contained in:
Sebastien Ros
2015-08-27 10:45:16 -07:00
29 changed files with 271 additions and 51 deletions

View File

@@ -27,6 +27,7 @@
<BuildPlatform Condition="$(ProgramW6432) != ''">x64</BuildPlatform> <BuildPlatform Condition="$(ProgramW6432) != ''">x64</BuildPlatform>
<BuildPlatform Condition="$(BuildPlatform) == ''">x86</BuildPlatform> <BuildPlatform Condition="$(BuildPlatform) == ''">x86</BuildPlatform>
<Configuration Condition="$(Configuration) == ''">Release</Configuration>
<!-- TeamCity build number --> <!-- TeamCity build number -->
<Version>$(BUILD_NUMBER)</Version> <Version>$(BUILD_NUMBER)</Version>
@@ -115,7 +116,7 @@
<MSBuild <MSBuild
Projects="$(SrcFolder)\Orchard.sln" Projects="$(SrcFolder)\Orchard.sln"
Targets="Build" Targets="Build"
Properties="Configuration=Release;OutputPath=$(CompileFolder)" /> Properties="Configuration=$(Configuration);OutputPath=$(CompileFolder)" />
<!-- Compile to "regular" output folder for devs using VS locally --> <!-- Compile to "regular" output folder for devs using VS locally -->
<MSBuild <MSBuild
Projects="$(SrcFolder)\Orchard.sln" Projects="$(SrcFolder)\Orchard.sln"
@@ -126,7 +127,7 @@
<MSBuild <MSBuild
Projects="$(SrcFolder)\Tools\MSBuild.Orchard.Tasks\MSBuild.Orchard.Tasks.csproj" Projects="$(SrcFolder)\Tools\MSBuild.Orchard.Tasks\MSBuild.Orchard.Tasks.csproj"
Targets="Build" Targets="Build"
Properties="Configuration=Release;OutputPath=$(MsBuildTasksFolder)" /> Properties="Configuration=$(Configuration);OutputPath=$(MsBuildTasksFolder)" />
</Target> </Target>
<Target Name="TypeScript" DependsOnTargets="CompileMsBuildTasks"> <Target Name="TypeScript" DependsOnTargets="CompileMsBuildTasks">
@@ -273,19 +274,19 @@
<!-- extra processing of the staged config files --> <!-- extra processing of the staged config files -->
<TransformXml <TransformXml
Source="$(StageFolder)\Web.Config" Source="$(StageFolder)\Web.Config"
Transform="$(SrcFolder)\Orchard.Web\Web.Release.Config" Transform="$(SrcFolder)\Orchard.Web\Web.$(Configuration).Config"
Destination="$(StageFolder)\Web.Config" Destination="$(StageFolder)\Web.Config"
/> />
<TransformXml <TransformXml
Source="$(StageFolder)\Config\HostComponents.Config" Source="$(StageFolder)\Config\HostComponents.Config"
Transform="$(SrcFolder)\Orchard.Web\Config\HostComponents.Release.Config" Transform="$(SrcFolder)\Orchard.Web\Config\HostComponents.$(Configuration).Config"
Destination="$(StageFolder)\Config\HostComponents.Config" Destination="$(StageFolder)\Config\HostComponents.Config"
/> />
<TransformXml <TransformXml
Source="$(StageFolder)\Config\log4net.Config" Source="$(StageFolder)\Config\log4net.Config"
Transform="$(SrcFolder)\Orchard.Web\Config\log4net.Release.Config" Transform="$(SrcFolder)\Orchard.Web\Config\log4net.$(Configuration).Config"
Destination="$(StageFolder)\Config\log4net.Config" Destination="$(StageFolder)\Config\log4net.Config"
/> />

View File

@@ -74,15 +74,15 @@ function getAssetGroups() {
function resolveAssetGroupPaths(assetGroup, assetManifestPath) { function resolveAssetGroupPaths(assetGroup, assetManifestPath) {
assetGroup.basePath = path.dirname(assetManifestPath); assetGroup.basePath = path.dirname(assetManifestPath);
assetGroup.inputPaths = assetGroup.inputs.map(function (inputPath) { assetGroup.inputPaths = assetGroup.inputs.map(function (inputPath) {
return path.join(assetGroup.basePath, inputPath); return path.resolve(path.join(assetGroup.basePath, inputPath));
}); });
assetGroup.watchPaths = []; assetGroup.watchPaths = [];
if (!!assetGroup.watch) { if (!!assetGroup.watch) {
assetGroup.watchPaths = assetGroup.watch.map(function (watchPath) { assetGroup.watchPaths = assetGroup.watch.map(function (watchPath) {
return path.join(assetGroup.basePath, watchPath); return path.resolve(path.join(assetGroup.basePath, watchPath));
}); });
} }
assetGroup.outputPath = path.join(assetGroup.basePath, assetGroup.output); assetGroup.outputPath = path.resolve(path.join(assetGroup.basePath, assetGroup.output));
assetGroup.outputDir = path.dirname(assetGroup.outputPath); assetGroup.outputDir = path.dirname(assetGroup.outputPath);
assetGroup.outputFileName = path.basename(assetGroup.output); assetGroup.outputFileName = path.basename(assetGroup.output);
} }

View File

@@ -76,5 +76,39 @@ namespace Orchard.Tests.ContentManagement {
Assert.That((object)testingPartDynamic, Is.AssignableTo<IEnumerable<ContentPart>>()); Assert.That((object)testingPartDynamic, Is.AssignableTo<IEnumerable<ContentPart>>());
} }
[Test]
public void NullCheckingCanBeDoneOnProperties() {
var contentItem = new ContentItem();
var contentPart = new ContentPart { TypePartDefinition = new ContentTypePartDefinition(new ContentPartDefinition("FooPart"), new SettingsDictionary()) };
var contentField = new ContentField { PartFieldDefinition = new ContentPartFieldDefinition(new ContentFieldDefinition("FooType"), "FooField", new SettingsDictionary()) };
dynamic item = contentItem;
dynamic part = contentPart;
Assert.That(item.FooPart == null, Is.True);
Assert.That(item.FooPart != null, Is.False);
contentItem.Weld(contentPart);
Assert.That(item.FooPart == null, Is.False);
Assert.That(item.FooPart != null, Is.True);
Assert.That(item.FooPart, Is.SameAs(contentPart));
Assert.That(part.FooField == null, Is.True);
Assert.That(part.FooField != null, Is.False);
Assert.That(item.FooPart.FooField == null, Is.True);
Assert.That(item.FooPart.FooField != null, Is.False);
contentPart.Weld(contentField);
Assert.That(part.FooField == null, Is.False);
Assert.That(part.FooField != null, Is.True);
Assert.That(item.FooPart.FooField == null, Is.False);
Assert.That(item.FooPart.FooField != null, Is.True);
Assert.That(part.FooField, Is.SameAs(contentField));
Assert.That(item.FooPart.FooField, Is.SameAs(contentField));
}
} }
} }

View File

@@ -4,9 +4,8 @@
@{ @{
ContentItem contentItem = Model.ContentItem; ContentItem contentItem = Model.ContentItem;
var typeDisplayName = contentItem.TypeDefinition.DisplayName ?? contentItem.ContentType.CamelFriendly(); var typeDisplayName = contentItem.TypeDefinition.DisplayName ?? contentItem.ContentType.CamelFriendly();
var pageTitle = T("New {0}", typeDisplayName);
Layout.Title = (string)pageTitle.Text; Layout.Title = T("New {0}", Html.Raw(typeDisplayName)).Text;
} }
@using (Html.BeginFormAntiForgeryPost(Url.Action("Create", new { ReturnUrl = Request.QueryString["ReturnUrl"] }), FormMethod.Post, new { enctype = "multipart/form-data" })) { @using (Html.BeginFormAntiForgeryPost(Url.Action("Create", new { ReturnUrl = Request.QueryString["ReturnUrl"] }), FormMethod.Post, new { enctype = "multipart/form-data" })) {

View File

@@ -4,13 +4,13 @@
var pageTitle = T("Manage Content"); var pageTitle = T("Manage Content");
var createLinkText = T("Create New Content"); var createLinkText = T("Create New Content");
if (!string.IsNullOrWhiteSpace(typeDisplayName)) { if (!string.IsNullOrWhiteSpace(typeDisplayName)) {
pageTitle = T("Manage {0} Content", typeDisplayName); pageTitle = T("Manage {0} Content", Html.Raw(typeDisplayName));
createLinkText = T("Create New {0}", typeDisplayName); createLinkText = T("Create New {0}", Html.Raw(typeDisplayName));
} }
IEnumerable<string> cultures = Model.Options.Cultures; IEnumerable<string> cultures = Model.Options.Cultures;
Layout.Title = pageTitle; Layout.Title = pageTitle.Text;
} }
<div class="manage"> <div class="manage">

View File

@@ -2,7 +2,7 @@
@{ @{
Style.Require("ContentTypesAdmin"); Style.Require("ContentTypesAdmin");
Script.Require("jQuery"); Script.Require("jQuery");
Layout.Title = T("Edit Content Type - {0}", Model.DisplayName).ToString(); Layout.Title = T("Edit Content Type - {0}", Html.Raw(Model.DisplayName)).Text;
} }
<div class="manage"> <div class="manage">

View File

@@ -3,7 +3,7 @@
@{ @{
Style.Require("ContentTypesAdmin"); Style.Require("ContentTypesAdmin");
Layout.Title = T("Edit Field \"{0}\"", Model.Name).ToString(); Layout.Title = T("Edit Field \"{0}\"", Html.Raw(Model.DisplayName)).ToString();
} }
@using (Html.BeginFormAntiForgeryPost()) { @using (Html.BeginFormAntiForgeryPost()) {

View File

@@ -9,7 +9,7 @@
<div class="properties"> <div class="properties">
<h3>@Model.DisplayName</h3> @if (!string.IsNullOrWhiteSpace(stereotype)) { <text><span class="stereotype" title="Stereotype">- @stereotype</span></text>} <h3>@Model.DisplayName</h3> @if (!string.IsNullOrWhiteSpace(stereotype)) { <text><span class="stereotype" title="Stereotype">- @stereotype</span></text>}
@if (creatable) { @if (creatable) {
<p class="pageStatus">@Html.ActionLink(T("Create New {0}", Model.DisplayName).Text, "Create", new {area = "Contents", id = Model.Name})</p> <p class="pageStatus">@Html.ActionLink(T("Create New {0}", Html.Raw(Model.DisplayName)).Text, "Create", new {area = "Contents", id = Model.Name})</p>
} }
</div> </div>
<div class="related">@if (creatable) { <div class="related">@if (creatable) {

View File

@@ -157,9 +157,7 @@
<ItemGroup> <ItemGroup>
<Content Include="Views\Admin\Export.cshtml" /> <Content Include="Views\Admin\Export.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup />
<Content Include="Views\Admin\ImportResult.cshtml" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Views\EditorTemplates\ImportActions\ExecuteRecipe.cshtml" /> <Content Include="Views\EditorTemplates\ImportActions\ExecuteRecipe.cshtml" />
</ItemGroup> </ItemGroup>

View File

@@ -47,8 +47,19 @@ namespace Orchard.Indexing.Commands {
Context.Output.WriteLine(T("Invalid index name.")); Context.Output.WriteLine(T("Invalid index name."));
} }
else { else {
_indexManager.GetSearchIndexProvider().CreateIndex(index); var indexProvider = _indexManager.GetSearchIndexProvider();
Context.Output.WriteLine(T("New index has been created successfully.")); if(indexProvider == null) {
Context.Output.WriteLine(T("New indexing service was found. Please enable a module like Lucene."));
}
else {
if (indexProvider.Exists(index)) {
Context.Output.WriteLine(T("The specified index already exists."));
}
else {
_indexManager.GetSearchIndexProvider().CreateIndex(index);
Context.Output.WriteLine(T("New index has been created successfully."));
}
}
} }
} }

View File

@@ -17,14 +17,13 @@ namespace Orchard.Indexing.Handlers {
OnUpdated<ContentPart>(CreateIndexingTask); OnUpdated<ContentPart>(CreateIndexingTask);
OnPublished<ContentPart>(CreateIndexingTask); OnPublished<ContentPart>(CreateIndexingTask);
OnUnpublished<ContentPart>(CreateIndexingTask); OnUnpublished<ContentPart>(CreateIndexingTask);
OnImported<ContentPart>(CreateIndexingTask);
OnRestored<ContentPart>(CreateIndexingTask);
OnRemoved<ContentPart>(RemoveIndexingTask); OnRemoved<ContentPart>(RemoveIndexingTask);
OnDestroyed<ContentPart>(RemoveIndexingTask);
} }
void CreateIndexingTask(CreateContentContext context, ContentPart part) { void CreateIndexingTask(ContentContextBase context, ContentPart part) {
_indexingTaskManager.CreateUpdateIndexTask(context.ContentItem);
}
void CreateIndexingTask(UpdateContentContext context, ContentPart part) {
_indexingTaskManager.CreateUpdateIndexTask(context.ContentItem); _indexingTaskManager.CreateUpdateIndexTask(context.ContentItem);
} }
@@ -38,7 +37,7 @@ namespace Orchard.Indexing.Handlers {
_indexingTaskManager.CreateUpdateIndexTask(context.ContentItem); _indexingTaskManager.CreateUpdateIndexTask(context.ContentItem);
} }
void RemoveIndexingTask(RemoveContentContext context, ContentPart part) { void RemoveIndexingTask(ContentContextBase context, ContentPart part) {
_indexingTaskManager.CreateDeleteIndexTask(context.ContentItem); _indexingTaskManager.CreateDeleteIndexTask(context.ContentItem);
} }
} }

View File

@@ -4,11 +4,12 @@
@{ @{
var field = (MediaLibraryPickerField) Model.ContentField; var field = (MediaLibraryPickerField) Model.ContentField;
string name = field.DisplayName; string displayName = field.DisplayName;
string name = field.Name;
var mediaParts = field.MediaParts; var mediaParts = field.MediaParts;
} }
@if (mediaParts.Any()) { @if (mediaParts.Any()) {
<span class="name">@name:</span> <span class="name">@displayName:</span>
<p class="media-@name.HtmlClassify()"> <p class="media-@name.HtmlClassify()">
@foreach (var contentItem in mediaParts) { @foreach (var contentItem in mediaParts) {
@Display(BuildDisplay(contentItem, "Thumbnail")) @Display(BuildDisplay(contentItem, "Thumbnail"))

View File

@@ -4,12 +4,13 @@
@{ @{
var field = (MediaLibraryPickerField) Model.ContentField; var field = (MediaLibraryPickerField) Model.ContentField;
string name = field.DisplayName; string displayName = field.DisplayName;
string name = field.Name;
var mediaParts = field.MediaParts; var mediaParts = field.MediaParts;
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString(); var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
} }
<span class="name">@name:</span> <span class="name">@displayName:</span>
<p class="media-library-picker-field media-library-picker-field-@name.HtmlClassify()"> <p class="media-library-picker-field media-library-picker-field-@name.HtmlClassify()">
@if (mediaParts.Any()) { @if (mediaParts.Any()) {

View File

@@ -4,11 +4,12 @@
@{ @{
var field = (MediaLibraryPickerField) Model.ContentField; var field = (MediaLibraryPickerField) Model.ContentField;
string name = field.DisplayName; string displayName = field.DisplayName;
string name = field.Name;
var contents = field.MediaParts; var contents = field.MediaParts;
} }
<section class="media-library-picker-field media-library-picker-field-@name.HtmlClassify()"> <section class="media-library-picker-field media-library-picker-field-@name.HtmlClassify()">
<h3>@name</h3> <h3>@displayName</h3>
@foreach(var content in contents) { @foreach(var content in contents) {
<div> <div>
@Display(BuildDisplay(content, "Summary")) @Display(BuildDisplay(content, "Summary"))

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Xml.Linq; using System.Xml.Linq;
using Orchard.ContentManagement; using Orchard.ContentManagement;

View File

@@ -58,7 +58,7 @@ namespace Orchard.Taxonomies.Drivers {
protected override DriverResult Editor(ContentPart part, TaxonomyField field, dynamic shapeHelper) { protected override DriverResult Editor(ContentPart part, TaxonomyField field, dynamic shapeHelper) {
return ContentShape("Fields_TaxonomyField_Edit", GetDifferentiator(field, part), () => { return ContentShape("Fields_TaxonomyField_Edit", GetDifferentiator(field, part), () => {
var settings = field.PartFieldDefinition.Settings.GetModel<TaxonomyFieldSettings>(); var settings = field.PartFieldDefinition.Settings.GetModel<TaxonomyFieldSettings>();
var appliedTerms = _taxonomyService.GetTermsForContentItem(part.ContentItem.Id, field.Name, VersionOptions.Latest).Distinct(new TermPartComparer()).ToDictionary(t => t.Id, t => t); var appliedTerms = GetAppliedTerms(part, field, VersionOptions.Latest).ToDictionary(t => t.Id, t => t);
var taxonomy = _taxonomyService.GetTaxonomyByName(settings.Taxonomy); var taxonomy = _taxonomyService.GetTaxonomyByName(settings.Taxonomy);
var terms = taxonomy != null var terms = taxonomy != null
? _taxonomyService.GetTerms(taxonomy.Id).Where(t => !string.IsNullOrWhiteSpace(t.Name)).Select(t => t.CreateTermEntry()).ToList() ? _taxonomyService.GetTerms(taxonomy.Id).Where(t => !string.IsNullOrWhiteSpace(t.Name)).Select(t => t.CreateTermEntry()).ToList()
@@ -82,7 +82,9 @@ namespace Orchard.Taxonomies.Drivers {
protected override DriverResult Editor(ContentPart part, TaxonomyField field, IUpdateModel updater, dynamic shapeHelper) { protected override DriverResult Editor(ContentPart part, TaxonomyField field, IUpdateModel updater, dynamic shapeHelper) {
// Initializing viewmodel using the terms that are already selected to prevent loosing them when updating an editor group this field isn't displayed in. // Initializing viewmodel using the terms that are already selected to prevent loosing them when updating an editor group this field isn't displayed in.
var viewModel = new TaxonomyFieldViewModel { Terms = field.Terms.Select(t => t.CreateTermEntry()).ToList() }; // Get all the selected, published terms of all the TaxonomyFields of the content item.
var appliedTerms = GetAppliedTerms(part).ToList();
var viewModel = new TaxonomyFieldViewModel { Terms = appliedTerms.Select(t => t.CreateTermEntry()).ToList() };
foreach (var item in viewModel.Terms) item.IsChecked = true; foreach (var item in viewModel.Terms) item.IsChecked = true;
if (updater.TryUpdateModel(viewModel, GetPrefix(field, part), null, null)) { if (updater.TryUpdateModel(viewModel, GetPrefix(field, part), null, null)) {
@@ -156,6 +158,13 @@ namespace Orchard.Taxonomies.Drivers {
return term; return term;
} }
private IEnumerable<TermPart> GetAppliedTerms(ContentPart part, TaxonomyField field = null, VersionOptions versionOptions = null) {
string fieldName = field != null ? field.Name : string.Empty;
return _taxonomyService.GetTermsForContentItem(part.ContentItem.Id, fieldName, versionOptions?? VersionOptions.Published).Distinct(new TermPartComparer());
}
} }
internal class TermPartComparer : IEqualityComparer<TermPart> { internal class TermPartComparer : IEqualityComparer<TermPart> {

View File

@@ -1,6 +1,7 @@
using System.Web; using System.Web;
using Orchard.ContentManagement.Drivers; using Orchard.ContentManagement.Drivers;
using Orchard.Themes.Models; using Orchard.Themes.Models;
using Orchard.UI.Admin;
namespace Orchard.Themes.Drivers { namespace Orchard.Themes.Drivers {
public class DisableThemePartDriver : ContentPartDriver<DisableThemePart> { public class DisableThemePartDriver : ContentPartDriver<DisableThemePart> {
@@ -11,6 +12,9 @@ namespace Orchard.Themes.Drivers {
} }
protected override DriverResult Display(DisableThemePart part, string displayType, dynamic shapeHelper) { protected override DriverResult Display(DisableThemePart part, string displayType, dynamic shapeHelper) {
if (AdminFilter.IsApplied(_httpContext.Request.RequestContext)) {
return null;
}
return ContentShape("Parts_DisableTheme", () => { return ContentShape("Parts_DisableTheme", () => {
ThemeFilter.Disable(_httpContext.Request.RequestContext); ThemeFilter.Disable(_httpContext.Request.RequestContext);
return null; return null;
@@ -18,4 +22,4 @@ namespace Orchard.Themes.Drivers {
} }
} }
} }

View File

@@ -219,20 +219,20 @@
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">
</Target> --> </Target> -->
<Target Name="AfterBuild" DependsOnTargets="AfterBuildCompiler"> <Target Name="AfterBuild" DependsOnTargets="AfterBuildCompiler">
<PropertyGroup> <PropertyGroup>
<AreasManifestDir>$(ProjectDir)\..\Manifests</AreasManifestDir> <AreasManifestDir>$(ProjectDir)\..\Manifests</AreasManifestDir>
</PropertyGroup> </PropertyGroup>
<!-- If this is an area child project, uncomment the following line: <!-- If this is an area child project, uncomment the following line:
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Child" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" /> <CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Child" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
--> -->
<!-- If this is an area parent project, uncomment the following lines: <!-- If this is an area parent project, uncomment the following lines:
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Parent" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" /> <CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Parent" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
<CopyAreaManifests ManifestPath="$(AreasManifestDir)" CrossCopy="false" RenameViews="true" /> <CopyAreaManifests ManifestPath="$(AreasManifestDir)" CrossCopy="false" RenameViews="true" />
--> -->
</Target> </Target>
<Target Name="AfterBuildCompiler" Condition="'$(MvcBuildViews)'=='true'"> <Target Name="AfterBuildCompiler" Condition="'$(MvcBuildViews)'=='true'">

View File

@@ -0,0 +1,37 @@
using System.Collections.Generic;
using Orchard.ContentManagement;
using Orchard.Users.Models;
namespace Orchard.Gallery.Services {
public class PackageIdentityResolverSelector : IIdentityResolverSelector {
private readonly IContentManager _contentManager;
public PackageIdentityResolverSelector(IContentManager contentManager) {
_contentManager = contentManager;
}
public IdentityResolverSelectorResult GetResolver(ContentIdentity contentIdentity) {
if (contentIdentity.Has("User.UserName")) {
return new IdentityResolverSelectorResult {
Priority = 0,
Resolve = ResolveIdentity
};
}
return null;
}
private IEnumerable<ContentItem> ResolveIdentity(ContentIdentity identity) {
var identifier = identity.Get("User.UserName");
if (identifier == null) {
return null;
}
return _contentManager
.Query<UserPart, UserPartRecord>()
.Where(p => p.NormalizedUserName == identifier)
.List<ContentItem>();
}
}
}

View File

@@ -66,6 +66,7 @@ header, footer, aside, nav, article { display: block; }
content: "."; content: ".";
display: block; display: block;
height: 0; height: 0;
font-size: 0;
clear: both; clear: both;
visibility: hidden; visibility: hidden;
} }
@@ -75,6 +76,7 @@ header, footer, aside, nav, article { display: block; }
content: "."; content: ".";
display: block; display: block;
height: 0; height: 0;
font-size: 0;
clear: both; clear: both;
visibility: hidden; visibility: hidden;
} }

View File

@@ -52,10 +52,11 @@ namespace Orchard.ContentManagement {
return true; return true;
} }
} }
return false; result = null;
return true;
} }
return true; return true;
} }
} }
} }

View File

@@ -74,7 +74,8 @@ namespace Orchard.ContentManagement {
return true; return true;
} }
} }
return false; result = null;
return true;
} }
return true; return true;

View File

@@ -96,6 +96,29 @@ namespace Orchard.ContentManagement.Handlers {
protected void OnIndexed<TPart>(Action<IndexContentContext, TPart> handler) where TPart : class, IContent { protected void OnIndexed<TPart>(Action<IndexContentContext, TPart> handler) where TPart : class, IContent {
Filters.Add(new InlineStorageFilter<TPart> { OnIndexed = handler }); Filters.Add(new InlineStorageFilter<TPart> { OnIndexed = handler });
} }
protected void OnImporting<TPart>(Action<ImportContentContext, TPart> handler) where TPart : class, IContent {
Filters.Add(new InlineStorageFilter<TPart> { OnImporting = handler });
}
protected void OnImported<TPart>(Action<ImportContentContext, TPart> handler) where TPart : class, IContent {
Filters.Add(new InlineStorageFilter<TPart> { OnImported = handler });
}
protected void OnExporting<TPart>(Action<ExportContentContext, TPart> handler) where TPart : class, IContent {
Filters.Add(new InlineStorageFilter<TPart> { OnExporting = handler });
}
protected void OnExported<TPart>(Action<ExportContentContext, TPart> handler) where TPart : class, IContent {
Filters.Add(new InlineStorageFilter<TPart> { OnExported = handler });
}
protected void OnRestoring<TPart>(Action<RestoreContentContext, TPart> handler) where TPart : class, IContent {
Filters.Add(new InlineStorageFilter<TPart> { OnRestoring = handler });
}
protected void OnRestored<TPart>(Action<RestoreContentContext, TPart> handler) where TPart : class, IContent {
Filters.Add(new InlineStorageFilter<TPart> { OnRestored = handler });
}
protected void OnGetContentItemMetadata<TPart>(Action<GetContentItemMetadataContext, TPart> handler) where TPart : class, IContent { protected void OnGetContentItemMetadata<TPart>(Action<GetContentItemMetadataContext, TPart> handler) where TPart : class, IContent {
Filters.Add(new InlineTemplateFilter<TPart> { OnGetItemMetadata = handler }); Filters.Add(new InlineTemplateFilter<TPart> { OnGetItemMetadata = handler });
@@ -132,6 +155,10 @@ namespace Orchard.ContentManagement.Handlers {
public Action<RemoveContentContext, TPart> OnRemoved { get; set; } public Action<RemoveContentContext, TPart> OnRemoved { get; set; }
public Action<IndexContentContext, TPart> OnIndexing { get; set; } public Action<IndexContentContext, TPart> OnIndexing { get; set; }
public Action<IndexContentContext, TPart> OnIndexed { get; set; } public Action<IndexContentContext, TPart> OnIndexed { get; set; }
public Action<ImportContentContext, TPart> OnImporting { get; set; }
public Action<ImportContentContext, TPart> OnImported { get; set; }
public Action<ExportContentContext, TPart> OnExporting { get; set; }
public Action<ExportContentContext, TPart> OnExported { get; set; }
public Action<RestoreContentContext, TPart> OnRestoring { get; set; } public Action<RestoreContentContext, TPart> OnRestoring { get; set; }
public Action<RestoreContentContext, TPart> OnRestored { get; set; } public Action<RestoreContentContext, TPart> OnRestored { get; set; }
public Action<DestroyContentContext, TPart> OnDestroying { get; set; } public Action<DestroyContentContext, TPart> OnDestroying { get; set; }
@@ -188,13 +215,29 @@ namespace Orchard.ContentManagement.Handlers {
if (OnRemoved != null) OnRemoved(context, instance); if (OnRemoved != null) OnRemoved(context, instance);
} }
protected override void Indexing(IndexContentContext context, TPart instance) { protected override void Indexing(IndexContentContext context, TPart instance) {
if ( OnIndexing != null ) if (OnIndexing != null)
OnIndexing(context, instance); OnIndexing(context, instance);
} }
protected override void Indexed(IndexContentContext context, TPart instance) { protected override void Indexed(IndexContentContext context, TPart instance) {
if ( OnIndexed != null ) if (OnIndexed != null)
OnIndexed(context, instance); OnIndexed(context, instance);
} }
protected override void Importing(ImportContentContext context, TPart instance) {
if (OnImporting != null)
OnImporting(context, instance);
}
protected override void Imported(ImportContentContext context, TPart instance) {
if (OnImported != null)
OnImported(context, instance);
}
protected override void Exporting(ExportContentContext context, TPart instance) {
if (OnExporting != null)
OnExporting(context, instance);
}
protected override void Exported(ExportContentContext context, TPart instance) {
if (OnExported != null)
OnExported(context, instance);
}
protected override void Restoring(RestoreContentContext context, TPart instance) { protected override void Restoring(RestoreContentContext context, TPart instance) {
if (OnRestoring != null) if (OnRestoring != null)
OnRestoring(context, instance); OnRestoring(context, instance);
@@ -353,18 +396,26 @@ namespace Orchard.ContentManagement.Handlers {
} }
void IContentHandler.Importing(ImportContentContext context) { void IContentHandler.Importing(ImportContentContext context) {
foreach (var filter in Filters.OfType<IContentStorageFilter>())
filter.Importing(context);
Importing(context); Importing(context);
} }
void IContentHandler.Imported(ImportContentContext context) { void IContentHandler.Imported(ImportContentContext context) {
foreach (var filter in Filters.OfType<IContentStorageFilter>())
filter.Imported(context);
Imported(context); Imported(context);
} }
void IContentHandler.Exporting(ExportContentContext context) { void IContentHandler.Exporting(ExportContentContext context) {
foreach (var filter in Filters.OfType<IContentStorageFilter>())
filter.Exporting(context);
Exporting(context); Exporting(context);
} }
void IContentHandler.Exported(ExportContentContext context) { void IContentHandler.Exported(ExportContentContext context) {
foreach (var filter in Filters.OfType<IContentStorageFilter>())
filter.Exported(context);
Exported(context); Exported(context);
} }

View File

@@ -19,6 +19,10 @@ namespace Orchard.ContentManagement.Handlers {
void Removed(RemoveContentContext context); void Removed(RemoveContentContext context);
void Indexing(IndexContentContext context); void Indexing(IndexContentContext context);
void Indexed(IndexContentContext context); void Indexed(IndexContentContext context);
void Importing(ImportContentContext context);
void Imported(ImportContentContext context);
void Exporting(ExportContentContext context);
void Exported(ExportContentContext context);
void Restoring(RestoreContentContext context); void Restoring(RestoreContentContext context);
void Restored(RestoreContentContext context); void Restored(RestoreContentContext context);
void Destroying(DestroyContentContext context); void Destroying(DestroyContentContext context);

View File

@@ -21,6 +21,10 @@ namespace Orchard.ContentManagement.Handlers {
protected virtual void Removed(RemoveContentContext context, TPart instance) { } protected virtual void Removed(RemoveContentContext context, TPart instance) { }
protected virtual void Indexing(IndexContentContext context, TPart instance) { } protected virtual void Indexing(IndexContentContext context, TPart instance) { }
protected virtual void Indexed(IndexContentContext context, TPart instance) { } protected virtual void Indexed(IndexContentContext context, TPart instance) { }
protected virtual void Importing(ImportContentContext context, TPart instance) { }
protected virtual void Imported(ImportContentContext context, TPart instance) { }
protected virtual void Exporting(ExportContentContext context, TPart instance) { }
protected virtual void Exported(ExportContentContext context, TPart instance) { }
protected virtual void Restoring(RestoreContentContext context, TPart instance) { } protected virtual void Restoring(RestoreContentContext context, TPart instance) { }
protected virtual void Restored(RestoreContentContext context, TPart instance) { } protected virtual void Restored(RestoreContentContext context, TPart instance) { }
protected virtual void Destroying(DestroyContentContext context, TPart instance) { } protected virtual void Destroying(DestroyContentContext context, TPart instance) { }
@@ -121,6 +125,26 @@ namespace Orchard.ContentManagement.Handlers {
Indexed(context, context.ContentItem.As<TPart>()); Indexed(context, context.ContentItem.As<TPart>());
} }
void IContentStorageFilter.Importing(ImportContentContext context) {
if (context.ContentItem.Is<TPart>())
Importing(context, context.ContentItem.As<TPart>());
}
void IContentStorageFilter.Imported(ImportContentContext context) {
if (context.ContentItem.Is<TPart>())
Imported(context, context.ContentItem.As<TPart>());
}
void IContentStorageFilter.Exporting(ExportContentContext context) {
if (context.ContentItem.Is<TPart>())
Exporting(context, context.ContentItem.As<TPart>());
}
void IContentStorageFilter.Exported(ExportContentContext context) {
if (context.ContentItem.Is<TPart>())
Exported(context, context.ContentItem.As<TPart>());
}
void IContentStorageFilter.Restoring(RestoreContentContext context) { void IContentStorageFilter.Restoring(RestoreContentContext context) {
if (context.ContentItem.Is<TPart>()) if (context.ContentItem.Is<TPart>())
Restoring(context, context.ContentItem.As<TPart>()); Restoring(context, context.ContentItem.As<TPart>());

View File

@@ -74,6 +74,7 @@ namespace Orchard.Data {
if (_session != null && _session.Transaction.IsActive) { if (_session != null && _session.Transaction.IsActive) {
Logger.Debug("Rolling back transaction"); Logger.Debug("Rolling back transaction");
_session.Transaction.Rollback(); _session.Transaction.Rollback();
DisposeSession();
} }
} }

View File

@@ -143,6 +143,10 @@ namespace Orchard.Environment {
catch (Exception e) { catch (Exception e) {
Logger.Error(e, "A tenant could not be started: " + settings.Name); Logger.Error(e, "A tenant could not be started: " + settings.Name);
} }
while (_processingEngine.AreTasksPending()) {
Logger.Debug("Processing pending task after activate Shell");
_processingEngine.ExecuteNextTask();
}
}); });
} }
// no settings, run the Setup // no settings, run the Setup

View File

@@ -114,6 +114,18 @@ namespace Orchard.Mvc.Html {
new RouteValueDictionary(htmlAttributes)); new RouteValueDictionary(htmlAttributes));
} }
public static MvcHtmlString ItemEditLink(this HtmlHelper html, string linkText, IContent content, object additionalRouteValues, object htmlAttributes) {
var metadata = content.ContentItem.ContentManager.GetItemMetadata(content);
if (metadata.EditorRouteValues == null)
return null;
return html.ActionLink(
NonNullOrEmpty(linkText, metadata.DisplayText, content.ContentItem.TypeDefinition.DisplayName),
Convert.ToString(metadata.EditorRouteValues["action"]),
metadata.EditorRouteValues.Merge(additionalRouteValues),
htmlAttributes);
}
public static MvcHtmlString ItemAdminLink(this HtmlHelper html, IContent content) { public static MvcHtmlString ItemAdminLink(this HtmlHelper html, IContent content) {
return ItemAdminLink(html, null, content); return ItemAdminLink(html, null, content);
} }

View File

@@ -53,6 +53,12 @@ namespace Orchard.Mvc {
// thus preventing a StackOverflowException. // thus preventing a StackOverflowException.
var baseUrl = new Func<string>(() => siteService.GetSiteSettings().BaseUrl); var baseUrl = new Func<string>(() => siteService.GetSiteSettings().BaseUrl);
var httpContextBase = context.Resolve<IHttpContextAccessor>().Current(); var httpContextBase = context.Resolve<IHttpContextAccessor>().Current();
if (httpContextBase == null) {
context.Resolve<IWorkContextAccessor>().CreateWorkContextScope();
return context.Resolve<IHttpContextAccessor>().Current();
}
context.Resolve<IWorkContextAccessor>().CreateWorkContextScope(httpContextBase); context.Resolve<IWorkContextAccessor>().CreateWorkContextScope(httpContextBase);
return httpContextBase; return httpContextBase;
} }
@@ -192,6 +198,18 @@ namespace Orchard.Mvc {
} }
} }
public override string HttpMethod {
get {
return "";
}
}
public override NameValueCollection Params {
get {
return new NameValueCollection();
}
}
public override string AppRelativeCurrentExecutionFilePath { public override string AppRelativeCurrentExecutionFilePath {
get { get {
return "~/"; return "~/";
@@ -240,6 +258,12 @@ namespace Orchard.Mvc {
} }
} }
public override string[] UserLanguages {
get {
return new string[0];
}
}
public override HttpBrowserCapabilitiesBase Browser { public override HttpBrowserCapabilitiesBase Browser {
get { get {
return new HttpBrowserCapabilitiesPlaceholder(); return new HttpBrowserCapabilitiesPlaceholder();