Inheritance: ISiteContent
		public static PagePayload GetContent(SiteNav nav) {
			PagePayload page = new PagePayload();
			page.ThePage = nav.GetContentPage();

			page.Load();
			return page;
		}
        public string SendTrackback(Uri targetURL, SiteNav pageNav)
        {
            this.DestinationUrl = targetURL;
            this.SourcePage = pageNav;
            this.BlogSite = SiteData.GetSiteFromCache(this.SourcePage.SiteID);

            return SendTrackback();
        }
		protected SiteNav GetHomePage(SiteData site) {
			if (_navHome == null) {
				using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
					_navHome = navHelper.FindHome(site.SiteID, false);
				}
			}
			return _navHome;
		}
 public SiteNav FindByFilename(Guid siteID, string urlFileName)
 {
     SiteNav content = null;
     vw_carrot_Content cont = CompiledQueries.GetLatestContentByURL(db, siteID, false, urlFileName);
     if (cont != null) {
         content = new SiteNav(cont);
     }
     return content;
 }
 public SiteNav FindHome(Guid siteID, bool bActiveOnly)
 {
     SiteNav content = null;
     vw_carrot_Content cont = CompiledQueries.FindHome(db, siteID, bActiveOnly);
     if (cont != null) {
         content = new SiteNav(cont);
     }
     return content;
 }
		public override string GetHtml() {
			string sFieldValue = string.Empty;

			if (this.ContentPage == null) {
				this.ContentPage = SiteData.GetCurrentPage();
			}

			SiteNav navNext = new SiteNav();

			if (this.NavigationDirection != NavDirection.Unknown) {
				using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
					if (NavigationDirection == NavDirection.Prev) {
						navNext = navHelper.GetPrevPost(SiteData.CurrentSiteID, this.ContentPage.Root_ContentID, !SecurityData.IsAuthEditor);
					}
					if (NavigationDirection == NavDirection.Next) {
						navNext = navHelper.GetNextPost(SiteData.CurrentSiteID, this.ContentPage.Root_ContentID, !SecurityData.IsAuthEditor);
					}

					if (navNext != null) {
						if (this.UseDefaultText) {
							string sField = this.CaptionDataField.ToString();

							object objData = ReflectionUtilities.GetPropertyValue(navNext, sField);
							if (objData != null) {
								sFieldValue = String.Format("{0}", objData);
							}

							this.NavigateText = sFieldValue;
						}

						this.NavigateUrl = navNext.FileName;
					} else {
						this.NavigateUrl = String.Empty;
					}
				}
			} else {
				this.NavigateUrl = String.Empty;
			}

			if (!String.IsNullOrEmpty(this.NavigateUrl)) {
				var lnkBuilder = new TagBuilder("a");
				lnkBuilder.MergeAttribute("href", this.NavigateUrl);

				lnkBuilder.InnerHtml = this.NavigateUrl;
				if (!String.IsNullOrEmpty(this.NavigateText)) {
					lnkBuilder.InnerHtml = this.NavigateText;
				}

				var lnkAttribs = (IDictionary<string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(linkAttributes);
				lnkBuilder.MergeAttributes(lnkAttribs);

				return lnkBuilder.ToString(TagRenderMode.Normal);
			} else {
				return String.Empty;
			}
		}
示例#7
0
        public SiteNav FindByFilename(Guid siteID, string urlFileName)
        {
            SiteNav           content = null;
            vw_carrot_Content cont    = CompiledQueries.GetLatestContentByURL(db, siteID, false, urlFileName);

            if (cont != null)
            {
                content = new SiteNav(cont);
            }
            return(content);
        }
示例#8
0
        public SiteNav GetPageNavigation(Guid siteID, string sPage)
        {
            SiteNav           content = null;
            vw_carrot_Content cont    = CompiledQueries.GetLatestContentByURL(db, siteID, false, sPage);

            if (cont != null)
            {
                content = new SiteNav(cont);
            }
            return(content);
        }
示例#9
0
        public SiteNav GetLatestVersion(Guid siteID, Guid rootContentID)
        {
            SiteNav           content = null;
            vw_carrot_Content cont    = CompiledQueries.GetLatestContentByID(db, siteID, false, rootContentID);

            if (cont != null)
            {
                content = new SiteNav(cont);
            }
            return(content);
        }
示例#10
0
        public string SendTrackback(string sourceURL, Guid siteID, string sTgtURL)
        {
            this.DestinationUrl = new Uri(sTgtURL);
            this.BlogSite = SiteData.GetSiteFromCache(siteID);

            using (SiteNavHelper snh = new SiteNavHelper()) {
                this.SourcePage = snh.FindByFilename(siteID, sourceURL);
            }

            return SendTrackback();
        }
示例#11
0
        public SiteNav FindHome(Guid siteID, bool bActiveOnly)
        {
            SiteNav           content = null;
            vw_carrot_Content cont    = CompiledQueries.FindHome(db, siteID, bActiveOnly);

            if (cont != null)
            {
                content = new SiteNav(cont);
            }
            return(content);
        }
示例#12
0
        private SiteNav GetPageNavigation(Guid siteID, Guid rootContentID, bool bActiveOnly)
        {
            SiteNav           content = null;
            vw_carrot_Content cont    = CompiledQueries.GetLatestContentByID(db, siteID, bActiveOnly, rootContentID);

            if (cont != null)
            {
                content = new SiteNav(cont);
            }
            return(content);
        }
示例#13
0
        public SiteNav GetLatestVersion(Guid siteID, bool bActiveOnly, string sPage)
        {
            SiteNav           content = null;
            vw_carrot_Content cont    = CompiledQueries.GetLatestContentByURL(db, siteID, bActiveOnly, sPage);

            if (cont != null)
            {
                content = new SiteNav(cont);
            }
            return(content);
        }
示例#14
0
        public string SendTrackback(Guid sourceGuid, Guid siteID, string sTgtURL)
        {
            this.DestinationUrl = new Uri(sTgtURL);
            this.BlogSite = SiteData.GetSiteFromCache(siteID);

            using (SiteNavHelper snh = new SiteNavHelper()) {
                this.SourcePage = snh.GetLatestVersion(siteID, sourceGuid);
            }

            return SendTrackback();
        }
示例#15
0
        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());
        }
示例#16
0
        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());
        }
示例#17
0
        private List <SiteNav> GetPageCrumbNavByContent(vw_carrot_Content content, bool bActiveOnly)
        {
            Guid siteID          = Guid.Empty;
            Guid rootContentID   = Guid.Empty;
            Guid?parentContentID = null;
            int  iOrder          = 1000000;

            List <SiteNav> lstContent = new List <SiteNav>();

            if (content != null)
            {
                rootContentID   = content.Root_ContentID;
                siteID          = content.SiteID;
                parentContentID = content.Parent_ContentID;
                SiteNav sn = new SiteNav(content);
                sn.NavOrder = iOrder + 100;
                lstContent.Add(sn);
            }

            if (rootContentID != Guid.Empty)
            {
                Guid?gLast = parentContentID;

                while (gLast.HasValue)
                {
                    SiteNav nav = GetPageNavigation(siteID, gLast.Value, false);
                    gLast = null;

                    if (nav != null)
                    {
                        nav.NavOrder = iOrder;
                        lstContent.Add(nav);
                        iOrder--;

                        gLast = nav.Parent_ContentID;
                    }
                }
            }

            SiteNav home = FindHome(siteID, false);

            home.NavOrder = 0;

            if (lstContent.Where(x => x.Root_ContentID == home.Root_ContentID).Count() < 1)
            {
                lstContent.Add(home);
            }

            return(lstContent.OrderBy(x => x.NavOrder).Where(x => x.PageActive == true && x.IsRetired == false && x.IsUnReleased == false || bActiveOnly == false).ToList());
        }
        public SiteNav GetLatestVersion(Guid siteID, bool bActiveOnly, string sPage)
        {
            SiteNav           content = null;
            vw_carrot_Content cont    = CompiledQueries.GetLatestContentByURL(db, siteID, bActiveOnly, sPage);

            if (cont != null)
            {
                content = new SiteNav(cont);
            }
            if (content == null && sPage == SiteData.DefaultDirectoryFilename)
            {
                content = FindHome(siteID, bActiveOnly);
            }
            return(content);
        }
示例#19
0
        public SiteNav GetSiteNav()
        {
            SiteNav sd = null;

            if (SiteData.IsPageSampler || !SiteData.IsWebView)
            {
                sd = SiteNavHelper.GetSamplerView();
            }
            else
            {
                using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
                    sd = navHelper.GetLatestVersion(this.SiteID, this.Root_ContentID);
                }
            }
            return(sd);
        }
        internal static SiteNav GetSamplerView()
        {
            string sFile2 = GetSampleBody();

            SiteNav navNew = new SiteNav();

            navNew.Root_ContentID = SeqGuid.NextGuid;
            navNew.ContentID      = Guid.NewGuid();

            navNew.NavOrder      = -1;
            navNew.TitleBar      = "Template Preview - TITLE";
            navNew.NavMenuText   = "Template PV - NAV";
            navNew.PageHead      = "Template Preview - HEAD";
            navNew.PageActive    = true;
            navNew.ShowInSiteNav = true;
            navNew.ShowInSiteMap = true;

            navNew.EditDate   = DateTime.Now.Date.AddHours(-8);
            navNew.CreateDate = DateTime.Now.Date.AddHours(-38);
            navNew.GoLiveDate = navNew.EditDate.AddHours(-5);
            navNew.RetireDate = navNew.CreateDate.AddYears(5);
            navNew.PageText   = "<h2>Content CENTER</h2>\r\n";

            navNew.TemplateFile = SiteData.PreviewTemplateFile;

            if (SiteData.IsWebView)
            {
                navNew.FileName = SiteData.PreviewTemplateFilePage + "?" + HttpContext.Current.Request.QueryString.ToString();
            }
            else
            {
                navNew.FileName = SiteData.PreviewTemplateFilePage + "?sampler=true";
            }

            navNew.PageText = "<h2>Content CENTER</h2>\r\n" + sFile2;

            navNew.SiteID           = SiteData.CurrentSiteID;
            navNew.Parent_ContentID = null;
            navNew.ContentType      = ContentPageType.PageType.ContentEntry;

            navNew.EditUserId = SecurityData.CurrentUserGuid;

            return(navNew);
        }
		public static BasicContentData CreateBasicContentDataFromSiteNav(SiteNav c) {
			BasicContentData sn = null;
			if (c != null) {
				sn = new BasicContentData();
				sn.Root_ContentID = c.Root_ContentID;
				sn.Parent_ContentID = c.Parent_ContentID;
				sn.FileName = c.FileName;
				sn.TemplateFile = c.TemplateFile;
				sn.SiteID = c.SiteID;
				sn.PageActive = c.PageActive;
				sn.CreateDate = c.CreateDate;
				sn.GoLiveDate = c.GoLiveDate;
				sn.RetireDate = c.RetireDate;
				sn.ContentType = c.ContentType;
				sn.NavOrder = c.NavOrder;
			}

			return sn;
		}
示例#22
0
 public override bool Equals(Object obj)
 {
     //Check for null and compare run-time types.
     if (obj == null || GetType() != obj.GetType())
     {
         return(false);
     }
     if (obj is SiteNav)
     {
         SiteNav p = (SiteNav)obj;
         return((this.ContentID == p.ContentID) &&
                (this.SiteID == p.SiteID) &&
                (this.Root_ContentID == p.Root_ContentID));
     }
     else
     {
         return(false);
     }
 }
		internal static SiteNav GetEmptyHome() {
			SiteNav navData = new SiteNav();
			navData.ContentID = Guid.Empty;
			navData.Root_ContentID = Guid.Empty;
			navData.SiteID = SiteData.CurrentSiteID;
			navData.TemplateFile = SiteData.DefaultDirectoryFilename;
			navData.FileName = SiteData.DefaultDirectoryFilename;
			navData.NavMenuText = "NONE";
			navData.PageHead = "NONE";
			navData.TitleBar = "NONE";
			navData.PageActive = false;
			navData.PageText = "NO PAGE CONTENT";
			navData.EditDate = DateTime.Now.Date.AddDays(-1);
			navData.CreateDate = DateTime.Now.Date.AddDays(-10);
			navData.GoLiveDate = DateTime.Now.Date.AddDays(1);
			navData.RetireDate = DateTime.Now.Date.AddDays(90);
			navData.ContentType = ContentPageType.PageType.ContentEntry;
			return navData;
		}
        internal static SiteNav GetEmptyHome()
        {
            SiteNav navData = new SiteNav();

            navData.ContentID      = Guid.Empty;
            navData.Root_ContentID = Guid.Empty;
            navData.SiteID         = SiteData.CurrentSiteID;
            navData.TemplateFile   = SiteData.DefaultDirectoryFilename;
            navData.FileName       = SiteData.DefaultDirectoryFilename;
            navData.NavMenuText    = "NONE";
            navData.PageHead       = "NONE";
            navData.TitleBar       = "NONE";
            navData.PageActive     = false;
            navData.PageText       = "NO PAGE CONTENT";
            navData.EditDate       = DateTime.Now.Date.AddDays(-1);
            navData.CreateDate     = DateTime.Now.Date.AddDays(-10);
            navData.GoLiveDate     = DateTime.Now.Date.AddDays(1);
            navData.RetireDate     = DateTime.Now.Date.AddDays(90);
            navData.ContentType    = ContentPageType.PageType.ContentEntry;
            return(navData);
        }
        internal static List <SiteNav> GetSamplerFakeNav(int iCount, Guid?rootParentID)
        {
            List <SiteNav> navList = new List <SiteNav>();
            int            n       = 0;

            SeqGuid = null;

            while (n < iCount)
            {
                SiteNav nav = GetSamplerView();
                nav.NavOrder      = n;
                nav.NavMenuText   = nav.NavMenuText + " " + n.ToString();
                nav.CreateDate    = nav.CreateDate.AddHours((0 - n) * 25);
                nav.EditDate      = nav.CreateDate.AddHours((0 - n) * 16);
                nav.GoLiveDate    = DateTime.Now.Date.AddMinutes(-5);
                nav.RetireDate    = DateTime.Now.Date.AddDays(90);
                nav.CommentCount  = (n * 2) + 1;
                nav.ShowInSiteNav = true;
                nav.ShowInSiteMap = true;

                if (n > 0 || rootParentID != null)
                {
                    nav.Root_ContentID = SeqGuid.NextGuid;
                    nav.ContentID      = Guid.NewGuid();
                    //nav.FileName = nav.FileName.Replace(".aspx", nav.NavOrder.ToString() + ".aspx");
                    nav.FileName = "/#";
                    if (rootParentID != null)
                    {
                        nav.NavMenuText = nav.NavMenuText + " - " + rootParentID.Value.ToString().Substring(0, 4);
                    }
                }
                nav.Parent_ContentID = rootParentID;

                navList.Add(nav);
                n++;
            }

            return(navList);
        }
示例#26
0
        public static BasicContentData CreateBasicContentDataFromSiteNav(SiteNav c)
        {
            BasicContentData sn = null;

            if (c != null)
            {
                sn = new BasicContentData();
                sn.Root_ContentID   = c.Root_ContentID;
                sn.Parent_ContentID = c.Parent_ContentID;
                sn.FileName         = c.FileName;
                sn.TemplateFile     = c.TemplateFile;
                sn.SiteID           = c.SiteID;
                sn.PageActive       = c.PageActive;
                sn.CreateDate       = c.CreateDate;
                sn.GoLiveDate       = c.GoLiveDate;
                sn.RetireDate       = c.RetireDate;
                sn.ContentType      = c.ContentType;
                sn.NavOrder         = c.NavOrder;
            }

            return(sn);
        }
示例#27
0
        private SiteNav GetParentPageNavigationByNav(Guid siteID, SiteNav navItem)
        {
            if (navItem != null)
            {
                if (navItem.ContentType == ContentPageType.PageType.BlogEntry)
                {
                    Guid?parentPageID = SiteData.GetSiteFromCache(siteID).Blog_Root_ContentID;
                    navItem.Parent_ContentID = parentPageID;
                }

                SiteNav content = null;
                if (navItem != null && navItem.Parent_ContentID.HasValue)
                {
                    content = new SiteNav(CompiledQueries.GetLatestContentByID(db, siteID, false, navItem.Parent_ContentID.Value));
                }

                return(content);
            }
            else
            {
                return(null);
            }
        }
示例#28
0
        public SiteNav GetParentPageNavigation(Guid siteID, string sPage)
        {
            SiteNav nav = GetPageNavigation(siteID, sPage);

            return(GetParentPageNavigationByNav(siteID, nav));
        }
示例#29
0
 public static SiteNav IdentifyLinkAsInactive(SiteNav nav)
 {
     return CMSConfigHelper.IdentifyLinkAsInactive(nav);
 }
示例#30
0
        protected SiteNav GetCurrentPage()
        {
            SiteNav pageNav = null;
            ControlUtilities cu = new ControlUtilities(this);
            ContentPage cp = cu.GetContainerContentPage(this);

            if (cp != null) {
                pageNav = new SiteNav();
                pageNav.Root_ContentID = cp.Root_ContentID;
                pageNav.FileName = cp.FileName;
                pageNav.TemplateFile = cp.TemplateFile;
            } else {
                pageNav = navHelper.FindByFilename(SiteData.CurrentSiteID, SiteData.AlternateCurrentScriptName);
                //assign bogus page name for comp purposes
                if (pageNav == null) {
                    pageNav = new SiteNav();
                    pageNav.Root_ContentID = Guid.Empty;
                    pageNav.FileName = "/##/##/";
                    pageNav.TemplateFile = "/##/##/";
                }
            }
            pageNav.SiteID = SiteData.CurrentSiteID;

            return pageNav;
        }
示例#31
0
 public string ConstructedCanonicalURL(SiteNav nav)
 {
     return RemoveDupeSlashesURL(this.MainCanonicalURL + nav.FileName);
 }
示例#32
0
        protected SiteNav GetParentPage()
        {
            SiteNav pageNav = navHelper.GetParentPageNavigation(SiteData.CurrentSiteID, SiteData.AlternateCurrentScriptName);

            //assign bogus page name for comp purposes
            if (pageNav == null) {
                pageNav = new SiteNav();
                pageNav.Root_ContentID = Guid.Empty;
                pageNav.FileName = "/##/";
                pageNav.TemplateFile = "/##/";
            }

            return pageNav;
        }
示例#33
0
 public bool NavIsCurrentPage(SiteNav nav)
 {
     return(this.ThePage.Root_ContentID == nav.Root_ContentID);
 }
        protected override IHttpHandler GetHttpHandler(System.Web.Routing.RequestContext requestCtx)
        {
            string requestedUri = (string)requestCtx.RouteData.Values["RequestedUri"];

            requestedUri = String.IsNullOrEmpty(requestedUri) ? String.Empty : requestedUri.ToLower();
            if (!requestedUri.StartsWith("/"))
            {
                requestedUri = String.Format("/{0}", requestedUri);
            }
            if (requestedUri.EndsWith("/"))
            {
                requestedUri = requestedUri.Substring(0, requestedUri.Length - 1);
            }

            if (requestedUri.EndsWith(".ashx"))
            {
                if (requestedUri == "/rss.ashx")
                {
                    requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                    requestCtx.RouteData.Values["action"]     = "RSSFeed";
                    return(base.GetHttpHandler(requestCtx));
                }
                if (requestedUri == "/sitemap.ashx")
                {
                    requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                    requestCtx.RouteData.Values["action"]     = "SiteMap";
                    return(base.GetHttpHandler(requestCtx));
                }

                //if (requestedUri == "/trackback.ashx") {	// will be dead link
                //	requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                //	requestCtx.RouteData.Values["action"] = "Trackback";
                //	return base.GetHttpHandler(requestCtx);
                //}

                requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                requestCtx.RouteData.Values["action"]     = "PageNotFound";
                requestCtx.RouteData.Values["id"]         = null;

                SiteData.WriteDebugException("cmsroutehandler ashx not matched", new Exception(String.Format("RequestedUri: {0}", requestedUri)));

                return(base.GetHttpHandler(requestCtx));
            }
            else if (requestedUri.EndsWith(".aspx"))
            {
                //since .aspx is not supported
                requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                requestCtx.RouteData.Values["action"]     = "PageNotFound";
                requestCtx.RouteData.Values["id"]         = null;
            }
            else
            {
                string sCurrentPage = SiteData.CurrentScriptName;

                try {
                    string sScrubbedURL = SiteData.AlternateCurrentScriptName;

                    if (sScrubbedURL.ToLower() != sCurrentPage.ToLower())
                    {
                        requestedUri = sScrubbedURL;
                    }

                    SiteNav navData             = null;
                    bool    bIsHomePage         = false;
                    bool    bIgnorePublishState = SecurityData.AdvancedEditMode || SecurityData.IsAdmin || SecurityData.IsSiteEditor;

                    using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
                        if (SiteData.IsLikelyHomePage(requestedUri))
                        {
                            navData = navHelper.FindHome(SiteData.CurrentSiteID, !bIgnorePublishState);

                            if (navData != null)
                            {
                                requestedUri = navData.FileName;
                                bIsHomePage  = true;
                            }
                        }

                        if (!bIsHomePage)
                        {
                            navData = navHelper.GetLatestVersion(SiteData.CurrentSiteID, !bIgnorePublishState, requestedUri);
                        }

                        if ((SiteData.IsLikelyHomePage(requestedUri)) && navData == null)
                        {
                            navData = SiteNavHelper.GetEmptyHome();
                        }

                        requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                        if (navData != null)
                        {
                            SiteData.WriteDebugException("cmsroutehandler != null", new Exception(String.Format("Default: {0}", navData.FileName)));
                            requestCtx.RouteData.Values["action"] = "Default";
                        }
                        else
                        {
                            SiteData.WriteDebugException("cmsroutehandler == null", new Exception(String.Format("_PageNotFound: {0}", sCurrentPage)));
                            requestCtx.RouteData.Values["action"] = "PageNotFound";
                        }
                        requestCtx.RouteData.Values["id"] = null;
                    }
                } catch (Exception ex) {
                    SiteData.WriteDebugException("cmsroutehandler_exception_uri", new Exception(String.Format("Exception: {0}", sCurrentPage)));

                    if (DatabaseUpdate.SystemNeedsChecking(ex) || DatabaseUpdate.AreCMSTablesIncomplete())
                    {
                        requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                        requestCtx.RouteData.Values["action"]     = "Default";
                        requestCtx.RouteData.Values["id"]         = null;
                        SiteData.WriteDebugException("cmsroutehandler_exception_systemneedschecking", ex);
                    }
                    else
                    {
                        //something bad has gone down, toss back the error
                        SiteData.WriteDebugException("cmsroutehandler_exception", ex);
                        throw;
                    }
                }
            }

            return(base.GetHttpHandler(requestCtx));
        }
示例#35
0
 public static SiteNav IdentifyLinkAsInactive(SiteNav nav)
 {
     if (nav != null) {
         if (!nav.PageActive) {
             nav.NavMenuText = InactivePagePrefix + nav.NavMenuText;
             nav.PageHead = InactivePagePrefix + nav.PageHead;
             nav.TitleBar = InactivePagePrefix + nav.TitleBar;
         }
         if (nav.IsRetired) {
             nav.NavMenuText = RetiredPagePrefix + nav.NavMenuText;
             nav.PageHead = RetiredPagePrefix + nav.PageHead;
             nav.TitleBar = RetiredPagePrefix + nav.TitleBar;
         }
         if (nav.IsUnReleased) {
             nav.NavMenuText = UnreleasedPagePrefix + nav.NavMenuText;
             nav.PageHead = UnreleasedPagePrefix + nav.PageHead;
             nav.TitleBar = UnreleasedPagePrefix + nav.TitleBar;
         }
     }
     return nav;
 }
示例#36
0
        internal static SiteNav GetSamplerView()
        {
            string sFile2 = GetSampleBody();

            SiteNav navNew = new SiteNav();
            navNew.Root_ContentID = Guid.NewGuid();
            navNew.ContentID = Guid.NewGuid();

            navNew.NavOrder = -1;
            navNew.TitleBar = "Template Preview - TITLE";
            navNew.NavMenuText = "Template PV - NAV"; ;
            navNew.PageHead = "Template Preview - HEAD";
            navNew.PageActive = true;
            navNew.ShowInSiteNav = true;
            navNew.ShowInSiteMap = true;

            navNew.EditDate = DateTime.Now.Date.AddHours(-8);
            navNew.CreateDate = DateTime.Now.Date.AddHours(-38);
            navNew.GoLiveDate = navNew.EditDate.AddHours(-5);
            navNew.RetireDate = navNew.CreateDate.AddYears(5);
            navNew.PageText = "<h2>Content CENTER</h2>\r\n";

            navNew.TemplateFile = SiteData.PreviewTemplateFile;
            if (SiteData.IsWebView) {
                navNew.FileName = SiteData.PreviewTemplateFilePage + "?" + HttpContext.Current.Request.QueryString.ToString();
            } else {
                navNew.FileName = SiteData.PreviewTemplateFilePage + "?sampler=true";
            }

            navNew.PageText = "<h2>Content CENTER</h2>\r\n" + sFile2;

            navNew.SiteID = SiteData.CurrentSiteID;
            navNew.Parent_ContentID = null;
            navNew.ContentType = ContentPageType.PageType.ContentEntry;

            navNew.EditUserId = SecurityData.CurrentUserGuid;

            return navNew;
        }
		public void OverridePage(SiteNav nav) {
			this.CmsPage = PagePayload.GetContent(nav);
			this.ViewData[PagePayload.ViewDataKey] = this.CmsPage;
		}
示例#38
0
 // ======================================
 private SiteNav IdentifyLinkAsInactive(SiteNav nav)
 {
     return CMSConfigHelper.IdentifyLinkAsInactive(nav);
 }
 public SiteNav GetPageNavigation(Guid siteID, string sPage)
 {
     SiteNav content = null;
     vw_carrot_Content cont = CompiledQueries.GetLatestContentByURL(db, siteID, false, sPage);
     if (cont != null) {
         content = new SiteNav(cont);
     }
     if (content == null && sPage == SiteData.DefaultDirectoryFilename) {
         content = FindHome(siteID, false);
     }
     return content;
 }
示例#40
0
		public bool NavIsInCurrentTree(SiteNav nav) {
			return (nav.Root_ContentID == this.ThePage.Root_ContentID
							|| (this.ThePage.Parent_ContentID.HasValue && nav.Root_ContentID == this.ThePage.Parent_ContentID.Value)
							|| (this.ThePage.ContentType == ContentPageType.PageType.BlogEntry && this.TheSite.Blog_Root_ContentID.HasValue
										&& nav.Root_ContentID == this.TheSite.Blog_Root_ContentID.Value));
		}
		public SiteNav GetLatestVersion(Guid siteID, bool bActiveOnly, string sPage) {
			SiteNav content = null;
			vw_carrot_Content cont = CompiledQueries.GetLatestContentByURL(db, siteID, bActiveOnly, sPage);
			if (cont != null) {
				content = new SiteNav(cont);
			}
			return content;
		}
 public SiteNav GetPageNavigation(Guid siteID, Guid rootContentID)
 {
     SiteNav content = null;
     vw_carrot_Content cont = CompiledQueries.GetLatestContentByID(db, siteID, false, rootContentID);
     if (cont != null) {
         content = new SiteNav(cont);
     }
     return content;
 }
        protected override void OnPreRender(EventArgs e)
        {
            string sFieldValue = string.Empty;

            ContentPage cp = cu.GetContainerContentPage(this);
            SiteNav navNext = new SiteNav();
            if (NavigationDirection != NavDirection.Unknown) {
                using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
                    if (NavigationDirection == NavDirection.Prev) {
                        navNext = navHelper.GetPrevPost(SiteData.CurrentSiteID, cp.Root_ContentID, !SecurityData.IsAuthEditor);
                    }
                    if (NavigationDirection == NavDirection.Next) {
                        navNext = navHelper.GetNextPost(SiteData.CurrentSiteID, cp.Root_ContentID, !SecurityData.IsAuthEditor);
                    }

                    if (navNext != null) {
                        if (UseDefaultText) {
                            string sField = this.CaptionDataField.ToString();

                            object objData = ReflectionUtilities.GetPropertyValue(navNext, sField);
                            if (objData != null) {
                                sFieldValue = String.Format("{0}", objData);
                            }

                            this.Text = sFieldValue;
                        }

                        this.NavigateUrl = navNext.FileName;
                    } else {
                        this.Visible = false;
                    }
                }
            } else {
                this.Visible = false;
            }

            base.OnPreRender(e);
        }
示例#44
0
 public void OverridePage(SiteNav nav)
 {
     this.CmsPage = PagePayload.GetContent(nav);
     this.ViewData[PagePayload.ViewDataKey] = this.CmsPage;
 }
        protected void LoadData()
        {
            ParentPageNav = GetParentPage();

            if (ShowSecondLevel) {
                lstTwoLevelNav = navHelper.GetTwoLevelNavigation(SiteData.CurrentSiteID, !SecurityData.IsAuthEditor);
            } else {
                lstTwoLevelNav = navHelper.GetTopNavigation(SiteData.CurrentSiteID, !SecurityData.IsAuthEditor);
            }

            lstTwoLevelNav.RemoveAll(x => x.ShowInSiteNav == false);
            lstTwoLevelNav.ToList().ForEach(q => IdentifyLinkAsInactive(q));
        }
示例#46
0
        public SiteNav GetParentPageNavigation(Guid siteID, Guid rootContentID)
        {
            SiteNav nav = GetPageNavigation(siteID, rootContentID);

            return(GetParentPageNavigationByNav(siteID, nav));
        }
        private SiteNav GetParentPageNavigationByNav(Guid siteID, SiteNav navItem)
        {
            if (navItem != null) {
                if (navItem.ContentType == ContentPageType.PageType.BlogEntry) {
                    Guid? parentPageID = SiteData.GetSiteFromCache(siteID).Blog_Root_ContentID;
                    navItem.Parent_ContentID = parentPageID;
                }

                SiteNav content = null;
                if (navItem != null && navItem.Parent_ContentID.HasValue) {
                    content = new SiteNav(CompiledQueries.GetLatestContentByID(db, siteID, false, navItem.Parent_ContentID.Value));
                }

                return content;
            } else {
                return null;
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
                SiteNav navData        = null;
                string  sFileRequested = context.Request.Path;
                sRequestedURL = sFileRequested;
                string sScrubbedURL = sFileRequested;

                sRequestedURL = SiteData.AppendDefaultPath(sRequestedURL);

                try {
                    sScrubbedURL = SiteData.AlternateCurrentScriptName;

                    if (sScrubbedURL.ToLower() != sRequestedURL.ToLower())
                    {
                        sFileRequested = sScrubbedURL;
                        bURLOverride   = true;
                    }

                    VirtualDirectory.RegisterRoutes();
                } catch (Exception ex) {
                    //assumption is database is probably empty / needs updating, so trigger the under construction view
                    if (DatabaseUpdate.SystemNeedsChecking(ex) || DatabaseUpdate.AreCMSTablesIncomplete())
                    {
                        if (navData == null)
                        {
                            navData = SiteNavHelper.GetEmptyHome();
                        }
                    }
                    else
                    {
                        //something bad has gone down, toss back the error
                        throw;
                    }
                }

                sFileRequested = SiteData.AppendDefaultPath(sFileRequested);

                if (context.User.Identity.IsAuthenticated)
                {
                    try {
                        if (context.Request.UrlReferrer != null && !string.IsNullOrEmpty(context.Request.UrlReferrer.AbsolutePath))
                        {
                            if (context.Request.UrlReferrer.AbsolutePath.ToLower().Contains(FormsAuthentication.LoginUrl.ToLower()) ||
                                FormsAuthentication.LoginUrl.ToLower() == sFileRequested.ToLower())
                            {
                                if (SiteFilename.DashboardURL.ToLower() != sFileRequested.ToLower() &&
                                    SiteFilename.SiteInfoURL.ToLower() != sFileRequested.ToLower())
                                {
                                    sFileRequested = SiteData.AdminDefaultFile;
                                }
                            }
                        }
                    } catch (Exception ex) { }
                }

                if (sFileRequested.ToLower().EndsWith(".aspx") || SiteData.IsLikelyHomePage(sFileRequested))
                {
                    bool bIgnorePublishState = SecurityData.AdvancedEditMode || SecurityData.IsAdmin || SecurityData.IsSiteEditor;

                    string queryString = String.Empty;
                    queryString = context.Request.QueryString.ToString();
                    if (string.IsNullOrEmpty(queryString))
                    {
                        queryString = String.Empty;
                    }

                    if (!CMSConfigHelper.CheckRequestedFileExistence(sFileRequested, SiteData.CurrentSiteID) || SiteData.IsLikelyHomePage(sFileRequested))
                    {
                        context.Items[REQ_PATH]  = context.Request.PathInfo;
                        context.Items[REQ_QUERY] = context.Request.QueryString.ToString();

                        // handle a case where this site was migrated from a format where all pages varied on a consistent querystring
                        // allow this QS parm to be set in a config file.
                        if (SiteData.IsLikelyHomePage(sFileRequested))
                        {
                            string sParm = String.Empty;
                            if (SiteData.OldSiteQuerystring != string.Empty)
                            {
                                if (context.Request.QueryString[SiteData.OldSiteQuerystring] != null)
                                {
                                    sParm = context.Request.QueryString[SiteData.OldSiteQuerystring].ToString();
                                }
                            }
                            if (!string.IsNullOrEmpty(sParm))
                            {
                                sFileRequested = "/" + sParm + ".aspx";

                                SiteData.Show301Message(sFileRequested);

                                context.Response.Redirect(sFileRequested);
                                context.Items[REQ_PATH]  = sFileRequested;
                                context.Items[REQ_QUERY] = String.Empty;
                            }
                        }

                        try {
                            //periodic test of database up-to-dated-ness
                            if (DatabaseUpdate.TablesIncomplete)
                            {
                                navData = SiteNavHelper.GetEmptyHome();
                            }
                            else
                            {
                                bool bIsHomePage = false;

                                if (SiteData.IsLikelyHomePage(sFileRequested))
                                {
                                    navData = navHelper.FindHome(SiteData.CurrentSiteID, !bIgnorePublishState);

                                    if (SiteData.IsLikelyHomePage(sFileRequested) && navData != null)
                                    {
                                        sFileRequested = navData.FileName;
                                        bIsHomePage    = true;
                                    }
                                }

                                if (!bIsHomePage)
                                {
                                    string pageName = sFileRequested;
                                    navData = navHelper.GetLatestVersion(SiteData.CurrentSiteID, !bIgnorePublishState, pageName);
                                }

                                if (SiteData.IsLikelyHomePage(sFileRequested) && navData == null)
                                {
                                    navData = SiteNavHelper.GetEmptyHome();
                                }
                            }
                        } catch (Exception ex) {
                            //assumption is database is probably empty / needs updating, so trigger the under construction view
                            if (DatabaseUpdate.SystemNeedsChecking(ex) || DatabaseUpdate.AreCMSTablesIncomplete())
                            {
                                if (navData == null)
                                {
                                    navData = SiteNavHelper.GetEmptyHome();
                                }
                            }
                            else
                            {
                                //something bad has gone down, toss back the error
                                throw;
                            }
                        }

                        if (navData != null)
                        {
                            string sSelectedTemplate = navData.TemplateFile;

                            // selectivly engage the cms helper only if in advance mode
                            if (SecurityData.AdvancedEditMode)
                            {
                                using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                                    if (cmsHelper.cmsAdminContent != null)
                                    {
                                        try { sSelectedTemplate = cmsHelper.cmsAdminContent.TemplateFile.ToLower(); } catch { }
                                    }
                                }
                            }

                            if (!CMSConfigHelper.CheckFileExistence(sSelectedTemplate))
                            {
                                sSelectedTemplate = SiteData.DefaultTemplateFilename;
                            }

                            sVirtualReqFile = sFileRequested;

                            if (bURLOverride)
                            {
                                sVirtualReqFile = sRequestedURL;
                                sFileRequested  = sRequestedURL;
                            }

                            RewriteCMSPath(context, sSelectedTemplate, queryString);
                        }
                        else
                        {
                            SiteData.PerformRedirectToErrorPage(404, sFileRequested);
                            SiteData.Show404MessageFull(true);
                        }
                    }
                    else
                    {
                        sVirtualReqFile = sFileRequested;

                        RewriteCMSPath(context, sVirtualReqFile, queryString);
                    }
                }

                context.ApplicationInstance.CompleteRequest();
            }
        }
示例#49
0
		public bool NavIsCurrentPage(SiteNav nav) {
			return this.ThePage.Root_ContentID == nav.Root_ContentID;
		}
        private List<SiteNav> GetPageCrumbNavByContent(vw_carrot_Content content, bool bActiveOnly)
        {
            Guid siteID = Guid.Empty;
            Guid rootContentID = Guid.Empty;
            Guid? parentContentID = null;
            int iOrder = 1000000;

            List<SiteNav> lstContent = new List<SiteNav>();

            if (content != null) {
                rootContentID = content.Root_ContentID;
                siteID = content.SiteID;
                parentContentID = content.Parent_ContentID;
                SiteNav sn = new SiteNav(content);
                sn.NavOrder = iOrder + 100;
                lstContent.Add(sn);
            }

            if (rootContentID != Guid.Empty) {
                Guid? gLast = parentContentID;

                while (gLast.HasValue) {
                    SiteNav nav = GetPageNavigation(siteID, gLast.Value, false);
                    gLast = null;

                    if (nav != null) {
                        nav.NavOrder = iOrder;
                        lstContent.Add(nav);
                        iOrder--;

                        gLast = nav.Parent_ContentID;
                    }
                }
            }

            SiteNav home = FindHome(siteID, false);
            home.NavOrder = 0;

            if (lstContent.Where(x => x.Root_ContentID == home.Root_ContentID).Count() < 1) {
                lstContent.Add(home);
            }

            return lstContent.OrderBy(x => x.NavOrder).Where(x => x.PageActive == true && x.IsRetired == false && x.IsUnReleased == false || bActiveOnly == false).ToList();
        }
		public SiteNav GetPageNavigation(Guid siteID, string sPage) {
			SiteNav content = null;
			vw_carrot_Content cont = CompiledQueries.GetLatestContentByURL(db, siteID, false, sPage);
			if (cont != null) {
				content = new SiteNav(cont);
			}
			return content;
		}
示例#52
0
 public string ConstructedCanonicalURL(SiteNav nav)
 {
     return(RemoveDupeSlashesURL(this.MainCanonicalURL + nav.FileName));
 }
 private SiteNav GetPageNavigation(Guid siteID, Guid rootContentID, bool bActiveOnly)
 {
     SiteNav content = null;
     vw_carrot_Content cont = CompiledQueries.GetLatestContentByID(db, siteID, bActiveOnly, rootContentID);
     if (cont != null) {
         content = new SiteNav(cont);
     }
     return content;
 }