// Sets the current page to not index for SEO
 private void SetDoNotIndex()
 {
     PageInstruction.AddFieldFilter("meta_robots", (name, data) =>
     {
         data.Value = "noindex, nofollow";
     });
 }
        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;
            }
        }
Example #3
0
        private void SetupFieldAndUrlFilters(ClinicalTrial trial)
        {
            // Copying the Title & Short Title logic from Advanced Form
            //set the page title as the protocol title
            PageInstruction.AddFieldFilter("long_title", (fieldName, data) =>
            {
                data.Value = trial.BriefTitle;
            });

            PageInstruction.AddFieldFilter("short_title", (fieldName, data) =>
            {
                data.Value = trial.BriefTitle;

                //Eh, When would this happen???
                if (!string.IsNullOrWhiteSpace(trial.NCTID))
                {
                    data.Value += " - " + trial.NCTID;
                }
            });


            PageInstruction.AddFieldFilter("meta_description", (fieldname, data) =>
            {
                data.Value = trial.BriefTitle;
            });



            PageInstruction.AddUrlFilter("CurrentUrl", (name, url) =>
            {
                //Copy the params
                //TODO: Really determine what to do with these params.  If the search is invalid, we probably
                //hsould not show them all.
                foreach (KeyValuePair <string, string> param in this.ParsedReqUrlParams.QueryParameters)
                {
                    url.QueryParameters.Add(param.Key, param.Value);
                }
            });

            PageInstruction.AddUrlFilter("CanonicalUrl", (name, url) =>
            {
                // only the id should be provided for the canonical URL, so clear all query parameters and
                // then add back id
                url.QueryParameters.Clear();
                url.QueryParameters.Add("id", trial.NCIID);
                //url.QueryParameters.Add("id", TrialID);
            });

            // Override the social media URL (og:url)
            PageInstruction.AddFieldFilter("og:url", (fieldName, data) =>
            {
                //Ok, this is weird, but...  The OpenGraph URL is actually a field. It kind of makes sense,
                //and it kind of does not.  Really it should be a field that gets the og:url instead of the
                //pretty URL.
                //BUt here we are, and it is what we have.  So let's replace the og:url with the canonical URL.

                data.Value = PageInstruction.GetUrl(NCI.Web.CDE.PageAssemblyInstructionUrls.CanonicalUrl).ToString();
            });
        }
Example #4
0
        /// <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>
        private void SetMetaTagDescription(DictionaryTerm dataItem, string DictionaryLanguage)
        {
            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 + ". ";
                        }
                        else
                        {
                            break;
                        }
                    }

                    PageInstruction.AddFieldFilter("meta_description", (name, data) =>
                    {
                        data.Value = sentences;
                    });
                }
                else
                {
                    SetMetaTagDescriptionToTerm(PageInstruction, termName, DictionaryLanguage);
                }
            }
            else
            {
                SetMetaTagDescriptionToTerm(PageInstruction, termName, DictionaryLanguage);
            }
        }
Example #5
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";
            });
        }
Example #6
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            fillFormattedDate();

            //set the page title as the protocol title
            PageInstruction.AddFieldFilter("long_title", (fieldName, data) =>
            {
                if (formattedDate == String.Empty)
                {
                    data.Value = String.Format((PageInstruction.Language == "es" ? espanolArchiveFormat : englishArchiveFormat),
                                               (String.IsNullOrEmpty(PageInstruction.GetField("short_title")) ? data.Value : PageInstruction.GetField("short_title")));
                }
                else
                {
                    data.Value = String.Format((PageInstruction.Language == "es" ? espanolDateFormat : englishDateFormat),
                                               (String.IsNullOrEmpty(PageInstruction.GetField("short_title")) ? data.Value : PageInstruction.GetField("short_title")), formattedDate);
                }
            });
        }