Added a part setting for TermPart so the display type can be changed on child items when displaying the details of the term.

This commit is contained in:
Bertrand Le Roy
2014-01-18 18:36:11 -08:00
parent d5b68e2c9a
commit 529a43c1ed
5 changed files with 426 additions and 369 deletions

View File

@@ -1,137 +1,143 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Routing;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Taxonomies.Models;
using Orchard.Taxonomies.Services;
using Orchard.ContentManagement.Handlers;
using Orchard.Core.Feeds;
using Orchard.Localization;
using Orchard.Mvc;
using Orchard.Settings;
using Orchard.UI.Navigation;
namespace Orchard.Taxonomies.Drivers {
public class TermPartDriver : ContentPartDriver<TermPart> {
private readonly ITaxonomyService _taxonomyService;
private readonly ISiteService _siteService;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IFeedManager _feedManager;
private readonly IContentManager _contentManager;
public TermPartDriver(
ITaxonomyService taxonomyService,
ISiteService siteService,
IHttpContextAccessor httpContextAccessor,
IFeedManager feedManager,
IContentManager contentManager) {
_taxonomyService = taxonomyService;
_siteService = siteService;
_httpContextAccessor = httpContextAccessor;
_feedManager = feedManager;
_contentManager = contentManager;
T = NullLocalizer.Instance;
}
public Localizer T { get; set; }
protected override string Prefix { get { return "Term"; } }
protected override DriverResult Display(TermPart part, string displayType, dynamic shapeHelper) {
return Combined(
ContentShape("Parts_TermPart_Feed", () => {
// generates a link to the RSS feed for this term
_feedManager.Register(part.Name, "rss", new RouteValueDictionary { { "term", part.Id } });
return null;
}),
ContentShape("Parts_TermPart", () => {
var pagerParameters = new PagerParameters();
var httpContext = _httpContextAccessor.Current();
if (httpContext != null) {
pagerParameters.Page = Convert.ToInt32(httpContext.Request.QueryString["page"]);
}
var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);
var taxonomy = _taxonomyService.GetTaxonomy(part.TaxonomyId);
var totalItemCount = _taxonomyService.GetContentItemsCount(part);
// asign Taxonomy and Term to the content item shape (Content) in order to provide
// alternates when those content items are displayed when they are listed on a term
var termContentItems = _taxonomyService.GetContentItems(part, pager.GetStartIndex(), pager.PageSize)
.Select(c => _contentManager.BuildDisplay(c, "Summary").Taxonomy(taxonomy).Term(part));
var list = shapeHelper.List();
list.AddRange(termContentItems);
var pagerShape = shapeHelper.Pager(pager)
.TotalItemCount(totalItemCount)
.Taxonomy(taxonomy)
.Term(part);
return shapeHelper.Parts_TermPart(ContentItems: list, Taxonomy: taxonomy, Pager: pagerShape);
}));
}
protected override DriverResult Editor(TermPart part, dynamic shapeHelper) {
return ContentShape("Parts_Taxonomies_Term_Fields",
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Taxonomies.Term.Fields", Model: part, Prefix: Prefix));
}
protected override DriverResult Editor(TermPart termPart, IUpdateModel updater, dynamic shapeHelper) {
if (updater.TryUpdateModel(termPart, Prefix, null, null)) {
var existing = _taxonomyService.GetTermByName(termPart.TaxonomyId, termPart.Name);
if (existing != null && existing.Record != termPart.Record && existing.Container.ContentItem.Record == termPart.Container.ContentItem.Record) {
updater.AddModelError("Name", T("The term {0} already exists at this level", termPart.Name));
}
}
return Editor(termPart, shapeHelper);
}
protected override void Exporting(TermPart part, ExportContentContext context) {
context.Element(part.PartDefinition.Name).SetAttributeValue("Count", part.Record.Count);
context.Element(part.PartDefinition.Name).SetAttributeValue("Selectable", part.Record.Selectable);
context.Element(part.PartDefinition.Name).SetAttributeValue("Weight", part.Record.Weight);
var taxonomy = _contentManager.Get(part.Record.TaxonomyId);
var identity = _contentManager.GetItemMetadata(taxonomy).Identity.ToString();
context.Element(part.PartDefinition.Name).SetAttributeValue("TaxonomyId", identity);
var identityPaths = new List<string>();
foreach(var pathPart in part.Record.Path.Split('/')) {
if(String.IsNullOrEmpty(pathPart)) {
continue;
}
var parent = _contentManager.Get(Int32.Parse(pathPart));
identityPaths.Add(_contentManager.GetItemMetadata(parent).Identity.ToString());
}
context.Element(part.PartDefinition.Name).SetAttributeValue("Path", String.Join(",", identityPaths.ToArray()));
}
protected override void Importing(TermPart part, ImportContentContext context) {
part.Record.Count = Int32.Parse(context.Attribute(part.PartDefinition.Name, "Count"));
part.Record.Selectable = Boolean.Parse(context.Attribute(part.PartDefinition.Name, "Selectable"));
part.Record.Weight = Int32.Parse(context.Attribute(part.PartDefinition.Name, "Weight"));
var identity = context.Attribute(part.PartDefinition.Name, "TaxonomyId");
var contentItem = context.GetItemFromSession(identity);
if (contentItem == null) {
throw new OrchardException(T("Unknown taxonomy: {0}", identity));
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Routing;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Taxonomies.Models;
using Orchard.Taxonomies.Services;
using Orchard.ContentManagement.Handlers;
using Orchard.Core.Feeds;
using Orchard.Localization;
using Orchard.Mvc;
using Orchard.Settings;
using Orchard.Taxonomies.Settings;
using Orchard.UI.Navigation;
namespace Orchard.Taxonomies.Drivers {
public class TermPartDriver : ContentPartDriver<TermPart> {
private readonly ITaxonomyService _taxonomyService;
private readonly ISiteService _siteService;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IFeedManager _feedManager;
private readonly IContentManager _contentManager;
public TermPartDriver(
ITaxonomyService taxonomyService,
ISiteService siteService,
IHttpContextAccessor httpContextAccessor,
IFeedManager feedManager,
IContentManager contentManager) {
_taxonomyService = taxonomyService;
_siteService = siteService;
_httpContextAccessor = httpContextAccessor;
_feedManager = feedManager;
_contentManager = contentManager;
T = NullLocalizer.Instance;
}
public Localizer T { get; set; }
protected override string Prefix { get { return "Term"; } }
protected override DriverResult Display(TermPart part, string displayType, dynamic shapeHelper) {
return Combined(
ContentShape("Parts_TermPart_Feed", () => {
// generates a link to the RSS feed for this term
_feedManager.Register(part.Name, "rss", new RouteValueDictionary { { "term", part.Id } });
return null;
}),
ContentShape("Parts_TermPart", () => {
var pagerParameters = new PagerParameters();
var httpContext = _httpContextAccessor.Current();
if (httpContext != null) {
pagerParameters.Page = Convert.ToInt32(httpContext.Request.QueryString["page"]);
}
var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);
var taxonomy = _taxonomyService.GetTaxonomy(part.TaxonomyId);
var totalItemCount = _taxonomyService.GetContentItemsCount(part);
var partSettings = part.Settings.GetModel<TermPartSettings>();
var childDisplayType = partSettings != null &&
!String.IsNullOrWhiteSpace(partSettings.ChildDisplayType)
? partSettings.ChildDisplayType
: "Summary";
// asign Taxonomy and Term to the content item shape (Content) in order to provide
// alternates when those content items are displayed when they are listed on a term
var termContentItems = _taxonomyService.GetContentItems(part, pager.GetStartIndex(), pager.PageSize)
.Select(c => _contentManager.BuildDisplay(c, childDisplayType).Taxonomy(taxonomy).Term(part));
var list = shapeHelper.List();
list.AddRange(termContentItems);
var pagerShape = shapeHelper.Pager(pager)
.TotalItemCount(totalItemCount)
.Taxonomy(taxonomy)
.Term(part);
return shapeHelper.Parts_TermPart(ContentItems: list, Taxonomy: taxonomy, Pager: pagerShape);
}));
}
protected override DriverResult Editor(TermPart part, dynamic shapeHelper) {
return ContentShape("Parts_Taxonomies_Term_Fields",
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Taxonomies.Term.Fields", Model: part, Prefix: Prefix));
}
protected override DriverResult Editor(TermPart termPart, IUpdateModel updater, dynamic shapeHelper) {
if (updater.TryUpdateModel(termPart, Prefix, null, null)) {
var existing = _taxonomyService.GetTermByName(termPart.TaxonomyId, termPart.Name);
if (existing != null && existing.Record != termPart.Record && existing.Container.ContentItem.Record == termPart.Container.ContentItem.Record) {
updater.AddModelError("Name", T("The term {0} already exists at this level", termPart.Name));
}
}
return Editor(termPart, shapeHelper);
}
protected override void Exporting(TermPart part, ExportContentContext context) {
context.Element(part.PartDefinition.Name).SetAttributeValue("Count", part.Record.Count);
context.Element(part.PartDefinition.Name).SetAttributeValue("Selectable", part.Record.Selectable);
context.Element(part.PartDefinition.Name).SetAttributeValue("Weight", part.Record.Weight);
var taxonomy = _contentManager.Get(part.Record.TaxonomyId);
var identity = _contentManager.GetItemMetadata(taxonomy).Identity.ToString();
context.Element(part.PartDefinition.Name).SetAttributeValue("TaxonomyId", identity);
var identityPaths = new List<string>();
foreach(var pathPart in part.Record.Path.Split('/')) {
if(String.IsNullOrEmpty(pathPart)) {
continue;
}
var parent = _contentManager.Get(Int32.Parse(pathPart));
identityPaths.Add(_contentManager.GetItemMetadata(parent).Identity.ToString());
}
context.Element(part.PartDefinition.Name).SetAttributeValue("Path", String.Join(",", identityPaths.ToArray()));
}
protected override void Importing(TermPart part, ImportContentContext context) {
part.Record.Count = Int32.Parse(context.Attribute(part.PartDefinition.Name, "Count"));
part.Record.Selectable = Boolean.Parse(context.Attribute(part.PartDefinition.Name, "Selectable"));
part.Record.Weight = Int32.Parse(context.Attribute(part.PartDefinition.Name, "Weight"));
var identity = context.Attribute(part.PartDefinition.Name, "TaxonomyId");
var contentItem = context.GetItemFromSession(identity);
if (contentItem == null) {
throw new OrchardException(T("Unknown taxonomy: {0}", identity));
}
part.Record.TaxonomyId = contentItem.Id;
part.Record.Path = "/";
foreach(var identityPath in context.Attribute(part.PartDefinition.Name, "Path").Split(new [] {','}, StringSplitOptions.RemoveEmptyEntries)) {
var pathContentItem = context.GetItemFromSession(identityPath);
foreach(var identityPath in context.Attribute(part.PartDefinition.Name, "Path").Split(new [] {','}, StringSplitOptions.RemoveEmptyEntries)) {
var pathContentItem = context.GetItemFromSession(identityPath);
part.Record.Path += pathContentItem.Id + "/";
}
}
}
}
}
}
}

View File

@@ -1,240 +1,244 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E649EA64-D213-461B-87F7-D67035801443}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.Taxonomies</RootNamespace>
<AssemblyName>Orchard.Taxonomies</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>false</UseIISExpress>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>4.0</OldToolsVersion>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AdminMenu.cs" />
<Compile Include="Controllers\AdminController.cs" />
<Compile Include="Controllers\TermAdminController.cs" />
<Compile Include="Drivers\TaxonomyNavigationPartDriver.cs" />
<Compile Include="Drivers\TermsPartDriver.cs" />
<Compile Include="Drivers\TaxonomyPartDriver.cs" />
<Compile Include="Handlers\TaxonomyPartHandler.cs" />
<Compile Include="Handlers\TermsPartHandler.cs" />
<Compile Include="Helpers\PathExtensions.cs" />
<Compile Include="Migrations.cs" />
<Compile Include="Drivers\TermPartDriver.cs" />
<Compile Include="Drivers\TaxonomyFieldDriver.cs" />
<Compile Include="Handlers\TermPartHandler.cs" />
<Compile Include="Helpers\PredicateBuilder.cs" />
<Compile Include="Models\TaxonomyNavigationPart.cs" />
<Compile Include="Models\TermContentItemPart.cs" />
<Compile Include="Models\TaxonomyPartRecord.cs" />
<Compile Include="Models\TermPart.cs" />
<Compile Include="Models\TermPartNode.cs" />
<Compile Include="Models\TermPartRecord.cs" />
<Compile Include="Models\TaxonomyPart.cs" />
<Compile Include="Models\TermContentItem.cs" />
<Compile Include="Models\TermsPart.cs" />
<Compile Include="Models\TermsPartRecord.cs" />
<Compile Include="Navigation\TaxonomyNavigationProvider.cs" />
<Compile Include="Permissions.cs" />
<Compile Include="Projections\TermsFilter.cs" />
<Compile Include="Projections\TermsFilterForms.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Fields\TaxonomyField.cs" />
<Compile Include="Services\ITaxonomyService.cs" />
<Compile Include="Services\TaxonomyService.cs" />
<Compile Include="Settings\TaxonomyFieldEditorEvents.cs" />
<Compile Include="Settings\TaxonomyFieldSettings.cs" />
<Compile Include="Shapes.cs" />
<Compile Include="StandardQueries\TermFeedQuery.cs" />
<Compile Include="Tokens\TaxonomyTokens.cs" />
<Compile Include="ViewModels\ImportViewModel.cs" />
<Compile Include="ViewModels\MergeTermViewModel.cs" />
<Compile Include="ViewModels\MoveTermViewModel.cs" />
<Compile Include="ViewModels\SelectTermViewModel.cs" />
<Compile Include="ViewModels\TaxonomyFieldViewModel.cs" />
<Compile Include="ViewModels\TermAdminIndexViewModel.cs" />
<Compile Include="ViewModels\TaxonomyAdminIndexViewModel.cs" />
<Compile Include="ViewModels\TaxonomyNavigationViewModel.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Scripts\admin-taxonomy-expando.js" />
<Content Include="Scripts\admin-taxonomy-field-settings.js" />
<Content Include="Scripts\admin-taxonomy-tags.js" />
<Content Include="Scripts\tagit.js" />
<Content Include="Styles\admin-taxonomy-tags.css" />
<Content Include="Styles\images\menu.taxonomies.png" />
<Content Include="Styles\menu.taxonomies-admin.css" />
<Content Include="Styles\ui-anim_basic_16x16.gif" />
<Content Include="Views\Admin\Import.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Styles\admin-taxonomy.css" />
<Content Include="Module.txt" />
<Content Include="Views\Admin\Edit.cshtml" />
<Content Include="Views\Admin\Create.cshtml" />
<Content Include="Views\Admin\Index.cshtml" />
<Content Include="Views\DefinitionTemplates\TaxonomyFieldSettings.cshtml" />
<Content Include="Views\Fields\TaxonomyField.cshtml" />
<Content Include="Views\EditorTemplates\Parts\Taxonomies.Term.Fields.cshtml" />
<Content Include="Views\Items\Content-Term.Edit.cshtml" />
<Content Include="Views\TermAdmin\Create.cshtml" />
<Content Include="Views\TermAdmin\Edit.cshtml" />
<Content Include="Views\TermAdmin\Index.cshtml" />
</ItemGroup>
<ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E649EA64-D213-461B-87F7-D67035801443}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.Taxonomies</RootNamespace>
<AssemblyName>Orchard.Taxonomies</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>false</UseIISExpress>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>4.0</OldToolsVersion>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AdminMenu.cs" />
<Compile Include="Controllers\AdminController.cs" />
<Compile Include="Controllers\TermAdminController.cs" />
<Compile Include="Drivers\TaxonomyNavigationPartDriver.cs" />
<Compile Include="Drivers\TermsPartDriver.cs" />
<Compile Include="Drivers\TaxonomyPartDriver.cs" />
<Compile Include="Handlers\TaxonomyPartHandler.cs" />
<Compile Include="Handlers\TermsPartHandler.cs" />
<Compile Include="Helpers\PathExtensions.cs" />
<Compile Include="Migrations.cs" />
<Compile Include="Drivers\TermPartDriver.cs" />
<Compile Include="Drivers\TaxonomyFieldDriver.cs" />
<Compile Include="Handlers\TermPartHandler.cs" />
<Compile Include="Helpers\PredicateBuilder.cs" />
<Compile Include="Models\TaxonomyNavigationPart.cs" />
<Compile Include="Models\TermContentItemPart.cs" />
<Compile Include="Models\TaxonomyPartRecord.cs" />
<Compile Include="Models\TermPart.cs" />
<Compile Include="Models\TermPartNode.cs" />
<Compile Include="Models\TermPartRecord.cs" />
<Compile Include="Models\TaxonomyPart.cs" />
<Compile Include="Models\TermContentItem.cs" />
<Compile Include="Models\TermsPart.cs" />
<Compile Include="Models\TermsPartRecord.cs" />
<Compile Include="Navigation\TaxonomyNavigationProvider.cs" />
<Compile Include="Permissions.cs" />
<Compile Include="Projections\TermsFilter.cs" />
<Compile Include="Projections\TermsFilterForms.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Fields\TaxonomyField.cs" />
<Compile Include="Services\ITaxonomyService.cs" />
<Compile Include="Services\TaxonomyService.cs" />
<Compile Include="Settings\TermPartEditorEvents.cs" />
<Compile Include="Settings\TaxonomyFieldEditorEvents.cs" />
<Compile Include="Settings\TermPartSettings.cs" />
<Compile Include="Settings\TaxonomyFieldSettings.cs" />
<Compile Include="Shapes.cs" />
<Compile Include="StandardQueries\TermFeedQuery.cs" />
<Compile Include="Tokens\TaxonomyTokens.cs" />
<Compile Include="ViewModels\ImportViewModel.cs" />
<Compile Include="ViewModels\MergeTermViewModel.cs" />
<Compile Include="ViewModels\MoveTermViewModel.cs" />
<Compile Include="ViewModels\SelectTermViewModel.cs" />
<Compile Include="ViewModels\TaxonomyFieldViewModel.cs" />
<Compile Include="ViewModels\TermAdminIndexViewModel.cs" />
<Compile Include="ViewModels\TaxonomyAdminIndexViewModel.cs" />
<Compile Include="ViewModels\TaxonomyNavigationViewModel.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Scripts\admin-taxonomy-expando.js" />
<Content Include="Scripts\admin-taxonomy-field-settings.js" />
<Content Include="Scripts\admin-taxonomy-tags.js" />
<Content Include="Scripts\tagit.js" />
<Content Include="Styles\admin-taxonomy-tags.css" />
<Content Include="Styles\images\menu.taxonomies.png" />
<Content Include="Styles\menu.taxonomies-admin.css" />
<Content Include="Styles\ui-anim_basic_16x16.gif" />
<Content Include="Views\Admin\Import.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Styles\admin-taxonomy.css" />
<Content Include="Module.txt" />
<Content Include="Views\Admin\Edit.cshtml" />
<Content Include="Views\Admin\Create.cshtml" />
<Content Include="Views\Admin\Index.cshtml" />
<Content Include="Views\DefinitionTemplates\TaxonomyFieldSettings.cshtml" />
<Content Include="Views\Fields\TaxonomyField.cshtml" />
<Content Include="Views\EditorTemplates\Parts\Taxonomies.Term.Fields.cshtml" />
<Content Include="Views\Items\Content-Term.Edit.cshtml" />
<Content Include="Views\TermAdmin\Create.cshtml" />
<Content Include="Views\TermAdmin\Edit.cshtml" />
<Content Include="Views\TermAdmin\Index.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Web.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Placement.info">
<SubType>Designer</SubType>
</Content>
<Content Include="Styles\Web.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Views\TermAdmin\RenderTermSelect.cshtml" />
<Content Include="Views\TermAdmin\MoveTerm.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Home\List.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Scripts\Web.config">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Views\TermAdmin\SelectTerm.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="web.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
<Project>{2d1d92bb-4555-4cbe-8d0e-63563d6ce4c6}</Project>
<Name>Orchard.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\..\Core\Orchard.Core.csproj">
<Project>{9916839c-39fc-4ceb-a5af-89ca7e87119f}</Project>
<Name>Orchard.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.Alias\Orchard.Alias.csproj">
<Project>{475b6c45-b27c-438b-8966-908b9d6d1077}</Project>
<Name>Orchard.Alias</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.Autoroute\Orchard.Autoroute.csproj">
<Project>{66fccd76-2761-47e3-8d11-b45d0001ddaa}</Project>
<Name>Orchard.Autoroute</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.Tokens\Orchard.Tokens.csproj">
<Project>{6f759635-13d7-4e94-bcc9-80445d63f117}</Project>
<Name>Orchard.Tokens</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Views\EditorTemplates\Fields\TaxonomyField.Autocomplete.cshtml" />
<Content Include="Views\EditorTemplates\Fields\TaxonomyField.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\TermAdmin\Merge.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Parts.TaxonomyPart.cshtml">
<SubType>Code</SubType>
</Content>
<Content Include="Views\Parts.TermPart.cshtml" />
<Content Include="Views\Taxonomy.cshtml" />
<Content Include="Views\TaxonomyItem.cshtml" />
<Content Include="Views\TaxonomyItemLink.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\EditorTemplates\Parts\Navigation.Taxonomy.Edit.cshtml" />
</ItemGroup>
<ItemGroup />
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<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">
</Target> -->
<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)" />
</Target>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>2078</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>
</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>True</UseCustomServer>
<CustomServerUrl>http://orchard.codeplex.com</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Content Include="Placement.info">
<SubType>Designer</SubType>
</Content>
<Content Include="Styles\Web.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Views\TermAdmin\RenderTermSelect.cshtml" />
<Content Include="Views\TermAdmin\MoveTerm.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Home\List.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Scripts\Web.config">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Views\TermAdmin\SelectTerm.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="web.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
<Project>{2d1d92bb-4555-4cbe-8d0e-63563d6ce4c6}</Project>
<Name>Orchard.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\..\Core\Orchard.Core.csproj">
<Project>{9916839c-39fc-4ceb-a5af-89ca7e87119f}</Project>
<Name>Orchard.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.Alias\Orchard.Alias.csproj">
<Project>{475b6c45-b27c-438b-8966-908b9d6d1077}</Project>
<Name>Orchard.Alias</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.Autoroute\Orchard.Autoroute.csproj">
<Project>{66fccd76-2761-47e3-8d11-b45d0001ddaa}</Project>
<Name>Orchard.Autoroute</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.Tokens\Orchard.Tokens.csproj">
<Project>{6f759635-13d7-4e94-bcc9-80445d63f117}</Project>
<Name>Orchard.Tokens</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Views\EditorTemplates\Fields\TaxonomyField.Autocomplete.cshtml" />
<Content Include="Views\EditorTemplates\Fields\TaxonomyField.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\TermAdmin\Merge.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Parts.TaxonomyPart.cshtml">
<SubType>Code</SubType>
</Content>
<Content Include="Views\Parts.TermPart.cshtml" />
<Content Include="Views\Taxonomy.cshtml" />
<Content Include="Views\TaxonomyItem.cshtml" />
<Content Include="Views\TaxonomyItemLink.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\EditorTemplates\Parts\Navigation.Taxonomy.Edit.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\DefinitionTemplates\TermPartSettings.cshtml" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<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">
</Target> -->
<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)" />
</Target>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>2078</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>
</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>True</UseCustomServer>
<CustomServerUrl>http://orchard.codeplex.com</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>

View File

@@ -0,0 +1,32 @@
using System.Collections.Generic;
using Orchard.ContentManagement;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData.Builders;
using Orchard.ContentManagement.MetaData.Models;
using Orchard.ContentManagement.ViewModels;
namespace Orchard.Taxonomies.Settings {
public class TermPartEditorEvents : ContentDefinitionEditorEventsBase {
public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
if (definition.PartDefinition.Name == "TermPart") {
var model = definition.Settings.GetModel<TermPartSettings>();
yield return DefinitionTemplate(model);
}
}
public override IEnumerable<TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel) {
if (builder.Name != "TermPart") {
yield break;
}
var model = new TermPartSettings();
if (updateModel.TryUpdateModel(model, "TermPartSettings", null, null)) {
builder
.WithSetting("TermPartSettings.ChildDisplayType", model.ChildDisplayType);
}
yield return DefinitionTemplate(model);
}
}
}

View File

@@ -0,0 +1,8 @@
namespace Orchard.Taxonomies.Settings {
public class TermPartSettings {
/// <summary>
/// The display type to use for the child items of the term.
/// </summary>
public string ChildDisplayType { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
@model Orchard.Taxonomies.Settings.TermPartSettings
<fieldset>
<label for="@Html.FieldIdFor(m => m.ChildDisplayType)">@T("Child display type")</label>
@Html.TextBoxFor(m => m.ChildDisplayType, new { @class = "text medium" })
<span class="hint">@T("The display type to apply to child items when displaying the details of this taxonomy term.")</span>
@Html.ValidationMessageFor(m => m.ChildDisplayType)
</fieldset>