예제 #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (this.BlogSearchList == null)
            {
                this.BlogSearchList = ModuleObjectFactory <BlogSearchList> .GetModuleObject(SnippetInfo.Data);
            }


            processData();
        }
예제 #2
0
        public static BestBetUIResult[] GetBestBets(string searchTerm, DisplayLanguage lang)
        {
            List <BestBetUIResult> rtnResults = new List <BestBetUIResult>();

            //Note, new NCI.Search.BestBets.BestBetsManager will clean terms for us, so we
            //do not have to worry about that.

            string twoCharLang = string.Empty; //To search all, pass in string.empty

            if (lang == DisplayLanguage.Spanish)
            {
                twoCharLang = "es";
            }
            else
            {
                twoCharLang = "en";
            }

            //TODO: Language!!!!
            //NOTE: This can throw an exception - in the past we left it unhandled.  That is stupid, because
            //we log other errors.  Put that logging here!
            BestBetResult[] rawResults = BestBetsManager.Search(searchTerm, twoCharLang);


            //Loop through the cats and get the list items.
            foreach (BestBetResult res in rawResults)
            {
                try
                {
                    if (string.IsNullOrEmpty(res.CategoryID))
                    {
                        log.Warn("GetBestBets(): category id is null/empty");
                        continue;
                    }

                    string bbResFileName = String.Format(ContentDeliveryEngineConfig.PathInformation.BestBetsResultPath.Path, res.CategoryID);

                    BestBetUIResult bbResult = ModuleObjectFactory <BestBetUIResult> .GetObjectFromFile(bbResFileName);

                    if (bbResult != null && bbResult.Display)
                    {
                        rtnResults.Add(bbResult);
                    }
                }
                catch (Exception ex)
                {
                    // The bestbet result xml file may not always be there, so catch the exception and log the error
                    // and ignore the exception
                    log.WarnFormat("GetBestBets(): could not find bb result for category id {0} Category name {1}", ex, res.CategoryID, res.CategoryName);
                }
            }

            return(rtnResults.ToArray());
        }
예제 #3
0
        public void Page_Load(object sender, EventArgs e)
        {
            // FIX THIS COMMENT
            BasePageAssemblyInstruction basePage = PageAssemblyContext.Current.PageAssemblyInstruction as BasePageAssemblyInstruction;

            if (basePage == null)
            {
                return;
            }
            bool isCommentingAvailable = Strings.ToBoolean(PageAssemblyContext.Current.PageAssemblyInstruction.GetField("is_commenting_available"), false, false);

            log.DebugFormat("Page_Load(): SocialMetadata isCommentingAvailable value is {0}", isCommentingAvailable);
            // if commenting is not available, then done with processing
            if (!isCommentingAvailable)
            {
                return;
            }
            // initialize the control
            theControl = new IntenseDebateControl();
            // load the account from settings
            IntenseDebateCommentsSettings intenseDebateCommentsSettings = ModuleObjectFactory <IntenseDebateCommentsSettings> .GetModuleObject(SnippetInfo.Data);

            if (intenseDebateCommentsSettings != null)
            {
                string account = intenseDebateCommentsSettings.DevAccount;
                // do not configure the control if no account available
                if (String.IsNullOrEmpty(intenseDebateCommentsSettings.DevAccount) || String.IsNullOrEmpty(intenseDebateCommentsSettings.LiveAccount))
                {
                    theControl.Dispose();
                    theControl = null;
                    return;
                }
                // check if the site is in production
                bool isProd = PageAssemblyContext.Current.IsProd;
                // append a shortname prefix based on the production state
                theControl.Account = (isProd ? intenseDebateCommentsSettings.LiveAccount : intenseDebateCommentsSettings.DevAccount);
            }
            // add the control
            this.Controls.Add(theControl);
            // begin setting the control's properties
            // identifer
            string contentType = basePage.ContentItemInfo.ContentItemType;
            string contentId   = basePage.ContentItemInfo.ContentItemID;

            theControl.Identifier = contentType + "-" + contentId;
            // split based on multipage or singlepage
            theControl.Title = PageAssemblyContext.Current.PageAssemblyInstruction.GetField("short_title");
            theControl.URL   = HttpContext.Current.Request.Url.Scheme
                               + "://"
                               + HttpContext.Current.Request.Url.Authority
                               + PageAssemblyContext.Current.PageAssemblyInstruction.GetUrl("PrettyUrl");
            theControl.CommentPolicyText = intenseDebateCommentsSettings.CommentPolicy;
        }
예제 #4
0
        public void Page_Load(object sender, EventArgs e)
        {
            SearchBoxSettings searchBoxSettings = ModuleObjectFactory <SearchBoxSettings> .GetModuleObject(SnippetInfo.Data);

            if (searchBoxSettings != null)
            {
                this.Title                = searchBoxSettings.Title;
                this.ActionURL            = searchBoxSettings.ActionUrl;
                this.WebAnalyticsFunction = searchBoxSettings.WebAnalyticsFunction;
                this.SearchType           = searchBoxSettings.SearchType;
            }
        }
예제 #5
0
        /// <summary>
        /// Identify the Templates on the Page. For each template add the Snippet info objects.
        /// </summary>
        /// <param name="e">Not Used</param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            loadTemplateSlots();
            loadSnippetsIntoTemplateSlots();

            string snippetXmlData = this.SnippetInfo.Data;

            snippetXmlData = snippetXmlData.Replace("]]ENDCDATA", "]]>");
            _subLayoutInfo = ModuleObjectFactory <SublayoutInfo> .GetModuleObject(snippetXmlData);

            this.AddFieldFilter("sublayout_title", (name, data) =>
            {
                data.Value = this.Title;
            });
        }
예제 #6
0
        public void Page_Load(object sender, EventArgs e)
        {
            // FIX THIS COMMENT
            SinglePageAssemblyInstruction basePage = PageAssemblyContext.Current.PageAssemblyInstruction as SinglePageAssemblyInstruction;

            if (basePage == null)
            {
                return;
            }

            BlogSeriesArchiveSettings blogSeriesArchiveSettings = ModuleObjectFactory <BlogSeriesArchiveSettings> .GetModuleObject(SnippetInfo.Data);

            // initialize the control
            var    language     = PageAssemblyContext.Current.PageAssemblyInstruction.Language;
            string years        = blogSeriesArchiveSettings.Years;
            string groupBy      = blogSeriesArchiveSettings.GroupBy;
            string blogMainPage = blogSeriesArchiveSettings.BlogMainPage;
            string blogSeriesId = "Blog Series-" + blogSeriesArchiveSettings.BlogSeriesId;

            theControl = new BlogSeriesArchiveControl(language, groupBy, blogMainPage);

            // load the shortname from settings

            if (blogSeriesArchiveSettings != null)
            {
                // do not configure the control if no shortname available
                if (String.IsNullOrEmpty(years))
                {
                    return;
                }
            }

            var results = BlogArchiveDataManager.Execute(blogSeriesId, Int32.Parse(years));

            theControl.results = results;

            // add the control
            this.Controls.Add(theControl);
        }
예제 #7
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            //Get Settings
            if (Request.RequestType == "POST")
            {
            }
            else
            {
                //The method was a GET, therfore we must be paging.
                _currentPage    = Strings.ToInt(Request.Params["PageNum"], 1);
                _recordsPerPage = Strings.ToInt(Request.Params["RecordsPerPage"], 10);
                _offSet         = Strings.ToInt(Request.Params["OffSet"], 0);
            }

            if (PerformSearch)
            {
                if (Keyword != null)
                {
                    //Store keyword in viewstate (This does not check if it is not there already)
                    if (ViewState[swKeyword] == null)
                    {
                        ViewState.Add(swKeyword, Keyword);
                    }
                    else
                    {
                        ViewState[swKeyword] = Keyword;
                    }

                    //set up the search collection
                    //determine what text needs to be removed from the title e.g. - National Cancer Institute
                    SiteWideSearchConfig searchConfig = ModuleObjectFactory <SiteWideSearchConfig> .GetModuleObject(SnippetInfo.Data);

                    if (searchConfig != null)
                    {
                        SearchCollection = searchConfig.SearchCollection;
                        ResultTitleText  = searchConfig.ResultTitleText;
                    }

                    try
                    {
                        long dimFilter = Strings.ToLong(ConfigurationManager.AppSettings["EndecaSWSearchDimFilter"], 0);

                        ISiteWideSearchResultCollection results = NCI.Search.SiteWideSearch.GetSearchResults(SearchCollection, Keyword, _recordsPerPage,
                                                                                                             (_currentPage - 1) * _recordsPerPage);

                        rptSearchResults.DataSource = results;
                        rptSearchResults.DataBind();

                        if (results.ResultCount == 0)
                        {
                            ResultsText = "No results found";
                            rptSearchResults.Visible = false;
                        }
                        else
                        {
                            int startRecord = 0;
                            int endRecord   = 0;
                            _resultsFound = true;
                            SimplePager.GetFirstItemLastItem(_currentPage, _recordsPerPage, (int)results.ResultCount, out startRecord, out endRecord);

                            //phNoResultsLabel.Visible = false;
                            rptSearchResults.Visible = true;
                            string resultsCount = String.Format("{0}-{1} of {2}", startRecord.ToString(), endRecord.ToString(), results.ResultCount.ToString());
                            ResultsText = "Results " + resultsCount;
                        }

                        spPager.RecordCount    = (int)results.ResultCount;
                        spPager.RecordsPerPage = _recordsPerPage;
                        spPager.CurrentPage    = _currentPage;
                        spPager.BaseUrl        = PrettyUrl + "?swKeywordQuery=" + Keyword;
                    }
                    catch (Exception ex)
                    {
                        //capture exactly which keyword caused the error
                        log.ErrorFormat("Search with the following keyword returned an error: {0}", ex, Keyword);
                    }
                }
                else
                {
                    ResultsText = "No results found";
                    rptSearchResults.Visible = false;
                }
            }
            else
            {
                ResultsText = String.Empty;
            }
        }
예제 #8
0
        /// <summary>
        /// Builds the index.
        /// </summary>
        private void BuildIndex()
        {
            //Building the index should require a lock.  If a lock has NOT been obtained, let's assume
            //that someone else is building the index and we should be done with things.
            if (Monitor.TryEnter(_indexLock))
            {
                try
                {
                    //Define our custom Analyzer for analyzing text fields for our index.
                    Analyzer analyzer = new BestBetsAnalyzer(global::Lucene.Net.Util.Version.LUCENE_30);

                    //Create instance of an IndexWriter
                    IndexWriter writer = new IndexWriter(_luceneIndex, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);

                    //Clear out the docs
                    writer.DeleteAll();

                    foreach (string bbFilePath in System.IO.Directory.EnumerateFiles(_bestBetsPath, "*.xml"))
                    {
                        BestBetCategory bbcat = ModuleObjectFactory <BestBetCategory> .GetObjectFromFile(bbFilePath);

                        //Clean up the language as it is the localized version
                        string twoLetterISOLanguageName = bbcat.Language;
                        if (twoLetterISOLanguageName.Length >= 2)
                        {
                            twoLetterISOLanguageName = twoLetterISOLanguageName.Substring(0, 2);
                        }
                        else
                        {
                            twoLetterISOLanguageName = "en";
                        }

                        //We will basically index each synonym as an idividual record, with the category information
                        //"duplicated" on each record.

                        PushToIndex(writer, bbcat.CategoryId.ToString(), bbcat.CategoryName, bbcat.CategoryName, false, bbcat.IsExactMatch, twoLetterISOLanguageName);

                        foreach (BestBetSynonym syn in bbcat.IncludeSynonyms)
                        {
                            PushToIndex(writer, bbcat.CategoryId.ToString(), bbcat.CategoryName, syn.Text, false, syn.IsExactMatch, twoLetterISOLanguageName);
                        }

                        foreach (BestBetSynonym syn in bbcat.ExcludeSynonyms)
                        {
                            PushToIndex(writer, bbcat.CategoryId.ToString(), bbcat.CategoryName, syn.Text, true, syn.IsExactMatch, twoLetterISOLanguageName);
                        }
                    }

                    //Commit the changes to the index.
                    writer.Commit();
                }
                finally
                {
                    Monitor.Exit(_indexLock);
                }
            }
            else
            {
                //TODO: Log debug statement that we are skipping indexing.  This may be due to another
                //job running an index.  This condition should not happen often.
                log.Info("BestBetsIndex lock obtained by other thread, skipping indexing.");
            }
        }
        /// <summary>
        /// Helper method to load configuration info based on DictionariesInfo appsetting path.
        /// </summary>
        /// <returns></returns>
        public static DictionariesInfo GetDictionariesInfo()
        {
            string configPath = ConfigurationManager.AppSettings["DictionariesConfigFilePath"];

            return((DictionariesInfo)ModuleObjectFactory <DictionariesInfo> .GetObjectFromFile(configPath));
        }
예제 #10
0
        /// <summary>
        /// Process the page options information in the xml and creates
        /// the page options items.
        /// </summary>
        /// <param name="snippetXmlData">The xml fragment which contains pageoptions information.</param>
        private void processPageOptionsData(string snippetXmlData)
        {
            // The snippet CDATA may contain CDATA as part of the data but percussion replaces the CDATA
            // close tag with Replace ']]>' with ']]ENDCDATA' this ']]ENDCDATA' should be replaced with
            // valid CDATA close tag ']]>' before it can be deserialized
            snippetXmlData = snippetXmlData.Replace("]]ENDCDATA", "]]>");

            IPageAssemblyInstruction pgInstruction = PageAssemblyContext.Current.PageAssemblyInstruction;

            // If AlternateContentVersions information is not in the instructions then do not create
            // the PageOptions box.
            string[] acvKeys = pgInstruction.AlternateContentVersionsKeys;

            if (acvKeys != null)
            {
                Module_PageOptionsBox mPBO = ModuleObjectFactory <Module_PageOptionsBox> .GetModuleObject(snippetXmlData);

                if (mPBO != null)
                {
                    // Create the Page Options box control.
                    PageOptionsBox pageOptionsBox = new PageOptionsBox();
                    pageOptionsBox.BoxTitle = mPBO.Title;
                    pageOptionsBox.CssClass = "po-box";

                    foreach (PageOption pgOptionItem in mPBO.PageOptions)
                    {
                        try
                        {
                            // Check if the Pageoptions are recognized in the Alternate Content Version keys
                            string key = pgOptionItem.Key;

                            if (!string.IsNullOrEmpty(key))
                            {
                                key = key.ToLower();
                            }

                            if (acvKeys.Contains <string>(key))
                            {
                                NCI.Web.UI.WebControls.PageOption pgoBase = null;

                                if (String.Compare(pgOptionItem.OptionType, PageOptionType.Link.ToString()) == 0)
                                {
                                    pgoBase = new LinkPageOption();
                                    ((LinkPageOption)pgoBase).OnClick = pgOptionItem.WebAnalyticsFunction;
                                    ((LinkPageOption)pgoBase).Href    = pgInstruction.GetUrl(key).ToString();
                                }
                                else if (String.Compare(pgOptionItem.OptionType, PageOptionType.Email.ToString()) == 0)
                                {
                                    pgoBase = new LinkPageOption();
                                    ((LinkPageOption)pgoBase).Href     = pgInstruction.GetUrl("email").ToString();
                                    ((LinkPageOption)pgoBase).OnClick  = pgOptionItem.WebAnalyticsFunction;
                                    ((LinkPageOption)pgoBase).OnClick += " " + "dynPopWindow('" + ((LinkPageOption)pgoBase).Href.Replace("'", "%27").Replace("(", "%28").Replace(")", "%29") + "', 'emailPopUp', 'height=525,width=492'); return false;";
                                }
                                else if (String.Compare(pgOptionItem.OptionType, PageOptionType.BookMarkShare.ToString()) == 0)
                                {
                                    pgoBase = new AddThisPageOption();
                                    ((AddThisPageOption)pgoBase).Settings.Language = pgInstruction.Language;
                                    //((AddThisPageOption)pgoBase).PageTitle = pgInstruction.GetField("long_description").ToString();  //pgInstruction.GetUrl("BookMarkShareUrl").ToString();
                                    ((AddThisPageOption)pgoBase).PageTitle = pgInstruction.GetField("long_title").ToString();
                                    ((AddThisPageOption)pgoBase).OnClick   = pgOptionItem.WebAnalyticsFunction;
                                }

                                if (pgoBase != null)
                                {
                                    pgoBase.CssClass = pgOptionItem.CssClass;
                                    pgoBase.LinkText = pgOptionItem.LinkText;
                                    pageOptionsBox.PageOptions.Add(pgoBase);
                                }
                            }
                        }
                        catch
                        {
                            //TODO, log exception
                        }
                    }

                    if (pageOptionsBox.PageOptions.Count > 0)
                    {
                        this.Controls.Add(pageOptionsBox);
                    }
                }
            }
        }
예제 #11
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            string searchType = Strings.Clean(Request.Params["cbsubmit"]);
            int    startMonth = Strings.ToInt(Strings.Clean(Request.Params["startMonth"]));
            int    startYear  = Strings.ToInt(Strings.Clean(Request.Params["startYear"]));
            int    endMonth   = Strings.ToInt(Strings.Clean(Request.Params["endMonth"]));
            int    endYear    = Strings.ToInt(Strings.Clean(Request.Params["endYear"]));

            keyword = Strings.Clean(Request.Params["cbkeyword"]);
            int  currentPage  = Strings.ToInt(Strings.Clean(Request.Params["page"]));
            bool bSearchRange = false;

            if (Page.Request.HttpMethod == "POST")
            {
                bSearchRange = (Request.Params["searchRangeButton"] != null);
            }
            else
            {
                bSearchRange = (searchType != null && string.Compare(searchType, "range", true) == 0);
            }



            firstRecord = 0;
            lastRecord  = 0;
            totalItems  = 0;

            if (currentPage < 0)
            {
                currentPage = 1;
            }
            int pageSize = 10;

            if (keyword == null)
            {
                resultsHtml = "<br><br>Please enter a search phrase.<br><br><br>";
            }
            else
            {
                firstRecord = (currentPage - 1) * pageSize + 1;
                recordIndex = firstRecord;

                //set up the search collection
                //determine what text needs to be removed from the title e.g. - National Cancer Institute
                SiteWideSearchConfig searchConfig = ModuleObjectFactory <SiteWideSearchConfig> .GetModuleObject(SnippetInfo.Data);

                if (searchConfig != null)
                {
                    SearchCollection = searchConfig.SearchCollection;
                    ResultTitleText  = searchConfig.ResultTitleText;
                }

                ISiteWideSearchResultCollection results;
                try
                {
                    results = NCI.Search.SiteWideSearch.GetSearchResults(SearchCollection, Keyword, pageSize,
                                                                         (currentPage - 1) * pageSize);

                    if (results != null && results.ResultCount > 0)
                    {
                        lastRecord = firstRecord + (int)results.ResultCount - 1;
                        totalItems = (int)results.ResultCount;

                        ResultRepeater.DataSource = results;
                        ResultRepeater.DataBind();

                        //pager code
                        string urlFormat;
                        string pagerUrl;
                        if (bSearchRange)
                        {
                            urlFormat = PrettyUrl + "?cbsubmit=range&cbkeyword={0}&startMonth={1}&startYear={2}&endMonth={3}&endYear={4}";
                            pagerUrl  = String.Format(urlFormat, Server.UrlEncode(keyword), startMonth.ToString(), startYear.ToString(), endMonth.ToString(), endYear.ToString());
                        }
                        else
                        {
                            urlFormat = PrettyUrl + "?cbkeyword={0}";
                            pagerUrl  = String.Format(urlFormat, Server.UrlEncode(keyword));
                        }

                        ResultPager objPager = new ResultPager(pagerUrl, currentPage, pageSize, 2, totalItems);
                        pager = objPager.RenderPager();
                    }
                    else
                    {
                        firstRecord = 0;
                    }
                }
                catch (Exception ex)
                {
                    //capture exactly which keyword caused the error
                    log.ErrorFormat("{0} - Search with the following keyword returned an error: {1}", ex, PrettyUrl, Keyword);
                    this.RaiseErrorPage();
                }


                //eSearch.FillSearchResults(eSearchResults);
            }

            this.PageInstruction.AddFieldFilter("channelName", (fieldName, data) =>
            {
                data.Value = "Newsletter";
            });
        }
예제 #12
0
        /// <summary>
        /// Implement OnLoad Event to handle fetching of results.
        /// Prevents derrived classes from implementing.
        /// </summary>
        /// <param name="e"></param>
        sealed protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // Step 1. Load config from App Module Page content item
            // Set Dictionary Mapping Filepath according to current language
            this.DictionaryConfig = ModuleObjectFactory <DictionaryConfig> .GetModuleObject(this.SnippetInfo.Data);

            //Step 2. Parse URL and pull out q, expand, and contains parameters for new URL syntax
            this.SetupUrls();

            String searchString = Strings.Clean(Request.QueryString["q"]);
            // default results to 'A' if no term chosen
            String expand = Strings.Clean(Request.QueryString["expand"], "A");
            // String language = Strings.Clean(Request.QueryString["language"]);
            String contains = Strings.Clean(Request.QueryString["contains"], "false");
            String first    = Strings.Clean(Request.QueryString["first"]);
            String page     = Strings.Clean(Request.QueryString["page"]);

            // Step 3. Get URL query parameters for expand and handling old URL syntax
            String legacySearchString = Strings.Clean(Request.QueryString["search"]);
            String legacyCdrId        = Strings.Clean(Request.QueryString["cdrid"]);
            String legacyId           = Strings.Clean(Request.QueryString["id"]);

            // Step 4. Load control depending on URL and path
            // Path is either /search?q=<term> or /def/<term or code>
            // Old URLs (?search=, ?cdrid=, ?id=, ?expand= get redirected or handled
            BaseDictionaryControl dictionaryControl = null;

            List <string> route = this.CurrAppPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries).ToList <string>();

            for (int i = 0; i < route.Count; i++)
            {
                route[i] = Strings.Clean(route[i]);
            }

            if (route.Count > 0)
            {
                if (route[0].Equals("search") || route[0].Equals("buscar"))
                {
                    // If path is /search, load the ResultsList control
                    dictionaryControl = LoadResultsListControl();
                }
                else if (route[0].Equals("def"))
                {
                    // If path is /def, load DefinitionView control
                    string friendlyName = GetFriendlyName(route[1]);
                    if (!string.IsNullOrEmpty(friendlyName))
                    {
                        RedirectToDefinitionView(friendlyName);
                    }
                    else
                    {
                        dictionaryControl = LoadDefinitionViewControl();
                    }
                }
                else if (route.Count > 2)
                {
                    // If path extends further than /search or /def/<term>, raise a 400 error
                    NCI.Web.CDE.Application.ErrorPageDisplayer.RaisePageByCode("Dictionary", 400, "Invalid parameters for dictionary");
                }
            }
            else if (!String.IsNullOrEmpty(legacySearchString))
            {
                // redirect to new search URL using searchString as term
                RedirectToResultsList(legacySearchString, contains, first, page);
            }
            else if (!String.IsNullOrEmpty(legacyCdrId))
            {
                // redirect to new view URL using cdrId
                // check for friendly name
                RedirectToDefinitionView(legacyCdrId);
            }
            else if (!String.IsNullOrEmpty(legacyId))
            {
                // redirect to new view URL using cdrId or id
                // check for friendly name
                RedirectToDefinitionView(legacyId);
            }
            else if (dictionaryControl == null && !String.IsNullOrEmpty(expand))
            {
                dictionaryControl = LoadExpandListControl();
            }
            else
            {
                dictionaryControl = LoadExpandListControl();
            }

            // Add control to page
            if (dictionaryControl != null)
            {
                dictionaryControl.DictionaryConfiguration = this.DictionaryConfig;
                dictionaryControl.PageInstruction         = this.PageInstruction;
                dictionaryControl.DictionaryRouter        = this;
                phDictionary.Controls.Add(dictionaryControl);
            }
        }
예제 #13
0
        /// <summary>
        /// Helper method to load configuration based on CTSConfigFilePath appsetting path.
        /// </summary>
        /// <returns></returns>
        public static BasicCTSPageInfo GetConfig()
        {
            string configPath = ConfigurationManager.AppSettings["CTSConfigFilePath"];

            return((BasicCTSPageInfo)ModuleObjectFactory <BasicCTSPageInfo> .GetObjectFromFile(configPath));
        }
예제 #14
0
        /// <summary>
        /// Event method sets content version and template and user control properties<br /><br />
        /// [1] Input form parameters:<br />
        /// keyword {string: search string},<br />
        /// first {integer: ordinal index of first result},<br />
        /// resultSearch {string: search within results search string},<br />
        /// chkCategories {comma-delimited set of strings: specific virtual paths to search},<br />
        /// selectedPage {integer: current result page number}<br />
        /// [2] Builds Verity and BestBet query language and Verity query xml document<br />
        /// [3] Parses Verity results and errors<br />
        /// [4] Builds Verity and BestBet result HTML<br />
        /// [5] Builds paging control for results browsing<br />
        /// </summary>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            //Setup the title, header, and left nav
            SetupCancerGovPageStuff();

            SetLabels();

            //Hide the error message
            phError.Visible = false;

            //set up the search collection (CancerGovEnglish or CancerGovSpanish)
            //determine what text needs to be removed from the title e.g. - National Cancer Institute
            SiteWideSearchConfig searchConfig = ModuleObjectFactory <SiteWideSearchConfig> .GetModuleObject(SnippetInfo.Data);

            if (searchConfig != null)
            {
                SearchCollection = searchConfig.SearchCollection;
            }


            if (Page.Request.RequestType == "POST")
            {
                if (!IsPostBack)
                {
                    /*********************************************/
                    /*        Search using header search box     */
                    /*********************************************/

                    Keyword = Request.Params["swKeyword"];

                    if (Keyword == string.Empty)
                    {
                        ShowErrorMessage();
                    }
                    else
                    {
                        LoadResults();

                        //Log User Input for initial search.
                        LogUserInput("Keyword:" + Keyword);
                    }
                }
                else
                {
                    //This is a postback from a user changing the items per page or
                    //searching within results.  There is one problem though.
                    //By default,
                    if (Strings.Clean(Request.Params["__EVENTTARGET"]) == null &&
                        Strings.Clean(Request.Params["__EVENTARGUMENT"]) == null &&
                        Strings.Clean(Request.Params[btnTextChangePageUnit.UniqueID]) == null &&
                        Strings.Clean(Request.Params[btnSWRTxtSearch.UniqueID]) == null)
                    {
                        //THIS IS FOR IE with no JS.  Oddly in most ways it is more broken than firefox, but
                        //is so broken that we can easily tell that the user hit enter on the only
                        //text box.
                        //Basically if all the buttons that can be clicked are null, and there
                        //is no event target or argument, then this is IE with Javascript turned
                        //off and the user clicked enter on the text box.  Also, image buttons do
                        //not come back ID, but ID.x and ID.y. (Hopefully screen readers send those
                        //things too.
                        //
                        //We need to handle this stuff after all the other postback events happen.
                        //so lets just set a variable for now.
                        _isIENoJSAndHitEnderInTheSearchBox = true;
                    }
                }
            }
            else
            {
                /*********************************************/
                /*    Either Paging or a DYM Click           */
                /*********************************************/

                //No Matter if this is a DYM or a Paging, swKeyword is the keyword. (There may be an old one, but that is for later)
                Keyword = Request.Params["swKeyword"];

                if (Keyword == string.Empty)
                {
                    ShowErrorMessage();
                }
                else
                {
                    //These things only apply to paging

                    //Get Items per page.
                    ItemsPerPage = Strings.ToInt(Request.Params["pageunit"], 10);

                    //Get the current Page
                    CurrentPage = Strings.ToInt(Request.Params["page"], 1);

                    //"De-serialize" old keywords.
                    if (!string.IsNullOrEmpty(Request.Params["old_keywords"]))
                    {
                        string[] oldKeys = Request.Params["old_keywords"].Split(new char[] { '|' });
                        OldKeywords.AddRange(oldKeys);
                    }

                    LoadResults();
                }
            }

            // build the OnClineClick value for results search
            var siteResultSearchSubmitParameter = "";

            if (PageDisplayInformation.Language == DisplayLanguage.Spanish)
            {
                siteResultSearchSubmitParameter = "true";
            }
            // removed search validation for now
            var siteResultSearchSubmitCall = ""; //"return siteResultSearchSubmit(" + siteResultSearchSubmitParameter + ")";

            // Web Analytics *************************************************
            if (WebAnalyticsOptions.IsEnabled)
            {
                siteResultSearchSubmitCall += "return NCIAnalytics.SiteWideSearchResultsSearch(this,'" + txtSWRKeyword.ClientID + "','" + rblSWRSearchType.UniqueID + "')";
            }
            // End Web Analytics *********************************************
            if (!String.IsNullOrEmpty(siteResultSearchSubmitCall))
            {
                siteResultSearchSubmitCall   += ";";
                btnSWRTxtSearch.OnClientClick = siteResultSearchSubmitCall;
            }
        }