Added ContentType metadata feature to allow dynamic mapping.

--HG--
branch : dev
This commit is contained in:
khavas
2010-05-18 13:08:47 -07:00
parent 6fb9d48666
commit 5667e6a999
20 changed files with 425 additions and 12 deletions

View File

@@ -3,6 +3,9 @@ using System.Linq;
using System.Web;
using Orchard.Comments.Models;
using Orchard.ContentManagement;
using Orchard.ContentManagement.MetaData.Models;
using Orchard.ContentManagement.MetaData.Records;
using Orchard.ContentManagement.Records;
using Orchard.Core.Common.Models;
using Orchard.Core.Navigation.Models;
using Orchard.Core.Settings.Models;
@@ -14,6 +17,7 @@ using Orchard.Environment.ShellBuilders;
using Orchard.Environment.Topology;
using Orchard.Environment.Topology.Models;
using Orchard.Localization;
using Orchard.ContentManagement.MetaData.Services;
using Orchard.Security;
using Orchard.Settings;
using Orchard.Themes;
@@ -159,6 +163,24 @@ namespace Orchard.Setup.Services {
var authenticationService = environment.Resolve<IAuthenticationService>();
authenticationService.SignIn(user, true);
}
//Add ContentType mappings
var contentTypeService = environment.Resolve<IContentTypeService>();
//Add ContentTypePartNames to MetaData
contentTypeService.AddContentTypePartNameToMetaData("HasComments");
contentTypeService.AddContentTypePartNameToMetaData("HasTags");
//Add mappings from ContentTypes to ContentParts to MetaData
contentTypeService.MapContentTypeToContentPart("blogpost","HasComments");
contentTypeService.MapContentTypeToContentPart("page", "HasComments");
contentTypeService.MapContentTypeToContentPart("sandboxpage", "HasComments");
contentTypeService.MapContentTypeToContentPart("blogpost", "HasTags");
contentTypeService.MapContentTypeToContentPart("page", "HasTags");
contentTypeService.MapContentTypeToContentPart("sandboxpage", "HasTags");
}
catch {
environment.Resolve<ITransactionManager>().Cancel();