private void DrawProfilesModule() { XsltArgumentList args = new XsltArgumentList(); XslCompiledTransform xslt = new XslCompiledTransform(); SessionManagement sm = new SessionManagement(); Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); string email = string.Empty; string imageemailurl = string.Empty; if (this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/prns:emailEncrypted", this.Namespaces) != null && this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/vivo:email", this.Namespaces) == null) { email = this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/prns:emailEncrypted", this.Namespaces).InnerText; imageemailurl = string.Format(Root.Domain + "/profile/modules/CustomViewPersonGeneralInfo/" + "EmailHandler.ashx?msg={0}", HttpUtility.UrlEncode(email)); } args.AddParam("root", "", Root.Domain); if (email != string.Empty) { args.AddParam("email", "", imageemailurl); } args.AddParam("imgguid", "", Guid.NewGuid().ToString()); // Check for an ORCID string internalUsername = new Profiles.ORCID.Utilities.ProfilesRNSDLL.BLL.Profile.Data.Person().GetInternalUsername(Convert.ToInt64(Request.QueryString["Subject"])); Profiles.ORCID.Utilities.ProfilesRNSDLL.BO.ORCID.Person orcidPerson = new Profiles.ORCID.Utilities.ProfilesRNSDLL.BLL.ORCID.Person().GetByInternalUsername(internalUsername); if (orcidPerson.Exists && !orcidPerson.ORCIDIsNull) { args.AddParam("orcid", "", orcidPerson.ORCID); args.AddParam("orcidurl", "", Profiles.ORCID.Utilities.config.ORCID_URL + "/" + orcidPerson.ORCID); args.AddParam("orcidinfosite", "", Profiles.ORCID.Utilities.config.InfoSite); args.AddParam("orcidimage", "", Root.Domain + "/Framework/Images/orcid_16x16(1).gif"); args.AddParam("orcidimageguid", "", Guid.NewGuid().ToString()); } else if (Profiles.ORCID.Utilities.config.ShowNoORCIDMessage && Profiles.ORCID.Utilities.config.Enabled) { //args.AddParam("orcid", "", "No ORCID id has been created for this user"); args.AddParam("orcid", "", "Login to create your ORCID iD"); args.AddParam("orcidinfosite", "", Profiles.ORCID.Utilities.config.InfoSite); string qs = HttpUtility.UrlEncode("predicateuri=http%3a%2f%2fvivoweb.org%2fontology%2fcore!orcidId&module=DisplayItemToEdit&ObjectType=Literal"); args.AddParam("orcidurl", "", Root.Domain + "/login/default.aspx?method=login&edit=true&editparams=" + qs); args.AddParam("orcidimage", "", Root.Domain + "/Framework/Images/orcid_16x16(1).gif"); args.AddParam("orcidimageguid", "", Guid.NewGuid().ToString()); } litPersonalInfo.Text = XslHelper.TransformInMemory(Server.MapPath("~/Profile/Modules/CustomViewPersonGeneralInfo/CustomViewPersonGeneralInfo.xslt"), args, base.BaseData.OuterXml); if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", base.Namespaces) != null) { string imageurl = base.BaseData.SelectSingleNode("//rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", base.Namespaces).Value; imgPhoto.ImageUrl = imageurl + "&cachekey=" + Guid.NewGuid().ToString(); } else { imgPhoto.Visible = false; } }
private void DrawProfilesModule() { XsltArgumentList args = new XsltArgumentList(); XslCompiledTransform xslt = new XslCompiledTransform(); SessionManagement sm = new SessionManagement(); Profiles.Profile.Modules.CustomViewPersonGeneralInfo.DataIO data = new Profiles.Profile.Modules.CustomViewPersonGeneralInfo.DataIO(); string email = string.Empty; string imageemailurl = string.Empty; string audioemailurl = string.Empty; if (this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/prns:emailEncrypted", this.Namespaces) != null && this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/vivo:email", this.Namespaces) == null) { email = this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/prns:emailEncrypted", this.Namespaces).InnerText; imageemailurl = string.Format(Root.Domain + "/profile/modules/CustomViewPersonGeneralInfo/" + "EmailHandler.ashx?msg={0}", HttpUtility.UrlEncode(email)); audioemailurl = string.Format(Root.Domain + "/profile/modules/CustomViewPersonGeneralInfo/" + "EmailAudioHandler.ashx?msg={0}", HttpUtility.UrlEncode(email)); } args.AddParam("root", "", Root.Domain); if (email != string.Empty) { args.AddParam("email", "", imageemailurl); args.AddParam("emailAudio", "", audioemailurl); args.AddParam("emailAudioImg", "", Root.Domain + "/Framework/Images/listen.jpg"); } args.AddParam("imgguid", "", Guid.NewGuid().ToString()); if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[1]/vivo:orcidId", base.Namespaces) != null) // Only show ORCID if security settings allow it { args.AddParam("orcid", "", base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[1]/vivo:orcidId", base.Namespaces).InnerText); args.AddParam("orcidurl", "", Profiles.ORCID.Utilities.config.ORCID_URL + "/" + base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[1]/vivo:orcidId", base.Namespaces).InnerText); string infosite; if (Profiles.ORCID.Utilities.config.InfoSite == null) { infosite = Root.Domain + "/about/default.aspx?tab=orcid"; } else if (Profiles.ORCID.Utilities.config.InfoSite.Equals("")) { infosite = Root.Domain + "/about/default.aspx?tab=orcid"; } else { infosite = Profiles.ORCID.Utilities.config.InfoSite; } args.AddParam("orcidinfosite", "", infosite); args.AddParam("orcidimage", "", Root.Domain + "/Framework/Images/orcid_16x16(1).gif"); args.AddParam("orcidimageguid", "", Guid.NewGuid().ToString()); } else if (Profiles.ORCID.Utilities.config.ShowNoORCIDMessage && Profiles.ORCID.Utilities.config.Enabled) { // Check for an ORCID string internalUsername = new Profiles.ORCID.Utilities.ProfilesRNSDLL.BLL.Profile.Data.Person().GetInternalUsername(Convert.ToInt64(Request.QueryString["Subject"])); Profiles.ORCID.Utilities.ProfilesRNSDLL.BO.ORCID.Person orcidPerson = new Profiles.ORCID.Utilities.ProfilesRNSDLL.BLL.ORCID.Person().GetByInternalUsername(internalUsername); if (!orcidPerson.Exists || orcidPerson.ORCIDIsNull) { //args.AddParam("orcid", "", "No ORCID id has been created for this user"); args.AddParam("orcid", "", "Login to create your ORCID iD"); args.AddParam("orcidinfosite", "", Profiles.ORCID.Utilities.config.InfoSite); string qs = HttpUtility.UrlEncode("predicateuri=http%3a%2f%2fvivoweb.org%2fontology%2fcore!orcidId&module=DisplayItemToEdit&ObjectType=Literal"); args.AddParam("orcidurl", "", Root.Domain + "/login/default.aspx?method=login&edit=true&editparams=" + qs); args.AddParam("orcidimage", "", Root.Domain + "/Framework/Images/orcid_16x16(1).gif"); args.AddParam("orcidimageguid", "", Guid.NewGuid().ToString()); } } args.AddParam("nodeid", "", Request.QueryString["Subject"]); litPersonalInfo.Text = XslHelper.TransformInMemory(Server.MapPath("~/Profile/Modules/CustomViewPersonGeneralInfo/CustomViewPersonGeneralInfo.xslt"), args, base.BaseData.OuterXml); try { string addressURI = base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[1]/vivo:mailingAddress", base.Namespaces).Attributes["rdf:resource"].Value; mapCountry = base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[@rdf:about=\"" + addressURI + "\"]/vivo:address3", base.Namespaces).InnerText; string mr = data.GetMapData(mapCountry); if (mr != "-1") { mapRegion = "region: '" + mr + "',"; } } catch (Exception) { } /* * if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", base.Namespaces) != null) * { * string imageurl = base.BaseData.SelectSingleNode("//rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", base.Namespaces).Value; * imgPhoto.ImageUrl = imageurl;// + "&cachekey=" + Guid.NewGuid().ToString(); * } * else * { * imgPhoto.Visible = false; * } */ // OpenSocial. Allows gadget developers to show test gadgets if you have them installed /* string uri = this.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/@rdf:about", base.Namespaces).Value; * OpenSocialManager om = OpenSocialManager.GetOpenSocialManager(uri, Page); * if (om.IsVisible() && om.GetUnrecognizedGadgets().Count > 0) * { * pnlSandboxGadgets.Visible = true; * litSandboxGadgets.Visible = true; * string sandboxDivs = "" ; * foreach (PreparedGadget gadget in om.GetUnrecognizedGadgets()) * { * sandboxDivs += "<div id='" + gadget.GetChromeId() + "' class='gadgets-gadget-parent'></div>"; * } * litSandboxGadgets.Text = sandboxDivs; * om.LoadAssets(); * // Add this just in case it is needed. * new ORNGProfileRPCService(Page, this.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/foaf:firstName", base.Namespaces).InnerText, uri); * } */ }
protected void btnCreateORCIDs_Click(object sender, EventArgs e) { Profiles.Framework.Utilities.DataIO data = new Profiles.Framework.Utilities.DataIO(); if (data.GetSessionSecurityGroup() != -50) { this.AddError("Only Administrators can push records to ORCID"); } else { foreach (RepeaterItem ri in this.rptSearchResults.Items) { switch (ri.ItemType) { case ListItemType.Item: case ListItemType.AlternatingItem: CheckBox chkSelected = (CheckBox)ri.FindControl("chkSelected"); if (chkSelected.Checked) { Label lblPersonID = (Label)ri.FindControl("lblPersonID"); Label lblErrors = (Label)ri.FindControl("lblErrors"); Label lblMessages = (Label)ri.FindControl("lblMessages"); try { Profiles.ORCID.Utilities.ProfilesRNSDLL.BO.ORCID.Person bo = new Profiles.ORCID.Utilities.ProfilesRNSDLL.BLL.ORCID.Person().GetPersonWithDBData(int.Parse(lblPersonID.Text), sm.Session().SessionID); if (!bo.BiographyIsNull && !bo.Biography.Equals(string.Empty)) { bo.PushBiographyToORCID = true; } //System.Threading.Thread.Sleep(2000); if (new Profiles.ORCID.Utilities.ProfilesRNSDLL.BLL.ORCID.Person().CreateNewORCID(bo, LoggedInInternalUsername, Profiles.ORCID.Utilities.ProfilesRNSDLL.BO.ORCID.REFPersonStatusType.REFPersonStatusTypes.User_Push_Failed)) { Edit.Utilities.DataIO dataio = new Edit.Utilities.DataIO(); long subjectID = Profiles.ORCID.Utilities.DataIO.getNodeIdFromPersonID(int.Parse(lblPersonID.Text)); dataio.AddLiteral(subjectID, dataio.GetStoreNode("http://vivoweb.org/ontology/core#orcidId"), dataio.GetStoreNode(bo.ORCID), this.PropertyListXML); lblMessages.Text = "Success"; } else { lblErrors.Text = bo.Error + bo.AllErrors + "<br /><br />"; } } catch (Exception ex) { // todo remove lblErrors.Text = ex.Message; //this.lblErrors.Text = "An error occurred while creating the ORCID."; } } break; } } } }
private void DrawProfilesModule() { XsltArgumentList args = new XsltArgumentList(); XslCompiledTransform xslt = new XslCompiledTransform(); SessionManagement sm = new SessionManagement(); Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); string email = string.Empty; //string imageemailurl = string.Empty; string emailPlainText = string.Empty; string audioemailurl = string.Empty; if (this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/prns:emailEncrypted", this.Namespaces) != null && this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/vivo:email", this.Namespaces) == null) { email = this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/prns:emailEncrypted", this.Namespaces).InnerText; //imageemailurl = string.Format(Root.Domain + "/profile/modules/CustomViewPersonGeneralInfo/" + "EmailHandler.ashx?msg={0}", HttpUtility.UrlEncode(email)); emailPlainText = getEmailPlainText(email); audioemailurl = string.Format(Root.Domain + "/profile/modules/CustomViewPersonGeneralInfo/" + "EmailAudioHandler.ashx?msg={0}", HttpUtility.UrlEncode(email)); } args.AddParam("root", "", Root.Domain); if (email != string.Empty) { //args.AddParam("email", "", imageemailurl); args.AddParam("email", "", emailPlainText); args.AddParam("emailAudioImg", "", Root.Domain + "/Framework/Images/listen.jpg"); } args.AddParam("imgguid", "", Guid.NewGuid().ToString()); if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[1]/vivo:orcidId", base.Namespaces) != null) // Only show ORCID if security settings allow it { args.AddParam("orcid", "", base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[1]/vivo:orcidId", base.Namespaces).InnerText); args.AddParam("orcidurl", "", Profiles.ORCID.Utilities.config.ORCID_URL + "/" + base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[1]/vivo:orcidId", base.Namespaces).InnerText); args.AddParam("orcidinfosite", "", Profiles.ORCID.Utilities.config.InfoSite); args.AddParam("orcidimage", "", Root.Domain + "/Framework/Images/orcid_16x16(1).gif"); args.AddParam("orcidimageguid", "", Guid.NewGuid().ToString()); } else if (Profiles.ORCID.Utilities.config.ShowNoORCIDMessage && Profiles.ORCID.Utilities.config.Enabled) { // Check for an ORCID string internalUsername = new Profiles.ORCID.Utilities.ProfilesRNSDLL.BLL.Profile.Data.Person().GetInternalUsername(Convert.ToInt64(Request.QueryString["Subject"])); Profiles.ORCID.Utilities.ProfilesRNSDLL.BO.ORCID.Person orcidPerson = new Profiles.ORCID.Utilities.ProfilesRNSDLL.BLL.ORCID.Person().GetByInternalUsername(internalUsername); if (!orcidPerson.Exists || orcidPerson.ORCIDIsNull) { //args.AddParam("orcid", "", "No ORCID id has been created for this user"); args.AddParam("orcid", "", "Login to create your ORCID iD"); args.AddParam("orcidinfosite", "", Profiles.ORCID.Utilities.config.InfoSite); string qs = HttpUtility.UrlEncode("predicateuri=http%3a%2f%2fvivoweb.org%2fontology%2fcore!orcidId&module=DisplayItemToEdit&ObjectType=Literal"); args.AddParam("orcidurl", "", Root.Domain + "/login/default.aspx?method=login&edit=true&editparams=" + qs); args.AddParam("orcidimage", "", Root.Domain + "/Framework/Images/orcid_16x16(1).gif"); args.AddParam("orcidimageguid", "", Guid.NewGuid().ToString()); } } args.AddParam("nodeid", "", Request.QueryString["Subject"]); litPersonalInfo.Text = XslHelper.TransformInMemory(Server.MapPath("~/Profile/Modules/CustomViewPersonGeneralInfo/CustomViewPersonGeneralInfo.xslt"), args, base.BaseData.OuterXml); if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", base.Namespaces) != null) { string imageurl = base.BaseData.SelectSingleNode("//rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", base.Namespaces).Value; imgPhoto.ImageUrl = imageurl + "&cachekey=" + Guid.NewGuid().ToString(); } else { imgPhoto.Visible = false; } // OpenSocial. Allows gadget developers to show test gadgets if you have them installed string uri = this.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/@rdf:about", base.Namespaces).Value; OpenSocialManager om = OpenSocialManager.GetOpenSocialManager(uri, Page); if (om.IsVisible()) { if (om.GetUnrecognizedGadgets().Count > 0) { pnlSandboxGadgets.Visible = true; litSandboxGadgets.Visible = true; string sandboxDivs = "" ; foreach (PreparedGadget gadget in om.GetUnrecognizedGadgets()) { sandboxDivs += "<div id='" + gadget.GetChromeId() + "' class='gadgets-gadget-parent'></div>"; } litSandboxGadgets.Text = sandboxDivs; om.LoadAssets(); } // Add this just in case it is needed. new ORNGProfileRPCService(Page, this.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/foaf:firstName", base.Namespaces).InnerText, uri); } }
protected void btnCreateORCIDs_Click(object sender, EventArgs e) { Profiles.Framework.Utilities.DataIO data = new Profiles.Framework.Utilities.DataIO(); if (data.GetSessionSecurityGroup() != -50) { this.AddError("Only Administrators can push records to ORCID"); } else { foreach (RepeaterItem ri in this.rptSearchResults.Items) { switch (ri.ItemType) { case ListItemType.Item: case ListItemType.AlternatingItem: CheckBox chkSelected = (CheckBox)ri.FindControl("chkSelected"); if (chkSelected.Checked) { Label lblPersonID = (Label)ri.FindControl("lblPersonID"); Label lblErrors = (Label)ri.FindControl("lblErrors"); Label lblMessages = (Label)ri.FindControl("lblMessages"); try { Profiles.ORCID.Utilities.ProfilesRNSDLL.BO.ORCID.Person bo = new Profiles.ORCID.Utilities.ProfilesRNSDLL.BLL.ORCID.Person().GetPersonWithDBData(int.Parse(lblPersonID.Text), sm.Session().SessionID); if (!bo.BiographyIsNull && !bo.Biography.Equals(string.Empty)) { bo.PushBiographyToORCID = true; } //System.Threading.Thread.Sleep(2000); if (new Profiles.ORCID.Utilities.ProfilesRNSDLL.BLL.ORCID.Person().CreateNewORCID(bo, LoggedInInternalUsername, Profiles.ORCID.Utilities.ProfilesRNSDLL.BO.ORCID.REFPersonStatusType.REFPersonStatusTypes.User_Push_Failed)) { lblMessages.Text = "Success"; } else { lblErrors.Text = bo.Error + bo.AllErrors + "<br /><br />"; } } catch (Exception ex) { // todo remove lblErrors.Text = ex.Message; //this.lblErrors.Text = "An error occurred while creating the ORCID."; } } break; } } } }