Пример #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            UserHistory uh = new UserHistory();

            masterpage  = (Framework.Template)base.Master;
            this.Master = masterpage;

            this.LoadAssets();

            this.LoadPresentationXML();

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

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

            if (base.RDFTriple.Subject != 0 && base.RDFTriple.Predicate != 0 && base.RDFTriple.Object == 0)
            {
                base.RDFTriple.Limit = "1";
            }

            base.LoadRDFData();

            Framework.Utilities.DebugLogging.Log("Page_Load Profile 1: " + DateTime.Now.ToLongTimeString());

            masterpage.Tab             = base.Tab;
            masterpage.RDFData         = base.RDFData;
            masterpage.RDFNamespaces   = base.RDFNamespaces;
            masterpage.PresentationXML = this.PresentationXML;
            Framework.Utilities.DebugLogging.Log("Page_Load Profile 2: " + DateTime.Now.ToLongTimeString());

            // UCSF added schema.org info
            // Only do this for a person only version of this page !
            XmlNode presentationClass = PresentationXML.SelectSingleNode("//Presentation/@PresentationClass", base.RDFNamespaces);

            if (presentationClass != null && "profile".Equals(presentationClass.InnerText.ToLower()) &&
                this.RDFData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/foaf:firstName", base.RDFNamespaces) != null &&
                this.RDFData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/foaf:lastName", base.RDFNamespaces) != null)
            {
                ((HtmlGenericControl)masterpage.FindControl("divProfilesContentMain")).Attributes.Add("itemscope", "itemscope");
                ((HtmlGenericControl)masterpage.FindControl("divProfilesContentMain")).Attributes.Add("itemtype", "http://schema.org/Person");

                HtmlMeta Description = new HtmlMeta();
                Description.Name = "Description";
                string name = this.RDFData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/foaf:firstName", base.RDFNamespaces).InnerText + " " +
                              this.RDFData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/foaf:lastName", base.RDFNamespaces).InnerText;
                Description.Content = name + "'s profile, publications, research topics, and co-authors";
                Page.Header.Controls.Add(Description);

                HtmlLink Canonical = new HtmlLink();
                Canonical.Href = Request.Url.AbsoluteUri.IndexOf('?') == -1 ? Request.Url.AbsoluteUri.ToLower() : Request.Url.AbsoluteUri.ToLower().Substring(0, Request.Url.AbsoluteUri.IndexOf('?'));
                Canonical.Attributes["rel"] = "canonical";
                Page.Header.Controls.Add(Canonical);
            }
        }
        public void Page_Load(object sender, EventArgs e)
        {
            masterpage = (Framework.Template)base.Master;
            this.Master = masterpage;

            this.LoadAssets();

            this.LoadPresentationXML();

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

            if (x != null)
                base.RDFTriple.ExpandRDFList = x.OuterXml;

            base.LoadRDFData();

            masterpage.Tab = base.Tab;
            masterpage.RDFData = base.RDFData;
            masterpage.RDFNamespaces = base.RDFNamespaces;
            masterpage.PresentationXML = this.PresentationXML;

            // UCSF added schema.org info
            // Only do this for a person only version of this page !
            if (this.RDFData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/foaf:firstName", base.RDFNamespaces) != null)
            {
                ((HtmlGenericControl)masterpage.FindControl("divProfilesContentMain")).Attributes.Add("itemscope", "itemscope");
                ((HtmlGenericControl)masterpage.FindControl("divProfilesContentMain")).Attributes.Add("itemtype", "http://schema.org/Person");

                HtmlMeta Description = new HtmlMeta();
                Description.Name = "Description";
                string name = this.RDFData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/foaf:firstName", base.RDFNamespaces).InnerText + " " +
                     this.RDFData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/foaf:lastName", base.RDFNamespaces).InnerText;
                Description.Content = name + "'s profile, publications, research topics, and co-authors";
                Page.Header.Controls.Add(Description);

                HtmlLink Canonical = new HtmlLink();
                Canonical.Href = Root.Domain + Request.Url.AbsolutePath.ToLower();
                Canonical.Attributes["rel"] = "canonical";
                Page.Header.Controls.Add(Canonical);

                // email tracking
                HtmlGenericControl trackMailClickJs = new HtmlGenericControl("script");
                trackMailClickJs.Attributes.Add("type", "text/javascript");
                trackMailClickJs.InnerHtml =
                    "\n   // per http://stackoverflow.com/a/8570258/31100\n" +
                    "       function handleMailto(link, email) {\n" +
                    "       _gaq.push(['_trackEvent', 'Profile Page Interaction', 'activate_email_link', email, , false]);\n" +
                    "       _gaq.push(function () { document.location = link.href });\n" +
                    "       return false;\n" +
                    "   }\n";
                Page.Header.Controls.Add(trackMailClickJs);
            }
        }
Пример #3
0
        public void Page_Load(object sender, EventArgs e)
        {
            masterpage = (Framework.Template)base.Master;

            LoadPresentationXML();

            if (!String.IsNullOrEmpty(Request["owner"]))
            {
                // go ahead and swap in the pretty URL
                Literal backlink = (Literal)masterpage.FindControl("litBackLink");
                backlink.Text = "<a href='" + Root.Domain + "/" +
                    UCSFIDSet.ByNodeId[Convert.ToInt64(Request["owner"].Substring(Request["owner"].LastIndexOf("/") + 1))].PrettyURL +
                    "'>Back to Profile</a>";
            }

            this.LoadAssets();
            masterpage.PresentationXML = this.PresentationXML;
        }
Пример #4
0
        public void Page_Load(object sender, EventArgs e)
        {
            masterpage = (Framework.Template)base.Master;

            LoadPresentationXML();

            if (!String.IsNullOrEmpty(Request["owner"]))
            {
                // go ahead and swap in the pretty URL
                Literal backlink = (Literal)masterpage.FindControl("litBackLink");
                backlink.Text = "<a href='" + Root.Domain + "/" +
                                UCSFIDSet.ByNodeId[Convert.ToInt64(Request["owner"].Substring(Request["owner"].LastIndexOf("/") + 1))].PrettyURL +
                                "'>Back to Profile</a>";
            }

            this.LoadAssets();
            masterpage.PresentationXML = this.PresentationXML;
        }
Пример #5
0
        public void Page_Load(object sender, EventArgs e)
        {
            UserHistory uh = new UserHistory();

            masterpage = (Framework.Template)base.Master;
            this.Master = masterpage;

            this.LoadAssets();

            this.LoadPresentationXML();

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

            if (x != null)
                base.RDFTriple.ExpandRDFList = x.OuterXml;

            if (base.RDFTriple.Subject != 0 && base.RDFTriple.Predicate != 0 && base.RDFTriple.Object == 0)
                base.RDFTriple.Limit = "1";

            base.LoadRDFData();

            Framework.Utilities.DebugLogging.Log("Page_Load Profile 1: " + DateTime.Now.ToLongTimeString());

            masterpage.Tab = base.Tab;
            masterpage.RDFData = base.RDFData;
            masterpage.RDFNamespaces = base.RDFNamespaces;
            masterpage.PresentationXML = this.PresentationXML;
            Framework.Utilities.DebugLogging.Log("Page_Load Profile 2: " + DateTime.Now.ToLongTimeString());

            // UCSF added schema.org info
            // Only do this for a person only version of this page !
            XmlNode presentationClass = PresentationXML.SelectSingleNode("//Presentation/@PresentationClass", base.RDFNamespaces);
            if (presentationClass != null && "profile".Equals(presentationClass.InnerText.ToLower()) &&
                this.RDFData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/foaf:firstName", base.RDFNamespaces) != null &&
                this.RDFData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/foaf:lastName", base.RDFNamespaces) != null)
            {
                ((HtmlGenericControl)masterpage.FindControl("divProfilesContentMain")).Attributes.Add("itemscope", "itemscope");
                ((HtmlGenericControl)masterpage.FindControl("divProfilesContentMain")).Attributes.Add("itemtype", "http://schema.org/Person");

                HtmlMeta Description = new HtmlMeta();
                Description.Name = "Description";
                string name = this.RDFData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/foaf:firstName", base.RDFNamespaces).InnerText + " " +
                     this.RDFData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/foaf:lastName", base.RDFNamespaces).InnerText;
                Description.Content = name + "'s profile, publications, research topics, and co-authors";
                Page.Header.Controls.Add(Description);

                HtmlLink Canonical = new HtmlLink();
                Canonical.Href = Request.Url.AbsoluteUri.IndexOf('?') == -1 ? Request.Url.AbsoluteUri.ToLower() : Request.Url.AbsoluteUri.ToLower().Substring(0, Request.Url.AbsoluteUri.IndexOf('?'));
                Canonical.Attributes["rel"] = "canonical";
                Page.Header.Controls.Add(Canonical);
            }
            else
            {
                // Tell the bots that this is slow moving data, add an exires at some random date up to 30 days out
                DateTime expires = DateTime.Now.Add( TimeSpan.FromDays( random.NextDouble() * 29 + 1 ));
                Response.AddHeader("Expires", expires.ToUniversalTime().ToString("r"));
            }
        }