Skip to content
Snippets Groups Projects
Commit b38516db authored by Alexander Vögl's avatar Alexander Vögl Committed by Johannes Goderbauer
Browse files

[Projekt: Entwicklung - xRM][TicketNr.: 1061957][360 Grad: Umbenennung...

[Projekt: Entwicklung - xRM][TicketNr.: 1061957][360 Grad: Umbenennung ViewTemplate Treetable -> Tree]
[Projekt: Entwicklung - xRM][TicketNr.: 1053175][Erweiterte 360-Grad Ansicht]
parent a55b9500
No related branches found
No related tags found
No related merge requests found
Showing
with 180 additions and 146 deletions
......@@ -12,4 +12,4 @@ var type = newSelect("OBJECT_TYPE")
.where("SALESORDER.SALESORDERID", params.rowId)
.cell();
result.string(db.cell(ContextUtils.getNameSql(type, params.value)));
result.string(ContextUtils.getTitleByContext(type, params.value));
......@@ -15,6 +15,7 @@
</siblings>
<grantUpdate v="false" />
<grantDelete v="false" />
<titlePlural>Links</titlePlural>
<recordContainer>jdito</recordContainer>
<entityFields>
<entityProvider>
......@@ -25,6 +26,7 @@
</entityField>
<entityField>
<name>TITLE</name>
<title>Title</title>
<linkedContextProcess>%aditoprj%/entity/360Degree_entity/entityfields/title/linkedContextProcess.js</linkedContextProcess>
</entityField>
<entityParameter>
......@@ -71,11 +73,10 @@
<entityField>
<name>ENTITY_NAME</name>
<title>Module</title>
<groupable v="true" />
<valueProcess>%aditoprj%/entity/360Degree_entity/entityfields/entity_name/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>DATE</name>
<name>DATE_NEW</name>
<title>Date</title>
<contentType>DATE</contentType>
<resolution>DAY</resolution>
......@@ -105,12 +106,6 @@
</entityParameter>
</children>
</entityProvider>
<entityField>
<name>YEAR</name>
<title>Year</title>
<groupable v="true" />
<valueProcess>%aditoprj%/entity/360Degree_entity/entityfields/year/valueProcess.js</valueProcess>
</entityField>
<entityActionGroup>
<name>newModule</name>
<title>New module</title>
......@@ -166,13 +161,6 @@
<contentType>IMAGE</contentType>
<valueProcess>%aditoprj%/entity/360Degree_entity/entityfields/icon/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>ACTIVE</name>
<title>Active</title>
<contentType>TEXT</contentType>
<groupable v="true" />
<dropDownProcess>%aditoprj%/entity/360Degree_entity/entityfields/active/dropDownProcess.js</dropDownProcess>
</entityField>
<entityParameter>
<name>BaseContextId_param</name>
<expose v="true" />
......@@ -185,6 +173,25 @@
<name>#PROVIDER_AGGREGATES</name>
<useAggregates v="true" />
</entityProvider>
<entityField>
<name>GROUP</name>
<title>Group</title>
<groupable v="true" />
</entityField>
<entityField>
<name>DESCRIPTION</name>
<title>Description</title>
</entityField>
<entityField>
<name>YEAR</name>
<title>Year</title>
<groupable v="true" />
</entityField>
<entityField>
<name>ACTIVE</name>
<title>Active</title>
<dropDownProcess>%aditoprj%/entity/360Degree_entity/entityfields/active/dropDownProcess.js</dropDownProcess>
</entityField>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
......@@ -203,20 +210,32 @@
<jDitoRecordFieldMapping>
<name>TARGET_CONTEXT.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>TARGET_CONTEXT.displayValue</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>TITLE.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>DATE.value</name>
<name>DESCRIPTION.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>ACTIVE.value</name>
<name>DATE_NEW.value</name>
<isFilterable v="true" />
<isLookupFilter v="true" />
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>YEAR.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>ENTITY_NAME.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>GROUP.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>ACTIVE.value</name>
<isFilterable v="true" />
</jDitoRecordFieldMapping>
</recordFieldMappings>
</jDitoRecordContainer>
</recordContainers>
......
......@@ -3,9 +3,9 @@
The 360Degree_entity shows the Connection between data models.
The entity has two providers for persons and organizations.
The 360Degree_entity shows direct connections, don´t be confused with the ObjectRelation_entity.
The 360Degree_entity shows direct connections, don´t be confused with the ObjectRelation_entity.
== Adding new modules to the 360° view
== Adding new modules to the 360° view
You may want to display more modules within the 360degree view (for example after creating and implemeting your own module).
.An Example:
......@@ -14,6 +14,23 @@ display it in the 360degree view.
Heres is a list of what you need to do whenever you want to do this:
- Add an entry in the function `ContextUtils.getSelectMap` which is located in the `Context_lib` (check out the documentation there for further details). _Speaking of the example above you need to define there how to retrieve the t-shirt-data for a contact_
- At first you have to fill/add certain Fields/Processes in your new Context.
- Add (These have to be written exactly like that, if not already existing):
- CONTACT_ID, this Field has to contain a CONTACTID. That will be used to find the Connection to your Person or your Organisation.
- DATE_NEW, this Field has to contain a Date as a Long Value. That will be used as the Date Value you can see in the Timeline View-Template.
- ACTIVE, in this Field you can specify which Datasets are active or not. You have to declare that in the Value Expression as a Case-When due to the Filter
- Fill (these can be filled in the specific Entity as a Process)
- #CONTENTTITLE, this will be the main display Text and the blue Link
- #CONTENTDESCRIPTION, this will be the smaller, mostly longer, Text beneath the #CONTENTTITLE
- Add an elemnt (with the name of the context you want to add) in the process of the `ObjectType_param` in the *corresponding provider* which is located in the `360Degree_entity`. _We would extend the JSON-Object which is returned in the `PersonObjects`-provider by the name of our t-shirt-context: "TShirt" in our example
-
- In that JSON-Object can also add some Configuration Elements to change the results.
- setGroupBy: here you can declare a DB-Column that will be used as the new group by of that context. A good example is Order. We want to group by the Ordertype so we have to declare ORDERTYPE as our groupBy.
- If your DB-Value is related to a Keyword you also have to use groupByKeyword and add the Container as Value
- Add an entry (with the name of the context you want to add) in the process of the `ObjectType_param` in the *corresponding provider* which is located in the `360Degree_entity`. _We would extend the array which is returned in the `PersonObjects`-provider by the name of our t-shirt-context: "TShirt" in our example_
\ No newline at end of file
- If you have a Connection of 1:N in your Database Schema (like Activity and ActivityLink) you have to add specific Properties in your Context Object. Lets take ActivityLink as a Example.
- subContext: the Name of the "Link"-Context -> ActivityLink
- childField: The Field where the LinkID to your Parent is stored -> ACTIVITY_ID
- parentField: The field in your Parent Context where your Connection to your Child is stored -> ACTIVITYID
- contactIdField: The Field in the Link Context where your Contactid is stored -> OBJECT_ROWID
\ No newline at end of file
......@@ -7,11 +7,11 @@ if (contextList)
{
var found = false;
contextList.forEach(function (context)
for(context in contextList)
{
if(context == "Campaign")
found = true;
});
}
if(found)
result.string(neon.COMPONENTSTATE_AUTO);
else
......
......@@ -6,11 +6,11 @@ var contextList = JSON.parse(vars.getString("$param.ObjectType_param"));
if (contextList)
{
var found = false;
contextList.forEach(function (context)
for(context in contextList)
{
if(context == "Contract")
found = true;
});
}
if(found)
result.string(neon.COMPONENTSTATE_AUTO);
else
......
......@@ -6,11 +6,11 @@ var contextList = JSON.parse(vars.getString("$param.ObjectType_param"));
if (contextList)
{
var found = false;
contextList.forEach(function (context)
for(context in contextList)
{
if(context == "Offer")
found = true;
});
}
if(found)
result.string(neon.COMPONENTSTATE_AUTO);
else
......
......@@ -6,11 +6,11 @@ var contextList = JSON.parse(vars.getString("$param.ObjectType_param"));
if (contextList)
{
var found = false;
contextList.forEach(function (context)
for(context in contextList)
{
if(context == "Order")
found = true;
});
}
if(found)
result.string(neon.COMPONENTSTATE_AUTO);
else
......
......@@ -7,11 +7,11 @@ if (contextList)
{
var found = false;
contextList.forEach(function (context)
for(context in contextList)
{
if(context == "Salesproject")
found = true;
});
}
if(found)
result.string(neon.COMPONENTSTATE_AUTO);
else
......
......@@ -3,4 +3,21 @@ import("system.result");
//No campaign, since a campaign can only be linked with a person.
//Even when all entries of persons are displayed in the organisation_entity: It's still nonsense to display campaigns per status.
result.object(["Salesproject", "Offer", "Order", "Contract", "SupportTicket"]);
\ No newline at end of file
var res = {
"Salesproject": {},
"Offer": {},
"Order": {
"setGroupBy":"ORDERTYPE",
"groupByKeyword":"OrderType"
},
"Contract": {},
"SupportTicket": {
"subContext":"TaskLink",
"childField":"TASK_ID",
"parentField":"TASK_TASKID",
"contactIdField":"OBJECT_ROWID"
}
}
result.string(JSON.stringify(res))
\ No newline at end of file
import("system.vars");
import("system.result");
result.object(["Offer", "Contract", "Campaign", "Order", "SupportTicket"]);
\ No newline at end of file
var res = {
"Offer": {},
"Order": {
"setGroupBy":"ORDERTYPE"
},
"Contract": {},
"SupportTicket": {},
"Campaign": {}
}
result.string(JSON.stringify(res))
\ No newline at end of file
import("system.util");
import("system.db");
import("system.vars");
import("system.datetime");
import("system.logging");
import("Util_lib");
import("system.translate");
import("system.result");
import("system.vars");
import("Context_lib");
import("system.translate");
import("Keyword_lib");
if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param") && vars.exists("$param.ObjectRowId_param") && vars.get("$param.ObjectRowId_param"))
{
var active;
var selectMap = ContextUtils.getSelectMap();
if(vars.exists("$local.filter") && vars.get("$local.filter") )
{
var filter = vars.get("$local.filter");
if (filter.filter)
if(filter.filter.childs != null && filter.filter.childs.length > 0)
{
filter.filter.childs.forEach(function(child)
{
if(child.name === "ACTIVE")
active = child.key == 'true';
});
}
}
var contextList = JSON.parse(vars.getString("$param.ObjectType_param"));
var contactId = vars.get("$param.ObjectRowId_param");
var idValues;
if (vars.exists("$local.idvalues"))
idValues = vars.get("$local.idvalues");
var res = _get360Data(selectMap, contactId, contextList, active, idValues);
result.object(res);
if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param")
&& vars.exists("$param.ObjectRowId_param") && vars.get("$param.ObjectRowId_param"))
{
var contextList = JSON.parse(vars.get("$param.ObjectType_param"));
var contactId = JSON.parse(vars.get("$param.ObjectRowId_param"));
var data = _get360Data(contactId, contextList);
result.object(data);
}
else
{
......@@ -38,79 +22,65 @@ else
}
/**
* load all data for the 360Degree tree.
* @param {Object} pSelectMap the select map (result of ContextUtils.getSelectMap())
* @param {String[]} pContactId the Contactid the 360 Degree tree should be loaded for
* @param {String[]} pContextList list of contexts to load. Note that subcontexts use their own list, defined in ContextUtils
* @param {Boolean} [pActive=undefined] if not undefined: it select only for active / inactive state
* @param {Array} [pUids=undefined] uids of the 360° entity that are used for filtering, each rowId needs the format:
* {id: "«rowid»", type: "«context id»"}
* collects all data for the 360Degree tree.
* @param {String} pContactId, the main Contactid that will be used for the Connections
* @param {String[]} pContextList, a list of Contexts that should be displayed
*
* @return {String[][]} the resulting data
*/
function _get360Data(pSelectMap, pContactId, pContextList, pActive, pUids)
function _get360Data(pContactId, pContextList)
{
//if there are uids for filtering, group them per context:
var uidContextMap = new Map();//Map where key is the type (contextname) and value is an array of the rowIds for that type
if (pUids)
{
pUids.forEach(function (uid){
uid = JSON.parse(uid);
if (uidContextMap.has(uid.type))
uidContextMap.get(uid.type).push(uid.id);
else
uidContextMap.set(uid.type, [uid.id]);
});
}
var resultList = [];
pContextList.forEach(function (context)
var filter = vars.get("$sys.filter");
for(var context in pContextList)
{
var rowIds;
if (pUids)
{
//when a Uid-filter exists, but there is no context for filtering we can skip that context,
//otherwise we need to filter for the found row ids of that context
if (!uidContextMap.has(context))
return;
else
rowIds = uidContextMap.get(context);
}
var data = db.table(ContextUtils.getContextDataSql(context, JSON.parse(pContactId), true, pActive, true, true, rowIds));
data.forEach(function (row)
var group = context;
if(pContextList[context].hasOwnProperty("setGroupBy") && pContextList[context].hasOwnProperty("groupByKeyword"))
var groupKeyword = Utils.objectFromMap(new Map(KeywordUtils.getEntryNamesAndIdsByContainer(pContextList[context]["groupByKeyword"])));
var res = ContextUtils.getContextDataViaReadEntity(context, pContextList[context], filter, pContactId);
if(res.length > 0)
{
var active;
if(pActive != undefined) //ACTIVE
active = translate.text(pActive);
else
res.forEach(function (row)
{
if(pSelectMap[context].activeStates && pSelectMap[context].activeStates.indexOf(row[3]) > -1)
active = translate.text("true");
else
active = translate.text("false");
}
var groupBy = row[4];
if(groupBy == "")
groupBy = ContextUtils.getEntityTitle(context, true);
var uid = JSON.stringify({id: row[0], type: context});
resultList.push([
uid, // UID
row[0], // TARGET_ID
context, // TARGET_CONTEXT
row[1], // TITLE
row[2], //DATE
active,
groupBy
]);
});
});
resultList.sort(function (a,b) {
if (a[4] < b[4]) return 1;
if (a[4] > b[4]) return -1;
return 0;
})
var uid = JSON.stringify({
"id": row["#UID"],
"type": context
});
var targetid = row["#UID"];
var title = row["#CONTENTTITLE"];
var description = row["#CONTENTDESCRIPTION"];
var dataDate = row["DATE_NEW"];
var active = row["ACTIVE"];
if(pContextList[context].hasOwnProperty("setGroupBy"))
group = row[pContextList[context]["setGroupBy"]]
if(pContextList[context].hasOwnProperty("setGroupBy"))
{
if( pContextList[context].hasOwnProperty("groupByKeyword") && groupKeyword)
group = groupKeyword[row[pContextList[context]["setGroupBy"]]]
else
group = row[pContextList[context]["setGroupBy"]]
}
resultList.push([
uid, // UID
targetid, // TARGET_ID
context, // TARGET_CONTEXT
translate.text(pContextList[context]), // TARGET_CONTEXT.displayValue
title, // TITLE
description, // DESCRIPTION
dataDate, // DATE
datetime.toDate(dataDate, "yyyy"), // YEAR
ContextUtils.getEntity(context), // ENTITY_NAME
translate.text(group), // GROUP
active // ACTIVE
]);
});
}
}
var sortArr = [9, false]
resultList = ArrayUtils.sortMulti(resultList, sortArr)
return resultList;
}
\ No newline at end of file
......@@ -7,5 +7,5 @@ import("Context_lib");
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.OBJECT_ROWID")) {
result.string("");
} else if (vars.exists("$field.OBJECT_TYPE") && vars.get("$field.OBJECT_TYPE")) {
result.string(db.cell(ContextUtils.getNameSql(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID"))));
result.string(ContextUtils.getTitleByContext(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID")));
}
\ No newline at end of file
......@@ -7,5 +7,5 @@ import("Context_lib");
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.OBJECTID")) {
result.string("");
} else if (vars.exists("$field.OBJECTTYPE") && vars.get("$field.OBJECTTYPE")) {
result.string(db.cell(ContextUtils.getNameSql(vars.get("$field.OBJECTTYPE"), vars.get("$field.OBJECTID"))));
result.string(ContextUtils.getTitleByContext(vars.get("$field.OBJECTTYPE"), vars.get("$field.OBJECTID")));
}
\ No newline at end of file
......@@ -78,10 +78,6 @@
<fieldName>Exclusive</fieldName>
</dependency>
<children>
<entityParameter>
<name>GetAllContexts_param</name>
<valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/context/children/getallcontexts_param/valueProcess.js</valueProcess>
</entityParameter>
<entityParameter>
<name>Blacklist_param</name>
<valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/context/children/blacklist_param/valueProcess.js</valueProcess>
......
import("system.result");
result.string(true);
\ No newline at end of file
......@@ -319,10 +319,6 @@
<name>Blacklist_param</name>
<valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/contexts/children/blacklist_param/valueProcess.js</valueProcess>
</entityParameter>
<entityParameter>
<name>GetAllContexts_param</name>
<valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/contexts/children/getallcontexts_param/valueProcess.js</valueProcess>
</entityParameter>
<entityParameter>
<name>InvertBlacklist_param</name>
<valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js</valueProcess>
......
import("system.result");
result.string(true);
\ No newline at end of file
......@@ -11,6 +11,7 @@
</siblings>
<grantDeleteProcess>%aditoprj%/entity/CampaignStep_entity/grantDeleteProcess.js</grantDeleteProcess>
<contentTitleProcess>%aditoprj%/entity/CampaignStep_entity/contentTitleProcess.js</contentTitleProcess>
<contentDescriptionProcess>%aditoprj%/entity/CampaignStep_entity/contentDescriptionProcess.js</contentDescriptionProcess>
<onValidation>%aditoprj%/entity/CampaignStep_entity/onValidation.js</onValidation>
<imageProcess>%aditoprj%/entity/CampaignStep_entity/imageProcess.js</imageProcess>
<titlePlural>Steps</titlePlural>
......
import("system.translate");
import("system.datetime");
import("system.result");
import("system.vars");
var dateVal = vars.get("$field.DATE");
result.string(datetime.toDate(dateVal, "yyyy"));
\ No newline at end of file
import("system.result");
result.string(datetime.toDate(vars.get("$field.DATE_NEW"), translate.text("dd.MM.yyyy")));
\ No newline at end of file
......@@ -13,6 +13,7 @@
</siblings>
<grantDeleteProcess>%aditoprj%/entity/Campaign_entity/grantDeleteProcess.js</grantDeleteProcess>
<contentTitleProcess>%aditoprj%/entity/Campaign_entity/contentTitleProcess.js</contentTitleProcess>
<contentDescriptionProcess>%aditoprj%/entity/Campaign_entity/contentDescriptionProcess.js</contentDescriptionProcess>
<afterUiInit>%aditoprj%/entity/Campaign_entity/afterUiInit.js</afterUiInit>
<useFavorites v="true" />
<iconId>VAADIN:GROUP</iconId>
......@@ -552,6 +553,9 @@
<name>#PROVIDER_AGGREGATES</name>
<useAggregates v="true" />
</entityProvider>
<entityField>
<name>ACTIVE</name>
</entityField>
</entityFields>
<recordContainers>
<dbRecordContainer>
......@@ -667,6 +671,10 @@
<isFilterable v="true" />
<filtertype>BASIC</filtertype>
</consumerMapping>
<dbRecordFieldMapping>
<name>ACTIVE.value</name>
<expression>%aditoprj%/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js</expression>
</dbRecordFieldMapping>
</recordFieldMappings>
<filterExtensions>
<filterExtensionSet>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment