public BlogDatePathParser(string folderPath) { _filename = folderPath; _site = SiteData.CurrentSite; ParseString(); }
public BlogDatePathParser() { _filename = SiteData.CurrentScriptName; _site = SiteData.CurrentSite; ParseString(); }
public BlogDatePathParser(SiteData site) { _FileName = SiteData.CurrentScriptName; _site = site; ParseString(); }
public BlogDatePathParser(SiteData site, string folderPath) { _filename = folderPath; _site = site; ParseString(); }
private void SetVals(SiteData s, List<ContentPageExport> pages) { CarrotCakeVersion = SiteData.CarrotCakeCMSVersion; ExportDate = DateTime.UtcNow; NewSiteID = Guid.NewGuid(); TheSite = s; ThePages = pages; if (TheSite == null) { TheSite = new SiteData(); TheSite.SiteID = Guid.NewGuid(); } if (ThePages == null) { ThePages = new List<ContentPageExport>(); } OriginalSiteID = TheSite.SiteID; foreach (var w in ThePages) { w.OriginalSiteID = NewSiteID; } TheCategories = s.GetCategoryList(); TheTags = s.GetTagList(); TheSnippets = s.GetContentSnippetList(); }
public BlogDatePathParser(string FolderPath) { _FileName = FolderPath; _site = SiteData.CurrentSite; ParseString(); }
public BlogDatePathParser(SiteData site, string FolderPath) { _FileName = FolderPath; _site = site; ParseString(); }
public List <SiteNav> GetFilteredContentByIDPagedList(SiteData currentSite, List <Guid> lstCategoryGUIDs, List <string> lstCategorySlugs, bool bActiveOnly, int pageSize, int pageNumber, string sortField, string sortDir) { Guid siteID = currentSite.SiteID; IQueryable <vw_carrot_Content> query1 = CannedQueries.GetContentByCategoryIDs(db, siteID, bActiveOnly, lstCategoryGUIDs, lstCategorySlugs); return(PerformDataPagingQueryableContent(siteID, bActiveOnly, pageSize, pageNumber, sortField, sortDir, query1)); }
public int GetFilteredContentByIDPagedCount(SiteData currentSite, List <Guid> lstCategoryGUIDs, List <string> lstCategorySlugs, bool bActiveOnly) { Guid siteID = currentSite.SiteID; IQueryable <vw_carrot_Content> query1 = CannedQueries.GetContentByCategoryIDs(db, siteID, bActiveOnly, lstCategoryGUIDs, lstCategorySlugs); return(query1.Count()); }
protected SiteNav GetHomePage(SiteData site) { if (_navHome == null) { using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) { _navHome = navHelper.FindHome(site.SiteID, false); } } return _navHome; }
public string SendTrackback(Uri targetURL, SiteNav pageNav) { this.DestinationUrl = targetURL; this.SourcePage = pageNav; this.BlogSite = SiteData.GetSiteFromCache(this.SourcePage.SiteID); return(SendTrackback()); }
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 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 PagePayload GetContent(Guid id) { PagePayload page = new PagePayload(); page.ThePage = SiteData.GetPage(id); page.Load(); return(page); }
public static PagePayload GetCurrentContent() { PagePayload page = new PagePayload(); page.ThePage = SiteData.GetCurrentPage(); page.Load(); return(page); }
public void RenderSiteMap(HttpContext context) { HttpRequest request = context.Request; HttpResponse response = context.Response; SiteData site = SiteData.CurrentSite; List <SiteNav> lstNav = new List <SiteNav>(); using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) { //lstNav = navHelper.GetTwoLevelNavigation(SiteData.CurrentSiteID, true); lstNav = navHelper.GetLevelDepthNavigation(SiteData.CurrentSiteID, 4, true); } lstNav.RemoveAll(x => x.ShowInSiteMap == false); DateTime dtMax = lstNav.Min(x => x.EditDate); string DateFormat = "yyyy-MM-dd"; response.Buffer = false; response.Clear(); response.ContentType = "application/xml"; XmlWriter writer = XmlWriter.Create(response.Output); writer.WriteStartDocument(); writer.WriteRaw("\n"); writer.WriteStartElement("urlset", "http://www.sitemaps.org/schemas/sitemap/0.9"); writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance"); writer.WriteAttributeString("xsi", "schemaLocation", null, "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"); writer.WriteRaw("\n"); writer.WriteStartElement("url"); writer.WriteElementString("loc", site.MainURL); writer.WriteElementString("lastmod", dtMax.ToString(DateFormat)); writer.WriteElementString("priority", "1.0"); writer.WriteEndElement(); writer.WriteRaw("\n"); // always, hourly, daily, weekly, monthly, yearly, never foreach (SiteNav n in lstNav) { writer.WriteStartElement("url"); writer.WriteElementString("loc", site.ConstructedCanonicalURL(n)); writer.WriteElementString("lastmod", n.EditDate.ToString(DateFormat)); writer.WriteElementString("changefreq", "weekly"); writer.WriteElementString("priority", n.Parent_ContentID.HasValue ? "0.60" : "0.80"); writer.WriteEndElement(); writer.WriteRaw("\n"); } writer.WriteEndDocument(); writer.Flush(); writer.Close(); }
public SiteExport() { CarrotCakeVersion = SiteData.CarrotCakeCMSVersion; ExportDate = DateTime.UtcNow; TheSite = new SiteData(); ThePages = new List<ContentPageExport>(); TheCategories = new List<ContentCategory>(); TheTags = new List<ContentTag>(); TheSnippets = new List<ContentSnippet>(); }
public SiteExport(Guid siteID) { SiteData s = null; List <ContentPageExport> pages = null; s = SiteData.GetSiteByID(siteID); pages = ContentImportExportUtils.ExportAllSiteContent(siteID); SetVals(s, pages); }
public string SendTrackback(string sourceURL, Guid siteID, string sTgtURL) { this.DestinationUrl = new Uri(sTgtURL); this.BlogSite = SiteData.GetSiteFromCache(siteID); using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) { this.SourcePage = navHelper.FindByFilename(siteID, sourceURL); } return(SendTrackback()); }
public string SendTrackback(Guid sourceGuid, Guid siteID, string sTgtURL) { this.DestinationUrl = new Uri(sTgtURL); this.BlogSite = SiteData.GetSiteFromCache(siteID); using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) { this.SourcePage = navHelper.GetLatestVersion(siteID, sourceGuid); } return(SendTrackback()); }
public ContentSnippet(Guid siteID) { this.Root_ContentSnippetID = Guid.NewGuid(); this.ContentSnippetID = Guid.NewGuid(); this.SiteID = siteID; this.CreateDate = SiteData.GetSiteByID(siteID).Now; this.EditDate = this.CreateDate; this.GoLiveDate = this.CreateDate.AddHours(-1); this.RetireDate = this.CreateDate.AddYears(2); }
public SiteExport() { CarrotCakeVersion = SiteData.CarrotCakeCMSVersion; ExportDate = DateTime.UtcNow; TheSite = new SiteData(); ThePages = new List <ContentPageExport>(); TheCategories = new List <ContentCategory>(); TheTags = new List <ContentTag>(); TheSnippets = new List <ContentSnippet>(); }
internal ContentPage(vw_carrot_Content c) { if (c != null) { SiteData site = SiteData.GetSiteFromCache(c.SiteID); this.Root_ContentID = c.Root_ContentID; this.SiteID = c.SiteID; this.Heartbeat_UserId = c.Heartbeat_UserId; this.EditHeartbeat = c.EditHeartbeat; this.FileName = c.FileName; this.CreateUserId = c.CreateUserId; this.CreateDate = site.ConvertUTCToSiteTime(c.CreateDate); this.GoLiveDate = site.ConvertUTCToSiteTime(c.GoLiveDate); this.RetireDate = site.ConvertUTCToSiteTime(c.RetireDate); this.EditDate = site.ConvertUTCToSiteTime(c.EditDate); this.ShowInSiteMap = c.ShowInSiteMap; this.BlockIndex = c.BlockIndex; this.PageActive = c.PageActive; this.ShowInSiteNav = c.ShowInSiteNav; this.PageSlug = c.PageSlug; this.ContentType = ContentPageType.GetTypeByID(c.ContentTypeID); this.ContentID = c.ContentID; this.Parent_ContentID = c.Parent_ContentID; this.IsLatestVersion = c.IsLatestVersion; this.TitleBar = c.TitleBar; this.NavMenuText = c.NavMenuText; this.PageHead = c.PageHead; this.PageText = c.PageText; this.LeftPageText = c.LeftPageText; this.RightPageText = c.RightPageText; this.NavOrder = c.NavOrder; this.EditUserId = c.EditUserId; this.CreditUserId = c.CreditUserId; this.TemplateFile = c.TemplateFile; this.Thumbnail = c.PageThumbnail; if (String.IsNullOrEmpty(this.PageSlug) && this.ContentType == ContentPageType.PageType.BlogEntry) { this.PageSlug = c.FileName; } this.MetaDescription = c.MetaDescription; this.MetaKeyword = c.MetaKeyword; this.VersionCount = c.VersionCount.HasValue ? c.VersionCount.Value : 0; } }
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(); } }
internal TrackBackEntry(vw_carrot_TrackbackQueue c) { if (c != null) { SiteData site = SiteData.GetSiteFromCache(c.SiteID); this.TrackbackQueueID = c.TrackbackQueueID; this.Root_ContentID = c.Root_ContentID; this.TrackBackURL = c.TrackBackURL; this.TrackBackResponse = c.TrackBackResponse; this.CreateDate = site.ConvertUTCToSiteTime(c.CreateDate); this.ModifiedDate = site.ConvertUTCToSiteTime(c.ModifiedDate); this.TrackedBack = c.TrackedBack; } }
public string GetBlogHeadingFromURL(SiteData currentSite, string sFilterPath) { Guid siteID = currentSite.SiteID; string sTitle = String.Empty; if (currentSite.CheckIsBlogCategoryPath(sFilterPath)) { vw_carrot_CategoryURL query = CompiledQueries.cqGetCategoryByURL(db, siteID, sFilterPath); sTitle = query.CategoryText; } if (currentSite.CheckIsBlogTagPath(sFilterPath)) { vw_carrot_TagURL query = CompiledQueries.cqGetTagByURL(db, siteID, sFilterPath); sTitle = query.TagText; } if (currentSite.CheckIsBlogEditorFolderPath(sFilterPath)) { vw_carrot_EditorURL query = CompiledQueries.cqGetEditorByURL(db, siteID, sFilterPath); ExtendedUserData usr = new ExtendedUserData(query.UserId); sTitle = usr.ToString(); } if (currentSite.CheckIsBlogDateFolderPath(sFilterPath)) { BlogDatePathParser p = new BlogDatePathParser(currentSite, sFilterPath); TimeSpan ts = p.DateEndUTC - p.DateBeginUTC; int daysDelta = ts.Days; if (daysDelta > 90) { sTitle = "Year " + p.DateBegin.ToString("yyyy"); } if (daysDelta < 36) { sTitle = p.DateBegin.ToString("MMMM yyyy"); } if (daysDelta < 5) { sTitle = p.DateBegin.ToString("MMMM d, yyyy"); } } if (currentSite.CheckIsSiteSearchPath(sFilterPath)) { sTitle = "Search Results"; } return(sTitle); }
public static PagePayload GetContent(string uri) { PagePayload page = new PagePayload(); if (SecurityData.AdvancedEditMode) { using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) { cmsHelper.OverrideKey(uri); if (cmsHelper.cmsAdminContent == null) { page.ThePage = SiteData.GetPage(uri); if (!page.ThePage.IsPageLocked) { if (page.ThePage.ContentType == ContentPageType.PageType.BlogEntry) { var c = page.ThePage.ContentCategories; var t = page.ThePage.ContentTags; } cmsHelper.cmsAdminContent = page.ThePage; } else { cmsHelper.cmsAdminContent = null; } } else { page.ThePage = cmsHelper.cmsAdminContent; if (page.IsPageLocked) { cmsHelper.cmsAdminContent = null; page.ThePage = SiteData.GetPage(uri); } } } } else { page.ThePage = SiteData.GetPage(uri); } page.Load(); return(page); }
protected override void OnInit(EventArgs e) { base.OnInit(e); pph = new PageProcessingHelper(this.Page); pph.LoadData(); if (pph.ThePage != null) { theSite = pph.TheSite; pageContents = pph.ThePage; pageWidgets = pph.ThePageWidgets; } if (SiteData.IsWebView) { pph.LoadPageControls(); } }
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 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); }
public List <ContentDateTally> GetMonthBlogUpdateList(Guid siteID, int iUpdates, bool bActiveOnly) { SiteData site = SiteData.GetSiteFromCache(siteID); List <carrot_ContentTally> lstContentTally = db.carrot_BlogMonthlyTallies(siteID, bActiveOnly, iUpdates).ToList(); List <ContentDateTally> lstContent = (from ct in lstContentTally orderby ct.DateMonth descending select(new ContentDateTally { DateCaption = ct.DateSlug, TallyDate = ct.DateMonth ?? DateTime.Now, UseCount = ct.ContentCount ?? 0, TheSite = site })).ToList(); return(lstContent); }
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); } } }
public void SaveTrackbackTop() { SiteData site = SiteData.GetSiteFromCache(this.SiteID); if (this.IsLatestVersion && site.SendTrackbacks) { TrackBackEntry t = TrackBackEntry.GetTrackBackQueue(this.Root_ContentID).FirstOrDefault(); if (t != null && t.CreateDate > site.Now.AddMinutes(-10)) { try { TrackBacker tb = new TrackBacker(); t.TrackBackResponse = tb.SendTrackback(t.Root_ContentID, site.SiteID, t.TrackBackURL); t.TrackedBack = true; t.Save(); } catch (Exception ex) { } } } }
protected BasicContentData GetFileInfoFromList(SiteData site, string sFilename) { if (sitePageList == null || sitePageList.Count < 1 || iAccessCounter % 25 == 0) { sitePageList = site.GetFullSiteFileList(); iAccessCounter = 0; } iAccessCounter++; BasicContentData pageData = (from m in sitePageList where m.FileName.ToLower() == sFilename.ToLower() select m).FirstOrDefault(); if (pageData == null) { using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) { pageData = BasicContentData.CreateBasicContentDataFromSiteNav(navHelper.GetLatestVersion(site.SiteID, false, sFilename.ToLower())); } } return pageData; }
public List <IContentMetaInfo> GetMonthBlogUpdateList(Guid siteID, int iUpdates, bool bActiveOnly) { SiteData site = SiteData.GetSiteFromCache(siteID); List <carrot_ContentTally> lstContentTally = db.carrot_BlogMonthlyTallies(siteID, bActiveOnly, iUpdates).ToList(); List <IContentMetaInfo> lstContent = (from ct in lstContentTally orderby ct.DateMonth descending select(IContentMetaInfo)( new ContentDateTally { DateCaption = ct.DateSlug, GoLiveDate = Convert.ToDateTime(ct.DateMonth), UseCount = Convert.ToInt32(ct.ContentCount), TheSite = site, TallyID = Guid.NewGuid() })).ToList(); return(lstContent); }
internal ContentTag(carrot_ContentTag c) { if (c != null) { this.ContentTagID = c.ContentTagID; this.SiteID = c.SiteID; this.TagSlug = ContentPageHelper.ScrubSlug(c.TagSlug); this.TagText = c.TagText; this.IsPublic = c.IsPublic; this.UseCount = 1; this.PublicUseCount = 1; SiteData site = SiteData.GetSiteFromCache(c.SiteID); if (site != null) { this.TagURL = ContentPageHelper.ScrubFilename(c.ContentTagID, String.Format("/{0}/{1}", site.BlogTagPath, c.TagSlug)); } } }
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 ContentPage(Guid siteID, ContentPageType.PageType pageType) { this.Root_ContentID = Guid.Empty; this.ContentID = Guid.NewGuid(); this.ContentType = pageType; this.SiteID = siteID; this.VersionCount = 0; this.NavOrder = -1; DateTime siteTime = SiteData.GetSiteByID(siteID).Now; this.CreateDate = siteTime; this.EditDate = siteTime; this.GoLiveDate = siteTime.AddMinutes(-5); this.RetireDate = siteTime.AddYears(200); //this.NavMenuText = "PAGE " + this.Root_ContentID.ToString().ToLowerInvariant(); //this.FileName = "/" + this.Root_ContentID.ToString().ToLowerInvariant(); this.NavMenuText = String.Empty; this.FileName = String.Empty; this.TemplateFile = SiteData.DefaultTemplateFilename; this.BlockIndex = false; this.PageActive = true; this.ShowInSiteMap = true; this.ShowInSiteNav = true; this.LeftPageText = PageContentEmpty; this.RightPageText = PageContentEmpty; this.PageText = PageContentEmpty; if (pageType != ContentPageType.PageType.ContentEntry) { this.Parent_ContentID = null; this.NavOrder = SiteData.BlogSortOrderNumber; this.ShowInSiteMap = false; this.ShowInSiteNav = false; } this.ContentCategories = new List <ContentCategory>(); this.ContentTags = new List <ContentTag>(); }
internal ContentEditor(vw_carrot_EditorURL c) { if (c != null) { SiteData site = SiteData.GetSiteFromCache(c.SiteID); this.UserId = c.UserId; this.SiteID = c.SiteID; this.UserUrl = c.UserUrl; this.LoweredEmail = c.LoweredEmail; this.UseCount = c.UseCount; this.PublicUseCount = c.PublicUseCount; this.IsPublic = true; if (c.EditDate.HasValue) { this.EditDate = site.ConvertUTCToSiteTime(c.EditDate.Value); } } }
protected void Page_Load(object sender, EventArgs e) { Master.ActivateTab(AdminBaseMasterPage.SectionID.SiteIndex); guidSiteID = GetGuidIDFromQuery(); btnAddUsers.Visible = SecurityData.IsAdmin; btnRemove.Visible = SecurityData.IsAdmin; theSite = SiteData.GetSiteByID(guidSiteID); if (theSite != null) { litID.Text = theSite.SiteID.ToString(); litSiteName.Text = theSite.SiteName; litTagline.Text = theSite.SiteTagline; litURL.Text = theSite.MainURL; } if (!IsPostBack) { GetUserList(); } }
internal BasicContentData(vw_carrot_Content c) { if (c != null) { SiteData site = SiteData.GetSiteFromCache(c.SiteID); this.SiteID = c.SiteID; this.Root_ContentID = c.Root_ContentID; this.PageActive = c.PageActive; this.Parent_ContentID = c.Parent_ContentID; this.FileName = c.FileName; this.TemplateFile = c.TemplateFile; this.NavOrder = c.NavOrder; this.ContentType = ContentPageType.GetTypeByID(c.ContentTypeID); this.CreateDate = site.ConvertUTCToSiteTime(c.CreateDate); this.GoLiveDate = site.ConvertUTCToSiteTime(c.GoLiveDate); this.RetireDate = site.ConvertUTCToSiteTime(c.RetireDate); } }
internal ContentTag(vw_carrot_TagURL c) { if (c != null) { SiteData site = SiteData.GetSiteFromCache(c.SiteID); this.ContentTagID = c.ContentTagID; this.SiteID = c.SiteID; this.TagURL = c.TagUrl; this.TagText = c.TagText; this.UseCount = c.UseCount; this.PublicUseCount = c.PublicUseCount; this.IsPublic = c.IsPublic; if (c.EditDate.HasValue) { this.EditDate = site.ConvertUTCToSiteTime(c.EditDate.Value); } } }
public string GetBlogHeadingFromURL(SiteData currentSite, string sFilterPath) { Guid siteID = currentSite.SiteID; string sTitle = String.Empty; if (currentSite.CheckIsBlogCategoryPath(sFilterPath)) { vw_carrot_CategoryURL query = CompiledQueries.cqGetCategoryByURL(db, siteID, sFilterPath); sTitle = query.CategoryText; } if (currentSite.CheckIsBlogTagPath(sFilterPath)) { vw_carrot_TagURL query = CompiledQueries.cqGetTagByURL(db, siteID, sFilterPath); sTitle = query.TagText; } if (currentSite.CheckIsBlogEditorFolderPath(sFilterPath)) { vw_carrot_EditorURL query = CompiledQueries.cqGetEditorByURL(db, siteID, sFilterPath); ExtendedUserData usr = new ExtendedUserData(query.UserId); sTitle = usr.ToString(); } if (currentSite.CheckIsBlogDateFolderPath(sFilterPath)) { BlogDatePathParser p = new BlogDatePathParser(currentSite, sFilterPath); TimeSpan ts = p.DateEndUTC - p.DateBeginUTC; int daysDelta = ts.Days; if (daysDelta > 90) { sTitle = "Year " + p.DateBegin.ToString("yyyy"); } if (daysDelta < 36) { sTitle = p.DateBegin.ToString("MMMM yyyy"); } if (daysDelta < 5) { sTitle = p.DateBegin.ToString("MMMM d, yyyy"); } } if (currentSite.CheckIsSiteSearchPath(sFilterPath)) { sTitle = "Search Results"; } return sTitle; }
public string GetBlogHeadingFromURL(SiteData currentSite, string sFilterPath) { string sTitle = String.Empty; if (currentSite.CheckIsBlogCategoryPath(sFilterPath)) { sTitle = "Category 1"; } if (currentSite.CheckIsBlogTagPath(sFilterPath)) { sTitle = "Tag 1"; } if (currentSite.CheckIsBlogEditorFolderPath(sFilterPath)) { sTitle = "Editor 1"; } if (currentSite.CheckIsBlogDateFolderPath(sFilterPath)) { sTitle = DateTime.UtcNow.ToString("MMMM yyyy"); } if (currentSite.CheckIsSiteSearchPath(sFilterPath)) { sTitle = "Search Results"; } return sTitle; }
public List<SiteNav> GetFilteredContentPagedList(SiteData currentSite, string sFilterPath, bool bActiveOnly, int pageSize, int pageNumber, string sortField, string sortDir) { return SiteNavHelper.GetSamplerFakeNav(pageSize); }
public static SiteData GetSiteFromCache(Guid siteID) { string ContentKey = SiteKeyPrefix + siteID.ToString(); SiteData currentSite = null; if (IsWebView) { try { currentSite = (SiteData)HttpContext.Current.Cache[ContentKey]; } catch { } if (currentSite == null) { currentSite = GetSiteByID(siteID); if (currentSite != null) { HttpContext.Current.Cache.Insert(ContentKey, currentSite, null, DateTime.Now.AddMinutes(5), Cache.NoSlidingExpiration); } else { HttpContext.Current.Cache.Remove(ContentKey); } } } else { currentSite = new SiteData(); currentSite.SiteID = Guid.Empty; currentSite.SiteName = "MOCK SITE"; currentSite.SiteTagline = "MOCK SITE TAGLINE"; currentSite.MainURL = "http://localhost"; currentSite.Blog_FolderPath = "archive"; currentSite.Blog_CategoryPath = "category"; currentSite.Blog_TagPath = "tag"; currentSite.Blog_DatePath = "date"; currentSite.Blog_EditorPath = "author"; currentSite.TimeZoneIdentifier = "UTC"; currentSite.Blog_DatePattern = "yyyy/MM/dd"; } return currentSite; }
public static string CheckForSpecialURL(SiteData site) { string sRequestedURL = "/"; if (IsWebView) { sRequestedURL = CurrentScriptName; string sFileRequested = sRequestedURL; if (!sRequestedURL.ToLower().StartsWith(AdminFolderPath) && site != null) { if (sFileRequested.ToLower().StartsWith(site.BlogFolderPath.ToLower())) { if (site.GetSpecialFilePathPrefixes().Where(x => sFileRequested.ToLower().StartsWith(x)).Count() > 0) { if (site.Blog_Root_ContentID.HasValue) { using (SiteNavHelper navHelper = new SiteNavHelper()) { SiteNav blogNavPage = navHelper.GetLatestVersion(site.SiteID, site.Blog_Root_ContentID.Value); if (blogNavPage != null) { sRequestedURL = blogNavPage.FileName; } } } } } } } return sRequestedURL; }
public void Load(SiteData model) { this.Site = model; }
public SiteExport(SiteData s, List<ContentPageExport> pages) { SetVals(s, pages); }
public int GetFilteredContentPagedCount(SiteData currentSite, string sFilterPath, bool bActiveOnly) { IQueryable<vw_carrot_Content> query1 = null; Guid siteID = currentSite.SiteID; bool bFound = false; if (currentSite.CheckIsBlogCategoryPath(sFilterPath)) { query1 = CannedQueries.GetContentByCategoryURL(db, siteID, bActiveOnly, sFilterPath); bFound = true; } if (currentSite.CheckIsBlogTagPath(sFilterPath)) { query1 = CannedQueries.GetContentByTagURL(db, siteID, bActiveOnly, sFilterPath); bFound = true; } if (currentSite.CheckIsBlogEditorFolderPath(sFilterPath)) { query1 = CannedQueries.GetContentByUserURL(db, siteID, bActiveOnly, sFilterPath); bFound = true; } if (currentSite.CheckIsBlogDateFolderPath(sFilterPath)) { BlogDatePathParser p = new BlogDatePathParser(currentSite, sFilterPath); query1 = CannedQueries.GetLatestBlogListDateRange(db, siteID, p.DateBeginUTC, p.DateEndUTC, bActiveOnly); bFound = true; } if (!bFound) { query1 = CannedQueries.GetLatestBlogList(db, siteID, bActiveOnly); } return query1.Count(); }
public void Save() { if (!this.IsWidgetPendingDelete) { SiteData site = new SiteData(CompiledQueries.cqGetSiteFromRootContentID(db, this.Root_ContentID)); carrot_Widget w = CompiledQueries.cqGetRootWidget(db, this.Root_WidgetID); bool bAdd = false; if (w == null) { bAdd = true; w = new carrot_Widget(); } if (this.Root_WidgetID == Guid.Empty) { this.Root_WidgetID = Guid.NewGuid(); } if (this.GoLiveDate.Year < 1900) { this.GoLiveDate = site.Now.AddMinutes(-5); } if (this.RetireDate.Year < 1900) { this.RetireDate = site.Now.AddYears(200); } w.Root_WidgetID = this.Root_WidgetID; w.WidgetOrder = this.WidgetOrder; w.Root_ContentID = this.Root_ContentID; w.PlaceholderName = this.PlaceholderName; w.ControlPath = this.ControlPath.Replace("~~/", "~/"); w.WidgetActive = this.IsWidgetActive; w.GoLiveDate = site.ConvertSiteTimeToUTC(this.GoLiveDate); w.RetireDate = site.ConvertSiteTimeToUTC(this.RetireDate); carrot_WidgetData wd = new carrot_WidgetData(); wd.Root_WidgetID = w.Root_WidgetID; wd.WidgetDataID = Guid.NewGuid(); wd.IsLatestVersion = true; wd.ControlProperties = this.ControlProperties; wd.EditDate = DateTime.UtcNow; carrot_WidgetData oldWD = CompiledQueries.cqGetWidgetDataByRootID(db, this.Root_WidgetID); //only add a new entry if the widget has some sort of change in the data stored. if (oldWD != null) { if (oldWD.ControlProperties != wd.ControlProperties) { oldWD.IsLatestVersion = false; db.carrot_WidgetDatas.InsertOnSubmit(wd); } } else { db.carrot_WidgetDatas.InsertOnSubmit(wd); } if (bAdd) { db.carrot_Widgets.InsertOnSubmit(w); } db.SubmitChanges(); } else { DeleteAll(); } }
public int GetFilteredContentByIDPagedCount(SiteData currentSite, List<Guid> lstCategoryGUIDs, List<string> lstCategorySlugs, bool bActiveOnly) { return 50; }
public PageViewType GetBlogHeadingFromURL(SiteData currentSite, string sFilterPath) { Guid siteID = currentSite.SiteID; PageViewType pvt = new PageViewType { ExtraTitle = "", CurrentViewType = PageViewType.ViewType.SinglePage, RawValue = null }; string sTitle = String.Empty; if (currentSite.CheckIsBlogCategoryPath(sFilterPath)) { pvt.CurrentViewType = PageViewType.ViewType.CategoryIndex; vw_carrot_CategoryURL query = CompiledQueries.cqGetCategoryByURL(db, siteID, sFilterPath); if (query != null) { sTitle = query.CategoryText; pvt.RawValue = query.CategoryText; } } if (currentSite.CheckIsBlogTagPath(sFilterPath)) { pvt.CurrentViewType = PageViewType.ViewType.TagIndex; vw_carrot_TagURL query = CompiledQueries.cqGetTagByURL(db, siteID, sFilterPath); if (query != null) { sTitle = query.TagText; pvt.RawValue = query.TagText; } } if (currentSite.CheckIsBlogEditorFolderPath(sFilterPath)) { pvt.CurrentViewType = PageViewType.ViewType.AuthorIndex; vw_carrot_EditorURL query = CompiledQueries.cqGetEditorByURL(db, siteID, sFilterPath); if (query != null) { ExtendedUserData usr = new ExtendedUserData(query.UserId); sTitle = usr.ToString(); pvt.RawValue = usr; } } if (currentSite.CheckIsBlogDateFolderPath(sFilterPath)) { pvt.CurrentViewType = PageViewType.ViewType.DateIndex; BlogDatePathParser p = new BlogDatePathParser(currentSite, sFilterPath); TimeSpan ts = p.DateEndUTC - p.DateBeginUTC; pvt.RawValue = p.DateBegin; int daysDelta = ts.Days; if (daysDelta < 400 && daysDelta > 90) { sTitle = p.DateBegin.ToString("yyyy"); pvt.CurrentViewType = PageViewType.ViewType.DateYearIndex; } if (daysDelta < 36 && daysDelta > 3) { sTitle = p.DateBegin.ToString("MMMM yyyy"); pvt.CurrentViewType = PageViewType.ViewType.DateMonthIndex; } if (daysDelta < 5) { sTitle = p.DateBegin.ToString("MMMM d, yyyy"); pvt.CurrentViewType = PageViewType.ViewType.DateDayIndex; } } if (currentSite.CheckIsSiteSearchPath(sFilterPath)) { pvt.CurrentViewType = PageViewType.ViewType.SearchResults; string sSearchTerm = ""; if (HttpContext.Current.Request.QueryString[SiteData.SearchQueryParameter] != null) { sSearchTerm = HttpContext.Current.Request.QueryString[SiteData.SearchQueryParameter].ToString(); } pvt.RawValue = sSearchTerm; sTitle = string.Format(" '{0}' ", sSearchTerm); } pvt.ExtraTitle = sTitle; return pvt; }
public List<SiteNav> GetFilteredContentByIDPagedList(SiteData currentSite, List<Guid> lstCategoryGUIDs, List<string> lstCategorySlugs, bool bActiveOnly, int pageSize, int pageNumber, string sortField, string sortDir) { return SiteNavHelper.GetSamplerFakeNav(pageSize); }
public List<ContentPage> GetFilteredContentPagedList(SiteData currentSite, string sFilterPath, bool bActiveOnly, int pageSize, int pageNumber, string sortField, string sortDir) { IQueryable<vw_carrot_Content> query1 = null; Guid siteID = currentSite.SiteID; bool bFound = false; if (currentSite.CheckIsBlogCategoryPath(sFilterPath)) { query1 = CannedQueries.GetContentByCategoryURL(db, siteID, bActiveOnly, sFilterPath); bFound = true; } if (currentSite.CheckIsBlogTagPath(sFilterPath)) { query1 = CannedQueries.GetContentByTagURL(db, siteID, bActiveOnly, sFilterPath); bFound = true; } if (currentSite.CheckIsBlogEditorFolderPath(sFilterPath)) { query1 = CannedQueries.GetContentByUserURL(db, siteID, bActiveOnly, sFilterPath); bFound = true; } if (currentSite.CheckIsBlogDateFolderPath(sFilterPath)) { BlogDatePathParser p = new BlogDatePathParser(currentSite, sFilterPath); query1 = CannedQueries.GetLatestBlogListDateRange(db, siteID, p.DateBeginUTC, p.DateEndUTC, bActiveOnly); bFound = true; } if (!bFound) { query1 = CannedQueries.GetLatestBlogList(db, siteID, bActiveOnly); } return PerformDataPagingQueryableContent(siteID, bActiveOnly, pageSize, pageNumber, sortField, sortDir, query1); }
public static HtmlString Rss(SiteData.RSSFeedInclude mode) { return new HtmlString(String.Format("<!-- RSS Header Feed --> <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS Feed\" href=\"{0}?type={1}\" /> ", CarrotCakeHtml.RssUri, mode)); }
public SiteDataModel(SiteData model) { Load(model); }
public static MvcHtmlString RssLink(SiteData.RSSFeedInclude mode, string imagePath = "", string imageAltText = "RSS", object imageAttributes = null, object linkAttributes = null) { var url = new UrlHelper(Html.ViewContext.RequestContext); var anchorBuilder = new TagBuilder("a"); anchorBuilder.MergeAttribute("href", String.Format("{0}?type={1}", CarrotCakeHtml.RssUri, mode)); var lnkAttribs = (IDictionary<string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(linkAttributes); anchorBuilder.MergeAttributes(lnkAttribs); if (String.IsNullOrEmpty(imagePath)) { imagePath = ControlUtilities.GetWebResourceUrl("Carrotware.CMS.UI.Components.feed.png"); } var imgBuilder = new TagBuilder("img"); imgBuilder.MergeAttribute("src", url.Content(imagePath)); imgBuilder.MergeAttribute("alt", imageAltText); imgBuilder.MergeAttribute("title", imageAltText); var imgAttribs = (IDictionary<string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(imageAttributes); imgBuilder.MergeAttributes(imgAttribs); string imgHtml = imgBuilder.ToString(TagRenderMode.SelfClosing); anchorBuilder.InnerHtml = imgHtml; return MvcHtmlString.Create(anchorBuilder.ToString()); }
public ActionResult SiteInfo(SiteDataModel model) { Helper.ForceValidation(ModelState, model); if (ModelState.IsValid) { SiteData site = siteHelper.GetCurrentSite(); bool bNewSite = false; if (site == null) { bNewSite = true; site = new SiteData(); site.SiteID = SiteID; } site = model.Site; site.Save(); //if (sDatePatternOld != ddlDatePattern.SelectedValue || sTimezoneOld != ddlTimeZone.SelectedValue) { // using (ContentPageHelper cph = new ContentPageHelper()) { // cph.BulkBlogFileNameUpdateFromDate(this.SiteID); // } //} if (model.CreateHomePage) { CreateEmptyHome(); } if (bNewSite) { return RedirectToAction("Index"); } else { return RedirectToAction("SiteInfo"); } } Helper.HandleErrorDict(ModelState); LoadTimeZoneInfo(); LoadDatePattern(); return View(model); }
public static MvcHtmlString RssTextLink(SiteData.RSSFeedInclude mode, string linkText = "RSS", object linkAttributes = null) { var anchorBuilder = new TagBuilder("a"); anchorBuilder.MergeAttribute("href", String.Format("{0}?type={1}", CarrotCakeHtml.RssUri, mode)); var lnkAttribs = (IDictionary<string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(linkAttributes); anchorBuilder.MergeAttributes(lnkAttribs); anchorBuilder.InnerHtml = linkText; return MvcHtmlString.Create(anchorBuilder.ToString()); }