Skip to content

Commit 94860ae

Browse files
committed
Merge branch 'release/v1.2'
2 parents 2bb7617 + aa513ee commit 94860ae

File tree

12 files changed

+586
-22
lines changed

12 files changed

+586
-22
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<AML>
2+
<Item type="Action" id="7EF4F89C64FE405899DCF81F3E3A230F" action="add">
3+
<item_query>&lt;Item type="{@type}" id="{@id}" levels= "1" action="get" /&gt;</item_query>
4+
<label xml:lang="en">Create New From Template</label>
5+
<location>client</location>
6+
<method keyed_name="labs_SpawnFromTemplate" type="Method">
7+
<Item type="Method" action="get" select="id">
8+
<name>labs_SpawnFromTemplate</name>
9+
</Item>
10+
</method>
11+
<target>none</target>
12+
<type>item</type>
13+
<name>Create New From Template</name>
14+
</Item>
15+
</AML>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<AML>
2+
<Item type="Identity" id="8DA368B8CDC14820813772B2E50A7A87" action="add">
3+
<_eto_balance>0.00</_eto_balance>
4+
<_eto_earned>0.00</_eto_earned>
5+
<description>Creates and manages template Documents</description>
6+
<is_alias>0</is_alias>
7+
<name>Technical Document Template Admin</name>
8+
<Relationships />
9+
</Item>
10+
<Item type="Member" id="D0820001CB7747BA894A6014D89F5ED3" action="add">
11+
<related_id keyed_name="Technical Document Administrator" type="Identity">719FA509EF8C4944AEEF468604A85E1D</related_id>
12+
<sort_order>128</sort_order>
13+
<source_id keyed_name="Technical Document Template Admin" type="Identity">8DA368B8CDC14820813772B2E50A7A87</source_id>
14+
</Item>
15+
</AML>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<AML>
2+
<Item type="Method" id="85B2E8A0DA9F495687E42CD6A570EED0" action="add">
3+
<comments>onBeforeAdd/Update event checks if user can set is_template flag</comments>
4+
<execution_allowed_to keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</execution_allowed_to>
5+
<method_code><![CDATA[/*
6+
* Author: Eli Donahue (Aras Labs)
7+
* Name: labs_CheckTemplateAdmin
8+
* Description: If context contains is_template=1, check user permissions
9+
* Params: this = tp_Block item
10+
* Preconditions: n/a
11+
********************************************************************************
12+
* 09-05-2017 : Packaged for deployment to MyI
13+
*/
14+
15+
if (this.getProperty("is_template","0") == "0")
16+
return this;
17+
18+
// check if current user is a tech doc template admin
19+
string techDocTemplateAdminId = "8DA368B8CDC14820813772B2E50A7A87";
20+
string userids = Aras.Server.Security.Permissions.Current.IdentitiesList;
21+
22+
if (userids.IndexOf(techDocTemplateAdminId) >= 0)
23+
return this;
24+
25+
// if still here, user is not an admin. throw error
26+
Innovator inn = this.getInnovator();
27+
return inn.newError("The current user is not a Template Admin and cannot save Tech Doc templates.");]]></method_code>
28+
<method_type>C#</method_type>
29+
<name>labs_CheckTemplateAdmin</name>
30+
</Item>
31+
</AML>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<AML>
2+
<Item type="Method" id="A552DA928F1347639375D2DDABAA9047" action="add">
3+
<comments>onBeforeCopy event to confirm tp_Block is template and rename new doc</comments>
4+
<execution_allowed_to keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</execution_allowed_to>
5+
<method_code><![CDATA[/*
6+
* Author: Eli Donahue (Aras Labs)
7+
* Name: labs_ConfirmTechDocIsTemplate
8+
* Description: Confirms onBeforeCopy that context item is a template tp_Block.
9+
* If so, set the name of new document. Else, return error.
10+
* Params: this = tp_Block item
11+
* Preconditions: is_template = 1 on context item
12+
********************************************************************************
13+
* 09-01-2017 : Packaged for deployment to MyI
14+
*/
15+
16+
Innovator inn = this.getInnovator();
17+
Item template = inn.getItemById("tp_Block",this.getID());
18+
19+
bool is_template = template.getProperty("is_template","0") == "0";
20+
string name = template.getProperty("name","");
21+
22+
if (is_template)
23+
return inn.newError("Tech Doc '" + name + "' is not a template document!");
24+
25+
this.setAttribute("useInputProperties", "1");
26+
this.setProperty("name","New from Template : " + name);
27+
28+
return this;]]></method_code>
29+
<method_type>C#</method_type>
30+
<name>labs_ConfirmTechDocIsTemplate</name>
31+
</Item>
32+
</AML>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<AML>
2+
<Item type="Method" id="4E18C9B596F04437BEFBBE8B52696EAF" action="add">
3+
<comments>Disables is_template field on tp_Block form for non-admin users</comments>
4+
<execution_allowed_to keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</execution_allowed_to>
5+
<method_code><![CDATA[/*
6+
* Author: Eli Donahue (Aras Labs)
7+
* Name: labs_DisableIsTemplate
8+
* Description: Disables is_template field on tp_Block form for non-admin users
9+
* Params: n/a
10+
* Preconditions: n/a
11+
********************************************************************************
12+
* 09-01-2017 : Packaged for deployment to MyI
13+
*/
14+
15+
var inn = document.thisItem.getInnovator();
16+
17+
// check if current user is a tech doc template admin
18+
var techDocTemplateAdminId = "8DA368B8CDC14820813772B2E50A7A87";
19+
var userIds = aras.getIdentityList().split(',');
20+
21+
if (userIds.indexOf(techDocTemplateAdminId) >= 0)
22+
return;
23+
24+
// if not an admin, disable the is_template field
25+
var is_template = getFieldByName("is_template").getElementsByTagName("input")[0];
26+
is_template.disabled = true;
27+
]]></method_code>
28+
<method_type>JavaScript</method_type>
29+
<name>labs_DisableIsTemplate</name>
30+
</Item>
31+
</AML>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<AML>
2+
<Item type="Method" id="4F6F124DC15745B88805451F595D3D53" action="add">
3+
<comments>onAfterCopy event to remove is_template flag from copied tech doc</comments>
4+
<execution_allowed_to keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</execution_allowed_to>
5+
<method_code><![CDATA[/*
6+
* Author: Eli Donahue (Aras Labs)
7+
* Name: labs_RemoveIsTemplateFlag
8+
* Description: onAfterCopy event to remove is_template flag from copied tech doc
9+
* Params: this = tp_Block item
10+
* Preconditions: n/a
11+
********************************************************************************
12+
* 09-01-2017 : Packaged for deployment to MyI
13+
*/
14+
15+
this.setProperty("is_template","0");
16+
this.setAction("edit");
17+
18+
Item res = this.apply();
19+
return res;]]></method_code>
20+
<method_type>C#</method_type>
21+
<name>labs_RemoveIsTemplateFlag</name>
22+
</Item>
23+
</AML>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<AML>
2+
<Item type="Method" id="2EF6C0DAB917479C8C88227EE150638E" action="add">
3+
<comments>Calls copyAsNew to create new doc from the context tp_Block item</comments>
4+
<execution_allowed_to keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</execution_allowed_to>
5+
<method_code><![CDATA[/*
6+
* Author: Eli Donahue (Aras Labs)
7+
* Name: labs_SpawnFromTemplate
8+
* Description: Calls copyAsNew to create new doc from the context tp_Block item.
9+
* onBeforeCopy/onAfterCopy events set special properties on doc.
10+
* Params: this = tp_Block item
11+
* Preconditions: is_template = 1 on context item
12+
********************************************************************************
13+
* 09-01-2017 : Packaged for deployment to MyI
14+
*/
15+
16+
var inn = this.getInnovator();
17+
var thisId = this.getID();
18+
var thisDoc = inn.getItemById("tp_Block",thisId);
19+
20+
thisDoc.setAction("copyAsNew");
21+
thisDoc = thisDoc.apply();
22+
23+
// show new doc window after it is created
24+
aras.uiShowItem("tp_Block", thisDoc.getID(), "tab view");]]></method_code>
25+
<method_type>JavaScript</method_type>
26+
<name>labs_SpawnFromTemplate</name>
27+
</Item>
28+
</AML>

0 commit comments

Comments
 (0)