mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-23 21:13:35 +08:00
Import handlers for navigation,blogs,widgets,layers and deferred publishing/archiving types.
--HG-- branch : dev
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using JetBrains.Annotations;
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Core.Navigation.Models;
|
||||
@@ -46,5 +47,28 @@ namespace Orchard.Core.Navigation.Drivers {
|
||||
|
||||
return Editor(part, shapeHelper);
|
||||
}
|
||||
|
||||
protected override void Importing(AdminMenuPart part, ContentManagement.Handlers.ImportContentContext context) {
|
||||
var adminMenuText = context.Attribute(part.PartDefinition.Name, "AdminMenuText");
|
||||
if (adminMenuText != null) {
|
||||
part.AdminMenuText = adminMenuText;
|
||||
}
|
||||
|
||||
var position = context.Attribute(part.PartDefinition.Name, "AdminMenuPosition");
|
||||
if (position != null) {
|
||||
part.AdminMenuPosition = position;
|
||||
}
|
||||
|
||||
var onAdminMenu = context.Attribute(part.PartDefinition.Name, "OnAdminMenu");
|
||||
if (onAdminMenu != null) {
|
||||
part.OnAdminMenu = Convert.ToBoolean(onAdminMenu);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Exporting(AdminMenuPart part, ContentManagement.Handlers.ExportContentContext context) {
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("AdminMenuText", part.AdminMenuText);
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("AdminMenuPosition", part.AdminMenuPosition);
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("OnAdminMenu", part.OnAdminMenu);
|
||||
}
|
||||
}
|
||||
}
|
@@ -24,6 +24,13 @@ namespace Orchard.Core.Navigation.Drivers {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected override void Importing(MenuItemPart part, ContentManagement.Handlers.ImportContentContext context) {
|
||||
var url = context.Attribute(part.PartDefinition.Name, "Url");
|
||||
if (url != null) {
|
||||
part.Url = url;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Exporting(MenuItemPart part, ContentManagement.Handlers.ExportContentContext context) {
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Url", part.Url);
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using JetBrains.Annotations;
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Core.Navigation.Models;
|
||||
@@ -46,6 +47,23 @@ namespace Orchard.Core.Navigation.Drivers {
|
||||
return Editor(part, shapeHelper);
|
||||
}
|
||||
|
||||
protected override void Importing(MenuPart part, ContentManagement.Handlers.ImportContentContext context) {
|
||||
var menuText = context.Attribute(part.PartDefinition.Name, "MenuText");
|
||||
if (menuText != null) {
|
||||
part.MenuText = menuText;
|
||||
}
|
||||
|
||||
var position = context.Attribute(part.PartDefinition.Name, "MenuPosition");
|
||||
if (position != null) {
|
||||
part.MenuPosition = position;
|
||||
}
|
||||
|
||||
var onMainMenu = context.Attribute(part.PartDefinition.Name, "OnMainMenu");
|
||||
if (onMainMenu != null) {
|
||||
part.OnMainMenu = Convert.ToBoolean(onMainMenu);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Exporting(MenuPart part, ContentManagement.Handlers.ExportContentContext context) {
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("MenuText", part.MenuText);
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("MenuPosition", part.MenuPosition);
|
||||
|
@@ -75,6 +75,13 @@ namespace Orchard.ArchiveLater.Drivers {
|
||||
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override void Importing(ArchiveLaterPart part, ImportContentContext context) {
|
||||
var scheduledUtc = context.Attribute(part.PartDefinition.Name, "ScheduledArchiveUtc");
|
||||
if (scheduledUtc != null) {
|
||||
part.ScheduledArchiveUtc.Value = XmlConvert.ToDateTime(scheduledUtc, XmlDateTimeSerializationMode.Utc);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Exporting(ArchiveLaterPart part, ExportContentContext context) {
|
||||
var scheduled = part.ScheduledArchiveUtc.Value;
|
||||
if (scheduled != null) {
|
||||
|
@@ -54,6 +54,13 @@ namespace Orchard.Blogs.Drivers {
|
||||
return Editor(part, shapeHelper);
|
||||
}
|
||||
|
||||
protected override void Importing(BlogArchivesPart part, ImportContentContext context) {
|
||||
var blogSlug = context.Attribute(part.PartDefinition.Name, "BlogSlug");
|
||||
if (blogSlug != null) {
|
||||
part.ForBlog = blogSlug;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Exporting(BlogArchivesPart part, ExportContentContext context) {
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("BlogSlug", part.ForBlog);
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using JetBrains.Annotations;
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
@@ -29,6 +30,18 @@ namespace Orchard.Blogs.Drivers {
|
||||
return Editor(blogPart, shapeHelper);
|
||||
}
|
||||
|
||||
protected override void Importing(BlogPart part, ContentManagement.Handlers.ImportContentContext context) {
|
||||
var description = context.Attribute(part.PartDefinition.Name, "Description");
|
||||
if (description != null) {
|
||||
part.Description = description;
|
||||
}
|
||||
|
||||
var postCount = context.Attribute(part.PartDefinition.Name, "PostCount");
|
||||
if (postCount != null) {
|
||||
part.PostCount = Convert.ToInt32(postCount);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Exporting(BlogPart part, ContentManagement.Handlers.ExportContentContext context) {
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Description", part.Description);
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("PostCount", part.PostCount);
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Blogs.Routing;
|
||||
using Orchard.Blogs.Services;
|
||||
@@ -66,6 +67,18 @@ namespace Orchard.Blogs.Drivers {
|
||||
return Editor(part, shapeHelper);
|
||||
}
|
||||
|
||||
protected override void Importing(RecentBlogPostsPart part, ImportContentContext context) {
|
||||
var blogSlug = context.Attribute(part.PartDefinition.Name, "BlogSlug");
|
||||
if (blogSlug != null) {
|
||||
part.ForBlog = blogSlug;
|
||||
}
|
||||
|
||||
var count = context.Attribute(part.PartDefinition.Name, "Count");
|
||||
if (count != null) {
|
||||
part.Count = Convert.ToInt32(count);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Exporting(RecentBlogPostsPart part, ExportContentContext context) {
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("BlogSlug", part.ForBlog);
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Count", part.Count);
|
||||
|
@@ -84,6 +84,13 @@ namespace Orchard.PublishLater.Drivers {
|
||||
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override void Importing(PublishLaterPart part, ImportContentContext context) {
|
||||
var scheduledUtc = context.Attribute(part.PartDefinition.Name, "ScheduledPublishUtc");
|
||||
if (scheduledUtc != null) {
|
||||
part.ScheduledPublishUtc.Value = XmlConvert.ToDateTime(scheduledUtc, XmlDateTimeSerializationMode.Utc);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Exporting(PublishLaterPart part, ExportContentContext context) {
|
||||
var scheduled = part.ScheduledPublishUtc.Value;
|
||||
if (scheduled != null) {
|
||||
|
@@ -65,6 +65,23 @@ namespace Orchard.Widgets.Drivers {
|
||||
return Editor(layerPart, shapeHelper);
|
||||
}
|
||||
|
||||
protected override void Importing(LayerPart part, ImportContentContext context) {
|
||||
var name = context.Attribute(part.PartDefinition.Name, "Name");
|
||||
if (name != null) {
|
||||
part.Name = name;
|
||||
}
|
||||
|
||||
var description = context.Attribute(part.PartDefinition.Name, "Description");
|
||||
if (description != null) {
|
||||
part.Description = description;
|
||||
}
|
||||
|
||||
var rule = context.Attribute(part.PartDefinition.Name, "LayerRule");
|
||||
if (rule != null) {
|
||||
part.LayerRule = rule;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Exporting(LayerPart part, ExportContentContext context) {
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Name", part.Name);
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Description", part.Description);
|
||||
|
@@ -36,6 +36,23 @@ namespace Orchard.Widgets.Drivers {
|
||||
return Editor(widgetPart, shapeHelper);
|
||||
}
|
||||
|
||||
protected override void Importing(WidgetPart part, ContentManagement.Handlers.ImportContentContext context) {
|
||||
var title = context.Attribute(part.PartDefinition.Name, "Title");
|
||||
if (title != null) {
|
||||
part.Title = title;
|
||||
}
|
||||
|
||||
var position = context.Attribute(part.PartDefinition.Name, "Position");
|
||||
if (position != null) {
|
||||
part.Position = position;
|
||||
}
|
||||
|
||||
var zone = context.Attribute(part.PartDefinition.Name, "Zone");
|
||||
if (zone != null) {
|
||||
part.Zone = zone;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override void Exporting(WidgetPart part, ContentManagement.Handlers.ExportContentContext context) {
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Title", part.Title);
|
||||
|
Reference in New Issue
Block a user