Exemple #1
0
        protected void rptRow_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                Item dataItem = e.Item.DataItem as Item;

                if (dataItem.InheritsTemplate(DefaultArticlePageItem.TemplateId))
                {
                    DefaultArticlePageItem article = (DefaultArticlePageItem)dataItem;

                    System.Web.UI.WebControls.Image imgThumbnail = e.FindControlAs <System.Web.UI.WebControls.Image>("imgThumbnail");
                    HyperLink hypArticleLink = e.FindControlAs <HyperLink>("hypArticleLink");
                    HyperLink hypThumbnail   = e.FindControlAs <HyperLink>("hypThumbnail");

                    if (imgThumbnail != null)
                    {
                        imgThumbnail.ImageUrl = article.GetArticleThumbnailUrl(230, 129);
                    }

                    if (hypArticleLink != null)
                    {
                        hypArticleLink.NavigateUrl = hypThumbnail.NavigateUrl = article.GetUrl();
                        hypArticleLink.Text        = article.ContentPage.PageTitle;
                    }
                }
            }
        }
        protected void rptWelcomeSlider_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                WelcomeTourItem item = e.Item.DataItem as WelcomeTourItem;
                if (item != null)
                {
                    Sitecore.Web.UI.WebControls.Image scBackgroundImage = e.FindControlAs <Sitecore.Web.UI.WebControls.Image>("scBackgroundImage");
                    FieldRenderer frContent  = e.FindControlAs <FieldRenderer>("frContent");
                    Link          scLinkJoin = e.FindControlAs <Link>("scLinkJoin");
                    HyperLink     hlNotNow   = e.FindControlAs <HyperLink>("hlNotNow");

                    if (frContent != null)
                    {
                        frContent.Item = item;
                    }

                    if (scBackgroundImage != null)
                    {
                        scBackgroundImage.Item = item;
                    }

                    if (scLinkJoin != null)
                    {
                        scLinkJoin.Item = item;
                    }

                    if (hlNotNow != null)
                    {
                        hlNotNow.Text = DictionaryConstants.NotNowLabel;
                    }
                }
            }
        }
Exemple #3
0
        protected void rptTopicListItems_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                DefaultArticlePageItem item = (DefaultArticlePageItem)e.Item.DataItem;

                HyperLink hlTopicTitle = e.FindControlAs <HyperLink>("hlTopicTitle");
                hlTopicTitle.NavigateUrl = item.GetUrl();
                hlTopicTitle.Text        = item.ContentPage.PageTitle.Rendered;

                PlaceHolder phThumbnail = e.FindControlAs <PlaceHolder>("phThumbnail");

                var icons = e.FindControlAs <UnderstoodDotOrg.Web.Presentation.Sublayouts.Recommendation.ArticleRecommendationIcons>("ArticleRecommendationIcons");
                if (icons != null)
                {
                    icons.MatchingChildrenIds       = item.GetMatchingChildrenIds(CurrentMember);
                    icons.HasMatchingParentInterest = item.HasMatchingParentInterest(CurrentMember);
                }

                // Handle first image
                if (e.Item.ItemIndex == 0)
                {
                    Image  imgThumbnail = e.FindControlAs <Image>("imgThumbnail");
                    string source       = item.GetArticleFeaturedThumbnailUrl(190, 107);
                    imgThumbnail.ImageUrl = source;
                    phThumbnail.Visible   = !String.IsNullOrEmpty(source);
                }
                else
                {
                    phThumbnail.Visible = false;
                }
            }
        }
Exemple #4
0
        protected void rptRow_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                DefaultArticlePageItem dataItem = (DefaultArticlePageItem)e.Item.DataItem;

                if (dataItem.InnerItem.InheritsTemplate(DefaultArticlePageItem.TemplateId))
                {
                    DefaultArticlePageItem article = (DefaultArticlePageItem)dataItem;

                    System.Web.UI.WebControls.Image imgThumbnail = e.FindControlAs <System.Web.UI.WebControls.Image>("imgThumbnail");
                    HyperLink hypArticleLink = e.FindControlAs <HyperLink>("hypArticleLink");
                    HyperLink hypThumbnail   = e.FindControlAs <HyperLink>("hypThumbnail");
                    ArticleRecommendationIcons articleRecommendationIcons = e.FindControlAs <ArticleRecommendationIcons>("articleRecommendationIcons");

                    if (imgThumbnail != null)
                    {
                        imgThumbnail.ImageUrl = article.GetArticleThumbnailUrl(230, 129);
                    }

                    if (hypArticleLink != null)
                    {
                        hypArticleLink.NavigateUrl = hypThumbnail.NavigateUrl = article.GetUrl();
                        hypArticleLink.Text        = article.ContentPage.PageTitle;
                    }

                    if (IsUserLoggedIn)
                    {
                        articleRecommendationIcons.HasMatchingParentInterest = article.HasMatchingParentInterest(CurrentMember);
                        articleRecommendationIcons.MatchingChildrenIds       = article.GetMatchingChildrenIds(CurrentMember);
                    }
                }
            }
        }
        protected void rptTopicChkbox_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            TopicCheckboxItem TopicItem = e.Item.DataItem as TopicCheckboxItem;

            if (TopicItem != null)
            {
                CheckBox cbTopicItem = e.FindControlAs <CheckBox>("cbTopicItem");
                if (TopicItem.ShowCheckbox.Checked == false)
                {
                    if (cbTopicItem != null)
                    {
                        cbTopicItem.Enabled = false;
                    }
                }

                if (savedQuiz != null)
                {
                    QuizItem temp = savedQuiz.MemberAnswers.Where(i => i.QuestionId == TopicItem.ID.ToGuid()).FirstOrDefault();
                    if (temp != null)
                    {
                        cbTopicItem.Checked = Convert.ToBoolean(temp.AnswerValue);
                    }
                }

                cbTopicItem.Attributes.Add("data-id", TopicItem.ID.ToString());

                FieldRenderer frTopicItem = e.FindControlAs <FieldRenderer>("frTopicItem");
                if (frTopicItem != null)
                {
                    frTopicItem.Item = TopicItem;
                }
            }
        }
        protected void rptMainNavigation_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                var item = e.Item.DataItem as NavigationLinkItem;
                if (item != null)
                {
                    var frMainNavigationLink = e.FindControlAs <FieldRenderer>("frMainNavigationLink");
                    if (frMainNavigationLink != null)
                    {
                        frMainNavigationLink.Item = item;
                    }

                    var results = item.GetNavigationLinkItems();
                    if (results != null && results.Any())
                    {
                        var rptPrimaryNav = e.FindControlAs <Repeater>("rptPrimaryNavigation");
                        if (rptPrimaryNav != null)
                        {
                            rptPrimaryNav.DataSource = results;
                            rptPrimaryNav.DataBind();
                        }
                    }
                }
            }
        }
        protected void rptHomeSlider_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                HomeSliderItem item = e.Item.DataItem as HomeSliderItem;
                if (item != null)
                {
                    FieldRenderer frSliderText   = e.FindControlAs <FieldRenderer>("frSliderText");
                    Panel         pnlSliderImage = e.FindControlAs <Panel>("pnlSliderImage");
                    Panel         pnlSliderText  = e.FindControlAs <Panel>("pnlSliderText");

                    if (frSliderText != null)
                    {
                        frSliderText.Item = item;
                    }

                    if (pnlSliderImage != null && item.HeroImage.MediaItem != null)
                    {
                        pnlSliderImage.Style.Add("background-image", string.Format("url('{0}')", item.HeroImage.MediaUrl));
                        pnlSliderImage.Attributes.Add("onclick", string.Format("location.href='{0}'", item.Link.Url));
                    }

                    if (pnlSliderText != null)
                    {
                        pnlSliderText.Attributes.Add("class", string.Format("text {0}", item.TextCss.Rendered));
                    }
                }
            }
        }
        protected void rptHeaderChkbox_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            HeaderCheckboxItem HeadItem = e.Item.DataItem as HeaderCheckboxItem;

            if (HeadItem != null)
            {
                FieldRenderer frHeaderItem = e.FindControlAs <FieldRenderer>("frHeaderItem");

                if (frHeaderItem != null)
                {
                    frHeaderItem.Item = HeadItem;

                    List <TopicCheckboxItem> Topics = ChecklistArticlePageItem.GetAllTopicItem(HeadItem);

                    if (Topics != null)
                    {
                        Repeater rptTopicChkbox = e.FindControlAs <Repeater>("rptTopicChkbox");
                        if (rptTopicChkbox != null)
                        {
                            rptTopicChkbox.DataSource = Topics;
                            rptTopicChkbox.DataBind();
                        }
                    }
                }
            }
        }
        void rptSlideButtons_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Header)
            {
                Literal ltlPrev = e.FindControlAs <Literal>("ltlPrev");
                ltlPrev.Text = DictionaryConstants.PrevTipButtonText;
            }

            if (e.IsItem())
            {
                string     buttonNumber = (e.Item.ItemIndex + 1).ToString();
                HtmlButton hgcButton    = e.FindControlAs <HtmlButton>("hgcButton");

                hgcButton.InnerText = buttonNumber;
                hgcButton.Attributes["data-target"] = buttonNumber;
            }

            if (e.Item.ItemType == ListItemType.Footer)
            {
                Literal ltlNext = e.FindControlAs <Literal>("ltlNext");
                Literal ltlLast = e.FindControlAs <Literal>("ltlLast");

                ltlNext.Text = DictionaryConstants.NextTipButtonText;
                ltlLast.Text = DictionaryConstants.LastTipButtonText;
            }
        }
Exemple #10
0
 protected void rptPromoDetails_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.IsItem())
     {
         PromoItem currentPromo = e.Item.DataItem as PromoItem;
         if (currentPromo != null)
         {
             Panel pnlImageType = e.FindControlAs <Panel>("pnlImageType");
             if (pnlImageType != null)
             {
                 if (currentPromo.ShowMediaFile.Checked == true)
                 {
                     pnlImageType.CssClass += " video";
                 }
                 HyperLink hlPromoMedia = e.FindControlAs <HyperLink>("hlPromoMedia");
                 if (hlPromoMedia != null)
                 {
                     FieldRenderer frPromoMedia = e.FindControlAs <FieldRenderer>("frPromoMedia");
                     if (frPromoMedia != null)
                     {
                         frPromoMedia.Item = currentPromo;
                     }
                 }
                 FieldRenderer frPromoTitle = e.FindControlAs <FieldRenderer>("frPromoTitle");
                 if (frPromoTitle != null)
                 {
                     frPromoTitle.Item = currentPromo;
                 }
             }
         }
     }
 }
        protected void rptTopicHeader_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                Item subTopicItem = e.Item.DataItem as Item;

                if (subTopicItem != null && subTopicItem != Sitecore.Context.Item)
                {
                    HyperLink          hlNavigationTitle = e.FindControlAs <HyperLink>("hlNavigationTitle");
                    HtmlGenericControl listItem          = e.FindControlAs <HtmlGenericControl>("listItem");
                    listItem.Visible = false;
                    BasePageNEWItem basePageNewItem = new BasePageNEWItem(subTopicItem);
                    if (hlNavigationTitle != null)
                    {
                        if (subTopicItem.GetUrl().Contains(Request.RawUrl))
                        {
                            hlNavigationTitle.Attributes.Add("class", "selected");
                        }

                        hlNavigationTitle.NavigateUrl = LinkManager.GetItemUrl(subTopicItem);
                        if (!basePageNewItem.IncludeinNavigation.Raw.IsNullOrEmpty())
                        {
                            hlNavigationTitle.Text = basePageNewItem.NavigationTitle.Rendered;
                            listItem.Visible       = true;
                        }
                    }
                }
            }
        }
        protected void rptListTermbyAnchor_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                GlossaryTermItem GTerm = e.Item.DataItem as GlossaryTermItem;
                if (GTerm != null)
                {
                    //FieldRenderer frTermAnchor = e.FindControlAs<FieldRenderer>("frTermAnchor");
                    //if (frTermAnchor != null)
                    //{
                    //    frTermAnchor.Item = GTerm.InnerItem;
                    //}

                    FieldRenderer frTermTitle = e.FindControlAs <FieldRenderer>("frTermTitle");
                    if (frTermTitle != null)
                    {
                        frTermTitle.Item = GTerm;
                    }
                    FieldRenderer frTermDefinition = e.FindControlAs <FieldRenderer>("frTermDefinition");
                    if (frTermDefinition != null)
                    {
                        frTermDefinition.Item = GTerm;
                    }
                }
            }
        }
 protected void rptChildIssues_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.IsItem())
     {
         ChildIssueItem issue         = new ChildIssueItem((Item)e.Item.DataItem);
         Literal        litChildIssue = e.FindControlAs <Literal>("litChildIssue");
         HiddenField    hfChildIssue  = e.FindControlAs <HiddenField>("hfChildIssue");
         litChildIssue.Text = issue.IssueName;
         hfChildIssue.Value = issue.ID.ToString();
     }
 }
Exemple #14
0
        protected void rptChildIssues_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                ChildIssueItem childIssueItem = e.Item.DataItem as ChildIssueItem;

                HtmlInputCheckBox inputIssue   = e.FindControlAs <HtmlInputCheckBox>("inputIssue");
                Literal           litIssueName = e.FindControlAs <Literal>("litIssueName");
                inputIssue.Attributes.Add("data-id", childIssueItem.ID.ToString());
                litIssueName.Text = childIssueItem.IssueName.Raw;
            }
        }
        void rptIssues_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                ParentInterestItem interest    = (ParentInterestItem)e.Item.DataItem;
                Literal            litInterest = e.FindControlAs <Literal>("litInterest");
                HiddenField        hfInterest  = e.FindControlAs <HiddenField>("hfInterest");

                litInterest.Text = interest.InterestName.Raw;
                hfInterest.Value = interest.ID.ToString();
            }
        }
        protected void rptChildIssues_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                ChildIssueItem childIssueItem = e.Item.DataItem as ChildIssueItem;

                HiddenField hfIssue  = e.FindControlAs <HiddenField>("hfIssue");
                Label       lblIssue = e.FindControlAs <Label>("lblIssue");
                hfIssue.Value = childIssueItem.ID.ToShortID().ToString();
                lblIssue.Text = childIssueItem.IssueName.Raw;
            }
        }
Exemple #17
0
        protected void rptPartnerships_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                PartnerInfoItem navItem = (PartnerInfoItem)e.Item.DataItem;

                HyperLink hlLink = e.FindControlAs <HyperLink>("hlLink");
                Sitecore.Web.UI.WebControls.Image scImage = e.FindControlAs <Sitecore.Web.UI.WebControls.Image>("scImage");
                hlLink.NavigateUrl = navItem.GetUrl();

                scImage.Item = navItem;
            }
        }
Exemple #18
0
        protected void rptNavUtility_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                var item = e.Item.DataItem as Item;

                Placeholder phMenuItem = e.FindControlAs <Placeholder>("phMenuItem");

                var frUtilityLink = e.FindControlAs <FieldRenderer>("frUtilityLink");

                frUtilityLink.Item = item;
            }
        }
        protected void rptPartnerList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                Item            item    = (Item)e.Item.DataItem;
                PartnerInfoItem partner = item;

                HyperLink hlPartnerLogo = e.FindControlAs <HyperLink>("hlPartnerLogo");
                hlPartnerLogo.NavigateUrl = item.GetUrl();
                hlPartnerLogo.Visible     = partner.PartnerLogo.MediaItem != null;

                FieldRenderer frPartnerLogo = e.FindControlAs <FieldRenderer>("frPartnerLogo");
                frPartnerLogo.Item = item;
            }
        }
Exemple #20
0
        private void rptLinks_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                NavigationLinkItem item = (NavigationLinkItem)e.Item.DataItem;

                FieldRenderer frLink = e.FindControlAs <FieldRenderer>("frLink");
                frLink.Item = item;

                if (item.Link.Field != null)
                {
                    // Handle initial menu choice
                    if (e.Item.ItemIndex == 0)
                    {
                        litInitialMenuChoice.Text = item.Link.Field.Text;
                    }

                    // Selected state
                    Item navItem = Sitecore.Context.Item;
                    while (navItem != null)
                    {
                        if (item.Link.Field.TargetID == navItem.ID)
                        {
                            frLink.Parameters = "class=selected";
                            break;
                        }
                        navItem = navItem.Parent;
                    }
                }
            }
        }
Exemple #21
0
        void rptArticles_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                DefaultArticlePageItem item = (DefaultArticlePageItem)e.Item.DataItem;

                HyperLink hlArticleDetail = e.FindControlAs <HyperLink>("hlArticleDetail");
                hlArticleDetail.NavigateUrl = item.GetUrl();

                System.Web.UI.WebControls.Image imgThumbnail = e.FindControlAs <System.Web.UI.WebControls.Image>("imgThumbnail");
                imgThumbnail.ImageUrl = item.GetArticleThumbnailUrl(230, 129);

                FieldRenderer frPageTitle = e.FindControlAs <FieldRenderer>("frPageTitle");
                frPageTitle.Item = item;
            }
        }
        private void rptSectionPages_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                AboutSectionPageItem page = (AboutSectionPageItem)e.Item.DataItem;
                FieldRenderer        frNavigationSectionTitle   = e.FindControlAs <FieldRenderer>("frNavigationSectionTitle");
                FieldRenderer        frNavigationSectionSummary = e.FindControlAs <FieldRenderer>("frNavigationSectionSummary");
                FieldRenderer        frNavigationSectionImage   = e.FindControlAs <FieldRenderer>("frNavigationSectionImage");

                frNavigationSectionImage.Item = frNavigationSectionSummary.Item = frNavigationSectionTitle.Item = page;

                HyperLink hlReadMore = e.FindControlAs <HyperLink>("hlReadMore");
                hlReadMore.NavigateUrl = page.GetUrl();
                hlReadMore.Text        = UnderstoodDotOrg.Common.DictionaryConstants.ReadMoreLabel;
            }
        }
Exemple #23
0
        void rptChildren_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                Child child = (Child)e.Item.DataItem;

                Literal litGrade     = (Literal)e.Item.FindControl("litGrade");
                Literal litChildInfo = (Literal)e.Item.FindControl("litChildInfo");

                string childPrefix = string.Empty;

                var grade = child.Grades.FirstOrDefault();
                if (grade != null)
                {
                    GradeLevelItem gli = Sitecore.Context.Database.GetItem(grade.Key);
                    if (gli != null)
                    {
                        litGrade.Text = gli.AbbreviatedGrade.Raw;
                        childPrefix   = String.Concat(gli.Name.Raw, ", ");
                    }
                }

                litChildInfo.Text = String.Concat(childPrefix, MembershipHelper.GetLocalizedGender(child.Gender));

                Repeater rptIssues = e.FindControlAs <Repeater>("rptIssues");
                if (child.Issues.Any())
                {
                    var issues = child.Issues.Select(x => (ChildIssueItem)Sitecore.Context.Database.GetItem(x.Key))
                                 .Where(x => x != null);

                    rptIssues.DataSource = issues;
                    rptIssues.DataBind();
                }
            }
        }
Exemple #24
0
        protected void rptSocialMedias_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                SocialMediaItem socialMediaItem = e.Item.DataItem as SocialMediaItem;

                HyperLink     hypSocialLink = e.FindControlAs <HyperLink>("hypSocialLink");
                FieldRenderer frSocialImage = e.FindControlAs <FieldRenderer>("frSocialImage");

                if (socialMediaItem != null)
                {
                    hypSocialLink.NavigateUrl = socialMediaItem.Link.Url;
                    hypSocialLink.Attributes.Add("class", "icon icon-" + socialMediaItem.MediaName.Text.ToLower());
                }
            }
        }
Exemple #25
0
        protected void rptLanguage_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                var languageItem    = e.Item.DataItem as LanguageLinkItem;
                var hypLanguageLink = e.FindControlAs <HyperLink>("hypLanguageLink");

                if (!languageItem.LanguageName.Raw.IsNullOrEmpty() && !languageItem.SitecoreLanguage.Raw.IsNullOrEmpty())
                {
                    hypLanguageLink.Text = languageItem.MobileAbbreviation.Rendered;
                    hypLanguageLink.Attributes.Add("title", languageItem.LanguageName.Raw);

                    hypLanguageLink.NavigateUrl = languageItem.GetCurrentIsoAwareUrl();

                    if (languageItem.IsoCode == Sitecore.Context.Language.Name)
                    {
                        hypLanguageLink.Attributes.Add("class", "is-active");
                    }
                    else
                    {
                        hypLanguageLink.Attributes.Remove("class");
                    }
                }
            }
        }
Exemple #26
0
        protected void rptFeaturedArticles_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                DefaultArticlePageItem article = e.Item.DataItem as DefaultArticlePageItem;

                HyperLink hypArticleLink = e.FindControlAs <HyperLink>("hypArticleLink");
                Literal   ltArticleText  = e.FindControlAs <Literal>("ltArticleText");
                System.Web.UI.WebControls.Image imgThumbnail = e.FindControlAs <System.Web.UI.WebControls.Image>("imgThumbnail");

                hypArticleLink.NavigateUrl = article.GetUrl();
                // TODO: verify this truncation is allowed
                ltArticleText.Text    = article.ContentPage.BasePageNEW.NavigationTitle.Raw.Truncate(50, true, true);
                imgThumbnail.ImageUrl = article.GetArticleFeaturedThumbnailUrl(230, 129);
            }
        }
        protected void rptTopicCarousel_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                DefaultArticlePageItem item = e.Item.DataItem as DefaultArticlePageItem;

                System.Web.UI.WebControls.Image imgFeatured = e.FindControlAs <System.Web.UI.WebControls.Image>("imgFeatured");
                imgFeatured.ImageUrl = item.GetArticleFeaturedThumbnailUrl(630, 354);

                Literal litNavigationTitle = e.FindControlAs <Literal>("litNavigationTitle");
                litNavigationTitle.Text = item.ContentPage.BasePageNEW.NavigationTitle.Rendered;

                HyperLink hlImageLink = e.FindControlAs <HyperLink>("hlImageLink");
                hlImageLink.NavigateUrl = item.GetUrl();
            }
        }
        protected void rptAuthorArticles_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                DefaultArticlePageItem article = (DefaultArticlePageItem)e.Item.DataItem;

                if (article != null)
                {
                    HyperLink hypImageLink        = e.FindControlAs <HyperLink>("hypImageLink");
                    HyperLink hypAuthor           = e.FindControlAs <HyperLink>("hypAuthor");
                    HyperLink hypReadMore         = e.FindControlAs <HyperLink>("hypReadMore");
                    HyperLink hypArticleTitleLink = e.FindControlAs <HyperLink>("hypArticleTitleLink");
                    Literal   litCommentCount     = e.FindControlAs <Literal>("litCommentCount");
                    Literal   litArticleTitle     = e.FindControlAs <Literal>("litArticleTitle");
                    Literal   litDatePosted       = e.FindControlAs <Literal>("litDatePosted");
                    Literal   litAbstract         = e.FindControlAs <Literal>("litAbstract");
                    ArticleRecommendationIcons articleRecommendationIcons = e.FindControlAs <ArticleRecommendationIcons>("articleRecommendationIcons");

                    if (article.AuthorName.Item != null)
                    {
                        hypAuthor.Text        = article.AuthorName.Item.DisplayName;
                        hypAuthor.NavigateUrl = Sitecore.Context.Item.GetUrl();

                        hypImageLink.NavigateUrl = hypReadMore.NavigateUrl = hypArticleTitleLink.NavigateUrl = article.GetUrl();
                        hypImageLink.ImageUrl    = article.GetArticleThumbnailUrl(230, 129);

                        litArticleTitle.Text = article.DisplayName;
                        litDatePosted.Text   = article.InnerItem.Statistics.Created.ToString("MMM dd, yyyy");
                        litAbstract.Text     = UnderstoodDotOrg.Common.Helpers.TextHelper.TruncateText(
                            Sitecore.StringUtil.RemoveTags(HttpUtility.HtmlDecode(article.ContentPage.BodyContent.Raw)), 150);

                        bool hasMoreResults;
                        int  totalComments;

                        List <Comment> dataSource = TelligentService.ReadComments(
                            article.BlogId.ToString(), article.BlogPostId.ToString(), 1, Constants.ARTICLE_COMMENTS_PER_PAGE, "CreatedUtcDate", true, out totalComments, out hasMoreResults);

                        litCommentCount.Text = totalComments.ToString();

                        if (IsUserLoggedIn)
                        {
                            articleRecommendationIcons.HasMatchingParentInterest = article.HasMatchingParentInterest(CurrentMember);
                            articleRecommendationIcons.MatchingChildrenIds       = article.GetMatchingChildrenIds(CurrentMember);
                        }
                    }
                    else
                    {
                        e.Item.Visible = false;
                    }
                }
            }
        }
Exemple #29
0
 protected void rptKeepReading_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.IsItem())
     {
         Item RelatedLink = e.Item.DataItem as Item;
         if (RelatedLink != null)
         {
             FieldRenderer frPageTitle = e.FindControlAs <FieldRenderer>("frPageTitle");
             HyperLink     hlPageTitle = e.FindControlAs <HyperLink>("hlPageTitle");
             if (frPageTitle != null)
             {
                 frPageTitle.Item        = RelatedLink;
                 hlPageTitle.NavigateUrl = RelatedLink.GetUrl();
                 hlPageTitle.Visible     = true;
             }
         }
     }
 }
Exemple #30
0
        protected void rptSkillsChecklist_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                MetadataItem issue = e.Item.DataItem as MetadataItem;

                if (issue != null)
                {
                    Literal            litSkill   = e.FindControlAs <Literal>("litSkill");
                    HtmlInputCheckBox  inputSkill = e.FindControlAs <HtmlInputCheckBox>("inputSkill");
                    HtmlGenericControl issueLabel = e.FindControlAs <HtmlGenericControl>("issueLabel");

                    inputSkill.Attributes.Add("data-id", issue.ID.ToString());
                    litSkill.Text = issue.ContentTitle;
                    issueLabel.Attributes.Add("for", inputSkill.ID);
                }
            }
        }