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

@@ -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">

View File

@@ -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()) {

View File

@@ -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) {

View File

@@ -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>

View File

@@ -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."));
}
}
}
}

View File

@@ -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);
}
}

View File

@@ -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"))

View File

@@ -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()) {

View File

@@ -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"))

View File

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

View File

@@ -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> {

View File

@@ -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 {
}
}
}
}

View File

@@ -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'">

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>();
}
}
}