mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-20 02:37:55 +08:00
Shifting ContentType editing into dedicated module
Orchard.ContentTypes module added Updating actionlink strings in views Adjusting actionview names in contenttypes/admin controller EditType to Edit, and CreateType to Create --HG-- branch : dev
This commit is contained in:
@@ -21,7 +21,7 @@ namespace Orchard.Core.Contents {
|
|||||||
var contentTypeDefinitions = _contentDefinitionManager.ListTypeDefinitions().OrderBy(d => d.Name);
|
var contentTypeDefinitions = _contentDefinitionManager.ListTypeDefinitions().OrderBy(d => d.Name);
|
||||||
|
|
||||||
builder.Add(T("Content"), "1", menu => {
|
builder.Add(T("Content"), "1", menu => {
|
||||||
menu.Add(T("Manage Content"), "1.2", item => item.Action("List", "Admin", new {area = "Contents"}));
|
menu.Add(T("Manage Content"), "1.2", item => item.Action("List", "Admin", new {area = "Orchard.ContentTypes"}));
|
||||||
//foreach (var contentTypeDefinition in contentTypeDefinitions) {
|
//foreach (var contentTypeDefinition in contentTypeDefinitions) {
|
||||||
// var ci = _contentManager.New(contentTypeDefinition.Name);
|
// var ci = _contentManager.New(contentTypeDefinition.Name);
|
||||||
// var cim = _contentManager.GetItemMetadata(ci);
|
// var cim = _contentManager.GetItemMetadata(ci);
|
||||||
@@ -30,8 +30,6 @@ namespace Orchard.Core.Contents {
|
|||||||
// menu.Add(T("Create New {0}", contentTypeDefinition.DisplayName), "1.3", item => item.Action(cim.CreateRouteValues["Action"] as string, cim.CreateRouteValues["Controller"] as string, cim.CreateRouteValues));
|
// menu.Add(T("Create New {0}", contentTypeDefinition.DisplayName), "1.3", item => item.Action(cim.CreateRouteValues["Action"] as string, cim.CreateRouteValues["Controller"] as string, cim.CreateRouteValues));
|
||||||
//}
|
//}
|
||||||
});
|
});
|
||||||
builder.Add(T("Site Configuration"), "11",
|
|
||||||
menu => menu.Add(T("Content Types"), "3", item => item.Action("Index", "Admin", new { area = "Contents" })));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -4,8 +4,8 @@ using System.Linq;
|
|||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
|
using Orchard.ContentManagement.MetaData;
|
||||||
using Orchard.ContentManagement.MetaData.Models;
|
using Orchard.ContentManagement.MetaData.Models;
|
||||||
using Orchard.Core.Contents.Services;
|
|
||||||
using Orchard.Core.Contents.ViewModels;
|
using Orchard.Core.Contents.ViewModels;
|
||||||
using Orchard.Data;
|
using Orchard.Data;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
@@ -18,20 +18,20 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
[ValidateInput(false)]
|
[ValidateInput(false)]
|
||||||
public class AdminController : Controller, IUpdateModel {
|
public class AdminController : Controller, IUpdateModel {
|
||||||
private readonly INotifier _notifier;
|
private readonly INotifier _notifier;
|
||||||
private readonly IContentDefinitionService _contentDefinitionService;
|
|
||||||
private readonly IContentManager _contentManager;
|
private readonly IContentManager _contentManager;
|
||||||
|
private readonly IContentDefinitionManager _contentDefinitionManager;
|
||||||
private readonly ITransactionManager _transactionManager;
|
private readonly ITransactionManager _transactionManager;
|
||||||
|
|
||||||
public AdminController(
|
public AdminController(
|
||||||
IOrchardServices orchardServices,
|
IOrchardServices orchardServices,
|
||||||
INotifier notifier,
|
INotifier notifier,
|
||||||
IContentDefinitionService contentDefinitionService,
|
|
||||||
IContentManager contentManager,
|
IContentManager contentManager,
|
||||||
|
IContentDefinitionManager contentDefinitionManager,
|
||||||
ITransactionManager transactionManager) {
|
ITransactionManager transactionManager) {
|
||||||
Services = orchardServices;
|
Services = orchardServices;
|
||||||
_notifier = notifier;
|
_notifier = notifier;
|
||||||
_contentDefinitionService = contentDefinitionService;
|
|
||||||
_contentManager = contentManager;
|
_contentManager = contentManager;
|
||||||
|
_contentDefinitionManager = contentDefinitionManager;
|
||||||
_transactionManager = transactionManager;
|
_transactionManager = transactionManager;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
Logger = NullLogger.Instance;
|
Logger = NullLogger.Instance;
|
||||||
@@ -41,244 +41,6 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
public ILogger Logger { get; set; }
|
public ILogger Logger { get; set; }
|
||||||
|
|
||||||
#region Types
|
|
||||||
|
|
||||||
public ActionResult Index() {
|
|
||||||
return Types();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActionResult Types() {
|
|
||||||
return View("Types", new ListContentTypesViewModel {
|
|
||||||
Types = _contentDefinitionService.GetTypeDefinitions()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActionResult CreateType() {
|
|
||||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to create a content type.")))
|
|
||||||
return new HttpUnauthorizedResult();
|
|
||||||
|
|
||||||
return View(new CreateTypeViewModel());
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost, ActionName("CreateType")]
|
|
||||||
public ActionResult CreateTypePOST(CreateTypeViewModel viewModel) {
|
|
||||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to create a content type.")))
|
|
||||||
return new HttpUnauthorizedResult();
|
|
||||||
|
|
||||||
var model = new ContentTypeDefinition("");
|
|
||||||
TryUpdateModel(model);
|
|
||||||
|
|
||||||
if (!ModelState.IsValid) {
|
|
||||||
Services.TransactionManager.Cancel();
|
|
||||||
return View(viewModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
_contentDefinitionService.AddTypeDefinition(model);
|
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActionResult EditType(string id) {
|
|
||||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content type.")))
|
|
||||||
return new HttpUnauthorizedResult();
|
|
||||||
|
|
||||||
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(id);
|
|
||||||
|
|
||||||
if (contentTypeDefinition == null)
|
|
||||||
return new NotFoundResult();
|
|
||||||
|
|
||||||
return View(new EditTypeViewModel(contentTypeDefinition));
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost, ActionName("EditType")]
|
|
||||||
public ActionResult EditTypePOST(string id) {
|
|
||||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content type.")))
|
|
||||||
return new HttpUnauthorizedResult();
|
|
||||||
|
|
||||||
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(id);
|
|
||||||
|
|
||||||
if (contentTypeDefinition == null)
|
|
||||||
return new NotFoundResult();
|
|
||||||
|
|
||||||
var viewModel = new EditTypeViewModel();
|
|
||||||
TryUpdateModel(viewModel);
|
|
||||||
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
return EditType(id);
|
|
||||||
|
|
||||||
var contentTypeDefinitionParts = viewModel.Parts.Select(GenerateTypePart).ToList();
|
|
||||||
if (viewModel.Fields.Any())
|
|
||||||
contentTypeDefinitionParts.Add(GenerateTypePart(viewModel));
|
|
||||||
|
|
||||||
//todo: apply the changes along the lines of but definately not resembling
|
|
||||||
// for now this _might_ just get a little messy ->
|
|
||||||
_contentDefinitionService.AlterTypeDefinition(
|
|
||||||
new ContentTypeDefinition(
|
|
||||||
viewModel.Name,
|
|
||||||
viewModel.DisplayName,
|
|
||||||
contentTypeDefinitionParts,
|
|
||||||
viewModel.Settings
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ContentTypeDefinition.Part GenerateTypePart(EditTypePartViewModel viewModel) {
|
|
||||||
return new ContentTypeDefinition.Part(
|
|
||||||
new ContentPartDefinition(
|
|
||||||
viewModel.PartDefinition.Name,
|
|
||||||
viewModel.PartDefinition.Fields.Select(
|
|
||||||
f => new ContentPartDefinition.Field(
|
|
||||||
new ContentFieldDefinition(f.FieldDefinition.Name),
|
|
||||||
f.Name,
|
|
||||||
f.Settings
|
|
||||||
)
|
|
||||||
),
|
|
||||||
viewModel.PartDefinition.Settings
|
|
||||||
),
|
|
||||||
viewModel.Settings
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ContentTypeDefinition.Part GenerateTypePart(EditTypeViewModel viewModel) {
|
|
||||||
return new ContentTypeDefinition.Part(
|
|
||||||
new ContentPartDefinition(
|
|
||||||
viewModel.Name,
|
|
||||||
viewModel.Fields.Select(
|
|
||||||
f => new ContentPartDefinition.Field(
|
|
||||||
new ContentFieldDefinition(f.FieldDefinition.Name),
|
|
||||||
f.Name,
|
|
||||||
f.Settings
|
|
||||||
)
|
|
||||||
),
|
|
||||||
null
|
|
||||||
),
|
|
||||||
null
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Parts
|
|
||||||
|
|
||||||
public ActionResult EditPart(string id) {
|
|
||||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a part.")))
|
|
||||||
return new HttpUnauthorizedResult();
|
|
||||||
|
|
||||||
var contentPartDefinition = _contentDefinitionService.GetPartDefinition(id);
|
|
||||||
|
|
||||||
if (contentPartDefinition == null)
|
|
||||||
return new NotFoundResult();
|
|
||||||
|
|
||||||
return View(new EditPartViewModel(contentPartDefinition));
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost, ActionName("EditPart")]
|
|
||||||
public ActionResult EditPartPOST(string id) {
|
|
||||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a part.")))
|
|
||||||
return new HttpUnauthorizedResult();
|
|
||||||
|
|
||||||
var contentPartDefinition = _contentDefinitionService.GetPartDefinition(id);
|
|
||||||
|
|
||||||
if (contentPartDefinition == null)
|
|
||||||
return new NotFoundResult();
|
|
||||||
|
|
||||||
var viewModel = new EditPartViewModel();
|
|
||||||
TryUpdateModel(viewModel);
|
|
||||||
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
return EditPart(id);
|
|
||||||
|
|
||||||
//todo: apply the changes along the lines of but definately not resembling
|
|
||||||
// for now this _might_ just get a little messy ->
|
|
||||||
_contentDefinitionService.AlterPartDefinition(GeneratePart(viewModel));
|
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActionResult AddFieldTo(string id) {
|
|
||||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a part.")))
|
|
||||||
return new HttpUnauthorizedResult();
|
|
||||||
|
|
||||||
var contentPartDefinition = _contentDefinitionService.GetPartDefinition(id);
|
|
||||||
|
|
||||||
if (contentPartDefinition == null) {
|
|
||||||
//id passed in might be that of a type w/ no implicit field
|
|
||||||
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(id);
|
|
||||||
if (contentTypeDefinition != null)
|
|
||||||
contentPartDefinition = new ContentPartDefinition(id);
|
|
||||||
else
|
|
||||||
return new NotFoundResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
var viewModel = new AddFieldViewModel {
|
|
||||||
Part = new EditPartViewModel(contentPartDefinition),
|
|
||||||
Fields = _contentDefinitionService.GetFieldDefinitions()
|
|
||||||
};
|
|
||||||
|
|
||||||
return View(viewModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost, ActionName("AddFieldTo")]
|
|
||||||
public ActionResult AddFieldToPOST(string id) {
|
|
||||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a part.")))
|
|
||||||
return new HttpUnauthorizedResult();
|
|
||||||
|
|
||||||
var viewModel = new AddFieldViewModel();
|
|
||||||
TryUpdateModel(viewModel);
|
|
||||||
|
|
||||||
var contentPartDefinition = _contentDefinitionService.GetPartDefinition(id);
|
|
||||||
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(id);
|
|
||||||
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
return AddFieldTo(id);
|
|
||||||
|
|
||||||
if (contentPartDefinition == null) {
|
|
||||||
//id passed in might be that of a type w/ no implicit field
|
|
||||||
if (contentTypeDefinition != null) {
|
|
||||||
contentPartDefinition = new ContentPartDefinition(id);
|
|
||||||
var contentTypeDefinitionParts = contentTypeDefinition.Parts.ToList();
|
|
||||||
contentTypeDefinitionParts.Add(new ContentTypeDefinition.Part(contentPartDefinition, null));
|
|
||||||
_contentDefinitionService.AlterTypeDefinition(
|
|
||||||
new ContentTypeDefinition(
|
|
||||||
contentTypeDefinition.Name,
|
|
||||||
contentTypeDefinition.DisplayName,
|
|
||||||
contentTypeDefinitionParts,
|
|
||||||
contentTypeDefinition.Settings
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return new NotFoundResult();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var contentPartFields = contentPartDefinition.Fields.ToList();
|
|
||||||
contentPartFields.Add(new ContentPartDefinition.Field(new ContentFieldDefinition(viewModel.FieldTypeName), viewModel.DisplayName, null));
|
|
||||||
_contentDefinitionService.AlterPartDefinition(new ContentPartDefinition(contentPartDefinition.Name, contentPartFields, contentPartDefinition.Settings));
|
|
||||||
|
|
||||||
if (contentTypeDefinition != null)
|
|
||||||
return RedirectToAction("EditType", new { id });
|
|
||||||
|
|
||||||
return RedirectToAction("EditPart", new {id});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ContentPartDefinition GeneratePart(EditPartViewModel viewModel) {
|
|
||||||
return new ContentPartDefinition(
|
|
||||||
viewModel.Name,
|
|
||||||
viewModel.Fields.Select(
|
|
||||||
f => new ContentPartDefinition.Field(
|
|
||||||
new ContentFieldDefinition(f.FieldDefinition.Name),
|
|
||||||
f.Name,
|
|
||||||
f.Settings
|
|
||||||
)
|
|
||||||
),
|
|
||||||
viewModel.Settings
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Content
|
#region Content
|
||||||
|
|
||||||
@@ -321,7 +83,7 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
|
|
||||||
ActionResult CreatableTypeList() {
|
ActionResult CreatableTypeList() {
|
||||||
var model = new ListContentTypesViewModel {
|
var model = new ListContentTypesViewModel {
|
||||||
Types = _contentDefinitionService.GetTypeDefinitions()
|
Types = _contentDefinitionManager.ListTypeDefinitions()
|
||||||
};
|
};
|
||||||
|
|
||||||
return View("CreatableTypeList", model);
|
return View("CreatableTypeList", model);
|
||||||
|
@@ -1,9 +0,0 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ListContentTypesViewModel>" %>
|
|
||||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
|
|
||||||
<h1><%:Html.TitleForPage(T("Content Types").ToString())%></h1>
|
|
||||||
<div class="manage"><%: Html.ActionLink(T("Create new type").ToString(), "CreateType", null, new { @class = "button primaryAction" })%></div>
|
|
||||||
<%:Html.UnorderedList(
|
|
||||||
Model.Types,
|
|
||||||
(t,i) => Html.DisplayFor(m => t),
|
|
||||||
"contentItems"
|
|
||||||
) %>
|
|
@@ -73,12 +73,7 @@
|
|||||||
<Compile Include="Common\ViewModels\TextContentFieldEditorViewModel.cs" />
|
<Compile Include="Common\ViewModels\TextContentFieldEditorViewModel.cs" />
|
||||||
<Compile Include="Contents\Controllers\ItemController.cs" />
|
<Compile Include="Contents\Controllers\ItemController.cs" />
|
||||||
<Compile Include="Contents\Handlers\ContentsModuleHandler.cs" />
|
<Compile Include="Contents\Handlers\ContentsModuleHandler.cs" />
|
||||||
<Compile Include="Contents\Permissions.cs" />
|
<Compile Include="Contents\ViewModels\EditItemViewModel.cs" />
|
||||||
<Compile Include="Contents\Services\ContentDefinitionService.cs" />
|
|
||||||
<Compile Include="Contents\Services\IContentDefinitionService.cs" />
|
|
||||||
<Compile Include="Contents\ViewModels\AddFieldViewModel.cs" />
|
|
||||||
<Compile Include="Contents\ViewModels\EditTypeViewModel.cs" />
|
|
||||||
<Compile Include="Contents\ViewModels\CreateTypeViewModel.cs" />
|
|
||||||
<Compile Include="Contents\ViewModels\ListContentsViewModel.cs" />
|
<Compile Include="Contents\ViewModels\ListContentsViewModel.cs" />
|
||||||
<Compile Include="Contents\ViewModels\ListContentTypesViewModel.cs" />
|
<Compile Include="Contents\ViewModels\ListContentTypesViewModel.cs" />
|
||||||
<Compile Include="Localization\Drivers\LocalizedDriver.cs" />
|
<Compile Include="Localization\Drivers\LocalizedDriver.cs" />
|
||||||
@@ -108,7 +103,6 @@
|
|||||||
<Compile Include="Contents\AdminMenu.cs" />
|
<Compile Include="Contents\AdminMenu.cs" />
|
||||||
<Compile Include="Contents\Controllers\AdminController.cs" />
|
<Compile Include="Contents\Controllers\AdminController.cs" />
|
||||||
<Compile Include="Contents\ViewModels\CreateItemViewModel.cs" />
|
<Compile Include="Contents\ViewModels\CreateItemViewModel.cs" />
|
||||||
<Compile Include="Contents\ViewModels\EditItemViewModel.cs" />
|
|
||||||
<Compile Include="Dashboard\AdminMenu.cs" />
|
<Compile Include="Dashboard\AdminMenu.cs" />
|
||||||
<Compile Include="Dashboard\Controllers\AdminController.cs" />
|
<Compile Include="Dashboard\Controllers\AdminController.cs" />
|
||||||
<Compile Include="Dashboard\Routes.cs" />
|
<Compile Include="Dashboard\Routes.cs" />
|
||||||
@@ -208,25 +202,11 @@
|
|||||||
<Content Include="Common\Views\EditorTemplates\Parts\Common.Container.ascx" />
|
<Content Include="Common\Views\EditorTemplates\Parts\Common.Container.ascx" />
|
||||||
<Content Include="Contents\Module.txt" />
|
<Content Include="Contents\Module.txt" />
|
||||||
<Content Include="Contents\Styles\admin.css" />
|
<Content Include="Contents\Styles\admin.css" />
|
||||||
<Content Include="Contents\Views\Admin\AddFieldTo.ascx" />
|
|
||||||
<Content Include="Contents\Views\Admin\EditPart.ascx" />
|
|
||||||
<Content Include="Contents\Views\Admin\EditType.ascx" />
|
|
||||||
<Content Include="Contents\Views\Admin\CreateType.ascx" />
|
|
||||||
<Content Include="Contents\Views\Admin\Types.ascx" />
|
|
||||||
<Content Include="Contents\Views\Admin\List.aspx" />
|
<Content Include="Contents\Views\Admin\List.aspx" />
|
||||||
<Content Include="Contents\Views\Admin\Edit.aspx" />
|
<Content Include="Contents\Views\Admin\Edit.aspx" />
|
||||||
<Content Include="Contents\Views\Admin\CreatableTypeList.aspx" />
|
<Content Include="Contents\Views\Admin\CreatableTypeList.aspx" />
|
||||||
<Content Include="Contents\Views\Admin\Create.aspx" />
|
<Content Include="Contents\Views\Admin\Create.aspx" />
|
||||||
<Content Include="Contents\Views\DisplayTemplates\ContentTypeDefinition.ascx" />
|
|
||||||
<Content Include="Contents\Views\DisplayTemplates\Items\Contents.Item.ascx" />
|
<Content Include="Contents\Views\DisplayTemplates\Items\Contents.Item.ascx" />
|
||||||
<Content Include="Contents\Views\DisplayTemplates\Settings.ascx" />
|
|
||||||
<Content Include="Contents\Views\EditorTemplates\Field.ascx" />
|
|
||||||
<Content Include="Contents\Views\EditorTemplates\Fields.ascx" />
|
|
||||||
<Content Include="Contents\Views\EditorTemplates\Settings.ascx" />
|
|
||||||
<Content Include="Contents\Views\DisplayTemplates\Fields.ascx" />
|
|
||||||
<Content Include="Contents\Views\DisplayTemplates\Field.ascx" />
|
|
||||||
<Content Include="Contents\Views\EditorTemplates\Parts.ascx" />
|
|
||||||
<Content Include="Contents\Views\EditorTemplates\Part.ascx" />
|
|
||||||
<Content Include="Contents\Views\EditorTemplates\Items\Contents.Item.ascx" />
|
<Content Include="Contents\Views\EditorTemplates\Items\Contents.Item.ascx" />
|
||||||
<Content Include="Contents\Views\Item\Preview.aspx" />
|
<Content Include="Contents\Views\Item\Preview.aspx" />
|
||||||
<Content Include="Contents\Views\Item\Display.aspx" />
|
<Content Include="Contents\Views\Item\Display.aspx" />
|
||||||
|
16
src/Orchard.Web/Modules/Orchard.ContentTypes/AdminMenu.cs
Normal file
16
src/Orchard.Web/Modules/Orchard.ContentTypes/AdminMenu.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using Orchard.Localization;
|
||||||
|
using Orchard.UI.Navigation;
|
||||||
|
|
||||||
|
namespace Orchard.ContentTypes {
|
||||||
|
public class AdminMenu : INavigationProvider {
|
||||||
|
|
||||||
|
public Localizer T { get; set; }
|
||||||
|
public string MenuName { get { return "admin"; } }
|
||||||
|
|
||||||
|
public void GetNavigation(NavigationBuilder builder) {
|
||||||
|
|
||||||
|
builder.Add(T("Site Configuration"), "11",
|
||||||
|
menu => menu.Add(T("Content Types"), "3", item => item.Action("Index", "Admin", new { area = "Orchard.ContentTypes" })));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,277 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
using Orchard.ContentManagement;
|
||||||
|
using Orchard.ContentManagement.MetaData.Models;
|
||||||
|
using Orchard.ContentTypes.Services;
|
||||||
|
using Orchard.ContentTypes.ViewModels;
|
||||||
|
using Orchard.Data;
|
||||||
|
using Orchard.Localization;
|
||||||
|
using Orchard.Logging;
|
||||||
|
using Orchard.Mvc.Results;
|
||||||
|
using Orchard.UI.Notify;
|
||||||
|
|
||||||
|
namespace Orchard.ContentTypes.Controllers {
|
||||||
|
public class AdminController : Controller {
|
||||||
|
private readonly INotifier _notifier;
|
||||||
|
private readonly IContentDefinitionService _contentDefinitionService;
|
||||||
|
private readonly IContentManager _contentManager;
|
||||||
|
private readonly ITransactionManager _transactionManager;
|
||||||
|
|
||||||
|
public AdminController(
|
||||||
|
IOrchardServices orchardServices,
|
||||||
|
INotifier notifier,
|
||||||
|
IContentDefinitionService contentDefinitionService,
|
||||||
|
IContentManager contentManager,
|
||||||
|
ITransactionManager transactionManager) {
|
||||||
|
Services = orchardServices;
|
||||||
|
_notifier = notifier;
|
||||||
|
_contentDefinitionService = contentDefinitionService;
|
||||||
|
_contentManager = contentManager;
|
||||||
|
_transactionManager = transactionManager;
|
||||||
|
T = NullLocalizer.Instance;
|
||||||
|
Logger = NullLogger.Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IOrchardServices Services { get; private set; }
|
||||||
|
public Localizer T { get; set; }
|
||||||
|
public ILogger Logger { get; set; }
|
||||||
|
public ActionResult Index() {
|
||||||
|
return List();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Types
|
||||||
|
|
||||||
|
public ActionResult List() {
|
||||||
|
return View("List", new ListContentTypesViewModel {
|
||||||
|
Types = _contentDefinitionService.GetTypeDefinitions()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionResult Create() {
|
||||||
|
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to create a content type.")))
|
||||||
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
|
return View(new CreateTypeViewModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost, ActionName("Create")]
|
||||||
|
public ActionResult CreatePOST(CreateTypeViewModel viewModel) {
|
||||||
|
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to create a content type.")))
|
||||||
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
|
var model = new ContentTypeDefinition("");
|
||||||
|
TryUpdateModel(model);
|
||||||
|
|
||||||
|
if (!ModelState.IsValid) {
|
||||||
|
Services.TransactionManager.Cancel();
|
||||||
|
return View(viewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
_contentDefinitionService.AddTypeDefinition(model);
|
||||||
|
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionResult Edit(string id) {
|
||||||
|
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content type.")))
|
||||||
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
|
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(id);
|
||||||
|
|
||||||
|
if (contentTypeDefinition == null)
|
||||||
|
return new NotFoundResult();
|
||||||
|
|
||||||
|
return View(new EditTypeViewModel(contentTypeDefinition));
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost, ActionName("Edit")]
|
||||||
|
public ActionResult EditPOST(string id) {
|
||||||
|
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content type.")))
|
||||||
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
|
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(id);
|
||||||
|
|
||||||
|
if (contentTypeDefinition == null)
|
||||||
|
return new NotFoundResult();
|
||||||
|
|
||||||
|
var viewModel = new EditTypeViewModel();
|
||||||
|
TryUpdateModel(viewModel);
|
||||||
|
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
return Edit(id);
|
||||||
|
|
||||||
|
var contentTypeDefinitionParts = viewModel.Parts.Select(GenerateTypePart).ToList();
|
||||||
|
if (viewModel.Fields.Any())
|
||||||
|
contentTypeDefinitionParts.Add(GenerateTypePart(viewModel));
|
||||||
|
|
||||||
|
//todo: apply the changes along the lines of but definately not resembling
|
||||||
|
// for now this _might_ just get a little messy ->
|
||||||
|
_contentDefinitionService.AlterTypeDefinition(
|
||||||
|
new ContentTypeDefinition(
|
||||||
|
viewModel.Name,
|
||||||
|
viewModel.DisplayName,
|
||||||
|
contentTypeDefinitionParts,
|
||||||
|
viewModel.Settings
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ContentTypeDefinition.Part GenerateTypePart(EditTypePartViewModel viewModel) {
|
||||||
|
return new ContentTypeDefinition.Part(
|
||||||
|
new ContentPartDefinition(
|
||||||
|
viewModel.PartDefinition.Name,
|
||||||
|
viewModel.PartDefinition.Fields.Select(
|
||||||
|
f => new ContentPartDefinition.Field(
|
||||||
|
new ContentFieldDefinition(f.FieldDefinition.Name),
|
||||||
|
f.Name,
|
||||||
|
f.Settings
|
||||||
|
)
|
||||||
|
),
|
||||||
|
viewModel.PartDefinition.Settings
|
||||||
|
),
|
||||||
|
viewModel.Settings
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ContentTypeDefinition.Part GenerateTypePart(EditTypeViewModel viewModel) {
|
||||||
|
return new ContentTypeDefinition.Part(
|
||||||
|
new ContentPartDefinition(
|
||||||
|
viewModel.Name,
|
||||||
|
viewModel.Fields.Select(
|
||||||
|
f => new ContentPartDefinition.Field(
|
||||||
|
new ContentFieldDefinition(f.FieldDefinition.Name),
|
||||||
|
f.Name,
|
||||||
|
f.Settings
|
||||||
|
)
|
||||||
|
),
|
||||||
|
null
|
||||||
|
),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Parts
|
||||||
|
|
||||||
|
public ActionResult EditPart(string id) {
|
||||||
|
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a part.")))
|
||||||
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
|
var contentPartDefinition = _contentDefinitionService.GetPartDefinition(id);
|
||||||
|
|
||||||
|
if (contentPartDefinition == null)
|
||||||
|
return new NotFoundResult();
|
||||||
|
|
||||||
|
return View(new EditPartViewModel(contentPartDefinition));
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost, ActionName("EditPart")]
|
||||||
|
public ActionResult EditPartPOST(string id) {
|
||||||
|
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a part.")))
|
||||||
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
|
var contentPartDefinition = _contentDefinitionService.GetPartDefinition(id);
|
||||||
|
|
||||||
|
if (contentPartDefinition == null)
|
||||||
|
return new NotFoundResult();
|
||||||
|
|
||||||
|
var viewModel = new EditPartViewModel();
|
||||||
|
TryUpdateModel(viewModel);
|
||||||
|
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
return EditPart(id);
|
||||||
|
|
||||||
|
//todo: apply the changes along the lines of but definately not resembling
|
||||||
|
// for now this _might_ just get a little messy ->
|
||||||
|
_contentDefinitionService.AlterPartDefinition(GeneratePart(viewModel));
|
||||||
|
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionResult AddFieldTo(string id) {
|
||||||
|
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a part.")))
|
||||||
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
|
var contentPartDefinition = _contentDefinitionService.GetPartDefinition(id);
|
||||||
|
|
||||||
|
if (contentPartDefinition == null) {
|
||||||
|
//id passed in might be that of a type w/ no implicit field
|
||||||
|
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(id);
|
||||||
|
if (contentTypeDefinition != null)
|
||||||
|
contentPartDefinition = new ContentPartDefinition(id);
|
||||||
|
else
|
||||||
|
return new NotFoundResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
var viewModel = new AddFieldViewModel {
|
||||||
|
Part = new EditPartViewModel(contentPartDefinition),
|
||||||
|
Fields = _contentDefinitionService.GetFieldDefinitions()
|
||||||
|
};
|
||||||
|
|
||||||
|
return View(viewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost, ActionName("AddFieldTo")]
|
||||||
|
public ActionResult AddFieldToPOST(string id) {
|
||||||
|
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a part.")))
|
||||||
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
|
var viewModel = new AddFieldViewModel();
|
||||||
|
TryUpdateModel(viewModel);
|
||||||
|
|
||||||
|
var contentPartDefinition = _contentDefinitionService.GetPartDefinition(id);
|
||||||
|
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(id);
|
||||||
|
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
return AddFieldTo(id);
|
||||||
|
|
||||||
|
if (contentPartDefinition == null) {
|
||||||
|
//id passed in might be that of a type w/ no implicit field
|
||||||
|
if (contentTypeDefinition != null) {
|
||||||
|
contentPartDefinition = new ContentPartDefinition(id);
|
||||||
|
var contentTypeDefinitionParts = contentTypeDefinition.Parts.ToList();
|
||||||
|
contentTypeDefinitionParts.Add(new ContentTypeDefinition.Part(contentPartDefinition, null));
|
||||||
|
_contentDefinitionService.AlterTypeDefinition(
|
||||||
|
new ContentTypeDefinition(
|
||||||
|
contentTypeDefinition.Name,
|
||||||
|
contentTypeDefinition.DisplayName,
|
||||||
|
contentTypeDefinitionParts,
|
||||||
|
contentTypeDefinition.Settings
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return new NotFoundResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var contentPartFields = contentPartDefinition.Fields.ToList();
|
||||||
|
contentPartFields.Add(new ContentPartDefinition.Field(new ContentFieldDefinition(viewModel.FieldTypeName), viewModel.DisplayName, null));
|
||||||
|
_contentDefinitionService.AlterPartDefinition(new ContentPartDefinition(contentPartDefinition.Name, contentPartFields, contentPartDefinition.Settings));
|
||||||
|
|
||||||
|
if (contentTypeDefinition != null)
|
||||||
|
return RedirectToAction("Edit", new { id });
|
||||||
|
|
||||||
|
return RedirectToAction("EditPart", new { id });
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ContentPartDefinition GeneratePart(EditPartViewModel viewModel) {
|
||||||
|
return new ContentPartDefinition(
|
||||||
|
viewModel.Name,
|
||||||
|
viewModel.Fields.Select(
|
||||||
|
f => new ContentPartDefinition.Field(
|
||||||
|
new ContentFieldDefinition(f.FieldDefinition.Name),
|
||||||
|
f.Name,
|
||||||
|
f.Settings
|
||||||
|
)
|
||||||
|
),
|
||||||
|
viewModel.Settings
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
10
src/Orchard.Web/Modules/Orchard.ContentTypes/Module.txt
Normal file
10
src/Orchard.Web/Modules/Orchard.ContentTypes/Module.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
name: ContentTypes
|
||||||
|
antiforgery: enabled
|
||||||
|
author: The Orchard Team
|
||||||
|
website: http://orchardproject.net
|
||||||
|
version: 0.1
|
||||||
|
orchardversion: 0.1.2010.0312
|
||||||
|
features:
|
||||||
|
Orchard.ContentTypes:
|
||||||
|
Description: ContentTypes modules enables the creation and alteration of content types not based on code.
|
||||||
|
Category: Developer
|
@@ -0,0 +1,146 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProductVersion>
|
||||||
|
</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{0E7646E8-FE8F-43C1-8799-D97860925EC4}</ProjectGuid>
|
||||||
|
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Orchard.ContentTypes</RootNamespace>
|
||||||
|
<AssemblyName>Orchard.ContentTypes</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
|
<MvcBuildViews>false</MvcBuildViews>
|
||||||
|
</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.Data" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Web.DynamicData" />
|
||||||
|
<Reference Include="System.Web.Entity" />
|
||||||
|
<Reference Include="System.Web.ApplicationServices" />
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Core">
|
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Data.DataSetExtensions">
|
||||||
|
<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.Extensions">
|
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web.Abstractions" />
|
||||||
|
<Reference Include="System.Web.Routing" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Web.Services" />
|
||||||
|
<Reference Include="System.EnterpriseServices" />
|
||||||
|
<Reference Include="System.Web.Mobile" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="AdminMenu.cs" />
|
||||||
|
<Compile Include="Controllers\AdminController.cs" />
|
||||||
|
<Compile Include="Permissions.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Services\ContentDefinitionService.cs" />
|
||||||
|
<Compile Include="Services\IContentDefinitionService.cs" />
|
||||||
|
<Compile Include="ViewModels\AddFieldViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\CreateTypeViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\EditTypeViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\ListContentsViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\ListContentTypesViewModel.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Module.txt" />
|
||||||
|
<Content Include="Views\Admin\AddFieldTo.ascx" />
|
||||||
|
<Content Include="Views\Admin\Create.ascx" />
|
||||||
|
<Content Include="Views\Admin\EditPart.ascx" />
|
||||||
|
<Content Include="Views\Admin\Edit.ascx" />
|
||||||
|
<Content Include="Views\Admin\List.ascx" />
|
||||||
|
<Content Include="Views\DisplayTemplates\ContentTypeDefinition.ascx" />
|
||||||
|
<Content Include="Views\DisplayTemplates\Field.ascx" />
|
||||||
|
<Content Include="Views\DisplayTemplates\Fields.ascx" />
|
||||||
|
<Content Include="Views\DisplayTemplates\Settings.ascx" />
|
||||||
|
<Content Include="Views\EditorTemplates\Field.ascx" />
|
||||||
|
<Content Include="Views\EditorTemplates\Fields.ascx" />
|
||||||
|
<Content Include="Views\EditorTemplates\Part.ascx" />
|
||||||
|
<Content Include="Views\EditorTemplates\Parts.ascx" />
|
||||||
|
<Content Include="Views\EditorTemplates\Settings.ascx" />
|
||||||
|
<Content Include="Web.config" />
|
||||||
|
<Content Include="Web.Debug.config">
|
||||||
|
<DependentUpon>Web.config</DependentUpon>
|
||||||
|
</Content>
|
||||||
|
<Content Include="Web.Release.config">
|
||||||
|
<DependentUpon>Web.config</DependentUpon>
|
||||||
|
</Content>
|
||||||
|
<Content Include="Views\Web.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="App_Data\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
|
||||||
|
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
||||||
|
<Name>Orchard.Framework</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||||
|
<!-- 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>9983</DevelopmentServerPort>
|
||||||
|
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||||
|
<IISUrl>
|
||||||
|
</IISUrl>
|
||||||
|
<NTLMAuthentication>False</NTLMAuthentication>
|
||||||
|
<UseCustomServer>False</UseCustomServer>
|
||||||
|
<CustomServerUrl>
|
||||||
|
</CustomServerUrl>
|
||||||
|
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||||
|
</WebProjectProperties>
|
||||||
|
</FlavorProperties>
|
||||||
|
</VisualStudio>
|
||||||
|
</ProjectExtensions>
|
||||||
|
</Project>
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Orchard.Security.Permissions;
|
using Orchard.Security.Permissions;
|
||||||
|
|
||||||
namespace Orchard.Core.Contents {
|
namespace Orchard.ContentTypes {
|
||||||
public class Permissions : IPermissionProvider {
|
public class Permissions : IPermissionProvider {
|
||||||
public static readonly Permission CreateContentTypes = new Permission { Name = "CreateContentTypes", Description = "Create custom content types." };
|
public static readonly Permission CreateContentTypes = new Permission { Name = "CreateContentTypes", Description = "Create custom content types." };
|
||||||
public static readonly Permission EditContentTypes = new Permission { Name = "EditContentTypes", Description = "Edit content types." };
|
public static readonly Permission EditContentTypes = new Permission { Name = "EditContentTypes", Description = "Edit content types." };
|
@@ -0,0 +1,35 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Orchard.ContentTypes")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("Microsoft")]
|
||||||
|
[assembly: AssemblyProduct("Orchard.ContentTypes")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("984154ba-5cb9-4728-9551-535c8773fd83")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
@@ -8,7 +8,7 @@ using Orchard.ContentManagement.MetaData.Models;
|
|||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
|
||||||
namespace Orchard.Core.Contents.Services {
|
namespace Orchard.ContentTypes.Services {
|
||||||
public class ContentDefinitionService : IContentDefinitionService {
|
public class ContentDefinitionService : IContentDefinitionService {
|
||||||
private readonly IContentDefinitionManager _contentDefinitionManager;
|
private readonly IContentDefinitionManager _contentDefinitionManager;
|
||||||
private readonly IEnumerable<IContentFieldDriver> _contentFieldDrivers;
|
private readonly IEnumerable<IContentFieldDriver> _contentFieldDrivers;
|
@@ -2,7 +2,7 @@
|
|||||||
using Orchard.ContentManagement.MetaData;
|
using Orchard.ContentManagement.MetaData;
|
||||||
using Orchard.ContentManagement.MetaData.Models;
|
using Orchard.ContentManagement.MetaData.Models;
|
||||||
|
|
||||||
namespace Orchard.Core.Contents.Services {
|
namespace Orchard.ContentTypes.Services {
|
||||||
public interface IContentDefinitionService : IDependency {
|
public interface IContentDefinitionService : IDependency {
|
||||||
IEnumerable<ContentTypeDefinition> GetTypeDefinitions();
|
IEnumerable<ContentTypeDefinition> GetTypeDefinitions();
|
||||||
ContentTypeDefinition GetTypeDefinition(string name);
|
ContentTypeDefinition GetTypeDefinition(string name);
|
@@ -2,7 +2,7 @@
|
|||||||
using Orchard.ContentManagement.MetaData;
|
using Orchard.ContentManagement.MetaData;
|
||||||
using Orchard.Mvc.ViewModels;
|
using Orchard.Mvc.ViewModels;
|
||||||
|
|
||||||
namespace Orchard.Core.Contents.ViewModels {
|
namespace Orchard.ContentTypes.ViewModels {
|
||||||
public class AddFieldViewModel : BaseViewModel {
|
public class AddFieldViewModel : BaseViewModel {
|
||||||
public AddFieldViewModel() {
|
public AddFieldViewModel() {
|
||||||
Fields = new List<ContentFieldInfo>();
|
Fields = new List<ContentFieldInfo>();
|
@@ -1,6 +1,6 @@
|
|||||||
using Orchard.Mvc.ViewModels;
|
using Orchard.Mvc.ViewModels;
|
||||||
|
|
||||||
namespace Orchard.Core.Contents.ViewModels {
|
namespace Orchard.ContentTypes.ViewModels {
|
||||||
public class CreateTypeViewModel : BaseViewModel {
|
public class CreateTypeViewModel : BaseViewModel {
|
||||||
public string DisplayName { get; set; }
|
public string DisplayName { get; set; }
|
||||||
}
|
}
|
@@ -3,7 +3,7 @@ using System.Linq;
|
|||||||
using Orchard.ContentManagement.MetaData.Models;
|
using Orchard.ContentManagement.MetaData.Models;
|
||||||
using Orchard.Mvc.ViewModels;
|
using Orchard.Mvc.ViewModels;
|
||||||
|
|
||||||
namespace Orchard.Core.Contents.ViewModels {
|
namespace Orchard.ContentTypes.ViewModels {
|
||||||
public class EditTypeViewModel : BaseViewModel {
|
public class EditTypeViewModel : BaseViewModel {
|
||||||
public EditTypeViewModel() {
|
public EditTypeViewModel() {
|
||||||
Settings = new SettingsDictionary();
|
Settings = new SettingsDictionary();
|
@@ -0,0 +1,9 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Orchard.ContentManagement.MetaData.Models;
|
||||||
|
using Orchard.Mvc.ViewModels;
|
||||||
|
|
||||||
|
namespace Orchard.ContentTypes.ViewModels {
|
||||||
|
public class ListContentTypesViewModel : BaseViewModel {
|
||||||
|
public IEnumerable<ContentTypeDefinition> Types { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,17 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Orchard.ContentManagement;
|
||||||
|
using Orchard.Mvc.ViewModels;
|
||||||
|
|
||||||
|
namespace Orchard.ContentTypes.ViewModels {
|
||||||
|
public class ListContentsViewModel : BaseViewModel {
|
||||||
|
public string Id { get; set; }
|
||||||
|
public int? Page { get; set; }
|
||||||
|
public IList<Entry> Entries { get; set; }
|
||||||
|
|
||||||
|
public class Entry {
|
||||||
|
public ContentItem ContentItem { get; set; }
|
||||||
|
public ContentItemMetadata ContentItemMetadata { get; set; }
|
||||||
|
public ContentItemViewModel ViewModel { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<AddFieldViewModel>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.AddFieldViewModel>" %>
|
||||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %><%
|
<%
|
||||||
Html.RegisterStyle("admin.css"); %>
|
Html.RegisterStyle("admin.css"); %>
|
||||||
<h1><%:Html.TitleForPage(T("Add a new field to {0}", Model.Part.Name).ToString())%></h1><%
|
<h1><%:Html.TitleForPage(T("Add a new field to {0}", Model.Part.Name).ToString())%></h1><%
|
||||||
using (Html.BeginFormAntiForgeryPost()) { %>
|
using (Html.BeginFormAntiForgeryPost()) { %>
|
@@ -1,5 +1,5 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<CreateTypeViewModel>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.CreateTypeViewModel>" %>
|
||||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
|
|
||||||
<h1><%:Html.TitleForPage(T("New Content Type").ToString())%></h1><%
|
<h1><%:Html.TitleForPage(T("New Content Type").ToString())%></h1><%
|
||||||
using (Html.BeginFormAntiForgeryPost()) { %>
|
using (Html.BeginFormAntiForgeryPost()) { %>
|
||||||
<%:Html.ValidationSummary() %>
|
<%:Html.ValidationSummary() %>
|
@@ -1,4 +1,4 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<EditTypeViewModel>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.EditTypeViewModel>" %>
|
||||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %><%
|
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %><%
|
||||||
Html.RegisterStyle("admin.css"); %>
|
Html.RegisterStyle("admin.css"); %>
|
||||||
<h1><%:Html.TitleForPage(T("Edit Content Type").ToString())%></h1>
|
<h1><%:Html.TitleForPage(T("Edit Content Type").ToString())%></h1>
|
||||||
@@ -18,7 +18,7 @@ using (Html.BeginFormAntiForgeryPost()) { %>
|
|||||||
<div class="manage add-to-type"><%: Html.ActionLink(T("Add").Text, "AddPart", new { }, new { @class = "button" }) %></div>
|
<div class="manage add-to-type"><%: Html.ActionLink(T("Add").Text, "AddPart", new { }, new { @class = "button" }) %></div>
|
||||||
<%:Html.EditorFor(m => m.Parts, "Parts", "") %>
|
<%:Html.EditorFor(m => m.Parts, "Parts", "") %>
|
||||||
<h2><%:T("Fields") %></h2>
|
<h2><%:T("Fields") %></h2>
|
||||||
<div class="manage add-to-type"><%: Html.ActionLink(T("Add").Text, "AddFieldTo", new { area = "Contents", id = Model.Name }, new { @class = "button" }) %></div>
|
<div class="manage add-to-type"><%: Html.ActionLink(T("Add").Text, "AddFieldTo", new { area = "Orchard.ContentTypes", id = Model.Name }, new { @class = "button" }) %></div>
|
||||||
<%:Html.EditorFor(m => m.Fields, "Fields", "") %>
|
<%:Html.EditorFor(m => m.Fields, "Fields", "") %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<button class="primaryAction" type="submit"><%:T("Save") %></button>
|
<button class="primaryAction" type="submit"><%:T("Save") %></button>
|
@@ -1,5 +1,5 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<EditPartViewModel>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.EditPartViewModel>" %>
|
||||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %><%
|
<%
|
||||||
Html.RegisterStyle("admin.css"); %>
|
Html.RegisterStyle("admin.css"); %>
|
||||||
<h1><%:Html.TitleForPage(T("Edit Part").ToString()) %></h1><%
|
<h1><%:Html.TitleForPage(T("Edit Part").ToString()) %></h1><%
|
||||||
using (Html.BeginFormAntiForgeryPost()) { %>
|
using (Html.BeginFormAntiForgeryPost()) { %>
|
||||||
@@ -11,7 +11,7 @@ using (Html.BeginFormAntiForgeryPost()) { %>
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
<%:Html.EditorFor(m => m.Settings, "Settings", "") %>
|
<%:Html.EditorFor(m => m.Settings, "Settings", "") %>
|
||||||
<h2><%:T("Fields") %></h2>
|
<h2><%:T("Fields") %></h2>
|
||||||
<div class="manage add-to-type"><%: Html.ActionLink(T("Add").Text, "AddFieldTo", new { area = "Contents", id = Model.Name }, new { @class = "button" }) %></div>
|
<div class="manage add-to-type"><%: Html.ActionLink(T("Add").Text, "AddFieldTo", new { area = "Orchard.ContentTypes", id = Model.Name }, new { @class = "button" }) %></div>
|
||||||
<%:Html.EditorFor(m => m.Fields, "Fields", "") %>
|
<%:Html.EditorFor(m => m.Fields, "Fields", "") %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<button class="primaryAction" type="submit"><%:T("Save") %></button>
|
<button class="primaryAction" type="submit"><%:T("Save") %></button>
|
@@ -0,0 +1,11 @@
|
|||||||
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.ListContentTypesViewModel>" %>
|
||||||
|
|
||||||
|
<h1>
|
||||||
|
<%:Html.TitleForPage(T("Content Types").ToString())%></h1>
|
||||||
|
<div class="manage">
|
||||||
|
<%: Html.ActionLink(T("Create new type").ToString(), "Create", new{Controller="Admin",Area="Orchard.ContentTypes"}, new { @class = "button primaryAction" })%></div>
|
||||||
|
<%:Html.UnorderedList(
|
||||||
|
Model.Types,
|
||||||
|
(t,i) => Html.DisplayFor(m => t),
|
||||||
|
"contentItems"
|
||||||
|
) %>
|
@@ -7,8 +7,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="related">
|
<div class="related">
|
||||||
<%:Html.ActionLink(T("List Items").ToString(), "List", new {area = "Contents", id = Model.Name})%><%:T(" | ")%>
|
<%:Html.ActionLink(T("List Items").ToString(), "List", new {area = "Contents", id = Model.Name})%><%:T(" | ")%>
|
||||||
<%:Html.ActionLink(T("Edit").ToString(), "EditType", new {area = "Contents", id = Model.Name})%><%:T(" | ") %>
|
<%:Html.ActionLink(T("Edit").ToString(), "Edit", new {area = "Orchard.ContentTypes", id = Model.Name})%><%:T(" | ") %>
|
||||||
<% using (Html.BeginFormAntiForgeryPost(Url.Action("RemoveType", new {area = "Contents", id = Model.Name}), FormMethod.Post, new { @class = "inline link" })) { %>
|
<% using (Html.BeginFormAntiForgeryPost(Url.Action("RemoveType", new {area = "Orchard.ContentTypes", id = Model.Name}), FormMethod.Post, new { @class = "inline link" })) { %>
|
||||||
<button type="submit" class="linkButton" title="<%:T("Delete") %>"><%:T("[Delete]")%></button><%
|
<button type="submit" class="linkButton" title="<%:T("Delete") %>"><%:T("[Delete]")%></button><%
|
||||||
} %>
|
} %>
|
||||||
</div>
|
</div>
|
@@ -1,4 +1,4 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<EditPartFieldViewModel>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.EditPartFieldViewModel>" %>
|
||||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
|
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
|
||||||
<dt><%:Model.Name %> <span>(<%:Model.FieldDefinition.Name %>)</span></dt>
|
<dt><%:Model.Name %> <span>(<%:Model.FieldDefinition.Name %>)</span></dt>
|
||||||
<dd>
|
<dd>
|
@@ -1,4 +1,4 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<IEnumerable<EditPartFieldViewModel>>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<IEnumerable<Orchard.ContentTypes.ViewModels.EditPartFieldViewModel>>" %>
|
||||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %><%
|
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %><%
|
||||||
if (Model.Any()) { %>
|
if (Model.Any()) { %>
|
||||||
<dl><%
|
<dl><%
|
@@ -0,0 +1,13 @@
|
|||||||
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentTypeDefinition.Part>" %>
|
||||||
|
<%@ Import Namespace="Orchard.ContentManagement.MetaData.Models" %>
|
||||||
|
<fieldset>
|
||||||
|
<h3><%:Model.PartDefinition.Name %></h3>
|
||||||
|
<div class="manage add-to-type">
|
||||||
|
<%--// these inline forms can't be here. should probably have some JavaScript in here to build up the forms and add the "remove" link.
|
||||||
|
// get the antiforgery token from the edit type form and mark up the part in a semantic way so I can get some info from the DOM --%>
|
||||||
|
<% using (Html.BeginFormAntiForgeryPost(Url.Action("RemovePart", new { area = "Contents" }), FormMethod.Post, new {@class = "inline link"})) { %>
|
||||||
|
<%=Html.Hidden("name", Model.PartDefinition.Name, new { id = "" }) %>
|
||||||
|
<button type="submit" title="<%:T("Remove") %>"><%:T("Remove") %></button>
|
||||||
|
<% } %>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
@@ -1,4 +1,4 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<EditPartFieldViewModel>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.EditPartFieldViewModel>" %>
|
||||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
|
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
|
||||||
<fieldset class="manage-field">
|
<fieldset class="manage-field">
|
||||||
<h3><%:Model.Name %> <span>(<%:Model.FieldDefinition.Name %>)</span></h3>
|
<h3><%:Model.Name %> <span>(<%:Model.FieldDefinition.Name %>)</span></h3>
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<%--// these inline forms can't be here. should probably have some JavaScript in here to build up the forms and add the "remove" link.
|
<%--// these inline forms can't be here. should probably have some JavaScript in here to build up the forms and add the "remove" link.
|
||||||
// get the antiforgery token from the edit type form and mark up the part in a semantic way so I can get some info from the DOM --%>
|
// get the antiforgery token from the edit type form and mark up the part in a semantic way so I can get some info from the DOM --%>
|
||||||
<%:Html.Link("[remove]", "#forshowonlyandnotintendedtowork!") %>
|
<%:Html.Link("[remove]", "#forshowonlyandnotintendedtowork!") %>
|
||||||
<%-- <% using (Html.BeginFormAntiForgeryPost(Url.Action("RemovePart", new { area = "Contents" }), FormMethod.Post, new {@class = "inline link"})) { %>
|
<%-- <% using (Html.BeginFormAntiForgeryPost(Url.Action("RemovePart", new { area = "Orchard.ContentTypes" }), FormMethod.Post, new {@class = "inline link"})) { %>
|
||||||
<%:Html.Hidden("name", Model.PartDefinition.Name, new { id = "" }) %>
|
<%:Html.Hidden("name", Model.PartDefinition.Name, new { id = "" }) %>
|
||||||
<button type="submit" title="<%:T("Remove") %>"><%:T("Remove") %></button>
|
<button type="submit" title="<%:T("Remove") %>"><%:T("Remove") %></button>
|
||||||
<% } %> --%>
|
<% } %> --%>
|
@@ -1,4 +1,4 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<IEnumerable<EditPartFieldViewModel>>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<IEnumerable<Orchard.ContentTypes.ViewModels.EditPartFieldViewModel>>" %>
|
||||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %><%
|
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %><%
|
||||||
if (Model.Any()) { %>
|
if (Model.Any()) { %>
|
||||||
<fieldset><%
|
<fieldset><%
|
@@ -1,4 +1,4 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<EditTypePartViewModel>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.EditTypePartViewModel>" %>
|
||||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
|
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
|
||||||
<fieldset class="manage-part">
|
<fieldset class="manage-part">
|
||||||
<h3><%:Model.PartDefinition.Name %></h3>
|
<h3><%:Model.PartDefinition.Name %></h3>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<%:Html.EditorFor(m => m.Settings, "Settings", "") %>
|
<%:Html.EditorFor(m => m.Settings, "Settings", "") %>
|
||||||
<h4><%:T("Global configuration") %></h4>
|
<h4><%:T("Global configuration") %></h4>
|
||||||
<div class="manage minor"><%:Html.ActionLink(T("Edit").Text, "EditPart", new { area = "Contents", id = Model.PartDefinition.Name }) %></div>
|
<div class="manage minor"><%:Html.ActionLink(T("Edit").Text, "EditPart", new { area = "Orchard.ContentTypes", id = Model.PartDefinition.Name }) %></div>
|
||||||
<%:Html.DisplayFor(m => m.PartDefinition.Settings, "Settings", "PartDefinition") %>
|
<%:Html.DisplayFor(m => m.PartDefinition.Settings, "Settings", "PartDefinition") %>
|
||||||
<%:Html.DisplayFor(m => m.PartDefinition.Fields, "Fields") %>
|
<%:Html.DisplayFor(m => m.PartDefinition.Fields, "Fields") %>
|
||||||
<%:Html.Hidden("PartDefinition.Name", Model.PartDefinition.Name) %>
|
<%:Html.Hidden("PartDefinition.Name", Model.PartDefinition.Name) %>
|
@@ -1,4 +1,4 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<IEnumerable<EditTypePartViewModel>>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<IEnumerable<Orchard.ContentTypes.ViewModels.EditTypePartViewModel>>" %>
|
||||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %><%
|
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %><%
|
||||||
if (Model.Any()) { %>
|
if (Model.Any()) { %>
|
||||||
<fieldset><%
|
<fieldset><%
|
@@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<configuration>
|
||||||
|
<system.web>
|
||||||
|
<httpHandlers>
|
||||||
|
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
|
||||||
|
</httpHandlers>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Enabling request validation in view pages would cause validation to occur
|
||||||
|
after the input has already been processed by the controller. By default
|
||||||
|
MVC performs request validation before a controller processes the input.
|
||||||
|
To change this behavior apply the ValidateInputAttribute to a
|
||||||
|
controller or action.
|
||||||
|
-->
|
||||||
|
<pages
|
||||||
|
validateRequest="false"
|
||||||
|
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||||
|
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||||
|
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||||
|
<controls>
|
||||||
|
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
|
||||||
|
</controls>
|
||||||
|
</pages>
|
||||||
|
</system.web>
|
||||||
|
|
||||||
|
<system.webServer>
|
||||||
|
<validation validateIntegratedModeConfiguration="false" />
|
||||||
|
|
||||||
|
<handlers>
|
||||||
|
<remove name="BlockViewHandler"/>
|
||||||
|
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
|
||||||
|
</handlers>
|
||||||
|
</system.webServer>
|
||||||
|
</configuration>
|
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
|
||||||
|
|
||||||
|
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||||
|
<!--
|
||||||
|
In the example below, the "SetAttributes" transform will change the value of
|
||||||
|
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
|
||||||
|
finds an atrribute "name" that has a value of "MyDB".
|
||||||
|
|
||||||
|
<connectionStrings>
|
||||||
|
<add name="MyDB"
|
||||||
|
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
|
||||||
|
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
|
||||||
|
</connectionStrings>
|
||||||
|
-->
|
||||||
|
<system.web>
|
||||||
|
<!--
|
||||||
|
In the example below, the "Replace" transform will replace the entire
|
||||||
|
<customErrors> section of your web.config file.
|
||||||
|
Note that because there is only one customErrors section under the
|
||||||
|
<system.web> node, there is no need to use the "xdt:Locator" attribute.
|
||||||
|
|
||||||
|
<customErrors defaultRedirect="GenericError.htm"
|
||||||
|
mode="RemoteOnly" xdt:Transform="Replace">
|
||||||
|
<error statusCode="500" redirect="InternalError.htm"/>
|
||||||
|
</customErrors>
|
||||||
|
-->
|
||||||
|
</system.web>
|
||||||
|
</configuration>
|
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
|
||||||
|
|
||||||
|
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||||
|
<!--
|
||||||
|
In the example below, the "SetAttributes" transform will change the value of
|
||||||
|
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
|
||||||
|
finds an atrribute "name" that has a value of "MyDB".
|
||||||
|
|
||||||
|
<connectionStrings>
|
||||||
|
<add name="MyDB"
|
||||||
|
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
|
||||||
|
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
|
||||||
|
</connectionStrings>
|
||||||
|
-->
|
||||||
|
<system.web>
|
||||||
|
<compilation xdt:Transform="RemoveAttributes(debug)" />
|
||||||
|
<!--
|
||||||
|
In the example below, the "Replace" transform will replace the entire
|
||||||
|
<customErrors> section of your web.config file.
|
||||||
|
Note that because there is only one customErrors section under the
|
||||||
|
<system.web> node, there is no need to use the "xdt:Locator" attribute.
|
||||||
|
|
||||||
|
<customErrors defaultRedirect="GenericError.htm"
|
||||||
|
mode="RemoteOnly" xdt:Transform="Replace">
|
||||||
|
<error statusCode="500" redirect="InternalError.htm"/>
|
||||||
|
</customErrors>
|
||||||
|
-->
|
||||||
|
</system.web>
|
||||||
|
</configuration>
|
80
src/Orchard.Web/Modules/Orchard.ContentTypes/Web.config
Normal file
80
src/Orchard.Web/Modules/Orchard.ContentTypes/Web.config
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!--
|
||||||
|
Note: As an alternative to hand editing this file you can use the
|
||||||
|
web admin tool to configure settings for your application. Use
|
||||||
|
the Website->Asp.Net Configuration option in Visual Studio.
|
||||||
|
A full list of settings and comments can be found in
|
||||||
|
machine.config.comments usually located in
|
||||||
|
\Windows\Microsoft.Net\Framework\v2.x\Config
|
||||||
|
-->
|
||||||
|
<configuration>
|
||||||
|
<appSettings/>
|
||||||
|
<connectionStrings>
|
||||||
|
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
|
||||||
|
</connectionStrings>
|
||||||
|
<system.web>
|
||||||
|
<!--
|
||||||
|
Set compilation debug="true" to insert debugging
|
||||||
|
symbols into the compiled page. Because this
|
||||||
|
affects performance, set this value to true only
|
||||||
|
during development.
|
||||||
|
-->
|
||||||
|
<compilation debug="true" targetFramework="4.0">
|
||||||
|
<assemblies>
|
||||||
|
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||||
|
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||||
|
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||||
|
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||||
|
</assemblies>
|
||||||
|
</compilation>
|
||||||
|
<!--
|
||||||
|
The <customErrors> section enables configuration
|
||||||
|
of what to do if/when an unhandled error occurs
|
||||||
|
during the execution of a request. Specifically,
|
||||||
|
it enables developers to configure html error pages
|
||||||
|
to be displayed in place of a error stack trace.
|
||||||
|
|
||||||
|
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
|
||||||
|
<error statusCode="403" redirect="NoAccess.htm" />
|
||||||
|
<error statusCode="404" redirect="FileNotFound.htm" />
|
||||||
|
</customErrors>
|
||||||
|
-->
|
||||||
|
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
|
||||||
|
<namespaces>
|
||||||
|
<add namespace="System.Web.Mvc"/>
|
||||||
|
<add namespace="System.Web.Mvc.Ajax"/>
|
||||||
|
<add namespace="System.Web.Mvc.Html"/>
|
||||||
|
<add namespace="System.Web.Routing"/>
|
||||||
|
<add namespace="System.Linq"/>
|
||||||
|
<add namespace="System.Collections.Generic"/>
|
||||||
|
<add namespace="Orchard.Mvc.Html"/>
|
||||||
|
</namespaces>
|
||||||
|
</pages>
|
||||||
|
<httpHandlers>
|
||||||
|
<add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||||
|
</httpHandlers>
|
||||||
|
</system.web>
|
||||||
|
<system.web.extensions/>
|
||||||
|
<!--
|
||||||
|
The system.webServer section is required for running ASP.NET AJAX under Internet
|
||||||
|
Information Services 7.0. It is not necessary for previous version of IIS.
|
||||||
|
-->
|
||||||
|
<system.webServer>
|
||||||
|
<validation validateIntegratedModeConfiguration="false"/>
|
||||||
|
<modules runAllManagedModulesForAllRequests="true">
|
||||||
|
</modules>
|
||||||
|
<handlers>
|
||||||
|
<remove name="MvcHttpHandler"/>
|
||||||
|
<remove name="UrlRoutingHandler"/>
|
||||||
|
<add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||||
|
</handlers>
|
||||||
|
</system.webServer>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
|
||||||
|
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
@@ -127,6 +127,10 @@
|
|||||||
<Project>{14C049FD-B35B-415A-A824-87F26B26E7FD}</Project>
|
<Project>{14C049FD-B35B-415A-A824-87F26B26E7FD}</Project>
|
||||||
<Name>Orchard.Comments</Name>
|
<Name>Orchard.Comments</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="Modules\Orchard.ContentTypes\Orchard.ContentTypes.csproj">
|
||||||
|
<Project>{0E7646E8-FE8F-43C1-8799-D97860925EC4}</Project>
|
||||||
|
<Name>Orchard.ContentTypes</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="Modules\Orchard.DevTools\Orchard.DevTools.csproj">
|
<ProjectReference Include="Modules\Orchard.DevTools\Orchard.DevTools.csproj">
|
||||||
<Project>{67C1D3AF-A0EC-46B2-BAE1-DF1DA8E0B890}</Project>
|
<Project>{67C1D3AF-A0EC-46B2-BAE1-DF1DA8E0B890}</Project>
|
||||||
<Name>Orchard.DevTools</Name>
|
<Name>Orchard.DevTools</Name>
|
||||||
|
@@ -69,6 +69,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Search", "Orchard.W
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Indexing", "Orchard.Web\Modules\Orchard.Indexing\Orchard.Indexing.csproj", "{EA2B9121-EF54-40A6-A53E-6593C86EE696}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Indexing", "Orchard.Web\Modules\Orchard.Indexing\Orchard.Indexing.csproj", "{EA2B9121-EF54-40A6-A53E-6593C86EE696}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.ContentTypes", "Orchard.Web\Modules\Orchard.ContentTypes\Orchard.ContentTypes.csproj", "{0E7646E8-FE8F-43C1-8799-D97860925EC4}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -195,6 +197,10 @@ Global
|
|||||||
{EA2B9121-EF54-40A6-A53E-6593C86EE696}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{EA2B9121-EF54-40A6-A53E-6593C86EE696}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{EA2B9121-EF54-40A6-A53E-6593C86EE696}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{EA2B9121-EF54-40A6-A53E-6593C86EE696}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{EA2B9121-EF54-40A6-A53E-6593C86EE696}.Release|Any CPU.Build.0 = Release|Any CPU
|
{EA2B9121-EF54-40A6-A53E-6593C86EE696}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{0E7646E8-FE8F-43C1-8799-D97860925EC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{0E7646E8-FE8F-43C1-8799-D97860925EC4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{0E7646E8-FE8F-43C1-8799-D97860925EC4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{0E7646E8-FE8F-43C1-8799-D97860925EC4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -217,6 +223,7 @@ Global
|
|||||||
{23E04990-2A8D-41B8-9908-6DDB71EA3B23} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
{23E04990-2A8D-41B8-9908-6DDB71EA3B23} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||||
{4BE4EB01-AC56-4048-924E-2CA77F509ABA} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
{4BE4EB01-AC56-4048-924E-2CA77F509ABA} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||||
{EA2B9121-EF54-40A6-A53E-6593C86EE696} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
{EA2B9121-EF54-40A6-A53E-6593C86EE696} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||||
|
{0E7646E8-FE8F-43C1-8799-D97860925EC4} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||||
{ABC826D4-2FA1-4F2F-87DE-E6095F653810} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
{ABC826D4-2FA1-4F2F-87DE-E6095F653810} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
||||||
{F112851D-B023-4746-B6B1-8D2E5AD8F7AA} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
{F112851D-B023-4746-B6B1-8D2E5AD8F7AA} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
||||||
{6CB3EB30-F725-45C0-9742-42599BA8E8D2} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
{6CB3EB30-F725-45C0-9742-42599BA8E8D2} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
||||||
|
Reference in New Issue
Block a user