protected string GetStringFromPresentationXML(string XPath) { string buffer = string.Empty; XmlNode MyXMLNode = this.PresentationXML.SelectSingleNode(XPath); if (MyXMLNode != null) { buffer = CustomParse.Parse(MyXMLNode.InnerText, this.RDFData, this.RDFNamespaces); } return(buffer); }
public void DrawProfilesModule() { DateTime d = DateTime.Now; //If your module performs a data request, based on the DataURI parameter then call ReLoadBaseData base.GetDataByURI(); List <CloudItem> weights = new List <CloudItem>(); double firsttwenty = 0.0; double lasttwenty = 0.0; string cloudweightnode = string.Empty; string networklistnode = string.Empty; string itemurl = string.Empty; string itemurltext = string.Empty; string itemtext = string.Empty; cloudweightnode = base.GetModuleParamString("CloudWeightNode"); networklistnode = base.GetModuleParamString("NetworkListNode"); itemurl = base.GetModuleParamString("ItemURL"); itemurltext = base.GetModuleParamString("ItemURLText"); itemtext = base.GetModuleParamString("ItemText"); if (base.BaseData.SelectNodes(networklistnode, base.Namespaces) != null && cloudweightnode != string.Empty) { if (cloudweightnode != string.Empty) { var items = from XmlNode networknode in base.BaseData.SelectNodes(networklistnode, base.Namespaces) select new { weight = Convert.ToDouble(networknode.SelectSingleNode(cloudweightnode, base.Namespaces).InnerText), value = networknode.SelectSingleNode("./rdf:object/@rdf:resource", this.Namespaces).Value }; foreach (var i in items) { weights.Add(new CloudItem(i.weight, i.value)); } //foreach (XmlNode networknode in base.BaseData.SelectNodes(networklistnode, base.Namespaces)) //{ // weight = Convert.ToDouble(networknode.SelectSingleNode(cloudweightnode, base.Namespaces).InnerText); // weights.Add(new CloudItem(weight, networknode.SelectSingleNode("./rdf:object/@rdf:resource", this.Namespaces).Value)); //} } weights = weights.OrderByDescending(clouditem => clouditem.Weight).ToList(); firsttwenty = weights.Count * .2; lasttwenty = weights.Count * .8; int cnt = 0; foreach (CloudItem ci in weights) { if (cnt > firsttwenty && cnt < lasttwenty) { ci.Rank = "med"; } if (cnt < firsttwenty) { ci.Rank = "big"; } if (cnt > lasttwenty) { ci.Rank = "small"; } cnt++; } } XmlDocument document = new XmlDocument(); System.Text.StringBuilder documentdata = new System.Text.StringBuilder(); documentdata.Append("<ListView"); documentdata.Append(" Columns=\""); documentdata.Append(base.GetModuleParamString("Columns")); documentdata.Append("\""); if (base.GetModuleParamString("BulletType") != string.Empty) { documentdata.Append(" Bullet=\""); documentdata.Append(base.GetModuleParamString("BulletType")); documentdata.Append("\""); } documentdata.Append(" InfoCaption=\""); documentdata.Append(base.GetModuleParamString("InfoCaption")); documentdata.Append("\""); documentdata.Append(" Description=\""); documentdata.Append(base.GetModuleParamString("Description")); documentdata.Append("\">"); string item = string.Empty; if (base.BaseData.SelectNodes(networklistnode, base.Namespaces) != null) { var items = from XmlNode networknode in base.BaseData.SelectNodes(networklistnode, base.Namespaces) select new { itemurl = CustomParse.Parse(itemurl, networknode, base.Namespaces), item = CustomParse.Parse(itemtext, networknode, base.Namespaces), weight = GetCloudRank(networknode.SelectSingleNode("./rdf:object/@rdf:resource", base.Namespaces).InnerText, weights), connectiondetails = networknode.SelectSingleNode("prns:hasConnectionDetails/@rdf:resource", base.Namespaces), sortorder = networknode.SelectSingleNode("prns:sortOrder", base.Namespaces), itemxpath = CustomParse.Parse(itemurltext, networknode, base.Namespaces) }; foreach (var i in items) { //foreach (XmlNode networknode in base.BaseData.SelectNodes(networklistnode, base.Namespaces)) //{ documentdata.Append("<Item"); if (itemurl != string.Empty) { documentdata.Append(" ItemURL=\""); documentdata.Append(i.itemurl); documentdata.Append("\""); if (cloudweightnode != string.Empty) { documentdata.Append(" Weight=\""); documentdata.Append(i.weight); documentdata.Append("\""); } if (i.connectiondetails != null) { if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[@rdf:about='" + i.connectiondetails.InnerText + "']/prns:isAlsoCoAuthor", base.Namespaces) != null) { documentdata.Append(" CoAuthor=\""); documentdata.Append(base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[@rdf:about='" + i.connectiondetails.InnerText + "']/prns:isAlsoCoAuthor", base.Namespaces).InnerText); documentdata.Append("\""); } if (i.sortorder != null) { documentdata.Append(" sortOrder=\""); documentdata.Append(i.sortorder.InnerText); documentdata.Append("\""); } } string itemxpath = i.itemxpath; if (itemxpath != string.Empty) { item = base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[@rdf:about= '" + itemxpath + "']/rdfs:label", base.Namespaces).InnerText; } documentdata.Append(" ItemURLText=\""); documentdata.Append(item); documentdata.Append("\""); } documentdata.Append(">"); documentdata.Append(i.item); documentdata.Append("</Item>"); } } documentdata.Append("</ListView>"); document.LoadXml(documentdata.ToString().Replace("&", "&")); XsltArgumentList args = new XsltArgumentList(); string xmlbuffer; if (base.GetModuleParamString("SortBy").Equals("Weight")) { xmlbuffer = XslHelper.TransformInMemory(Server.MapPath("~/Profile/Modules/NetworkList/SortIntermediateByWeight.xslt"), args, document.OuterXml); } else { xmlbuffer = XslHelper.TransformInMemory(Server.MapPath("~/Profile/Modules/NetworkList/SortIntermediate.xslt"), args, document.OuterXml); } litListView.Text = XslHelper.TransformInMemory(Server.MapPath("~/Profile/Modules/NetworkList/NetworkList.xslt"), args, xmlbuffer); Framework.Utilities.DebugLogging.Log("Network List MODULE end Milliseconds:" + (DateTime.Now - d).TotalSeconds); }
public void DrawProfilesModule() { //If your module performs a data request, based on the DataURI parameter then call ReLoadBaseData base.GetDataByURI(); //If the two counts don't match then their are more header columns than data or more data than header. if (base.GetModuleParamXml("TableHeader").SelectNodes("Header/Column").Count != base.GetModuleParamXml("TableRow").SelectNodes("Data/Column").Count) { throw new Exception("TableHeader count does not match TableRow count in PresentationXML"); } XmlDocument document = new XmlDocument(); System.Text.StringBuilder documentdata = new System.Text.StringBuilder(); XmlNode connectionnode; ////Format any URL Nodes that might exist, this uses a single hop parse for the Connection information within a Network. ////If your presentationXML has Connection data that needs to be parsed out of the XML data, you should use the HopParse method. ////This enables you to access (SingleHop) Entity/Network/Connection data and display it any way you need. ////[IE. You can map all of a single persons co-authors, but not their co-authors, co-authors.] //foreach (XmlNode col in base.TableRow.SelectNodes("Data/Column")) //{ // foreach (XmlNode node in base.BaseData.SelectNodes(base.NetworkListNode)) // { // col["URL"].InnerText = CustomParse.HopParse(col["URL"].InnerText, base.BaseData,node); // } //} documentdata.Append("<DetailTable"); documentdata.Append(" Columns=\""); documentdata.Append(base.GetModuleParamXml("TableHeader").SelectNodes("Header/Column").Count); documentdata.Append("\""); documentdata.Append(" InfoCaption=\""); documentdata.Append(base.GetModuleParamString("InfoCaption")); documentdata.Append("\""); documentdata.Append(">"); //Loop the Header Columns to build the first row of the table. documentdata.Append("<Row type=\"header\">"); foreach (XmlNode header in base.GetModuleParamXml("TableHeader").SelectNodes("Header/Column")) { documentdata.Append("<Column Justify=\"" + header["Justify"].InnerText + "\""); documentdata.Append(" Width=\"" + header["Width"].InnerText + "\""); documentdata.Append(">" + header["Name"].InnerXml + "</Column>"); } documentdata.Append("</Row>"); //Loop the Data Columns to supply the rows after the header. foreach (XmlNode networknode in base.BaseData.SelectNodes(base.GetModuleParamString("NetworkListNode"))) { documentdata.Append("<Row type=\"data\" url=\"" + Root.Domain + CustomParse.Parse(base.GetModuleParamString("RowURL"), networknode, base.Namespaces) + "\">"); connectionnode = base.BaseData.SelectSingleNode(CustomParse.Parse(base.GetModuleParamString("ConnectionListNode"), networknode, base.Namespaces)); foreach (XmlNode col in base.GetModuleParamXml("TableRow").SelectNodes("Data/Column")) { documentdata.Append("<Column url=\"" + Root.Domain + CustomParse.Parse(col["URL"].InnerText, base.BaseData, networknode, base.Namespaces) + "\""); if (col["Data"].InnerText.Contains("Profile")) { documentdata.Append(">" + CustomParse.Parse(col["Data"].InnerText, networknode, base.Namespaces) + "</Column>"); } else { documentdata.Append(">" + CustomParse.Parse(col["Data"].InnerText, connectionnode, base.Namespaces) + "</Column>"); } } documentdata.Append("</Row>"); } documentdata.Append("</DetailTable>"); document.LoadXml(documentdata.ToString()); XslCompiledTransform xslt = new XslCompiledTransform(); XsltArgumentList args = new XsltArgumentList(); args.AddParam("root", "", Root.Domain); litNetworkDetails.Text = Utilities.XslHelper.TransformInMemory(Server.MapPath("~/framework/modules/NetworkDetails/NetworkDetails.xslt"), args, base.BaseData.OuterXml); }
public void DrawProfilesModule() { DateTime d = DateTime.Now; //If your module performs a data request, based on the DataURI parameter then call ReLoadBaseData base.GetDataByURI(); XmlDocument document = new XmlDocument(); XsltArgumentList args = new XsltArgumentList(); bool networkexists = false; System.Text.StringBuilder documentdata = new System.Text.StringBuilder(); documentdata.Append("<PassiveList"); documentdata.Append(" InfoCaption=\""); documentdata.Append(base.GetModuleParamString("InfoCaption")); documentdata.Append("\""); documentdata.Append(" Description=\""); documentdata.Append(base.GetModuleParamString("Description")); documentdata.Append("\""); documentdata.Append(" ID=\""); documentdata.Append(Guid.NewGuid().ToString()); documentdata.Append("\""); documentdata.Append(" MoreText=\""); documentdata.Append(CustomParse.Parse(base.GetModuleParamString("MoreText"), base.BaseData, base.Namespaces)); documentdata.Append("\""); documentdata.Append(" MoreURL=\""); if (base.GetModuleParamString("MoreURL").Contains("&")) { documentdata.Append(Root.Domain + CustomParse.Parse(base.GetModuleParamString("MoreURL"), base.BaseData, base.Namespaces).Replace("&", "&")); } else { documentdata.Append(CustomParse.Parse(base.GetModuleParamString("MoreURL"), base.BaseData, base.Namespaces)); } documentdata.Append("\""); documentdata.Append(">"); documentdata.Append("<ItemList>"); try { var items = from XmlNode networknode in this.BaseData.SelectNodes(base.GetModuleParamString("ListNode") + "[position() < " + Math.BigMul((Convert.ToInt16(base.GetModuleParamString("MaxDisplay")) + 1), 1).ToString() + "]", this.Namespaces) select new { itemurl = CustomParse.Parse(base.GetModuleParamString("ItemURL"), networknode, this.Namespaces), itemurltext = CustomParse.Parse(base.GetModuleParamString("ItemURLText"), networknode, this.Namespaces), item = CustomParse.Parse(base.GetModuleParamString("ItemText"), networknode, this.Namespaces), personid = CustomParse.Parse("{{{rdf:Description/prns:personId}}}", networknode, this.Namespaces) }; foreach (var i in items) { networkexists = true; documentdata.Append("<Item"); if (base.GetModuleParamString("ItemURL") != string.Empty) { documentdata.Append(" ItemURL=\"" + i.itemurl); documentdata.Append("\""); documentdata.Append(" ItemURLText=\"" + i.itemurltext); documentdata.Append("\""); if (i.personid != string.Empty) { documentdata.Append(" PersonID=\"" + i.personid); documentdata.Append("\""); } } documentdata.Append(">"); documentdata.Append(i.item); documentdata.Append("</Item>"); } } catch (Exception ex) { Framework.Utilities.DebugLogging.Log(ex.Message + " ++ " + ex.StackTrace); } documentdata.Append("</ItemList>"); documentdata.Append("</PassiveList>"); if (networkexists) { document.LoadXml(documentdata.ToString()); args.AddParam("root", "", Root.Domain); args.AddParam("ListNode", "", base.GetModuleParamString("ListNode")); args.AddParam("InfoCaption", "", base.GetModuleParamString("InfoCaption")); args.AddParam("Description", "", base.GetModuleParamString("Description")); args.AddParam("MoreUrl", "", base.GetModuleParamString("ListNode")); litPassiveNetworkList.Text = XslHelper.TransformInMemory(Server.MapPath("~/Profile/Modules/PassiveList/PassiveList.xslt"), args, document.OuterXml); Framework.Utilities.DebugLogging.Log("PASSIVE MODULE end Milliseconds:" + (DateTime.Now - d).TotalSeconds); } }
public void DrawProfilesModule() { DateTime d = DateTime.Now; //If your module performs a data request, based on the DataURI parameter then call ReLoadBaseData base.GetDataByURI(); XmlDocument document = new XmlDocument(); XsltArgumentList args = new XsltArgumentList(); bool networkexists = false; System.Text.StringBuilder documentdata = new System.Text.StringBuilder(); documentdata.Append("<PassiveList"); documentdata.Append(" InfoCaption=\""); documentdata.Append(base.GetModuleParamString("InfoCaption")); documentdata.Append("\""); documentdata.Append(" Description=\""); documentdata.Append(base.GetModuleParamString("Description")); documentdata.Append("\""); documentdata.Append(" ID=\""); documentdata.Append(Guid.NewGuid().ToString()); documentdata.Append("\""); documentdata.Append(" MoreText=\""); documentdata.Append(CustomParse.Parse(base.GetModuleParamString("MoreText"), base.BaseData, base.Namespaces)); documentdata.Append("\""); documentdata.Append(" MoreURL=\""); if (base.GetModuleParamString("MoreURL").Contains("&")) { documentdata.Append(Root.Domain + CustomParse.Parse(base.GetModuleParamString("MoreURL"), base.BaseData, base.Namespaces).Replace("&", "&")); } else { documentdata.Append(CustomParse.Parse(base.GetModuleParamString("MoreURL"), base.BaseData, base.Namespaces)); } documentdata.Append("\""); documentdata.Append(">"); documentdata.Append("<ItemList>"); string path = base.GetModuleParamString("ListNode"); //path = path.Substring(path.LastIndexOf("@rdf:about=") + 12); //path = path.Substring(0, path.Length - 1); try { XmlNodeList items = this.BaseData.SelectNodes(path, this.Namespaces); int remainingItems = Convert.ToInt16(base.GetModuleParamString("MaxDisplay")); foreach (XmlNode i in items) { if (remainingItems == 0) { break; } remainingItems--; XmlNode networknode = this.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[@rdf:about=\"" + i.Value + "\"]", this.Namespaces); string itemurl = CustomParse.Parse(base.GetModuleParamString("ItemURL"), networknode, this.Namespaces); string itemurltext = CustomParse.Parse(base.GetModuleParamString("ItemURLText"), networknode, this.Namespaces); string item = CustomParse.Parse(base.GetModuleParamString("ItemText"), networknode, this.Namespaces); networkexists = true; documentdata.Append("<Item"); if (base.GetModuleParamString("ItemURL") != string.Empty) { documentdata.Append(" ItemURL=\"" + itemurl); documentdata.Append("\""); if (!itemurltext.Equals("")) { documentdata.Append(" ItemURLText=\"" + itemurltext); } else { documentdata.Append(" ItemURLText=\"" + CustomParse.Parse("{{{//rdf:Description[@rdf:about='" + itemurl + "']/rdfs:label}}}", this.BaseData, this.Namespaces)); } documentdata.Append("\""); } documentdata.Append(">"); documentdata.Append(item); documentdata.Append("</Item>"); } } catch (Exception ex) { Framework.Utilities.DebugLogging.Log(ex.Message + " ++ " + ex.StackTrace); } /* * try * { * var items = from XmlNode networknode in this.BaseData.SelectNodes(base.GetModuleParamString("ListNode") + "[position() < " + Math.BigMul((Convert.ToInt16(base.GetModuleParamString("MaxDisplay")) + 1), 1).ToString() + "]", this.Namespaces) * select new * { * itemurl = CustomParse.Parse(base.GetModuleParamString("ItemURL"), networknode, this.Namespaces), * itemurltext = CustomParse.Parse(base.GetModuleParamString("ItemURLText"), networknode, this.Namespaces), * item = CustomParse.Parse(base.GetModuleParamString("ItemText"), networknode, this.Namespaces) * }; * * foreach (var i in items) * { * networkexists = true; * * documentdata.Append("<Item"); * * if (base.GetModuleParamString("ItemURL") != string.Empty) * { * documentdata.Append(" ItemURL=\"" + i.itemurl); * documentdata.Append("\""); * if (!i.itemurltext.Equals("")) documentdata.Append(" ItemURLText=\"" + i.itemurltext); * else documentdata.Append(" ItemURLText=\"" + CustomParse.Parse("{{{//rdf:Description[@rdf:about='"+ i.itemurl + "']/rdfs:label}}}", this.BaseData, this.Namespaces)); * documentdata.Append("\""); * } * documentdata.Append(">"); * documentdata.Append(i.item); * documentdata.Append("</Item>"); * } * * } * catch (Exception ex) { Framework.Utilities.DebugLogging.Log(ex.Message + " ++ " + ex.StackTrace); } */ documentdata.Append("</ItemList>"); documentdata.Append("</PassiveList>"); if (networkexists) { document.LoadXml(documentdata.ToString()); args.AddParam("root", "", Root.Domain); args.AddParam("ListNode", "", base.GetModuleParamString("ListNode")); args.AddParam("InfoCaption", "", base.GetModuleParamString("InfoCaption")); args.AddParam("Description", "", base.GetModuleParamString("Description")); args.AddParam("MoreUrl", "", base.GetModuleParamString("ListNode")); litPassiveNetworkList.Text = XslHelper.TransformInMemory(Server.MapPath("~/Profile/Modules/PassiveList/PassiveList.xslt"), args, document.OuterXml); Framework.Utilities.DebugLogging.Log("PASSIVE MODULE end Milliseconds:" + (DateTime.Now - d).TotalSeconds); } }
public void DrawProfilesModule() { DateTime d = DateTime.Now; //If your module performs a data request, based on the DataURI parameter then call ReLoadBaseData base.GetDataByURI(); XmlDocument document = new XmlDocument(); XsltArgumentList args = new XsltArgumentList(); bool networkexists = false; pl = new global::passiveList(); pl.InfoCaption = base.GetModuleParamString("InfoCaption"); pl.TotalCount = CustomParse.Parse(base.GetModuleParamString("TotalCount"), base.BaseData, base.Namespaces); pl.Description = base.GetModuleParamString("Description"); pl.ID = Guid.NewGuid().ToString(); pl.MoreText = CustomParse.Parse(base.GetModuleParamString("MoreText"), base.BaseData, base.Namespaces); pl.MoreURL = CustomParse.Parse(base.GetModuleParamString("MoreURL"), base.BaseData, base.Namespaces).Replace("amp;", ""); string path = base.GetModuleParamString("ListNode"); try { XmlNodeList items = this.BaseData.SelectNodes(path, this.Namespaces); pl.ItemList = new List <itemList>(); int remainingItems = Convert.ToInt16(base.GetModuleParamString("MaxDisplay")); foreach (XmlNode i in items) { if (remainingItems == 0) { break; } remainingItems--; XmlNode networknode = this.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[@rdf:about=\"" + i.Value + "\"]", this.Namespaces); string itemurl = CustomParse.Parse(base.GetModuleParamString("ItemURL"), networknode, this.Namespaces); string itemurltext = CustomParse.Parse(base.GetModuleParamString("ItemURLText"), networknode, this.Namespaces); string item = CustomParse.Parse(base.GetModuleParamString("ItemText"), networknode, this.Namespaces); networkexists = true; if (base.GetModuleParamString("ItemURL") != string.Empty) { if (itemurltext.Equals("")) { itemurltext = CustomParse.Parse("{{{//rdf:Description[@rdf:about='" + itemurl + "']/rdfs:label}}}", this.BaseData, this.Namespaces); } networkexists = true; pl.ItemList.Add(new itemList { ItemURL = itemurl, ItemURLText = itemurltext, Item = item, ID = pl.ID }); } } } catch (Exception ex) { Framework.Utilities.DebugLogging.Log("Passive List died " + ex.Message + " ++ " + ex.StackTrace); } if (networkexists) { passiveList.DataSource = pl.ItemList; passiveList.DataBind(); } }