mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
45 lines
1.5 KiB
C#
45 lines
1.5 KiB
C#
using Orchard.ContentManagement;
|
|
using Orchard.Data;
|
|
using Orchard.ContentManagement.Handlers;
|
|
using Orchard.Localization;
|
|
using Orchard.SecureSocketsLayer.Models;
|
|
using Orchard.Caching;
|
|
|
|
namespace Orchard.SecureSocketsLayer.Handlers {
|
|
public class SslSettingsPartHandler : ContentHandler {
|
|
private readonly ISignals _signals;
|
|
|
|
public SslSettingsPartHandler(ISignals signals) {
|
|
|
|
_signals = signals;
|
|
|
|
T = NullLocalizer.Instance;
|
|
|
|
Filters.Add(new ActivatingFilter<SslSettingsPart>("Site"));
|
|
|
|
// Evict cached content when updated, removed or destroyed.
|
|
OnUpdated<SslSettingsPart>((context, part) => Invalidate(part));
|
|
OnPublished<SslSettingsPart>((context, part) => Invalidate(part));
|
|
OnRemoved<SslSettingsPart>((context, part) => Invalidate(part));
|
|
OnDestroyed<SslSettingsPart>((context, part) => Invalidate(part));
|
|
}
|
|
|
|
public Localizer T { get; set; }
|
|
|
|
protected override void GetItemMetadata(GetContentItemMetadataContext context) {
|
|
if (context.ContentItem.ContentType != "Site")
|
|
return;
|
|
base.GetItemMetadata(context);
|
|
context.Metadata.EditorGroupInfo.Add(new GroupInfo(T("SSL")) {
|
|
Id = "Ssl",
|
|
Position = "2"
|
|
});
|
|
}
|
|
|
|
private void Invalidate(SslSettingsPart content) {
|
|
_signals.Trigger($"SslSettingsPart_{content.Id}");
|
|
_signals.Trigger("SslSettingsPart_EvictAll");
|
|
}
|
|
}
|
|
}
|