Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        public void CreateHistory(Guid siteGuid)
        {
            if (this.itemGuid == Guid.Empty)
            {
                return;
            }

            HtmlContent currentVersion = new HtmlContent(moduleID);

            if (currentVersion.Body == this.Body)
            {
                return;
            }

            ContentHistory history = new ContentHistory();

            history.ContentGuid = currentVersion.ModuleGuid;
            history.ContentText = currentVersion.Body;
            history.SiteGuid    = siteGuid;
            history.UserGuid    = currentVersion.LastModUserGuid;
            history.CreatedUtc  = currentVersion.LastModUtc;
            history.Save();
        }
Exemplo n.º 3
0
        /// <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();
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
        /// <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();
        }
Exemplo n.º 7
0
        public void CreateHistory(Guid siteGuid)
        {
            if (this.itemGuid == Guid.Empty) { return; }

            HtmlContent currentVersion = new HtmlContent(moduleID);
            if (currentVersion.Body == this.Body) { return; }

            ContentHistory history = new ContentHistory();
            history.ContentGuid = currentVersion.ModuleGuid;
            history.ContentText = currentVersion.Body;
            history.SiteGuid = siteGuid;
            history.UserGuid = currentVersion.LastModUserGuid;
            history.CreatedUtc = currentVersion.LastModUtc;
            history.Save();
        }
Exemplo n.º 8
0
        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();
        }
Exemplo n.º 9
0
        public void CreateHistory(Guid siteGuid)
        {
            if (this.blogGuid == Guid.Empty) { return; }

            Blog currentVersion = new Blog(this.itemID);
            if (currentVersion.Description == this.Description) { return; }

            ContentHistory history = new ContentHistory();
            history.ContentGuid = currentVersion.BlogGuid;
            history.Title = currentVersion.Title;
            history.ContentText = currentVersion.Description;
            history.SiteGuid = siteGuid;
            history.UserGuid = currentVersion.LastModUserGuid;
            history.CreatedUtc = currentVersion.LastModUtc;
            history.Save();
        }