mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Adding Import/Export to Audio, Document, Image, OEmbed and Video Parts
This commit is contained in:
@@ -11,5 +11,16 @@ namespace Orchard.MediaLibrary.Drivers {
|
||||
ContentShape("Parts_Audio", () => shapeHelper.Parts_Audio())
|
||||
);
|
||||
}
|
||||
|
||||
protected override void Exporting(AudioPart part, ContentManagement.Handlers.ExportContentContext context) {
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Length", part.Length);
|
||||
}
|
||||
|
||||
protected override void Importing(AudioPart part, ContentManagement.Handlers.ImportContentContext context) {
|
||||
var length = context.Attribute(part.PartDefinition.Name, "Length");
|
||||
if (length != null) {
|
||||
part.Length = int.Parse(length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -11,5 +11,16 @@ namespace Orchard.MediaLibrary.Drivers {
|
||||
ContentShape("Parts_Document", () => shapeHelper.Parts_Document())
|
||||
);
|
||||
}
|
||||
|
||||
protected override void Exporting(DocumentPart part, ContentManagement.Handlers.ExportContentContext context) {
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Length", part.Length);
|
||||
}
|
||||
|
||||
protected override void Importing(DocumentPart part, ContentManagement.Handlers.ImportContentContext context) {
|
||||
var length = context.Attribute(part.PartDefinition.Name, "Length");
|
||||
if (length != null) {
|
||||
part.Length = int.Parse(length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -12,5 +12,22 @@ namespace Orchard.MediaLibrary.Drivers {
|
||||
ContentShape("Parts_Image_SummaryAdmin", () => shapeHelper.Parts_Image_SummaryAdmin())
|
||||
);
|
||||
}
|
||||
|
||||
protected override void Exporting(ImagePart part, ContentManagement.Handlers.ExportContentContext context) {
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Height", part.Height);
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Width", part.Width);
|
||||
}
|
||||
|
||||
protected override void Importing(ImagePart part, ContentManagement.Handlers.ImportContentContext context) {
|
||||
var height = context.Attribute(part.PartDefinition.Name, "Height");
|
||||
if (height != null) {
|
||||
part.Height = int.Parse(height);
|
||||
}
|
||||
|
||||
var width = context.Attribute(part.PartDefinition.Name, "Width");
|
||||
if (width != null) {
|
||||
part.Width = int.Parse(width);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -11,5 +11,16 @@ namespace Orchard.MediaLibrary.Drivers {
|
||||
ContentShape("Parts_OEmbed", () => shapeHelper.Parts_OEmbed())
|
||||
);
|
||||
}
|
||||
|
||||
protected override void Exporting(OEmbedPart part, ContentManagement.Handlers.ExportContentContext context) {
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Source", part.Source);
|
||||
}
|
||||
|
||||
protected override void Importing(OEmbedPart part, ContentManagement.Handlers.ImportContentContext context) {
|
||||
var source = context.Attribute(part.PartDefinition.Name, "Source");
|
||||
if (source != null) {
|
||||
part.Source = source;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -11,5 +11,16 @@ namespace Orchard.MediaLibrary.Drivers {
|
||||
ContentShape("Parts_Video", () => shapeHelper.Parts_Video)
|
||||
);
|
||||
}
|
||||
|
||||
protected override void Exporting(VideoPart part, ContentManagement.Handlers.ExportContentContext context) {
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Length", part.Length);
|
||||
}
|
||||
|
||||
protected override void Importing(VideoPart part, ContentManagement.Handlers.ImportContentContext context) {
|
||||
var length = context.Attribute(part.PartDefinition.Name, "Length");
|
||||
if (length != null) {
|
||||
part.Length = int.Parse(length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user