Ejemplo n.º 1
0
        private void BindContent()
        {
            BehaviorAdvicePageItem item = Sitecore.Context.Item;

            litCommentsCount.Text = CommunityHelper.GetTotalComments(item.BlogId.Raw, item.BlogPostId.Raw).ToString();
            litHelpfulCount.Text  = CommunityHelper.GetTotalLikes(item.ContentId.Raw).ToString();
        }
 void rptTips_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.IsItem())
     {
         BehaviorAdvicePageItem item = (BehaviorAdvicePageItem)e.Item.DataItem;
         HyperLink hlTip             = e.FindControlAs <HyperLink>("hlTip");
         hlTip.NavigateUrl = item.GetUrl();
         hlTip.Text        = item.TipTitle;
     }
 }
 void rptRelatedArticles_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.IsItem())
     {
         Item      item          = (Item)e.Item.DataItem;
         HyperLink hlArticleLink = e.FindControlAs <HyperLink>("hlArticleLink");
         hlArticleLink.NavigateUrl = item.GetUrl();
         BehaviorAdvicePageItem behaviorItem = item;
         hlArticleLink.Text = !String.IsNullOrEmpty(behaviorItem.TipTitle) ? behaviorItem.TipTitle : behaviorItem.BasePageNEW.NavigationTitle;
     }
 }
        private void BindContent()
        {
            BehaviorAdvicePageItem item = Sitecore.Context.Item;
            ActivityLog            log  = new ActivityLog();

            litCommentsCount.Text = CommunityHelper.GetTotalComments(item.BlogId.Raw, item.BlogPostId.Raw).ToString();

            Guid contentId;
            int  helpfulCount = 0;

            if (Guid.TryParse(Model.BehaviorAdvicePage.ContentId.Raw, out contentId))
            {
                helpfulCount = log.GetActivityCountByValue(contentId, Constants.UserActivity_Values.FoundHelpful_True);
            }
            litHelpfulCount.Text = helpfulCount.ToString();
        }
Ejemplo n.º 5
0
        public object ComputeFieldValue(IIndexable indexable)
        {
            var indexItem = indexable as SitecoreIndexableItem;

            if (indexItem == null)
            {
                return(null);
            }
            var item = (Sitecore.Data.Items.Item)indexItem.Item;

            if (item == null)
            {
                return(null);
            }

            // Skip non-behavior articles
            if (!item.InheritsTemplate(BehaviorAdvicePageItem.TemplateId))
            {
                return(null);
            }

            var  article               = new BehaviorAdvicePageItem(item);
            bool fieldMatch            = true;
            CustomTreeListField target = null;

            // Only index the following fields
            switch (FieldName)
            {
            case UnderstoodDotOrg.Common.Constants.SolrFields.ChildChallenges:
                target = article.ChildChallenges;
                break;

            case UnderstoodDotOrg.Common.Constants.SolrFields.ChildBehaviorGrades:
                target = article.ChildGrades;
                break;

            default:
                fieldMatch = false;
                break;
            }

            return(fieldMatch ? GetSelectedItems(target) : null);
        }
        void rptArticles_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                Item item = (Item)e.Item.DataItem;

                BehaviorAdvicePageItem article = new BehaviorAdvicePageItem(item);

                if (article != null)
                {
                    System.Web.UI.WebControls.Image imgThumbnail = e.FindControlAs <System.Web.UI.WebControls.Image>("imgThumbnail");
                    imgThumbnail.ImageUrl = article.GetArticleThumbnailUrl(230, 129);

                    HyperLink hlArticleLink = e.FindControlAs <HyperLink>("hlArticleLink");
                    hlArticleLink.NavigateUrl = article.GetUrl();

                    Literal litArticleTitle = e.FindControlAs <Literal>("litArticleTitle");
                    litArticleTitle.Text = article.InnerItem.Fields["Navigation Title"].ToString();
                }
            }
        }
Ejemplo n.º 7
0
        private void BindData(Item thePage)
        {
            string BlogId     = "";
            string BlogPostId = "";

            if (thePage.InheritsTemplate(DefaultArticlePageItem.TemplateId))
            {
                BlogId     = new DefaultArticlePageItem(thePage).BlogId.Raw;
                BlogPostId = new DefaultArticlePageItem(thePage).BlogPostId.Raw;
            }
            else if (thePage.InheritsTemplate(BehaviorToolsAdvicePageItem.TemplateId))
            {
                BlogId     = new BehaviorAdvicePageItem(thePage).BlogId.Raw;
                BlogPostId = new BehaviorAdvicePageItem(thePage).BlogPostId.Raw;
            }

            ActivityLog tempLog = new ActivityLog();
            //ContentId, ActivityValue
            int helpfulCount = tempLog.GetActivityCountByValue(new Guid(Sitecore.Context.Item.ID.ToString()), Constants.UserActivity_Values.FoundHelpful_True);
            int commentCount = 0;

            if (!string.IsNullOrEmpty(BlogId) && !string.IsNullOrEmpty(BlogPostId))
            {
                commentCount = CommunityHelper.GetTotalComments(BlogId, BlogPostId);
            }

            lblHelpfulCount.Text = lblHelpfulCountMobile.Text = helpfulCount.ToString();
            lblCommentCount.Text = lblCommentCountMobile.Text = commentCount.ToString();

            ltlFoundThisHelpful.Text = ltlFoundThisHelpfulMobile.Text = DictionaryConstants.FoundThisHelpful;

            string commentLabel = DictionaryConstants.PluralCommentLabel;

            if (commentCount == 1)
            {
                commentLabel = DictionaryConstants.SingleCommentLabel;
            }

            ltlComments.Text = ltlCommentsMobile.Text = commentLabel;
        }
Ejemplo n.º 8
0
 public BehaviorToolsAdviceVideoPageItem(Item innerItem) : base(innerItem)
 {
     _BehaviorAdvicePageItem = new BehaviorAdvicePageItem(innerItem);
 }