protected void Page_Load(object sender, EventArgs e) { Assert.ArgumentNotNullOrEmpty(ItemPaths.SharedMemberships, "Shared club personal membership path missing"); Assert.ArgumentNotNullOrEmpty(ItemPaths.EnquiryForm, "Enquiry form path missing"); //get the details of the club currentClub = SitecoreHelper.GetCurrentClub(Sitecore.Context.Item); SharedLanding = new MembershipLandingItem(Sitecore.Context.Database.GetItem(ItemPaths.SharedMemberships)); enqForm = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.EnquiryForm)); //Databind the sections if (SharedLanding.InnerItem.HasChildren) { List<MembershipStaticPageItem> sections = Context.Products.ListItems.ConvertAll(X => new MembershipStaticPageItem(X)); int counter = 1; sections.ForEach((delegate(MembershipStaticPageItem section) { //section.FormUrl = EnqFormUrl; if (Context.InnerItem.Fields[String.Format("Product {0} price", counter.ToString())] != null) { section.Price = Context.InnerItem.Fields[String.Format("Product {0} price", counter.ToString())].Value; counter++; } })); MemberSectionList.DataSource = sections; MemberSectionList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { Boolean containsChildPages = false; //Check if item is the parent listing item or the child detail item List<Item> childList = currentItem.InnerItem.GetChildren().ToList(); foreach(Item childItem in childList) { List<TemplateItem> baseTemplates = childItem.Template.BaseTemplates.ToList(); foreach (TemplateItem baseTemplate in baseTemplates) { if (baseTemplate.ID.ToString() == PageSummaryItem.TemplateId) { //there are children that inherit from PageSummaryItem containsChildPages = true; } } } if (containsChildPages == true) { //We are on the parent listing page DataBindSecondaryNav(currentItem); } else { //We are on the detail page //Get the parent listing page PageSummaryItem landingPage = new PageSummaryItem(currentItem.InnerItem.Parent); DataBindSecondaryNav(landingPage); } }
protected void Page_Load(object sender, EventArgs e) { try { PageSummaryItem currentItem = new PageSummaryItem(Sitecore.Context.Item); Header = new HeaderItem(Sitecore.Context.Database.GetItem(ItemPaths.Header)); Item[] ancestors = currentItem.InnerItem.Axes.SelectItems("./ancestor-or-self::*"); //Set active flag if current page is in facilities and classes if (ancestors != null) { List<Item> contextAncestorsOrSelf = ancestors.ToList(); Item memberSection = member.InnerItem; if (SitecoreHelper.ListContainsItem(contextAncestorsOrSelf, memberSection)) { ActiveFlag = " active"; } } } catch (Exception ex) { Log.Error(String.Format("Error printing your health Nav: {0}" + ex.Message), this); mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex); } }
protected void Page_Load(object sender, EventArgs e) { try { Item[] ancestorsWithHeading = contextTitle.InnerItem.Axes.SelectItems("ancestor-or-self::*[@IsHeading = '1' ]"); if (ancestorsWithHeading != null) { contextTitle = new PageSummaryItem(ancestorsWithHeading[0]); } if (!string.IsNullOrEmpty(WebUtil.GetQueryString("title"))) { layoutHeader.Text = WebUtil.GetQueryString("title"); } else { layoutHeader.Text = contextTitle.NavigationTitle.Rendered; } } catch (Exception ex) { Log.Error(String.Format("Error retriving a valid page title: {0}", ex.Message), this); mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex); } if (Sitecore.Context.PageMode.IsPageEditorEditing) { PageEditorControls.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { Item articleList = article.InnerItem.Axes.SelectSingleItem(String.Format("ancestor::*[@@tid='{0}']", PressLandingItem.TemplateId)); if (articleList != null) { articleListingUrl = new PageSummaryItem(articleList).Url; } }
protected void ClubList_OnItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem dataItem = (ListViewDataItem)e.Item; var club = dataItem.DataItem as Club; var ltrClubLink = e.Item.FindControl("ltrClubLink") as System.Web.UI.WebControls.Literal; string ClubLinkUrl = new PageSummaryItem(club.ClubItm.InnerItem).Url; //if (club.ClubItm.IsPlaceholder.Checked == true) //{ // Item campaign; // if (club.ClubItm.PlaceholderCampaign.Item.TemplateID.ToString() == ClubMicrositeLandingItem.TemplateId) // { // campaign = // club.ClubItm.PlaceholderCampaign.Item.Axes.SelectSingleItem( // String.Format("*[@@tid='{0}']", MicrositeHomeItem.TemplateId)); // } // else // { // //redirect to campaign // campaign = club.ClubItm.PlaceholderCampaign.Item; // } // if (campaign != null) // { // UrlOptions opt = new UrlOptions(); // opt.AddAspxExtension = false; // opt.LanguageEmbedding = LanguageEmbedding.Never; // opt.AlwaysIncludeServerUrl = true; // ClubLinkUrl = LinkManager.GetItemUrl(campaign, opt); // } //} string ClubName = club.ClubItm.Clubname.Raw; if(club.IsClassic == true) { ClubName += String.Format(@" <span class=""small-font"">({0} {1})</span>", Translate.Text("by"), Translate.Text("VIRGIN ACTIVE CLASSIC")); } else if(club.ClubCentric == true) { ClubName += String.Format(@" <span class=""small-font"">({0})</span>", Translate.Text("previously ESPORTA")); } ltrClubLink.Text = @"<a href=""" + ClubLinkUrl + @""">" + ClubName + @"</a>"; } }
protected void Page_Load(object sender, EventArgs e) { if (PromoListing.InnerItem != null) { Assert.ArgumentNotNullOrEmpty(ItemPaths.EnquiryForm, "Enquiry form path missing"); enqForm = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.EnquiryForm)); List<MemberPromotionItem> promos = PromoListing.InnerItem.Children.ToList().ConvertAll(X => new MemberPromotionItem(X)); promos.First().IsFirst = true; OfferList.DataSource = promos; OfferList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { Item currentItem = Sitecore.Context.Item; PageSummaryItem item = new PageSummaryItem(currentItem); string canonicalTag = item.GetCanonicalTag(); string metaDescription = item.GetMetaDescription(); //Add page title //todo: add club name string title = Translate.Text("Virgin Active"); string browserPageTitle = item.GetPageTitle(); string section = Sitecore.Web.WebUtil.GetQueryString("section"); if (!String.IsNullOrEmpty(section)) { PageSummaryItem listing = null; if (currentItem.TemplateID.ToString() == ClassesListingItem.TemplateId) { //Get classes listing browser page title listing = Sitecore.Context.Database.GetItem(ItemPaths.SharedClasses + "/" + section); } else if (currentItem.TemplateID.ToString() == FacilitiesListingItem.TemplateId) { //Get facility listing browser page title listing = Sitecore.Context.Database.GetItem(ItemPaths.SharedFacilities + "/" + section); } if (listing != null) { browserPageTitle = listing.GetPageTitle(); canonicalTag = String.IsNullOrEmpty(Request.QueryString["section"]) ? listing.GetCanonicalTag() : listing.GetCanonicalTag(Request.QueryString["section"]); metaDescription = listing.GetMetaDescription(); } } if (!String.IsNullOrEmpty(browserPageTitle)) { title = String.Format("{0} | {1}", browserPageTitle, title); } Page.Title = title; //Add canonical Page.Header.Controls.Add(new Literal() { Text = canonicalTag }); //Add meta description Page.Header.Controls.Add(new Literal() { Text = metaDescription }); }
private void LoadImagePanels(Item panelRoot, string rootUrl) { if (panelRoot.HasChildren) { foreach (Item panelParent in panelRoot.GetChildren()) { PageSummaryItem current = new PageSummaryItem(panelParent); if (!current.Hidefrommenu.Checked) { ImagePanel panel = this.Page.LoadControl("~/layouts/virginactive/navigation/ImagePanel.ascx") as ImagePanel; panel.ContextItem = current; panel.RootUrl = rootUrl; //Set a root URL because we want to generate jump links and section QS value phPanels.Controls.Add(panel); } } } }
protected void Page_Load(object sender, EventArgs e) { Item panelRoot = Sitecore.Context.Item; if (panelRoot.HasChildren) { foreach (Item childPanel in panelRoot.GetChildren()) { PageSummaryItem itm = new PageSummaryItem(childPanel); if (!itm.Hidefrommenu.Checked) { ImagePanel panel = this.Page.LoadControl("~/layouts/virginactive/navigation/ImagePanel.ascx") as ImagePanel; panel.ContextItem = itm; phPanels.Controls.Add(panel); } } } }
protected void Page_Load(object sender, EventArgs e) { Sitecore.Links.UrlOptions urlOptions = new Sitecore.Links.UrlOptions(); urlOptions.AlwaysIncludeServerUrl = true; urlOptions.AddAspxExtension = true; urlOptions.LanguageEmbedding = LanguageEmbedding.Never; privacyPolicyUrl = SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.PrivacyPolicy); termsConditionsUrl = new PageSummaryItem(campaign.CampaignBase.Termsandconditionslink.Item).QualifiedUrl; findYourClubUrl = SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.ClubFinder); var homeItem = Sitecore.Context.Database.GetItem(Sitecore.Context.Site.StartPath.ToString()); homePageUrl = Sitecore.Links.LinkManager.GetItemUrl(homeItem, urlOptions); //add the item specific css stylesheet //string classNames = article.Attributes["class"]; //article.Attributes.Add("class", classNames.Length > 0 ? classNames + " campaign-" + campaign.CampaignBase.Cssstyle.Raw : "campaign-" + campaign.CampaignBase.Cssstyle.Raw); //Add dynamic content to header HtmlHead head = (HtmlHead)Page.Header; //Add Open Tag if (Session["sess_User"] != null) { User objUser = (User)Session["sess_User"]; if (objUser.Preferences != null) { if (objUser.Preferences.MarketingCookies && objUser.Preferences.MetricsCookies) { head.Controls.Add(new LiteralControl(OpenTagHelper.OpenTagVirginActiveUK)); } } } //Add Page Title System.Text.StringBuilder markupBuilder = new System.Text.StringBuilder(); markupBuilder.Append(@"<meta name='viewport' content='width=1020'>"); markupBuilder.Append(@"<link rel='apple-touch-icon' href='/virginactive/images/apple-touch-icon.png'>"); markupBuilder.Append(@"<link rel='shortcut icon' href='/virginactive/images/favicon.ico'>"); markupBuilder.Append(@"<link href='/virginactive/css/fonts.css' rel='stylesheet'>"); markupBuilder.Append(@"<link href='/va_campaigns/css/campaign.css' rel='stylesheet'>"); head.Controls.Add(new LiteralControl(markupBuilder.ToString())); }
protected void Page_Load(object sender, EventArgs e) { //Get Club Finder Details membershipUrl = SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.MembershipOptions); Assert.ArgumentNotNullOrEmpty(ItemPaths.MembershipOptions, "member option path null or empty"); Assert.ArgumentNotNullOrEmpty(ItemPaths.MembershipReciprocal, "Membership path null or empty"); MemberOptions.Path = ItemPaths.MembershipOptions; //Set Header type param if available string rawParameters = Attributes["sc_parameters"]; NameValueCollection parameters = Sitecore.Web.WebUtil.ParseUrlParameters(rawParameters); if (!String.IsNullOrEmpty(parameters["HeaderIsH2"])) { HeaderIsH2 = Convert.ToBoolean(parameters["HeaderIsH2"]); } memberBenifits = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.MemberBenefits)); memberReciprocal = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.MembershipReciprocal)); }
protected void clubList_OnItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem dataItem = (ListViewDataItem)e.Item; var club = dataItem.DataItem as ClubItem; if (club != null) { //Get club Urls var ltrClubLink = e.Item.FindControl("ltrClubLink") as System.Web.UI.WebControls.Literal; string ClubLinkUrl = new PageSummaryItem(club.InnerItem).Url; ltrClubLink.Text = @"<li><a href=""" + ClubLinkUrl + @"""><span class=""arrow"">" + HtmlRemoval.StripTagsCharArray(club.Clubname.Text) + @"</span></a></li>"; } } }
protected void Page_Load(object sender, EventArgs e) { Assert.ArgumentNotNullOrEmpty(ItemPaths.HomePage, "home is not correct in ItemPaths"); Assert.ArgumentNotNullOrEmpty(ItemPaths.ClubFinder, "Club finder is not correct in ItemPaths"); Assert.ArgumentNotNullOrEmpty(ItemPaths.EnquiryForm, "Enq form not correct in ItemPaths"); try { //Set misc pages MemberEnq = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.EnquiryForm)); Home = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.HomePage)); ClubFinder = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.ClubFinder)); Contact = new PageSummaryItem(Home.InnerItem.Axes.SelectSingleItem(String.Format("child::*[@@tid='{0}']", ContactFormItem.TemplateId))); } catch (Exception ex) { Log.Error(String.Format("Issues encountered when building sitemap: {0}", ex.Message), this); mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Item landingItem = Sitecore.Context.Item.Axes.SelectSingleItem(String.Format("ancestor-or-self::*[@@tid='{0}']", ClubMicrositeLandingItem.TemplateId)); if (landingItem == null) { return; } Item homeItem = landingItem.Axes.SelectSingleItem(String.Format("*[@@tid='{0}']", MicrositeHomeItem.TemplateId)); if (homeItem == null) { return; } List<PageSummaryItem> items = new List<PageSummaryItem>(); items.Add(new PageSummaryItem(homeItem)); items.AddRange( homeItem.Children.ToList().ConvertAll(x => new PageSummaryItem(x)).Where( x => x.Hidefrommenu.Checked == false && !String.IsNullOrEmpty(x.NavigationTitle.Raw))); NavigationListView.DataSource = items; NavigationListView.DataBind(); micrositeUrl = new PageSummaryItem(homeItem).Url; ClubMicrositeLandingItem club = new ClubMicrositeLandingItem(landingItem); micrositeLogo = club.Logo.MediaUrl; micrositeHeading = club.Hiddentitle.Rendered; } }
protected void Page_Load(object sender, EventArgs e) { Assert.ArgumentNotNullOrEmpty(ItemPaths.EnquiryForm, "Enquiry form path missing"); //Assert.ArgumentNotNullOrEmpty(ItemPaths.ClubVFacilityId, "ClubV facility Id missing"); Assert.ArgumentNotNullOrEmpty(ItemPaths.KidsFacilityListing, "ClubV facility Id missing"); //Get child kid facilities from the Kids Facility Listings Item listing = Sitecore.Context.Database.GetItem(ItemPaths.KidsFacilityListing); string kidFacilities = ""; foreach (Item kidsFacility in listing.Children) { kidFacilities = kidFacilities + kidsFacility.ID.ToString() + "|"; } kidFacilities = kidFacilities.Length > 0 ? kidFacilities.Remove(kidFacilities.Length - 1) : ""; enqForm = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.EnquiryForm)); /* Format the overlay links */ MoreLink = String.Format(MoreLink, Translate.Text("Kids facilities in your club"), "/feedback?page=kids", Translate.Text("To find what's available near you, please tell us your nearest club"), //ItemPaths.ClubVFacilityId, kidFacilities, Translate.Text("Find out more") ); MoreBtnLink = String.Format(MoreBtnLink, Translate.Text("Kids facilities in your club"), "/feedback?page=kids", Translate.Text("To find what's available near you, please tell us your nearest club"), //ItemPaths.ClubVFacilityId, kidFacilities, Translate.Text("Find out more") ); HeroSectionPlaceholder.Visible = ClubV.ShowHeroSection.Checked; }
private StringBuilder GetSectionHtml(PageSummaryItem section, PageSummaryItem landing) { StringBuilder sb = new StringBuilder(); try { sb.AppendFormat(@"<h4><a href=""{0}?section={2}"">{1}</a></h4>", landing.Url, section.NavigationTitle.Text, section.Name.ToLower()); List<PageSummaryItem> childItems = section.InnerItem.Children.ToList().ConvertAll(x => new PageSummaryItem(x)); StringBuilder children = new StringBuilder(); foreach (PageSummaryItem child in childItems) { children.AppendFormat(@"<li><a href=""{0}?section={2}#{3}"">{1}</a></li>", landing.Url, child.NavigationTitle.Text, section.Name.ToLower(), child.Name.ToLower()); } sb.AppendFormat(@"<ul>{0}</ul>", children.ToString()); } catch (Exception ex) { Log.Error(String.Format("Error printing Facilities and classes Nav: {0}" + ex.Message), this); mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex); } return sb; }
protected void Page_Load(object sender, EventArgs e) { //THIS IS WHERE WE HIDE/SHOW COOKIE MESSAGE -N.B. User Session initialised and set in Header //Interorgate the request 'Do Not Track' settings. HttpContext objContext = HttpContext.Current; bool headerDoNotTrack = false; if (!string.IsNullOrEmpty(objContext.Request.Headers["DNT"])) { headerDoNotTrack = objContext.Request.Headers["DNT"] == "1" ? true : false; } User objUser = new User(); //READ/SET COOKIE OPTIONS if (Session["sess_User"] == null) { newSession = true; } else { objUser = (User)Session["sess_User"]; } //If this has not been set -we need to show the cookie message if (!headerDoNotTrack) { //Check if User Session object has been set -i.e. not first page load if (!newSession) { //Have the cookie preferences been set? if (objUser.Preferences == null) { //Show Cookie Preferences ribbon CookieRibbon cookieDeclaration = Page.LoadControl("~/layouts/virginactive/CookieRibbon.ascx") as CookieRibbon; RibbonPh.Controls.Add(cookieDeclaration); string classNames = BodyTag.Attributes["class"] != null ? BodyTag.Attributes["class"] : ""; BodyTag.Attributes.Add("class", classNames.Length > 0 ? classNames + " cookie-show" : "cookie-show"); } } else { //Seesion info not set (as it's a new session) -Check the 'Cookie Preferences Cookie' exists if (string.IsNullOrEmpty(CookieHelper.GetOptInCookieValue(CookieKeyNames.MarketingCookies))) { //User has NOT stored settings //Show Cookie Preferences ribbon CookieRibbon cookieDeclaration = Page.LoadControl("~/layouts/virginactive/CookieRibbon.ascx") as CookieRibbon; RibbonPh.Controls.Add(cookieDeclaration); string classNames = BodyTag.Attributes["class"] != null ? BodyTag.Attributes["class"] : ""; BodyTag.Attributes.Add("class", classNames.Length > 0 ? classNames + " cookie-show" : "cookie-show"); } } } //READ/SET COOKIE OPTIONS if (newSession) { //New Session //Check if cookie preferences session cookie exists if (!string.IsNullOrEmpty(CookieHelper.GetOptInCookieValue(CookieKeyNames.MarketingCookies))) { Preferences preferences = new Preferences(); preferences.MarketingCookies = CookieHelper.GetOptInCookieValue(CookieKeyNames.MarketingCookies) == "Y" ? true : false; preferences.MetricsCookies = CookieHelper.GetOptInCookieValue(CookieKeyNames.MetricsCookies) == "Y" ? true : false; preferences.PersonalisedCookies = CookieHelper.GetOptInCookieValue(CookieKeyNames.PersonalisedCookies) == "Y" ? true : false; preferences.SocialCookies = CookieHelper.GetOptInCookieValue(CookieKeyNames.SocialCookies) == "Y" ? true : false; //Store to session objUser.Preferences = preferences; } else { if (headerDoNotTrack) { //Set Preferences in User Session -default to N Preferences preferences = new Preferences(); preferences.MarketingCookies = false; preferences.MetricsCookies = false; preferences.PersonalisedCookies = false; preferences.SocialCookies = false; objUser.Preferences = preferences; //Set Cookie Preferences Cookie CookieHelper.AddUpdateOptInCookie(CookieKeyNames.MarketingCookies, "N"); CookieHelper.AddUpdateOptInCookie(CookieKeyNames.MetricsCookies, "N"); CookieHelper.AddUpdateOptInCookie(CookieKeyNames.PersonalisedCookies, "N"); CookieHelper.AddUpdateOptInCookie(CookieKeyNames.SocialCookies, "N"); //Delete Existing Personalisation Cookie CookieHelper.DeleteCookie(); } } } //DEFAULT PREFERENCES IF NOT SET if (objUser.Preferences == null) { //Set preferences in User Session -default to Y Preferences preferences = new Preferences(); preferences.MarketingCookies = true; preferences.MetricsCookies = true; preferences.PersonalisedCookies = true; preferences.SocialCookies = true; //Store to session objUser.Preferences = preferences; //Set Cookie Preferences Cookie -default to permission allowed CookieHelper.AddUpdateOptInCookie(CookieKeyNames.MarketingCookies, "Y"); CookieHelper.AddUpdateOptInCookie(CookieKeyNames.MetricsCookies, "Y"); CookieHelper.AddUpdateOptInCookie(CookieKeyNames.PersonalisedCookies, "Y"); CookieHelper.AddUpdateOptInCookie(CookieKeyNames.SocialCookies, "Y"); } //Save session Session["sess_User"] = objUser; CampaignItem cmp = new CampaignItem(Sitecore.Context.Item); if (!String.IsNullOrEmpty(cmp.CampaignBase.Termsandconditionslink.Raw)) { privacy = new PageSummaryItem(cmp.CampaignBase.Termsandconditionslink.Item); } Item currentItem = Sitecore.Context.Item; PageSummaryItem item = new PageSummaryItem(currentItem); string canonicalTag = item.GetCanonicalTag(); string metaDescription = item.GetMetaDescription(); //Add page title //todo: add club name string title = Translate.Text("Virgin Active"); string browserPageTitle = item.GetPageTitle(); string section = Sitecore.Web.WebUtil.GetQueryString("section"); if (!String.IsNullOrEmpty(section)) { PageSummaryItem listing = null; if (currentItem.TemplateID.ToString() == ClassesListingItem.TemplateId) { //Get classes listing browser page title listing = Sitecore.Context.Database.GetItem(ItemPaths.SharedClasses + "/" + section); } else if (currentItem.TemplateID.ToString() == FacilitiesListingItem.TemplateId) { //Get facility listing browser page title listing = Sitecore.Context.Database.GetItem(ItemPaths.SharedFacilities + "/" + section); } if (listing != null) { browserPageTitle = listing.GetPageTitle(); canonicalTag = String.IsNullOrEmpty(Request.QueryString["section"]) ? listing.GetCanonicalTag() : listing.GetCanonicalTag(Request.QueryString["section"]); metaDescription = listing.GetMetaDescription(); } } if (!String.IsNullOrEmpty(browserPageTitle)) { title = String.Format("{0} | {1}", browserPageTitle, title); } Page.Title = title; //Add canonical Page.Header.Controls.Add(new Literal() { Text = canonicalTag }); //Add meta description Page.Header.Controls.Add(new Literal() { Text = metaDescription }); //Load OpenTag container -depending on cookie preferences if (!newSession) { //Add dynamic content to header HtmlHead head = (HtmlHead)Page.Header; if (objUser.Preferences != null) { if (objUser.Preferences.MarketingCookies && objUser.Preferences.MetricsCookies) { //Have permission to load in OpenTag head.Controls.Add(new LiteralControl(OpenTagHelper.OpenTagVirginActiveUK)); } } //LOAD IN SOCIAL OPEN GRAPH -if cookie preference allows } //Get club details if (!Page.IsPostBack) { Item landingItem = Sitecore.Context.Item.Axes.SelectSingleItem(String.Format("ancestor-or-self::*[@@tid='{0}']", ClubMicrositeLandingItem.TemplateId)); if (landingItem == null) { return; } ClubMicrositeLandingItem club = new ClubMicrositeLandingItem(landingItem); ClubItem linkClub = new ClubItem(club.Club.Item); } }
protected void Page_Load(object sender, EventArgs e) { enqForm = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.EnquiryForm)); }
protected void Page_Load(object sender, EventArgs e) { section = Sitecore.Web.WebUtil.GetQueryString("section"); Item[] firstList = currentItem.InnerItem.Axes.SelectItems(String.Format(@"ancestor-or-self::*[@@tid=""{0}"" or @@tid=""{1}""]/child::*", ClassicClubItem.TemplateId, LifeCentreItem.TemplateId)); if (firstList != null) { List<Item> firstLevelList = firstList.ToList(); List<Item> contextAncestorsOrSelf = currentItem.InnerItem.Axes.SelectItems("./ancestor-or-self::*").ToList(); List<PageSummaryItem> firstLevel = firstLevelList.ConvertAll(x => new PageSummaryItem(x)); firstLevel.RemoveAll(x => x.Hidefrommenu.Checked); firstLevel.Last().IsLast = true; //need to figure out the 'active' first level item (the one to highlight) //This can then also be used to build to second level foreach (PageSummaryItem item in firstLevel) { if (SitecoreHelper.ListContainsItem(contextAncestorsOrSelf, item.InnerItem)) { item.IsCurrent = true; currentfirstLevelItem = item; break; } } //Bind the first level items TopElements.DataSource = firstLevel; TopElements.DataBind(); } if (currentfirstLevelItem != null && (currentfirstLevelItem.InnerItem.TemplateID.ToString() != ItemPaths.BlogTemplateId) && (currentfirstLevelItem.InnerItem.TemplateID.ToString() != TimetableDownloadItem.TemplateId) && (currentfirstLevelItem.InnerItem.TemplateID.ToString() != FeedbackItem.TemplateId) ) { //Do not build the second level for blog section. if (currentfirstLevelItem.InnerItem.HasChildren) { bool notBound = true; if (currentfirstLevelItem.InnerItem.TemplateID.ToString() == HealthAndBeautyLandingItem.TemplateId) { //Get treatment listing details ClubHealthAndBeautyListingItem listing = new ClubHealthAndBeautyListingItem(Sitecore.Context.Item); //Get the facility modules that are to be shown on listing page List<TreatmentModuleItem> treatmentModules = listing.Sharedtreatments.ListItems.ToList().ConvertAll(X => new TreatmentModuleItem(X)); HealthAndBeautyLandingItem currentBrand = null; HealthAndBeautyListingItem currentListing = null; List<HealthAndBeautyListingItem> sharedListings = new List<HealthAndBeautyListingItem>(); List<HealthAndBeautyListingItem> clubListings = new List<HealthAndBeautyListingItem>(); List<HealthAndBeautyListingItem> clubListingsAvailable = new List<HealthAndBeautyListingItem>(); foreach (TreatmentModuleItem module in treatmentModules) { //if first item load the shared content if (currentBrand == null) { //find which brand the treatment belongs to Item brand = module.InnerItem.Axes.SelectSingleItem(String.Format(@"ancestor-or-self::*[@@tid=""{0}""]", HealthAndBeautyLandingItem.TemplateId)); if (brand != null) { currentBrand = new HealthAndBeautyLandingItem(brand); sharedListings = currentBrand.InnerItem.Axes.SelectItems(String.Format("descendant-or-self::*[@@tid = '{0}']", HealthAndBeautyListingItem.TemplateId)).ToList().ConvertAll(x => new HealthAndBeautyListingItem(x)); } } //check current listing currentListing = new HealthAndBeautyListingItem(module.InnerItem.Axes.SelectSingleItem(String.Format(@"ancestor-or-self::*[@@tid=""{0}""]", HealthAndBeautyListingItem.TemplateId))); if(currentListing != null) { //Add listing to the listings available collection bool blnExist = false; //Check if it exists already foreach (HealthAndBeautyListingItem existingClubListings in clubListingsAvailable) { if(existingClubListings.ID.ToString() == currentListing.ID.ToString()) { blnExist = true; break; } } if(blnExist == false) { //Check that it exists as a listing under the shared brand foreach (HealthAndBeautyListingItem sharedList in sharedListings) { if (sharedList.ID.ToString() == currentListing.ID.ToString()) { clubListingsAvailable.Add(currentListing); } } } } } if (clubListingsAvailable.Count > 1) { HealthAndBeautySecondaryNav(clubListingsAvailable, new PageSummaryItem(currentfirstLevelItem.InnerItem.Children[0]).Url); } notBound = false; } if (notBound) { DataBindSecondaryNav(currentfirstLevelItem.InnerItem, ""); } } } }
private void SetPage() { //Check Session if (Session["sess_User_landing"] == null) { newSession = true; } //THIS IS WHERE WE HIDE/SHOW COOKIE MESSAGE -N.B. User Session initialised and set in Header //Interorgate the request 'Do Not Track' settings. HttpContext objContext = HttpContext.Current; bool headerDoNotTrack = false; if (!string.IsNullOrEmpty(objContext.Request.Headers["DNT"])) { headerDoNotTrack = objContext.Request.Headers["DNT"] == "1" ? true : false; } //If this has not been set -we need to show the cookie message if (!headerDoNotTrack) { //Check if User Session object has been set -i.e. not first page load if (!newSession) { User objUser = new User(); objUser = (User)Session["sess_User_landing"]; //Have the cookie preferences been set? if (objUser.Preferences == null) { //Show Cookie Preferences ribbon CookieRibbon cookieDeclaration = Page.LoadControl("~/layouts/virginactive/CookieRibbon.ascx") as CookieRibbon; RibbonPh.Controls.Add(cookieDeclaration); Control HeaderRegion = (Control)Page.FindControl("HeaderRegion"); if (HeaderRegion != null && HeaderRegion.Controls.Count > 0) { Control HeaderControlContainer = HeaderRegion.Controls[0]; if (HeaderControlContainer != null && HeaderControlContainer.Controls.Count > 0) { Control HeaderControl = HeaderControlContainer.Controls[0]; if (HeaderControl != null) { //HtmlGenericControl HeaderContainer = // (HtmlGenericControl)HeaderControl.FindControl("HeaderContainer"); //HtmlGenericControl ShowMorePanel = // (HtmlGenericControl)HeaderControl.FindControl("ShowMore"); string classNames = BodyTag.Attributes["class"] != null ? BodyTag.Attributes["class"] : ""; BodyTag.Attributes.Add("class", classNames.Length > 0 ? classNames + " cookie-show" : "cookie-show"); //ShowMorePanel.Attributes.Add("style", "display:none;"); } } } } } else { //Session info not set (as it's a new session) -Check the 'Cookie Preferences Cookie' exists if (string.IsNullOrEmpty(CookieHelper.GetOptInCookieValue(CookieKeyNames.MarketingCookies))) { //User has NOT stored settings //Show Cookie Preferences ribbon CookieRibbon cookieDeclaration = Page.LoadControl("~/layouts/virginactive/CookieRibbon.ascx") as CookieRibbon; RibbonPh.Controls.Add(cookieDeclaration); string classNames = BodyTag.Attributes["class"] != null ? BodyTag.Attributes["class"] : ""; BodyTag.Attributes.Add("class", classNames.Length > 0 ? classNames + " cookie-show" : "cookie-show"); } } } PageSummaryItem item = new PageSummaryItem(currentItem); string canonicalTag = item.GetCanonicalTag(); string metaDescription = item.GetMetaDescription(); //Add page title //todo: add club name string title = Translate.Text("Virgin Active"); string browserPageTitle = item.GetPageTitle(); if (!String.IsNullOrEmpty(browserPageTitle)) { title = String.Format("{0} | {1}", browserPageTitle, title); } Page.Title = browserPageTitle; //Add canonical Page.Header.Controls.Add(new Literal() { Text = canonicalTag }); //Add meta description Page.Header.Controls.Add(new Literal() { Text = metaDescription }); //Load OpenTag container for all pages (Google needs it) HtmlHead head = (HtmlHead)Page.Header; head.Controls.Add(new LiteralControl(OpenTagHelper.OpenTagVirginActiveUK)); //Add open graph tags (controls info facebook needs) string openGraphDescription = ""; string openGraphImage = ""; string openGraphTitle = title; openGraphDescription = SitecoreHelper.GetSiteSetting("Facebook description"); openGraphImage = SitecoreHelper.GetSiteSetting("Facebook image url"); //Overwrite if we are inheriting from Social Open Graph SocialOpenGraphItem openGraphDetails; var itemTemplate = TemplateManager.GetTemplate(currentItem); if (itemTemplate.InheritsFrom("Social Open Graph")) { openGraphDetails = (SocialOpenGraphItem)currentItem.InnerItem; openGraphTitle = openGraphDetails.Title.Raw != "" ? openGraphDetails.Title.Raw : openGraphTitle; openGraphDescription = openGraphDetails.Description.Raw != "" ? openGraphDetails.Description.Raw : openGraphDescription; openGraphImage = openGraphDetails.ImageUrl.Raw != "" ? openGraphDetails.ImageUrl.Raw : openGraphImage; } Literal openGraphMeta = new Literal(); openGraphMeta.Text = String.Format(metaProperty, "og:title", openGraphTitle); openGraphMeta.Text += String.Format(metaProperty, "og:description", openGraphDescription); openGraphMeta.Text += String.Format(metaProperty, "og:image", openGraphImage); Page.Header.Controls.Add(openGraphMeta); //Add no-follow meta tags if (item.Noindex != null) { if (item.Noindex.Checked) { Page.Header.Controls.Add(new LiteralControl(@"<meta name=""robots"" content=""noindex, follow"" />")); } } }
protected void Page_Load(object sender, EventArgs e) { //CREATE NEW USER SESSION //Check if we are loading home page for the first time User objUser = new User(); //Check Session if (Session["sess_User"] == null) { newSession = true; } else { objUser = (User)Session["sess_User"]; } //READ/SET COOKIE OPTIONS if (newSession) { //New Session //Check gallery preference if (!string.IsNullOrEmpty(CookieHelper.GetCookieValue(CookieKeyNames.ShowGallery))) { //Store to session objUser.ShowGallery = CookieHelper.GetCookieValue(CookieKeyNames.ShowGallery) == "Y" ? true : false; } //Check if cookie preferences session cookie exists if (!string.IsNullOrEmpty(CookieHelper.GetOptInCookieValue(CookieKeyNames.MarketingCookies))) { Preferences preferences = new Preferences(); preferences.MarketingCookies = CookieHelper.GetOptInCookieValue(CookieKeyNames.MarketingCookies) == "Y" ? true : false; preferences.MetricsCookies = CookieHelper.GetOptInCookieValue(CookieKeyNames.MetricsCookies) == "Y" ? true : false; preferences.PersonalisedCookies = CookieHelper.GetOptInCookieValue(CookieKeyNames.PersonalisedCookies) == "Y" ? true : false; preferences.SocialCookies = CookieHelper.GetOptInCookieValue(CookieKeyNames.SocialCookies) == "Y" ? true : false; //Store to session objUser.Preferences = preferences; } else { //Interorgate the request 'Do Not Track' settings. HttpContext objContext = HttpContext.Current; bool headerDoNotTrack = false; if (!string.IsNullOrEmpty(objContext.Request.Headers["DNT"])) { headerDoNotTrack = objContext.Request.Headers["DNT"] == "1" ? true : false; } if (headerDoNotTrack) { //Set Preferences in User Session -default to N Preferences preferences = new Preferences(); preferences.MarketingCookies = false; preferences.MetricsCookies = false; preferences.PersonalisedCookies = false; preferences.SocialCookies = false; objUser.Preferences = preferences; //Set Cookie Preferences Cookie CookieHelper.AddUpdateOptInCookie(CookieKeyNames.MarketingCookies, "N"); CookieHelper.AddUpdateOptInCookie(CookieKeyNames.MetricsCookies, "N"); CookieHelper.AddUpdateOptInCookie(CookieKeyNames.PersonalisedCookies, "N"); CookieHelper.AddUpdateOptInCookie(CookieKeyNames.SocialCookies, "N"); //Delete Existing Personalisation Cookie CookieHelper.DeleteCookie(); } } } //DEFAULT PREFERENCES if (objUser.Preferences == null) { //Set preferences in User Session -default to Y Preferences preferences = new Preferences(); preferences.MarketingCookies = true; preferences.MetricsCookies = true; preferences.PersonalisedCookies = true; preferences.SocialCookies = true; //Store to session objUser.Preferences = preferences; //Set Cookie Preferences Cookie -default to permission allowed CookieHelper.AddUpdateOptInCookie(CookieKeyNames.MarketingCookies, "Y"); CookieHelper.AddUpdateOptInCookie(CookieKeyNames.MetricsCookies, "Y"); CookieHelper.AddUpdateOptInCookie(CookieKeyNames.PersonalisedCookies, "Y"); CookieHelper.AddUpdateOptInCookie(CookieKeyNames.SocialCookies, "Y"); } //SET PAGE META DATA PageSummaryItem item = new PageSummaryItem(currentItem); string canonicalTag = item.GetCanonicalTag(); string metaDescription = item.GetMetaDescription(); //Add page title //todo: add club name string title = Translate.Text("Virgin Active"); string browserPageTitle = item.GetPageTitle(); if (!String.IsNullOrEmpty(browserPageTitle)) { title = String.Format("{0} | {1}", browserPageTitle, title); } Page.Title = title; //Add canonical Page.Header.Controls.Add(new Literal() { Text = canonicalTag }); //Add meta description Page.Header.Controls.Add(new Literal() { Text = metaDescription }); //Load OpenTag container for all pages (Google needs it) HtmlHead head = (HtmlHead)Page.Header; head.Controls.Add(new LiteralControl(OpenTagHelper.OpenTagVirginActiveUK)); //Add open graph tags (controls info facebook needs) string openGraphDescription = ""; string openGraphImage = ""; string openGraphTitle = title; string startPath = Sitecore.Context.Site.StartPath.ToString(); var homeItem = Sitecore.Context.Database.GetItem(startPath); var options = new UrlOptions { AlwaysIncludeServerUrl = true, AddAspxExtension = false, LanguageEmbedding = LanguageEmbedding.Never }; var homeUrl = LinkManager.GetItemUrl(homeItem, options); var mediaOptions = new MediaUrlOptions { AbsolutePath = true }; //Set return to main site link HomeMainSiteUrl = homeUrl + "?sc_device=default&persisted=true"; openGraphDescription = SitecoreHelper.GetSiteSetting("Facebook description"); openGraphImage = SitecoreHelper.GetSiteSetting("Facebook image url"); //Overwrite if we are inheriting from Social Open Graph SocialOpenGraphItem openGraphDetails; var itemTemplate = TemplateManager.GetTemplate(currentItem); if (itemTemplate.InheritsFrom("Social Open Graph")) { openGraphDetails = (SocialOpenGraphItem)currentItem; openGraphTitle = openGraphDetails.Title.Raw != "" ? openGraphDetails.Title.Raw : openGraphTitle; openGraphDescription = openGraphDetails.Description.Raw != "" ? openGraphDetails.Description.Raw : openGraphDescription; openGraphImage = openGraphDetails.ImageUrl.Raw != "" ? openGraphDetails.ImageUrl.Raw : openGraphImage; } Literal openGraphMeta = new Literal(); openGraphMeta.Text = String.Format(metaProperty, "og:title", openGraphTitle); openGraphMeta.Text = openGraphMeta.Text + String.Format(metaProperty, "og:description", openGraphDescription); openGraphMeta.Text = openGraphMeta.Text + String.Format(metaProperty, "og:image", openGraphImage); Page.Header.Controls.Add(openGraphMeta); //SET PAGE LINKS youTubeUrl = Settings.YouTubeLinkUrl; twitterUrl = Settings.TwitterLinkUrl; facebookUrl = Settings.FacebookLinkUrl; privacyUrl = SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.PrivacyPolicy); termsAndConditionsUrl = SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.TermsAndConditions); cookiesUrl = SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.CookiesForm); //Set featured promo link and home page link Sitecore.Links.UrlOptions urlOptions = new Sitecore.Links.UrlOptions(); urlOptions.AlwaysIncludeServerUrl = true; urlOptions.AddAspxExtension = true; urlOptions.LanguageEmbedding = LanguageEmbedding.Never; //Set home page link (set as club home if home club set) homeOrClubPageUrl = Sitecore.Links.LinkManager.GetItemUrl(homeItem, urlOptions); //<h1><a href="/" class="logo"><strong>VIRGIN ACTIVE</strong> HEALTH CLUBS</a></h1> System.Text.StringBuilder markupBuilder = new System.Text.StringBuilder(); if (Sitecore.Context.Item.ID == homeItem.ID) { //Page is home page markupBuilder.Append(@"<h1><a class=""logo"" href="""); markupBuilder.Append(HomeOrClubPageUrl + @"""><strong class=""home"">"); markupBuilder.Append(Translate.Text("VIRGIN ACTIVE") + "</strong> "); markupBuilder.Append(Translate.Text("HEALTH CLUBS") + "</a></h1>"); } else { markupBuilder.Append(@"<a class=""logo"" href="""); markupBuilder.Append(HomeOrClubPageUrl + @"""><strong>"); markupBuilder.Append(Translate.Text("VIRGIN ACTIVE") + "</strong> "); markupBuilder.Append(Translate.Text("HEALTH CLUBS") + "</a>"); } ltrHeaderText.Text = markupBuilder.ToString(); }
protected void ClubList_OnItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem dataItem = (ListViewDataItem)e.Item; var club = dataItem.DataItem as Club; if (club != null) { //Get address var Address = e.Item.FindControl("ltrAddress") as System.Web.UI.WebControls.Literal; if (Address != null) { System.Text.StringBuilder markupBuilder; markupBuilder = new System.Text.StringBuilder(); markupBuilder.Append(club.ClubItm.Addressline1.Text); markupBuilder.Append(!String.IsNullOrEmpty(club.ClubItm.Addressline2.Text) ? "<br />" + club.ClubItm.Addressline2.Text : ""); markupBuilder.Append(!String.IsNullOrEmpty(club.ClubItm.Addressline3.Text) ? "<br />" + club.ClubItm.Addressline3.Text : ""); markupBuilder.Append("<br />"); markupBuilder.Append(!String.IsNullOrEmpty(club.ClubItm.Addressline4.Text) ? club.ClubItm.Addressline4.Text + " " : ""); markupBuilder.Append(club.ClubItm.Postcode.Text); Address.Text = markupBuilder.ToString(); } //Get club Urls var ltrNearestHeader = e.Item.FindControl("ltrNearestHeader") as System.Web.UI.WebControls.Literal; //var ltrClubTitleLink = e.Item.FindControl("ltrClubTitleLink") as System.Web.UI.WebControls.Literal; string ClubLinkUrl = new PageSummaryItem(club.ClubItm.InnerItem).Url; string clubLat = club.ClubItm.Lat.Raw; string clubLng = club.ClubItm.Long.Raw; var ltrDistanceLink = e.Item.FindControl("ltrDistanceLink") as System.Web.UI.WebControls.Literal; System.Text.StringBuilder markupBuilder2; markupBuilder2 = new System.Text.StringBuilder(); markupBuilder2.Append(@"<a href=""https://maps.google.co.uk/?q="); markupBuilder2.Append(clubLat); markupBuilder2.Append("," + clubLng); markupBuilder2.Append(@""">"+ club.DistanceFromSource.ToString() + " "); markupBuilder2.Append(Translate.Text("miles") + "</a>"); ltrDistanceLink.Text = markupBuilder2.ToString(); //ltrClubTitleLink.Text = @"<a href=""" + ClubLinkUrl + @""">" + club.ClubItm.Clubname.Text + @"</a>"; ltrNearestHeader.Text = club.IsNearest ? "<h2>" + Translate.Text("Nearest club") + "</h2>" : ""; } } }
protected void Page_Load(object sender, EventArgs e) { section = Sitecore.Web.WebUtil.GetQueryString("section"); if (currentItem.InnerItem.Axes.SelectItems(String.Format("./ancestor-or-self::*[@@tid='{0}']/child::*", SectionContainerItem.TemplateId)) != null) { List<Item> firstLevelList = currentItem.InnerItem.Axes.SelectItems(String.Format("./ancestor-or-self::*[@@tid='{0}']/child::*", SectionContainerItem.TemplateId)).ToList(); List<Item> contextAncestorsOrSelf = currentItem.InnerItem.Axes.SelectItems("./ancestor-or-self::*").ToList(); List<PageSummaryItem> firstLevel = firstLevelList.ConvertAll(x => new PageSummaryItem(x)); firstLevel.RemoveAll(x => x.Hidefrommenu.Checked); //Remove all hidden items firstLevel.RemoveAll(x => x.InnerItem.TemplateID.ToString() == WidgetContainerItem.TemplateId); //Remove all widget containers if (firstLevel.Count > 0) { firstLevel.Last().IsLast = true; //need to figure out the 'active' first level item (the one to highlight) //This can then also be used to build to second level foreach (PageSummaryItem item in firstLevel) { if (SitecoreHelper.ListContainsItem(contextAncestorsOrSelf, item.InnerItem)) { item.IsCurrent = true; currentfirstLevelItem = item; break; } } //Bind the first level items TopElements.DataSource = firstLevel; TopElements.DataBind(); } } if (currentfirstLevelItem != null && (currentfirstLevelItem.InnerItem.TemplateID.ToString() != ItemPaths.BlogTemplateId)) { //Do not build the second level for blog section. if (currentfirstLevelItem.InnerItem.HasChildren) { bool notBound = true; //Get Facility & class items, different behaviour for these (jump links) if (currentfirstLevelItem.InnerItem.TemplateID.ToString() == FacilitiesLandingItem.TemplateId) { Item sharedFacility = Sitecore.Context.Database.GetItem(ItemPaths.SharedFacilities); DataBindSecondaryNav(sharedFacility, new PageSummaryItem(currentfirstLevelItem.InnerItem.Children[0]).Url); notBound = false; } if (currentfirstLevelItem.InnerItem.TemplateID.ToString() == ClassesLandingItem.TemplateId) { Item shareClass = Sitecore.Context.Database.GetItem(ItemPaths.SharedClasses); DataBindSecondaryNav(shareClass, new PageSummaryItem(currentfirstLevelItem.InnerItem.Children[0]).Url); notBound = false; } if (currentfirstLevelItem.InnerItem.TemplateID.ToString() == HealthAndBeautyLandingItem.TemplateId) { //Secondary Navigation is hidden (child elements are displayed in screen and non navigatable) SecondLevelNavigation.Visible = false; notBound = false; } //Hide for workouts section if (currentfirstLevelItem.InnerItem.TemplateID.ToString() == WorkoutLandingItem.TemplateId) { //Secondary Navigation is hidden (child elements are displayed in screen and non navigatable) SecondLevelNavigation.Visible = false; notBound = false; } //Hide for Indoor modules if (currentfirstLevelItem.InnerItem.TemplateID.ToString() == IndoorGeneralItem.TemplateId || currentfirstLevelItem.InnerItem.TemplateID.ToString() == IndoorClassesItem.TemplateId || currentfirstLevelItem.InnerItem.TemplateID.ToString() == IndoorHistoryItem.TemplateId || currentfirstLevelItem.InnerItem.TemplateID.ToString() == IndoorEventsItem.TemplateId ) { //Secondary Navigation is hidden (child elements are displayed in screen and non navigatable) SecondLevelNavigation.Visible = false; notBound = false; } if (notBound) { DataBindSecondaryNav(currentfirstLevelItem.InnerItem, ""); } } } }
protected void Page_Load(object sender, EventArgs e) { System.Text.StringBuilder markupBuilder = new System.Text.StringBuilder(); //Redirect to club home Sitecore.Links.UrlOptions urlOptions = new Sitecore.Links.UrlOptions(); urlOptions.AlwaysIncludeServerUrl = true; urlOptions.AddAspxExtension = false; urlOptions.LanguageEmbedding = LanguageEmbedding.Never; if(club != null) { //Get opening hours if (club.Openinghours.Rendered.Trim() != "") { //add opening hours details markupBuilder.Append(@"<p class=""openingtimes"">"); markupBuilder.Append(club.Openinghours.Rendered); markupBuilder.Append(@"</p>"); openingHours = markupBuilder.ToString(); } //Get address markupBuilder = new System.Text.StringBuilder(); markupBuilder.Append(club.Addressline1.Text); markupBuilder.Append(!String.IsNullOrEmpty(club.Addressline2.Text) ? "<br />" + club.Addressline2.Text : ""); markupBuilder.Append(!String.IsNullOrEmpty(club.Addressline3.Text) ? "<br />" + club.Addressline3.Text : ""); markupBuilder.Append("<br />"); markupBuilder.Append(!String.IsNullOrEmpty(club.Addressline4.Text) ? club.Addressline4.Text + " " : ""); markupBuilder.Append(club.Postcode.Text); Address.Text = markupBuilder.ToString(); //Get Club details ClubName = club.Clubname.Rendered; lng = club.Long.Raw; lat = club.Lat.Raw; //Get timetable link if (club.InnerItem.Axes.SelectSingleItem(String.Format(@"descendant-or-self::*[@@tid = '{0}']", TimetableItem.TemplateId)) != null) { TimetableItem timetableItem = new TimetableItem(club.InnerItem.Axes.SelectSingleItem(String.Format(@"descendant-or-self::*[@@tid = '{0}']", TimetableItem.TemplateId))); SectionContainerItem timetableSectionItem = new SectionContainerItem(timetableItem.InnerItem.Axes.SelectSingleItem(String.Format(@"..", SectionContainerItem.TemplateId))); ClubTimetableUrl = Sitecore.Links.LinkManager.GetItemUrl(timetableSectionItem); } else { if (club.InnerItem.Axes.SelectSingleItem(String.Format(@"descendant-or-self::*[@@tid = '{0}']", TimetableDownloadItem.TemplateId)) != null) { TimetableDownloadItem timetableDownloadItem = new TimetableDownloadItem(club.InnerItem.Axes.SelectSingleItem(String.Format(@"descendant-or-self::*[@@tid = '{0}']", TimetableDownloadItem.TemplateId))); ClubTimetableUrl = Sitecore.Links.LinkManager.GetItemUrl(timetableDownloadItem); } } //Get enquiries link PageSummaryItem enqForm = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.EnquiryForm)); if(enqForm != null) { ClubEnquiriesUrl = enqForm.Url + "?sc_trk=enq&c=" + club.InnerItem.ID.ToShortID(); } List<MediaItem> imageList; if (!String.IsNullOrEmpty(club.Imagegallery.Raw)) { imageList = club.Imagegallery.ListItems.ConvertAll(X => new MediaItem(X)); ImageList.DataSource = imageList; ImageList.DataBind(); } //Set club last visited User objUser = new User(); if (Session["sess_User"] != null) { objUser = (User)Session["sess_User"]; } objUser.ClubLastVisitedID = club.ClubId.Rendered; Session["sess_User"] = objUser; //Set club last visited cookie CookieHelper.AddClubsLastVisitedCookie(CookieKeyNames.ClubLastVisited, club.ClubId.Rendered); //Add club name to page title string clubNameTitle = String.Format(" - {0}", club.Clubname.Raw); clubNameTitle = HtmlRemoval.StripTagsCharArray(clubNameTitle); Page.Title = Page.Title + clubNameTitle; } }
protected void ClubList_OnItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem dataItem = (ListViewDataItem)e.Item; var club = dataItem.DataItem as Club; var ltrClubImageLink = e.Item.FindControl("ltrClubImageLink") as System.Web.UI.WebControls.Literal; var ltrClubTitleLink = e.Item.FindControl("ltrClubTitleLink") as System.Web.UI.WebControls.Literal; string ClubLinkUrl = new PageSummaryItem(club.ClubItm.InnerItem).Url; //if (club.ClubItm.IsPlaceholder.Checked == true) //{ // Item campaign; // if (club.ClubItm.PlaceholderCampaign.Item.TemplateID.ToString() == ClubMicrositeLandingItem.TemplateId) // { // campaign = // club.ClubItm.PlaceholderCampaign.Item.Axes.SelectSingleItem( // String.Format("*[@@tid='{0}']", MicrositeHomeItem.TemplateId)); // } // else // { // //redirect to campaign // campaign = club.ClubItm.PlaceholderCampaign.Item; // } // if (campaign != null) // { // UrlOptions opt = new UrlOptions(); // opt.AddAspxExtension = false; // opt.LanguageEmbedding = LanguageEmbedding.Never; // opt.AlwaysIncludeServerUrl = true; // ClubLinkUrl = LinkManager.GetItemUrl(campaign, opt); // } //} ltrClubImageLink.Text = @"<a href=""" + ClubLinkUrl + @""">" + club.ClubItm.Clubimage.RenderCrop("180x120") + @"</a>"; ltrClubTitleLink.Text = @"<a href=""" + ClubLinkUrl + @""">" + club.ClubItm.Clubname.Text + @"</a>"; } }
protected void Page_Load(object sender, EventArgs e) { Assert.ArgumentNotNullOrEmpty(ItemPaths.EnquiryForm, "Enquiry form path missing"); enqForm = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.EnquiryForm)); }
protected void Page_Load(object sender, EventArgs e) { try { blogItem = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.YourHealthBlog)); yourHealth = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.YourHealth)); HealthArticles.Path = ItemPaths.YourHealthArticles; HealthTools.Path = ItemPaths.YourHealthTools; /* ************Workouts section removed************** workoutRoot = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.YourHealthWorkouts)); Item categoryList = Sitecore.Context.Database.GetItem(ItemPaths.WorkoutCategories); if (categoryList.HasChildren) { workoutCategories = categoryList.Children.ToList(); WorkoutCategoryList.DataSource = workoutCategories; WorkoutCategoryList.DataBind(); } */ PageSummaryItem currentItem = new PageSummaryItem(Sitecore.Context.Item); Item[] ancestorsOrSelf = currentItem.InnerItem.Axes.SelectItems("./ancestor-or-self::*"); //Set active flag if current page is in facilities and classes if (ancestorsOrSelf != null) { List<Item> contextAncestorsOrSelf = ancestorsOrSelf.ToList(); Item facilitiesAndClassesSection = Sitecore.Context.Database.GetItem(ItemPaths.YourHealth); if (SitecoreHelper.ListContainsItem(contextAncestorsOrSelf, facilitiesAndClassesSection)) { ActiveFlag = " active"; } } if (blogItem != null) { if (blogItem.InnerItem.HasChildren) { List<BlogEntryItem> blogPosts = new List<BlogEntryItem>(); blogPosts = blogItem.InnerItem.Axes.SelectItems(String.Format(@"descendant::*[@@tid=""{0}""]", BlogEntryItem.TemplateId.ToString())).ToList().ConvertAll(X => new BlogEntryItem(X)); blogPosts.Sort((x, y) => y.Created.CompareTo(x.Created)); //We hardcode the list to two latest posts for now if (blogPosts.Count > 5) { blogPosts.RemoveRange(5 - 1, blogPosts.Count - 5); } BlogPostList.DataSource = blogPosts; BlogPostList.DataBind(); } } //Set Header type param if available string rawParameters = Attributes["sc_parameters"]; NameValueCollection parameters = Sitecore.Web.WebUtil.ParseUrlParameters(rawParameters); if (!String.IsNullOrEmpty(parameters["HeaderIsH2"])) { HeaderIsH2 = Convert.ToBoolean(parameters["HeaderIsH2"]); } } catch (Exception ex) { Log.Error(String.Format("Error printing Your Health Nav: {0}", ex.Message), this); mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex); } }
protected void Page_Load(object sender, EventArgs e) { if (FacilityModule != null) { //Retrieve CSS class cssClass = FacilityModule.Abstract.GetPanelCssClass(); if (cssClass == "full-panel") { HeaderIsH2 = true; } //Get context item if (contextItem == null) { contextItem = Sitecore.Context.Item; } System.Text.StringBuilder markupBuilder = new System.Text.StringBuilder(); //check if link through to detail page if (FacilityModule.Isdetailpage.Checked == false) { //no link through -just show heading markupBuilder.Append(HeaderIsH2 ? "<h2>" : "<h3>"); markupBuilder.Append(FacilityModule.PageSummary.NavigationTitle.Text); markupBuilder.Append(HeaderIsH2 ? "</h2>" : "</h3>"); } else { //link heading markupBuilder.Append(@"<a href="""); markupBuilder.Append(String.Format("{0}?facility={1}", contextItem.Url, FacilityModule.Name)); markupBuilder.Append(@""">"); markupBuilder.Append(HeaderIsH2 ? "<h2>" : "<h3>"); markupBuilder.Append(FacilityModule.PageSummary.NavigationTitle.Text); markupBuilder.Append(HeaderIsH2 ? "</h2>" : "</h3>"); markupBuilder.Append(@"</a>"); //additional 'View more' link through to detail page viewDetailsLink.Visible = true; detailLinkURL = String.Format("{0}?facility={1}", contextItem.Url, FacilityModule.Name); } //Configure Layout if (cssClass == "full-panel") { IsFullWidth = true; HeaderIsH2 = true; //use heading position 2 heading2.Text = markupBuilder.ToString(); heading2.Visible = true; } else { //use title position 2 heading1.Text = markupBuilder.ToString(); heading1.Visible = true; } //Retrieve Colour Me Fit ShowColourMeFit = FacilityModule.Showcolourmefit.Checked; if (ShowColourMeFit) { CardioPercentage = Convert.ToString(FacilityModule.Cardiopercentage); StrengthPercentage = Convert.ToString(FacilityModule.Strengthpercentage); BalancePercentage = Convert.ToString(FacilityModule.Balancepercentage); } } }
protected void Page_Load(object sender, EventArgs e) { privacyPolicyUrl = SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.PrivacyPolicy); //termsConditionsUrl = new PageSummaryItem(campaign.CampaignBase.Termsandconditionslink.Item).QualifiedUrl; termsConditionsUrl = SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.TermsAndConditions); londonTriathlonUrl = campaign.CampaignBase.QualifiedUrl; clubFinderUrl = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.ClubFinder)).QualifiedUrl; //add the item specific css stylesheet //Add dynamic content to header HtmlHead head = (HtmlHead)Page.Header; //Add Open Tag if (Session["sess_User"] != null) { User objUser = (User)Session["sess_User"]; if (objUser.Preferences != null) { if (objUser.Preferences.MarketingCookies && objUser.Preferences.MetricsCookies) { head.Controls.Add(new LiteralControl(OpenTagHelper.OpenTagVirginActiveUK)); } } } //Add Page Title //System.Text.StringBuilder markupBuilder = new System.Text.StringBuilder(); //Get blog content to display in page List<Item> itemList = campaign.InnerItem.Children.ToList(); foreach (Item item in itemList) { campaignBlogEntry = (BlogEntryItem)item; break; } //Get blog entry or article entry to link to (show first article only) itemList = campaign.CampaignBase.Blogarticles.ListItems.ToList(); foreach (Item item in itemList) { linkedBlogEntry = (PageSummaryItem)item; break; } //Add Page Title System.Text.StringBuilder markupBuilder = new System.Text.StringBuilder(); //HtmlTitle title = (HtmlTitle)Page.FindControl("title"); //title.Text = "Virgin Active London Triathlon 2012 | The Official Virgin Active Site for Training Programmes, Event Information and More."; //markupBuilder.Append(@"<meta name='description' content='As the title sponsor of this great event for the 2nd year running, we are here to help first timers and old hats alike, every step of the way with training plans, event information and all the encouragement you will need to complete the Virgin Active London Triathlon.'>"); markupBuilder.Append(@"<meta name='viewport' content='width=1020'>"); markupBuilder.Append(@"<link rel='apple-touch-icon' href='/virginactive/images/apple-touch-icon.png'>"); markupBuilder.Append(@"<link rel='shortcut icon' href='/virginactive/images/favicon.ico'>"); markupBuilder.Append(@"<link href='/va_campaigns/Bespoke/LondonTriathlonII/css/styles.css' rel='stylesheet' type='text/css' media='screen' />"); head.Controls.Add(new LiteralControl(markupBuilder.ToString())); Control scriptPh = this.Page.FindControl("ScriptPh"); if (scriptPh != null) { scriptPh.Controls.Add(new LiteralControl(@" <script src='/va_campaigns/Bespoke/LondonTriathlonII/js/plugins.js' type='text/javascript'></script> <script src='/va_campaigns/Bespoke/LondonTriathlonII/js/scripts.js' type='text/javascript'></script> ")); } }