private void GetMember()
        {
            string screenName = Sitecore.Web.WebUtil.GetUrlName(0);

            // Verify user exists in telligent
            var telligentUser = TelligentService.GetUser(screenName);

            if (telligentUser == null || telligentUser.Username != screenName)
            {
                // TODO: display error?
                Sitecore.Diagnostics.Log.Info(String.Format("View Profile - Could not find user in telligent: {0}", screenName), this);
                Response.Redirect(MainsectionItem.GetHomeItem().GetUrl());
                return;
            }

            // Check member account
            MembershipManager mm = new MembershipManager();

            _profileMember = mm.GetMemberByScreenName(screenName);

            if (_profileMember == null)
            {
                // TODO: display error?
                Sitecore.Diagnostics.Log.Info(String.Format("View Profile - Could not find member with screen name: {0}", screenName), this);
                Response.Redirect(MainsectionItem.GetHomeItem().GetUrl());
                return;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var standalone = Request.QueryString["standalone"];

            IsPersonalized = string.IsNullOrEmpty(standalone) || standalone.ToLower() != bool.TrueString.ToLower();

            var simq = Request.QueryString["simq"];

            if (!string.IsNullOrEmpty(simq))
            {
                var simIds = simq.Split(',');
                if (!simIds.Any())
                {
                    return;
                }

                var issueId = simIds.First();
                IssueItem = Sitecore.Context.Database.GetItem(issueId);
            }

            if (IssueItem == null)
            {
                Response.Redirect(MainsectionItem.GetHomePageItem().GetUrl());
            }
        }
Beispiel #3
0
        /// <summary>
        /// Inits the Google Analytics script which is pulled from the global item
        /// TODO: Moved from the header to the footer due to performace issues. See UNAO-1141
        /// </summary>
        protected void InitGoogleAnalytics()
        {
            StringBuilder sb = new StringBuilder();

            GlobalsItem global = MainsectionItem.GetGlobals();

            if (global != null)
            {
                sb.AppendLine(global.GoogleAnalytics.Raw);
            }

            BasePageNEWItem basePage = Sitecore.Context.Item;

            if (basePage.GoogleAnalytics.Field != null)
            {
                sb.AppendLine(basePage.GoogleAnalytics.Raw);
            }

            string output = sb.ToString().Trim();

            if (!string.IsNullOrEmpty(output))
            {
                litAnalytics.Text = String.Format(@"<script type=""text/javascript"">{0}</script>", output);
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MyAccountItem context = (MyAccountItem)Sitecore.Context.Item;

            litSeeAllNotificationsLabel.Text = DictionaryConstants.SeeAllNotificationsLabel;
            hrefNotificationsLink.HRef       = MainsectionItem.GetHomePageItem().GetMyAccountFolder().GetMyNotificationsPage().GetUrl();
            hrefNotificationsLink.InnerText  = context.SeeAllNotificationsText;
            if (Notifications != null)
            {
                litNotifCount.Text   = Notifications.Count().ToString();
                pnlEmptyText.Visible = false;
            }
            else
            {
                pnlEmptyText.Visible = true;
            }

            var filterNotifs = Notifications;

            if (Notifications != null)
            {
                filterNotifs = Notifications.OrderByDescending(x => x.NotificationDate).Take(3).ToList();
            }

            lvNotifications.DataSource = filterNotifs;
            lvNotifications.DataBind();
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Comments = TelligentService.ReadComments(Model.BlogId, Model.BlogPostId);
            Reviews  = CSMUserReviewExtensions.GetReviews(Sitecore.Context.Item.ID.ToGuid());


            if (IsUserLoggedIn)
            {
                if (Reviews.Where(i => i.MemberId == CurrentMember.MemberId).Count() > 0)
                {
                    SubmittedReview = true;
                }
            }

            if (!IsPostBack)
            {
                BindDropDowns();
                BindReviews();
            }

            AssistiveToolsSkillFolderItem issuesFolder = MainsectionItem.GetGlobals().GetIssuesFolder();

            rptIssuesChecklist.DataSource = issuesFolder.InnerItem.Children.Select(i => (MetadataItem)i);
            rptIssuesChecklist.DataBind();

            litAverageRating.Text = GetRatingHTML(Int32.Parse(CSMUserReviewExtensions.GetAverageRating(Model.ID.ToGuid())));

            rfvGrades.ErrorMessage       = DictionaryConstants.ReviewSelectGradeErrorMessage;
            rfvIThinkItIs.ErrorMessage   = DictionaryConstants.ReviewIThinkItIsErrorMessaage;
            rfvWhatYouThink.ErrorMessage = DictionaryConstants.ReviewWhatYouThinkErrorMessage;
            rfvReviewTitle.ErrorMessage  = DictionaryConstants.ReviewGiveTitleErrorMessage;
        }
Beispiel #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //TODO: Look into and/or implement mobile version of header
     PreviousPageItem = Sitecore.Context.Item.IsOfType(TyceOverviewPageItem.TemplateId) ?
                        MainsectionItem.GetHomeItem().InnerItem :
                        Sitecore.Context.Item.Parent;
     PageItem = (TyceBasePageItem)Sitecore.Context.Item;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            var donatePage = MainsectionItem.GetHomePageItem().GetAboutPage().GetDonatePage();

            hypDonate25.NavigateUrl    = string.Format(donatePage.GetUrl() + "?{0}={1}", Constants.DONATION_AMOUNT, "25");
            hypDonate50.NavigateUrl    = string.Format(donatePage.GetUrl() + "?{0}={1}", Constants.DONATION_AMOUNT, "50");
            hypDonate100.NavigateUrl   = string.Format(donatePage.GetUrl() + "?{0}={1}", Constants.DONATION_AMOUNT, "100");
            hypDonateOther.NavigateUrl = string.Format(donatePage.GetUrl() + "?{0}={1}", Constants.DONATION_AMOUNT, "other");
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     btnAgree.Text    = Model.Agree.Rendered;
     btnNotAgree.Text = Model.NotAgree.Rendered;
     if (CurrentMember == null)
     {
         Response.Redirect(MainsectionItem.GetHomeItem().GetUrl());
     }
 }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BindEvents();
            cvFilters.Text = UnderstoodDotOrg.Common.DictionaryConstants.AssistiveToolRequiredFilterErrorMessage;

            if (Sitecore.Context.Language.Name == "es-MX")
            {
                frNoSpanishWarning.Item = MainsectionItem.GetHomePageItem().GetToolsPage().GetAssistiveToolsLandingPage().GetSearchPage();
                pnlNotInSpansih.Visible = true;
            }

            if (!Page.IsPostBack)
            {
                lblBrowseBy.Text = DictionaryConstants.BrowseByLabel;
                lblSearchBy.Text = DictionaryConstants.SearchByLabel;

                btnBrowseFind.Text = "";
                btnSearchFind.Text = "";
                // Set selected state of dynamic dropdown
                PlatformId = Request.QueryString[Constants.QueryStrings.LearningTool.PlatformId];

                PopulateDropDowns();

                var keyword = Request.QueryString[Constants.QueryStrings.LearningTool.Keyword];
                if (!string.IsNullOrEmpty(keyword))
                {
                    tbKeywordSearch.Value = keyword;
                }
                else
                {
                    var issueId = Request.QueryString[Constants.QueryStrings.LearningTool.IssueId];
                    var gradeId = Request.QueryString[Constants.QueryStrings.LearningTool.GradeId];
                    var typeId  = Request.QueryString[Constants.QueryStrings.LearningTool.TypeId];

                    ListItem temp;
                    if (!string.IsNullOrEmpty(issueId) && (temp = ddlIssues.Items.FindByValue(issueId)) != null)
                    {
                        temp.Selected = true;
                    }
                    if (!string.IsNullOrEmpty(gradeId) && (temp = ddlGrades.Items.FindByValue(gradeId)) != null)
                    {
                        temp.Selected = true;
                    }
                    if (!string.IsNullOrEmpty(typeId) && (temp = ddlTechTypes.Items.FindByValue(typeId)) != null)
                    {
                        temp.Selected = true;
                    }

                    if (!string.IsNullOrEmpty(PlatformId))
                    {
                        hfSelectedPlatform.Value = PlatformId;
                    }
                }
            }
        }
Beispiel #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var globalsItem   = MainsectionItem.GetGlobals();
            var advocacyLinks = globalsItem.GetAdvocacyLinksFolder().GetAdvocacyLinks();

            rptArticles.DataSource = this.Model.GetAdvocacyArticles();
            rptArticles.DataBind();

            rptrActionAlerts.DataSource = advocacyLinks;
            rptrActionAlerts.DataBind();
        }
Beispiel #11
0
        public static SiteSettingsItem GetSiteSettings()
        {
            var global = MainsectionItem.GetGlobals();

            if (global != null)
            {
                return(global.InnerItem.Children.Where(i => i.InheritsTemplate(SiteSettingsItem.TemplateId))
                       .Select(i => new SiteSettingsItem(i))
                       .FirstOrDefault());
            }

            return(null);
        }
        public static HeaderFolderItem GetHeader()
        {
            var siteItem = MainsectionItem.GetSiteRoot();

            if (siteItem != null)
            {
                GlobalsItem objGlobalItem = MainsectionItem.GetGlobals();
                if (objGlobalItem != null)
                {
                    return(objGlobalItem.GetHeader());
                }
            }
            return(null);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SectionLandingPageItem contextItem = Sitecore.Context.Item;
            HomePageItem           homePage    = MainsectionItem.GetHomeItem();

            if (homePage != null)
            {
                hlBackLink.NavigateUrl = homePage.GetUrl();
                HomepageLink           = homePage.ContentPage.BasePageNEW.NavigationTitle.Rendered;
            }
            if (contextItem != null)
            {
                scTopicTitle.Text = contextItem.DisplayName;
            }
        }
Beispiel #14
0
        /// <summary>
        /// Gets footer item from global
        /// </summary>
        /// <returns></returns>
        public static FooterFolderItem GetFooter()
        {
            MainsectionItem  objSiteItem             = MainsectionItem.GetSiteRoot();
            FooterFolderItem objFooterLinkFolderItem = null;

            if (objSiteItem != null)
            {
                GlobalsItem objGlobalItem = MainsectionItem.GetGlobals();
                if (objGlobalItem != null)
                {
                    objFooterLinkFolderItem = objGlobalItem.GetFooter();
                }
            }
            return(objFooterLinkFolderItem);
        }
Beispiel #15
0
        private void PopulateContent()
        {
            hlBackToHomepage.NavigateUrl = MainsectionItem.GetHomePageItem().GetUrl();

            // TODO: find member location?
            litLocation.Text = GeoTargeting.GetStateByZip(ProfileMember.ZipCode);

            // Avatar
            var user = TelligentService.GetUser(ScreenName);

            if (user != null)
            {
                imgAvatar.ImageUrl = user.AvatarUrl;
            }
            else
            {
                // TODO: fallback image?
                imgAvatar.Visible = false;
            }

            // Hide support from user viewing their own profile
            if (IsUserLoggedIn &&
                !string.IsNullOrEmpty(CurrentMember.ScreenName) &&
                CurrentMember.ScreenName == ScreenName)
            {
                pnlSupport.Visible = false;
            }
            else
            {
                pnlSupport.Visible = ProfileMember.allowConnections;
            }

            // Conditional content for logged in viewers or impersonating visitor
            if (!IsUserLoggedIn || IsImpersonatingVistor)
            {
                if (ProfileMember.allowConnections && ProfileMember.Children.Any())
                {
                    rptChildren.DataSource = ProfileMember.Children;
                    rptChildren.DataBind();
                }
            }
            else
            {
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         HomepageUrl = MainsectionItem.GetHomePageItem().GetUrl();
         ProcessQueryString();
         if (!IsStandaloneSimulation)
         {
             InitializeVideoIdPairs();
         }
         AddResourcesToPage();
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message + "<br/>" + ex.StackTrace);
         Response.End();
         //Response.Redirect(HomepageUrl);
     }
 }
        /// <summary>
        /// Gets footer item from global
        /// </summary>
        /// <returns></returns>
        public static WelcomeTourFolderItem GetWelcomeTourFolder()
        {
            MainsectionItem       objSiteItem = MainsectionItem.GetSiteRoot();
            WelcomeTourFolderItem objWelcomeTourFolderItem = null;

            if (objSiteItem != null)
            {
                GlobalsItem objGlobalItem = MainsectionItem.GetGlobals();
                if (objGlobalItem != null)
                {
                    MetadataFolderFolderItem metaDataFolder = objGlobalItem.GetMetaDataFolder();
                    if (metaDataFolder != null)
                    {
                        objWelcomeTourFolderItem = metaDataFolder.GetWelcomeTourFolder();
                    }
                }
            }
            return(objWelcomeTourFolderItem);
        }
        private void BindContent()
        {
            litTitle.Text = Model.ContentPage.PageTitle.Rendered;

            if (Model.InnerItem.InheritsTemplate(AuthorItem.TemplateId))
            {
                Item homepage = MainsectionItem.GetHomePageItem();
                litPreviousLink.Text        = homepage.DisplayName;
                hlBreadcrumbNav.NavigateUrl = homepage.GetUrl();
            }
            else
            {
                if (Model.InnerItem.Parent != null)
                {
                    SectionLandingPageItem parent = Model.InnerItem.Parent;
                    hlBreadcrumbNav.NavigateUrl = parent.GetUrl();
                    litPreviousLink.Text        = parent.ContentPage.BasePageNEW.NavigationTitle.Rendered;
                }
            }
        }
        private void BindRecommendedQuestion()
        {
            List<RecommendationQuestionItem> questions = MainsectionItem.GetGlobals().GetRecommendationsFolder().InnerItem.Children.Select(i => (RecommendationQuestionItem)i).ToList();

            RecommendationQuestionItem theQuestion = questions.Shuffle().ToList().FirstOrDefault();

            if (theQuestion != null)
            {
                hypCompleteProfile.Text = theQuestion.ButtonText;
                hypCompleteProfile.Text = theQuestion.ButtonText;
                if (IsUserLoggedIn)
                    hypCompleteProfile.NavigateUrl = MainsectionItem.GetHomeItem().GetMyAccountFolder().GetMyProfilePage().GetUrl();
                else
                    hypCompleteProfile.NavigateUrl = MainsectionItem.GetHomeItem().GetUrl() + "?recommend=true";
                litQuestion.Text = theQuestion.Question;
                litQuestionHeader.Text = theQuestion.QuestionHeader;
                litWhyAskContent.Text = theQuestion.WhyAreWeAskingContent;
                litWhyAskHeader.Text = theQuestion.WhyAreWeAskingHeader;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.AppendHeader("Access-Control-Allow-Origin", "*");

            ThankYouPageUrl = Model.GetConfirmationPage().GetUrl();

            var donationAmounts = Model.DonationAmounts.ListItems
                                  .Where(i => i != null)
                                  .Select(i => (DonationAmountItem)i);

            rptrDonationAmounts.DataSource = donationAmounts;
            rptrDonationAmounts.DataBind();

            List <StateItem> states         = MainsectionItem.GetGlobals().GetStatesFolder().InnerItem.Children.Select(i => (StateItem)i).ToList();
            List <ListItem>  statesDDlItems = states.Select(i => new ListItem(i.DisplayName, i.StateCode, true)).ToList();

            ddlStates.DataSource = statesDDlItems;
            ddlStates.DataBind();
            ddlStates.Items.Insert(0, new ListItem(DictionaryConstants.SelectLabel, string.Empty));
        }
Beispiel #21
0
        protected void Page_Init(object sender, EventArgs e)
        {
            // Repeaters may contain forms with post-back so bind repeater in init so viewstate is not lost
            GlobalsItem globalItem = MainsectionItem.GetGlobals();

            if (globalItem != null)
            {
                var moreExploreFolder = globalItem.GetMoreExploreFolder();
                if (moreExploreFolder != null)
                {
                    frMoreExploreTitle.Item = moreExploreFolder;
                    var moreExploreItems = moreExploreFolder.InnerItem.GetChildren(); //moreExploreFolder.GetMoreExploreItems();
                    if (moreExploreItems != null && moreExploreItems.Any())
                    {
                        rptMoreExplorer.Visible    = true;
                        rptMoreExplorer.DataSource = moreExploreItems;
                        rptMoreExplorer.DataBind();
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            HomepageUrl = MainsectionItem.GetHomePageItem().GetUrl();

            QuestionsPageItem = Model.TyceBasePage.GetQuestionsPage();
            PlayerPageItem    = Model.TyceBasePage.GetPlayerPage();

            TyceIssues = ChildLearningIssueItem.GetChildLearningIssues().ToList();

            rptrSimulations.DataSource = TyceIssues;
            rptrSimulations.DataBind();

            var tyceGradeGroups = TYCEGradeGroupItem.GetTyceGradeGroups().ToList();

            rptrChildStoryTabs.DataSource = tyceGradeGroups;
            rptrChildStoryTabs.DataBind();

            rptrChildStories.DataSource     = tyceGradeGroups;
            rptrChildStories.ItemDataBound += rptrChildStories_ItemDataBound;
            rptrChildStories.DataBind();
        }
Beispiel #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["Entry Message"] == null && CameFromOutsideSite() && Sitecore.Context.Item.InheritsTemplate(DefaultArticlePageItem.TemplateId))
            {
                Item content = MainsectionItem.GetGlobals().GetArticleEntryMessagesFolder().GetArticleEntryMessageContentItem();
                frContent.Item             = content;
                frChildEnrolledLabel.Item  = content;
                frChildNeedsHelpLabel.Item = content;
                frChildsNameIs.Item        = content;
                frChildsNameLabel.Item     = content;
                frCloseLabel.Item          = content;
                frContent.Item             = content;
                frNoThanksButtonLabel.Item = content;
                frPersonalizeLabel.Item    = content;
                frPersonalizeLabel2.Item   = content;
                frSubmitButtonLabel.Item   = content;
                frYesButtonLabel.Item      = content;

                var childIssues = FormHelper.GetIssues();
                rptChildIssues.Visible    = true;
                rptChildIssues.DataSource = childIssues;
                rptChildIssues.DataBind();

                var grades = FormHelper.GetGrades();
                ddlGrade.DataSource = grades.Select(g => new ListItem
                {
                    Text  = g.Name.Raw,
                    Value = g.ID.ToString()
                });
                ddlGrade.DataTextField  = "Text";
                ddlGrade.DataValueField = "Value";
                ddlGrade.DataBind();

                setCookie("Entry Message", "viewed");
            }
            else
            {
                this.Visible = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Model.ShowPromotionalControl.Checked)
            {
                var promoItems = Model.PromotionalContent.ListItems
                                 .Where(i => i != null && i.InheritsTemplate(PromoItem.TemplateId))
                                 .Select(i => (PromoItem)i)
                                 .Where(i => i.Active)
                                 .Take(3).ToList();
                var additionalPromosNeeded = 3 - promoItems.Count();
                var dtPromos = promoItems;
                if (additionalPromosNeeded > 0)
                {
                    var additionalPromoItems = MainsectionItem.GetGlobals().GetPromosFolder().GetPromoItems()
                                               .OrderBy(emp => Guid.NewGuid()).Select(i => (PromoItem)i).ToList().Where(i => i.Active);
                    dtPromos = promoItems.Union(additionalPromoItems).GroupBy(i => i.ID).Select(g => g.First()).ToList();
                }

                rptPromoList.DataSource = dtPromos.Take(3);
                rptPromoList.DataBind();
            }
        }
Beispiel #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AssistiveToolsSearchResultsPageItem searchPage = MainsectionItem.GetHomePageItem().GetToolsPage().GetAssistiveToolsLandingPage().GetSearchPage();

            frFooterContent.Item = searchPage;

            var screenshots = Model.Screenshots.ListItems
                              .Where(i => i != null && i.Paths.IsMediaItem)
                              .Select(i => (MediaItem)i);

            rptrScreenshots.DataSource = screenshots
                                         .Select(mi => new
            {
                Alt = mi.Alt,
                Url = mi.GetImageUrl()
            }).ToList();
            rptrScreenshots.DataBind();

            var platforms = Model.Platforms.ListItems
                            .Where(i => i != null && i.IsOfType(AssistiveToolsPlatformItem.TemplateId))
                            .Select(i => (MetadataItem)i).ToList();

            rptrPlatforms.DataSource = platforms;
            rptrPlatforms.DataBind();

            var subjectsAndSkills = Model.Subjects.ListItems
                                    .Where(i => i != null)
                                    .Select(i => (MetadataItem)i).ToList();

            subjectsAndSkills.AddRange(Model.Skills.ListItems
                                       .Where(i => i != null)
                                       .Select(i => (MetadataItem)i));

            rptrSubjectsAndSkills.DataSource = subjectsAndSkills;
            rptrSubjectsAndSkills.DataBind();

            frPlatformsLink.Item = MainsectionItem.GetHomePageItem().GetToolsPage().GetAssistiveToolsLandingPage().GetSearchPage();
        }
Beispiel #26
0
        /// <summary>
        /// Want to add a new review? Fill an instance of ReviewModel, and put it here
        /// </summary>
        /// <param name="Review">New review to add to Sitecore</param>
        /// <returns>Sitecore Item that was added</returns>
        ///

        public Item Add(ReviewModel Review)
        {
            try
            {
                using (new SecurityDisabler())
                {
                    Item newReview;

                    AssistiveToolsSearchResultsPageItem searchPage = MainsectionItem.GetHomePageItem().GetToolsPage().GetAssistiveToolsLandingPage().GetSearchPage();

                    newReview = GetReviewIfAlreadyExists(Review.CommonSenseMediaID, searchPage);

                    if (newReview == null)
                    {
                        TemplateItem reviewTemplate = Sitecore.Configuration.Factory.GetDatabase("master").GetTemplate(AssistiveToolsReviewPageItem.TemplateId);
                        newReview = Get(searchPage.ID.ToString()).Add(Review.Title, reviewTemplate);
                    }

                    newReview.Editing.BeginEdit();

                    newReview = Map(newReview, Review);

                    newReview.Editing.EndEdit();

                    // publish
                    CommonSenseImportHelper.PublishItem(newReview, Sitecore.Configuration.Factory.GetDatabase("master"));
                    CommonSenseImportHelper.PublishItem(newReview, Sitecore.Configuration.Factory.GetDatabase("web"));

                    return(newReview);
                }
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Beispiel #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Search Query"] != null)
            {
                anchorBackLink.Attributes.Add("href", Session["Search Query"].ToString());
                Session["Search Query"] = null;
                lblBackToResults.Text   = DictionaryConstants.BackToResultsLabel;
            }
            else
            {
                arrowDiv.Visible = false;
            }

            AssistiveToolsSearchResultsPageItem searchPage = MainsectionItem.GetHomePageItem().GetToolsPage().GetAssistiveToolsLandingPage().GetSearchPage();

            frSponsorImage.Item = searchPage.InnerItem.Parent;
            frRandRby.Item      = searchPage.InnerItem.Parent;
            AppleImage.Item     = searchPage.InnerItem.Parent;
            GoogleImage.Item    = searchPage.InnerItem.Parent;

            lblAboutOurRatingSystem.Text = DictionaryConstants.AboutOurRatingSystemLabel;
            lblBestFragment.Text         = DictionaryConstants.BestFragment;
            lblContentIsAppropriate.Text = DictionaryConstants.ContentIsAppropriateLabel;
            lblDisappointing.Text        = DictionaryConstants.DisappointingLabel;
            lblDontBother.Text           = DictionaryConstants.DontBotherLabel;
            lblEngaging.Text             = DictionaryConstants.EngagingLabel;
            lblFairFragment.Text         = DictionaryConstants.Fairfragment;
            lblGoodFragment.Text         = DictionaryConstants.Goodfragment;
            lblGrade.Text                  = DictionaryConstants.GradeLabel;
            lblJustFine.Text               = DictionaryConstants.JustFineLabel;
            lblKnowYourChild.Text          = DictionaryConstants.KnowYourChildLabel;
            lblMoreInfo.Text               = DictionaryConstants.MoreInformationLabel;
            lblMoreInformation.Text        = DictionaryConstants.MoreInformationLabel;
            lblMoreInformation1.Text       = DictionaryConstants.MoreInformationLabel;
            lblNotAgeAppropriate.Text      = DictionaryConstants.NotAgeAppropriateLabel;
            lblNotAppropriate.Text         = DictionaryConstants.NotAppropriateLabel;
            lblNotForKidsFragment.Text     = DictionaryConstants.NotAppropriateLabel;
            lblNotForLearningFragment.Text = DictionaryConstants.NotForLearningfragment;
            lblNotRecommended.Text         = DictionaryConstants.NotRecommendedLabel;
            lblOffFragment.Text            = DictionaryConstants.OffFragment;
            lblOnFragment.Text             = DictionaryConstants.OnRatingLabel;
            lblPauseFragment.Text          = DictionaryConstants.Pausefragment;
            lblPrettyEngaging.Text         = DictionaryConstants.PrettyEngagingLabel;
            lblQuality.Text                = DictionaryConstants.QualityLabel;
            lblQualityRating.Text          = DictionaryConstants.QualityRatingLabel;
            lblReallyEngaging.Text         = DictionaryConstants.ReallyEngagingLabel;
            lblReallyGood.Text             = DictionaryConstants.ReallyGoodLabel;
            lblSomewhatEngaging.Text       = DictionaryConstants.SomewhatEngagingLabel;
            lblTheBest.Text                = DictionaryConstants.TheBestLabel;
            lblVeryGoodFragment.Text       = DictionaryConstants.VeryGoodfragment;

            var screenshots = Model.Screenshots.ListItems
                              .Where(i => i != null && i.Paths.IsMediaItem)
                              .Select(i => (MediaItem)i);

            rptrScreenshots.DataSource = screenshots
                                         .Select(mi => new { Alt = mi.Alt, Url = mi.GetImageUrl() }).ToList();
            rptrScreenshots.DataBind();

            var appropriateGrades = Enumerable.Range(1, 12)
                                    .Select(i => new
            {
                Grade = i,
                Color = i <= Model.OffGrade ? "red" : i < Model.OnGrade ? "yellow" : "green"
            });

            rptrAppropriateGrades.DataSource = appropriateGrades;
            rptrAppropriateGrades.DataBind();

            var subjects = Model.Subjects.ListItems
                           .Where(i => i != null && i.IsOfType(AssistiveToolsSubjectItem.TemplateId))
                           .Select(i => (AssistiveToolsSubjectItem)i).ToList();

            rptrSubjects.DataSource = subjects;
            rptrSubjects.DataBind();
        }
Beispiel #28
0
        /// <summary>
        /// Maps the ReviewModel to a Sitecore Item
        /// </summary>
        /// <param name="mappedReview">Destination Sitecore Item to map</param>
        /// <param name="Review">Values to map</param>
        /// <returns>Updated Sitecore item</returns>
        private Item Map(Item mappedReview, ReviewModel Review)
        {
            try
            {
                // Single-line text
                if (mappedReview["title"] != null && !string.IsNullOrEmpty(Review.Title))
                {
                    mappedReview["title"] = Review.Title.Trim();
                }

                if (mappedReview["summary"] != null && Review.Summary != null)
                {
                    mappedReview["summary"] = Review.Summary.Trim();
                }

                if (mappedReview["description"] != null && Review.Description != null)
                {
                    mappedReview["description"] = Review.Description.Trim();
                }

                if (mappedReview["what parents need to know"] != null && Review.ParentsNeedToKnow != null)
                {
                    mappedReview["what parents need to know"] = Review.ParentsNeedToKnow.Trim();
                }

                if (mappedReview["what kids can learn"] != null && Review.WhatKidsCanLearn != null)
                {
                    mappedReview["what kids can learn"] = Review.WhatKidsCanLearn.Trim();
                }

                if (mappedReview["any good"] != null && !string.IsNullOrEmpty(Review.AnyGood))
                {
                    mappedReview["any good"] = Review.AnyGood.Trim();
                }

                if (mappedReview["target grade"] != null && !string.IsNullOrEmpty(Review.TargetGrade))
                {
                    mappedReview["target grade"] = Review.TargetGrade.Trim();
                }

                if (mappedReview["on grade"] != null && !string.IsNullOrEmpty(Review.OnGrade))
                {
                    mappedReview["on grade"] = Review.OnGrade.Trim();
                }

                if (mappedReview["off grade"] != null && !string.IsNullOrEmpty(Review.OffGrade))
                {
                    mappedReview["off grade"] = Review.OffGrade.Trim();
                }

                if (mappedReview["apple app store id"] != null && !string.IsNullOrEmpty(Review.AppleAppStoreID))
                {
                    mappedReview["apple app store id"] = Review.AppleAppStoreID.Trim();
                }

                if (mappedReview["google play store id"] != null && !string.IsNullOrEmpty(Review.GooglePlayStoreID))
                {
                    mappedReview["google play store id"] = Review.GooglePlayStoreID.Trim();
                }

                if (mappedReview["csm id"] != null && !string.IsNullOrEmpty(Review.CommonSenseMediaID))
                {
                    mappedReview["csm id"] = Review.CommonSenseMediaID.Trim();
                }

                if (mappedReview["external link"] != null && !string.IsNullOrEmpty(Review.ExternalLink))
                {
                    mappedReview["external link"] = "<link text=\"\" linktype=\"external\" url=\"" + Review.ExternalLink + "\" target=\"\" />";
                }

                if (mappedReview["price"] != null && !string.IsNullOrEmpty(Review.Price))
                {
                    mappedReview["price"] = Review.Price.Trim();
                }

                if (mappedReview["how parents can help"] != null && Review.HowParentsCanHelp != null)
                {
                    mappedReview["how parents can help"] = Review.HowParentsCanHelp.Trim();
                }

                if (mappedReview["learning"] != null && Review.LearningRank != null)
                {
                    mappedReview["learning"] = Review.LearningRank.Trim();
                }

                if (mappedReview["publish date"] != null && Review.Published != null)
                {
                    mappedReview["publish date"] = Review.Published.Trim();
                }

                if (mappedReview["quality"] != null && Review.QualityRank != null)
                {
                    mappedReview["quality"] = Review.QualityRank.Trim();
                }

                if (mappedReview["screenshots"] != null && Review.Screenshots != null)
                {
                    mappedReview["screenshots"] = CommonSenseImportHelper.addMedia(Review.Screenshots).Trim();
                }

                if (mappedReview["platforms"] != null && Review.Platforms != null)
                {
                    mappedReview["platforms"] = CommonSenseImportHelper.MatchCSV(Review.Platforms, "{042EBC5C-CCA0-4758-823D-A07213A72434}").Trim();
                }

                if (mappedReview["skills"] != null && Review.Skills != null)
                {
                    mappedReview["skills"] = CommonSenseImportHelper.MatchCSV(Review.Skills, MainsectionItem.GetGlobals().GetSkillsFolder().ID.ToString()).Trim();
                }

                if (mappedReview["subjects"] != null && Review.Subjects != null)
                {
                    mappedReview["subjects"] = CommonSenseImportHelper.MatchCSV(Review.Subjects, "{11AAE042-9BFA-43C4-A971-0AF140108921}").Trim();
                }

                if (mappedReview["issues"] != null && Review.Issues != null)
                {
                    mappedReview["issues"] = CommonSenseImportHelper.MatchCSVIssues(Review.Issues, "{5CDC7D81-19CA-4CF6-8C58-A4D013823A05}").Trim();
                }

                if (mappedReview["genre"] != null && Review.Genres != null)
                {
                    mappedReview["genre"] = CommonSenseImportHelper.MatchCSV(Review.Genres, "{97908446-B312-4183-915E-2E43BA5A7693}").Trim();
                }

                if (mappedReview["thumbnail image"] != null && Review.Thumbnail != null)
                {
                    MediaItem temp = CommonSenseImportHelper.addMedia(Review.Thumbnail);
                    if (temp != null)
                    {
                        mappedReview["thumbnail image"] = "<image mediaid=\"" + temp.ID.ToString() + "\" mediapath=\"" + temp.MediaPath + "\" src=\"" + temp.FilePath + "\" />";
                    }
                }

                if (mappedReview["type"] != null && Review.Type != null)
                {
                    mappedReview["type"] = CommonSenseImportHelper.MatchCSV(Review.Type, "{88226E2B-BAFE-44E9-8EEE-95525458EA14}").Trim();
                }

                if (mappedReview["category"] != null && Review.Category != null)
                {
                    mappedReview["category"] = CommonSenseImportHelper.GetCategory(Review.Category).Trim();
                }
            }
            catch (Exception e)
            {
                return(mappedReview);
            }

            //// Links
            //mappedReview["telligent id"] = Review.TelligentID;

            //// Numbers
            //mappedReview["quality"] = Review.QualityRank;

            return(mappedReview);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            List <INotification> notifs      = new List <INotification>();
            List <Conversation>  checkConvos = new List <Conversation>();

            if (IsUserLoggedIn)
            {
                if (!String.IsNullOrEmpty(CurrentMember.ScreenName))
                {
                    if (Notifications != null)
                    {
                        notifs = Notifications;
                    }
                    else
                    {
                        notifs = TelligentService.GetNotifications(CurrentMember.ScreenName);
                        if (notifs != null)
                        {
                            Notifications = notifs;
                        }
                        else
                        {
                            Notifications = new List <INotification>();
                        }
                    }


                    if (Conversations != null)
                    {
                        checkConvos = Conversations;
                    }
                    else
                    {
                        checkConvos = TelligentService.GetConversations(CurrentMember.ScreenName, Constants.TelligentConversationStatus.Unread);
                        if (checkConvos != null)
                        {
                            Conversations = checkConvos;
                        }
                        else
                        {
                            checkConvos   = new List <Conversation>();
                            Conversations = checkConvos;
                        }
                    }
                }
            }



            litNotifsCount.Text         = notifs != null && notifs.Count() > 0?notifs.Count().ToString():"0";
            litwhatsHappeningLabel.Text = DictionaryConstants.WhatsHappeningLabel;
            litPrivateMsgsLabel.Text    = DictionaryConstants.PrivateMessagesLabel;
            litEmailPrefLabel.Text      = DictionaryConstants.EmailPreferencesLabel;
            litPMs.Text = checkConvos.Count().ToString();
            if (!IsPostBack)
            {
                if (Sitecore.Context.Item.TemplateID.ToString() == EmailandAlertPreferencesPageItem.TemplateId)
                {
                    liEmailPreferencesTab.Attributes["class"] += "active";
                }

                if (Sitecore.Context.Item.TemplateID.ToString() == PrivateMessageToolItem.TemplateId)
                {
                    liMessagesTab.Attributes["class"] += "active";
                }

                if (Sitecore.Context.Item.TemplateID.ToString() == MyNotificationsPageItem.TemplateId)
                {
                    liNotificationsTab.Attributes["class"] += "active";
                }

                // TODO: refactor
                hypWhatsHappening.NavigateUrl           = MainsectionItem.GetHomePageItem().GetMyAccountFolder().GetMyNotificationsPage().GetUrl();
                hypEmailAndAlertPreferences.NavigateUrl = MainsectionItem.GetHomePageItem().GetMyAccountFolder().GetMyNotificationsPage().GetEmailAndAlertPreferences().InnerItem.GetUrl();
                hypPrivateMessages.NavigateUrl          = MainsectionItem.GetHomePageItem().GetMyAccountFolder().GetMyNotificationsPage().GetPrivateMessageTool().InnerItem.GetUrl();
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     //hlBackToPreviousPage.NavigateUrl = Sitecore.Context.Item.Parent.GetUrl();
     //litBackToPreviousPage.Text = "Back";
     PreviousPageItem = Sitecore.Context.Item.Parent.InheritsTemplate(BasePageNEWItem.TemplateId) ? Sitecore.Context.Item.Parent : MainsectionItem.GetHomeItem().InnerItem;
 }