protected override void Updating(UpdateContentContext context) {
            var contentItem = context.ContentItem;

            _ignoreExportHandlerFor = contentItem;
            _previousVersionXml = _contentItemCreated 
                ? default(XElement) // No need to do a diff on a newly created content item.
                : _contentManager.Export(contentItem);
            _ignoreExportHandlerFor = null;
        }
 private void ScheduleNewTask(UpdateContentContext context, FeaturedProductsSettingsPart part) {
     if (part.TimeLimit.HasValue) {
         if (part.TimeLimit < DateTime.UtcNow) {
             // Schedule for tomorrow
             var forDate = DateTime.UtcNow;
             if (part.TimeLimit.Value.TimeOfDay > forDate.TimeOfDay) {
                 forDate = forDate.AddDays(1);
             }
             part.TimeLimit = _featuredProductService.BuildTimeLimit(forDate, part.TimeLimit.Value);
         }
         _featuredProductService.ScheduleNextTask(part.TimeLimit.Value);
     }
 }
        private void EndUpdateEvent(UpdateContentContext context, AuditTrailSettingsPart part) {
            var newEventSettings = part.Retrieve<string>("Events");

            if (newEventSettings == _oldEventSettings)
                return;

            _auditTrailManager.CreateRecord<AuditTrailSettingsEventProvider>(
                eventName: AuditTrailSettingsEventProvider.EventsChanged,
                eventData: new Dictionary<string, object> {
                    {"OldSettings", _auditTrailManager.ToEventData(_oldEventSettings)},
                    {"NewSettings", _auditTrailManager.ToEventData(newEventSettings)}
                },
                user: _wca.GetContext().CurrentUser);
        }
Example #4
0
        private void PostProcessPlacedWidget(UpdateContentContext context, WidgetPart part) {
            if (!part.IsPlaceableContent())
                return;

            // This is a widget placed on a layout, so clear out the zone propertiey
            // to prevent the widget from appearing on the Widgets screen and on the front-end.
            part.Zone = null;

            // To prevent the widget from being recognized as being orphaned, set its container.
            // If the current container is a LayerPart, override that as well.
            var commonPart = part.As<ICommonPart>();
            if (commonPart != null && (commonPart.Container == null || commonPart.Container.Is<LayerPart>())) {
                commonPart.Container = _orchardServices.WorkContext.CurrentSite;
            }
        }
        protected override void Updated(UpdateContentContext context) {
            var contentItem = context.ContentItem;
           
            if (_contentItemCreated) {
                RecordAuditTrailEvent(ContentAuditTrailEventProvider.Created, context.ContentItem);
            }
            else {
                _ignoreExportHandlerFor = contentItem;
                var newVersionXml = _contentManager.Export(contentItem);
                _ignoreExportHandlerFor = null;

                var diffGram = _analyzer.GenerateDiffGram(_previousVersionXml, newVersionXml);
                RecordAuditTrailEvent(ContentAuditTrailEventProvider.Saved, context.ContentItem, diffGram: diffGram, previousVersionXml: _previousVersionXml);    
            }
        }
        private void EndUpdateEvent(UpdateContentContext context, AuditTrailTrimmingSettingsPart part) {
            var newRetentionPeriod = part.RetentionPeriod;
            var newMinimumRunInterval = part.MinimumRunInterval;

            if (newRetentionPeriod == _oldRetentionPeriod && newMinimumRunInterval == _oldMinimumRunInterval)
                return;

            _auditTrailManager.CreateRecord<AuditTrailTrimmingSettingsEventProvider>(
                eventName: AuditTrailTrimmingSettingsEventProvider.TrimmingSettingsChanged,
                user: _wca.GetContext().CurrentUser,
                eventData: new Dictionary<string, object> {
                    {"OldRetentionPeriod", _oldRetentionPeriod},
                    {"NewRetentionPeriod", newRetentionPeriod},
                    {"OldMinimumRunInterval", _oldMinimumRunInterval},
                    {"NewMinimumRunInterval", newMinimumRunInterval}
                });
        }
        private void RescheduleExistingProducts(UpdateContentContext updateContentContext, ProductSettingsPart part) {

            var existingTasks = _scheduledTaskManager
                .GetTasks(Constants.UnpublishTaskName)
                .ToList();

            _scheduledTaskManager.DeleteTasks(null, t => t.TaskType == Constants.UnpublishTaskName);

            if (part.HideProductDelay > 0) {
                foreach (var task in existingTasks) {
                    if (task.ContentItem != null) {
                        var published = task.ContentItem.As<CommonPart>();
                        if (published != null && published.PublishedUtc.HasValue) {
                            _scheduledTaskManager.CreateTask(Constants.UnpublishTaskName, published.PublishedUtc.Value.AddDays(part.HideProductDelay), task.ContentItem);
                        }
                    }
                }
            }
        }
 protected override void Updated(UpdateContentContext context) {
     var part = context.ContentItem.As<ConfigurationPart>();
     if (part == null)
         return;
     try {
         //test if configuration works
         var root = new TflRoot(
             part.Configuration,
             null,
             new CfgNetNotifier(_notifier)
         );
         CheckAddress(part.StartAddress);
         CheckAddress(part.EndAddress);
         Logger.Information("Loaded {0} with {1} warnings, and {2} errors.", part.Title(), root.Warnings().Length, root.Errors().Length);
     } catch (Exception ex) {
         _notifier.Add(NotifyType.Warning, T(ex.Message));
         Logger.Warning(ex.Message);
     }
 }
 public void Updated(UpdateContentContext context)
 {
     TriggerIfGraph(context);
 }
 protected override void  Updated(UpdateContentContext context)
 {
     var socket = context.ContentItem.As<SocketsPart>();
     if (socket!=null) {
         // TODO: Perhaps there's a way not to do this since ConnectorCollection tracks removed and added objects,
         // ideally we can drop this and let everything happen at the end of transaction scope.
         // When using the API a call to flush is manually needed except when Creating/Publishing.
         socket.Sockets.Flush();
     }
 }
Example #11
0
        public string UpdateEditor(IContent content, IUpdateModel updater)
        {
            var context = new UpdateContentContext(content.ContentItem);

            Handlers.Invoke(handler => handler.Updating(context), Logger);

            var result = _contentDisplay.Value.UpdateEditor(content, updater);

            Handlers.Invoke(handler => handler.Updated(context), Logger);

            return result;
        }
 private void BeginUpdateEvent(UpdateContentContext context, AuditTrailSettingsPart part) {
     _oldEventSettings = part.Retrieve<string>("Events");
 }
 protected override void Updated(UpdateContentContext context)
 {
     EnforceResourceSharingOffOnDefault(context);
 }
Example #14
0
        public override void Updating(UpdateContentContext context)
        {
            var utcNow = _clock.UtcNow;

            context.ContentItem.ModifiedUtc = utcNow;
        }
 private void BeginUpdateEvent(UpdateContentContext context, AuditTrailTrimmingSettingsPart part) {
     _oldRetentionPeriod = part.RetentionPeriod;
     _oldMinimumRunInterval = part.MinimumRunInterval;
 }
Example #16
0
 public virtual void Updated(UpdateContentContext context)
 {
 }
Example #17
0
 public virtual void Updated(UpdateContentContext context)
 {
 }
 public override void Updating(UpdateContentContext context)
 {
     var utcNow = _clock.UtcNow;
     context.ContentItem.ModifiedUtc = utcNow;
 }
 private void EvictCache(UpdateContentContext context, OutputCachePart part)
 {
     _signals.Trigger(OutputCachePart.ContentSignalName(part.Id));
 }
        protected override void Updated(UpdateContentContext context)
        {
            base.Updated(context);

            InvalidateCachesAfteMenuItemChanges(context);
        }
 private void TriggerNotificationsSubscriptionUpdatedEvents(UpdateContentContext context, NotificationsSubscriptionPart part) {
     // TODO: these triggers / iterating over interfaces are what will allow other modules to integrate
 }
 public void Updating(UpdateContentContext context)
 {
 }
        protected override void Updated(UpdateContentContext context) {
            base.Updated(context);

            _outputCachedPartsService.InvalidateCachedOutput(context.ContentItem.Id);
        }
 private void AssignUpdateUser(UpdateContentContext context, CoeveryCommonPart part) {
     part.Modifer = _authenticationService.GetAuthenticatedUser();
 }
Example #25
0
 public virtual void Updated(UpdateContentContext context, TPart instance)
 {
 }
 public void Updated(UpdateContentContext context)
 {
     IUser user = context.ContentManager.Get<IUser>(context.Id);
     if (user != null)
     {
         this._scheduledTaskManager.CreateTask("SychronizeUser", this._clock.UtcNow.AddMinutes(1), context.ContentItem);
     }
 }
Example #27
0
 protected virtual void Updated(UpdateContentContext context)
 {
 }
 void CreateIndexingTask(UpdateContentContext context, ContentPart part) {
     _indexingTaskManager.CreateUpdateIndexTask(context.ContentItem);
 }
Example #29
0
 protected virtual void Updated(UpdateContentContext context, TPart instance)
 {
 }
        protected override void  Updating(UpdateContentContext context)
        {
 	         base.Updating(context);
        }
 private void AssignUpdateDates(UpdateContentContext context, CoeveryCommonPart part) {
     var utcNow = _clock.UtcNow;
     part.ModifiedUtc = utcNow;
     part.VersionModifiedUtc = utcNow;
 }
 protected override void Updated(UpdateContentContext context) {
     if (context.ContentItem.ContentType != "Site")
         return;
     base.Updated(context);
     _signals.Trigger(TRIGGER_KEY);
 }