private void BuildLinks()
        {
            string tab = string.Empty;
            string searchfor = string.Empty;
            string searchrequest = string.Empty;

            tab = Request.QueryString["tab"];

            if (Request.QueryString["searchtype"] == "everything")
            {
                tab = "all";
            }

            litModifySearch.Text = "<a href=\"javascript:modify('" + Root.Domain + "','" + tab + "','" + base.MasterPage.SearchRequest + "');\">" + "Modify Search" + "</a>";

            if (Request.QueryString["searchfor"].IsNullOrEmpty())
                searchfor = Request.Form["txtSearchFor"];
            else
                searchfor = Request.QueryString["searchfor"];

            if (searchfor.IsNullOrEmpty())
            {
                Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

                XmlDocument xmlsearchrequest = new XmlDocument();
                searchrequest = data.DecryptRequest(base.MasterPage.SearchRequest);
                xmlsearchrequest.LoadXml(searchrequest);

                if (xmlsearchrequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString") != null)
                    searchfor = xmlsearchrequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString").InnerText;
            }

            litSearchOtherInstitutions.Text = "<a href='" + Root.Domain + "/direct/default.aspx?keyword=" + searchfor + "&searchrequest=" + base.MasterPage.SearchRequest + "&searchtype=" + Request.QueryString["searchtype"] + "'>" + "Search Other Institutions" + "</a>";
        }
        public SearchResults(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
            : base(pagedata, moduleparams, pagenamespaces)
        {
            Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

            this.SearchData = pagedata;
        }
        public void Execute()
        {
            DataIO search = new DataIO();
            XmlDocument returndata = null;
            string queryid = string.Empty;

            _doc.LoadXml(_doc.OuterXml.Replace("xmlns=\"\"", ""));

            returndata = search.BetaSearch(_doc);

            this.SetQueryID(returndata);

            CacheWrapper.CacheItem(this.QueryID + "request", _doc);
            CacheWrapper.CacheItem(this.QueryID + "results", returndata);
        }
Esempio n. 4
0
        //public void Page_Load(object sender, EventArgs e)
        override protected void OnInit(EventArgs e)
        {
            masterpage = (Framework.Template)base.Master;


            string tab = string.Empty;


            if (Request.QueryString["searchtype"] == null && Request.Form["searchtype"] == null && Session["DIRECTSEARCHTYPE"] != null)
            {
                this.SearchType = Session["DIRECTSEARCHTYPE"].ToString();
            }
            else if (Request.QueryString["searchtype"] == null && Request.Form["searchtype"] != null && Session["DIRECTSEARCHTYPE"] == null)
            {
                this.SearchType = Request.Form["searchtype"];
            }
            else if (Request.QueryString["searchtype"] != null && Request.Form["searchtype"] == null && Session["DIRECTSEARCHTYPE"] == null)
            {
                this.SearchType = Request.QueryString["searchtype"];
            }


            if (Session["DIRECTSEARCHREQUEST"] != null)
            {
                masterpage.SearchRequest = Session["DIRECTSEARCHREQUEST"].ToString();
                string searchrequest = masterpage.SearchRequest;

                Session["DIRECTKEYWORD"]       = null;
                Session["DIRECTSEARCHREQUEST"] = null;
                Session["DIRECTSEARCHTYPE"]    = null;

                Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

                data.SearchRequest("", "", "", "", "", "", "", "", "", "", "", "15", "0", "", "", "", "", ref searchrequest);

                Response.Redirect(Root.Domain + "/search/default.aspx?searchtype=" + this.SearchType + "&searchrequest=" + searchrequest, true);
            }

            if (this.SearchType.IsNullOrEmpty())
            {
                this.LoadPresentationXML("searchform");
                if (Request.QueryString["tab"] != null)
                {
                    masterpage.Tab = Request.QueryString["tab"];
                }
                else
                {
                    masterpage.Tab = "";
                }



                masterpage.RDFData       = null;
                masterpage.RDFNamespaces = null;
            }
            else
            {
                if (Request.QueryString["tab"] != null)
                {
                    masterpage.Tab = Request.QueryString["tab"];
                }
                else
                {
                    masterpage.Tab = "";
                }

                this.LoadPresentationXML(this.SearchType);

                this.LoadRDFSearchResults();
            }

            this.LoadAssets();
            masterpage.PresentationXML = this.PresentationXML;
        }
Esempio n. 5
0
        //public void Page_Load(object sender, EventArgs e)
        protected override void OnInit(EventArgs e)
        {
            masterpage = (Framework.Template)base.Master;

            string tab = string.Empty;

            if (Request.QueryString["searchtype"] == null && Request.Form["searchtype"] == null && Session["DIRECTSEARCHTYPE"] != null)
                this.SearchType = Session["DIRECTSEARCHTYPE"].ToString();
            else if (Request.QueryString["searchtype"] == null && Request.Form["searchtype"] != null && Session["DIRECTSEARCHTYPE"] == null)
                this.SearchType = Request.Form["searchtype"];
            else if (Request.QueryString["searchtype"] != null && Request.Form["searchtype"] == null && Session["DIRECTSEARCHTYPE"] == null)
                this.SearchType = Request.QueryString["searchtype"];

            if (Session["DIRECTSEARCHREQUEST"] != null)
            {
                masterpage.SearchRequest = Session["DIRECTSEARCHREQUEST"].ToString();
                string searchrequest = masterpage.SearchRequest;

                Session["DIRECTKEYWORD"] = null;
                Session["DIRECTSEARCHREQUEST"] = null;
                Session["DIRECTSEARCHTYPE"] = null;

                Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

                data.SearchRequest("", "", "", "", "", "", "", "", "", "", "", "15", "0", "", "", "", "", ref searchrequest);

                Response.Redirect(Root.Domain + "/search/default.aspx?searchtype=" + this.SearchType + "&searchrequest=" + searchrequest, true);

            }

            if (this.SearchType.IsNullOrEmpty())
            {
                this.LoadPresentationXML("searchform");
                if (Request.QueryString["tab"] != null)
                    masterpage.Tab = Request.QueryString["tab"];
                else
                    masterpage.Tab = "";

                masterpage.RDFData = null;
                masterpage.RDFNamespaces = null;
            }
            // added by UCSF.  A hack THAT NEEDS TO BE TESTED (try not doing the UrlEncode)
            else if (Request.QueryString["tab"] == "concept")
            {
                Response.Redirect(Root.Domain + "/search/default.aspx?searchtype=everything&searchfor=" + HttpUtility.UrlEncode(Request.Form["txtSearchFor"]) +
                    "&ClassGroupURI=" + HttpUtility.UrlEncode("http://profiles.catalyst.harvard.edu/ontology/prns!ClassGroupConcepts") + "&perpage=15&offset=");
            }
            else
            {
                if (Request.QueryString["tab"] != null)
                    masterpage.Tab = Request.QueryString["tab"];
                else
                    masterpage.Tab = "";

                this.LoadPresentationXML(this.SearchType);

                this.LoadRDFSearchResults();
            }

            this.LoadAssets();
            masterpage.PresentationXML = this.PresentationXML;
        }
        public XmlDocument ExecuteSingle()
        {
            DataIO search = new DataIO();
            XmlDocument returndata = null;
            string queryid = string.Empty;

            _doc.LoadXml(_doc.OuterXml.Replace("xmlns=\"\"", ""));

            returndata = search.BetaSearch(_doc);
            return returndata;
        }
        //public void Page_Load(object sender, EventArgs e)
        protected override void OnInit(EventArgs e)
        {
            masterpage = (Framework.Template)base.Master;

            string tab = string.Empty;

            if (Request.QueryString["searchtype"] == null && Request.Form["searchtype"] == null && Session["DIRECTSEARCHTYPE"] != null)
                this.SearchType = Session["DIRECTSEARCHTYPE"].ToString();
            else if (Request.QueryString["searchtype"] == null && Request.Form["searchtype"] != null && Session["DIRECTSEARCHTYPE"] == null)
                this.SearchType = Request.Form["searchtype"];
            else if (Request.QueryString["searchtype"] != null && Request.Form["searchtype"] == null && Session["DIRECTSEARCHTYPE"] == null)
                this.SearchType = Request.QueryString["searchtype"];

            if (Session["DIRECTSEARCHREQUEST"] != null)
            {
                masterpage.SearchRequest = Session["DIRECTSEARCHREQUEST"].ToString();
                string searchrequest = masterpage.SearchRequest;

                Session["DIRECTKEYWORD"] = null;
                Session["DIRECTSEARCHREQUEST"] = null;
                Session["DIRECTSEARCHTYPE"] = null;

                Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

                data.SearchRequest("", "", "", "", "", "", "", "", "", "", "", "15", "0", "", "", "", "", ref searchrequest);

                Response.Redirect(Root.Domain + "/search/default.aspx?searchtype=" + this.SearchType + "&searchrequest=" + searchrequest, true);

            }

            if (this.SearchType.IsNullOrEmpty())
            {
                this.LoadPresentationXML("searchform");
                if (Request.QueryString["tab"] != null)
                    masterpage.Tab = Request.QueryString["tab"];
                else
                    masterpage.Tab = "";

                masterpage.RDFData = null;
                masterpage.RDFNamespaces = null;
            }
            else
            {
                if (Request.QueryString["tab"] != null)
                    masterpage.Tab = Request.QueryString["tab"];
                else
                    masterpage.Tab = "";

                this.LoadPresentationXML(this.SearchType);

                this.LoadRDFSearchResults();
            }

            this.LoadAssets();
            masterpage.PresentationXML = this.PresentationXML;
        }
            public override List<string> getPeople()
            {
                try
                {
                    List<string> peopleURIs = new List<string>();
                    int offSet = 0;
                    Boolean hasMorePeople = true;
                    while (peopleURIs.Count < searchLimit && hasMorePeople)
                    {
                        searchRequest.SelectSingleNode("/SearchOptions/OutputOptions/Offset").InnerText = "" + offSet;
                        searchRequest.SelectSingleNode("/SearchOptions/OutputOptions/Limit").InnerText = "" + searchLimit;
                        XmlDocument searchData = new Profiles.Search.Utilities.DataIO().Search(searchRequest, false, false);

                        DebugLogging.Log("SeachCallbackResponse :" + searchRequest.ToString());

                        XmlNodeList people = searchData.GetElementsByTagName("rdf:object");
                        for (int i = 0; i < people.Count; i++)
                        {
                            peopleURIs.Add(people[i].Attributes["rdf:resource"].Value);
                        }
                        // increase offset by amount found
                        XmlNode node = searchData.SelectSingleNode("rdf:RDF/rdf:Description/prns:numberOfConnections", namespaceManager);
                        offSet += people.Count;
                        hasMorePeople = Convert.ToInt32(node.InnerText) > peopleURIs.Count;
                    }
                    if (peopleURIs.Count > 0)
                    {
                        return peopleURIs;
                    }
                }
                catch (Exception e)
                {
                    DebugLogging.Log(e.Message);
                }

                return null;
            }
        private void Search()
        {
            string lname = Request.Form[this.txtLname.UniqueID];
            string fname = Request.Form[this.txtFname.UniqueID];
            string searchfor = Request.Form[this.txtSearchFor.UniqueID];
            string exactphrase = Request.Form[this.chkExactphrase.UniqueID];
            string facrank = Request.Form[this.hidList.UniqueID];

            if (exactphrase == "on")
                exactphrase = "true";
            else
                exactphrase = "false";

            string institution = "";
            string institutionallexcept = "";

            string department = "";
            string departmentallexcept = "";

            string division = "";
            string divisionallexcept = "";

            if (Request.Form["institution"] != null)
            {
                institution = Request.Form["institution"];
                institutionallexcept = Request.Form[this.institutionallexcept.UniqueID];//Request.Form["institutionallexcept"];
            }

            if (!Request.Form["department"].IsNullOrEmpty())
            {
                department = Request.Form["department"];
                departmentallexcept = Request.Form[this.departmentallexcept.UniqueID];
            }

            string otherfilters = Request.Form["hdnSelectedText"];

            string classuri = "http://xmlns.com/foaf/0.1/Person";

            string searchrequest = string.Empty;

            Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

            data.SearchRequest(searchfor, exactphrase, fname, lname, institution, institutionallexcept,
                department, departmentallexcept, division, divisionallexcept, classuri, "15", "0", "", "", otherfilters, facrank, ref searchrequest);

            Response.Redirect(Root.Domain + "/search/default.aspx?showcolumns=10&searchtype=people&otherfilters=" + otherfilters + "&searchrequest=" + searchrequest, true);
        }
Esempio n. 10
0
        private void BuildFilters()
        {
            Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

            System.Data.DataSet ds = data.GetPersonTypes();

            ctcFirst.DataMasterName = "DataMasterName";
            ctcFirst.DataDetailName = "DataDetailName";

            ctcFirst.DataMasterIDField = "personTypeGroupId";
            ctcFirst.DataMasterTextField = "personTypeGroup";

            ctcFirst.DataDetailIDField = "personTypeFlagId";
            ctcFirst.DataDetailTextField = "personTypeFlag";

            ctcFirst.DataSource = ds;
            ctcFirst.DataBind();
        }
        private void DrawProfilesModule()
        {
            XsltArgumentList args = new XsltArgumentList();

            string searchfor = string.Empty;
            string classgroupuri = string.Empty;
            string classuri = string.Empty;
            string searchrequest = string.Empty;
            string exactphrase = string.Empty;

            XmlDocument xmlsearchrequest;

            if (Request.QueryString["searchfor"] != null)
                searchfor = Request.QueryString["searchfor"];
            else
                searchfor = Request.Form["txtSearchFor"];

            if (Request.QueryString["classgroupuri"] != null)
                classgroupuri = HttpUtility.UrlDecode(Request.QueryString["classgroupuri"]);
            else
                classgroupuri = HttpUtility.UrlDecode(Request.Form["classgroupuri"]);

            if (classgroupuri != null)
            {
                if (classgroupuri.Contains("!"))
                    classgroupuri = classgroupuri.Replace('!', '#');
            }
            else
            {
                classgroupuri = string.Empty;
            }

            if (Request.QueryString["classuri"] != null)
                classuri = HttpUtility.UrlDecode(Request.QueryString["classuri"]);
            else
                classuri = HttpUtility.UrlDecode(Request.Form["classuri"]);

            if (classuri != null)
            {
                if (classuri.Contains("!"))
                    classuri = classuri.Replace('!', '#');
            }
            else
            {
                classuri = string.Empty;
            }

            Search.Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

            if (Request.QueryString["searchrequest"] != null)
            {
                searchrequest = Request.QueryString["searchrequest"];

                if (searchfor == null)
                {
                    xmlsearchrequest = new XmlDocument();

                    xmlsearchrequest.LoadXml(data.DecryptRequest(searchrequest));

                    searchfor = xmlsearchrequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString").InnerText;

                }
            }

            if (Request.QueryString["exactphrase"] != null)
            {
                exactphrase = Request.QueryString["exactphrase"];
            }
            else exactphrase = "false";

            //Grab the full results so I can get the counts, this comes from the cache cloud.
            this.SearchResults = data.Search(data.SearchRequest(searchfor, exactphrase, "", "", "0", "100"), false);

            Int64 total = 0;

            foreach (XmlNode x in this.SearchResults.SelectNodes("rdf:RDF/rdf:Description/vivo:overview/prns:matchesClassGroupsList/prns:matchesClassGroup", this.Namespaces))
            {

                total += Convert.ToInt64(x.SelectSingleNode("prns:numberOfConnections", this.Namespaces).InnerText);
            }

            args.AddParam("total", "", total);
            args.AddParam("searchfor", "", searchfor);
            args.AddParam("exactphrase", "", exactphrase);
            args.AddParam("root", "", Root.Domain);
            args.AddParam("classGrpURIpassedin", "", classgroupuri);
            args.AddParam("classURIpassedin", "", classuri);

            XslCompiledTransform xslt = new XslCompiledTransform();
            litEverythingPassiveResults.Text = XslHelper.TransformInMemory(Server.MapPath("~/Search/Modules/SearchEverythingFacets/SearchEverythingFacets.xslt"), args, this.SearchResults.OuterXml);
        }
        private void DrawProfilesModule()
        {
            string output = string.Empty;
            Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

            if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchString", base.Namespaces) != null)
                output += base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchString", base.Namespaces).InnerText + "<br/>";

            if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property='http://xmlns.com/foaf/0.1/lastName']", base.Namespaces) != null)
                output += base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property='http://xmlns.com/foaf/0.1/lastName']", base.Namespaces).InnerText + "<br/>";

            if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property='http://xmlns.com/foaf/0.1/firstName']", base.Namespaces) != null)
                output += base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property='http://xmlns.com/foaf/0.1/firstName']", base.Namespaces).InnerText + "<br/>";

            if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property='http://profiles.catalyst.harvard.edu/ontology/prns#hasPersonFilter']", base.Namespaces) != null)
            {
                string s = string.Empty;
                s = Request.QueryString["otherfilters"];

                foreach (GenericListItem gi in data.GetOtherOptions(s))
                {
                    Rank = data.GetConvertedURIListItem(data.GetListOfFilters(), gi.Value);
                    output += Rank + "<br/>";
                }
            }

            if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property2='http://vivoweb.org/ontology/core#positionInOrganization']", base.Namespaces) != null)
            {
                Institution = data.GetConvertedURIListItem(data.GetInstitutions(), base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property2='http://vivoweb.org/ontology/core#positionInOrganization']", base.Namespaces).InnerText);
                output += Institution + "<br/>";
            }

            if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property2='http://profiles.catalyst.harvard.edu/ontology/prns#positionInDepartment']", base.Namespaces) != null)
            {
                Department = data.GetConvertedURIListItem(data.GetDepartments(), base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property2='http://profiles.catalyst.harvard.edu/ontology/prns#positionInDepartment']", base.Namespaces).InnerText);
                output += Department + "<br/>";
            }

            if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property2='http://profiles.catalyst.harvard.edu/ontology/prns#positionInDivision']", base.Namespaces) != null)
            {
                Division = data.GetConvertedURIListItem(data.GetDivisions(), base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property2='http://profiles.catalyst.harvard.edu/ontology/prns#positionInDivision']", base.Namespaces).InnerText);
                output += Division + "<br/>";
            }

            litSearchCriteria.Text = output;
        }
        private void DrawProfilesModule()
        {
            XsltArgumentList args = new XsltArgumentList();

            string searchfor     = string.Empty;
            string classgroupuri = string.Empty;
            string classuri      = string.Empty;
            string searchrequest = string.Empty;
            string exactphrase   = string.Empty;

            XmlDocument xmlsearchrequest;



            if (Request.QueryString["searchfor"] != null)
            {
                searchfor = Request.QueryString["searchfor"];
            }
            else
            {
                searchfor = Request.Form["txtSearchFor"];
            }



            if (Request.QueryString["classgroupuri"] != null)
            {
                classgroupuri = HttpUtility.UrlDecode(Request.QueryString["classgroupuri"]);
            }
            else
            {
                classgroupuri = HttpUtility.UrlDecode(Request.Form["classgroupuri"]);
            }

            if (classgroupuri != null)
            {
                if (classgroupuri.Contains("!"))
                {
                    classgroupuri = classgroupuri.Replace('!', '#');
                }
            }
            else
            {
                classgroupuri = string.Empty;
            }

            if (Request.QueryString["classuri"] != null)
            {
                classuri = HttpUtility.UrlDecode(Request.QueryString["classuri"]);
            }
            else
            {
                classuri = HttpUtility.UrlDecode(Request.Form["classuri"]);
            }

            if (classuri != null)
            {
                if (classuri.Contains("!"))
                {
                    classuri = classuri.Replace('!', '#');
                }
            }
            else
            {
                classuri = string.Empty;
            }


            Search.Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();


            if (Request.QueryString["searchrequest"] != null)
            {
                searchrequest = Request.QueryString["searchrequest"];

                if (searchfor == null)
                {
                    xmlsearchrequest = new XmlDocument();

                    xmlsearchrequest.LoadXml(data.DecryptRequest(searchrequest));

                    searchfor = xmlsearchrequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString").InnerText;
                }
            }

            if (Request.QueryString["exactphrase"] != null)
            {
                exactphrase = Request.QueryString["exactphrase"];
            }
            else
            {
                exactphrase = "false";
            }

            //Grab the full results so I can get the counts, this comes from the cache cloud.
            this.SearchResults = data.Search(data.SearchRequest(searchfor, exactphrase, "", "", "0", "100"), false);



            Int64 total = 0;

            foreach (XmlNode x in this.SearchResults.SelectNodes("rdf:RDF/rdf:Description/vivo:overview/prns:matchesClassGroupsList/prns:matchesClassGroup", this.Namespaces))
            {
                total += Convert.ToInt64(x.SelectSingleNode("prns:numberOfConnections", this.Namespaces).InnerText);
            }

            args.AddParam("total", "", total);
            args.AddParam("searchfor", "", searchfor);
            args.AddParam("exactphrase", "", exactphrase);
            args.AddParam("root", "", Root.Domain);
            args.AddParam("classGrpURIpassedin", "", classgroupuri);
            args.AddParam("classURIpassedin", "", classuri);



            XslCompiledTransform xslt = new XslCompiledTransform();

            litEverythingPassiveResults.Text = XslHelper.TransformInMemory(Server.MapPath("~/Search/Modules/SearchEverythingFacets/SearchEverythingFacets.xslt"), args, this.SearchResults.OuterXml);
        }
        private void BuildFilters()
        {
            Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

            System.Data.DataSet ds = data.GetPersonTypes();
        }
        private void DrawProfilesModule()
        {
            XsltArgumentList args = new XsltArgumentList();
            long offset = 0;
            long perpage = 0;
            long totalcount = 0;
            long totalpageremainder = 0;
            long totalpages = 0;
            long startrecord = 0;
            long page = 0;
            string searchfor = "";
            string classgroupuri = "";
            string classuri = "";

            string fname = "";
            string lname = "";
            string institution = "";
            string department = "";
            string sort = "";
            string sortdirection = "";
            string searchrequest = "";
            XmlDocument xmlsearchrequest;
            xmlsearchrequest = new XmlDocument();

            Int16 showcolumns = 0;

            string otherfilters = "";
            string institutionallexcept = string.Empty;
            string departmentallexcept = string.Empty;
            string exactphrase = string.Empty;

            string division = string.Empty;
            string divisionallexcept = string.Empty;

            string searchtype = "";

            Search.Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

            if (String.IsNullOrEmpty(Request.QueryString["searchrequest"])==false)
            {
                searchrequest = data.DecryptRequest(Request.QueryString["searchrequest"]);
                xmlsearchrequest.LoadXml(searchrequest);
            }

            if (String.IsNullOrEmpty(Request.QueryString["searchtype"])==false)
            {
                searchtype = Request.QueryString["searchtype"];
            }
            else if (String.IsNullOrEmpty(Request.Form["searchtype"])==false)
            {
                searchtype = Request.Form["searchtype"];

            }

            if (String.IsNullOrEmpty(Request.QueryString["searchfor"])==false)
            {
                searchfor = Request.QueryString["searchfor"];
            }
            else if(String.IsNullOrEmpty(Request.Form["txtSearchFor"])==false)
            {
                searchfor = Request.Form["txtSearchFor"];

            }
            else if (xmlsearchrequest.ChildNodes.Count > 0)
            {
                try
                {
                    searchfor = xmlsearchrequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString").InnerText;
                }
                catch(Exception)
                {
                    // Do nothing, leave searchfor = null
                }
            }

            if (searchfor == null)
                searchfor = string.Empty;

            if (String.IsNullOrEmpty(Request.QueryString["lname"])==false)
                lname = Request.QueryString["lname"];
            else
                lname = Request.Form["txtLname"];

            if (lname == null)
                lname = string.Empty;

            if (String.IsNullOrEmpty(Request.QueryString["fname"])==false)
                fname = Request.QueryString["fname"];
            else
                fname = Request.Form["txtFname"];

            if (fname == null)
                fname = string.Empty;

            if (String.IsNullOrEmpty(Request.QueryString["institution"])==false)
                institution = Request.QueryString["institution"];

            if (String.IsNullOrEmpty(Request.QueryString["department"])==false)
                department = Request.QueryString["department"];

            if (String.IsNullOrEmpty(Request.QueryString["perpage"])==false)
            {
                perpage = Convert.ToInt64(Request.QueryString["perpage"]);
                if (!(perpage>0))
                    perpage = 15;

                //if (String.IsNullOrEmpty(Request.QueryString["perpage"])==false)
                //    perpage = Convert.ToInt64(Request.QueryString["perpage"]);
                //else
                //    perpage = 15;
            }
            else
            {
                perpage = 15; //default
            }

            if (String.IsNullOrEmpty(Request.QueryString["offset"])==false)
            {
                offset = Convert.ToInt64(Request.QueryString["offset"]);
                //if (Request.QueryString["offset"] != string.Empty)
                //    offset = Convert.ToInt64(Request.QueryString["offset"]);
                //else
                //    offset = 0;
            }
            else
            {
                offset = 0;
            }

            if (String.IsNullOrEmpty(Request.QueryString["page"])==false)
            {
                page = Convert.ToInt64(Request.QueryString["page"]);
                if (!(page > 0))
                    page = 1;
                //if (Request.QueryString["page"] != string.Empty)
                //    page = Convert.ToInt64(Request.QueryString["page"]);
                //else
                //    page = 1;
            }
            else
            {
                page = 1;
            }

            if (String.IsNullOrEmpty(Request.QueryString["classgroupuri"])==false)
                classgroupuri = HttpUtility.UrlDecode(Request.QueryString["classgroupuri"]);
            else
                classgroupuri = HttpUtility.UrlDecode(Request.Form["classgroupuri"]);

            if (classgroupuri != null)
            {
                if (classgroupuri.Contains("!"))
                    classgroupuri = classgroupuri.Replace('!', '#');
            }
            else
            {
                classgroupuri = string.Empty;
            }

            if (String.IsNullOrEmpty(Request.QueryString["classuri"])==false)
                classuri = HttpUtility.UrlDecode(Request.QueryString["classuri"]);
            else
                classuri = HttpUtility.UrlDecode(Request.Form["classuri"]);

            if (classuri != null)
            {
                if (classuri.Contains("!"))
                    classuri = classuri.Replace('!', '#');
            }
            else
            {
                classuri = string.Empty;
            }

            if (String.IsNullOrEmpty(Request.QueryString["sortby"])==false)
                sort = Request.QueryString["sortby"];

            if (String.IsNullOrEmpty(Request.QueryString["sortdirection"])==false)
                sortdirection = Request.QueryString["sortdirection"];

            if (String.IsNullOrEmpty(Request.QueryString["showcolumns"])==false)
            {
                showcolumns = Convert.ToInt16(Request.QueryString["showcolumns"]);
                if (!(showcolumns > 0))
                    showcolumns = 2;

            }
            else
            {
                showcolumns = 2;
            }

            if (String.IsNullOrEmpty(Request.QueryString["otherfilters"])==false)
            {
                otherfilters = Request.QueryString["otherfilters"];

            }

            if (String.IsNullOrEmpty(Request.QueryString["institutionallexcept"])==false)
            {
                institutionallexcept = Request.QueryString["institutionallexcept"];

            }

            if (String.IsNullOrEmpty(Request.QueryString["departmentallexcept"])==false)
            {
                departmentallexcept = Request.QueryString["departmentallexcept"];

            }

            if (String.IsNullOrEmpty(Request.QueryString["exactphrase"])==false)
            {
                exactphrase = Request.QueryString["exactphrase"];

            }

            if (String.IsNullOrEmpty(Request.QueryString["division"])==false)
            {
                division = Request.QueryString["division"];
            }

            if (String.IsNullOrEmpty(Request.QueryString["divisionallexcept"])==false)
            {
                divisionallexcept = Request.QueryString["divisionallexcept"];
            }

            try
            {

                totalcount = data.GetTotalSearchConnections(this.SearchData, base.Namespaces);

                if (page < 0)
                {
                    page = 1;
                }

                totalpages = Math.DivRem(totalcount, Convert.ToInt64(perpage), out totalpageremainder);

                if (totalpageremainder > 0) { totalpages = totalpages + 1; }

                if (page > totalpages)
                    page = totalpages;

                startrecord = ((Convert.ToInt32(page) * Convert.ToInt32(perpage)) + 1) - Convert.ToInt32(perpage);

                if(searchrequest.Trim() != string.Empty)
                searchrequest = data.EncryptRequest(searchrequest);

                switch (searchtype.ToLower())
                {
                    case "everything":

                            xmlsearchrequest = data.SearchRequest(searchfor, classgroupuri, classuri, perpage.ToString(), (startrecord - 1).ToString());
                        break;
                    default:
                            xmlsearchrequest = data.SearchRequest(searchfor, exactphrase, fname, lname, institution, institutionallexcept, department, departmentallexcept, division, divisionallexcept, "http://xmlns.com/foaf/0.1/Person", perpage.ToString(), (startrecord - 1).ToString(), sort, sortdirection, otherfilters, ref searchrequest);
                        break;
                }

                OpenSocialManager om = OpenSocialManager.GetOpenSocialManager(null, Page, false, false);
                om.RegisterORNGCallbackResponder(OpenSocialManager.JSON_PERSONID_CHANNEL, new Responder(xmlsearchrequest));

                this.SearchData = data.Search(xmlsearchrequest,false);

                this.SearchRequest = data.EncryptRequest(xmlsearchrequest.OuterXml);
            }
            catch (Exception ex)
            {
                ex = ex;
                //for now just flip it back to the defaults. This is if someone keys some funky divide by zero stuff in the URL
                // to try and break the system.
                startrecord = 1;
                perpage = 15;
            }

            args.AddParam("root", "", Root.Domain);
            args.AddParam("perpage", "", perpage);
            args.AddParam("offset", "", offset);
            args.AddParam("totalpages", "", totalpages);
            args.AddParam("page", "", page);
            args.AddParam("searchfor", "", searchfor);
            args.AddParam("classGrpURIpassedin", "", classgroupuri);
            args.AddParam("classURIpassedin", "", classuri);
            args.AddParam("searchrequest", "", this.SearchRequest);

            switch (searchtype.ToLower())
            {
                case "everything":
                    litEverythingResults.Text = XslHelper.TransformInMemory(Server.MapPath("~/Search/Modules/SearchResults/EverythingResults.xslt"), args, this.SearchData.OuterXml);
                    break;
                case "people":

                    args.AddParam("showcolumns", "", showcolumns.ToString());

                    if ((showcolumns & 1) == 1)
                    {
                        args.AddParam("institution", "", "true");
                    }
                    else
                    {
                        args.AddParam("institution", "", "false");
                    }

                    if ((showcolumns & 2) == 2)
                    {
                        args.AddParam("department", "", "true");
                    }
                    else
                    {
                        args.AddParam("department", "", "false");
                    }

                    if ((showcolumns & 4) == 4)
                    {
                        args.AddParam("division", "", "true");
                    }
                    else
                    {
                        args.AddParam("division", "", "false");
                    }

                    if ((showcolumns & 8) == 8)
                    {
                        args.AddParam("facrank", "", "true");
                    }
                    else
                    {
                        args.AddParam("facrank", "", "false");
                    }

                    //Profiles.Search.Utilities.DataIO dropdowns = new Profiles.Search.Utilities.DataIO();
                    if (Convert.ToBoolean(ConfigurationSettings.AppSettings["ShowInstitutions"]) == true)
                    {

                        args.AddParam("ShowInstitutions", "", "true");
                    }
                    else
                    {
                        args.AddParam("ShowInstitutions", "", "false");
                    }

                    if (Convert.ToBoolean(ConfigurationSettings.AppSettings["ShowDepartments"]) == true)
                    {
                        args.AddParam("ShowDepartments", "", "true");
                    }
                    else
                    {
                        args.AddParam("ShowDepartments", "", "false");
                    }

                    if (Convert.ToBoolean(ConfigurationSettings.AppSettings["ShowDivisions"]) == true)
                    {
                        args.AddParam("ShowDivisions", "", "true");
                    }
                    else
                    {
                        args.AddParam("ShowDivisions", "", "false");
                    }

                    //Faculty Rank always shows
                    args.AddParam("ShowFacRank", "", "true");

                    args.AddParam("currentsort", "", sort);
                    args.AddParam("currentsortdirection", "", sortdirection);

                    if (base.BaseData.SelectNodes("rdf:RDF/rdf:Description/vivo:overview/SearchDetails/SearchPhraseList", base.Namespaces).Count > 0)
                        args.AddParam("why", "", true);
                    else
                        args.AddParam("why", "", false);

                    litEverythingResults.Text = XslHelper.TransformInMemory(Server.MapPath("~/Search/Modules/SearchResults/PeopleResults.xslt"), args, this.SearchData.OuterXml);
                    break;
            }
        }
Esempio n. 16
0
        private void ModifySearch()
        {
            Search.Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

            bool   institutiondropdown = false;
            bool   departmentdropdown  = false;
            bool   divisiondropdown    = false;
            string searchrequest       = string.Empty;


            if (base.MasterPage != null)
            {
                if (base.MasterPage.SearchRequest.IsNullOrEmpty() == false)
                {
                    searchrequest = base.MasterPage.SearchRequest;
                }
            }
            else if (Request.QueryString["searchrequest"].IsNullOrEmpty() == false)
            {
                searchrequest = Request.QueryString["searchrequest"];
            }

            SearchRequest = new XmlDocument();

            ctcFirst.SearchRequest = new XmlDocument();

            SearchRequest.LoadXml(data.DecryptRequest(searchrequest));

            ctcFirst.SearchRequest = this.SearchRequest;



            if (SearchRequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString") != null)
            {
                txtSearchFor.Text = SearchRequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString").InnerText;
            }

            if (SearchRequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString/@ExactMatch") != null)
            {
                switch (SearchRequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString/@ExactMatch").Value)
                {
                case "true":
                    chkExactphrase.Checked = true;
                    break;

                case "false":
                    chkExactphrase.Checked = false;
                    break;
                }
            }

            if (SearchRequest.SelectSingleNode("SearchOptions/MatchOptions/SearchFiltersList") != null)
            {
                foreach (XmlNode x in SearchRequest.SelectNodes("SearchOptions/MatchOptions/SearchFiltersList/SearchFilter"))
                {
                    if (x.SelectSingleNode("@Property").Value == "http://profiles.catalyst.harvard.edu/ontology/prns#personInPrimaryPosition" && x.SelectSingleNode("@Property2").Value == "http://vivoweb.org/ontology/core#positionInOrganization")
                    {
                        litInstitution.Text = SearcDropDowns.BuildDropdown("institution", "249", x.InnerText);
                        institutiondropdown = true;

                        if (x.SelectSingleNode("@IsExclude").Value == "1")
                        {
                            institutionallexcept.Checked = true;
                        }
                        else
                        {
                            institutionallexcept.Checked = false;
                        }
                    }

                    if (x.SelectSingleNode("@Property").Value == "http://profiles.catalyst.harvard.edu/ontology/prns#personInPrimaryPosition" && x.SelectSingleNode("@Property2").Value == "http://profiles.catalyst.harvard.edu/ontology/prns#positionInDepartment")
                    {
                        litDepartment.Text = SearcDropDowns.BuildDropdown("department", "249", x.InnerText);
                        departmentdropdown = true;

                        if (x.SelectSingleNode("@IsExclude").Value == "1")
                        {
                            departmentallexcept.Checked = true;
                        }
                        else
                        {
                            departmentallexcept.Checked = false;
                        }
                    }


                    if (x.SelectSingleNode("@Property").Value == "http://profiles.catalyst.harvard.edu/ontology/prns#personInPrimaryPosition" && x.SelectSingleNode("@Property2").Value == "http://profiles.catalyst.harvard.edu/ontology/prns#positionInDivision")
                    {
                        litDivision.Text = SearcDropDowns.BuildDropdown("division", "249", x.InnerText);
                        divisiondropdown = true;

                        if (x.SelectSingleNode("@IsExclude").Value == "1")
                        {
                            divisionallexcept.Checked = true;
                        }
                        else
                        {
                            divisionallexcept.Checked = false;
                        }
                    }

                    if (x.SelectSingleNode("@Property").Value == "http://profiles.catalyst.harvard.edu/ontology/prns#hasPersonFilter")
                    {
                    }

                    if (x.SelectSingleNode("@Property").Value == "http://xmlns.com/foaf/0.1/firstName")
                    {
                        txtFname.Text = x.InnerText;
                    }

                    if (x.SelectSingleNode("@Property").Value == "http://xmlns.com/foaf/0.1/lastName")
                    {
                        txtLname.Text = x.InnerText;
                    }
                }
            }

            if (!institutiondropdown)
            {
                litInstitution.Text = SearcDropDowns.BuildDropdown("institution", "249", "");
            }

            if (!departmentdropdown)
            {
                litDepartment.Text = SearcDropDowns.BuildDropdown("department", "249", "");
            }

            if (!divisiondropdown)
            {
                litDivision.Text = SearcDropDowns.BuildDropdown("division", "249", "");
            }
        }
        public XmlDocument Execute(string QueryID, string Keyword, string EntityID)
        {
            DataIO search = new DataIO();
            try
            {
                _doc = new XmlDocument();
                _doc.Load(AppDomain.CurrentDomain.BaseDirectory.ToString() + "/Search/Utilities/GetSearchConnection.xml");

                _doc.LoadXml(_doc.InnerXml.Replace("{{{@EntityID}}}", EntityID));
                _doc.LoadXml(_doc.InnerXml.Replace("{{{@QueryID}}}", QueryID));
                _doc.LoadXml(_doc.InnerXml.Replace("{{{@Keyword}}}", Keyword));

            }
            catch (Exception ex)
            {
                //For Debugging only put a break(F9) on the ex=ex while debugging,  if an error takes place at this level then the cache for the query header has
                // exprired so notify the user and have them start a new search session.
               Framework.Utilities.DebugLogging.Log(ex.Message + " ++ " + ex.StackTrace);
            }
            return search.BetaSearch(_doc);
        }
        //Need to process this at the page level for the framework data
        //to process the presentation XML
        public void LoadRDFSearchResults()
        {
            XmlDocument xml           = new XmlDocument();
            Namespace   rdfnamespaces = new Namespace();

            Utilities.DataIO data = new Utilities.DataIO();

            string searchtype  = string.Empty;
            string lname       = string.Empty;
            string fname       = string.Empty;
            string institution = string.Empty;
            string department  = string.Empty;
            string division    = string.Empty;

            string searchfor            = string.Empty;
            string classgroupuri        = string.Empty;
            string classuri             = string.Empty;
            string perpage              = string.Empty;
            string offset               = string.Empty;
            string searchrequest        = string.Empty;
            string otherfilters         = string.Empty;
            string institutionallexcept = string.Empty;
            string departmentallexcept  = string.Empty;
            string divisionallexcept    = string.Empty;
            string exactphrase          = string.Empty;
            string nodeuri              = string.Empty;
            string nodeid               = string.Empty;


            string country = (Request.QueryString["country"].IsNullOrEmpty() ? "(All)" : Request.QueryString["country"]);

            department = country;

            if (Request.QueryString["new"] == "true")
            {
                Session["searchrequest"] = null;
                masterpage.SearchRequest = null;
            }

            if (this.SearchType.IsNullOrEmpty() == false)
            {
                searchtype = this.SearchType;
            }

            //else if (Request.Form["searchtype"] != null)
            //{
            //    searchtype = Request.Form["searchtype"];
            //}

            if (Request.QueryString["searchfor"].IsNullOrEmpty() == false)
            {
                searchfor = Request.QueryString["searchfor"];
            }

            if (Request.Form["txtSearchFor"].IsNullOrEmpty() == false)
            {
                searchfor = Request.Form["txtSearchFor"];
            }

            if (Request.QueryString["lname"].IsNullOrEmpty() == false)
            {
                lname = Request.QueryString["lname"];
            }

            if (Request.QueryString["institution"].IsNullOrEmpty() == false)
            {
                institution = Request.QueryString["institution"];
            }

            if (Request.QueryString["division"].IsNullOrEmpty() == false)
            {
                division = Request.QueryString["division"];
            }

            if (Request.QueryString["fname"].IsNullOrEmpty() == false)
            {
                fname = Request.QueryString["fname"];
            }

            if (Request.QueryString["classgroupuri"].IsNullOrEmpty() == false)
            {
                classgroupuri = HttpUtility.UrlDecode(Request.QueryString["classgroupuri"]);
            }
            else
            {
                classgroupuri = HttpUtility.UrlDecode(Request.Form["classgroupuri"]);
            }

            if (classgroupuri != null)
            {
                if (classgroupuri.Contains("!"))
                {
                    classgroupuri = classgroupuri.Replace('!', '#');
                }
            }

            if (Request.QueryString["classuri"].IsNullOrEmpty() == false)
            {
                classuri = HttpUtility.UrlDecode(Request.QueryString["classuri"]);
            }
            else
            {
                classuri = HttpUtility.UrlDecode(Request.Form["classuri"]);
            }

            if (classuri != null)
            {
                if (classuri.Contains("!"))
                {
                    classuri = classuri.Replace('!', '#');
                }
            }
            else
            {
                classuri = "";
            }

            if (Request.QueryString["perpage"].IsNullOrEmpty() == false)
            {
                perpage = Request.QueryString["perpage"];
            }
            else
            {
                perpage = Request.Form["perpage"];
            }

            //if (perpage == string.Empty || perpage == null)
            //{
            //    perpage = Request.QueryString["perpage"];
            //}

            if (perpage.IsNullOrEmpty())
            {
                perpage = "15";
            }

            if (Request.QueryString["offset"].IsNullOrEmpty() == false)
            {
                offset = Request.QueryString["offset"];
            }
            else
            {
                offset = Request.Form["offset"];
            }

            if (offset.IsNullOrEmpty())
            {
                offset = "0";
            }



            if (Request.QueryString["otherfilters"].IsNullOrEmpty() == false)
            {
                otherfilters = Request.QueryString["otherfilters"];
            }

            if (Request.QueryString["institutionallexcept"].IsNullOrEmpty() == false)
            {
                institutionallexcept = Request.QueryString["institutionallexcept"];
            }

            if (Request.QueryString["departmentallexcept"].IsNullOrEmpty() == false)
            {
                departmentallexcept = Request.QueryString["departmentallexcept"];
            }

            if (Request.QueryString["divisionallexcept"].IsNullOrEmpty() == false)
            {
                divisionallexcept = Request.QueryString["divisionallexcept"];
            }

            if (Request.QueryString["exactphrase"].IsNullOrEmpty() == false)
            {
                exactphrase = Request.QueryString["exactphrase"];
            }

            if (Request.QueryString["nodeuri"].IsNullOrEmpty() == false)
            {
                nodeuri = Request.QueryString["nodeuri"];
                nodeid  = nodeuri.Substring(nodeuri.LastIndexOf("/") + 1);
            }



            string keywordOrPerson = "keyword";

            //added this test for search type so we could split the person keyword search into a split to remove the why col for person
            keywordOrPerson = data.SearchType(searchfor);



            if (keywordOrPerson == "person")
            {
                xml = data.CovidPersonSearchRequest(searchfor, offset, perpage, country);
            }
            else
            {
                xml = data.SearchRequest(searchfor, exactphrase, fname, lname, institution, institutionallexcept, department, departmentallexcept, division, divisionallexcept, "http://xmlns.com/foaf/0.1/Person", perpage, offset, otherfilters, "", true, ref searchrequest);
            }

            searchrequest            = xml.OuterXml;
            Session["SearchRequest"] = searchrequest;

            if (nodeuri != string.Empty && nodeid != string.Empty)
            {
                masterpage.RDFData = data.WhySearch(xml, nodeuri, Convert.ToInt64(nodeid));
            }
            else
            {
                masterpage.RDFData = data.Search(xml, false, false);
            }

            Framework.Utilities.DebugLogging.Log(masterpage.RDFData.OuterXml);
            masterpage.RDFNamespaces = rdfnamespaces.LoadNamespaces(masterpage.RDFData);
            masterpage.SearchRequest = searchrequest;
        }
Esempio n. 19
0
        private void DrawProfilesModule()
        {
            XsltArgumentList args               = new XsltArgumentList();
            long             offset             = 0;
            long             perpage            = 0;
            long             totalcount         = 0;
            long             totalpageremainder = 0;
            long             totalpages         = 0;
            long             startrecord        = 0;
            long             page               = 0;
            string           searchfor          = "";
            string           classgroupuri      = "";
            string           classuri           = "";

            string      fname         = "";
            string      lname         = "";
            string      institution   = "";
            string      department    = "";
            string      division      = "";
            string      sort          = "";
            string      sortdirection = "";
            string      searchrequest = "";
            XmlDocument xmlsearchrequest;

            xmlsearchrequest = new XmlDocument();

            Int16 showcolumns = 0;

            string otherfilters         = "";
            string institutionallexcept = string.Empty;
            string departmentallexcept  = string.Empty;
            string divisionallexcept    = string.Empty;
            string exactphrase          = "false"; // UCSF default value to allow old Mini Search to work


            string searchtype = "";

            Search.Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

            if (String.IsNullOrEmpty(Request.QueryString["searchrequest"]) == false)
            {
                searchrequest = data.DecryptRequest(Request.QueryString["searchrequest"]);
                xmlsearchrequest.LoadXml(searchrequest);
            }
            else if (string.IsNullOrEmpty(base.MasterPage.SearchRequest) == false)
            {
                searchrequest = data.DecryptRequest(base.MasterPage.SearchRequest);
                xmlsearchrequest.LoadXml(searchrequest);
            }


            if (String.IsNullOrEmpty(Request.QueryString["searchtype"]) == false)
            {
                searchtype = Request.QueryString["searchtype"];
            }
            else if (String.IsNullOrEmpty(Request.Form["searchtype"]) == false)
            {
                searchtype = Request.Form["searchtype"];
            }


            if (String.IsNullOrEmpty(Request.QueryString["searchfor"]) == false)
            {
                searchfor = Request.QueryString["searchfor"];
                //exactphrase = Request.QueryString["exactphrase"];  This is causing a bug. We test and set this if present later in this block anyway
            }
            else if (String.IsNullOrEmpty(Request.Form["txtSearchFor"]) == false)
            {
                searchfor = Request.Form["txtSearchFor"];
            }
            else if (xmlsearchrequest.ChildNodes.Count > 0)
            {
                try
                {
                    searchfor = xmlsearchrequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString").InnerText;
                }
                catch (Exception)
                {
                    // Do nothing, leave searchfor = null
                }
            }



            if (searchfor == null)
            {
                searchfor = string.Empty;
            }

            if (String.IsNullOrEmpty(Request.QueryString["lname"]) == false)
            {
                lname = Request.QueryString["lname"];
            }
            else
            {
                lname = Request.Form["txtLname"];
            }

            if (lname == null)
            {
                lname = string.Empty;
            }

            if (String.IsNullOrEmpty(Request.QueryString["fname"]) == false)
            {
                fname = Request.QueryString["fname"];
            }
            else
            {
                fname = Request.Form["txtFname"];
            }

            if (fname == null)
            {
                fname = string.Empty;
            }

            if (String.IsNullOrEmpty(Request.QueryString["institution"]) == false)
            {
                institution = Request.QueryString["institution"];
            }

            if (String.IsNullOrEmpty(Request.QueryString["department"]) == false)
            {
                department = Request.QueryString["department"];
            }

            if (String.IsNullOrEmpty(Request.QueryString["division"]) == false)
            {
                division = Request.QueryString["division"];
            }

            if (String.IsNullOrEmpty(Request.QueryString["perpage"]) == false)
            {
                perpage = Convert.ToInt64(Request.QueryString["perpage"]);
                if (!(perpage > 0))
                {
                    perpage = 15;
                }

                //if (String.IsNullOrEmpty(Request.QueryString["perpage"])==false)
                //    perpage = Convert.ToInt64(Request.QueryString["perpage"]);
                //else
                //    perpage = 15;
            }
            else
            {
                perpage = 15; //default
            }

            if (String.IsNullOrEmpty(Request.QueryString["offset"]) == false)
            {
                offset = Convert.ToInt64(Request.QueryString["offset"]);
                //if (Request.QueryString["offset"] != string.Empty)
                //    offset = Convert.ToInt64(Request.QueryString["offset"]);
                //else
                //    offset = 0;
            }
            else
            {
                offset = 0;
            }

            if (String.IsNullOrEmpty(Request.QueryString["page"]) == false)
            {
                page = Convert.ToInt64(Request.QueryString["page"]);
                if (!(page > 0))
                {
                    page = 1;
                }
                //if (Request.QueryString["page"] != string.Empty)
                //    page = Convert.ToInt64(Request.QueryString["page"]);
                //else
                //    page = 1;
            }
            else
            {
                page = 1;
            }


            if (String.IsNullOrEmpty(Request.QueryString["classgroupuri"]) == false)
            {
                classgroupuri = HttpUtility.UrlDecode(Request.QueryString["classgroupuri"]);
            }
            else
            {
                classgroupuri = HttpUtility.UrlDecode(Request.Form["classgroupuri"]);
            }

            if (classgroupuri != null)
            {
                if (classgroupuri.Contains("!"))
                {
                    classgroupuri = classgroupuri.Replace('!', '#');
                }
            }
            else
            {
                classgroupuri = string.Empty;
            }

            if (String.IsNullOrEmpty(Request.QueryString["classuri"]) == false)
            {
                classuri = HttpUtility.UrlDecode(Request.QueryString["classuri"]);
            }
            else
            {
                classuri = HttpUtility.UrlDecode(Request.Form["classuri"]);
            }

            if (classuri != null)
            {
                if (classuri.Contains("!"))
                {
                    classuri = classuri.Replace('!', '#');
                }
            }
            else
            {
                classuri = string.Empty;
            }


            if (String.IsNullOrEmpty(Request.QueryString["sortby"]) == false)
            {
                sort = Request.QueryString["sortby"];
            }

            if (String.IsNullOrEmpty(Request.QueryString["sortdirection"]) == false)
            {
                sortdirection = Request.QueryString["sortdirection"];
            }


            if (String.IsNullOrEmpty(Request.QueryString["showcolumns"]) == false)
            {
                showcolumns = Convert.ToInt16(Request.QueryString["showcolumns"]);
            }
            else
            {
                showcolumns = 1;
            }


            if (String.IsNullOrEmpty(Request.QueryString["otherfilters"]) == false)
            {
                otherfilters = Request.QueryString["otherfilters"];
            }



            if (String.IsNullOrEmpty(Request.QueryString["institutionallexcept"]) == false)
            {
                institutionallexcept = Request.QueryString["institutionallexcept"];
            }


            if (String.IsNullOrEmpty(Request.QueryString["departmentallexcept"]) == false)
            {
                departmentallexcept = Request.QueryString["departmentallexcept"];
            }

            if (String.IsNullOrEmpty(Request.QueryString["divisionallexcept"]) == false)
            {
                divisionallexcept = Request.QueryString["divisionallexcept"];
            }

            if (String.IsNullOrEmpty(Request.QueryString["exactphrase"]) == false)
            {
                exactphrase = Request.QueryString["exactphrase"];
            }


            try
            {
                totalcount = data.GetTotalSearchConnections(this.SearchData, base.Namespaces);

                if (page < 0)
                {
                    page = 1;
                }


                totalpages = Math.DivRem(totalcount, Convert.ToInt64(perpage), out totalpageremainder);

                if (totalpageremainder > 0)
                {
                    totalpages = totalpages + 1;
                }

                if (page > totalpages)
                {
                    page = totalpages;
                }

                startrecord = ((Convert.ToInt32(page) * Convert.ToInt32(perpage)) + 1) - Convert.ToInt32(perpage);

                if (startrecord < 0)
                {
                    startrecord = 1;
                }

                if (searchrequest.Trim() != string.Empty)
                {
                    searchrequest = data.EncryptRequest(searchrequest);
                }

                List <GenericListItem> g = new List <GenericListItem>();
                g = data.GetListOfFilters();

                if (otherfilters.IsNullOrEmpty() && base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property='http://profiles.catalyst.harvard.edu/ontology/prns#hasPersonFilter']", base.Namespaces) != null)
                {
                    string s = string.Empty;

                    foreach (XmlNode x in base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property='http://profiles.catalyst.harvard.edu/ontology/prns#hasPersonFilter']", base.Namespaces))
                    {
                        s             = data.GetConvertedURIListItem(g, x.InnerText);
                        otherfilters += "," + s;
                    }
                }

                switch (searchtype.ToLower())
                {
                case "everything":
                    xmlsearchrequest = data.SearchRequest(searchfor, exactphrase, classgroupuri, classuri, perpage.ToString(), (startrecord - 1).ToString());
                    break;

                default:
                    xmlsearchrequest = data.SearchRequest(searchfor, exactphrase, fname, lname, institution, institutionallexcept, department, departmentallexcept, division, divisionallexcept, "http://xmlns.com/foaf/0.1/Person", perpage.ToString(), (startrecord - 1).ToString(), sort, sortdirection, otherfilters, "", ref searchrequest);
                    break;
                }

                this.SearchData               = data.Search(xmlsearchrequest, false);
                this.SearchRequest            = data.EncryptRequest(xmlsearchrequest.OuterXml);
                base.MasterPage.SearchRequest = this.SearchRequest;
                base.MasterPage.RDFData       = this.SearchData;
                base.MasterPage.RDFNamespaces = this.Namespaces;

                // only shows these if we are not doing an everything search, or we are looking at people in the everything search
                if (!"everything".Equals(searchtype.ToLower()) || "http://profiles.catalyst.harvard.edu/ontology/prns#ClassGroupPeople".Equals(classgroupuri))
                {
                    new ORNGSearchRPCService(Page, this.SearchData, xmlsearchrequest, this.Namespaces);
                }
            }
            catch (DisallowedSearchException se)
            {
                litEverythingResults.Text = se.Message;
                return;
            }
            catch (Exception ex)
            {
                ex = ex;
                DebugLogging.Log("ERROR" + ex.Message);
                //for now just flip it back to the defaults. This is if someone keys some funky divide by zero stuff in the URL
                // to try and break the system.
                startrecord = 1;
                perpage     = 15;
            }

            args.AddParam("root", "", Root.Domain);
            args.AddParam("perpage", "", perpage);
            args.AddParam("offset", "", offset);
            args.AddParam("totalpages", "", totalpages);
            args.AddParam("page", "", page);
            args.AddParam("searchfor", "", searchfor);
            args.AddParam("exactphrase", "", exactphrase);
            args.AddParam("classGrpURIpassedin", "", classgroupuri);
            args.AddParam("classURIpassedin", "", classuri);
            args.AddParam("searchrequest", "", this.SearchRequest);

            switch (searchtype.ToLower())
            {
            case "everything":
                litEverythingResults.Text = XslHelper.TransformInMemory(Server.MapPath("~/Search/Modules/SearchResults/EverythingResults.xslt"), args, this.SearchData.OuterXml);
                break;

            case "people":

                args.AddParam("showcolumns", "", showcolumns.ToString());

                if ((showcolumns & 1) == 1)
                {
                    args.AddParam("institution", "", "true");
                }
                else
                {
                    args.AddParam("institution", "", "false");
                }

                if ((showcolumns & 2) == 2)
                {
                    args.AddParam("department", "", "true");
                }
                else
                {
                    args.AddParam("department", "", "false");
                }



                if ((showcolumns & 8) == 8)
                {
                    args.AddParam("facrank", "", "true");
                }
                else
                {
                    args.AddParam("facrank", "", "false");
                }



                //Profiles.Search.Utilities.DataIO dropdowns = new Profiles.Search.Utilities.DataIO();
                if (Convert.ToBoolean(ConfigurationSettings.AppSettings["ShowInstitutions"]) == true)
                {
                    args.AddParam("ShowInstitutions", "", "true");
                }
                else
                {
                    args.AddParam("ShowInstitutions", "", "false");
                }


                if (Convert.ToBoolean(ConfigurationSettings.AppSettings["ShowDepartments"]) == true)
                {
                    args.AddParam("ShowDepartments", "", "true");
                }
                else
                {
                    args.AddParam("ShowDepartments", "", "false");
                }

                //Faculty Rank always shows
                args.AddParam("ShowFacRank", "", "true");

                args.AddParam("currentsort", "", sort);
                args.AddParam("currentsortdirection", "", sortdirection);

                if (base.BaseData.SelectNodes("rdf:RDF/rdf:Description/vivo:overview/SearchDetails/SearchPhraseList", base.Namespaces).Count > 0)
                {
                    args.AddParam("why", "", true);
                }
                else
                {
                    args.AddParam("why", "", false);
                }

                litEverythingResults.Text = HttpUtility.HtmlDecode(XslHelper.TransformInMemory(Server.MapPath("~/Search/Modules/SearchResults/PeopleResults.xslt"), args, this.SearchData.OuterXml));
                break;
            }
        }
Esempio n. 20
0
        private void BuildFacultyType()
        {
            Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

            DropDownList ddl = new DropDownList();
            ddl.ID = "ddlChkList";
            ListItem lstItem = new ListItem();
            ddl.Items.Insert(0, lstItem);
            ddl.Attributes.Add("title", "faculty type");
            ddl.Width = new Unit(250);
            ddl.Height = new Unit(20);
            ddl.Attributes.Add("onclick", "showdivonClick()");
            ddl.Attributes.Add("onkeypress", "showdivonClick()");
            CheckBoxList chkBxLst = new CheckBoxList();
            chkBxLst.ID = "chkLstItem";
            chkBxLst.Attributes.Add("onmouseover", "showdiv()");
            chkBxLst.Attributes.Add("onfocus", "if ( event.keyCode == 13) showdiv()");
            List<GenericListItem> dtListItem = data.GetFacultyRanks();
            int rowNo = dtListItem.Count;
            string lstValue = string.Empty;
            string lstID = string.Empty;
            string javascript = string.Empty;

            litFacRankScript.Text = "<script>";
            for (int i = 0; i < rowNo; i++)
            {
                lstValue = dtListItem[i].Text;
                lstID = dtListItem[i].Value;
                lstItem = new ListItem("<a href=\"javascript:void(0)\" id=\"alst\" style=\"text-decoration:none;color:Black; \" onclick=\"getSelectedItem(' " + lstValue + "','" + i + "','" + lstID + "','anchor');\">" + lstValue + "</a>", lstID);
                lstItem.Attributes.Add("onclick", "getSelectedItem('" + lstValue + "','" + i + "','" + lstID + "','listItem');");

                if (SearchRequest != null && !lstID.IsNullOrEmpty())
                {
                    if (SearchRequest.OuterXml.Contains(lstID))
                    {
                        javascript += " javascript:getSelectedItem('" + lstValue + "','" + i + "','" + lstID + "','anchor');";
                    }
                }

                chkBxLst.Items.Add(lstItem);
            }

            litFacRankScript.Text += javascript + "</script>";

            System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
            div.ID = "divChkList";
            div.Controls.Add(chkBxLst);
            div.Style.Add("background-color", "#ffffff");
            div.Style.Add("position", "absolute");
            div.Style.Add("fload", "left");
            div.Style.Add("border", "black 1px solid");
            div.Style.Add("width", "249px");
            div.Style.Add("height", "180px");
            div.Style.Add("overflow", "AUTO");
            div.Style.Add("display", "none");
            div.Style.Add("padding-top", "25px");
            phDDLCHK.Controls.Add(ddl);
            phDDLList.Controls.Add(div);
        }
Esempio n. 21
0
        private void BuildFacultyType()
        {
            Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

            DropDownList ddl = new DropDownList();

            ddl.ID = "ddlChkList";
            ListItem lstItem = new ListItem();

            ddl.Items.Insert(0, lstItem);
            ddl.Attributes.Add("title", "faculty type");
            ddl.Width  = new Unit(250);
            ddl.Height = new Unit(20);
            ddl.Attributes.Add("onclick", "showdivonClick()");
            ddl.Attributes.Add("onkeypress", "showdivonClick()");
            CheckBoxList chkBxLst = new CheckBoxList();

            chkBxLst.ID = "chkLstItem";
            chkBxLst.Attributes.Add("onmouseover", "showdiv()");
            chkBxLst.Attributes.Add("onfocus", "if ( event.keyCode == 13) showdiv()");
            List <GenericListItem> dtListItem = data.GetFacultyRanks();
            int    rowNo      = dtListItem.Count;
            string lstValue   = string.Empty;
            string lstID      = string.Empty;
            string javascript = string.Empty;


            litFacRankScript.Text = "<script>";
            for (int i = 0; i < rowNo; i++)
            {
                lstValue = dtListItem[i].Text;
                lstID    = dtListItem[i].Value;
                lstItem  = new ListItem("<a href=\"javascript:void(0)\" id=\"alst\" style=\"text-decoration:none;color:Black; \" onclick=\"getSelectedItem(' " + lstValue + "','" + i + "','" + lstID + "','anchor');\">" + lstValue + "</a>", lstID);
                lstItem.Attributes.Add("onclick", "getSelectedItem('" + lstValue + "','" + i + "','" + lstID + "','listItem');");

                if (SearchRequest != null && !lstID.IsNullOrEmpty())
                {
                    if (SearchRequest.OuterXml.Contains(lstID))
                    {
                        javascript += " javascript:getSelectedItem('" + lstValue + "','" + i + "','" + lstID + "','anchor');";
                    }
                }

                chkBxLst.Items.Add(lstItem);
            }


            litFacRankScript.Text += javascript + "</script>";



            System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
            div.ID = "divChkList";
            div.Controls.Add(chkBxLst);
            div.Style.Add("background-color", "#ffffff");
            div.Style.Add("position", "absolute");
            div.Style.Add("fload", "left");
            div.Style.Add("border", "black 1px solid");
            div.Style.Add("width", "249px");
            div.Style.Add("height", "180px");
            div.Style.Add("overflow", "AUTO");
            div.Style.Add("display", "none");
            div.Style.Add("padding-top", "25px");
            phDDLCHK.Controls.Add(ddl);
            phDDLList.Controls.Add(div);
        }
Esempio n. 22
0
        private void ModifySearch()
        {
            Search.Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

            bool institutiondropdown = false;
            bool departmentdropdown = false;
            bool divisiondropdown = false;
            string searchrequest = string.Empty;

            if (base.MasterPage !=null)
            {
                if(base.MasterPage.SearchRequest.IsNullOrEmpty() ==false)
                searchrequest = base.MasterPage.SearchRequest;
            }
            else if (Request.QueryString["searchrequest"].IsNullOrEmpty() == false)
            {
                searchrequest = Request.QueryString["searchrequest"];
            }

            SearchRequest = new XmlDocument();

            ctcFirst.SearchRequest = new XmlDocument();

            SearchRequest.LoadXml(data.DecryptRequest(searchrequest));

            ctcFirst.SearchRequest = this.SearchRequest;

            if (SearchRequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString") != null)
            {
                txtSearchFor.Text = SearchRequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString").InnerText;
            }

            if (SearchRequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString/@ExactMatch") != null)
            {
                switch (SearchRequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString/@ExactMatch").Value)
                {
                    case "true":
                        chkExactphrase.Checked = true;
                        break;
                    case "false":
                        chkExactphrase.Checked = false;
                        break;
                }
            }

            if (SearchRequest.SelectSingleNode("SearchOptions/MatchOptions/SearchFiltersList") != null)
            {

                foreach (XmlNode x in SearchRequest.SelectNodes("SearchOptions/MatchOptions/SearchFiltersList/SearchFilter"))
                {
                    if (x.SelectSingleNode("@Property").Value == "http://vivoweb.org/ontology/core#personInPosition" && x.SelectSingleNode("@Property2").Value == "http://vivoweb.org/ontology/core#positionInOrganization")
                    {

                        litInstitution.Text = SearcDropDowns.BuildDropdown("institution", "249", x.InnerText);
                        institutiondropdown = true;

                        if (x.SelectSingleNode("@IsExclude").Value == "1")
                            institutionallexcept.Checked = true;
                        else
                            institutionallexcept.Checked = false;
                    }

                    if (x.SelectSingleNode("@Property").Value == "http://vivoweb.org/ontology/core#personInPosition" && x.SelectSingleNode("@Property2").Value == "http://profiles.catalyst.harvard.edu/ontology/prns#positionInDepartment")
                    {
                        litDepartment.Text = SearcDropDowns.BuildDropdown("department", "249", x.InnerText);
                        departmentdropdown = true;

                        if (x.SelectSingleNode("@IsExclude").Value == "1")
                            departmentallexcept.Checked = true;
                        else
                            departmentallexcept.Checked = false;
                    }

                    if (x.SelectSingleNode("@Property").Value == "http://vivoweb.org/ontology/core#personInPosition" && x.SelectSingleNode("@Property2").Value == "http://profiles.catalyst.harvard.edu/ontology/prns#positionInDivision")
                    {
                        litDivision.Text = SearcDropDowns.BuildDropdown("division", "249", x.InnerText);
                        divisiondropdown = true;

                        if (x.SelectSingleNode("@IsExclude").Value == "1")
                            divisionallexcept.Checked = true;
                        else
                            divisionallexcept.Checked = false;
                    }

                    if (x.SelectSingleNode("@Property").Value == "http://profiles.catalyst.harvard.edu/ontology/prns#hasPersonFilter")
                    {

                    }

                    if (x.SelectSingleNode("@Property").Value == "http://xmlns.com/foaf/0.1/firstName")
                    {
                        txtFname.Text = x.InnerText;
                    }

                    if (x.SelectSingleNode("@Property").Value == "http://xmlns.com/foaf/0.1/lastName")
                    {
                        txtLname.Text = x.InnerText;
                    }
                }
            }

            if (!institutiondropdown)
                litInstitution.Text = SearcDropDowns.BuildDropdown("institution", "249", "");

            if (!departmentdropdown)
                litDepartment.Text = SearcDropDowns.BuildDropdown("department", "249", "");

            if (!divisiondropdown)
                litDivision.Text = SearcDropDowns.BuildDropdown("division", "249", "");
        }
Esempio n. 23
0
        private void Search()
        {
            string lname       = Request.Form[this.txtLname.UniqueID];
            string fname       = Request.Form[this.txtFname.UniqueID];
            string searchfor   = Request.Form[this.txtSearchFor.UniqueID];
            string exactphrase = Request.Form[this.chkExactphrase.UniqueID];
            string facrank     = Request.Form[this.hidList.UniqueID];

            if (exactphrase == "on")
            {
                exactphrase = "true";
            }
            else
            {
                exactphrase = "false";
            }

            string institution          = "";
            string institutionallexcept = "";

            string department          = "";
            string departmentallexcept = "";

            string division          = "";
            string divisionallexcept = "";


            if (Request.Form["institution"] != null)
            {
                institution          = Request.Form["institution"];
                institutionallexcept = Request.Form[this.institutionallexcept.UniqueID];//Request.Form["institutionallexcept"];
            }

            if (!Request.Form["department"].IsNullOrEmpty())
            {
                department          = Request.Form["department"];
                departmentallexcept = Request.Form[this.departmentallexcept.UniqueID];
            }


            if (!Request.Form["division"].IsNullOrEmpty())
            {
                division          = Request.Form["division"];
                divisionallexcept = Request.Form[this.divisionallexcept.UniqueID];
            }

            string otherfilters = Request.Form["hdnSelectedText"];

            string classuri = "http://xmlns.com/foaf/0.1/Person";

            string searchrequest = string.Empty;

            Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();



            data.SearchRequest(searchfor, exactphrase, fname, lname, institution, institutionallexcept,
                               department, departmentallexcept, division, divisionallexcept, classuri, "15", "0", "", "", otherfilters, facrank, ref searchrequest);

            Response.Redirect(Root.Domain + "/search/default.aspx?showcolumns=1&searchtype=people&otherfilters=" + otherfilters + "&searchrequest=" + searchrequest, true);
        }
            public override string getCallbackResponse()
            {
                try
                {
                    searchRequest.SelectSingleNode("/SearchOptions/OutputOptions/Offset").InnerText = "0";
                    searchRequest.SelectSingleNode("/SearchOptions/OutputOptions/Limit").InnerText = "500";
                    XmlDocument searchData = new Profiles.Search.Utilities.DataIO().Search(searchRequest, false, false);

                    DebugLogging.Log("SeachCallbackResponse :" + searchRequest.ToString());

                    List<string> peopleURIs = new List<string>();
                    XmlNodeList people = searchData.GetElementsByTagName("rdf:object");
                    for (int i = 0; i < people.Count; i++)
                    {
                        peopleURIs.Add(people[i].Attributes["rdf:resource"].Value);
                    }
                    if (peopleURIs.Count > 0)
                    {
                        return BuildJSONPersonIds(peopleURIs, "" + peopleURIs.Count + " people found");
                    }
                }
                catch (Exception e)
                {
                    DebugLogging.Log(e.Message);
                }

                return null;
            }
Esempio n. 25
0
        //Need to process this at the page level for the framework data
        //to process the presentation XML
        public void LoadRDFSearchResults()
        {
            XmlDocument xml           = new XmlDocument();
            Namespace   rdfnamespaces = new Namespace();

            Utilities.DataIO data = new Utilities.DataIO();

            string searchtype  = string.Empty;
            string lname       = string.Empty;
            string fname       = string.Empty;
            string institution = string.Empty;
            string department  = string.Empty;
            string division    = string.Empty;

            string searchfor            = string.Empty;
            string classgroupuri        = string.Empty;
            string classuri             = string.Empty;
            string perpage              = string.Empty;
            string offset               = string.Empty;
            string sortby               = string.Empty;
            string sortdirection        = string.Empty;
            string searchrequest        = string.Empty;
            string otherfilters         = string.Empty;
            string institutionallexcept = string.Empty;
            string departmentallexcept  = string.Empty;
            string divisionallexcept    = string.Empty;
            string exactphrase          = string.Empty;
            string nodeuri              = string.Empty;
            string nodeid               = string.Empty;


            if (this.SearchType.IsNullOrEmpty() == false)
            {
                searchtype = this.SearchType;
            }

            //else if (Request.Form["searchtype"] != null)
            //{
            //    searchtype = Request.Form["searchtype"];
            //}

            if (Request.QueryString["searchfor"].IsNullOrEmpty() == false)
            {
                searchfor = Request.QueryString["searchfor"];
            }

            if (Request.Form["txtSearchFor"].IsNullOrEmpty() == false)
            {
                searchfor = Request.Form["txtSearchFor"];
            }

            if (Request.QueryString["lname"].IsNullOrEmpty() == false)
            {
                lname = Request.QueryString["lname"];
            }

            if (Request.QueryString["institution"].IsNullOrEmpty() == false)
            {
                institution = Request.QueryString["institution"];
            }

            if (Request.QueryString["department"].IsNullOrEmpty() == false)
            {
                department = Request.QueryString["department"];
            }

            if (Request.QueryString["division"].IsNullOrEmpty() == false)
            {
                division = Request.QueryString["division"];
            }

            if (Request.QueryString["fname"].IsNullOrEmpty() == false)
            {
                fname = Request.QueryString["fname"];
            }

            if (Request.QueryString["classgroupuri"].IsNullOrEmpty() == false)
            {
                classgroupuri = HttpUtility.UrlDecode(Request.QueryString["classgroupuri"]);
            }
            else
            {
                classgroupuri = HttpUtility.UrlDecode(Request.Form["classgroupuri"]);
            }

            if (classgroupuri != null)
            {
                if (classgroupuri.Contains("!"))
                {
                    classgroupuri = classgroupuri.Replace('!', '#');
                }
            }

            if (Request.QueryString["classuri"].IsNullOrEmpty() == false)
            {
                classuri = HttpUtility.UrlDecode(Request.QueryString["classuri"]);
            }
            else
            {
                classuri = HttpUtility.UrlDecode(Request.Form["classuri"]);
            }

            if (classuri != null)
            {
                if (classuri.Contains("!"))
                {
                    classuri = classuri.Replace('!', '#');
                }
            }
            else
            {
                classuri = "";
            }

            if (Request.QueryString["perpage"].IsNullOrEmpty() == false)
            {
                perpage = Request.QueryString["perpage"];
            }
            else
            {
                perpage = Request.Form["perpage"];
            }

            //if (perpage == string.Empty || perpage == null)
            //{
            //    perpage = Request.QueryString["perpage"];
            //}

            if (perpage.IsNullOrEmpty())
            {
                perpage = "15";
            }

            if (Request.QueryString["offset"].IsNullOrEmpty() == false)
            {
                offset = Request.QueryString["offset"];
            }
            else
            {
                offset = Request.Form["offset"];
            }

            if (offset.IsNullOrEmpty())
            {
                offset = "0";
            }

            //if (offset == null)
            //    offset = "0";

            if (Request.QueryString["sortby"].IsNullOrEmpty() == false)
            {
                sortby = Request.QueryString["sortby"];
            }

            if (Request.QueryString["sortdirection"].IsNullOrEmpty() == false)
            {
                sortdirection = Request.QueryString["sortdirection"];
            }

            if (Request.QueryString["searchrequest"].IsNullOrEmpty() == false)
            {
                searchrequest = Request.QueryString["searchrequest"];
            }
            else if (masterpage.SearchRequest.IsNullOrEmpty() == false)
            {
                searchrequest = masterpage.SearchRequest;
            }

            if (Request.QueryString["otherfilters"].IsNullOrEmpty() == false)
            {
                otherfilters = Request.QueryString["otherfilters"];
            }

            if (Request.QueryString["institutionallexcept"].IsNullOrEmpty() == false)
            {
                institutionallexcept = Request.QueryString["institutionallexcept"];
            }

            if (Request.QueryString["departmentallexcept"].IsNullOrEmpty() == false)
            {
                departmentallexcept = Request.QueryString["departmentallexcept"];
            }

            if (Request.QueryString["divisionallexcept"].IsNullOrEmpty() == false)
            {
                divisionallexcept = Request.QueryString["divisionallexcept"];
            }

            if (Request.QueryString["exactphrase"].IsNullOrEmpty() == false)
            {
                exactphrase = Request.QueryString["exactphrase"];
            }

            if (Request.QueryString["nodeuri"].IsNullOrEmpty() == false)
            {
                nodeuri = Request.QueryString["nodeuri"];
                nodeid  = nodeuri.Substring(nodeuri.LastIndexOf("/") + 1);
            }

            switch (searchtype.ToLower())
            {
            case "everything":

                if (searchrequest != string.Empty)
                {
                    xml.LoadXml(data.DecryptRequest(searchrequest));
                }
                else
                {
                    xml = data.SearchRequest(searchfor, exactphrase, classgroupuri, classuri, perpage, offset);
                }

                break;

            default:                    //Person is the default
                if (searchrequest != string.Empty)
                {
                    xml.LoadXml(data.DecryptRequest(searchrequest));
                }
                else
                {
                    xml = data.SearchRequest(searchfor, exactphrase, fname, lname, institution, institutionallexcept, department, departmentallexcept, division, divisionallexcept, classuri, perpage, offset, sortby, sortdirection, otherfilters, "", ref searchrequest);
                }
                break;
            }


            if (nodeuri != string.Empty && nodeid != string.Empty)
            {
                masterpage.RDFData = data.WhySearch(xml, nodeuri, Convert.ToInt64(nodeid));
            }
            else
            {
                masterpage.RDFData = data.Search(xml, false);
            }

            Framework.Utilities.DebugLogging.Log(masterpage.RDFData.OuterXml);
            masterpage.RDFNamespaces = rdfnamespaces.LoadNamespaces(masterpage.RDFData);
            masterpage.SearchRequest = searchrequest;
        }
Esempio n. 26
0
        private void DrawProfilesModule()
        {
            XsltArgumentList args = new XsltArgumentList();
            long offset = 0;
            long perpage = 0;
            long totalcount = 0;
            long totalpageremainder = 0;
            long totalpages = 0;
            long startrecord = 0;
            long page = 0;
            string searchfor = "";
            string classgroupuri = "";
            string classuri = "";

            string fname = "";
            string lname = "";
            string institution = "";
            string department = "";
            string division = "";
            string sort = "";
            string sortdirection = "";
            string searchrequest = "";
            XmlDocument xmlsearchrequest;
            xmlsearchrequest = new XmlDocument();

            Int16 showcolumns = 0;

            string otherfilters = "";
            string institutionallexcept = string.Empty;
            string departmentallexcept = string.Empty;
            string divisionallexcept = string.Empty;
            string exactphrase = "false"; // UCSF default value to allow old Mini Search to work

            string searchtype = "";

            Search.Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

            if (String.IsNullOrEmpty(Request.QueryString["searchrequest"])==false)
            {
                searchrequest = data.DecryptRequest(Request.QueryString["searchrequest"]);
                xmlsearchrequest.LoadXml(searchrequest);
            }
            else if (string.IsNullOrEmpty(base.MasterPage.SearchRequest) == false)
            {
                searchrequest = data.DecryptRequest(base.MasterPage.SearchRequest);
                xmlsearchrequest.LoadXml(searchrequest);
            }

            if (String.IsNullOrEmpty(Request.QueryString["searchtype"])==false)
            {
                searchtype = Request.QueryString["searchtype"];
            }
            else if (String.IsNullOrEmpty(Request.Form["searchtype"])==false)
            {
                searchtype = Request.Form["searchtype"];
            }

            if (String.IsNullOrEmpty(Request.QueryString["searchfor"])==false)
            {
                searchfor = Request.QueryString["searchfor"];
                //exactphrase = Request.QueryString["exactphrase"];  This is causing a bug. We test and set this if present later in this block anyway
            }
            else if(String.IsNullOrEmpty(Request.Form["txtSearchFor"])==false)
            {
                searchfor = Request.Form["txtSearchFor"];
            }
            else if (xmlsearchrequest.ChildNodes.Count > 0)
            {
                try
                {
                    searchfor = xmlsearchrequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString").InnerText;
                }
                catch(Exception)
                {
                    // Do nothing, leave searchfor = null
                }
            }

            if (searchfor == null)
                searchfor = string.Empty;

            if (String.IsNullOrEmpty(Request.QueryString["lname"])==false)
                lname = Request.QueryString["lname"];
            else
                lname = Request.Form["txtLname"];

            if (lname == null)
                lname = string.Empty;

            if (String.IsNullOrEmpty(Request.QueryString["fname"])==false)
                fname = Request.QueryString["fname"];
            else
                fname = Request.Form["txtFname"];

            if (fname == null)
                fname = string.Empty;

            if (String.IsNullOrEmpty(Request.QueryString["institution"])==false)
                institution = Request.QueryString["institution"];

            if (String.IsNullOrEmpty(Request.QueryString["department"])==false)
                department = Request.QueryString["department"];

            if (String.IsNullOrEmpty(Request.QueryString["division"]) == false)
                division = Request.QueryString["division"];

            if (String.IsNullOrEmpty(Request.QueryString["perpage"])==false)
            {
                perpage = Convert.ToInt64(Request.QueryString["perpage"]);
                if (!(perpage>0))
                    perpage = 15;

                //if (String.IsNullOrEmpty(Request.QueryString["perpage"])==false)
                //    perpage = Convert.ToInt64(Request.QueryString["perpage"]);
                //else
                //    perpage = 15;
            }
            else
            {
                perpage = 15; //default
            }

            if (String.IsNullOrEmpty(Request.QueryString["offset"])==false)
            {
                offset = Convert.ToInt64(Request.QueryString["offset"]);
                //if (Request.QueryString["offset"] != string.Empty)
                //    offset = Convert.ToInt64(Request.QueryString["offset"]);
                //else
                //    offset = 0;
            }
            else
            {
                offset = 0;
            }

            if (String.IsNullOrEmpty(Request.QueryString["page"])==false)
            {
                page = Convert.ToInt64(Request.QueryString["page"]);
                if (!(page > 0))
                    page = 1;
                //if (Request.QueryString["page"] != string.Empty)
                //    page = Convert.ToInt64(Request.QueryString["page"]);
                //else
                //    page = 1;
            }
            else
            {
                page = 1;
            }

            if (String.IsNullOrEmpty(Request.QueryString["classgroupuri"])==false)
                classgroupuri = HttpUtility.UrlDecode(Request.QueryString["classgroupuri"]);
            else
                classgroupuri = HttpUtility.UrlDecode(Request.Form["classgroupuri"]);

            if (classgroupuri != null)
            {
                if (classgroupuri.Contains("!"))
                    classgroupuri = classgroupuri.Replace('!', '#');
            }
            else
            {
                classgroupuri = string.Empty;
            }

            if (String.IsNullOrEmpty(Request.QueryString["classuri"])==false)
                classuri = HttpUtility.UrlDecode(Request.QueryString["classuri"]);
            else
                classuri = HttpUtility.UrlDecode(Request.Form["classuri"]);

            if (classuri != null)
            {
                if (classuri.Contains("!"))
                    classuri = classuri.Replace('!', '#');
            }
            else
            {
                classuri = string.Empty;
            }

            if (String.IsNullOrEmpty(Request.QueryString["sortby"])==false)
                sort = Request.QueryString["sortby"];

            if (String.IsNullOrEmpty(Request.QueryString["sortdirection"])==false)
                sortdirection = Request.QueryString["sortdirection"];

            if (String.IsNullOrEmpty(Request.QueryString["showcolumns"])==false)
            {
                showcolumns = Convert.ToInt16(Request.QueryString["showcolumns"]);
            }
            else
            {
                showcolumns = 1;
            }

            if (String.IsNullOrEmpty(Request.QueryString["otherfilters"])==false)
            {
                otherfilters = Request.QueryString["otherfilters"];

            }

            if (String.IsNullOrEmpty(Request.QueryString["institutionallexcept"])==false)
            {
                institutionallexcept = Request.QueryString["institutionallexcept"];

            }

            if (String.IsNullOrEmpty(Request.QueryString["departmentallexcept"])==false)
            {
                departmentallexcept = Request.QueryString["departmentallexcept"];

            }

            if (String.IsNullOrEmpty(Request.QueryString["divisionallexcept"]) == false)
            {
                divisionallexcept = Request.QueryString["divisionallexcept"];

            }

            if (String.IsNullOrEmpty(Request.QueryString["exactphrase"])==false)
            {
                exactphrase = Request.QueryString["exactphrase"];

            }

            try
            {

                totalcount = data.GetTotalSearchConnections(this.SearchData, base.Namespaces);

                if (page < 0)
                {
                    page = 1;
                }

                totalpages = Math.DivRem(totalcount, Convert.ToInt64(perpage), out totalpageremainder);

                if (totalpageremainder > 0) { totalpages = totalpages + 1; }

                if (page > totalpages)
                    page = totalpages;

                startrecord = ((Convert.ToInt32(page) * Convert.ToInt32(perpage)) + 1) - Convert.ToInt32(perpage);

                if (startrecord < 0)
                    startrecord = 1;

                if (searchrequest.Trim() != string.Empty)
                    searchrequest = data.EncryptRequest(searchrequest);

                List<GenericListItem> g = new List<GenericListItem>();
                g = data.GetListOfFilters();

                if (otherfilters.IsNullOrEmpty() && base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property='http://profiles.catalyst.harvard.edu/ontology/prns#hasPersonFilter']", base.Namespaces) != null)
                {
                    string s = string.Empty;

                    foreach (XmlNode x in base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property='http://profiles.catalyst.harvard.edu/ontology/prns#hasPersonFilter']", base.Namespaces))
                    {
                        s = data.GetConvertedURIListItem(g, x.InnerText);
                        otherfilters += "," + s;
                    }
                }

                switch (searchtype.ToLower())
                {
                    case "everything":
                        xmlsearchrequest = data.SearchRequest(searchfor, exactphrase, classgroupuri, classuri, perpage.ToString(), (startrecord - 1).ToString());
                        break;

                    default:
                        xmlsearchrequest = data.SearchRequest(searchfor, exactphrase, fname, lname, institution, institutionallexcept, department, departmentallexcept, division, divisionallexcept,  "http://xmlns.com/foaf/0.1/Person", perpage.ToString(), (startrecord - 1).ToString(), sort, sortdirection, otherfilters, "",ref searchrequest);
                        break;
                }

                this.SearchData = data.Search(xmlsearchrequest, false);
                this.SearchRequest = data.EncryptRequest(xmlsearchrequest.OuterXml);
                base.MasterPage.SearchRequest = this.SearchRequest;
                base.MasterPage.RDFData = this.SearchData;
                base.MasterPage.RDFNamespaces = this.Namespaces;

                // only shows these if we are not doing an everything search, or we are looking at people in the everything search
                if (!"everything".Equals(searchtype.ToLower()) || "http://profiles.catalyst.harvard.edu/ontology/prns#ClassGroupPeople".Equals(classgroupuri))
                {
                    new ORNGSearchRPCService(Page, this.SearchData, xmlsearchrequest, this.Namespaces);
                }
            }
            catch (DisallowedSearchException se)
            {
                litEverythingResults.Text = se.Message;
                return;
            }
            catch (Exception ex)
            {
                ex = ex;
                DebugLogging.Log("ERROR" + ex.Message);
                //for now just flip it back to the defaults. This is if someone keys some funky divide by zero stuff in the URL
                // to try and break the system.
                startrecord = 1;
                perpage = 15;
            }

            args.AddParam("root", "", Root.Domain);
            args.AddParam("perpage", "", perpage);
            args.AddParam("offset", "", offset);
            args.AddParam("totalpages", "", totalpages);
            args.AddParam("page", "", page);
            args.AddParam("searchfor", "", searchfor);
            args.AddParam("exactphrase", "", exactphrase);
            args.AddParam("classGrpURIpassedin", "", classgroupuri);
            args.AddParam("classURIpassedin", "", classuri);
            args.AddParam("searchrequest", "", this.SearchRequest);

            switch (searchtype.ToLower())
            {
                case "everything":
                    litEverythingResults.Text = XslHelper.TransformInMemory(Server.MapPath("~/Search/Modules/SearchResults/EverythingResults.xslt"), args, this.SearchData.OuterXml);
                    break;
                case "people":

                    args.AddParam("showcolumns", "", showcolumns.ToString());

                    if ((showcolumns & 1) == 1)
                    {
                        args.AddParam("institution", "", "true");
                    }
                    else
                    {
                        args.AddParam("institution", "", "false");
                    }

                    if ((showcolumns & 2) == 2)
                    {
                        args.AddParam("department", "", "true");
                    }
                    else
                    {
                        args.AddParam("department", "", "false");
                    }

                    if ((showcolumns & 8) == 8)
                    {
                        args.AddParam("facrank", "", "true");
                    }
                    else
                    {
                        args.AddParam("facrank", "", "false");
                    }

                    //Profiles.Search.Utilities.DataIO dropdowns = new Profiles.Search.Utilities.DataIO();
                    if (Convert.ToBoolean(ConfigurationSettings.AppSettings["ShowInstitutions"]) == true)
                    {

                        args.AddParam("ShowInstitutions", "", "true");
                    }
                    else
                    {
                        args.AddParam("ShowInstitutions", "", "false");
                    }

                    if (Convert.ToBoolean(ConfigurationSettings.AppSettings["ShowDepartments"]) == true)
                    {
                        args.AddParam("ShowDepartments", "", "true");
                    }
                    else
                    {
                        args.AddParam("ShowDepartments", "", "false");
                    }

                    //Faculty Rank always shows
                    args.AddParam("ShowFacRank", "", "true");

                    args.AddParam("currentsort", "", sort);
                    args.AddParam("currentsortdirection", "", sortdirection);

                    if (base.BaseData.SelectNodes("rdf:RDF/rdf:Description/vivo:overview/SearchDetails/SearchPhraseList", base.Namespaces).Count > 0)
                        args.AddParam("why", "", true);
                    else
                        args.AddParam("why", "", false);

                    litEverythingResults.Text = HttpUtility.HtmlDecode( XslHelper.TransformInMemory(Server.MapPath("~/Search/Modules/SearchResults/PeopleResults.xslt"), args, this.SearchData.OuterXml));
                    break;
            }
        }
        //Need to process this at the page level for the framework data
        //to process the presentation XML
        public void LoadRDFSearchResults()
        {
            XmlDocument xml = new XmlDocument();
            Namespace rdfnamespaces = new Namespace();
            Utilities.DataIO data = new Utilities.DataIO();

            string searchtype = string.Empty;
            string lname = string.Empty;
            string fname = string.Empty;
            string institution = string.Empty;
            string department = string.Empty;
            string division = string.Empty;

            string searchfor = string.Empty;
            string classgroupuri = string.Empty;
            string classuri = string.Empty;
            string perpage = string.Empty;
            string offset = string.Empty;
            string sortby = string.Empty;
            string sortdirection = string.Empty;
            string searchrequest = string.Empty;
            string otherfilters = string.Empty;
            string institutionallexcept = string.Empty;
            string departmentallexcept = string.Empty;
            string divisionallexcept = string.Empty;
            string exactphrase = string.Empty;
            string nodeuri = string.Empty;
            string nodeid = string.Empty;

            if (this.SearchType.IsNullOrEmpty() == false)
                searchtype = this.SearchType;

            //else if (Request.Form["searchtype"] != null)
            //{
            //    searchtype = Request.Form["searchtype"];
            //}

            if (Request.QueryString["searchfor"].IsNullOrEmpty() == false)
                searchfor = Request.QueryString["searchfor"];

            if (Request.Form["txtSearchFor"].IsNullOrEmpty() == false)
                searchfor = Request.Form["txtSearchFor"];

            if (Request.QueryString["lname"].IsNullOrEmpty() == false)
                lname = Request.QueryString["lname"];

            if (Request.QueryString["institution"].IsNullOrEmpty() == false)
                institution = Request.QueryString["institution"];

            if (Request.QueryString["department"].IsNullOrEmpty() == false)
                department = Request.QueryString["department"];

            if (Request.QueryString["division"].IsNullOrEmpty() == false)
                division = Request.QueryString["division"];

            if (Request.QueryString["fname"].IsNullOrEmpty() == false)
                fname = Request.QueryString["fname"];

            if (Request.QueryString["classgroupuri"].IsNullOrEmpty() == false)
                classgroupuri = HttpUtility.UrlDecode(Request.QueryString["classgroupuri"]);
            else
                classgroupuri = HttpUtility.UrlDecode(Request.Form["classgroupuri"]);

            if (classgroupuri != null)
            {
                if (classgroupuri.Contains("!"))
                    classgroupuri = classgroupuri.Replace('!', '#');
            }

            if (Request.QueryString["classuri"].IsNullOrEmpty() == false)
                classuri = HttpUtility.UrlDecode(Request.QueryString["classuri"]);
            else
                classuri = HttpUtility.UrlDecode(Request.Form["classuri"]);

            if (classuri != null)
            {
                if (classuri.Contains("!"))
                    classuri = classuri.Replace('!', '#');
            }
            else
            {
                classuri = "";
            }

            if (Request.QueryString["perpage"].IsNullOrEmpty() == false)
                perpage = Request.QueryString["perpage"];
            else
                perpage = Request.Form["perpage"];

            //if (perpage == string.Empty || perpage == null)
            //{
            //    perpage = Request.QueryString["perpage"];
            //}

            if (perpage.IsNullOrEmpty())
                perpage = "15";

            if (Request.QueryString["offset"].IsNullOrEmpty() == false)
                offset = Request.QueryString["offset"];
            else
                offset = Request.Form["offset"];

            if (offset.IsNullOrEmpty())
                offset = "0";

            //if (offset == null)
            //    offset = "0";

            if (Request.QueryString["sortby"].IsNullOrEmpty() == false)
                sortby = Request.QueryString["sortby"];

            if (Request.QueryString["sortdirection"].IsNullOrEmpty() == false)
                sortdirection = Request.QueryString["sortdirection"];

            if (Request.QueryString["searchrequest"].IsNullOrEmpty() == false)
                searchrequest = Request.QueryString["searchrequest"];
            else if (masterpage.SearchRequest.IsNullOrEmpty() == false)
                searchrequest = masterpage.SearchRequest;

            if (Request.QueryString["otherfilters"].IsNullOrEmpty() == false)
                otherfilters = Request.QueryString["otherfilters"];

            if (Request.QueryString["institutionallexcept"].IsNullOrEmpty() == false)
                institutionallexcept = Request.QueryString["institutionallexcept"];

            if (Request.QueryString["departmentallexcept"].IsNullOrEmpty() == false)
                departmentallexcept = Request.QueryString["departmentallexcept"];

            if (Request.QueryString["divisionallexcept"].IsNullOrEmpty() == false)
                divisionallexcept = Request.QueryString["divisionallexcept"];

            if (Request.QueryString["exactphrase"].IsNullOrEmpty() == false)
                exactphrase = Request.QueryString["exactphrase"];

            if (Request.QueryString["nodeuri"].IsNullOrEmpty() == false)
            {
                nodeuri = Request.QueryString["nodeuri"];
                nodeid = nodeuri.Substring(nodeuri.LastIndexOf("/") + 1);
            }

            switch (searchtype.ToLower())
            {
                case "everything":

                    if (searchrequest != string.Empty)
                        xml.LoadXml(data.DecryptRequest(searchrequest));
                    else
                        xml = data.SearchRequest(searchfor, exactphrase, classgroupuri, classuri, perpage, offset);

                    break;
                default:                //Person is the default
                    if (searchrequest != string.Empty)
                        xml.LoadXml(data.DecryptRequest(searchrequest));
                    else
                        xml = data.SearchRequest(searchfor, exactphrase, fname, lname, institution, institutionallexcept, department, departmentallexcept, division, divisionallexcept, classuri, perpage, offset, sortby, sortdirection, otherfilters, "", ref searchrequest);
                    break;
            }

            if (nodeuri != string.Empty && nodeid != string.Empty)
                masterpage.RDFData = data.WhySearch(xml, nodeuri, Convert.ToInt64(nodeid));
            else
                masterpage.RDFData = data.Search(xml, false);

            Framework.Utilities.DebugLogging.Log(masterpage.RDFData.OuterXml);
            masterpage.RDFNamespaces = rdfnamespaces.LoadNamespaces(masterpage.RDFData);
            masterpage.SearchRequest = searchrequest;
        }
        public XmlDocument Execute(string QueryID, string SortBy, string StartRecord, string MaxRecords)
        {
            XmlDocument rtn = new XmlDocument();
            try
            {
                DataIO search = new DataIO();
                XmlDocument returndata = new XmlDocument();
                _doc.LoadXml(search.GetQueryXML(QueryID));

                if (_doc == null)
                {
                    _doc = new XmlDocument();
                    _doc.Load(AppDomain.CurrentDomain.BaseDirectory.ToString() + "/Search/Utilities/GetPersonListWithQueryID.xml");
                    this.LoadQueryID(QueryID);
                    this.LoadOutputOptions(SortBy, StartRecord, MaxRecords);
                }
                else
                {

                    this.SetPages(StartRecord, MaxRecords);
                    this.SetSort(SortBy);
                }

                //TODO: ZAP: Sometimes the personid gets cached if its a connection search of a keyword.
                if (_doc.SelectSingleNode("Profiles/QueryDefinition/PersonID") != null)
                {
                    _doc.SelectSingleNode("Profiles/QueryDefinition/PersonID").InnerText = "";
                }

                returndata = search.BetaSearch(_doc);

                this.QueryID = QueryID;

                CacheWrapper.CacheItem(QueryID + "request", _doc);
                CacheWrapper.CacheItem(QueryID + "results", returndata);
                rtn = returndata;
            }
            catch (Exception ex)
            {
                //For Debugging only put a break(F9) on the ex=ex while debugging,  if an error takes place at this level then the cache for the query header has
                // exprired so notify the user and have them start a new search session.
               Framework.Utilities.DebugLogging.Log(ex.Message + " ++ " + ex.StackTrace);

            }

            return rtn;
        }
        private void DrawProfilesModule()
        {
            XsltArgumentList args = new XsltArgumentList();

            args.AddParam("root", "", Root.Domain);

            Search.Utilities.APISearchRequest apisearch = new APISearchRequest();
            Search.Utilities.DataIO data = new Profiles.Search.Utilities.DataIO();

            string queryid = string.Empty;
            string keyword = string.Empty;
            string personid = string.Empty;
            string nodeid = string.Empty;

            //I dont know what the root of /people should return so for now I require the queryid
            if (Request.QueryString["queryid"] != null)
            {
                queryid = Request.QueryString["queryid"].ToString().Trim();

            }

            if (Request.QueryString["nodeid"] != null)
            {
                nodeid = Request.QueryString["nodeid"].ToString().Trim();

            }

            keyword = data.KeyKeyword(queryid);
            personid = data.PersonID(queryid, nodeid);

            this.SearchData = apisearch.Execute(queryid, keyword, personid);

            litKeywordConnection.Text = XslHelper.TransformInMemory(Server.MapPath("~/Search/Modules/KeywordConnection/KeywordConnection.xslt"), args, this.SearchData.OuterXml);
        }