private void Document_Update_After(object sender, DocumentEventArgs e) { // Update the document itself, only if there is no workflow try { if (e.Node.WorkflowStep == null) { DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID); } else { if (e.Node.WorkflowStep.StepIsPublished && DynamicRouteInternalHelper.ErrorOnConflict()) { DynamicRouteEventHelper.DocumentInsertUpdated_CheckOnly(e.Node.NodeID); } } } catch (UrlSlugCollisionException ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "UrlSlugConflict", $"Occurred on Document Update After for ${e.Node.NodeAlias}."); e.Cancel(); } catch (Exception ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "Error", $"Occurred on Document Update After for ${e.Node.NodeAlias}."); e.Cancel(); } }
private void Document_Move_After(object sender, DocumentEventArgs e) { // Update on the Node itself, this will rebuild itself and it's children DynamicRouteInternalHelper.CommitTransaction(true); try { DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID); var PreviousParentNodeID = Thread.GetData(Thread.GetNamedDataSlot("PreviousParentIDForNode_" + e.Node.NodeID)); if (PreviousParentNodeID != null && (int)PreviousParentNodeID != e.TargetParentNodeID) { // If differnet node IDs, it moved to another parent, so also run Document Moved check on both new and old parent DynamicRouteEventHelper.DocumentMoved((int)PreviousParentNodeID, e.TargetParentNodeID); } } catch (UrlSlugCollisionException ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "UrlSlugConflict", $"Occurred on Document After Before for Node {e.Node.NodeAliasPath}"); e.Cancel(); } catch (Exception ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "Error", $"Occurred on Document Move After for Node {e.Node.NodeAliasPath}"); } }
private void CultureSite_InsertDelete_After(object sender, ObjectEventArgs e) { CultureSiteInfo CultureSite = (CultureSiteInfo)e.Object; string SiteName = DynamicRouteHelper.GetSite(CultureSite.SiteID).SiteName; DynamicRouteEventHelper.SiteLanguageChanged(SiteName); }
private void DataClass_Update_After(object sender, ObjectEventArgs e) { DataClassInfo Class = (DataClassInfo)e.Object; // If the "Continue" is false, it means that a DataClass_Update_Before found that the UrlPattern was changed // Otherwise the "Continue" will be true that this is the first time triggering it. if (!new RecursionControl("TriggerClassUpdateAfter_" + Class.ClassName).Continue) { DynamicRouteEventHelper.ClassUrlPatternChanged(Class.ClassName); } }
private void Document_Copy_After(object sender, DocumentEventArgs e) { try { DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID); } catch (UrlSlugCollisionException ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "UrlSlugConflict", $"Occurred on Document Copy for Node {e.Node.NodeAliasPath}"); e.Cancel(); } catch (Exception ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "Error", $"Occurred on Document Copy for Node {e.Node.NodeAliasPath}"); } }
private void Document_Publish_After(object sender, WorkflowEventArgs e) { // Update the document itself try { DynamicRouteEventHelper.DocumentInsertUpdated(e.Document.NodeID); } catch (UrlSlugCollisionException ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "UrlSlugConflict", $"Occurred on Document Publish After of Node {e.Document.NodeID} [{e.Document.NodeAliasPath}]"); e.Cancel(); } catch (Exception ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "Error", $"Occurred on Document Publish After of Node {e.Document.NodeID} [{e.Document.NodeAliasPath}]"); } }
private void CultureSite_InsertDelete_After(object sender, ObjectEventArgs e) { CultureSiteInfo CultureSite = (CultureSiteInfo)e.Object; string SiteName = DynamicRouteInternalHelper.GetSite(CultureSite.SiteID).SiteName; try { DynamicRouteEventHelper.SiteLanguageChanged(SiteName); } catch (UrlSlugCollisionException ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "UrlSlugConflict", $"Occurred on Culture Site Insert/Delete for Site {SiteName}"); e.Cancel(); } catch (Exception ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "Error", $"Occurred on Culture Site Insert/Delete for Site {SiteName}"); } }
private void Document_Move_After(object sender, DocumentEventArgs e) { var Slot = Thread.AllocateNamedDataSlot("PreviousParentIDForNode_" + e.Node.NodeID); var PreviousParentNodeID = Thread.GetData(Slot); if (PreviousParentNodeID != null) { // Check if the move was just ordering if ((int)PreviousParentNodeID != e.TargetParentNodeID) { DynamicRouteEventHelper.DocumentMoved((int)PreviousParentNodeID, e.TargetParentNodeID); } else { // Just update the document which will check for siblings with NodeOrder DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID); } } }
private void Document_ChangeOrder_After(object sender, DocumentChangeOrderEventArgs e) { // Sometimes ChangeOrder is triggered before the insert (if it inserts before other records), // So will use recursion helper to prevent this from running on the insert as well. RecursionControl PreventInsertAfter = new RecursionControl("PreventInsertAfter" + e.Node.NodeID); var Trigger = PreventInsertAfter.Continue; try { DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID); } catch (UrlSlugCollisionException ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "UrlSlugConflict", $"Occurred on Document Change Order for Node {e.Node.NodeAliasPath}"); e.Cancel(); } catch (Exception ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "Error", $"Occurred on Document Change Order for Node {e.Node.NodeAliasPath}"); } }
private void Document_Insert_After(object sender, DocumentEventArgs e) { // Prevents the CHangeOrderAfter which may trigger before this from creating a double queue item. RecursionControl PreventInsertAfter = new RecursionControl("PreventInsertAfter" + e.Node.NodeID); if (PreventInsertAfter.Continue) { try { DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID); } catch (UrlSlugCollisionException ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "UrlSlugConflict", $"Occurred on Document Insert After for Node {e.Node.NodeAliasPath}"); e.Cancel(); } catch (Exception ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "Error", $"Occurred on Document Insert After for Node {e.Node.NodeAliasPath}"); } } }
private void SettingsKey_InsertUpdate_After(object sender, ObjectEventArgs e) { SettingsKeyInfo Key = (SettingsKeyInfo)e.Object; switch (Key.KeyName.ToLower()) { case "cmsdefaultculturecode": if (Key.SiteID > 0) { string SiteName = DynamicRouteHelper.GetSite(Key.SiteID).SiteName; DynamicRouteEventHelper.SiteDefaultLanguageChanged(SiteName); } else { foreach (string SiteName in SiteInfoProvider.GetSites().Select(x => x.SiteName)) { DynamicRouteEventHelper.SiteDefaultLanguageChanged(SiteName); } } break; case "generateculturevariationurlslugs": if (Key.SiteID > 0) { string SiteName = DynamicRouteHelper.GetSite(Key.SiteID).SiteName; DynamicRouteEventHelper.CultureVariationSettingsChanged(SiteName); } else { foreach (string SiteName in SiteInfoProvider.GetSites().Select(x => x.SiteName)) { DynamicRouteEventHelper.CultureVariationSettingsChanged(SiteName); } } break; } }
private void DataClass_Update_After(object sender, ObjectEventArgs e) { DataClassInfo Class = (DataClassInfo)e.Object; RecursionControl PreventDoubleClassUpdateTrigger = new RecursionControl("PreventDoubleClassUpdateTrigger_" + Class.ClassName); // If the "Continue" is false, it means that a DataClass_Update_Before found that the UrlPattern was changed // Otherwise the "Continue" will be true that this is the first time triggering it. if (!new RecursionControl("TriggerClassUpdateAfter_" + Class.ClassName).Continue&& PreventDoubleClassUpdateTrigger.Continue) { try { DynamicRouteEventHelper.ClassUrlPatternChanged(Class.ClassName); } catch (UrlSlugCollisionException ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "UrlSlugConflict", $"Occurred on Class Update After for class {Class.ClassName}"); e.Cancel(); } catch (Exception ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "Error", $"Occurred on Class Update After for class {Class.ClassName}"); } } }
private void Document_Update_After(object sender, DocumentEventArgs e) { // Update the document itself DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID); }
private void SettingsKey_InsertUpdate_After(object sender, ObjectEventArgs e) { SettingsKeyInfo Key = (SettingsKeyInfo)e.Object; switch (Key.KeyName.ToLower()) { case "cmsdefaultculturecode": try { if (Key.SiteID > 0) { string SiteName = DynamicRouteInternalHelper.GetSite(Key.SiteID).SiteName; DynamicRouteEventHelper.SiteDefaultLanguageChanged(SiteName); } else { foreach (string SiteName in SiteInfoProvider.GetSites().Select(x => x.SiteName)) { DynamicRouteEventHelper.SiteDefaultLanguageChanged(SiteName); } } } catch (UrlSlugCollisionException ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "UrlSlugConflict", $"Occurred on Settings Key Update After for Key {Key.KeyName}"); e.Cancel(); } catch (Exception ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "Error", $"Occurred on Settings Key Update After for Key {Key.KeyName}"); } break; case "generateculturevariationurlslugs": try { if (Key.SiteID > 0) { string SiteName = DynamicRouteInternalHelper.GetSite(Key.SiteID).SiteName; DynamicRouteEventHelper.CultureVariationSettingsChanged(SiteName); } else { foreach (string SiteName in SiteInfoProvider.GetSites().Select(x => x.SiteName)) { DynamicRouteEventHelper.CultureVariationSettingsChanged(SiteName); } } } catch (UrlSlugCollisionException ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "UrlSlugConflict", $"Occurred on Settings Key Update After for Key {Key.KeyName}"); e.Cancel(); } catch (Exception ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "Error", $"Occurred on Settings Key Update After for Key {Key.KeyName}"); } break; } }
private void Document_InsertLink_After(object sender, DocumentEventArgs e) { DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID); }
private void Document_Delete_After(object sender, DocumentEventArgs e) { DynamicRouteEventHelper.DocumentDeleted(e.Node.NodeParentID); }
private void Document_ChangeOrder_After(object sender, DocumentChangeOrderEventArgs e) { DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID); }