/// <summary> /// Approves a draft and sets it's status as AwaitingPublishing /// </summary> /// <param name="siteGuid"></param> /// <param name="approvalUserGuid"></param> public void ApproveContentForPublishing(Guid siteGuid, Guid approvalUserGuid) { // get latest workflow record waiting for approval ContentWorkflow submittedContent = ContentWorkflow.GetWorkInProgress(this.moduleGuid, ContentWorkflowStatus.AwaitingApproval.ToString()); if (submittedContent == null) { return; } //update content workflow to show record is now AwaitingPublishing submittedContent.Status = ContentWorkflowStatus.AwaitingPublishing; submittedContent.LastModUserGuid = approvalUserGuid; submittedContent.LastModUtc = DateTime.UtcNow; submittedContent.Save(); }
public void PublishDraft(Guid siteGuid, Guid approvalUserGuid) { // get latest workflow record waiting for approval ContentWorkflow submittedContent = ContentWorkflow.GetWorkInProgress(this.moduleGuid, ContentWorkflowStatus.Draft.ToString()); if (submittedContent == null) { return; } // create a new content history record of the existing live content ContentHistory history = new ContentHistory(); history.ContentGuid = ModuleGuid; history.ContentText = Body; history.SiteGuid = siteGuid; history.UserGuid = LastModUserGuid; history.CreatedUtc = LastModUtc; history.Save(); //update the html with the approved content this.body = submittedContent.ContentText; // Joe D - this line looks like it would be wrong if not using 3 level approval // so I commented it out. I also added the if not Guid.Empty but then decided it was still wrong // a draft could be pubklished directly by an editor without ever submitting for approval // Joe A 2013-04-24 integration comment //Guid submitterGuid = ContentWorkflow.GetDraftSubmitter(submittedContent.Guid); //if (submitterGuid != Guid.Empty) //{ // this.lastModUserGuid = submitterGuid; //} //else //{ this.lastModUserGuid = submittedContent.LastModUserGuid; //} this.lastModUtc = DateTime.UtcNow; this.Save(); //update content workflow to show record is now approved submittedContent.Status = ContentWorkflowStatus.Approved; submittedContent.LastModUserGuid = approvalUserGuid; submittedContent.LastModUtc = DateTime.UtcNow; submittedContent.Save(); }
/// <summary> /// Publishes an approved content draft. /// </summary> /// <param name="siteGuid"></param> /// <param name="publishingUserGuid"></param> public void PublishApprovedContent(Guid siteGuid, Guid publishingUserGuid) { ContentWorkflow approvedContent = ContentWorkflow.GetWorkInProgress(this.moduleGuid, ContentWorkflowStatus.AwaitingPublishing.ToString()); if (approvedContent == null) { return; } // create a new content history record of the existing live content ContentHistory history = new ContentHistory(); history.ContentGuid = ModuleGuid; history.ContentText = Body; history.SiteGuid = siteGuid; history.UserGuid = LastModUserGuid; history.CreatedUtc = LastModUtc; history.Save(); //update the html with the approved content this.body = approvedContent.ContentText; Guid submitterGuid = ContentWorkflow.GetDraftSubmitter(approvedContent.Guid); if (submitterGuid != Guid.Empty) { this.lastModUserGuid = submitterGuid; } this.lastModUtc = DateTime.UtcNow; this.Save(); //update content workflow to show record is now approved approvedContent.Status = ContentWorkflowStatus.Approved; approvedContent.LastModUserGuid = publishingUserGuid; approvedContent.LastModUtc = DateTime.UtcNow; approvedContent.Save(); }
public void ApproveContent(Guid siteGuid, Guid approvalUserGuid, bool allowUnsubmitted) { // get latest workflow record waiting for approval ContentWorkflow submittedContent = ContentWorkflow.GetWorkInProgress(this.moduleGuid, ContentWorkflowStatus.AwaitingApproval.ToString()); if ((submittedContent == null) && (allowUnsubmitted)) { submittedContent = ContentWorkflow.GetWorkInProgress(this.moduleGuid, ContentWorkflowStatus.Draft.ToString()); } if (submittedContent == null) { return; } // create a new content history record of the existing live content ContentHistory history = new ContentHistory(); history.ContentGuid = ModuleGuid; history.ContentText = Body; history.SiteGuid = siteGuid; history.UserGuid = LastModUserGuid; history.CreatedUtc = LastModUtc; history.Save(); //update the html with the approved content this.body = submittedContent.ContentText; this.lastModUserGuid = submittedContent.LastModUserGuid; this.lastModUtc = DateTime.UtcNow; this.Save(); //update content workflow to show record is now approved submittedContent.Status = ContentWorkflowStatus.Approved; submittedContent.LastModUserGuid = approvalUserGuid; submittedContent.LastModUtc = DateTime.UtcNow; submittedContent.Save(); }