Esempio n. 1
0
        public static ContentPageExport GetSerializedContentPageExport(Guid rootContentID)
        {
            ContentPageExport c = null;

            try {
                string sXML = GetSerialized(rootContentID);
                c = GetSerialData <ContentPageExport>(sXML) as ContentPageExport;
            } catch (Exception ex) { }
            return(c);
        }
Esempio n. 2
0
        public bool IsUniqueBlog()
        {
            DateTime dateGoLive     = Convert.ToDateTime(this.GoLiveDate);
            DateTime dateOrigGoLive = DateTime.MinValue;

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

            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);
        }
Esempio n. 3
0
        public static void AssignContentPageExportNewIDs(ContentPageExport cpe)
        {
            cpe.NewRootContentID = Guid.NewGuid();

            cpe.ThePage.Root_ContentID = cpe.NewRootContentID;
            cpe.ThePage.ContentID      = cpe.NewRootContentID;
            cpe.ThePage.SiteID         = SiteData.CurrentSiteID;
            cpe.ThePage.EditUserId     = SecurityData.CurrentUserGuid;
            cpe.ThePage.EditDate       = DateTime.UtcNow;

            foreach (var w in cpe.ThePageWidgets)
            {
                w.Root_ContentID = cpe.NewRootContentID;
                w.Root_WidgetID  = Guid.NewGuid();
                w.WidgetDataID   = Guid.NewGuid();
            }
        }
        public static void MapSiteCategoryTags(ContentPageExport cpe)
        {
            if (cpe.ThePage.ContentType == ContentPageType.PageType.BlogEntry)
            {
                var lstCategories = SiteData.CurrentSite.GetCategoryList();
                var lstTags       = SiteData.CurrentSite.GetTagList();

                cpe.ThePage.ContentCategories = (from l in lstCategories
                                                 join o in cpe.ThePage.ContentCategories on l.CategorySlug.ToLowerInvariant() equals o.CategorySlug.ToLowerInvariant()
                                                 where !String.IsNullOrEmpty(o.CategorySlug)
                                                 select l).Distinct().ToList();

                cpe.ThePage.ContentTags = (from l in lstTags
                                           join o in cpe.ThePage.ContentTags on l.TagSlug.ToLowerInvariant() equals o.TagSlug.ToLowerInvariant()
                                           where !String.IsNullOrEmpty(o.TagSlug)
                                           select l).Distinct().ToList();
            }
            else
            {
                cpe.ThePage.ContentCategories = new List <ContentCategory>();
                cpe.ThePage.ContentTags       = new List <ContentTag>();
            }
        }
        public static void AssignContentPageExportNewIDs(ContentPageExport cpe)
        {
            cpe.NewRootContentID = Guid.NewGuid();

            cpe.ThePage.Root_ContentID = cpe.NewRootContentID;
            cpe.ThePage.ContentID      = Guid.NewGuid();
            cpe.ThePage.SiteID         = SiteData.CurrentSiteID;
            cpe.ThePage.EditUserId     = SecurityData.CurrentUserGuid;
            cpe.ThePage.EditDate       = DateTime.UtcNow;

            cpe.ThePage.FileName = ContentPageHelper.ScrubFilename(cpe.NewRootContentID, cpe.ThePage.FileName);
            if (!String.IsNullOrEmpty(cpe.ParentFileName))
            {
                cpe.ParentFileName = ContentPageHelper.ScrubFilename(cpe.OriginalParentContentID, cpe.ParentFileName);
            }

            foreach (var w in cpe.ThePageWidgets)
            {
                w.Root_ContentID = cpe.NewRootContentID;
                w.Root_WidgetID  = Guid.NewGuid();
                w.WidgetDataID   = Guid.NewGuid();
            }
        }
Esempio n. 6
0
        public static ContentPageExport DeserializeContentPageExport(string sXML)
        {
            ContentPageExport c = GetSerialData <ContentPageExport>(sXML) as ContentPageExport;

            return(c);
        }
Esempio n. 7
0
        public static string GetContentPageExportXML(Guid siteID, Guid rootContentID)
        {
            ContentPageExport exp = GetExportPage(siteID, rootContentID);

            return(GetExportXML <ContentPageExport>(exp));
        }
Esempio n. 8
0
        public static ContentPageExport GetExportPage(Guid siteID, Guid rootContentID)
        {
            ContentPageExport cpe = new ContentPageExport(siteID, rootContentID);

            return(cpe);
        }