Exemple #1
0
        public CustomEditMainImage(XmlDocument pagedata, List <ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
            : base(pagedata, moduleparams, pagenamespaces)
        {
            Edit.Utilities.DataIO data = new Profiles.Edit.Utilities.DataIO();
            SessionManagement     sm   = new SessionManagement();

            this.XMLData = pagedata;

            propdata = new Profiles.Profile.Utilities.DataIO();

            if (Request.QueryString["subject"] != null)
            {
                this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]);
            }
            else if (base.GetRawQueryStringItem("subject") != null)
            {
                this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject"));
            }
            else
            {
                Response.Redirect("~/search");
            }

            this.PredicateURI    = Request.QueryString["predicateuri"].Replace("!", "#");
            this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, PredicateURI, false, true, false);
            litBackLink.Text     = "<a href='" + Root.Domain + "/edit/" + this.SubjectID.ToString() + "'>Edit Menu</a> &gt; <b>" + PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value + "</b>";

            securityOptions.Subject        = this.SubjectID;
            securityOptions.PredicateURI   = PredicateURI;
            securityOptions.PrivacyCode    = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value);
            securityOptions.SecurityGroups = new XmlDataDocument();
            securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml);

            securityOptions.BubbleClick += SecurityDisplayed;
        }
Exemple #2
0
        public void LoadRDFData()
        {
            Framework.Utilities.DebugLogging.Log("{Page Calling} Profile.ProfileData.LoadRDFData() start " + ((System.Web.UI.TemplateControl)(this)).AppRelativeVirtualPath);
            XmlDocument xml           = new XmlDocument();
            Namespace   rdfnamespaces = new Namespace();

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

            if (HttpContext.Current.Request.Headers["Offset"] != null)
            {
                this.RDFTriple.Offset = HttpContext.Current.Request.Headers["Offset"];
            }

            if (HttpContext.Current.Request.Headers["Limit"] != null)
            {
                this.RDFTriple.Limit = HttpContext.Current.Request.Headers["Limit"];
            }

            if (HttpContext.Current.Request.Headers["ExpandRDFList"] != null)
            {
                this.RDFTriple.ExpandRDFList = HttpContext.Current.Request.Headers["ExpandRDFList"];
            }

            xml                = data.GetRDFData(this.RDFTriple);
            this.RDFData       = xml;
            this.RDFNamespaces = rdfnamespaces.LoadNamespaces(xml);
            Framework.Utilities.DebugLogging.Log("{Page Calling} Profile.ProfileData.LoadRDFData() end" + ((System.Web.UI.TemplateControl)(this)).AppRelativeVirtualPath);
        }
        protected virtual void SetConnectionData()
        {
            var dataIO = new Profiles.Profile.Utilities.DataIO();

            this.ConnectionDetails = new List <Publication>();

            // Loop through reader and fill object
            using (var rdr = dataIO.GetProfileConnection(new RDFTriple(this.Subject.NodeId, 0, this.Object.NodeId), this.StoredProcedureName))
            {
                bool headerLoaded = false;
                while (rdr.Read())
                {
                    // Data is denormalized.  Load header object once
                    if (headerLoaded == false)
                    {
                        this.ConnectionStrength = double.Parse(rdr["TotalOverallWeight"].ToString());
                    }

                    this.ConnectionDetails.Add(new Publication
                    {
                        PMID        = long.Parse(rdr["PMID"].ToString()),
                        Description = rdr["Reference"].ToString(),
                        Score       = double.Parse(rdr["OverallWeight"].ToString())
                    });

                    headerLoaded = true;
                }
            }
        }
Exemple #4
0
        protected override void SetConnectionData()
        {
            var dataIO = new Profiles.Profile.Utilities.DataIO();

            // Loop through reader and fill object
            using (var rdr = dataIO.GetProfileConnection(new RDFTriple(this.Subject.NodeId, 0, this.Object.NodeId), this.StoredProcedureName))
            {
                bool headerLoaded = false;
                while (rdr.Read())
                {
                    // Data is denormalized.  Load header object once
                    if (headerLoaded == false)
                    {
                        this.ConnectionStrength = double.Parse(rdr["TotalOverallWeight"].ToString());
                    }

                    SimilarConcept sim = new SimilarConcept
                    {
                        MeshTerm       = rdr["MeshHeader"].ToString(),
                        OverallWeight  = double.Parse(rdr["OverallWeight"].ToString()),
                        ConceptProfile = rdr["ObjectURI"].ToString()
                    };

                    sim.Subject.KeywordWeight        = double.Parse(rdr["KeywordWeight1"].ToString());
                    sim.Subject.ConceptConnectionURI = rdr["ConnectionURI1"].ToString();
                    sim.Object.KeywordWeight         = double.Parse(rdr["KeywordWeight2"].ToString());
                    sim.Object.ConceptConnectionURI  = rdr["ConnectionURI2"].ToString();

                    this.ConnectionDetails.Add(sim);

                    headerLoaded = true;
                }
                rdr.Close();
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            if (!string.IsNullOrEmpty(context.Request.QueryString["msg"]))
            {
                Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO();
                SqlDataReader    reader;
                string           email = context.Request.QueryString["msg"];

                SqlCommand cmd = new SqlCommand("SELECT [Utility.Application].[fnDecryptBase64RC4] ( '" + email + "',   (Select [value] from [Framework.].parameter with(nolock) where ParameterID = 'RC4EncryptionKey'))");
                reader = data.GetSQLDataReader(cmd);
                reader.Read();

                string EmailText = reader[0].ToString();
                char[] s1        = EmailText.ToCharArray();
                char[] s2        = new char[s1.Length * 2];
                for (int i = 0; i < s1.Length; i++)
                {
                    s2[2 * i]     = s1[i];
                    s2[2 * i + 1] = ' ';
                }
                EmailText = new String(s2);
                EmailText = EmailText.Replace(".", "dot");
                context.Response.ContentType = "audio/wav";
                //MemoryStream mstream = GetAudio(EmailText);
                MemoryStream mstream = GetAudio(EmailText);
                mstream.Position = 0;
                mstream.WriteTo(context.Response.OutputStream);
                context.Response.End();
            }
        }
Exemple #6
0
        public CustomEditAuthorInAuthorship(XmlDocument pagedata, List <ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
            : base(pagedata, moduleparams, pagenamespaces)
        {
            SessionManagement sm = new SessionManagement();

            Utilities.DataIO data = new Profiles.Edit.Utilities.DataIO();
            propdata = new Profiles.Profile.Utilities.DataIO();

            this._subject      = Convert.ToInt64(Request.QueryString["subject"]);
            this._predicateuri = Request.QueryString["predicateuri"].Replace("!", "#");
            this._personId     = data.GetPersonID(_subject);

            Session["NodeID"]    = this._subject;
            Session["SessionID"] = sm.Session().SessionID;

            this.PropertyListXML = propdata.GetPropertyList(pagedata, base.PresentationXML, this._predicateuri, false, true, false);

            securityOptions.Subject        = this._subject;
            securityOptions.PredicateURI   = this._predicateuri;
            securityOptions.PrivacyCode    = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value);
            securityOptions.SecurityGroups = new XmlDocument();
            securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml);


            securityOptions.BubbleClick += SecurityDisplayed;
        }
        private void DrawProfilesModule()
        {
            Utilities.DataIO        data   = new Profiles.Profile.Utilities.DataIO();
            Search.Utilities.DataIO search = new Profiles.Search.Utilities.DataIO();

            XmlDocument     xml   = data.GetSameDepartment(base.RDFTriple);
            List <ListItem> items = new List <ListItem>();


            if (xml.SelectSingleNode("Network/NumberOfConnections").InnerText != "0")
            {
                string departmenturi   = xml.SelectSingleNode("Network/DepartmentURI").InnerText;
                string insitutitionuri = xml.SelectSingleNode("Network/InstitutionURI").InnerText;
                string searchrequest   = string.Empty;

                search.SearchRequest("", "", "", "", insitutitionuri, "", departmenturi, "", "", "", "http://xmlns.com/foaf/0.1/Person", "25", "0", "", "", "", "", false, ref searchrequest);

                this.SearchRequest = searchrequest;

                foreach (XmlNode n in xml.SelectNodes("Network/Connection"))
                {
                    items.Add(new ListItem(n.InnerText, n.SelectSingleNode("@URI").Value));
                }

                rptSameDepartment.DataSource = items;
                rptSameDepartment.DataBind();
            }
            else
            {
                rptSameDepartment.Visible = false;
            }
        }
        public void DrawProfilesModule()
        {
            var           dataIO = new Profiles.Profile.Utilities.DataIO();
            StringBuilder html   = new StringBuilder();

            using (var reader = dataIO.GetConceptTopJournal(base.RDFTriple))
            {
                while (reader.Read())
                {
                    html.AppendFormat("<li><a href=\"javascript:alert('{0}')\">{1}</a></li>", reader["JournalTitle"].ToString(), reader["Journal"].ToString());
                }
                reader.Close();
            }

            // Hide section title if no Top Journals are returned
            if (html.ToString().Length == 0)
            {
                sectionTitle.Attributes.Add("style", "display: none;");
            }
            else
            {
                imgQuestion.ImageUrl = Root.Domain + "/Framework/Images/info.png";
                lineItemLiteral.Text = html.ToString();
            }
        }
        public CustomEditWebsite(XmlDocument pagedata, List <ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
            : base(pagedata, moduleparams, pagenamespaces)
        {
            SessionManagement sm = new SessionManagement();

            this.XMLData = pagedata;

            data = new Profiles.Edit.Modules.CustomEditWebsite.DataIO();
            Profiles.Profile.Utilities.DataIO propdata = new Profiles.Profile.Utilities.DataIO();

            if (Request.QueryString["subject"] != null)
            {
                this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]);
            }
            else if (base.GetRawQueryStringItem("subject") != null)
            {
                this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject"));
            }
            else
            {
                Response.Redirect("~/search");
            }

            Predicate            = Request.QueryString["predicateuri"].Replace("!", "#");
            this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, Predicate, false, true, false);

            this.PredicateID = data.GetStoreNode(Predicate);

            base.GetNetworkProfile(this.SubjectID, this.PredicateID);

            litBackLink.Text = "<a href='" + Root.Domain + "/edit/default.aspx?subject=" + this.SubjectID.ToString() + "'>Edit Menu</a> &gt; <b>" + PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value + "</b>";

            btnEditAwards.Text = "Add " + PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value + "(s)";
            lblNoAwards.Text   = "No " + PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value + "s have been added.";

            securityOptions.Subject        = this.SubjectID;
            securityOptions.PredicateURI   = Predicate;
            securityOptions.PrivacyCode    = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value);
            securityOptions.SecurityGroups = new XmlDocument();
            securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml);

            if (Request.QueryString["new"] != null && Session["new"] != null)
            {
                Session["pnlInsertAward.Visible"] = null;
                Session["new"] = null;

                if (Session["newclose"] != null)
                {
                    Session["newclose"] = null;
                    btnInsertCancel_OnClick(this, new EventArgs());
                }
                else
                {
                    btnEditAwards_OnClick(this, new EventArgs());
                }
            }

            securityOptions.BubbleClick += SecurityDisplayed;
        }
        public void DrawProfilesModule()
        {
            Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO();

            if (Request.QueryString["Subject"] == null)
            {
                return;
            }

            base.RDFTriple = new RDFTriple(Convert.ToInt64(Request.QueryString["Subject"]));



            dlGoogleMapLinks.DataSource = data.GetGoogleMapZoomLinks();
            dlGoogleMapLinks.DataBind();

            SqlDataReader reader  = null;
            SqlDataReader reader2 = null;

            Profiles.Framework.Utilities.SessionManagement session = new SessionManagement();

            GoogleMapHelper gmh = new GoogleMapHelper();

            if (base.GetModuleParamString("MapType") == "CoAuthor")
            {
                reader  = data.GetGMapUserCoAuthors(base.RDFTriple.Subject, 0, session.Session().SessionID);
                reader2 = data.GetGMapUserCoAuthors(base.RDFTriple.Subject, 1, session.Session().SessionID);
            }

            if (base.GetModuleParamString("MapType") == "SimilarTo")
            {
                reader  = data.GetGMapUserSimilarPeople(base.RDFTriple.Subject, false, session.Session().SessionID);
                reader2 = data.GetGMapUserSimilarPeople(base.RDFTriple.Subject, true, session.Session().SessionID);
            }

            if (base.GetModuleParamString("MapType") == "Group")
            {
                litCoauthorGroup.Text = "group members";
                reader  = data.GetGMapUserGroup(base.RDFTriple.Subject, 0, session.Session().SessionID);
                reader2 = data.GetGMapUserGroup(base.RDFTriple.Subject, 1, session.Session().SessionID);
            }

            string googleCode, tableText;

            gmh.MapPlotPeople(base.RDFTriple.Subject, reader, reader2, out googleCode, out tableText);
            litGoogleCode.Text  = googleCode;
            litNetworkText.Text = tableText;


            if (!reader.IsClosed)
            {
                reader.Close();
            }

            if (!reader2.IsClosed)
            {
                reader2.Close();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO();

            Profiles.Framework.Utilities.RDFTriple request = new RDFTriple(Convert.ToInt32(Request.QueryString["p"]));
            Response.ContentType = "application/xml; charset=utf-8";
            Response.Write(data.GetProfileNetworkForBrowserXML(request).InnerXml);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO();

            Profiles.Framework.Utilities.RDFTriple request = new RDFTriple(Convert.ToInt32(Request.QueryString["p"]));
            Response.ContentType = "application/json; charset=utf-8";
            Response.AppendHeader("Access-Control-Allow-Origin", "*");
            Response.Write(data.GetProfileNetworkForBrowser(request));
        }
        public void ProcessRequest(HttpContext context)
        {
            // Set up the response settings
            context.Response.ContentType = "image/jpeg";
            context.Response.Cache.SetCacheability(HttpCacheability.Public);
            context.Response.BufferOutput = false;

            if (!string.IsNullOrEmpty(context.Request.QueryString["NodeID"]))
            {

                // get the id for the image
                Int64 nodeid = Convert.ToInt32(context.Request.QueryString["NodeID"]);
                bool harvarddefault = false;

                if (context.Request.QueryString["HarvardDefault"] != null)
                {
                    harvarddefault = true;
                }

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

                Framework.Utilities.RDFTriple request = new Profiles.Framework.Utilities.RDFTriple(nodeid);

                request.Expand = true;
                Framework.Utilities.Namespace xmlnamespace = new Profiles.Framework.Utilities.Namespace();
                XmlDocument person ;

                person = data.GetRDFData(request);
                XmlNamespaceManager namespaces =  xmlnamespace.LoadNamespaces(person);

                if (person.SelectSingleNode("rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", namespaces) != null)
                {

                    //Set up the response settings
                    context.Response.ContentType = "image/jpeg";
                    context.Response.Cache.SetCacheability(HttpCacheability.Public);
                    context.Response.BufferOutput = false;

                    Stream stream = data.GetUserPhotoList(nodeid,harvarddefault);

                    const int buffersize = 1024 * 16;
                    byte[] buffer2 = new byte[buffersize];
                    int count = stream.Read(buffer2, 0, buffersize);
                    while (count > 0)
                    {
                        context.Response.OutputStream.Write(buffer2, 0, count);
                        count = stream.Read(buffer2, 0, buffersize);
                    }

                }
                else
                {

                    context.Response.Write("No Image Found");
                }
            }
        }
            //***************************************************************************************************************************************
            public Modules.NetworkMap.NetworkMap.GoogleMapLocation GetDefaultZoom()
            {
                Modules.NetworkMap.NetworkMap.GoogleMapLocation loc = null;
                Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO();


                loc = data.GetGoogleMapZoomLinks().Find(delegate(Modules.NetworkMap.NetworkMap.GoogleMapLocation item) { return(item.DefaultLevel == "True"); });

                return(loc);
            }
        public void ProcessRequest(HttpContext context)
        {
            // Set up the response settings
            context.Response.ContentType = "image/jpeg";
            context.Response.Cache.SetCacheability(HttpCacheability.Public);
            context.Response.BufferOutput = false;

            if (!string.IsNullOrEmpty(context.Request.QueryString["NodeID"]))
            {
                // get the id for the image
                Int64 nodeid         = Convert.ToInt32(context.Request.QueryString["NodeID"]);
                bool  harvarddefault = false;

                if (context.Request.QueryString["HarvardDefault"] != null)
                {
                    harvarddefault = true;
                }

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

                Framework.Utilities.RDFTriple request = new Profiles.Framework.Utilities.RDFTriple(nodeid);

                request.Expand = true;
                Framework.Utilities.Namespace xmlnamespace = new Profiles.Framework.Utilities.Namespace();
                XmlDocument person;

                person = data.GetRDFData(request);
                XmlNamespaceManager namespaces = xmlnamespace.LoadNamespaces(person);

                if (person.SelectSingleNode("rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", namespaces) != null)
                {
                    //Set up the response settings
                    context.Response.ContentType = "image/jpeg";
                    context.Response.Cache.SetCacheability(HttpCacheability.Public);
                    context.Response.BufferOutput = false;

                    Stream stream = data.GetUserPhotoList(nodeid, harvarddefault);

                    const int buffersize = 1024 * 16;
                    byte[]    buffer2    = new byte[buffersize];
                    int       count      = stream.Read(buffer2, 0, buffersize);
                    while (count > 0)
                    {
                        context.Response.OutputStream.Write(buffer2, 0, count);
                        count = stream.Read(buffer2, 0, buffersize);
                    }
                }
                else
                {
                    context.Response.Write("No Image Found");
                }
            }
        }
Exemple #16
0
        public PropertyList(XmlDocument pagedata, List <ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
            : base(pagedata, moduleparams, pagenamespaces)
        {
            XmlDocument       presentationxml = base.PresentationXML;
            SessionManagement sm = new SessionManagement();

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


            this.PropertyListXML = data.GetPropertyList(pagedata, presentationxml, "", false, false, true);

            mp = new ModulesProcessing();
        }
Exemple #17
0
        public EditPersonalGadget(XmlDocument pagedata, List <ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
            : base(pagedata, moduleparams, pagenamespaces)
        {
            SessionManagement sm = new SessionManagement();

            base.BaseData = pagedata;

            data = new Profiles.ORNG.Utilities.DataIO();
            Profiles.Edit.Utilities.DataIO    editdata = new Profiles.Edit.Utilities.DataIO();
            Profiles.Profile.Utilities.DataIO propdata = new Profiles.Profile.Utilities.DataIO();

            if (Request.QueryString["subject"] != null)
            {
                this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]);
            }
            else if (base.GetRawQueryStringItem("subject") != null)
            {
                this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject"));
            }
            else
            {
                Response.Redirect("~/search");
            }

            this.PredicateURI    = Request.QueryString["predicateuri"].Replace("!", "#");
            this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, this.PredicateURI, false, true, false);
            litBackLink.Text     = "<a href='" + Root.Domain + "/edit/" + this.SubjectID.ToString() + "'>Edit Menu</a> &gt; <b>" + PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value + "</b>";


            //create a new network triple request.
            base.RDFTriple = new RDFTriple(this.SubjectID, editdata.GetStoreNode(this.PredicateURI));

            base.RDFTriple.Expand      = true;
            base.RDFTriple.ShowDetails = true;
            base.GetDataByURI();//This will reset the data to a Network.

            // Profiles OpenSocial Extension by UCSF
            uri    = this.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/@rdf:about", base.Namespaces).Value;
            uri    = uri.Substring(0, uri.IndexOf(Convert.ToString(this.SubjectID)) + Convert.ToString(this.SubjectID).Length);
            appId  = Convert.ToInt32(base.GetModuleParamString("AppId"));
            om     = OpenSocialManager.GetOpenSocialManager(uri, Page, true);
            gadget = om.AddGadget(appId, base.GetModuleParamString("View"), base.GetModuleParamString("OptParams"));

            securityOptions.Subject        = this.SubjectID;
            securityOptions.PredicateURI   = this.PredicateURI;
            securityOptions.PrivacyCode    = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value);
            securityOptions.SecurityGroups = new XmlDataDocument();
            securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml);

            hasGadget = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@NumberOfConnections").Value) > 0;
        }
        private void DrawProfilesModule()
        {
            base.RDFTriple = new RDFTriple(Convert.ToInt64(Request.QueryString["Subject"]));

            Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO();
            SqlDataReader    reader;

            // Get support text
            using (reader = data.GetPublicationSupportHtml(base.RDFTriple, base.MasterPage.CanEdit))
            {
                while (reader.Read())
                {
                    supportText.Text = reader["HTML"].ToString();
                }
                reader.Close();
            }
        }
        public CustomEditEagleI(XmlDocument pagedata, List <ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
            : base(pagedata, moduleparams, pagenamespaces)
        {
            SessionManagement sm = new SessionManagement();

            base.BaseData = pagedata;

            Profiles.Profile.Utilities.DataIO propdata = new Profiles.Profile.Utilities.DataIO();
            data = new Edit.Utilities.DataIO();



            if (Request.QueryString["subject"] != null)
            {
                this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]);
            }
            else if (base.GetRawQueryStringItem("subject") != null)
            {
                this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject"));
            }
            else
            {
                Response.Redirect("~/search");
            }

            string predicateuri = Request.QueryString["predicateuri"].Replace("!", "#");

            this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, predicateuri, false, true, false);
            litBackLink.Text     = "<a href='" + Root.Domain + "/edit/" + this.SubjectID.ToString() + "'>Edit Menu</a> &gt; <b>" + PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value + "</b>";


            //create a new network triple request.
            base.RDFTriple = new RDFTriple(this.SubjectID, data.GetStoreNode(predicateuri));

            base.RDFTriple.Expand      = true;
            base.RDFTriple.ShowDetails = true;
            base.GetDataByURI();//This will reset the data to a Network.



            securityOptions.Subject        = this.SubjectID;
            securityOptions.PredicateURI   = predicateuri;
            securityOptions.PrivacyCode    = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value);
            securityOptions.SecurityGroups = new XmlDataDocument();
            securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml);
        }
        public void DrawProfilesCloud()
        {
            XmlDocument document = new XmlDocument();
            string      xml      = string.Empty;

            Profiles.Profile.Utilities.DataIO pdata = new Profiles.Profile.Utilities.DataIO();
            RDFTriple request = new RDFTriple(Convert.ToInt64(Request.QueryString["subject"]));


            document.LoadXml(pdata.GetNetworkCloud(request).ToString().Replace("&", "&amp;"));

            XslCompiledTransform xslt = new XslCompiledTransform();
            XsltArgumentList     args = new XsltArgumentList();

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

            litListView.Text = XslHelper.TransformInMemory(Server.MapPath("~/Profile/Modules/NetworkList/NetworkList.xslt"), args, document.OuterXml);
        }
        public CustomEditGroupSettings(XmlDocument pagedata, List <ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
            : base(pagedata, moduleparams, pagenamespaces)
        {
            SessionManagement sm = new SessionManagement();

            data     = new Profiles.Edit.Utilities.DataIO();
            propdata = new Profiles.Profile.Utilities.DataIO();
            string predicateuri = Request.QueryString["predicateuri"].Replace("!", "#");

            if (Request.QueryString["subject"] != null)
            {
                this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]);
            }
            else if (base.GetRawQueryStringItem("subject") != null)
            {
                this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject"));
            }
            else
            {
                Response.Redirect("~/search");
            }

            litBackLink.Text = "<a href='" + Root.Domain + "/edit/" + this.SubjectID + "'>Edit Menu</a> &gt; <b>Group Settings</b>";

            //btnEditProperty.Text = "Add " + PropertyLabel;
            imbAddArror.Visible = true;

            SqlDataReader reader = data.GetGroup(SubjectID);

            reader.Read();
            securityOptions.PrivacyCode = Convert.ToInt32(reader["ViewSecurityGroup"].ToString());
            reader.Close();

            //this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, predicateuri, false, true, false);

            //this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, predicateuri, false, true, false);
            securityOptions.Subject      = this.SubjectID;
            securityOptions.PredicateURI = predicateuri;
            //securityOptions.PrivacyCode = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value);
            securityOptions.SecurityGroups = new XmlDataDocument();
            securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml);

            //txtLabel.Attributes.Add("data-autocomplete-url", Root.Domain + "/edit/Modules/CustomEditFreetextKeyword/keywordAutocomplete.aspx?keys=");
        }
        public void DrawProfilesModule()
        {
            XmlDocument document = new XmlDocument();
            string      xml      = string.Empty;


            Utilities.DataIO data    = new Profiles.Profile.Utilities.DataIO();
            RDFTriple        request = new RDFTriple(Convert.ToInt64(Request.QueryString["subject"]));


            document.LoadXml(data.GetNetworkCategory(request).ToString());

            XslCompiledTransform xslt = new XslCompiledTransform();
            XsltArgumentList     args = new XsltArgumentList();

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

            litCategoryList.Text = Framework.Utilities.XslHelper.TransformInMemory(Server.MapPath("~/Profile/modules/NetworkCategories/NetworkCategories.xslt"), args, document.OuterXml);
        }
        public CustomEditGroupSettings(XmlDocument pagedata, List <ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
            : base(pagedata, moduleparams, pagenamespaces)
        {
            SessionManagement sm = new SessionManagement();

            data     = new Profiles.Edit.Utilities.DataIO();
            propdata = new Profiles.Profile.Utilities.DataIO();
            string predicateuri = Request.QueryString["predicateuri"].Replace("!", "#");

            if (Request.QueryString["subject"] != null)
            {
                this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]);
            }
            else if (base.GetRawQueryStringItem("subject") != null)
            {
                this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject"));
            }
            else
            {
                Response.Redirect("~/search");
            }

            litBackLink.Text = "<a href='" + Root.Domain + "/edit/default.aspx?subject=" + this.SubjectID + "'>Edit Menu</a> &gt; <b>Group Settings</b>";


            imbAddArror.Visible = true;

            SqlDataReader reader = data.GetGroup(SubjectID);

            reader.Read();
            securityOptions.PrivacyCode = Convert.ToInt32(reader["ViewSecurityGroup"].ToString());
            reader.Close();


            securityOptions.Subject      = this.SubjectID;
            securityOptions.PredicateURI = predicateuri;

            securityOptions.SecurityGroups = new XmlDocument();
            securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml);

            securityOptions.BubbleClick += SecurityDisplayed;
        }
        private void DrawProfilesModule()
        {
            Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO();
            string listid = "";

            if (!string.IsNullOrEmpty(Request.QueryString["listid"]))
            {
                listid = Request.QueryString["listid"].ToString();


                dlGoogleMapLinks.DataSource = data.GetGoogleMapZoomLinks();
                dlGoogleMapLinks.DataBind();

                SqlDataReader reader  = null;
                SqlDataReader reader2 = null;

                Profiles.Framework.Utilities.SessionManagement session = new SessionManagement();

                GoogleMapHelper gmh = new GoogleMapHelper();


                reader             = Profiles.Lists.Utilities.DataIO.GetGMapList(listid, "0", session.Session().SessionID);
                reader2            = Profiles.Lists.Utilities.DataIO.GetGMapList(listid, "1", session.Session().SessionID);
                litRedMapType.Text = "list members";


                string googleCode;
                gmh.MapPlotPeople(reader, reader2, out googleCode);
                litGoogleCode.Text = googleCode;


                if (!reader.IsClosed)
                {
                    reader.Close();
                }

                if (!reader2.IsClosed)
                {
                    reader2.Close();
                }
            }
        }
        public void LoadPageData()
        {
            Framework.Utilities.Namespace namespaces = new Namespace();

            Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO();
            this.PresentationXML = data.GetPresentationData(this.RDFTriple);

            XmlNode x = this.PresentationXML.SelectSingleNode("Presentation[1]/ExpandRDFList[1]");

            if (x != null)
            {
                this.RDFTriple.ExpandRDFList = x.OuterXml;
            }

            this.RDFData = data.GetRDFData(this.RDFTriple);



            this.RDFNamespaces = namespaces.LoadNamespaces(this.RDFData);
        }
Exemple #26
0
        public void DrawProfilesModule()
        {
            Utilities.DataIO dataIO      = new Profiles.Profile.Utilities.DataIO();
            StringBuilder    html        = new StringBuilder();
            List <string>    reader      = dataIO.GetEagleI(base.RDFTriple.Subject);
            string           eagleIEmail = ConfigurationManager.AppSettings["EAGLEI.EmailAddress"];

            litHead.Text = "<table><tr><td><table style='width:480px;font-weight:bold;color:#888;padding:5px 0px;'>" +
                           "<tr><td valign='top' xstyle='width:90%'>This researcher has shared information about their research resources <br/>in the eagle-i Network.  To update or add resource records, contact <br/>" +
                           "<a href='mailto:" + eagleIEmail + "'>" + eagleIEmail + "</a>.</td>" +
                           "</tr></table></td><td style='text-align:center'><img src='" + Root.Domain + "/profile/modules/CustomViewEagleI/Images/logo.gif'/></td></tr></table>";


            for (int i = 0; i < reader.Count; i++)
            {
                html.Append("<div class='mentor-completed'>");
                html.Append(reader[i]);
                html.Append("</div>");
            }

            litHtml.Text = html.ToString();
        }
        public EditDataTypeProperty(XmlDocument pagedata, List <ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
            : base(pagedata, moduleparams, pagenamespaces)
        {
            SessionManagement sm = new SessionManagement();

            propdata = new Profiles.Profile.Utilities.DataIO();
            data     = new Profiles.Edit.Utilities.DataIO();
            string predicateuri = Request.QueryString["predicateuri"].Replace("!", "#");

            this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, predicateuri, false, true, false);
            PropertyLabel        = this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value;

            if (Request.QueryString["subject"] != null)
            {
                this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]);
            }
            else if (base.GetRawQueryStringItem("subject") != null)
            {
                this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject"));
            }
            else
            {
                Response.Redirect("~/search");
            }

            litBackLink.Text = "<a href='" + Root.Domain + "/edit/" + this.SubjectID + "'>Edit Menu</a> &gt; <b>" + PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value + "</b>";

            btnEditProperty.Text = "Add " + PropertyLabel;

            this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, predicateuri, false, true, false);
            this.MaxCardinality  = this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@MaxCardinality").Value;
            this.MinCardinality  = this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@MinCardinality").Value;

            securityOptions.Subject        = this.SubjectID;
            securityOptions.PredicateURI   = predicateuri;
            securityOptions.PrivacyCode    = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value);
            securityOptions.SecurityGroups = new XmlDataDocument();
            securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml);
        }
        private void DrawProfilesModule()
        {
            Profiles.Profile.Utilities.DataIO dataIO = new Profiles.Profile.Utilities.DataIO();
            StringBuilder html              = new StringBuilder();
            List <string> reader            = dataIO.GetEagleI(this.SubjectID);
            string        eagleIEmail       = ConfigurationManager.AppSettings["EAGLEI.EmailAddress"];
            string        eagleIInstitution = ConfigurationManager.AppSettings["EAGLEI.InstitutionName"];

            html.Append("<div class='mentor-completed'>Information in the research resource module is provided automatically from the ");
            html.Append(eagleIInstitution);
            html.Append(" repository of the eagle-i Network. To update information or list your resources in eagle-i, please contact <a href='mailto:");
            html.Append(eagleIEmail);
            html.Append("'>");
            html.Append(eagleIEmail);
            html.Append("</a>. For more information about the eagle-i research resource network, visit <a href='http://www.eagle-i.net'>www.eagle-i.net</a>.</div><br>");


            if (reader.Count == 0)
            {
                html
                .Append("<div class='mentor-current'>")
                .AppendFormat("<div><i>You have no current records in the eagle-i system.</i></div></div>");
            }
            else
            {
                for (int loop = 0; loop < reader.Count; loop++)
                {
                    html
                    .Append("<div class='mentor-current'>")
                    .Append(reader[loop])
                    .Append("</div>");
                }
            }


            // Pass to control
            litEagleI.Text = html.ToString();
        }
        private new void Init()
        {
            if (Request.QueryString["subject"] != null)
            {
                this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]);
            }
            else if (base.GetRawQueryStringItem("subject") != null)
            {
                this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject"));
            }

            //name of the class that owns this class;
            if (Request.QueryString["predicateuri"] != null)
            {
                this.PredicateURI = Request.QueryString["predicateuri"];
            }
            else if (base.GetRawQueryStringItem("subject") != null)
            {
                this.PredicateURI = base.GetRawQueryStringItem("predicateuri");
            }


            this.propdata = new Profiles.Profile.Utilities.DataIO();
        }
        public void ProcessRequest(HttpContext context)
        {
            Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO();
            // Set up the response settings
            context.Response.ContentType = "image/jpeg";
            context.Response.Cache.SetCacheability(HttpCacheability.Public);
            context.Response.BufferOutput = false;

            Int64 nodeid = -1;

            if (!string.IsNullOrEmpty(context.Request.QueryString["NodeID"]))
            {

                // get the id for the image
                nodeid = Convert.ToInt32(context.Request.QueryString["NodeID"]);
            }
            if (nodeid > 0)
            {
                bool thumbnail = false;
                int width = 150;
                int height = 300;
                if (context.Request.QueryString["Thumbnail"] != null)
                {
                    thumbnail = true;
                }
                if (context.Request.QueryString["Width"] != null)
                {
                    width = Convert.ToInt32(context.Request.QueryString["Width"]);
                    height = 2 * width;
                }
                if (context.Request.QueryString["Height"] != null)
                {
                    height = Convert.ToInt32(context.Request.QueryString["Height"]);
                }

                byte[] image = (byte[])Framework.Utilities.Cache.FetchObject(GetCacheKey(nodeid, width, height));

                if (image == null)
                {
                    // stuff below this and if statement is what makes it slow
                    Framework.Utilities.RDFTriple request = new Profiles.Framework.Utilities.RDFTriple(nodeid);

                    request.Expand = true;
                    request.ShowDetails = true;
                    request.ExpandRDFList = "<ExpandRDF Class=\"http://xmlns.com/foaf/0.1/Person\" Property=\"http://vivoweb.org/ontology/core#authorInAuthorship\" Limit=\"1\" />";
                    Framework.Utilities.Namespace xmlnamespace = new Profiles.Framework.Utilities.Namespace();
                    XmlDocument person;

                    person = data.GetRDFData(request);
                    XmlNamespaceManager namespaces = xmlnamespace.LoadNamespaces(person);

                    byte[] rawimage = null;
                    if (person.SelectSingleNode("rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", namespaces) != null)
                    {
                        rawimage = data.GetUserPhotoList(nodeid);
                    }
                    else if (thumbnail)
                    {
                        rawimage = silhouetteImage;
                    }
                    if (rawimage != null)
                    {
                        Edit.Utilities.DataIO resize = new Profiles.Edit.Utilities.DataIO();
                        image = resize.ResizeImageFile(rawimage, width, height);
                        // we are caching silhouettes many times, but that is OK
                        Framework.Utilities.Cache.Set(GetCacheKey(nodeid, width, height), image, nodeid, request.Session.SessionID);
                    }
                }

                if (image != null)
                {
                    Stream stream = new System.IO.MemoryStream(image);

                    // Set up the response settings
                    context.Response.ContentType = "image/jpeg";
                    context.Response.Cache.SetExpires(DateTime.Now.AddDays(7));
                    context.Response.Cache.SetCacheability(HttpCacheability.Public);
                    context.Response.Cache.SetValidUntilExpires(true);
                    context.Response.BufferOutput = false;
                    context.Response.AddHeader("Content-Length", stream.Length.ToString());

                    const int buffersize = 1024 * 16;
                    byte[] buffer2 = new byte[buffersize];
                    int count = stream.Read(buffer2, 0, buffersize);
                    while (count > 0)
                    {
                        context.Response.OutputStream.Write(buffer2, 0, count);
                        count = stream.Read(buffer2, 0, buffersize);
                    }
                }
                else
                {
                    context.Response.Write("No Image Found");
                }

            }
        }
Exemple #31
0
        protected void InitAssets()
        {
            System.Web.UI.HtmlControls.HtmlLink NetworkBrowsercss = new System.Web.UI.HtmlControls.HtmlLink();
            NetworkBrowsercss.Href = Root.Domain + "/Profile/CSS/NetworkBrowser.css";
            NetworkBrowsercss.Attributes["rel"]   = "stylesheet";
            NetworkBrowsercss.Attributes["type"]  = "text/css";
            NetworkBrowsercss.Attributes["media"] = "all";
            Page.Header.Controls.Add(NetworkBrowsercss);

            HtmlGenericControl jsscript0 = new HtmlGenericControl("script");

            jsscript0.Attributes.Add("type", "text/javascript");
            jsscript0.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkRadial/JavaScript/watchdog.js");
            Page.Header.Controls.Add(jsscript0);

            HtmlGenericControl jsscript1 = new HtmlGenericControl("script");

            jsscript1.Attributes.Add("type", "text/javascript");
            jsscript1.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkCluster/scriptaculous/lib/prototype.js");
            Page.Header.Controls.Add(jsscript1);

            HtmlGenericControl jsscript2 = new HtmlGenericControl("script");

            jsscript2.Attributes.Add("type", "text/javascript");
            jsscript2.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkCluster/scriptaculous/src/scriptaculous.js");
            Page.Header.Controls.Add(jsscript2);

            HtmlGenericControl jsscript3 = new HtmlGenericControl("script");

            jsscript3.Attributes.Add("type", "text/javascript");
            jsscript3.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkClusterGroup/JavaScript/networkBrowserClass.js");
            Page.Header.Controls.Add(jsscript3);

            HtmlGenericControl jsscript4 = new HtmlGenericControl("script");

            jsscript4.Attributes.Add("type", "text/javascript");
            jsscript4.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkClusterGroup/JavaScript/networkClusterLayoutEngine.js");
            Page.Header.Controls.Add(jsscript4);

            HtmlGenericControl jsscript5 = new HtmlGenericControl("script");

            jsscript5.Attributes.Add("type", "text/javascript");
            jsscript5.Attributes.Add("src", "//cdnjs.cloudflare.com/ajax/libs/d3/3.4.13/d3.min.js");
            Page.Header.Controls.Add(jsscript5);


            HtmlGenericControl script = new HtmlGenericControl("script");

            script.Attributes.Add("type", "text/javascript");
            script.InnerHtml = "function loadClusterView() {" +
                               " network_browser.Init('" + Root.Domain + "/profile/modules/NetworkClusterGroup/NetworkClusterGroupSvc.aspx?p='); " +
                               " network_browser.loadNetwork('" + Request.QueryString["Subject"].ToString() + "'); " +
                               "};";
            Page.Header.Controls.Add(script);


            Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO();
            RDFTriple   request = new RDFTriple(Convert.ToInt64(Request.QueryString["subject"]));
            XmlDocument x       = data.GetGroupNetworkForBrowserXML(request);

            System.Xml.Xsl.XsltArgumentList args = new System.Xml.Xsl.XsltArgumentList();
            args.AddParam("root", "", Root.Domain);
            DateTime d = DateTime.Now;

            System.Xml.Xsl.XslCompiledTransform xslt = new System.Xml.Xsl.XslCompiledTransform();
            litNetworkText.Text = Profiles.Framework.Utilities.XslHelper.TransformInMemory(Server.MapPath("~/profile/XSLT/NetworkTableGroup.xslt"), args, x.InnerXml);
        }
        public void ProcessRequest(HttpContext context)
        {
            if (!string.IsNullOrEmpty(context.Request.QueryString["msg"]))
            {
                Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO();
                SqlDataReader reader;
                string email = context.Request.QueryString["msg"];

                SqlCommand cmd = new SqlCommand("SELECT [Utility.Application].[fnDecryptBase64RC4] ( '" + email + "',   (Select [value] from [Framework.].parameter with(nolock) where ParameterID = 'RC4EncryptionKey'))");
                reader = data.GetSQLDataReader(cmd);
                reader.Read();

                string EmailText = reader[0].ToString();
                char[] s1 = EmailText.ToCharArray();
                char[] s2 = new char[s1.Length * 2];
                for (int i = 0; i < s1.Length; i++)
                {
                    s2[2 * i] = s1[i];
                    s2[2 * i + 1] = ' ';
                }
                EmailText = new String(s2);
                EmailText = EmailText.Replace(".", "dot");
                context.Response.ContentType = "audio/wav";
                //MemoryStream mstream = GetAudio(EmailText);
                MemoryStream mstream = GetAudio(EmailText);
                mstream.Position = 0;
                mstream.WriteTo(context.Response.OutputStream);
                context.Response.End();
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            // Set up the response settings
            context.Response.ContentType = "image/jpeg";
            context.Response.Cache.SetCacheability(HttpCacheability.Public);
            context.Response.BufferOutput = false;

            Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO();
            Int64 nodeid = -1;
            if (!string.IsNullOrEmpty(context.Request.QueryString["NodeID"]))
            {
                // get the id for the image
                nodeid = Convert.ToInt32(context.Request.QueryString["NodeID"]);
            }
            else if (!string.IsNullOrEmpty(context.Request.QueryString["person"]))
            {
                // UCSF.  Allow old id to work
                nodeid = data.GetNodeID(Convert.ToInt32(context.Request.QueryString["person"].ToString()));
            }

            if (nodeid > 0)
            {
                //Set up the response settings
                context.Response.ContentType = "image/jpeg";
                context.Response.Cache.SetCacheability(HttpCacheability.Public);
                context.Response.BufferOutput = false;

                Stream stream = data.GetUserPhotoList(nodeid);

                // UCSF show silhouette if we have no image and this is in the URL
                // note that if the length is 4 then it is going to be the word "null".
                if (stream.Length == 4 && "True".Equals(context.Request.QueryString["ShowSilhouetteAsDefault"]))
                {
                    // It's OK that this isn't synchronized even though it would be cleaner if it were
                    if (silhouetteImage == null)
                    {
                        // this method is limited to 2^32 byte files (4.2 GB)
                        FileStream fs = File.OpenRead(AppDomain.CurrentDomain.BaseDirectory + "/Profile/Images/default_img.png");
                        try
                        {
                            silhouetteImage = new byte[fs.Length];
                            fs.Read(silhouetteImage, 0, Convert.ToInt32(fs.Length));
                        }
                        finally
                        {
                            fs.Close();
                        }
                    }
                    // added by UCSF
                    stream = new System.IO.MemoryStream(silhouetteImage);
                }

                // added by UCSF
                context.Response.AddHeader("Content-Length", stream.Length.ToString());

                const int buffersize = 1024 * 16;
                byte[] buffer2 = new byte[buffersize];
                int count = stream.Read(buffer2, 0, buffersize);
                while (count > 0)
                {
                    context.Response.OutputStream.Write(buffer2, 0, count);
                    count = stream.Read(buffer2, 0, buffersize);
                }

            }
        }
        public void DrawProfilesModule()
        {
            // Get subject node id
            Int64 qsNodeId;

            if (Int64.TryParse(HttpContext.Current.Request.QueryString["subject"].ToString(), out qsNodeId) == false)
            {
                throw new InvalidOperationException(String.Format("Expected Int64 NodeId, '{0}' was returned.", HttpContext.Current.Request.QueryString["subject"].ToString()));
            }

            // Get stored proc based on timeline type
            string timelineType = base.GetModuleParamString("TimelineType");
            string proc         = null;

            switch (timelineType)
            {
            case "CoAuthor":
                proc = "[Profile.Module].[NetworkTimeline.Person.CoAuthorOf.GetData]";
                break;

            case "Concept":
                proc = "[Profile.Module].[NetworkTimeline.Person.HasResearchArea.GetData]";
                break;

            default:
                throw new InvalidOperationException("Please select ChartType.");
            }

            // Get data
            Profiles.Profile.Utilities.DataIO dataIO = new Profiles.Profile.Utilities.DataIO();
            DataView dataView = dataIO.GetNetworkTimeline(new RDFTriple(qsNodeId), proc);

            // Draw timeline chart
            if (dataView.Count > 0)
            {
                int    x = 0, y = 0, i, a, b, j, c, d, n, w, k = 0;
                bool   drawAvg;
                string label = null;

                if (int.TryParse(dataView[0]["a"].ToString(), out a) == false)
                {
                    throw new InvalidOperationException("Value 'a' is not a number");
                }

                if (int.TryParse(dataView[0]["b"].ToString(), out b) == false)
                {
                    throw new InvalidOperationException("Value 'b' is not a number");
                }

                if (int.TryParse(dataView[0]["n"].ToString(), out n) == false)
                {
                    throw new InvalidOperationException("Value 'n' is not a number");
                }

                j = b - a;
                c = Convert.ToInt32(j / 2 + 0.5);
                d = Convert.ToInt32(j / 15) + 1;
                w = 400;

                SolidBrush brushWhite = new SolidBrush(Color.White);
                SolidBrush brushAvg   = new SolidBrush(Color.FromArgb(204, 0, 30));
                SolidBrush brushPub   = new SolidBrush(Color.Blue);

                Pen penTimeline     = new Pen(Color.FromArgb(170, 170, 204), 2);
                Pen penTimelineThin = new Pen(Color.FromArgb(230, 230, 230), 1);
                Pen penYears        = new Pen(Color.FromArgb(102, 102, 102), 1);
                Pen penGraphBox     = new Pen(Color.FromArgb(102, 102, 102), 1);

                Bitmap bitmap = new Bitmap(w + 30, n * 20 + 40);

                Graphics graphic = Graphics.FromImage(bitmap);
                graphic.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;

                // Draw background white
                graphic.FillRectangle(brushWhite, 0, 0, w + 30, n * 20 + 40);

                // Draw year key at top
                graphic.DrawLine(penYears, new Point(15, 20), new Point(15 + w, 20));
                for (i = 0; i <= j; i++)
                {
                    x = 15 + Convert.ToInt32((w * i / j));
                    graphic.DrawLine(penYears, new Point(x, 15), new Point(x, 20));
                    if ((j - i) % d == 0)
                    {
                        graphic.DrawString(
                            (a + i).ToString(),
                            new Font("Arial", 7),
                            new SolidBrush(Color.Black),
                            new Point(x - 10, 0)
                            );
                    }
                }

                // Draw timelines
                for (i = 0; i <= dataView.Count - 1; i++)
                {
                    if (label != dataView[i]["label"].ToString())
                    {
                        k++;
                    }

                    x = Convert.ToInt32(Convert.ToSingle(dataView[i]["x"]) * w + 0.5) + 15;
                    y = k * 20 + 20;

                    if (label != dataView[i]["label"].ToString())
                    {
                        label = dataView[i]["label"].ToString();
                        //oGraphic.DrawString(sLabel, New Font("Arial", 7), New SolidBrush(Color.Black), New Point(10, y))
                        graphic.DrawLine(penTimelineThin, new PointF(15, y), new PointF(15 + w, y));
                        graphic.DrawLine(penTimeline, new PointF(15 + (Convert.ToSingle(dataView[i]["MinX"])) * w, y), new PointF(15 + (Convert.ToSingle(dataView[i]["MaxX"])) * w, y));
                    }
                    graphic.FillRectangle(brushPub, x - 1, y - 3, 3, 6);
                    drawAvg = false;
                    if (i == dataView.Count - 1)
                    {
                        drawAvg = true;
                    }
                    else if (label != dataView[i + 1]["label"].ToString())
                    {
                        drawAvg = true;
                    }

                    if (drawAvg)
                    {
                        x = Convert.ToInt32(Convert.ToSingle(dataView[i]["AvgX"]) * w + 0.5) + 15;
                        graphic.FillEllipse(brushAvg, new Rectangle(x - 5, y - 5, 10, 10));
                    }
                }

                graphic.DrawLine(penGraphBox, new Point(15, 20), new Point(15, 30 + 20 * n));

                // Write out image
                byte[] imageArray;
                using (System.IO.MemoryStream imageStream = new System.IO.MemoryStream())
                {
                    bitmap.Save(imageStream, ImageFormat.Png);
                    imageArray = new byte[imageStream.Length];
                    imageStream.Seek(0, System.IO.SeekOrigin.Begin);
                    imageStream.Read(imageArray, 0, Convert.ToInt32(imageStream.Length));
                }
                timelineImage.Src = "data:image/png;base64," + Convert.ToBase64String(imageArray);

                // Write out timeline detail list
                StringBuilder sb = new StringBuilder();
                label = string.Empty;
                for (i = 0; i <= dataView.Count - 1; i++)
                {
                    if (label != dataView[i]["label"].ToString())
                    {
                        sb.AppendFormat("<a href=\"{0}\">{1}</a><br/>", dataView[i]["ObjectURI"].ToString(), dataView[i]["label"].ToString());
                        label = dataView[i]["label"].ToString();
                    }
                }
                timelineDetails.InnerHtml = sb.ToString();

                string        altText   = "";
                StringBuilder tableText = new StringBuilder();
                tableText.AppendLine("<div class=\"listTable\" style=\"margin-top: 12px, margin-bottom:8px \"><table>");
                tableText.AppendLine("<tr><th>Name</th><th>Number of Publications</th><th>First Publication Year</th><th>Most Recent Publication Year</th><th>Average Publication Date</th></tr>");

                switch (timelineType)
                {
                case "CoAuthor":
                    for (i = 0; i < dataView.Count; i++)
                    {
                        bool run = false;
                        if (i == dataView.Count - 1)
                        {
                            run = true;
                        }
                        else if (dataView[i]["label"].ToString() != dataView[i + 1]["label"].ToString())
                        {
                            run = true;
                        }
                        if (run)
                        {
                            string l        = dataView[i]["label"].ToString();
                            double AvgX     = Double.Parse(dataView[i]["AvgX"].ToString());
                            double Avg      = (double)a + (double)j * AvgX;
                            int    AvgYear  = (int)Avg;
                            int    AvgMonth = (int)((Avg - (double)AvgYear) * (double)12);
                            string month    = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(AvgMonth + 1);
                            altText = altText + l + ", " + dataView[i]["PublicationCount"].ToString() + " publications between " + dataView[i]["FirstPublicationYear"].ToString() +
                                      " and " + dataView[i]["LastPublicationYear"].ToString() + ", average publication date " + month + " " + AvgYear + ". ";
                            tableText.AppendLine("<tr><td style=\"text-align:left\"><a href=\"" + dataView[i]["ObjectURI"].ToString() + "\">" + l + "</a></td><td>" + dataView[i]["PublicationCount"].ToString() + "</td><td>" + dataView[i]["FirstPublicationYear"].ToString() + "</td><td>" + dataView[i]["LastPublicationYear"].ToString() + "</td><td style=\"text-align:left\">" + month + " " + AvgYear + "</td></tr>");
                        }
                    }
                    break;

                case "Concept":
                    for (i = 0; i < dataView.Count; i++)
                    {
                        bool run = false;
                        if (i == dataView.Count - 1)
                        {
                            run = true;
                        }
                        else if (dataView[i]["label"].ToString() != dataView[i + 1]["label"].ToString())
                        {
                            run = true;
                        }
                        if (run)
                        {
                            string l        = dataView[i]["label"].ToString();
                            double AvgX     = Double.Parse(dataView[i]["AvgX"].ToString());
                            double Avg      = (double)a + (double)j * AvgX;
                            int    AvgYear  = (int)Avg;
                            int    AvgMonth = (int)((Avg - (double)AvgYear) * (double)12);
                            string month    = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(AvgMonth + 1);
                            altText = altText + l + ", " + dataView[i]["NumPubsThis"].ToString() + " publications between " + dataView[i]["FirstPublicationYear"].ToString() +
                                      " and " + dataView[i]["LastPublicationYear"].ToString() + ", average publication date " + month + " " + AvgYear + ". ";
                            tableText.AppendLine("<tr><td style=\"text-align:left\"><a href=\"" + dataView[i]["ObjectURI"].ToString() + "\">" + l + "</a></td><td>" + dataView[i]["NumPubsThis"].ToString() + "</td><td>" + dataView[i]["FirstPublicationYear"].ToString() + "</td><td>" + dataView[i]["LastPublicationYear"].ToString() + "</td><td style=\"text-align:left\">" + month + " " + AvgYear + "</td></tr>");
                        }
                    }
                    break;
                }
                tableText.AppendLine("</table></div>");
                timelineImage.Alt   = altText;
                litNetworkText.Text = tableText.ToString();
            }



            if (dataView.Count == 0)
            {
                timelineImage.Visible = false;
            }
        }
Exemple #35
0
        public void LoadRDFData()
        {
            Framework.Utilities.DebugLogging.Log("{Page Calling} Profile.ProfileData.LoadRDFData() start " + ((System.Web.UI.TemplateControl)(this)).AppRelativeVirtualPath);
            XmlDocument xml = new XmlDocument();
            Namespace rdfnamespaces = new Namespace();
            Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO();

            if (HttpContext.Current.Request.Headers["Offset"] != null)
                this.RDFTriple.Offset = HttpContext.Current.Request.Headers["Offset"];

            if (HttpContext.Current.Request.Headers["Limit"] != null)
                this.RDFTriple.Limit = HttpContext.Current.Request.Headers["Limit"];

            if (HttpContext.Current.Request.Headers["ExpandRDFList"] != null)
                this.RDFTriple.ExpandRDFList = HttpContext.Current.Request.Headers["ExpandRDFList"];

            xml = data.GetRDFData(this.RDFTriple);
            this.RDFData = xml;
            this.RDFNamespaces = rdfnamespaces.LoadNamespaces(xml);
            Framework.Utilities.DebugLogging.Log("{Page Calling} Profile.ProfileData.LoadRDFData() end" + ((System.Web.UI.TemplateControl)(this)).AppRelativeVirtualPath);
        }
        public void ProcessRequest(HttpContext context)
        {
            // Set up the response settings
            context.Response.ContentType = "image/bmp";
            context.Response.Cache.SetCacheability(HttpCacheability.Public);
            context.Response.BufferOutput = false;

            if (!string.IsNullOrEmpty(context.Request.QueryString["msg"]))
            {
                Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO();
                SqlDataReader reader;
                string email = context.Request.QueryString["msg"];

                SqlCommand cmd = new SqlCommand("SELECT [Utility.Application].[fnDecryptBase64RC4] ( '" + email + "',   (Select [value] from [Framework.].parameter with(nolock) where ParameterID = 'RC4EncryptionKey'))");
                reader = data.GetSQLDataReader(cmd);
                reader.Read();

                string EmailText = reader[0].ToString();

                int MyLen;

                SizeF size;
                float fontSize = 13;
                Font font;

                font = new Font("Arial", fontSize, FontStyle.Regular);

                MyLen = EmailText.Length;

                // Create a new 32-bit bitmap image.
                Bitmap bitmap = new Bitmap(MyLen, 25, PixelFormat.Format32bppArgb);

                // Create a graphics object for drawing.
                Graphics g = Graphics.FromImage(bitmap);
                g.SmoothingMode = SmoothingMode.AntiAlias;

                size = g.MeasureString(EmailText, font);

                // Create a CAPTCHA image using the text stored in the Session object.
                EmailImg.TextImage ci = new EmailImg.TextImage(EmailText, (int)size.Width, (int)size.Height, "Arial");

                // Change the response headers to output a JPEG image.
                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.ContentType = "image/jpeg";

                // Code to stop image from being cached
                HttpContext.Current.Response.CacheControl = "no-cache";
                HttpContext.Current.Response.AddHeader("Pragma", "no-cache");
                HttpContext.Current.Response.Expires = -1;
                HttpContext.Current.Response.AddHeader("Last-Modified", DateTime.Now.ToString());

                // Write the image to the response stream in JPEG format.
                ci.Image.Save(HttpContext.Current.Response.OutputStream, ImageFormat.Jpeg);

                // Dispose of the CAPTCHA image object.
                ci.Dispose();

                font.Dispose();
                g.Dispose();

            }
        }