GetVersion() публичный Метод

public GetVersion ( System.Guid siteID, System.Guid contentID ) : ContentPage
siteID System.Guid
contentID System.Guid
Результат ContentPage
		public void SetVersion(Guid id) {
			this.VersionID = id;

			using (ContentPageHelper pageHelper = new ContentPageHelper()) {
				this.ContentPage = pageHelper.GetVersion(this.SiteID, id);
				this.Root_ContentID = this.ContentPage.Root_ContentID;
			}
		}
Пример #2
0
		public bool IsUniqueFilename() {
			string theFileName = this.FileName;

			theFileName = ContentPageHelper.ScrubFilename(this.Root_ContentID, theFileName);

			theFileName = theFileName.ToLower();

			if (SiteData.IsPageSpecial(theFileName) || SiteData.IsLikelyHomePage(theFileName)) {
				return false;
			}

			if (SiteData.CurrentSite.GetSpecialFilePathPrefixes().Where(x => theFileName.StartsWith(x.ToLower())).Count() > 0
				|| theFileName.StartsWith(SiteData.CurrentSite.BlogFolderPath.ToLower())) {
				return false;
			}

			using (ContentPageHelper pageHelper = new ContentPageHelper()) {
				ContentPage fn = pageHelper.FindByFilename(SiteData.CurrentSite.SiteID, theFileName);

				ContentPage cp = pageHelper.FindContentByID(SiteData.CurrentSite.SiteID, this.Root_ContentID);

				if (cp == null && this.Root_ContentID != Guid.Empty) {
					cp = pageHelper.GetVersion(SiteData.CurrentSite.SiteID, this.Root_ContentID);
				}

				if (fn == null || (fn != null && cp != null && fn.Root_ContentID == cp.Root_ContentID)) {
					return true;
				}
			}

			return false;
		}
Пример #3
0
		public bool IsUniqueBlog() {
			DateTime dateGoLive = Convert.ToDateTime(this.GoLiveDate);
			DateTime dateOrigGoLive = DateTime.MinValue;

			string thePageSlug = ContentPageHelper.ScrubFilename(this.Root_ContentID, this.PageSlug).ToLower();

			string theFileName = thePageSlug;

			using (ContentPageHelper pageHelper = new ContentPageHelper()) {
				ContentPage cp = pageHelper.FindContentByID(SiteData.CurrentSite.SiteID, this.Root_ContentID);

				if (cp != null) {
					dateOrigGoLive = cp.GoLiveDate;
				}
				if (cp == null && this.Root_ContentID != Guid.Empty) {
					ContentPageExport cpe = ContentImportExportUtils.GetSerializedContentPageExport(this.Root_ContentID);
					if (cpe != null) {
						dateOrigGoLive = cpe.ThePage.GoLiveDate;
					}
				}

				theFileName = ContentPageHelper.CreateFileNameFromSlug(SiteData.CurrentSite.SiteID, dateGoLive, thePageSlug);

				if (SiteData.IsPageSpecial(theFileName) || SiteData.IsLikelyHomePage(theFileName)) {
					return false;
				}

				ContentPage fn1 = pageHelper.FindByFilename(SiteData.CurrentSite.SiteID, theFileName);

				if (cp == null && this.Root_ContentID != Guid.Empty) {
					cp = pageHelper.GetVersion(SiteData.CurrentSite.SiteID, this.Root_ContentID);
				}

				if (fn1 == null || (fn1 != null && cp != null && fn1.Root_ContentID == cp.Root_ContentID)) {
					return true;
				}
			}

			return false;
		}
        public ContentPage GetPost(Guid? id, Guid? versionid, Guid? importid, string mode)
        {
            ContentPage pageContents = null;
            this.ImportID = importid;
            this.VersionID = versionid;
            this.Mode = (String.IsNullOrEmpty(mode) || mode.Trim().ToLowerInvariant() != "raw") ? "html" : "raw";

            using (ContentPageHelper pageHelper = new ContentPageHelper()) {
                if (!id.HasValue && !versionid.HasValue && !importid.HasValue) {
                    if (pageContents == null) {
                        pageContents = new ContentPage(SiteData.CurrentSiteID, ContentPageType.PageType.BlogEntry);
                    }

                    pageContents.Root_ContentID = Guid.Empty;
                } else {
                    if (importid.HasValue) {
                        ContentPageExport cpe = ContentImportExportUtils.GetSerializedContentPageExport(importid.Value);
                        if (cpe != null) {
                            pageContents = cpe.ThePage;
                            pageContents.EditDate = SiteData.CurrentSite.Now;

                            var rp = pageHelper.GetLatestContentByURL(SiteData.CurrentSiteID, false, pageContents.FileName);
                            if (rp != null) {
                                pageContents.Root_ContentID = rp.Root_ContentID;
                                pageContents.ContentID = rp.ContentID;
                            } else {
                                pageContents.Root_ContentID = Guid.Empty;
                                pageContents.ContentID = Guid.Empty;
                            }
                            pageContents.Parent_ContentID = null;
                            pageContents.NavOrder = SiteData.BlogSortOrderNumber;
                        }
                    }
                    if (versionid.HasValue) {
                        pageContents = pageHelper.GetVersion(SiteData.CurrentSiteID, versionid.Value);
                    }
                    if (id.HasValue && pageContents == null) {
                        pageContents = pageHelper.FindContentByID(SiteData.CurrentSiteID, id.Value);
                    }
                }
            }

            OverrideCache(pageContents);

            SetPage(pageContents);

            return pageContents;
        }