Ejemplo n.º 1
0
        private static List <ContentHistory> LoadListFromReader(IDataReader reader)
        {
            List <ContentHistory> contentHistoryList = new List <ContentHistory>();

            try
            {
                while (reader.Read())
                {
                    ContentHistory contentHistory = new ContentHistory();
                    contentHistory.guid        = new Guid(reader["Guid"].ToString());
                    contentHistory.siteGuid    = new Guid(reader["SiteGuid"].ToString());
                    contentHistory.userGuid    = new Guid(reader["UserGuid"].ToString());
                    contentHistory.contentGuid = new Guid(reader["ContentGuid"].ToString());
                    contentHistory.title       = reader["Title"].ToString();
                    contentHistory.contentText = reader["ContentText"].ToString();
                    contentHistory.customData  = reader["CustomData"].ToString();
                    contentHistory.createdUtc  = Convert.ToDateTime(reader["CreatedUtc"]);
                    contentHistory.historyUtc  = Convert.ToDateTime(reader["HistoryUtc"]);
                    contentHistory.userLogin   = reader["LoginName"].ToString();
                    contentHistory.userName    = reader["Name"].ToString();
                    contentHistoryList.Add(contentHistory);
                }
            }
            finally
            {
                reader.Close();
            }

            return(contentHistoryList);
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
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();
        }
Ejemplo 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();
        }
Ejemplo n.º 5
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();
        }
Ejemplo n.º 6
0
        private void PopulateControls()
        {
            if (moduleId == -1) { return; }
            if (itemId == -1) { return; }
            //if (module == null) { return; }
            if (historyGuid == Guid.Empty) { return; }

            Blog blog = new Blog(itemId);
            if (blog.ModuleId != moduleId)
            {
                SiteUtils.RedirectToAccessDeniedPage(this);
                return;
            }

            ContentHistory history = new ContentHistory(historyGuid);
            if (history.ContentGuid != blog.BlogGuid) { return; }

            litCurrentHeading.Text = string.Format(BlogResources.CurrentVersionHeadingFormat,
                DateTimeHelper.Format(blog.LastModUtc, timeZone, "g", timeOffset));

            if (BlogConfiguration.UseHtmlDiff)
            {
                HtmlDiff diffHelper = new HtmlDiff(history.ContentText, blog.Description);
                litCurrentVersion.Text = diffHelper.Build();
            }
            else
            {
                litCurrentVersion.Text = blog.Description;
            }

            litHistoryHead.Text = string.Format(BlogResources.VersionAsOfHeadingFormat,
                DateTimeHelper.Format(history.CreatedUtc, timeZone, "g", timeOffset));

            litHistoryVersion.Text = history.ContentText;

            string onClick = "top.window.LoadHistoryInEditor('" + historyGuid.ToString() + "');  return false;";
            btnRestore.Attributes.Add("onclick", onClick);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Compares 2 instances of ContentHistory.
 /// </summary>
 public static int CompareByTitle(ContentHistory contentHistory1, ContentHistory contentHistory2)
 {
     return contentHistory1.Title.CompareTo(contentHistory2.Title);
 }
Ejemplo n.º 8
0
        private static List<ContentHistory> LoadListFromReader(IDataReader reader)
        {
            List<ContentHistory> contentHistoryList = new List<ContentHistory>();
            try
            {
                while (reader.Read())
                {
                    ContentHistory contentHistory = new ContentHistory();
                    contentHistory.guid = new Guid(reader["Guid"].ToString());
                    contentHistory.siteGuid = new Guid(reader["SiteGuid"].ToString());
                    contentHistory.userGuid = new Guid(reader["UserGuid"].ToString());
                    contentHistory.contentGuid = new Guid(reader["ContentGuid"].ToString());
                    contentHistory.title = reader["Title"].ToString();
                    contentHistory.contentText = reader["ContentText"].ToString();
                    contentHistory.customData = reader["CustomData"].ToString();
                    contentHistory.createdUtc = Convert.ToDateTime(reader["CreatedUtc"]);
                    contentHistory.historyUtc = Convert.ToDateTime(reader["HistoryUtc"]);
                    contentHistory.userLogin = reader["LoginName"].ToString();
                    contentHistory.userName = reader["Name"].ToString();
                    contentHistoryList.Add(contentHistory);

                }
            }
            finally
            {
                reader.Close();
            }

            return contentHistoryList;
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Compares 2 instances of ContentHistory.
 /// </summary>
 public static int CompareByCustomData(ContentHistory contentHistory1, ContentHistory contentHistory2)
 {
     return contentHistory1.CustomData.CompareTo(contentHistory2.CustomData);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Compares 2 instances of ContentHistory.
 /// </summary>
 public static int CompareByHistoryUtc(ContentHistory contentHistory1, ContentHistory contentHistory2)
 {
     return contentHistory1.HistoryUtc.CompareTo(contentHistory2.HistoryUtc);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Compares 2 instances of ContentHistory.
 /// </summary>
 public static int CompareByCustomData(ContentHistory contentHistory1, ContentHistory contentHistory2)
 {
     return(contentHistory1.CustomData.CompareTo(contentHistory2.CustomData));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Compares 2 instances of ContentHistory.
 /// </summary>
 public static int CompareByCreatedUtc(ContentHistory contentHistory1, ContentHistory contentHistory2)
 {
     return contentHistory1.CreatedUtc.CompareTo(contentHistory2.CreatedUtc);
 }
Ejemplo n.º 13
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();
        }
Ejemplo n.º 14
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();
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Compares 2 instances of ContentHistory.
 /// </summary>
 public static int CompareByCreatedUtc(ContentHistory contentHistory1, ContentHistory contentHistory2)
 {
     return(contentHistory1.CreatedUtc.CompareTo(contentHistory2.CreatedUtc));
 }
Ejemplo n.º 16
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();
        }
Ejemplo n.º 17
0
        private void PopulateControls()
        {
            if (html == null) { return; }
            this.itemId = html.ItemId;

            edContent.Text = html.Body;
            chkExcludeFromRecentContent.Checked = html.ExcludeFromRecentContent;

            if ((workInProgress != null) && (ViewMode == PageViewMode.WorkInProgress))
            {
                pnlWorkflowStatus.Visible = true;
                edContent.Text = workInProgress.ContentText;

                litRecentActionBy.Text = workInProgress.RecentActionByUserLogin;
                litRecentActionOn.Text = workInProgress.RecentActionOn.ToString();

                lnkCompareDraft.Visible = true;
                lnkCompareDraft.NavigateUrl = SiteRoot
                    + "/HtmlCompare.aspx?pageid=" + pageId.ToString(CultureInfo.InvariantCulture)
                    + "&mid=" + moduleId.ToString(CultureInfo.InvariantCulture) + "&d=" + workInProgress.Guid.ToString();

                switch (workInProgress.Status)
                {
                    case ContentWorkflowStatus.ApprovalRejected:

                        litWorkflowStatus.Text = Resource.ContentWasRejected;
                        lblRecentActionBy.ConfigKey = "RejectedBy";
                        lblRecentActionOn.ConfigKey = "RejectedOn";
                        litCreatedBy.Text = workInProgress.CreatedByUserName;
                        ltlRejectionReason.Text = workInProgress.Notes;
                        divRejection.Visible = true;

                        break;

                    case ContentWorkflowStatus.AwaitingApproval:

                        litWorkflowStatus.Text = Resource.ContentAwaitingApproval;
                        lblRecentActionBy.ConfigKey = "ContentLastEditBy";
                        lblRecentActionOn.ConfigKey = "ContentLastEditDate";
                        ltlRejectionReason.Text = string.Empty;
                        divRejection.Visible = false;

                        break;

                    case ContentWorkflowStatus.AwaitingPublishing:

                        litWorkflowStatus.Text = Resource.ContentAwaitingPublishing;
                        lblRecentActionBy.ConfigKey = "ApprovedBy";
                        lblRecentActionOn.ConfigKey = "ApprovedDate";

                        break;
                    case ContentWorkflowStatus.Draft:

                        litWorkflowStatus.Text = Resource.ContentEditsInProgress;
                        lblRecentActionBy.ConfigKey = "ContentLastEditBy";
                        lblRecentActionOn.ConfigKey = "ContentLastEditDate";
                        ltlRejectionReason.Text = string.Empty;
                        divRejection.Visible = false;

                        break;

                }

            }

            //if(this.itemId == -1)
            //{
            this.btnDelete.Visible = false;

            //}

            if (enableContentVersioning)
            {
                BindHistory();

            }

            if (restoreGuid != Guid.Empty)
            {
                ContentHistory rHistory = new ContentHistory(restoreGuid);
                if (rHistory.ContentGuid == html.ModuleGuid)
                {
                    edContent.Text = rHistory.ContentText;
                }

            }
        }
Ejemplo n.º 18
0
        void grdHistory_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string g = e.CommandArgument.ToString();
            if (g.Length != 36) { return; }
            Guid historyGuid = new Guid(g);

            switch (e.CommandName)
            {
                case "RestoreToEditor":
                    ContentHistory history = new ContentHistory(historyGuid);
                    if (history.Guid == Guid.Empty) { return; }

                    edContent.Text = history.ContentText;
                    BindHistory();
                    break;

                case "DeleteHistory":
                    ContentHistory.Delete(historyGuid);
                    BindHistory();
                    break;

                default:

                    break;
            }
        }
Ejemplo n.º 19
0
        void btnRestoreFromGreyBox_Click(object sender, ImageClickEventArgs e)
        {
            if (hdnHxToRestore.Value.Length != 36)
            {
                BindHistory();
                return;
            }

            Guid h = new Guid(hdnHxToRestore.Value);

            ContentHistory history = new ContentHistory(h);
            if (history.Guid == Guid.Empty) { return; }

            edContent.Text = history.ContentText;
            BindHistory();
        }
Ejemplo n.º 20
0
        protected virtual void PopulateControls()
        {
            if (blog != null)
            {
                dpBeginDate.ShowTime = true;
                if (timeZone != null)
                {
                    dpBeginDate.Text = blog.StartDate.ToLocalTime(timeZone).ToString("g");
                    if (blog.EndDate < DateTime.MaxValue)
                    {
                        dpEndDate.Text = blog.EndDate.ToLocalTime(timeZone).ToString("g");
                    }
                }
                else
                {
                    dpBeginDate.Text = DateTimeHelper.LocalizeToCalendar(blog.StartDate.AddHours(timeOffset).ToString("g"));
                    if (blog.EndDate < DateTime.MaxValue)
                    {
                        dpEndDate.Text = DateTimeHelper.LocalizeToCalendar(blog.EndDate.AddHours(timeOffset).ToString("g"));
                    }
                }
                txtTitle.Text = blog.Title;
                txtSubTitle.Text = blog.SubTitle;
                txtItemUrl.Text = blog.ItemUrl;
                txtLocation.Text = blog.Location;
                edContent.Text = blog.Description;
                edExcerpt.Text = blog.Excerpt;
                txtMetaDescription.Text = blog.MetaDescription;
                txtMetaKeywords.Text = blog.MetaKeywords;
                this.chkIncludeInFeed.Checked = blog.IncludeInFeed;
                chkIsPublished.Checked = blog.IsPublished;

                chkShowDownloadLink.Checked = blog.ShowDownloadLink;
                chkUseBing.Checked = blog.UseBingMap;

                ((GMapTypeSetting)MapTypeControl).SetValue(blog.MapType);
                ((GMapZoomLevelSetting)ZoomLevelControl).SetValue(blog.MapZoom.ToInvariantString());
                txtMapHeight.Text = blog.MapHeight;
                txtMapWidth.Text = blog.MapWidth;
                chkShowMapOptions.Checked = blog.ShowMapOptions;
                chkShowMapZoom.Checked = blog.ShowZoomTool;
                chkShowMapBalloon.Checked = blog.ShowLocationInfo;
                chkShowMapDirections.Checked = blog.UseDrivingDirections;

                chkIncludeInSearchIndex.Checked = blog.IncludeInSearch;
                chkExcludeFromRecentContent.Checked = blog.ExcludeFromRecentContent;
                chkIncludeInSiteMap.Checked = blog.IncludeInSiteMap;
                chkShowAuthorName.Checked = blog.ShowAuthorName;
                chkShowAuthorAvatar.Checked = blog.ShowAuthorAvatar;
                chkShowAuthorBio.Checked = blog.ShowAuthorBio;

                chkIncludeInNews.Checked = blog.IncludeInNews;
                txtPublicationName.Text = blog.PubName;
                txtPubLanguage.Text = blog.PubLanguage;
                txtPubGenres.Text = blog.PubGenres;
                txtPubGeoLocations.Text = blog.PubGeoLocations;
                txtPubKeyWords.Text = blog.PubKeyWords;
                txtPubStockTickers.Text = blog.PubStockTickers;
                txtHeadlineImage.Text = blog.HeadlineImageUrl;

                //sureshchanges//

                coverImage.ImageUrl = "/Data/CoverImages/" + currentUser.UserId + "/" + itemId.ToString() + ".jpg";
                //suresh changes end//

                if (blog.HeadlineImageUrl.Length > 0)
                {
                    imgPreview.ImageUrl = blog.HeadlineImageUrl;
                }
                chkIncludeImageInExcerpt.Checked = blog.IncludeImageInExcerpt;

                ListItem item
                    = ddCommentAllowedForDays.Items.FindByValue(blog.AllowCommentsForDays.ToInvariantString());
                if (item != null)
                {
                    ddCommentAllowedForDays.ClearSelection();
                    item.Selected = true;
                }

                if (restoreGuid != Guid.Empty)
                {
                    ContentHistory rHistory = new ContentHistory(restoreGuid);
                    if (rHistory.ContentGuid == blog.BlogGuid)
                    {
                        edContent.Text = rHistory.ContentText;
                    }

                }
                // show preview button for saved drafts
                if ((!blog.IsPublished) || (blog.StartDate > DateTime.UtcNow)) { btnSaveAndPreview.Visible = true; }

                BindHistory();
            }
            else
            {
                chkIncludeInFeed.Checked = true;
                dpBeginDate.Text = DateTimeHelper.LocalizeToCalendar(DateTime.UtcNow.AddHours(timeOffset).ToString("g"));
                this.btnDelete.Visible = false;
                pnlHistory.Visible = false;
            }

            if ((txtItemUrl.Text.Length == 0)&&(txtTitle.Text.Length > 0))
            {
                String friendlyUrl;

                if (WebConfigSettings.AppendDateToBlogUrls)
                {
                    friendlyUrl = SiteUtils.SuggestFriendlyUrl(txtTitle.Text + "-" + DateTime.UtcNow.AddHours(timeOffset).ToString("yyyy-MM-dd"), siteSettings);
                }
                else
                {
                    friendlyUrl = SiteUtils.SuggestFriendlyUrl(txtTitle.Text, siteSettings);
                }

                txtItemUrl.Text = "~/" + friendlyUrl;
            }

            if (blog != null)
            {
                hdnTitle.Value = txtTitle.Text;
            }
        }
Ejemplo n.º 21
0
 /// <summary>
 /// Compares 2 instances of ContentHistory.
 /// </summary>
 public static int CompareByHistoryUtc(ContentHistory contentHistory1, ContentHistory contentHistory2)
 {
     return(contentHistory1.HistoryUtc.CompareTo(contentHistory2.HistoryUtc));
 }
Ejemplo n.º 22
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();
        }
Ejemplo n.º 23
0
 /// <summary>
 /// Compares 2 instances of ContentHistory.
 /// </summary>
 public static int CompareByTitle(ContentHistory contentHistory1, ContentHistory contentHistory2)
 {
     return(contentHistory1.Title.CompareTo(contentHistory2.Title));
 }
Ejemplo n.º 24
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();
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Compares 2 instances of ContentHistory.
 /// </summary>
 public static int CompareByContentText(ContentHistory contentHistory1, ContentHistory contentHistory2)
 {
     return contentHistory1.ContentText.CompareTo(contentHistory2.ContentText);
 }
Ejemplo n.º 26
0
        private void ShowVsHistory()
        {
            HtmlContent html = repository.Fetch(moduleId);
            ContentHistory history = new ContentHistory(historyGuid);
            if (history.ContentGuid != html.ModuleGuid) { return; }

            litCurrentHeading.Text = string.Format(Resource.CurrentVersionHeadingFormat,
                DateTimeHelper.Format(html.LastModUtc, timeZone, "g", timeOffset));

            if ((HtmlConfiguration.UseHtmlDiff)&&(highlightDiff))
            {
                HtmlDiff diffHelper = new HtmlDiff(history.ContentText, html.Body);
                litCurrentVersion.Text = diffHelper.Build();
            }
            else
            {
                litCurrentVersion.Text = html.Body;
            }

            litHistoryHead.Text = string.Format(Resource.VersionAsOfHeadingFormat,
                DateTimeHelper.Format(history.CreatedUtc, timeZone, "g", timeOffset));

            litHistoryVersion.Text = history.ContentText;

            string onClick = "top.window.LoadHistoryInEditor('" + historyGuid.ToString() + "');  return false;";
            btnRestore.Attributes.Add("onclick", onClick);
        }
Ejemplo n.º 27
0
 /// <summary>
 /// Compares 2 instances of ContentHistory.
 /// </summary>
 public static int CompareByContentText(ContentHistory contentHistory1, ContentHistory contentHistory2)
 {
     return(contentHistory1.ContentText.CompareTo(contentHistory2.ContentText));
 }