public List <SiteMapOrder> ParseChildPageData(string sMapText, Guid contentID) { List <SiteMapOrder> m = new List <SiteMapOrder>(); sMapText = sMapText.Trim(); carrot_Content c = (from ct in db.carrot_Contents where ct.Root_ContentID == contentID && ct.IsLatestVersion == true select ct).FirstOrDefault(); int iOrder = Convert.ToInt32(c.NavOrder) + 2; if (!String.IsNullOrEmpty(sMapText)) { sMapText = sMapText.Replace("\r\n", "\n"); var rows = sMapText.Split('\n'); foreach (string r in rows) { if (!String.IsNullOrEmpty(r)) { var rr = r.Split('\t'); SiteMapOrder s = new SiteMapOrder(); s.NavOrder = iOrder + int.Parse(rr[0]); s.Root_ContentID = new Guid(rr[1]); s.Parent_ContentID = contentID; m.Add(s); } } } return(m); }
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 SavePageEdit() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { SiteData site = SiteData.GetSiteFromCache(this.SiteID); if (this.Root_ContentID == Guid.Empty) { this.Root_ContentID = Guid.NewGuid(); } if (this.ContentID == Guid.Empty) { this.ContentID = Guid.NewGuid(); } if (this.Parent_ContentID == Guid.Empty) { this.Parent_ContentID = null; } carrot_RootContent rc = CompiledQueries.cqGetRootContentTbl(_db, this.SiteID, this.Root_ContentID); carrot_Content oldC = CompiledQueries.cqGetLatestContentTbl(_db, this.SiteID, this.Root_ContentID); bool bNew = false; if (rc == null) { rc = new carrot_RootContent(); PerformCommonSaveRoot(site, rc); _db.carrot_RootContents.InsertOnSubmit(rc); bNew = true; } carrot_Content c = new carrot_Content(); c.ContentID = Guid.NewGuid(); if (!bNew) { oldC.IsLatestVersion = false; } PerformCommonSave(site, rc, c); _db.carrot_Contents.InsertOnSubmit(c); SaveKeywordsAndTags(_db); _db.SubmitChanges(); SaveTrackbacks(); } }
public void ApplyTemplate() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { carrot_Content c = CompiledQueries.cqGetLatestContentTbl(_db, this.SiteID, this.Root_ContentID); if (c != null) { c.TemplateFile = this.TemplateFile; _db.SubmitChanges(); } } }
public void UpdateSiteMap(Guid siteID, List <SiteMapOrder> oMap) { foreach (SiteMapOrder m in oMap) { carrot_Content c = (from ct in db.carrot_Contents join r in db.carrot_RootContents on ct.Root_ContentID equals r.Root_ContentID where r.SiteID == siteID && r.Root_ContentID == m.Root_ContentID && ct.IsLatestVersion == true select ct).FirstOrDefault(); c.Parent_ContentID = m.Parent_ContentID; c.NavOrder = (m.NavOrder * 10); } db.SubmitChanges(); }
public void SavePageAsDraft() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { SiteData site = SiteData.GetSiteFromCache(this.SiteID); if (this.Root_ContentID == Guid.Empty) { this.Root_ContentID = Guid.NewGuid(); } if (this.ContentID == Guid.Empty) { this.ContentID = Guid.NewGuid(); } carrot_RootContent rc = CompiledQueries.cqGetRootContentTbl(_db, this.SiteID, this.Root_ContentID); if (rc == null) { rc = new carrot_RootContent(); PerformCommonSaveRoot(site, rc); _db.carrot_RootContents.InsertOnSubmit(rc); } carrot_Content c = new carrot_Content(); c.ContentID = Guid.NewGuid(); PerformCommonSave(site, rc, c); c.IsLatestVersion = false; // draft, leave existing version latest _db.carrot_Contents.InsertOnSubmit(c); SaveKeywordsAndTags(_db); _db.SubmitChanges(); this.IsLatestVersion = c.IsLatestVersion; SaveTrackbacks(); } }
public void SavePageEdit() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { SiteData site = SiteData.GetSiteFromCache(this.SiteID); if (this.Root_ContentID == Guid.Empty) { this.Root_ContentID = Guid.NewGuid(); } if (this.ContentID == Guid.Empty) { this.ContentID = Guid.NewGuid(); } if (this.Parent_ContentID == Guid.Empty) { this.Parent_ContentID = null; } carrot_RootContent rc = CompiledQueries.cqGetRootContentTbl(_db, this.SiteID, this.Root_ContentID); carrot_Content oldC = CompiledQueries.cqGetLatestContentTbl(_db, this.SiteID, this.Root_ContentID); bool bNew = false; if (rc == null) { rc = new carrot_RootContent(); PerformCommonSaveRoot(site, rc); _db.carrot_RootContents.InsertOnSubmit(rc); bNew = true; } carrot_Content c = new carrot_Content(); c.ContentID = Guid.NewGuid(); if (!bNew) { oldC.IsLatestVersion = false; } PerformCommonSave(site, rc, c); _db.carrot_Contents.InsertOnSubmit(c); SaveKeywordsAndTags(_db); _db.SubmitChanges(); SaveTrackbacks(); } }
public void SavePageAsDraft() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { SiteData site = SiteData.GetSiteFromCache(this.SiteID); if (this.Root_ContentID == Guid.Empty) { this.Root_ContentID = Guid.NewGuid(); } if (this.ContentID == Guid.Empty) { this.ContentID = Guid.NewGuid(); } carrot_RootContent rc = CompiledQueries.cqGetRootContentTbl(_db, this.SiteID, this.Root_ContentID); if (rc == null) { rc = new carrot_RootContent(); PerformCommonSaveRoot(site, rc); _db.carrot_RootContents.InsertOnSubmit(rc); } carrot_Content c = new carrot_Content(); c.ContentID = Guid.NewGuid(); PerformCommonSave(site, rc, c); c.IsLatestVersion = false; // draft, leave existing version latest _db.carrot_Contents.InsertOnSubmit(c); SaveKeywordsAndTags(_db); _db.SubmitChanges(); this.IsLatestVersion = c.IsLatestVersion; SaveTrackbacks(); } }