protected void Page_Load(object sender, EventArgs e)
        {
            SetupCanonicalUrl(this.DictionaryRouter.GetBaseURL());
            GetDefinitionTerm();
            ValidateCDRID();

            //For Genetics dictionary language is always English
            DictionaryLanguage = "en";

            DictionaryAppManager _dictionaryAppManager = new DictionaryAppManager();

            DictionaryTerm dataItem = _dictionaryAppManager.GetTerm(Convert.ToInt32(CdrID), NCI.Web.Dictionary.DictionaryType.genetic, DictionaryLanguage, "v1");

            if (dataItem != null && dataItem.Term != null)
            {
                ActivateDefinitionView(dataItem);
                currentItem = dataItem;
                // Web Analytics *************************************************
                if (WebAnalyticsOptions.IsEnabled)
                {
                    // Set analytics for definition view page load
                    SetAnalytics();
                }

                PageInstruction.AddFieldFilter("browser_title", (name, data) =>
                {
                    data.Value = "Definition of " + dataItem.Term + " - NCI Dictionary of Genetics Terms";
                });
            }
            else
            {
                termDictionaryDefinitionView.Visible = false;
            }
        }
        private void ActivateDefinitionView(DictionaryTerm dataItem)
        {
            var myDataSource = new List <DictionaryTerm> {
                dataItem
            };

            drugDictionaryDefinitionView.Visible    = true;
            drugDictionaryDefinitionView.DataSource = myDataSource;
            drugDictionaryDefinitionView.DataBind();

            string termName = dataItem.Term;

            CdrID = dataItem.ID.ToString();

            PageAssemblyContext.Current.PageAssemblyInstruction.AddFieldFilter("browser_title", (name, data) =>
            {
                data.Value = "Definition of " + termName + " - NCI Drug Dictionary";
            });

            DictionaryDefinitionHelper.SetMetaTagDescription(dataItem, DictionaryLanguage, PageInstruction);

            PageAssemblyContext.Current.PageAssemblyInstruction.AddFieldFilter("meta_keywords", (name, data) =>
            {
                data.Value = termName + ", definition";
            });
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetupCanonicalUrls(DictionaryURL, DictionaryURL);
            GetDefinitionTerm();
            ValidateCDRID();

            DictionaryURL = this.DictionaryRouter.GetBaseURL();

            DictionaryLanguage = PageAssemblyContext.Current.PageAssemblyInstruction.Language;

            DictionaryAppManager _dictionaryAppManager = new DictionaryAppManager();

            DictionaryTerm dataItem = _dictionaryAppManager.GetTerm(Convert.ToInt32(CdrID), NCI.Web.Dictionary.DictionaryType.term, DictionaryLanguage, "v1");

            if (dataItem != null && dataItem.Term != null)
            {
                ActivateDefinitionView(dataItem);
                currentItem = dataItem;
                // Web Analytics *************************************************
                if (WebAnalyticsOptions.IsEnabled)
                {
                    // Set analytics for definition view page load
                    SetAnalytics();
                }
            }
            else
            {
                termDictionaryDefinitionView.Visible = false;
            }
        }
        /// <summary>
        /// Stinky code to generate a drug definition's list of aliases.
        /// </summary>
        /// <param name="termSearchResult"></param>
        /// <returns></returns>
        public string GenerateTermAliasList(object termSearchResult)
        {
            string aliasDisplay = String.Empty;

            DictionaryTerm termInfo = termSearchResult as DictionaryTerm;

            if (termInfo != null && termInfo.HasAliases)
            {
                Dictionary <string, List <string> > nameTypeMap = RollupNameTypeLists(termInfo.Aliases);
                StringBuilder sb = new StringBuilder();

                // Display the list of names.
                if (nameTypeMap.Count > 0)
                {
                    sb.Append("<p><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">");

                    sb.Append(GenerateAliasRow(nameTypeMap, NAME_TYPE_SYNONYM, NAME_LABEL_SYNONYM));
                    sb.Append(GenerateAliasRow(nameTypeMap, NAME_TYPE_BRAND_NAME, NAME_LABEL_BRAND_NAME));
                    sb.Append(GenerateAliasRow(nameTypeMap, NAME_TYPE_FOREIGN_BRAND, NAME_LABEL_FOREIGN_BRAND));
                    sb.Append(GenerateAliasRow(nameTypeMap, NAME_TYPE_ABBREV, NAME_LABEL_ABBREV));
                    sb.Append(GenerateAliasRow(nameTypeMap, NAME_TYPE_ACRONYM, NAME_LABEL_ACRONYM));
                    sb.Append(GenerateAliasRow(nameTypeMap, NAME_TYPE_CODE_NAME, NAME_LABEL_CODE_NAME));
                    sb.Append(GenerateAliasULRow(nameTypeMap, NAME_TYPE_CHEMICAL_NAME, NAME_LABEL_CHEMICAL_NAME));
                    sb.Append(GenerateAliasULRow(nameTypeMap, NAME_TYPE_IND_NUMBER, NAME_LABEL_IND_NUMBER));
                    sb.Append(GenerateAliasULRow(nameTypeMap, NAME_TYPE_NSC_CODE, NAME_LABEL_NSC_CODE));

                    sb.Append("</table><p>");
                }

                aliasDisplay = sb.ToString();
            }

            return(aliasDisplay);
        }
        protected void termDictionaryDefinitionView_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                //get the TermReturn object that is bound to the current row.
                DictionaryTerm termDetails = (DictionaryTerm)e.Item.DataItem;

                if (termDetails != null)
                {
                    PlaceHolder phPronunciation = (PlaceHolder)e.Item.FindControl("phPronunciation");
                    if (termDetails.HasPronunciation && phPronunciation != null)
                    {
                        phPronunciation.Visible = true;
                        System.Web.UI.HtmlControls.HtmlAnchor pronunciationLink = (System.Web.UI.HtmlControls.HtmlAnchor)e.Item.FindControl("pronunciationLink");

                        Label pronunciationKey = (Label)e.Item.FindControl("pronunciationKey");
                        if (pronunciationKey != null && termDetails.Pronunciation.HasKey)
                        {
                            pronunciationKey.Text = " " + termDetails.Pronunciation.Key;
                        }
                    }
                    else
                    {
                        phPronunciation.Visible = false;
                    }

                    //Get Related Information from the Manager layer
                    //Add check to see if it exists and then display data accordingly
                    Panel pnlRelatedInfo = e.Item.FindControl("pnlRelatedInfo") as Panel;
                    if (pnlRelatedInfo != null)
                    {
                        //display the related information panel
                        //when atleast one of the related item exists
                        if (termDetails.Images.Length > 0)
                        {
                            pnlRelatedInfo.Visible = true;

                            Repeater relatedImages = (Repeater)e.Item.FindControl("relatedImages");
                            if (relatedImages != null)
                            {
                                if (termDetails.Images.Length > 0)
                                {
                                    relatedImages.Visible    = true;
                                    relatedImages.DataSource = termDetails.Images;
                                    relatedImages.DataBind();
                                }
                            }
                        }
                        else
                        {
                            pnlRelatedInfo.Visible = false;
                        }
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string input_term;

            if (PageAssemblyContext.Current.DisplayVersion == DisplayVersions.Web)
            {
                urlArgs    = Request.Url.Query.Substring(1);
                input_term = Strings.Clean(Request.Params["term"]);
                CdrID      = Strings.IfNull(Strings.Clean(Request.Params["id"]), Strings.Clean(Request.Params["cdrid"]));
                AudienceType   audience   = GetAudienceType(Strings.Clean(Request.Params["version"]));
                DictionaryType dictionary = GetDictionaryType(Strings.Clean(Request.Params["dictionary"]));

                //load the definition
                DictionaryAppManager _dictionaryAppManager = new DictionaryAppManager();

                DictionaryTerm dataItem = null;

                if (!string.IsNullOrEmpty(CdrID))
                {
                    CdrID = Regex.Replace(CdrID, "^CDR0+", "", RegexOptions.Compiled);
                    // call appropriate method if dictionary type is known
                    // the language is set to English = en by default
                    if (dictionary == DictionaryType.Unknown)
                    {
                        dataItem = _dictionaryAppManager.GetTermForAudience(Convert.ToInt32(CdrID), dictionaryLanguage, "v1", audience);
                    }
                    else
                    {
                        dataItem = _dictionaryAppManager.GetTerm(Convert.ToInt32(CdrID), dictionary, dictionaryLanguage, "v1", audience);
                    }
                }

                if (dataItem != null && dataItem.Term != null)
                {
                    ActivateDefinitionView(dataItem);
                }
                else
                {
                    phDefinition.Visible = false;
                    phNoResult.Visible   = true;
                }

                // Web Analytics *************************************************
                WebAnalyticsPageLoad webAnalyticsPageLoad = new WebAnalyticsPageLoad();

                webAnalyticsPageLoad.SetChannel("Dictionary of Cancer Terms");
                webAnalyticsPageLoad.SetLanguage("en");

                webAnalyticsPageLoad.AddEvent(WebAnalyticsOptions.Events.event11); // Dictionary Term view (event11)
                litOmniturePageLoad.Text = webAnalyticsPageLoad.Tag();             // Load page load script
                // End Web Analytics *********************************************
            }
        }
        private void ActivateDefinitionView(DictionaryTerm dataItem)
        {
            phDefinition.Visible = true;
            phNoResult.Visible   = false;

            var myDataSource = new List <DictionaryTerm> {
                dataItem
            };

            termDictionaryDefinitionView.Visible    = true;
            termDictionaryDefinitionView.DataSource = myDataSource;
            termDictionaryDefinitionView.DataBind();
        }
        /// <summary>
        ///    Sets the meta tag description. The function checks if the Dictionary Term has a valid (not null and length greater than 0) definition.
        ///    If it is the case the function attempts to extract the first two sentences of the Definition and set them as the meta tag description.
        ///    If not, we revert to using the term itself has the meta tag description.
        ///
        ///    AUTHOR: CHRISTIAN RIKONG
        ///    LAST PUBLISHED DATE: 12/08/2017 11:47 AM
        /// </summary>
        /// <param name="dataItem">Stores the Dictionary Term that is used to create the description meta tag</param>
        public static void SetMetaTagDescription(DictionaryTerm dataItem, string DictionaryLanguage, IPageAssemblyInstruction PageInstruction)
        {
            string termName = dataItem.Term;


            if (dataItem.Definition != null && dataItem.Definition.Text != null && dataItem.Definition.Text.Length > 0)
            {
                string   sentences            = "";
                string[] definitionsSentences = System.Text.RegularExpressions.Regex.Split(dataItem.Definition.Text, @"(?<=[\.!\?])\s+");


                if (definitionsSentences != null && definitionsSentences.Length > 0)
                {
                    int sentencesCount = 0;

                    foreach (string existingSentence in definitionsSentences)
                    {
                        sentencesCount = sentencesCount + 1;

                        if (sentencesCount <= 2)
                        {
                            sentences = sentences + existingSentence.Replace(".", "") + ". ";
                        }
                        else
                        {
                            break;
                        }
                    }

                    PageInstruction.AddFieldFilter("meta_description", (name, data) =>
                    {
                        data.Value = sentences;
                    });
                }
                else
                {
                    SetMetaTagDescriptionToTerm(PageInstruction, termName, DictionaryLanguage);
                }
            }
            else
            {
                SetMetaTagDescriptionToTerm(PageInstruction, termName, DictionaryLanguage);
            }
        }
        protected void drugDictionaryDefinitionView_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                //get the TermReturn object that is bound to the current row.
                DictionaryTerm termDetails = (DictionaryTerm)e.Item.DataItem;

                if (termDetails != null)
                {
                    PlaceHolder phAliasList = (PlaceHolder)e.Item.FindControl("phAliasList");
                    if (phAliasList != null && termDetails.HasAliases)
                    {
                        phAliasList.Visible = true;
                    }

                    SetupDrugInfoSummaryLink(e.Item, termDetails);
                }
            }
        }
Example #10
0
        // Activate definition view for given term
        private void ActivateDefinitionView(DictionaryTerm dataItem)
        {
            var myDataSource = new List <DictionaryTerm> {
                dataItem
            };

            termDictionaryDefinitionView.Visible    = true;
            termDictionaryDefinitionView.DataSource = myDataSource;
            termDictionaryDefinitionView.DataBind();

            string termName = dataItem.Term;

            CdrID = dataItem.ID.ToString();

            if (DictionaryLanguage == "es")
            {
                PageInstruction.AddFieldFilter("browser_title", (name, data) =>
                {
                    data.Value = "Definici&oacute;n de " + termName + " - Diccionario de c&aacute;ncer";
                });

                this.Page.Title = PageInstruction.GetField("short_title");

                DictionaryDefinitionHelper.SetMetaTagDescription(dataItem, DictionaryLanguage, PageInstruction);
            }
            else
            {
                PageInstruction.AddFieldFilter("browser_title", (name, data) =>
                {
                    data.Value = "Definition of " + termName + " - NCI Dictionary of Cancer Terms";
                });

                //CHANGE MADE BY CHRISTIAN RIKONG ON 12/08/2017 AT 11:47 AM
                DictionaryDefinitionHelper.SetMetaTagDescription(dataItem, DictionaryLanguage, PageInstruction);
            }

            PageInstruction.AddFieldFilter("meta_keywords", (name, data) =>
            {
                data.Value = termName + ", definition";
            });
        }
        private void ActivateDefinitionView(DictionaryTerm dataItem)
        {
            var myDataSource = new List <DictionaryTerm> {
                dataItem
            };

            termDictionaryDefinitionView.Visible    = true;
            termDictionaryDefinitionView.DataSource = myDataSource;
            termDictionaryDefinitionView.DataBind();

            string termName = dataItem.Term;

            CdrID = dataItem.ID.ToString();

            if (DictionaryLanguage == "es")
            {
                PageAssemblyContext.Current.PageAssemblyInstruction.AddFieldFilter("short_title", (name, data) =>
                {
                    data.Value = "Definici&oacute;n de " + termName + " - Diccionario de c&aacute;ncer";
                });

                this.Page.Header.Title = PageAssemblyContext.Current.PageAssemblyInstruction.GetField("short_title");
            }
            else
            {
                PageAssemblyContext.Current.PageAssemblyInstruction.AddFieldFilter("short_title", (name, data) =>
                {
                    data.Value = "Definition of " + termName + " - NCI Dictionary of Cancer Terms";
                });

                this.Page.Header.Title = PageAssemblyContext.Current.PageAssemblyInstruction.GetField("short_title");
            }

            DictionaryDefinitionHelper.SetMetaTagDescription(dataItem, DictionaryLanguage, PageInstruction);

            PageAssemblyContext.Current.PageAssemblyInstruction.AddFieldFilter("meta_keywords", (name, data) =>
            {
                data.Value = termName + ", definition";
            });
        }
        /// <summary>
        /// Set up the link to the definition's related drug information summary, if one exists.
        /// Sets up at most one related drug summary.
        /// </summary>
        /// <param name="dataItem">The DictionaryTerm item for the term being displayed.</param>
        private void SetupDrugInfoSummaryLink(Control parent, DictionaryTerm dataItem)
        {
            if (parent != null &&
                dataItem != null &&
                dataItem.HasRelatedItems &&
                dataItem.Related.DrugSummary != null &&
                dataItem.Related.DrugSummary.Length > 0)
            {
                // Only load data from the first item.
                RelatedDrugSummary drugSumamry = dataItem.Related.DrugSummary[0];

                // Find the dd tag containing the hyperlink.
                Control container = parent.FindControl("ddPatientInfo");

                // Find the actual hyperlink.
                HyperLink hlPatientInfo = (HyperLink)parent.FindControl("hlPatientInfo");
                if (container != null && hlPatientInfo != null)
                {
                    container.Visible         = true;
                    hlPatientInfo.NavigateUrl = drugSumamry.url;
                }
            }
        }
Example #13
0
        /// <summary>
        /// Get Term from Dictionary Service to be deserialized and returned to the app module
        /// </summary>
        /// <param name="termId">int of the CDR ID</param>
        /// <param name="dictionary">which dictionary is being passed through</param>
        /// <param name="language">English/Spanish term</param>
        /// <param name="version">the version of the dictionary service</param>
        /// <param name="audience">The Term's desired audience.
        ///     Supported values are:
        ///         Patient
        ///         HealthProfessional
        /// </param>
        /// <returns>the term deserialized and the meta data from the database</returns>
        public DictionaryTerm GetTerm(int termId, DictionaryType dictionary, String language, String version, AudienceType audience)
        {
            // Translate from types the AppManager exposes to types the Dictionary Service exposes.
            svcDictionaryType svcDictionary = TypeTranslator.Translate(dictionary);
            svcLanguage       svcLanguage   = TypeTranslator.TranslateLocaleString(language);
            svcAudienceType   svcAudience   = TypeTranslator.Translate(audience);

            //sets up Dictionary Service so methods can be called
            DictionaryService service = new DictionaryService();

            //Sets up the services return type so that the meta data can be transfered to this term return.

            NCI.Services.Dictionary.BusinessObjects.TermReturn termRet = null;
            try
            {
                termRet = service.GetTerm(termId, svcDictionary, svcLanguage, svcAudience);
            }
            catch (Exception ex)
            {
                log.Error("Error in Dictionary Web Service for Get Term.", ex);
            }

            //String of JSON returned from the Database to be deserialized.
            DictionaryTerm dicTerm = null;

            try
            {
                //deserialize term details as returned by the service layer (termret.term)
                dicTerm = JsonConvert.DeserializeObject <DictionaryTerm>(termRet.Term);
            }
            catch (JsonReaderException ex)
            {
                log.Error("Error in Json string from service.", ex);
            }

            return(dicTerm);
        }
Example #14
0
        /// <summary>
        /// this is to utilize shared code between search and expand as they return the same objects and do the same action
        /// </summary>
        /// <param name="list">the string list that the dictionary service would return</param>
        /// <returns>deserialized list of DictionarySearchResults</returns>
        private List <DictionarySearchResult> DeserializeList(NCI.Services.Dictionary.BusinessObjects.DictionarySearchResultEntry[] list, svcDictionaryType dictionaryType)
        {
            List <DictionarySearchResult> returnList = new List <DictionarySearchResult>();;

            foreach (NCI.Services.Dictionary.BusinessObjects.DictionarySearchResultEntry m in list)
            {
                try
                {
                    int            id       = m.ID;
                    string         termName = m.MatchedTerm;
                    DictionaryTerm term     = JsonConvert.DeserializeObject <DictionaryTerm>(m.TermDetail);

                    DictionarySearchResult expansion = new DictionarySearchResult(id, termName, term);
                    returnList.Add(expansion);
                }
                catch (JsonReaderException ex)
                {
                    log.ErrorFormat("Error in Json string from service.\nDictionary: {0}\nTerm ID: {1}\nTerm Name: {2}",
                                    ex, dictionaryType, m.ID, m.MatchedTerm);
                }
            }

            return(returnList);
        }
Example #15
0
        /*// Set the URL Translation Filter
         * private void SetupUrlTranslationFilter(string name, NciUrl url)
         * {
         *  url.SetUrl(url.ToString() + "/def/" + GetCDRIDForLanguageToggle());
         * }*/

        protected void termDictionaryDefinitionView_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                //get the TermReturn object that is bound to the current row.
                DictionaryTerm termDetails = (DictionaryTerm)e.Item.DataItem;

                if (termDetails != null)
                {
                    PlaceHolder phPronunciation = (PlaceHolder)e.Item.FindControl("phPronunciation");
                    if (termDetails.HasPronunciation && phPronunciation != null)
                    {
                        phPronunciation.Visible = true;
                        System.Web.UI.HtmlControls.HtmlAnchor pronunciationLink = (System.Web.UI.HtmlControls.HtmlAnchor)e.Item.FindControl("pronunciationLink");
                        if (pronunciationLink != null && termDetails.Pronunciation.HasAudio)
                        {
                            pronunciationLink.Visible = true;
                            pronunciationLink.HRef    = termDetails.Pronunciation.Audio;
                        }
                        else
                        {
                            pronunciationLink.Visible = false;
                        }

                        Literal pronunciationKey = (Literal)e.Item.FindControl("pronunciationKey");
                        if (pronunciationKey != null && termDetails.Pronunciation.HasKey)
                        {
                            pronunciationKey.Text = " " + termDetails.Pronunciation.Key;
                        }
                    }
                    else
                    {
                        phPronunciation.Visible = false;
                    }

                    //Get Related Information from the Manager layer
                    //Add check to see if it exists and then display data accordingly
                    Panel pnlRelatedInfo = e.Item.FindControl("pnlRelatedInfo") as Panel;
                    if (pnlRelatedInfo != null)
                    {
                        //display the related information panel
                        //when atleast one of the related item exists
                        if (termDetails.Related.Term.Length > 0 ||
                            termDetails.Related.Summary.Length > 0 ||
                            termDetails.Related.DrugSummary.Length > 0 ||
                            termDetails.Related.External.Length > 0 ||
                            termDetails.Images.Length > 0)
                        {
                            pnlRelatedInfo.Visible = true;
                            Literal litMoreInformation = e.Item.FindControl("litMoreInformation") as Literal;
                            if (litMoreInformation != null)
                            {
                                //don't display more information text when only images are being displayed
                                if (termDetails.Related.Term.Length > 0 ||
                                    termDetails.Related.Summary.Length > 0 ||
                                    termDetails.Related.DrugSummary.Length > 0 ||
                                    termDetails.Related.External.Length > 0)
                                {
                                    litMoreInformation.Visible = true;
                                    if (DictionaryLanguage == "es")
                                    {
                                        litMoreInformation.Text = "M&aacute;s informaci&oacute;n";
                                    }
                                    else
                                    {
                                        litMoreInformation.Text = "More Information";
                                    }
                                }
                                else
                                {
                                    litMoreInformation.Visible = false;
                                }
                            }

                            if (termDetails.Related.External.Length > 0)
                            {
                                Repeater relatedExternalRefs = (Repeater)e.Item.FindControl("relatedExternalRefs");
                                if (relatedExternalRefs != null)
                                {
                                    relatedExternalRefs.Visible    = true;
                                    relatedExternalRefs.DataSource = termDetails.Related.External;
                                    relatedExternalRefs.DataBind();
                                }
                            }

                            if (termDetails.Related.Summary.Length > 0)
                            {
                                Repeater relatedSummaryRefs = (Repeater)e.Item.FindControl("relatedSummaryRefs");
                                if (relatedSummaryRefs != null)
                                {
                                    relatedSummaryRefs.Visible    = true;
                                    relatedSummaryRefs.DataSource = termDetails.Related.Summary;
                                    relatedSummaryRefs.DataBind();
                                }
                            }

                            if (termDetails.Related.DrugSummary.Length > 0)
                            {
                                Repeater relatedDrugInfoSummaries = (Repeater)e.Item.FindControl("relatedDrugInfoSummaries");
                                if (relatedDrugInfoSummaries != null)
                                {
                                    relatedDrugInfoSummaries.Visible    = true;
                                    relatedDrugInfoSummaries.DataSource = termDetails.Related.DrugSummary;
                                    relatedDrugInfoSummaries.DataBind();
                                }
                            }

                            if (termDetails.Related.Term.Length > 0)
                            {
                                RelatedTermCount = termDetails.Related.Term.Length;
                                PlaceHolder phRelatedTerms = (PlaceHolder)e.Item.FindControl("phRelatedTerms");
                                if (phRelatedTerms != null)
                                {
                                    phRelatedTerms.Visible = true;
                                    Label labelDefintion = (Label)e.Item.FindControl("labelDefintion");
                                    if (labelDefintion != null)
                                    {
                                        if (DictionaryLanguage == "es")
                                        {
                                            labelDefintion.Text = "Definici&oacute;n de:";
                                        }
                                        else
                                        {
                                            labelDefintion.Text = "Definition of:";
                                        }
                                    }
                                    Repeater relatedTerms = (Repeater)e.Item.FindControl("relatedTerms");
                                    if (relatedTerms != null)
                                    {
                                        relatedTerms.DataSource = termDetails.Related.Term;
                                        relatedTerms.DataBind();
                                    }
                                }
                            }

                            Repeater relatedImages = (Repeater)e.Item.FindControl("relatedImages");
                            if (relatedImages != null)
                            {
                                if (termDetails.Images.Length > 0)
                                {
                                    relatedImages.Visible    = true;
                                    relatedImages.DataSource = termDetails.Images;
                                    relatedImages.DataBind();
                                }
                            }

                            Repeater relatedVideos = (Repeater)e.Item.FindControl("relatedVideos");
                            if (relatedVideos != null)
                            {
                                if (termDetails.HasVideos && termDetails.Videos.Length > 0)
                                {
                                    relatedVideos.Visible    = true;
                                    relatedVideos.DataSource = termDetails.Videos;
                                    relatedVideos.DataBind();
                                }
                            }
                        }
                        else
                        {
                            pnlRelatedInfo.Visible = false;
                        }
                    }
                }
            }
        }
Example #16
0
 public bool VisitTerm(DictionaryTerm term)
 {
     PrintConsole(ConsoleColor.Gray, $"{term.Key} -> {index.GetPostingList(term.Key).ToString()}");
     return(true);
 }
Example #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string input_term;

            if (PageAssemblyContext.Current.DisplayVersion == DisplayVersions.Web)
            {
                urlArgs    = Request.Url.Query.Substring(1);
                input_term = Strings.Clean(Request.Params["term"]);
                CdrID      = Strings.IfNull(Strings.Clean(Request.Params["id"]), Strings.Clean(Request.Params["cdrid"]));
                AudienceType   audience   = GetAudienceType(Strings.Clean(Request.Params["version"]));
                DictionaryType dictionary = GetDictionaryType(Strings.Clean(Request.Params["dictionary"]));

                if (Request.QueryString["language"] == "Spanish")
                {
                    dictionaryLanguage        = "es";
                    logoAnchor.HRef           = "/espanol";
                    logoImage.Alt             = "Instituto Nacional Del Cáncer";
                    logoImage.Src             = "/publishedcontent/images/images/design-elements/logos/nci-logo-full-es.svg";
                    closeWindowText.InnerText = "Cerrar";
                    definitionLabel.Text      = "Definición:";
                }
                else
                {
                    logoAnchor.HRef           = "/";
                    logoImage.Alt             = "National Cancer Institute";
                    logoImage.Src             = "/publishedcontent/images/images/design-elements/logos/nci-logo-full.svg";
                    closeWindowText.InnerText = "Close Window";
                    definitionLabel.Text      = "Definition:";
                }

                //load the definition
                DictionaryAppManager _dictionaryAppManager = new DictionaryAppManager();

                DictionaryTerm dataItem = null;

                if (!string.IsNullOrEmpty(CdrID))
                {
                    CdrID = Regex.Replace(CdrID, "^CDR0+", "", RegexOptions.Compiled);

                    // call appropriate method if dictionary type is known
                    if (dictionary == DictionaryType.Unknown)
                    {
                        dataItem = _dictionaryAppManager.GetTermForAudience(Convert.ToInt32(CdrID), dictionaryLanguage, "v1", audience);
                    }
                    else
                    {
                        dataItem = _dictionaryAppManager.GetTerm(Convert.ToInt32(CdrID), dictionary, dictionaryLanguage, "v1", audience);
                    }
                }

                if (dataItem != null && dataItem.Term != null)
                {
                    ActivateDefinitionView(dataItem);
                }
                else
                {
                    phDefinition.Visible = false;
                    phNoResult.Visible   = true;
                }

                // Web Analytics *************************************************
                WebAnalyticsPageLoad webAnalyticsPageLoad = new WebAnalyticsPageLoad();

                if (dictionaryLanguage == "es")
                {
                    webAnalyticsPageLoad.SetChannel("Diccionario de cancer (Dictionary of Cancer Terms)");
                    webAnalyticsPageLoad.SetLanguage("es");
                }
                else
                {
                    webAnalyticsPageLoad.SetChannel("Dictionary of Cancer Terms");
                    webAnalyticsPageLoad.SetLanguage("en");
                }
                webAnalyticsPageLoad.AddEvent(WebAnalyticsOptions.Events.event11); // Dictionary Term view (event11)
                litOmniturePageLoad.Text = webAnalyticsPageLoad.Tag();             // Load page load script
                // End Web Analytics *********************************************
            }
        }
Example #18
0
 public bool VisitTerm(DictionaryTerm term)
 {
     PrintConsole(ConsoleColor.Gray, $"{term.Key} -> {string.Join(", ", index.PostingLists.Get(term.Value))}");
     ++Terms;
     return(true);
 }