public GetSessionSecurityGroup ( ) : System.Int64 | ||
return | System.Int64 |
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() { Int64 subject = 0; if (Request.QueryString["subject"] != null) { subject = Convert.ToInt64(Request.QueryString["subject"]); } Utilities.DataIO data = new Profiles.Framework.Utilities.DataIO(); menulist.Append("<ul>"); menulist.Append("<li><a href='" + Root.Domain + "/search'>Find People</a></li>"); menulist.Append("<li><a href='" + Root.Domain + "/search/all'>Find Everything</a></li>"); //-50 is the profiles Admin if (data.GetSessionSecurityGroup() == -50) { menulist.Append("<li><a href='" + Root.Domain + "/SPARQL/default.aspx'>SPARQL Query</a></li>"); } menulist.Append("<li><a href='" + Root.Domain + "/about/default.aspx'>About This Site</a></li>"); if (sm.Session().NodeID > 0) { menulist.Append("<li><a href='" + sm.Session().PersonURI + "'>View My Profile</a></li>"); } menulist.Append("<li><a href='" + Root.Domain + "/login/default.aspx?method=login&edit=true'>Edit My Profile</a></li>"); if (base.MasterPage.CanEdit) { menulist.Append("<li><a href='" + Root.Domain + "/edit/" + subject.ToString() + "'>Edit This Profile</a></li>"); } if (sm.Session().UserID > 0) { menulist.Append("<li><a href='" + Root.Domain + "/proxy/default.aspx?subject=" + sm.Session().NodeID.ToString() + "'>Manage Proxies</a></li>"); } if (base.BaseData.SelectSingleNode(".").OuterXml != string.Empty && !Root.AbsolutePath.ToLower().Contains("/search")) { if (base.BaseData.SelectSingleNode("//rdf:RDF/rdf:Description/@rdf:about", base.Namespaces) != null && !Root.AbsolutePath.ToLower().Contains("proxy")) { string uri = this.BaseData.SelectSingleNode("//rdf:RDF/rdf:Description/@rdf:about", base.Namespaces).Value; //IF the URI is in our system then we build the link. If not then we do not build the link for the data. if (uri.Contains(Root.Domain)) { string file = string.Empty; string spostring = string.Empty; string[] spoarray; spostring = uri.ToLower().Replace(Root.Domain.ToLower() + "/profile/", ""); spoarray = spostring.Split('/'); for (int i = 0; i < spoarray.Length; i++) { file = file + spoarray[i] + "_"; } file = file.Substring(0, file.Length - 1); menulist.Append("<li><a href=\"" + uri + "/" + file + ".rdf\" target=\"_blank\">" + "Export RDF" + "</a> <a style='border: none;' href='" + Root.Domain + "/about/default.aspx?tab=data'><img style='border-style: none' src='" + Root.Domain + "/Framework/Images/info.png' border='0' alt='Help with RDF'></a></li>"); if (base.MasterPage != null) { System.Web.UI.HtmlControls.HtmlContainerControl Head1; Head1 = (System.Web.UI.HtmlControls.HtmlContainerControl)base.MasterPage.FindControl("Head1"); //If a masterpage exists, you need to to create an ASP.Net Literal object and pass it to the masterpage so it can process the link in the Head block. string link = "<link rel=\"alternate\" type=\"application/rdf+xml\" href=\"" + uri + "/" + file + ".rdf\" />"; Head1.Controls.Add(new LiteralControl(link)); } } } } if (sm.Session().UserID == 0) { if (!Root.AbsolutePath.Contains("login")) { menulist.Append("<li><a href='" + Root.Domain + "/login/default.aspx?pin=send&method=login&redirectto=" + Root.Domain + Root.AbsolutePath + "'>Login to Profiles</a></li>"); } } else { menulist.Append("<li><a href='" + Root.Domain + "/login/default.aspx?method=logout&redirectto=" + Root.Domain + Root.AbsolutePath + "'>Logout</a></li>"); } menulist.Append("</ul>"); // hide active networks DIV if not logged in if (sm.Session().UserID > 0) { ActiveNetworkRelationshipTypes.Visible = true; } else { ActiveNetworkRelationshipTypes.Visible = false; } UserHistory uh = new UserHistory(); ProfileHistory.RDFData = base.BaseData; ProfileHistory.PresentationXML = base.MasterPage.PresentationXML; ProfileHistory.Namespaces = base.Namespaces; if (uh.GetItems() != null) { ProfileHistory.Visible = true; } else { ProfileHistory.Visible = false; } panelMenu.InnerHtml = menulist.ToString(); }
private void DrawProfilesModule() { Int64 subject = 0; if (Request.QueryString["subject"] != null) subject = Convert.ToInt64(Request.QueryString["subject"]); Utilities.DataIO data = new Profiles.Framework.Utilities.DataIO(); menulist.Append("<ul>"); menulist.Append("<li><a href='" + Root.Domain + "/search'>Find People</a></li>"); menulist.Append("<li><a href='" + Root.Domain + "/search/all'>Find Everything</a></li>"); //-50 is the profiles Admin if (data.GetSessionSecurityGroup() == -50) menulist.Append("<li><a href='" + Root.Domain + "/SPARQL/default.aspx'>SPARQL Query</a></li>"); menulist.Append("<li><a href='" + Root.Domain + "/about/default.aspx'>About This Site</a></li>"); if (sm.Session().NodeID > 0) menulist.Append("<li><a href='" + sm.Session().PersonURI + "'>View My Profile</a></li>"); menulist.Append("<li><a href='" + Root.Domain + "/login/default.aspx?method=login&edit=true'>Edit My Profile</a></li>"); if (base.MasterPage.CanEdit) { menulist.Append("<li><a href='" + Root.Domain + "/edit/" + subject.ToString() + "'>Edit This Profile</a></li>"); } if (sm.Session().UserID > 0) menulist.Append("<li><a href='" + Root.Domain + "/proxy/default.aspx?subject=" + sm.Session().NodeID.ToString() + "'>Manage Proxies</a></li>"); if (base.BaseData.SelectSingleNode(".").OuterXml != string.Empty && !Root.AbsolutePath.ToLower().Contains("/search")) { if (base.BaseData.SelectSingleNode("//rdf:RDF/rdf:Description/@rdf:about", base.Namespaces) != null && !Root.AbsolutePath.ToLower().Contains("proxy")) { string uri = this.BaseData.SelectSingleNode("//rdf:RDF/rdf:Description/@rdf:about", base.Namespaces).Value; //IF the URI is in our system then we build the link. If not then we do not build the link for the data. if (uri.Contains(Root.Domain)) { string file = string.Empty; string spostring = string.Empty; string[] spoarray; spostring = uri.ToLower().Replace(Root.Domain.ToLower() + "/profile/", ""); spoarray = spostring.Split('/'); for (int i = 0; i < spoarray.Length; i++) { file = file + spoarray[i] + "_"; } file = file.Substring(0, file.Length - 1); menulist.Append("<li><a href=\"" + uri + "/" + file + ".rdf\" target=\"_blank\">" + "Export RDF" + "</a> <a style='border: none;' href='" + Root.Domain + "/about/default.aspx?tab=data'><img style='border-style: none' src='" + Root.Domain + "/Framework/Images/info.png' border='0'></a></li>"); if (base.MasterPage != null) { System.Web.UI.HtmlControls.HtmlContainerControl Head1; Head1 = (System.Web.UI.HtmlControls.HtmlContainerControl)base.MasterPage.FindControl("Head1"); //If a masterpage exists, you need to to create an ASP.Net Literal object and pass it to the masterpage so it can process the link in the Head block. string link = "<link rel=\"alternate\" type=\"application/rdf+xml\" href=\"" + uri + "/" + file + ".rdf\" />"; Head1.Controls.Add(new LiteralControl(link)); } } } } if (sm.Session().UserID == 0) { if (!Root.AbsolutePath.Contains("login")) { menulist.Append("<li><a href='" + Root.Domain + "/login/default.aspx?pin=send&method=login&redirectto=" + Root.Domain + Root.AbsolutePath + "'>Login to Profiles</a></li>"); } } else { menulist.Append("<li><a href='" + Root.Domain + "/login/default.aspx?method=logout&redirectto=" + Root.Domain + Root.AbsolutePath + "'>Logout</a></li>"); } menulist.Append("</ul>"); // hide active networks DIV if not logged in if (sm.Session().UserID > 0) { ActiveNetworkRelationshipTypes.Visible = true; } else { ActiveNetworkRelationshipTypes.Visible = false; } UserHistory uh = new UserHistory(); ProfileHistory.RDFData = base.BaseData; ProfileHistory.PresentationXML = base.MasterPage.PresentationXML; ProfileHistory.Namespaces = base.Namespaces; if (uh.GetItems() != null) { ProfileHistory.Visible = true; } else { ProfileHistory.Visible = false; } panelMenu.InnerHtml = menulist.ToString(); }
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() { Int64 subject = 0; if (Request.QueryString["subject"] != null) subject = Convert.ToInt64(Request.QueryString["subject"]); Utilities.DataIO data = new Profiles.Framework.Utilities.DataIO(); menulist.Append("<ul>"); menulist.Append("<li><a href='" + Root.Domain + "/search'>New Search</a></li>"); //-50 is the profiles Admin if (data.GetSessionSecurityGroup() == -50) menulist.Append("<li><a href='" + Root.Domain + "/SPARQL/default.aspx'>SPARQL Query</a></li>"); menulist.Append("<li><a href='" + Root.Domain + "/about/default.aspx'>About Profiles</a></li>"); // UCSF //if (sm.Session().NodeID != subject && sm.Session().NodeID > 0) // menulist.Append("<li><a href='" + sm.Session().PersonURI + "'>View My Profile</a></li>"); if (sm.Session().NodeID > 0) { menulist.Append("<li><img src='" + Root.Domain + "/profile/Modules/CustomViewPersonGeneralInfo/PhotoHandler.ashx?NodeID=" + sm.Session().NodeID + "&ShowSilhouetteAsDefault=True'></li>"); menulist.Append("<li><a href='" + sm.Session().PersonURI + "'>" + sm.Session().ShortDisplayName + "</a></li>"); } if (!Root.AbsolutePath.ToLower().Contains("/edit/")) { if ((sm.Session().UserID > 0 && sm.Session().PersonID > 0) || (sm.Session().UserID == 0 && sm.Session().PersonID == 0)) { menulist.Append("<li><a href='" + Root.Domain + "/login/default.aspx?method=login&edit=true'>Edit My Profile</a></li>"); } } if (base.PresentationXML.SelectSingleNode("Presentation/PageOptions[@CanEdit='true']") != null && !Root.AbsolutePath.ToLower().Contains("/edit/")) { if (sm.Session().NodeID != subject) menulist.Append("<li><a href='" + Root.Domain + "/edit/" + subject.ToString() + "'>Edit This Profile</a></li>"); } if (sm.Session().NodeID > 0) menulist.Append("<li><a href='" + Root.Domain + "/proxy/default.aspx?subject=" + sm.Session().NodeID.ToString() + "'>Manage Proxies</a></li>"); if (base.BaseData.SelectSingleNode(".").OuterXml != string.Empty && !Root.AbsolutePath.ToLower().Contains("/search/")) { if (base.BaseData.SelectSingleNode("//rdf:RDF/rdf:Description/@rdf:about", base.Namespaces) != null) { string uri = this.BaseData.SelectSingleNode("//rdf:RDF/rdf:Description/@rdf:about", base.Namespaces).Value; //IF the URI is in our system then we build the link. If not then we do not build the link for the data. if (uri.Contains(Root.Domain)) { string file = string.Empty; string spostring = string.Empty; string[] spoarray; spostring = uri.ToLower().Replace(Root.Domain.ToLower() + "/profile/", ""); spoarray = spostring.Split('/'); for (int i = 0; i < spoarray.Length; i++) { file = file + spoarray[i] + "_"; } file = file.Substring(0, file.Length - 1); menulist.Append("<li><a href=\"" + uri + "/" + file + ".rdf\" target=\"_blank\">" + "Export RDF" + "</a></li>"); if (base.MasterPage != null) { System.Web.UI.HtmlControls.HtmlContainerControl Head1; Head1 = (System.Web.UI.HtmlControls.HtmlContainerControl)base.MasterPage.FindControl("Head1"); //If a masterpage exists, you need to to create an ASP.Net Literal object and pass it to the masterpage so it can process the link in the Head block. string link = "<link rel=\"alternate\" type=\"application/rdf+xml\" href=\"" + uri + "/" + file + ".rdf\" />"; Head1.Controls.Add(new LiteralControl(link)); } } } } if (sm.Session().UserID == 0) { if (!Root.AbsolutePath.Contains("login")) { menulist.Append("<li><a href='" + Root.Domain + "/login/default.aspx?method=login&redirectto=" + Root.Domain + Root.AbsolutePath + "'>Login to Profiles</a></li>"); } } else { menulist.Append("<li><a href='" + Root.Domain + "/login/default.aspx?method=logout&redirectto=" + Root.Domain + "/About/CloseBrowser.aspx" + "'>Sign out</a></li>"); } menulist.Append("</ul>"); // hide active networks DIV if not logged in if (sm.Session().UserID > 0) { ActiveNetworkRelationshipTypes.Visible = true; } else { ActiveNetworkRelationshipTypes.Visible = false; } panelMenu.InnerHtml = menulist.ToString(); }