GetVersionHistory() public method

public GetVersionHistory ( System.Guid siteID, System.Guid rootContentID ) : List
siteID System.Guid
rootContentID System.Guid
return List
		public void SetCurrent(Guid id) {
			this.Root_ContentID = id;

			using (ContentPageHelper pageHelper = new ContentPageHelper()) {
				this.ContentPage = pageHelper.FindContentByID(this.SiteID, id);

				this.History.DataSource = pageHelper.GetVersionHistory(this.SiteID, id);
				this.History.TotalRecords = this.History.DataSource.Count();
				this.History.PageSize = this.History.TotalRecords * 2;
			}
		}
Exemplo n.º 2
0
        public void SetPage(ContentPage page)
        {
            this.ContentPage = page;

            this.OriginalFileName = page.FileName;
            this.SelectedCategories = this.ContentPage.ContentCategories.Select(x => x.ContentCategoryID.ToString().ToLower()).ToList();
            this.SelectedTags = this.ContentPage.ContentTags.Select(x => x.ContentTagID.ToString().ToLower()).ToList();
            this.InitSelections();

            if (this.ContentPage != null) {
                using (ContentPageHelper pageHelper = new ContentPageHelper()) {
                    if (this.ContentPage.Root_ContentID != Guid.Empty) {
                        this.VersionHistory = (from v in pageHelper.GetVersionHistory(this.ContentPage.SiteID, this.ContentPage.Root_ContentID)
                                               join u in ExtendedUserData.GetUserList() on v.EditUserId equals u.UserId
                                               orderby v.EditDate descending
                                               select new KeyValuePair<string, string>(v.ContentID.ToString(),
                                                                        String.Format("{0} ({1}) {2}", v.EditDate, u.UserName, (v.IsLatestVersion ? " [**] " : " ")))
                                                                        ).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
                    } else {
                        this.ContentPage.CreateDate = DateTime.UtcNow.Date;
                        this.ContentPage.EditDate = DateTime.UtcNow.Date;
                        this.ContentPage.ContentID = Guid.NewGuid();

                        if (this.ContentPage.ContentType == ContentPageType.PageType.ContentEntry) {
                            this.ContentPage.NavOrder = pageHelper.GetSitePageCount(this.ContentPage.SiteID, this.ContentPage.ContentType) + 1;
                        } else {
                            this.ContentPage.Parent_ContentID = null;
                            this.ContentPage.NavOrder = SiteData.BlogSortOrderNumber;
                        }

                        DateTime dtSite = CMSConfigHelper.CalcNearestFiveMinTime(SiteData.CurrentSite.Now);
                        this.ContentPage.GoLiveDate = dtSite;
                        this.ContentPage.RetireDate = dtSite.AddYears(200);

                        float iThird = (float)(this.ContentPage.NavOrder - 1) / (float)3;

                        Dictionary<string, float> dictTemplates = pageHelper.GetPopularTemplateList(this.ContentPage.SiteID, this.ContentPage.ContentType);
                        if (dictTemplates.Any() && dictTemplates.First().Value >= iThird) {
                            try {
                                this.ContentPage.TemplateFile = dictTemplates.First().Key;
                            } catch { }
                        }
                    }
                }
            }
        }