GetSitePageCount() 공개 메소드

public GetSitePageCount ( System.Guid siteID, ContentPageType entryType ) : int
siteID System.Guid
entryType ContentPageType
리턴 int
        public SiteImportNativeModel()
        {
            this.CreateUsers = true;
            this.MapUsers = true;
            this.HasLoaded = false;

            using (ContentPageHelper pageHelper = new ContentPageHelper()) {
                this.PageCount = pageHelper.GetSitePageCount(SiteData.CurrentSiteID, ContentPageType.PageType.ContentEntry);

                using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                    this.Templates = cmsHelper.Templates;

                    float iThird = (float)(this.PageCount - 1) / (float)3;
                    Dictionary<string, float> dictTemplates = null;

                    dictTemplates = pageHelper.GetPopularTemplateList(SiteData.CurrentSiteID, ContentPageType.PageType.ContentEntry);
                    if (dictTemplates.Count > 0 && dictTemplates.First().Value >= iThird) {
                        try { this.PageTemplate = dictTemplates.First().Key; } catch { }
                    }

                    dictTemplates = pageHelper.GetPopularTemplateList(SiteData.CurrentSiteID, ContentPageType.PageType.BlogEntry);
                    if (dictTemplates.Count > 0) {
                        try { this.PostTemplate = dictTemplates.First().Key; } catch { }
                    }
                }
            }
        }
예제 #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 { }
                        }
                    }
                }
            }
        }
        public ContentPage GetPage(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.ContentEntry);
                    }

                    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;
                            pageContents.Parent_ContentID = null;
                            var rp = pageHelper.GetLatestContentByURL(SiteData.CurrentSiteID, false, pageContents.FileName);
                            if (rp != null) {
                                pageContents.Root_ContentID = rp.Root_ContentID;
                                pageContents.ContentID = rp.ContentID;
                                pageContents.Parent_ContentID = rp.Parent_ContentID;
                                pageContents.NavOrder = rp.NavOrder;
                            } else {
                                pageContents.Root_ContentID = Guid.Empty;
                                pageContents.ContentID = Guid.Empty;
                                pageContents.NavOrder = pageHelper.GetSitePageCount(SiteData.CurrentSiteID, ContentPageType.PageType.ContentEntry);
                            }
                        }
                    }
                    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;
        }