Skip to content

Commit f6b8cab

Browse files
Merge pull request #5 from asebastian-aras/master
v1.3 release
2 parents 94860ae + bf1d15b commit f6b8cab

File tree

4 files changed

+908
-1
lines changed

4 files changed

+908
-1
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<AML>
2+
<Item type="Method" id="20BC2F7D9CAB40709B0DB8FE2447513C" action="add">
3+
<execution_allowed_to keyed_name="Administrators" type="Identity">2618D6F5A90949BAA7E920D1B04C7EE1</execution_allowed_to>
4+
<method_code><![CDATA[//MethodTemplateName=CSharp:Aras.TDF.ContentGenerator(Strict);
5+
ItemDocumentElement targetItem = targetElement as ItemDocumentElement;
6+
if (targetItem != null) {
7+
targetItem.ClearChilds();
8+
9+
10+
// if referenced item was set, then
11+
if (!targetItem.IsEmpty)
12+
{
13+
TableDocumentElement tableElement = (TableDocumentElement) this.Factory.NewTable("Table", 3, 3);
14+
tableElement.GetCell(0, 0).AddChild(this.Factory.NewText("Title","Part with link"));
15+
for (int i = 0; i < tableElement.CellCount; i++)
16+
{
17+
tableElement.MergeCells(0, i, MergeDirection.Right);
18+
}
19+
20+
tableElement.GetCell(1, 0).AddChild(this.Factory.NewText("Title", "Name"));
21+
tableElement.GetCell(1, 1).AddChild(this.Factory.NewText("Title", "Classification"));
22+
tableElement.GetCell(1, 2).AddChild(this.Factory.NewText("Title", "Status"));
23+
24+
25+
//iterate through test cases
26+
//create a text element which we can modify
27+
var baseText = this.Factory.NewText("Text", targetItem.GetItemProperty("name",""));
28+
//work down to the attributes to get the ownerDocument
29+
var children = baseText.Childs[0];
30+
var origins = children.Origin;
31+
var attributes = origins.Attributes;
32+
XmlDocument doc = baseText.Childs[0].Origin.OwnerDocument;
33+
//set the attributes which we'll append to our baseText element
34+
XmlAttribute link = doc.CreateAttribute("link");
35+
link.Value = "true";
36+
XmlAttribute linktype = doc.CreateAttribute("linktype");
37+
linktype.Value = "url";
38+
string innUrl = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;
39+
innUrl = innUrl.Replace("Server/InnovatorServer.aspx","");
40+
innUrl += "?StartItem=part:"+ targetItem.GetItemProperty("id","") +":current";
41+
XmlAttribute url = doc.CreateAttribute("url");
42+
url.Value = innUrl;
43+
//append to baseText
44+
baseText.Childs[0].Origin.Attributes.Append(link);
45+
baseText.Childs[0].Origin.Attributes.Append(linktype);
46+
baseText.Childs[0].Origin.Attributes.Append(url);
47+
//populate the other columns
48+
tableElement.GetCell(2, 0).AddChild(baseText);
49+
tableElement.GetCell(2, 1).AddChild(this.Factory.NewText("Text", targetItem.GetItemProperty("classification","")));
50+
tableElement.GetCell(2, 2).AddChild(this.Factory.NewText("Text", targetItem.GetItemProperty("state", " ")));
51+
targetItem.AddChild(tableElement);
52+
}
53+
54+
}]]></method_code>
55+
<method_type>C#</method_type>
56+
<name>labs_PartLinkGenerator</name>
57+
</Item>
58+
</AML>

0 commit comments

Comments
 (0)