protected void LoadMasterPageInfo() { if (SiteData.IsWebView) { if (Master.ThePage != null) { theSite = Master.TheSite; pageContents = Master.ThePage; pageWidgets = Master.ThePageWidgets; } else { if (pageContents == null) { theSite = SiteData.CurrentSite; pageContents = SiteData.GetCurrentPage(); if (pageContents != null) { pageWidgets = SiteData.GetCurrentPageWidgets(pageContents.Root_ContentID); } } } } else { theSite = SiteData.CurrentSite; pageContents = SiteData.GetCurrentPage(); pageWidgets = new List <Widget>(); } }
public override string GetHtml() { if (this.ContentPage == null) { this.ContentPage = SiteData.GetCurrentPage(); } this.ImgSrc = this.ContentPage.Thumbnail; this.Title = this.ContentPage.NavMenuText; if (String.IsNullOrEmpty(this.ImgSrc)) { // if page itself has no image, see if the image had been specified directly this.ImgSrc = this.ImageUrl; } if (!String.IsNullOrEmpty(this.ImgSrc)) { if (this.PerformURLResize) { ImageSizer imgSzr = new ImageSizer(); imgSzr.ImageUrl = this.ImgSrc; imgSzr.ThumbSize = this.ThumbSize; imgSzr.ScaleImage = this.ScaleImage; this.ImgSrc = imgSzr.ImageThumbUrl; } } else { this.ImgSrc = String.Empty; } if (!String.IsNullOrEmpty(this.ImgSrc)) { var imgBuilder = new TagBuilder("img"); imgBuilder.MergeAttribute("src", this.ImgSrc); if (!String.IsNullOrEmpty(this.Title)) { imgBuilder.MergeAttribute("alt", this.Title); imgBuilder.MergeAttribute("title", this.Title); } var imgAttribs = (IDictionary <string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(imageAttributes); imgBuilder.MergeAttributes(imgAttribs); return(imgBuilder.ToString(TagRenderMode.SelfClosing)); } else { return(String.Empty); } }
public void LoadData() { theSite = SiteData.CurrentSite; pageContents = null; pageWidgets = new List <Widget>(); pageContents = SiteData.GetCurrentPage(); if (pageContents != null) { guidContentID = pageContents.Root_ContentID; pageWidgets = SiteData.GetCurrentPageWidgets(guidContentID); } }
public override string GetHtml() { string pageUri = string.Empty; SiteData sd = SiteData.CurrentSite; if (sd != null) { pageUri = sd.DefaultCanonicalURL; if (this.ContentPage == null) { this.ContentPage = SiteData.GetCurrentPage(); } if (ContentPage != null) { if (ContentPage.NavOrder == 0) { pageUri = sd.MainCanonicalURL; } else { pageUri = sd.DefaultCanonicalURL; } } } else { pageUri = SiteData.DefaultDirectoryFilename; } string lnk = String.Format("<link rel=\"canonical\" href=\"{0}\" />", pageUri); if (this.Enable301Redirect) { HttpContext ctx = HttpContext.Current; if (!SiteData.CurrentSite.MainCanonicalURL.ToLower().Contains(@"://" + CMSConfigHelper.DomainName.ToLower())) { ctx.Response.Status = "301 Moved Permanently"; ctx.Response.AddHeader("Location", pageUri); } } return(lnk); }
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); } }