mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
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:
@@ -74,15 +74,15 @@ function getAssetGroups() {
|
||||
function resolveAssetGroupPaths(assetGroup, assetManifestPath) {
|
||||
assetGroup.basePath = path.dirname(assetManifestPath);
|
||||
assetGroup.inputPaths = assetGroup.inputs.map(function (inputPath) {
|
||||
return path.join(assetGroup.basePath, inputPath);
|
||||
return path.resolve(path.join(assetGroup.basePath, inputPath));
|
||||
});
|
||||
assetGroup.watchPaths = [];
|
||||
if (!!assetGroup.watch) {
|
||||
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.outputFileName = path.basename(assetGroup.output);
|
||||
}
|
||||
|
@@ -76,5 +76,39 @@ namespace Orchard.Tests.ContentManagement {
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,9 +4,8 @@
|
||||
@{
|
||||
ContentItem contentItem = Model.ContentItem;
|
||||
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" })) {
|
||||
|
@@ -4,13 +4,13 @@
|
||||
var pageTitle = T("Manage Content");
|
||||
var createLinkText = T("Create New Content");
|
||||
if (!string.IsNullOrWhiteSpace(typeDisplayName)) {
|
||||
pageTitle = T("Manage {0} Content", typeDisplayName);
|
||||
createLinkText = T("Create New {0}", typeDisplayName);
|
||||
pageTitle = T("Manage {0} Content", Html.Raw(typeDisplayName));
|
||||
createLinkText = T("Create New {0}", Html.Raw(typeDisplayName));
|
||||
}
|
||||
|
||||
IEnumerable<string> cultures = Model.Options.Cultures;
|
||||
|
||||
Layout.Title = pageTitle;
|
||||
Layout.Title = pageTitle.Text;
|
||||
}
|
||||
|
||||
<div class="manage">
|
||||
|
@@ -2,7 +2,7 @@
|
||||
@{
|
||||
Style.Require("ContentTypesAdmin");
|
||||
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">
|
||||
|
@@ -3,7 +3,7 @@
|
||||
@{
|
||||
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()) {
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<div class="properties">
|
||||
<h3>@Model.DisplayName</h3> @if (!string.IsNullOrWhiteSpace(stereotype)) { <text><span class="stereotype" title="Stereotype">- @stereotype</span></text>}
|
||||
@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 class="related">@if (creatable) {
|
||||
|
@@ -157,9 +157,7 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Admin\Export.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Admin\ImportResult.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Content Include="Views\EditorTemplates\ImportActions\ExecuteRecipe.cshtml" />
|
||||
</ItemGroup>
|
||||
|
@@ -47,8 +47,19 @@ namespace Orchard.Indexing.Commands {
|
||||
Context.Output.WriteLine(T("Invalid index name."));
|
||||
}
|
||||
else {
|
||||
_indexManager.GetSearchIndexProvider().CreateIndex(index);
|
||||
Context.Output.WriteLine(T("New index has been created successfully."));
|
||||
var indexProvider = _indexManager.GetSearchIndexProvider();
|
||||
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."));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -17,14 +17,13 @@ namespace Orchard.Indexing.Handlers {
|
||||
OnUpdated<ContentPart>(CreateIndexingTask);
|
||||
OnPublished<ContentPart>(CreateIndexingTask);
|
||||
OnUnpublished<ContentPart>(CreateIndexingTask);
|
||||
OnImported<ContentPart>(CreateIndexingTask);
|
||||
OnRestored<ContentPart>(CreateIndexingTask);
|
||||
OnRemoved<ContentPart>(RemoveIndexingTask);
|
||||
OnDestroyed<ContentPart>(RemoveIndexingTask);
|
||||
}
|
||||
|
||||
void CreateIndexingTask(CreateContentContext context, ContentPart part) {
|
||||
_indexingTaskManager.CreateUpdateIndexTask(context.ContentItem);
|
||||
}
|
||||
|
||||
void CreateIndexingTask(UpdateContentContext context, ContentPart part) {
|
||||
void CreateIndexingTask(ContentContextBase context, ContentPart part) {
|
||||
_indexingTaskManager.CreateUpdateIndexTask(context.ContentItem);
|
||||
}
|
||||
|
||||
@@ -38,7 +37,7 @@ namespace Orchard.Indexing.Handlers {
|
||||
_indexingTaskManager.CreateUpdateIndexTask(context.ContentItem);
|
||||
}
|
||||
|
||||
void RemoveIndexingTask(RemoveContentContext context, ContentPart part) {
|
||||
void RemoveIndexingTask(ContentContextBase context, ContentPart part) {
|
||||
_indexingTaskManager.CreateDeleteIndexTask(context.ContentItem);
|
||||
}
|
||||
}
|
||||
|
@@ -4,11 +4,12 @@
|
||||
|
||||
@{
|
||||
var field = (MediaLibraryPickerField) Model.ContentField;
|
||||
string name = field.DisplayName;
|
||||
string displayName = field.DisplayName;
|
||||
string name = field.Name;
|
||||
var mediaParts = field.MediaParts;
|
||||
}
|
||||
@if (mediaParts.Any()) {
|
||||
<span class="name">@name:</span>
|
||||
<span class="name">@displayName:</span>
|
||||
<p class="media-@name.HtmlClassify()">
|
||||
@foreach (var contentItem in mediaParts) {
|
||||
@Display(BuildDisplay(contentItem, "Thumbnail"))
|
||||
|
@@ -4,12 +4,13 @@
|
||||
|
||||
@{
|
||||
var field = (MediaLibraryPickerField) Model.ContentField;
|
||||
string name = field.DisplayName;
|
||||
string displayName = field.DisplayName;
|
||||
string name = field.Name;
|
||||
var mediaParts = field.MediaParts;
|
||||
|
||||
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()">
|
||||
|
||||
@if (mediaParts.Any()) {
|
||||
|
@@ -4,11 +4,12 @@
|
||||
|
||||
@{
|
||||
var field = (MediaLibraryPickerField) Model.ContentField;
|
||||
string name = field.DisplayName;
|
||||
string displayName = field.DisplayName;
|
||||
string name = field.Name;
|
||||
var contents = field.MediaParts;
|
||||
}
|
||||
<section class="media-library-picker-field media-library-picker-field-@name.HtmlClassify()">
|
||||
<h3>@name</h3>
|
||||
<h3>@displayName</h3>
|
||||
@foreach(var content in contents) {
|
||||
<div>
|
||||
@Display(BuildDisplay(content, "Summary"))
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Orchard.ContentManagement;
|
||||
|
@@ -58,7 +58,7 @@ namespace Orchard.Taxonomies.Drivers {
|
||||
protected override DriverResult Editor(ContentPart part, TaxonomyField field, dynamic shapeHelper) {
|
||||
return ContentShape("Fields_TaxonomyField_Edit", GetDifferentiator(field, part), () => {
|
||||
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 terms = taxonomy != null
|
||||
? _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) {
|
||||
// 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;
|
||||
|
||||
if (updater.TryUpdateModel(viewModel, GetPrefix(field, part), null, null)) {
|
||||
@@ -156,6 +158,13 @@ namespace Orchard.Taxonomies.Drivers {
|
||||
|
||||
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> {
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using System.Web;
|
||||
using System.Web;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Themes.Models;
|
||||
using Orchard.UI.Admin;
|
||||
|
||||
namespace Orchard.Themes.Drivers {
|
||||
public class DisableThemePartDriver : ContentPartDriver<DisableThemePart> {
|
||||
@@ -11,6 +12,9 @@ namespace Orchard.Themes.Drivers {
|
||||
}
|
||||
|
||||
protected override DriverResult Display(DisableThemePart part, string displayType, dynamic shapeHelper) {
|
||||
if (AdminFilter.IsApplied(_httpContext.Request.RequestContext)) {
|
||||
return null;
|
||||
}
|
||||
return ContentShape("Parts_DisableTheme", () => {
|
||||
ThemeFilter.Disable(_httpContext.Request.RequestContext);
|
||||
return null;
|
||||
@@ -18,4 +22,4 @@ namespace Orchard.Themes.Drivers {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -219,20 +219,20 @@
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
<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.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
<!-- 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.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target> -->
|
||||
<Target Name="AfterBuild" DependsOnTargets="AfterBuildCompiler">
|
||||
<PropertyGroup>
|
||||
<AreasManifestDir>$(ProjectDir)\..\Manifests</AreasManifestDir>
|
||||
</PropertyGroup>
|
||||
<!-- If this is an area child project, uncomment the following line:
|
||||
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Child" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
|
||||
<!-- If this is an area child project, uncomment the following line:
|
||||
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Child" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
|
||||
-->
|
||||
<!-- If this is an area parent project, uncomment the following lines:
|
||||
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Parent" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
|
||||
<CopyAreaManifests ManifestPath="$(AreasManifestDir)" CrossCopy="false" RenameViews="true" />
|
||||
<!-- If this is an area parent project, uncomment the following lines:
|
||||
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Parent" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
|
||||
<CopyAreaManifests ManifestPath="$(AreasManifestDir)" CrossCopy="false" RenameViews="true" />
|
||||
-->
|
||||
</Target>
|
||||
<Target Name="AfterBuildCompiler" Condition="'$(MvcBuildViews)'=='true'">
|
||||
|
@@ -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>();
|
||||
}
|
||||
}
|
||||
}
|
@@ -66,6 +66,7 @@ header, footer, aside, nav, article { display: block; }
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
font-size: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
@@ -75,6 +76,7 @@ header, footer, aside, nav, article { display: block; }
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
font-size: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
@@ -52,10 +52,11 @@ namespace Orchard.ContentManagement {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
result = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -74,7 +74,8 @@ namespace Orchard.ContentManagement {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
result = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -96,6 +96,29 @@ namespace Orchard.ContentManagement.Handlers {
|
||||
protected void OnIndexed<TPart>(Action<IndexContentContext, TPart> handler) where TPart : class, IContent {
|
||||
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 {
|
||||
Filters.Add(new InlineTemplateFilter<TPart> { OnGetItemMetadata = handler });
|
||||
@@ -132,6 +155,10 @@ namespace Orchard.ContentManagement.Handlers {
|
||||
public Action<RemoveContentContext, TPart> OnRemoved { get; set; }
|
||||
public Action<IndexContentContext, TPart> OnIndexing { 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> OnRestored { get; set; }
|
||||
public Action<DestroyContentContext, TPart> OnDestroying { get; set; }
|
||||
@@ -188,13 +215,29 @@ namespace Orchard.ContentManagement.Handlers {
|
||||
if (OnRemoved != null) OnRemoved(context, instance);
|
||||
}
|
||||
protected override void Indexing(IndexContentContext context, TPart instance) {
|
||||
if ( OnIndexing != null )
|
||||
if (OnIndexing != null)
|
||||
OnIndexing(context, instance);
|
||||
}
|
||||
protected override void Indexed(IndexContentContext context, TPart instance) {
|
||||
if ( OnIndexed != null )
|
||||
if (OnIndexed != null)
|
||||
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) {
|
||||
if (OnRestoring != null)
|
||||
OnRestoring(context, instance);
|
||||
@@ -353,18 +396,26 @@ namespace Orchard.ContentManagement.Handlers {
|
||||
}
|
||||
|
||||
void IContentHandler.Importing(ImportContentContext context) {
|
||||
foreach (var filter in Filters.OfType<IContentStorageFilter>())
|
||||
filter.Importing(context);
|
||||
Importing(context);
|
||||
}
|
||||
|
||||
void IContentHandler.Imported(ImportContentContext context) {
|
||||
foreach (var filter in Filters.OfType<IContentStorageFilter>())
|
||||
filter.Imported(context);
|
||||
Imported(context);
|
||||
}
|
||||
|
||||
void IContentHandler.Exporting(ExportContentContext context) {
|
||||
foreach (var filter in Filters.OfType<IContentStorageFilter>())
|
||||
filter.Exporting(context);
|
||||
Exporting(context);
|
||||
}
|
||||
|
||||
void IContentHandler.Exported(ExportContentContext context) {
|
||||
foreach (var filter in Filters.OfType<IContentStorageFilter>())
|
||||
filter.Exported(context);
|
||||
Exported(context);
|
||||
}
|
||||
|
||||
|
@@ -19,6 +19,10 @@ namespace Orchard.ContentManagement.Handlers {
|
||||
void Removed(RemoveContentContext context);
|
||||
void Indexing(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 Restored(RestoreContentContext context);
|
||||
void Destroying(DestroyContentContext context);
|
||||
|
@@ -21,6 +21,10 @@ namespace Orchard.ContentManagement.Handlers {
|
||||
protected virtual void Removed(RemoveContentContext context, TPart instance) { }
|
||||
protected virtual void Indexing(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 Restored(RestoreContentContext 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>());
|
||||
}
|
||||
|
||||
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) {
|
||||
if (context.ContentItem.Is<TPart>())
|
||||
Restoring(context, context.ContentItem.As<TPart>());
|
||||
|
@@ -74,6 +74,7 @@ namespace Orchard.Data {
|
||||
if (_session != null && _session.Transaction.IsActive) {
|
||||
Logger.Debug("Rolling back transaction");
|
||||
_session.Transaction.Rollback();
|
||||
DisposeSession();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -143,6 +143,10 @@ namespace Orchard.Environment {
|
||||
catch (Exception e) {
|
||||
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
|
||||
|
@@ -114,6 +114,18 @@ namespace Orchard.Mvc.Html {
|
||||
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) {
|
||||
return ItemAdminLink(html, null, content);
|
||||
}
|
||||
|
@@ -53,6 +53,12 @@ namespace Orchard.Mvc {
|
||||
// thus preventing a StackOverflowException.
|
||||
var baseUrl = new Func<string>(() => siteService.GetSiteSettings().BaseUrl);
|
||||
var httpContextBase = context.Resolve<IHttpContextAccessor>().Current();
|
||||
|
||||
if (httpContextBase == null) {
|
||||
context.Resolve<IWorkContextAccessor>().CreateWorkContextScope();
|
||||
return context.Resolve<IHttpContextAccessor>().Current();
|
||||
}
|
||||
|
||||
context.Resolve<IWorkContextAccessor>().CreateWorkContextScope(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 {
|
||||
get {
|
||||
return "~/";
|
||||
@@ -240,6 +258,12 @@ namespace Orchard.Mvc {
|
||||
}
|
||||
}
|
||||
|
||||
public override string[] UserLanguages {
|
||||
get {
|
||||
return new string[0];
|
||||
}
|
||||
}
|
||||
|
||||
public override HttpBrowserCapabilitiesBase Browser {
|
||||
get {
|
||||
return new HttpBrowserCapabilitiesPlaceholder();
|
||||
|
Reference in New Issue
Block a user