public static void AssignSiteExportNewIDs(SiteExport se) { se.NewSiteID = Guid.NewGuid(); se.TheSite.SiteID = se.NewSiteID; foreach (var p in se.ThePages) { AssignContentPageExportNewIDs(p); if (p.ThePage.ContentType == ContentPageType.PageType.BlogEntry) { p.ThePage.ContentCategories.ToList().ForEach(r => r.CategorySlug = se.TheCategories.Where(x => x.ContentCategoryID == r.ContentCategoryID).FirstOrDefault().CategorySlug); p.ThePage.ContentTags.ToList().ForEach(r => r.TagSlug = se.TheTags.Where(x => x.ContentTagID == r.ContentTagID).FirstOrDefault().TagSlug); } } se.ThePages.Where(p => p.ThePage.ContentType == ContentPageType.PageType.BlogEntry).ToList() .ForEach(r => r.ThePage.PageSlug = ContentPageHelper.ScrubFilename(r.ThePage.Root_ContentID, r.ThePage.PageSlug)); se.ThePages.Where(p => p.ThePage.ContentType == ContentPageType.PageType.BlogEntry).ToList() .ForEach(q => q.ThePage.FileName = ContentPageHelper.ScrubFilename(q.ThePage.Root_ContentID, String.Format("/{0}/{1}", q.ThePage.GoLiveDate.ToString(se.TheSite.Blog_DatePattern), q.ThePage.PageSlug))); se.ThePages.ToList().ForEach(r => r.ThePage.FileName = ContentPageHelper.ScrubFilename(r.ThePage.Root_ContentID, r.ThePage.FileName)); }
public static ContentPage GetPage(string sCurrentPage) { ContentPage pageContents = null; using (ContentPageHelper pageHelper = new ContentPageHelper()) { if (SecurityData.IsAdmin || SecurityData.IsSiteEditor) { if (sCurrentPage.Length <= 1 || sCurrentPage == SiteData.DefaultDirectoryFilename) { pageContents = pageHelper.FindHome(SiteData.CurrentSiteID); } else { pageContents = pageHelper.FindByFilename(SiteData.CurrentSiteID, sCurrentPage); } } else { if (sCurrentPage.Length <= 1 || sCurrentPage == SiteData.DefaultDirectoryFilename) { pageContents = pageHelper.FindHome(SiteData.CurrentSiteID, true); } else { pageContents = pageHelper.GetLatestContentByURL(SiteData.CurrentSiteID, true, sCurrentPage); } } } return(pageContents); }
public void Load() { this.TheSite = SiteData.CurrentSite; if (SecurityData.AdvancedEditMode && !this.IsPageLocked) { using (ContentPageHelper pageHelper = new ContentPageHelper()) { bool bRet = pageHelper.RecordPageLock(this.ThePage.Root_ContentID, this.TheSite.SiteID, SecurityData.CurrentUserGuid); } } CMSConfigHelper.IdentifyLinkAsInactive(this.ThePage); Guid guidContentID = Guid.Empty; if (this.ThePage != null) { guidContentID = this.ThePage.Root_ContentID; this.TheWidgets = SiteData.GetCurrentPageWidgets(guidContentID); } else { this.ThePage = new ContentPage(); this.TheWidgets = new List <Widget>(); } }
protected void LoadGuids() { if (filePage == null) { using (ContentPageHelper pageHelper = new ContentPageHelper()) { if (SiteData.IsPageSampler && filePage == null) { filePage = ContentPageHelper.GetSamplerView(); } else { if (SiteData.CurrentScriptName.ToLowerInvariant().StartsWith(SiteData.AdminFolderPath)) { Guid guidPage = Guid.Empty; if (!String.IsNullOrEmpty(HttpContext.Current.Request.QueryString["pageid"])) { guidPage = new Guid(HttpContext.Current.Request.QueryString["pageid"].ToString()); } filePage = pageHelper.FindContentByID(SiteData.CurrentSiteID, guidPage); } else { filePage = pageHelper.FindByFilename(SiteData.CurrentSiteID, SiteData.CurrentScriptName); } } } } }
public void Save() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { bool bNew = false; carrot_ContentTag s = CompiledQueries.cqGetContentTagByID(_db, this.ContentTagID); if (s == null || (s != null && s.ContentTagID == Guid.Empty)) { s = new carrot_ContentTag(); s.ContentTagID = Guid.NewGuid(); s.SiteID = this.SiteID; bNew = true; } s.TagSlug = ContentPageHelper.ScrubSlug(this.TagSlug); s.TagText = this.TagText; s.IsPublic = this.IsPublic; if (bNew) { _db.carrot_ContentTags.InsertOnSubmit(s); } _db.SubmitChanges(); this.ContentTagID = s.ContentTagID; } }
public void OverrideKey(string sPageName) { filePage = null; using (ContentPageHelper pageHelper = new ContentPageHelper()) { filePage = pageHelper.FindByFilename(SiteData.CurrentSiteID, sPageName); } }
public void OverrideKey(Guid guidContentID) { filePage = null; using (ContentPageHelper pageHelper = new ContentPageHelper()) { filePage = pageHelper.FindContentByID(SiteData.CurrentSiteID, guidContentID); } }
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); }
public SiteImportWordpressModel() { this.CreateUsers = true; this.MapUsers = true; this.FixHtmlBodies = true; this.HasLoaded = false; BuildFolderList(); 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.Any() && dictTemplates.First().Value >= iThird) { try { this.PageTemplate = dictTemplates.First().Key; } catch { } } dictTemplates = pageHelper.GetPopularTemplateList(SiteData.CurrentSiteID, ContentPageType.PageType.BlogEntry); if (dictTemplates.Any()) { try { this.PostTemplate = dictTemplates.First().Key; } catch { } } } } }
private void PerformCommonSave(SiteData pageSite, carrot_RootContent rc, carrot_Content c) { c.NavOrder = this.NavOrder; if (this.ContentType == ContentPageType.PageType.BlogEntry) { this.PageSlug = ContentPageHelper.ScrubFilename(this.Root_ContentID, this.PageSlug); this.FileName = ContentPageHelper.CreateFileNameFromSlug(this.SiteID, this.GoLiveDate, this.PageSlug); c.NavOrder = SiteData.BlogSortOrderNumber; } rc.GoLiveDate = pageSite.ConvertSiteTimeToUTC(this.GoLiveDate); rc.RetireDate = pageSite.ConvertSiteTimeToUTC(this.RetireDate); rc.GoLiveDateLocal = pageSite.ConvertUTCToSiteTime(rc.GoLiveDate); rc.PageSlug = this.PageSlug; rc.PageThumbnail = this.Thumbnail; c.Root_ContentID = this.Root_ContentID; rc.Heartbeat_UserId = this.Heartbeat_UserId; rc.EditHeartbeat = this.EditHeartbeat; rc.FileName = this.FileName; rc.PageActive = this.PageActive; rc.ShowInSiteNav = this.ShowInSiteNav; rc.BlockIndex = this.BlockIndex; rc.ShowInSiteMap = this.ShowInSiteMap; rc.FileName = ContentPageHelper.ScrubFilename(this.Root_ContentID, rc.FileName); c.Parent_ContentID = this.Parent_ContentID; c.IsLatestVersion = true; c.TitleBar = this.TitleBar; c.NavMenuText = this.NavMenuText; c.PageHead = this.PageHead; c.PageText = this.PageText; c.LeftPageText = this.LeftPageText; c.RightPageText = this.RightPageText; c.EditUserId = this.EditUserId; c.CreditUserId = this.CreditUserId; c.EditDate = DateTime.UtcNow; c.TemplateFile = this.TemplateFile; FixMeta(); c.MetaKeyword = this.MetaKeyword.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ").Replace(" ", " "); c.MetaDescription = this.MetaDescription.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ").Replace(" ", " "); this.Root_ContentID = rc.Root_ContentID; this.ContentID = c.ContentID; this.FileName = rc.FileName; this.EditDate = pageSite.ConvertUTCToSiteTime(c.EditDate); this.CreateDate = pageSite.ConvertUTCToSiteTime(rc.CreateDate); this.GoLiveDate = pageSite.ConvertUTCToSiteTime(rc.GoLiveDate); this.RetireDate = pageSite.ConvertUTCToSiteTime(rc.RetireDate); }
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; } }
public void Save() { this.CopyCount = 0; if (this.Widgets != null) { List <Guid> lstSel = this.Widgets.Where(x => x.Selected).Select(x => x.Root_WidgetID).ToList(); using (ContentPageHelper pageHelper = new ContentPageHelper()) { this.SelectedPage = pageHelper.FindContentByID(SiteData.CurrentSiteID, this.SelectedItem); this.Widgets = this.SelectedPage.GetWidgetList(); } using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) { cmsHelper.OverrideKey(this.Root_ContentID); if (cmsHelper.cmsAdminWidget != null) { List <Widget> cacheWidget = cmsHelper.cmsAdminWidget; List <Widget> ww = (from w in this.SelectedPage.GetWidgetList() where lstSel.Contains(w.Root_WidgetID) && w.IsLatestVersion == true select w).ToList(); if (ww != null) { this.CopyCount = ww.Count; foreach (var w in ww) { Guid newWidget = Guid.NewGuid(); Widget wCpy = new Widget { Root_ContentID = this.Root_ContentID, Root_WidgetID = newWidget, WidgetDataID = Guid.NewGuid(), PlaceholderName = this.PlaceholderName, ControlPath = w.ControlPath, ControlProperties = w.ControlProperties, IsLatestVersion = true, IsPendingChange = true, IsWidgetActive = true, IsWidgetPendingDelete = false, WidgetOrder = w.WidgetOrder, GoLiveDate = w.GoLiveDate, RetireDate = w.RetireDate, EditDate = SiteData.CurrentSite.Now }; cacheWidget.Add(wCpy); } } cmsHelper.cmsAdminWidget = cacheWidget; } } } }
public static void AssignWPExportNewIDs(SiteData sd, WordPressSite wps) { wps.NewSiteID = Guid.NewGuid(); wps.Content.Where(p => p.PostType == WordPressPost.WPPostType.BlogPost).ToList() .ForEach(q => q.ImportFileName = ContentPageHelper.ScrubPath("/" + sd.ConvertUTCToSiteTime(q.PostDateUTC).ToString(sd.Blog_DatePattern) + "/" + q.ImportFileSlug)); wps.Content.ToList().ForEach(r => r.ImportFileName = ContentPageHelper.ScrubPath(r.ImportFileName.Replace("//", "/"))); }
public static void AssignWPExportNewIDs(SiteData sd, WordPressSite wps) { wps.NewSiteID = Guid.NewGuid(); wps.Content.Where(p => p.PostType == WordPressPost.WPPostType.BlogPost).ToList() .ForEach(q => q.ImportFileName = ContentPageHelper.ScrubFilename(q.ImportRootID, String.Format("/{0}/{1}", sd.ConvertUTCToSiteTime(q.PostDateUTC).ToString(sd.Blog_DatePattern), q.ImportFileSlug))); wps.Content.ToList().ForEach(r => r.ImportFileName = ContentPageHelper.ScrubFilename(r.ImportRootID, r.ImportFileName)); }
public static ContentPage GetPage(Guid guidContentID) { ContentPage pageContents = null; using (ContentPageHelper pageHelper = new ContentPageHelper()) { pageContents = pageHelper.FindContentByID(CurrentSiteID, guidContentID); } return(pageContents); }
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) * 2; } 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 { } } } } RefreshWidgetList(); } }
protected void btnDelete_Click(object sender, EventArgs e) { guidRootContentID = new Guid(hdnRootID.Value); using (ContentPageHelper cph = new ContentPageHelper()) { cph.RemoveContent(SiteID, guidRootContentID); } Response.Redirect(SiteFilename.BlogPostIndexURL); }
public void SearchTwo() { this.Widgets = null; this.Pages = null; using (ContentPageHelper pageHelper = new ContentPageHelper()) { this.SelectedPage = pageHelper.FindContentByID(SiteData.CurrentSiteID, this.SelectedItem); this.Widgets = this.SelectedPage.GetWidgetList(); } }
public ContentPage SavePage() { ContentPage page = this.ContentPage; ContentPage pageContents = null; using (ContentPageHelper pageHelper = new ContentPageHelper()) { pageContents = pageHelper.FindContentByID(SiteData.CurrentSiteID, page.Root_ContentID); } if (pageContents == null) { pageContents = new ContentPage(SiteData.CurrentSiteID, ContentPageType.PageType.ContentEntry); } pageContents.GoLiveDate = page.GoLiveDate; pageContents.RetireDate = page.RetireDate; pageContents.IsLatestVersion = true; pageContents.Thumbnail = page.Thumbnail; pageContents.TemplateFile = page.TemplateFile; pageContents.TitleBar = page.TitleBar; pageContents.NavMenuText = page.NavMenuText; pageContents.PageHead = page.PageHead; pageContents.FileName = page.FileName; pageContents.PageSlug = null; pageContents.MetaDescription = page.MetaDescription; pageContents.MetaKeyword = page.MetaKeyword; pageContents.EditDate = SiteData.CurrentSite.Now; pageContents.NavOrder = page.NavOrder; pageContents.PageText = page.PageText; pageContents.LeftPageText = page.LeftPageText; pageContents.RightPageText = page.RightPageText; pageContents.PageActive = page.PageActive; pageContents.ShowInSiteNav = page.ShowInSiteNav; pageContents.ShowInSiteMap = page.ShowInSiteMap; pageContents.BlockIndex = page.BlockIndex; pageContents.Parent_ContentID = page.Parent_ContentID; pageContents.CreditUserId = page.CreditUserId; pageContents.EditUserId = SecurityData.CurrentUserGuid; pageContents.SavePageEdit(); SaveTextWidgets(); return(pageContents); }
public static ContentPage GetCurrentLivePage() { ContentPage pageContents = null; using (ContentPageHelper pageHelper = new ContentPageHelper()) { bool IsPageTemplate = false; string sCurrentPage = SiteData.CurrentScriptName; string sScrubbedURL = SiteData.AlternateCurrentScriptName; if (sScrubbedURL.ToLower() != sCurrentPage.ToLower()) { sCurrentPage = sScrubbedURL; } if (SecurityData.IsAdmin || SecurityData.IsSiteEditor) { if (sCurrentPage.Length <= 1 || sCurrentPage == SiteData.DefaultDirectoryFilename) { pageContents = pageHelper.FindHome(SiteData.CurrentSiteID); } else { pageContents = pageHelper.FindByFilename(SiteData.CurrentSiteID, sCurrentPage); } } else { if (sCurrentPage.Length <= 1 || sCurrentPage == SiteData.DefaultDirectoryFilename) { pageContents = pageHelper.FindHome(SiteData.CurrentSiteID, true); } else { pageContents = pageHelper.GetLatestContentByURL(SiteData.CurrentSiteID, true, sCurrentPage); } } if (pageContents == null && SiteData.IsPageReal) { IsPageTemplate = true; } if ((SiteData.IsPageSampler || IsPageTemplate || !IsWebView) && pageContents == null) { pageContents = ContentPageHelper.GetSamplerView(); } if (IsPageTemplate) { pageContents.TemplateFile = sCurrentPage; } } return(pageContents); }
protected void btnSave_Click(object sender, EventArgs e) { if (pageContents != null) { pageContents.TitleBar = txtTitle.Text; pageContents.NavMenuText = txtNav.Text; pageContents.PageHead = txtHead.Text; pageContents.MetaDescription = txtDescription.Text; pageContents.MetaKeyword = txtKey.Text; pageContents.Thumbnail = txtThumb.Text; pageContents.EditDate = SiteData.CurrentSite.Now; pageContents.GoLiveDate = ucReleaseDate.GetDate(); pageContents.RetireDate = ucRetireDate.GetDate(); pageContents.PageActive = chkActive.Checked; pageContents.ShowInSiteNav = false; pageContents.ShowInSiteMap = false; pageContents.BlockIndex = chkHide.Checked; List <ContentCategory> lstCat = new List <ContentCategory>(); List <ContentTag> lstTag = new List <ContentTag>(); lstCat = (from cr in GeneralUtilities.GetSelectedValues(listCats).Select(x => new Guid(x)) join l in SiteData.CurrentSite.GetCategoryList() on cr equals l.ContentCategoryID select l).ToList(); lstTag = (from cr in GeneralUtilities.GetSelectedValues(listTags).Select(x => new Guid(x)) join l in SiteData.CurrentSite.GetTagList() on cr equals l.ContentTagID select l).ToList(); pageContents.ContentCategories = lstCat; pageContents.ContentTags = lstTag; if (String.IsNullOrEmpty(hdnCreditUserID.Value)) { pageContents.CreditUserId = null; } else { var usr = new ExtendedUserData(hdnCreditUserID.Value); pageContents.CreditUserId = usr.UserId; } pageContents.FileName = ContentPageHelper.CreateFileNameFromSlug(pageContents.SiteID, pageContents.GoLiveDate, pageContents.PageSlug); cmsHelper.cmsAdminContent = pageContents; Master.ShowSave(); Response.Redirect(SiteData.CurrentScriptName + "?pageid=" + pageContents.Root_ContentID.ToString() + Master.SavedSuffix); } }
public void Save() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { carrot_Site s = CompiledQueries.cqGetSiteByID(_db, this.SiteID); bool bNew = false; if (s == null) { s = new carrot_Site(); if (this.SiteID == Guid.Empty) { this.SiteID = Guid.NewGuid(); } bNew = true; } // if updating the current site then blank out its cache if (CurrentSiteID == this.SiteID) { CurrentSite = null; } s.SiteID = this.SiteID; s.TimeZone = this.TimeZoneIdentifier; FixMeta(); s.MetaKeyword = this.MetaKeyword.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ").Replace(" ", " "); s.MetaDescription = this.MetaDescription.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ").Replace(" ", " "); s.SiteName = this.SiteName; s.SiteTagline = this.SiteTagline; s.SiteTitlebarPattern = this.SiteTitlebarPattern; s.MainURL = this.MainURL; s.BlockIndex = this.BlockIndex; s.SendTrackbacks = this.SendTrackbacks; s.AcceptTrackbacks = this.AcceptTrackbacks; s.Blog_FolderPath = ContentPageHelper.ScrubSlug(this.Blog_FolderPath); s.Blog_CategoryPath = ContentPageHelper.ScrubSlug(this.Blog_CategoryPath); s.Blog_TagPath = ContentPageHelper.ScrubSlug(this.Blog_TagPath); s.Blog_EditorPath = ContentPageHelper.ScrubSlug(this.Blog_EditorPath); s.Blog_DatePath = ContentPageHelper.ScrubSlug(this.Blog_DatePath); s.Blog_Root_ContentID = this.Blog_Root_ContentID; s.Blog_DatePattern = String.IsNullOrEmpty(this.Blog_DatePattern) ? "yyyy/MM/dd" : this.Blog_DatePattern; if (bNew) { _db.carrot_Sites.InsertOnSubmit(s); } _db.SubmitChanges(); } }
public static List <ContentPageExport> ExportPosts(Guid siteID) { List <ContentPageExport> lst = null; using (ContentPageHelper pageHelper = new ContentPageHelper()) { lst = (from c in pageHelper.GetAllLatestBlogList(siteID) select new ContentPageExport(c, c.GetWidgetList())).ToList(); } return(lst); }
public ContentPageExport(Guid siteID, Guid rootContentID) { ContentPage cp = null; using (ContentPageHelper cph = new ContentPageHelper()) { cp = cph.FindContentByID(siteID, rootContentID); } List <Widget> widgets = cp.GetWidgetList(); SetVals(cp, widgets); }
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; } }
internal ContentCategory(vw_carrot_CategoryCounted c) { if (c != null) { this.ContentCategoryID = c.ContentCategoryID; this.SiteID = c.SiteID; this.CategorySlug = ContentPageHelper.ScrubSlug(c.CategorySlug); this.CategoryText = c.CategoryText; this.UseCount = c.UseCount; this.PublicUseCount = 1; this.IsPublic = c.IsPublic; SiteData site = SiteData.GetSiteFromCache(c.SiteID); if (site != null) { this.CategoryURL = ContentPageHelper.ScrubFilename(c.ContentCategoryID, String.Format("/{0}/{1}", site.BlogCategoryPath, c.CategorySlug)); } } }
public ContentPage GetContentPage() { ContentPage cp = null; if (SiteData.IsPageSampler) { cp = ContentPageHelper.GetSamplerView(); } else { using (ContentPageHelper cph = new ContentPageHelper()) { cp = cph.FindContentByID(this.SiteID, this.Root_ContentID); } } return(cp); }
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); }
internal ContentCategory(vw_carrot_CategoryURL c) { if (c != null) { SiteData site = SiteData.GetSiteFromCache(c.SiteID); this.ContentCategoryID = c.ContentCategoryID; this.SiteID = c.SiteID; this.CategoryURL = ContentPageHelper.ScrubFilename(c.ContentCategoryID, c.CategoryUrl); this.CategoryText = c.CategoryText; this.UseCount = c.UseCount; this.PublicUseCount = c.PublicUseCount; this.IsPublic = c.IsPublic; if (c.EditDate.HasValue) { this.EditDate = site.ConvertUTCToSiteTime(c.EditDate.Value); } } }
protected bool FoldersAreValid() { string sFolderPath = this.Blog_FolderPath ?? String.Empty; if (SiteData.CurretSiteExists) { using (ContentPageHelper pageHelper = new ContentPageHelper()) { var exists = pageHelper.ExistingPagesBeginWith(this); return(!exists); } } else { return(true); } return(false); }