Skip to content
Snippets Groups Projects
Commit e696f997 authored by S.Listl's avatar S.Listl
Browse files

360Degree: use entity titles instead of context titles

parent c27beeb8
No related branches found
No related tags found
No related merge requests found
......@@ -61,10 +61,10 @@
<name>TARGET_ID</name>
</entityField>
<entityField>
<name>CONTEXT_NAME</name>
<name>ENTITY_NAME</name>
<title>Module</title>
<groupable v="true" />
<valueProcess>%aditoprj%/entity/360Degree_entity/entityfields/context_name/valueProcess.js</valueProcess>
<valueProcess>%aditoprj%/entity/360Degree_entity/entityfields/entity_name/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>DATE</name>
......@@ -199,6 +199,9 @@
<isFilterable v="true" />
<isLookupFilter v="true" />
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>ENTITY_NAME.value</name>
</jDitoRecordFieldMapping>
</recordFieldMappings>
</jDitoRecordContainer>
</recordContainers>
......
......@@ -58,22 +58,25 @@ function _get360Data(pSelectMap, pBaseContextId, pContactId, pContextList, pActi
var data = db.table(ContextUtils.getContextDataSql(context, pContactId, true, pActive, true, pExcludedObjectIds));
data.forEach(function (row)
{
var record = [];
record[0] = util.getNewUUID(); // UID
record[1] = row[0]; // TARGET_ID
record[2] = context; // TARGET_CONTEXT
record[3] = row[1]; // TITLE
record[4] = row[2]; //DATE
var active;
if(pActive != undefined) //ACTIVE
record[5] = translate.text(pActive);
active = translate.text(pActive);
else
{
if(pSelectMap[context].activeStates && pSelectMap[context].activeStates.indexOf(row[3]) > -1)
record[5] = translate.text("true");
active = translate.text("true");
else
record[5] = translate.text("false");
active = translate.text("false");
}
resultList.push(record);
resultList.push([
util.getNewUUID(), // UID
row[0], // TARGET_ID
context, // TARGET_CONTEXT
row[1], // TITLE
row[2], //DATE
active,
ContextUtils.getEntityTitle(context, true)
]);
});
});
......
......@@ -16,7 +16,7 @@
<descriptionField>DATE</descriptionField>
<iconField>ICON</iconField>
<defaultGroupFields>
<element>CONTEXT_NAME</element>
<element>ENTITY_NAME</element>
</defaultGroupFields>
<entityField>#ENTITY</entityField>
</treeViewTemplate>
......@@ -24,7 +24,7 @@
<name>Timeline</name>
<dateField>DATE</dateField>
<titleField>TITLE</titleField>
<descriptionField>CONTEXT_NAME</descriptionField>
<descriptionField>ENTITY_NAME</descriptionField>
<entityField>#ENTITY</entityField>
</timelineViewTemplate>
</children>
......
......@@ -31,16 +31,47 @@ ContextUtils.getCurrentContextId = function()
return vars.getString("$sys.currentcontextname");
}
ContextUtils.getTitle = function(pContextId)
/**
* Returns the title of the context
*
* @param {String} pContextId id of the context
* @param {boolean} [pTranslate=false] if the title should be translated
*
* @return {String} title of the context
*/
ContextUtils.getTitle = function(pContextId, pTranslate)
{
return project.getDataModel(project.DATAMODEL_KIND_CONTEXT, pContextId)[1];
var title = project.getDataModel(project.DATAMODEL_KIND_CONTEXT, pContextId)[1];
return pTranslate ? translate.text(title) : title;
}
/**
* Returns the icon of the context
*
* @param {String} pContextId id of the context
*
* @return {String} icon of the context
*/
ContextUtils.getIcon = function(pContextId)
{
return project.getDataModel(project.DATAMODEL_KIND_CONTEXT, pContextId)[5];
}
/**
* Returns the title of the entity associated with the context
*
* @param {String} pContextId id of the context
* @param {boolean} [pTranslate=false] if the title should be translated
*
* @return {String} title of the entity
*/
ContextUtils.getEntityTitle = function (pContextId, pTranslate)
{
var entity = project.getContextStructure(pContextId).entity;
var title = project.getDataModel(project.DATAMODEL_KIND_ENTITY, entity)[1];
return pTranslate ? translate.text(title) : title;
}
/**
* TODO: use System function. Currently the Name is also the id.
* Returns the Name of a context by the Id
......
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