Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
basic
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Gitlab Maintenance 28.03.2025 | 20:00 - 23:00 MEZ
Show more breadcrumbs
xrm
basic
Commits
7eae3c72
Commit
7eae3c72
authored
4 years ago
by
Alexander Vögl
Browse files
Options
Downloads
Patches
Plain Diff
add missing code piece
parent
dd4dddda
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
entity/360Degree_entity/recordcontainers/jdito/contentProcess.js
+86
-59
86 additions, 59 deletions
...360Degree_entity/recordcontainers/jdito/contentProcess.js
with
86 additions
and
59 deletions
entity/360Degree_entity/recordcontainers/jdito/contentProcess.js
+
86
−
59
View file @
7eae3c72
import
(
"
JditoFilter_lib
"
);
import
(
"
system.eMath
"
);
import
(
"
system.logging
"
);
import
(
"
system.util
"
);
import
(
"
system.db
"
);
import
(
"
system.vars
"
);
import
(
"
system.result
"
);
import
(
"
Context_lib
"
);
import
(
"
system.translate
"
);
import
(
"
system.datetime
"
);
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
=
filterData
(
_get360Data
(
contactId
,
contextList
));
result
.
object
(
data
);
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
);
}
else
{
...
...
@@ -24,66 +39,78 @@ else
/**
* load all data for the 360Degree tree.
* @param {String} pContactId the select map (result of ContextUtils.getContextDataSqlviaReadEntity())
* @param {String[]} pContextList the Contactid the 360 Degree tree should be loaded for
* @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»"}
*
* @return {String[][]} the resulting data
*/
function
_get360Data
(
pContactId
,
pContextList
)
function
_get360Data
(
pSelectMap
,
pContactId
,
pContextList
,
pActive
,
pUids
)
{
//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
=
[];
for
(
var
i
=
0
;
i
<
pContextList
.
length
;
i
++
)
pContextList
.
forEach
(
function
(
context
)
{
var
r
es
=
ContextUtils
.
getContextDataSqlviaReadEntity
(
pContextList
[
i
],
pContact
Id
)
;
res
.
forEach
(
function
(
row
)
var
r
ow
Id
s
;
if
(
pUids
)
{
var
targetid
=
row
[
"
#UID
"
];
var
title
=
row
[
"
#CONTENTTITLE
"
];
var
description
=
row
[
"
#CONTENTDESCRIPTION
"
];
var
dataDate
=
row
[
"
DATE_NEW
"
];
var
group
=
pContextList
[
i
];
//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
active
;
if
(
pActive
!=
undefined
)
//ACTIVE
active
=
translate
.
text
(
pActive
);
else
{
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
([
util
.
getNewUUID
(),
// UID
targetid
,
// TARGET_ID
pContextList
[
i
],
// TARGET_CONTEXT
translate
.
text
(
pContextList
[
i
]),
// TARGET_CONTEXT.displayValue
title
,
// TITLE
description
,
// DESCRIPTION
dataDate
,
// DATE
dataDate
,
// YEAR
ContextUtils
.
getEntity
(
pContextList
[
i
]),
// ENTITY_NAME
translate
.
text
(
group
)
// GROUP
uid
,
// UID
row
[
0
],
// TARGET_ID
context
,
// TARGET_CONTEXT
row
[
1
],
// TITLE
row
[
2
],
//DATE
active
,
groupBy
]);
});
}
}
);
resultList
.
sort
(
function
(
a
,
b
)
{
if
(
a
[
6
]
<
b
[
6
])
return
1
;
if
(
a
[
6
]
>
b
[
6
])
return
-
1
;
if
(
a
[
4
]
<
b
[
4
])
return
1
;
if
(
a
[
4
]
>
b
[
4
])
return
-
1
;
return
0
;
})
return
resultList
;
}
function
filterData
(
data
)
{
var
filter
=
vars
.
get
(
"
$local.filter
"
)
var
filterFields
=
[
"
UID
"
,
"
TARGET_ID
"
,
"
TARGET_CONTEXT
"
,
""
,
"
TITLE
"
,
"
DESCRIPTION
"
,
"
DATE
"
,
"
YEAR
"
,
"
ENTITY_NAME
"
,
"
GROUP
"
];
data
=
JditoFilterUtils
.
filterRecords
(
filterFields
,
data
,
filter
.
filter
);
return
data
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment