public void DoInsidePublishing(IContextOfSite context, Action <VersioningActionInfo> action) { var possibleContextOfBlock = context as IContextOfBlock; var enabled = possibleContextOfBlock?.Publishing.ForceDraft ?? false; var instanceId = possibleContextOfBlock?.Module.Id ?? Eav.Constants.IdNotInitialized; var userId = (context.User as DnnUser)?.UnwrappedContents.UserID ?? Eav.Constants.IdNotInitialized; Log.Add($"DoInsidePublishing(module:{instanceId}, user:{userId}, enabled:{enabled})"); if (enabled) { var moduleVersionSettings = new DnnPagePublishing.ModuleVersions(instanceId, Log); // Get an new version number and submit it to DNN // The submission must be made every time something changes, because a "discard" could have happened // in the meantime. TabChangeTracker.Instance.TrackModuleModification( moduleVersionSettings.ModuleInfo, moduleVersionSettings.IncreaseLatestVersion(), userId ); } var versioningActionInfo = new VersioningActionInfo(); action.Invoke(versioningActionInfo); Log.Add("/DoInsidePublishing"); }
public void DoInsidePublishing(IInstanceContext context, Action <VersioningActionInfo> action) { var instanceId = context.Container.Id; var userId = (context.User as DnnUser).UnwrappedContents.UserID; var enabled = IsEnabled(instanceId); Log.Add($"DoInsidePublishing(module:{instanceId}, user:{userId}, enabled:{enabled})"); if (enabled) { var moduleVersionSettings = new DnnPagePublishing.ModuleVersions(instanceId, Log); // Get an new version number and submit it to DNN // The submission must be made every time something changes, because a "discard" could have happened // in the meantime. TabChangeTracker.Instance.TrackModuleModification( moduleVersionSettings.ModuleInfo, moduleVersionSettings.IncreaseLatestVersion(), userId ); } var versioningActionInfo = new VersioningActionInfo(); action.Invoke(versioningActionInfo); Log.Add("/DoInsidePublishing"); }
public int GetPublishedVersion(int instanceId) { var moduleVersionSettings = new DnnPagePublishing.ModuleVersions(instanceId, Log); var publ = moduleVersionSettings.GetPublishedVersion(); Log.Add($"GetPublishedVersion(m:{instanceId}) = pub:{publ}"); return(publ); }
public int GetLatestVersion(int instanceId) { var moduleVersionSettings = new DnnPagePublishing.ModuleVersions(instanceId, Log); var ver = moduleVersionSettings.GetLatestVersion(); Log.Add($"GetLatestVersion(m:{instanceId}) = ver:{ver}"); return(ver); }