Exemple #1
0
        private Item GetReviewIfAlreadyExists(string CSMId, AssistiveToolsSearchResultsPageItem searchPage)
        {
            Item temp = Sitecore.Data.Database.GetDatabase("master").SelectSingleItem("/sitecore/content/Home/Tools/#Assistive Technology#//*[@@templatename='Assistive Tools Review Page' and @#CSM ID# = '" + CSMId + "']");

            if (temp != null)
            {
                return(temp);
            }

            return(null);
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // TODO: convert to constants
                SearchPageId = Request["pageId"].AsNGuid().Value;
                CategoryId   = Request["categoryId"].AsNGuid().Value;
                ClickCount   = Request["count"].AsInt();
                Keyword      = Request["keyword"];
                if (string.IsNullOrEmpty(Keyword))
                {
                    IssueId    = Request["issueId"].AsNGuid();
                    GradeId    = Request["gradeId"].AsNGuid();
                    TechTypeId = Request["techTypeId"].AsNGuid();
                    PlatformId = Request["platformId"].AsNGuid();
                }

                var defaultSortValue = (int)SearchHelper.SortOptions.AssistiveToolsSortOptions.Relevance;
                SortOption = Request["sortOption"].AsEnum <SearchHelper.SortOptions.AssistiveToolsSortOptions>(defaultValue: defaultSortValue);

                SearchResults = AssistiveToolsSearchResultsPageItem.GetSearchResultsByCategory(
                    ClickCount + 1,
                    CategoryId,
                    IssueId,
                    GradeId,
                    TechTypeId,
                    PlatformId,
                    Keyword,
                    SortOption);

                rptrResults.DataSource = SearchResults;
                rptrResults.DataBind();
            }
            catch (Exception ex)
            {
                throw new Exception("An error occurred while trying to load more results", ex);
            }
        }
Exemple #3
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();
        }
Exemple #4
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);
            }
        }
Exemple #5
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();
        }