protected void EditForm_OnBeforeRedirect(object sender, EventArgs e) { if (editForm.IsInsertMode) { WorkflowStepInfoProvider.CreateDefaultWorkflowSteps(CurrentWorkflow); // To prevent from creating multiple versions - turn versioning back on CurrentWorkflow.Generalized.SupportsVersioning = true; // Create one version manually if (LicenseHelper.CheckFeature(RequestContext.CurrentDomain, FeatureEnum.ObjectVersioning) && ObjectVersionManager.AllowObjectVersioning(CurrentWorkflow)) { ObjectVersionManager.CreateVersion(CurrentWorkflow, CMSActionContext.CurrentUser.UserID); } } }
/// <summary> /// Creates new version of the object. Called when the "Create version" button is pressed. /// Expects the CreateVersionedObject method to be run first. /// </summary> private bool CreateVersion() { // Get the css stylesheet CssStylesheetInfo newStylesheetVersion = CssStylesheetInfoProvider.GetCssStylesheetInfo("MyNewVersionedStylesheet"); if (newStylesheetVersion != null) { // Check if object versioning of stylesheet objects is allowed on current site if (ObjectVersionManager.AllowObjectVersioning(newStylesheetVersion, CMSContext.CurrentSiteName)) { // Update the properties newStylesheetVersion.StylesheetDisplayName = newStylesheetVersion.StylesheetDisplayName.ToLower(); // Create new version ObjectVersionManager.CreateVersion(newStylesheetVersion, true); return(true); } } return(false); }