mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-08-01 18:45:54 +08:00
Adding storage filter events for Import/Export
This commit is contained in:
parent
d35ebe04e7
commit
dcc7783f12
@ -96,6 +96,21 @@ namespace Orchard.ContentManagement.Handlers {
|
||||
protected void OnIndexed<TPart>(Action<IndexContentContext, TPart> handler) where TPart : class, IContent {
|
||||
Filters.Add(new InlineStorageFilter<TPart> { OnIndexed = handler });
|
||||
}
|
||||
protected void OnImporting<TPart>(Action<ImportContentContext, TPart> handler) where TPart : class, IContent {
|
||||
Filters.Add(new InlineStorageFilter<TPart> { OnImporting = handler });
|
||||
}
|
||||
|
||||
protected void OnImported<TPart>(Action<ImportContentContext, TPart> handler) where TPart : class, IContent {
|
||||
Filters.Add(new InlineStorageFilter<TPart> { OnImported = handler });
|
||||
}
|
||||
|
||||
protected void OnExporting<TPart>(Action<ExportContentContext, TPart> handler) where TPart : class, IContent {
|
||||
Filters.Add(new InlineStorageFilter<TPart> { OnExporting = handler });
|
||||
}
|
||||
|
||||
protected void OnExported<TPart>(Action<ExportContentContext, TPart> handler) where TPart : class, IContent {
|
||||
Filters.Add(new InlineStorageFilter<TPart> { OnExported = handler });
|
||||
}
|
||||
|
||||
protected void OnGetContentItemMetadata<TPart>(Action<GetContentItemMetadataContext, TPart> handler) where TPart : class, IContent {
|
||||
Filters.Add(new InlineTemplateFilter<TPart> { OnGetItemMetadata = handler });
|
||||
@ -132,6 +147,10 @@ namespace Orchard.ContentManagement.Handlers {
|
||||
public Action<RemoveContentContext, TPart> OnRemoved { get; set; }
|
||||
public Action<IndexContentContext, TPart> OnIndexing { get; set; }
|
||||
public Action<IndexContentContext, TPart> OnIndexed { get; set; }
|
||||
public Action<ImportContentContext, TPart> OnImporting { get; set; }
|
||||
public Action<ImportContentContext, TPart> OnImported { get; set; }
|
||||
public Action<ExportContentContext, TPart> OnExporting { get; set; }
|
||||
public Action<ExportContentContext, TPart> OnExported { get; set; }
|
||||
public Action<RestoreContentContext, TPart> OnRestoring { get; set; }
|
||||
public Action<RestoreContentContext, TPart> OnRestored { get; set; }
|
||||
public Action<DestroyContentContext, TPart> OnDestroying { get; set; }
|
||||
@ -188,13 +207,29 @@ namespace Orchard.ContentManagement.Handlers {
|
||||
if (OnRemoved != null) OnRemoved(context, instance);
|
||||
}
|
||||
protected override void Indexing(IndexContentContext context, TPart instance) {
|
||||
if ( OnIndexing != null )
|
||||
if (OnIndexing != null)
|
||||
OnIndexing(context, instance);
|
||||
}
|
||||
protected override void Indexed(IndexContentContext context, TPart instance) {
|
||||
if ( OnIndexed != null )
|
||||
if (OnIndexed != null)
|
||||
OnIndexed(context, instance);
|
||||
}
|
||||
protected override void Importing(ImportContentContext context, TPart instance) {
|
||||
if (OnImporting != null)
|
||||
OnImporting(context, instance);
|
||||
}
|
||||
protected override void Imported(ImportContentContext context, TPart instance) {
|
||||
if (OnImported != null)
|
||||
OnImported(context, instance);
|
||||
}
|
||||
protected override void Exporting(ExportContentContext context, TPart instance) {
|
||||
if (OnExporting != null)
|
||||
OnExporting(context, instance);
|
||||
}
|
||||
protected override void Exported(ExportContentContext context, TPart instance) {
|
||||
if (OnExported != null)
|
||||
OnExported(context, instance);
|
||||
}
|
||||
protected override void Restoring(RestoreContentContext context, TPart instance) {
|
||||
if (OnRestoring != null)
|
||||
OnRestoring(context, instance);
|
||||
@ -353,18 +388,26 @@ namespace Orchard.ContentManagement.Handlers {
|
||||
}
|
||||
|
||||
void IContentHandler.Importing(ImportContentContext context) {
|
||||
foreach (var filter in Filters.OfType<IContentStorageFilter>())
|
||||
filter.Importing(context);
|
||||
Importing(context);
|
||||
}
|
||||
|
||||
void IContentHandler.Imported(ImportContentContext context) {
|
||||
foreach (var filter in Filters.OfType<IContentStorageFilter>())
|
||||
filter.Imported(context);
|
||||
Imported(context);
|
||||
}
|
||||
|
||||
void IContentHandler.Exporting(ExportContentContext context) {
|
||||
foreach (var filter in Filters.OfType<IContentStorageFilter>())
|
||||
filter.Exporting(context);
|
||||
Exporting(context);
|
||||
}
|
||||
|
||||
void IContentHandler.Exported(ExportContentContext context) {
|
||||
foreach (var filter in Filters.OfType<IContentStorageFilter>())
|
||||
filter.Exported(context);
|
||||
Exported(context);
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,10 @@ namespace Orchard.ContentManagement.Handlers {
|
||||
void Removed(RemoveContentContext context);
|
||||
void Indexing(IndexContentContext context);
|
||||
void Indexed(IndexContentContext context);
|
||||
void Importing(ImportContentContext context);
|
||||
void Imported(ImportContentContext context);
|
||||
void Exporting(ExportContentContext context);
|
||||
void Exported(ExportContentContext context);
|
||||
void Restoring(RestoreContentContext context);
|
||||
void Restored(RestoreContentContext context);
|
||||
void Destroying(DestroyContentContext context);
|
||||
|
@ -21,6 +21,10 @@ namespace Orchard.ContentManagement.Handlers {
|
||||
protected virtual void Removed(RemoveContentContext context, TPart instance) { }
|
||||
protected virtual void Indexing(IndexContentContext context, TPart instance) { }
|
||||
protected virtual void Indexed(IndexContentContext context, TPart instance) { }
|
||||
protected virtual void Importing(ImportContentContext context, TPart instance) { }
|
||||
protected virtual void Imported(ImportContentContext context, TPart instance) { }
|
||||
protected virtual void Exporting(ExportContentContext context, TPart instance) { }
|
||||
protected virtual void Exported(ExportContentContext context, TPart instance) { }
|
||||
protected virtual void Restoring(RestoreContentContext context, TPart instance) { }
|
||||
protected virtual void Restored(RestoreContentContext context, TPart instance) { }
|
||||
protected virtual void Destroying(DestroyContentContext context, TPart instance) { }
|
||||
@ -121,6 +125,26 @@ namespace Orchard.ContentManagement.Handlers {
|
||||
Indexed(context, context.ContentItem.As<TPart>());
|
||||
}
|
||||
|
||||
void IContentStorageFilter.Importing(ImportContentContext context) {
|
||||
if (context.ContentItem.Is<TPart>())
|
||||
Importing(context, context.ContentItem.As<TPart>());
|
||||
}
|
||||
|
||||
void IContentStorageFilter.Imported(ImportContentContext context) {
|
||||
if (context.ContentItem.Is<TPart>())
|
||||
Imported(context, context.ContentItem.As<TPart>());
|
||||
}
|
||||
|
||||
void IContentStorageFilter.Exporting(ExportContentContext context) {
|
||||
if (context.ContentItem.Is<TPart>())
|
||||
Exporting(context, context.ContentItem.As<TPart>());
|
||||
}
|
||||
|
||||
void IContentStorageFilter.Exported(ExportContentContext context) {
|
||||
if (context.ContentItem.Is<TPart>())
|
||||
Exported(context, context.ContentItem.As<TPart>());
|
||||
}
|
||||
|
||||
void IContentStorageFilter.Restoring(RestoreContentContext context) {
|
||||
if (context.ContentItem.Is<TPart>())
|
||||
Restoring(context, context.ContentItem.As<TPart>());
|
||||
|
Loading…
Reference in New Issue
Block a user